Allow taking templates from the workshops in creative mode
There's no point in making the user put supplies in the machine if they can just grab them from the creative inventory. Behavior in survival mode is unchanged.
This commit is contained in:
parent
0da3203054
commit
c58bdc81ef
@ -91,6 +91,9 @@ function streets.workshop.update_formspec(pos)
|
||||
fs = fs .. "image[7,2;1,1;gui_furnace_arrow_bg.png^[lowpart:" .. meta:get_int("progress")*10 .. ":gui_furnace_arrow_fg.png^[transformR180]"
|
||||
fs = fs .. "list[context;output;7,3;1,1]"
|
||||
fs = fs .. "list[current_player;main;0.5,5;8,4]"
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
fs = fs .."label[2,4;CREATIVE MODE: Taking templates is enabled]"
|
||||
end
|
||||
meta:set_string("formspec",fs)
|
||||
end
|
||||
|
||||
@ -157,7 +160,7 @@ local function on_construct(pos)
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if listname == "output" or listname == "surface" or listname == "white_dye" or listname == "yellow_dye" then
|
||||
if listname == "output" or listname == "surface" or listname == "white_dye" or listname == "yellow_dye" or (listname == "list" and minetest.setting_getbool("creative_mode")) then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
@ -188,7 +191,7 @@ local function on_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if listname == "yellow_dye" or listname == "white_dye" then
|
||||
if listname == "yellow_dye" or listname == "white_dye" or (listname == "list" and minetest.setting_getbool("creative_mode")) then
|
||||
return stack:get_count()
|
||||
elseif listname == "surface" and (stack:get_name() == "default:paper" or streets.surfaces.surfacetypes[stack:get_name()]) then
|
||||
return stack:get_count()
|
||||
|
@ -105,6 +105,9 @@ function streets.signworkshop.update_formspec(pos)
|
||||
fs = fs .. "button[2.25,4;1,1;prevpage;<-]"
|
||||
fs = fs .. "button[5.25,4;1,1;nextpage;->]"
|
||||
fs = fs .. "label[3.75,4;"..string.format("Page %s of %s",page,maxpage).."]"
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
fs = fs .."label[0,3.5;CREATIVE MODE\nTaking templates\nis enabled]"
|
||||
end
|
||||
end
|
||||
fs = fs .. "list[current_player;main;0.5,5;8,4]"
|
||||
meta:set_string("formspec",fs)
|
||||
@ -177,7 +180,7 @@ local function on_construct(pos)
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if listname == "output" or listname == "surface" or listname == "dye" then
|
||||
if listname == "output" or listname == "surface" or listname == "dye" or (listname == "list" and minetest.setting_getbool("creative_mode")) then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
@ -212,7 +215,7 @@ end
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if listname == "dye" and stack:get_name():sub(1,4) == "dye:" then
|
||||
return stack:get_count()
|
||||
elseif listname == "surface" and stack:get_name() == "streets:sign_blank" then
|
||||
elseif (listname == "surface" and stack:get_name() == "streets:sign_blank") or (listname == "list" and minetest.setting_getbool("creative_mode")) then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user