Fix workbench items not being dropped in creative

This commit is contained in:
Wuzzy 2017-02-10 19:31:59 +01:00
parent d01937d089
commit fd581fa4b6
2 changed files with 7 additions and 1 deletions

View file

@ -286,6 +286,9 @@ crafting.set_creative_formspec = function(player, start_i, pagenum, show, page,
formspec = formspec .. "field_close_on_enter[suche;false]"
end
if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
-- inventory marker
formspec = formspec .. "cin"
player:set_inventory_formspec(formspec)
end

View file

@ -102,6 +102,7 @@ local function set_inventory(player)
"listring[current_player;craft]"..
"listring[current_player;main]"..
"listring[detached:"..player_name.."_armor;armor]"..
-- inventory marker
"inv"
player:set_inventory_formspec(form)
@ -122,6 +123,7 @@ local function set_workbench(player)
"tooltip[__mcl_craftguide;Show crafting recipes]"..
"listring[current_player;main]"..
"listring[current_player;craft]"..
-- inventory marker
"wob"
--player:set_inventory_formspec(form)
@ -131,10 +133,11 @@ end
--drop craf items and reset inventory on closing
minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.quit then
minetest.log("error", "quite")
local formspec = player:get_inventory_formspec()
local size = string.len(formspec)
local marker = string.sub(formspec,size-2)
if marker == "inv" or marker == "wob" then
if marker == "inv" or marker == "wob" or marker == "cin" then
drop_fields(player,"craft")
set_inventory(player)
end