putting a cottages:pitchfork in an item frame duplicates it #717

Closed
opened 2021-07-17 05:03:39 +00:00 by Diaeresis · 6 comments

pitchfork is not being removed from the player inventory upon placement in the item frame

pitchfork is not being removed from the player inventory upon placement in the item frame
Author

Also, when it is taken out of the item frame again, it is a cottages:pitchfork_placed, which is stackable unlike the original item.

Also, when it is taken out of the item frame again, it is a cottages:pitchfork_placed, which is stackable unlike the original item.

Compare #670

Compare #670
AliasAlreadyTaken added the
1. kind/bug
3. source/mod upstream
labels 2021-07-18 05:10:15 +00:00
Styxcolor added the
4. step/question
label 2021-11-03 03:27:41 +00:00
Member

This is really interesting. The 2 bugs here are discrete - that the pitchfork is not removed from the player's inventory, and that it turns into the distinct "placed" variant when used on an itemframe.

The locus of the bug is in this code from cottages:

minetest.rotate_and_place(ItemStack("cottages:pitchfork_placed"), placer, pointed_thing)
-- did the placing succeed?
local nnode = minetest.get_node(pos)
if( not(nnode) or not(nnode.name) or nnode.name ~= "cottages:pitchfork_placed") then
        return nil
end
local meta = minetest.get_meta(pos)
meta:set_int( "wear", itemstack:get_wear())
meta:set_string("infotext", S("pitchfork (for hay and straw)"))
-- the tool has been placed; consume it
return ItemStack("")

I'm not sure what the correct code looks like. Part of the issue is not checking the return value of minetest.rotate_and_place, but by that point, the wrong item is already in the frame.

This is really interesting. The 2 bugs here are discrete - that the pitchfork is not removed from the player's inventory, and that it turns into the distinct "placed" variant when used on an itemframe. The locus of the bug is in this code from cottages: ```lua minetest.rotate_and_place(ItemStack("cottages:pitchfork_placed"), placer, pointed_thing) -- did the placing succeed? local nnode = minetest.get_node(pos) if( not(nnode) or not(nnode.name) or nnode.name ~= "cottages:pitchfork_placed") then return nil end local meta = minetest.get_meta(pos) meta:set_int( "wear", itemstack:get_wear()) meta:set_string("infotext", S("pitchfork (for hay and straw)")) -- the tool has been placed; consume it return ItemStack("") ``` I'm not sure what the correct code looks like. Part of the issue is not checking the return value of `minetest.rotate_and_place`, but by that point, the wrong item is already in the frame.
Member

This behavior also prevents you from repairing the pitchfork in an anvil - but because right-clicking the anvil tries to put the pitchfork_placed in there, which isn't a damaged tool (!). You can use the electrumese pick to successfully put it the anvil for the moment, but that is "fixed" in #1701.

This behavior also prevents you from repairing the pitchfork in an anvil - but because right-clicking the anvil tries to put the `pitchfork_placed` in there, which isn't a damaged tool (!). You can use the electrumese pick to successfully put it the anvil for the moment, but that is "fixed" in #1701.
flux added the
3. source/integration
label 2022-05-28 18:59:57 +00:00
Member

Fixed by just making sure to call a the node's "on_rightclick" behavior before trying to place the pitchfork: 4fc9b84793

Fixed by just making sure to call a the node's "on_rightclick" behavior before trying to place the pitchfork: https://gitea.your-land.de/your-land/yl_commons/commit/4fc9b8479324126a78c8cae0eece311e8c3ba827
flux added
4. step/ready to QA test
and removed
4. step/question
labels 2022-06-06 18:59:20 +00:00
AliasAlreadyTaken added this to the 1.1.112 milestone 2022-06-07 10:21:49 +00:00
flux added
5. result/fixed
and removed
4. step/ready to QA test
labels 2022-06-07 16:07:23 +00:00
Member

this is live

this is live
flux closed this issue 2022-06-07 23:17:29 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: your-land/bugtracker#717
No description provided.