mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 01:21:05 +01:00
Fix workbench items not being dropped in creative
This commit is contained in:
parent
d01937d089
commit
fd581fa4b6
2 changed files with 7 additions and 1 deletions
|
@ -287,6 +287,9 @@ crafting.set_creative_formspec = function(player, start_i, pagenum, show, page,
|
||||||
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
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ local function set_inventory(player)
|
||||||
"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"
|
"inv"
|
||||||
|
|
||||||
player:set_inventory_formspec(form)
|
player:set_inventory_formspec(form)
|
||||||
|
@ -122,6 +123,7 @@ local function set_workbench(player)
|
||||||
"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"
|
"wob"
|
||||||
|
|
||||||
--player:set_inventory_formspec(form)
|
--player:set_inventory_formspec(form)
|
||||||
|
@ -131,10 +133,11 @@ end
|
||||||
--drop craf items and reset inventory on closing
|
--drop craf items 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
|
||||||
|
minetest.log("error", "quite")
|
||||||
local formspec = player:get_inventory_formspec()
|
local formspec = player:get_inventory_formspec()
|
||||||
local size = string.len(formspec)
|
local size = string.len(formspec)
|
||||||
local marker = string.sub(formspec,size-2)
|
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")
|
drop_fields(player,"craft")
|
||||||
set_inventory(player)
|
set_inventory(player)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue