I confirm there is an issue with the 2x2 in 5.1, using sfinv.
FWIW, I disabled it entirely. It allows to make a craft table on the spot, which kind of defeats its purpose. In the same "hard mode survival" spirit, one could consider making the crafting recipe of the table optional too. The game designer can come up with ways for the players to get them (quests, NPC trade, dungeon loot, ...).
I guess it is difficult to deal with the bazillion of inventory mods in this context. It is not clear to me what register_craft_predict() does, but it seems it could be used to prevent crafting (that would avoid touching existing formspecs). I could try it myself, but I am not familiar with formspecs and inventories, so I am afraid of missing some corner case even if it is appears to work.
Also, is there a reason why the inventory of the table is dropped when one closes the formspec? I was expecting a behavior similar to furnaces and chests (one cannot remove the node if it is not "empty").
-- Clear metadata when exit from craft table formspec
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname == "craft_table:craft_table" and fields.quit then
local meta = player:get_meta()
drop_craft(player, minetest.deserialize(meta:get_string("craft_table:craft_table_pos")))
meta:set_string("craft_table:craft_table_pos", "")
meta:set_string("craft_table:craft_table_grid", "2x2") --maybe should add this line to return to 2x2 mode after finishing accessing the table
end
end)
Astrobe wrote:
Also, is there a reason why the inventory of the table is dropped when one closes the formspec? I was expecting a behavior similar to furnaces and chests (one cannot remove the node if it is not "empty").
Well, technically the items are on the table, just take them back. XD
-- Clear metadata when exit from craft table formspec
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname == "craft_table:craft_table" and fields.quit then
local meta = player:get_meta()
drop_craft(player, minetest.deserialize(meta:get_string("craft_table:craft_table_pos")))
meta:set_string("craft_table:craft_table_pos", "")
meta:set_string("craft_table:craft_table_grid", "2x2") --maybe should add this line to return to 2x2 mode after finishing accessing the table
end
end)
I could do that, but is is not the safest way to return the inventory 2x2 because it can be changed by another mod, that is, I must always define this the moment the inventory is accessed.
Astrobe wrote:
Also, is there a reason why the inventory of the table is dropped when one closes the formspec? I was expecting a behavior similar to furnaces and chests (one cannot remove the node if it is not "empty").
Well, technically the items are on the table, just take them back. XD
Sure but is there a technical reason why they are "popped"? I figured out after some use that this behavior is probably intended to prevent players from forgetting something there, but OTOH when you realize you miss an ingredient in the middle of a craft that you have to fetch from some chest, you have to restart from scratch.
For my game I don't mind the former but the latter is a bit annoying. I also believe that items could vanish if a player is disconnected and cannot come back in time. So if you tell me there is no corner case that forced the implementation of that behavior, I can try to change it.
if you allow items to stay on the bench (like a chest) allow other players to pick up your items while you use them. furthermore i don't know how to code this, since the crafting grid is an player attribute (and not a node attribute). maybe there is a way but it doesn't seem viable.