mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-08-23 18:37:24 +02:00
Fix no craftgrid drop after close; fix creative
The 2nd bug in Creative Mode was that the inventory got reset each time you closed it.
This commit is contained in:
parent
835d5592ec
commit
d4d7d8792f
@ -335,8 +335,6 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, show, p
|
|||||||
end
|
end
|
||||||
if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
|
if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
|
||||||
|
|
||||||
-- inventory marker
|
|
||||||
formspec = formspec .. "cin"
|
|
||||||
|
|
||||||
player:set_inventory_formspec(formspec)
|
player:set_inventory_formspec(formspec)
|
||||||
end
|
end
|
||||||
|
@ -103,9 +103,7 @@ local function set_inventory(player, armor_change_only)
|
|||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[current_player;craft]"..
|
"listring[current_player;craft]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[detached:"..player_name.."_armor;armor]"..
|
"listring[detached:"..player_name.."_armor;armor]"
|
||||||
-- inventory marker
|
|
||||||
"inv"
|
|
||||||
|
|
||||||
player:set_inventory_formspec(form)
|
player:set_inventory_formspec(form)
|
||||||
end
|
end
|
||||||
@ -124,22 +122,17 @@ local function set_workbench(player)
|
|||||||
"image_button[8,0;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
"image_button[8,0;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
||||||
"tooltip[__mcl_craftguide;Show crafting recipes]"..
|
"tooltip[__mcl_craftguide;Show crafting recipes]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[current_player;craft]"..
|
"listring[current_player;craft]"
|
||||||
-- inventory marker
|
|
||||||
"wob"
|
|
||||||
|
|
||||||
--player:set_inventory_formspec(form)
|
--player:set_inventory_formspec(form)
|
||||||
minetest.show_formspec(player:get_player_name(), "main", form)
|
minetest.show_formspec(player:get_player_name(), "main", form)
|
||||||
end
|
end
|
||||||
|
|
||||||
--drop craf items and reset inventory on closing
|
-- Drop items in craft grid and reset inventory on closing
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if fields.quit then
|
if fields.quit then
|
||||||
local formspec = player:get_inventory_formspec()
|
drop_fields(player,"craft")
|
||||||
local size = string.len(formspec)
|
if not minetest.setting_getbool("creative_mode") and formname == "" then
|
||||||
local marker = string.sub(formspec,size-2)
|
|
||||||
if marker == "inv" or marker == "wob" or marker == "cin" then
|
|
||||||
drop_fields(player,"craft")
|
|
||||||
set_inventory(player)
|
set_inventory(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user