mirror of
https://github.com/minetest-mods/digtron.git
synced 2024-12-22 20:32:22 +01:00
making formspecs more systematic and upgradable
This commit is contained in:
parent
c6ee4a8957
commit
ade365df1b
143
init.lua
143
init.lua
@ -20,21 +20,25 @@ digtron.builder_read_item_substitutions = {
|
|||||||
["farming:desert_sand_soil_wet"] = "default:desert_sand",
|
["farming:desert_sand_soil_wet"] = "default:desert_sand",
|
||||||
}
|
}
|
||||||
|
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/config.lua" )
|
local digtron_modpath = minetest.get_modpath( "digtron" )
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/util.lua" )
|
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/doc.lua" )
|
dofile( digtron_modpath .. "/config.lua" )
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/awards.lua" )
|
dofile( digtron_modpath .. "/util.lua" )
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/class_pointset.lua" )
|
dofile( digtron_modpath .. "/doc.lua" )
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/class_layout.lua" )
|
dofile( digtron_modpath .. "/awards.lua" )
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/entities.lua" )
|
dofile( digtron_modpath .. "/class_pointset.lua" )
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/nodes/node_misc.lua" ) -- contains structure and light nodes
|
dofile( digtron_modpath .. "/class_layout.lua" )
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/nodes/node_storage.lua" ) -- contains inventory and fuel storage nodes
|
dofile( digtron_modpath .. "/entities.lua" )
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/nodes/node_diggers.lua" ) -- contains all diggers
|
dofile( digtron_modpath .. "/nodes/node_misc.lua" ) -- contains structure and light nodes
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/nodes/node_builders.lua" ) -- contains all builders (there's just one currently)
|
dofile( digtron_modpath .. "/nodes/node_storage.lua" ) -- contains inventory and fuel storage nodes
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/nodes/node_controllers.lua" ) -- controllers
|
dofile( digtron_modpath .. "/nodes/node_diggers.lua" ) -- contains all diggers
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/nodes/node_axle.lua" ) -- Rotation controller
|
dofile( digtron_modpath .. "/nodes/node_builders.lua" ) -- contains all builders (there's just one currently)
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/nodes/node_crate.lua" ) -- Digtron portability support
|
dofile( digtron_modpath .. "/nodes/node_controllers.lua" ) -- controllers
|
||||||
dofile( minetest.get_modpath( "digtron" ) .. "/nodes/recipes.lua" )
|
dofile( digtron_modpath .. "/nodes/node_axle.lua" ) -- Rotation controller
|
||||||
|
dofile( digtron_modpath .. "/nodes/node_crate.lua" ) -- Digtron portability support
|
||||||
|
dofile( digtron_modpath .. "/nodes/recipes.lua" )
|
||||||
|
|
||||||
|
dofile( digtron_modpath .. "/upgrades.lua" ) -- various LBMs for upgrading older versions of Digtron.
|
||||||
|
|
||||||
-- digtron group numbers:
|
-- digtron group numbers:
|
||||||
-- 1 - generic digtron node, nothing special is done with these. They're just dragged along.
|
-- 1 - generic digtron node, nothing special is done with these. They're just dragged along.
|
||||||
@ -44,113 +48,8 @@ dofile( minetest.get_modpath( "digtron" ) .. "/nodes/recipes.lua" )
|
|||||||
-- 5 - fuel-holding digtron, has a "fuel" invetory that the control node can draw fuel items from. Separate from general inventory, nothing gets put here automatically.
|
-- 5 - fuel-holding digtron, has a "fuel" invetory that the control node can draw fuel items from. Separate from general inventory, nothing gets put here automatically.
|
||||||
-- 6 - holds both fuel and main inventories
|
-- 6 - holds both fuel and main inventories
|
||||||
|
|
||||||
minetest.register_lbm({
|
-- This code was added for use with FaceDeer's fork of the [catacomb] mod. Paramat's version doesn't support customized protected nodes, which causes
|
||||||
name = "digtron:sand_digger_upgrade",
|
-- it to "eat" Digtrons sometimes.
|
||||||
nodenames = {"digtron:sand_digger"},
|
|
||||||
action = function(pos, node)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local offset = meta:get_string("offset")
|
|
||||||
local period = meta:get_string("period")
|
|
||||||
minetest.set_node(pos, {name = "digtron:soft_digger",
|
|
||||||
param2 = node.param2})
|
|
||||||
meta:set_string("offset", offset)
|
|
||||||
meta:set_string("period", period)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_lbm({
|
|
||||||
name = "digtron:fuelstore_upgrade",
|
|
||||||
nodenames = {"digtron:fuelstore"},
|
|
||||||
action = function(pos, node)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local list = inv:get_list("main")
|
|
||||||
inv:set_list("main", {})
|
|
||||||
inv:set_list("fuel", list)
|
|
||||||
meta:set_string("formspec",
|
|
||||||
"size[8,9.3]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"label[0,0;Fuel items]" ..
|
|
||||||
"list[current_name;fuel;0,0.6;8,4;]" ..
|
|
||||||
"list[current_player;main;0,5.15;8,1;]" ..
|
|
||||||
"list[current_player;main;0,6.38;8,3;8]" ..
|
|
||||||
"listring[current_name;fuel]" ..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
default.get_hotbar_bg(0,5.15)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_lbm({
|
|
||||||
name = "digtron:autocontroller_lateral_upgrade",
|
|
||||||
nodenames = {"digtron:auto_controller"},
|
|
||||||
action = function(pos, node)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local cycles = meta:get_int("offset")
|
|
||||||
meta:set_int("cycles", cycles)
|
|
||||||
meta:set_int("offset", 0)
|
|
||||||
meta:set_int("slope", 0)
|
|
||||||
meta:set_string("formspec",
|
|
||||||
"size[3.5,2]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"field[0.5,0.8;1,0.1;cycles;Cycles;${cycles}]" ..
|
|
||||||
"tooltip[cycles;When triggered, this controller will try to run for the given number of cycles.\nThe cycle count will decrement as it runs, so if it gets halted by a problem\nyou can fix the problem and restart.]" ..
|
|
||||||
"button_exit[1.2,0.5;1,0.1;set;Set]" ..
|
|
||||||
"tooltip[set;Saves the cycle setting without starting the controller running]" ..
|
|
||||||
"button_exit[2.2,0.5;1,0.1;execute;Set &\nExecute]" ..
|
|
||||||
"tooltip[execute;Begins executing the given number of cycles]" ..
|
|
||||||
"field[0.5,2.0;1,0.1;slope;Slope;${slope}]" ..
|
|
||||||
"tooltip[slope;For diagonal digging. After every X nodes the auto controller moves forward,\nthe controller will add an additional cycle moving the digtron laterally in the\ndirection of the arrows on the side of this controller.\nSet to 0 for no lateral digging.]" ..
|
|
||||||
"field[1.5,2.0;1,0.1;offset;Offset;${offset}]" ..
|
|
||||||
"tooltip[offset;Sets the offset of the lateral motion defined in the Slope field.\nNote: this offset is relative to the controller's location.\nThe controller will move down when it reaches the indicated point.]" ..
|
|
||||||
"field[2.5,2.0;1,0.1;period;Delay;${period}]" ..
|
|
||||||
"tooltip[period;Number of seconds to wait between each cycle]"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- internationalization boilerplate
|
|
||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
|
||||||
|
|
||||||
minetest.register_lbm({
|
|
||||||
name = "digtron:builder_extrusion_upgrade",
|
|
||||||
nodenames = {"digtron:builder"},
|
|
||||||
action = function(pos, node)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_int("extrusion", 1)
|
|
||||||
meta:set_string("formspec",
|
|
||||||
"size[8,5.2]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"list[current_name;main;0.5,0;1,1;]" ..
|
|
||||||
"label[0.5,0.8;" .. S("Block to build") .. "]" ..
|
|
||||||
"field[2.3,0.8;1,0.1;extrusion;" .. S("Extrusion") .. ";${extrusion}]" ..
|
|
||||||
"tooltip[extrusion;" .. S("Builder will extrude this many blocks in the direction it is facing.\nCan be set from 1 to @1.\nNote that Digtron won't build into unloaded map regions.", digtron.config.maximum_extrusion) .. "]" ..
|
|
||||||
"field[3.3,0.8;1,0.1;period;" .. S("Periodicity") .. ";${period}]" ..
|
|
||||||
"tooltip[period;" .. S("Builder will build once every n steps.\nThese steps are globally aligned, so all builders with the\nsame period and offset will build on the same location.") .. "]" ..
|
|
||||||
"field[4.3,0.8;1,0.1;offset;" .. S("Offset") .. ";${offset}]" ..
|
|
||||||
"tooltip[offset;" .. S("Offsets the start of periodicity counting by this amount.\nFor example, a builder with period 2 and offset 0 builds\nevery even-numbered block and one with period 2 and\noffset 1 builds every odd-numbered block.") .. "]" ..
|
|
||||||
"button_exit[5.0,0.5;1,0.1;set;" .. S("Save &\nShow") .. "]" ..
|
|
||||||
"tooltip[set;" .. S("Saves settings") .. "]" ..
|
|
||||||
"field[6.3,0.8;1,0.1;build_facing;" .. S("Facing") .. ";${build_facing}]" ..
|
|
||||||
"tooltip[build_facing;" .. S("Value from 0-23. Not all block types make use of this.\nUse the 'Read & Save' button to copy the facing of the block\ncurrently in the builder output location.") .. "]" ..
|
|
||||||
"button_exit[7.0,0.5;1,0.1;read;" .. S("Read &\nSave") .. "]" ..
|
|
||||||
"tooltip[read;" .. S("Reads the facing of the block currently in the build location,\nthen saves all settings.") .. "]" ..
|
|
||||||
"list[current_player;main;0,1.3;8,1;]" ..
|
|
||||||
default.get_hotbar_bg(0,1.3) ..
|
|
||||||
"list[current_player;main;0,2.5;8,3;8]" ..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
"listring[current_name;main]"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
if minetest.get_modpath("catacomb") and catacomb ~= nil and catacomb.chamber_protected_nodes ~= nil and catacomb.passage_protected_nodes ~= nil then
|
if minetest.get_modpath("catacomb") and catacomb ~= nil and catacomb.chamber_protected_nodes ~= nil and catacomb.passage_protected_nodes ~= nil then
|
||||||
local digtron_nodes = {
|
local digtron_nodes = {
|
||||||
minetest.get_content_id("digtron:inventory"),
|
minetest.get_content_id("digtron:inventory"),
|
||||||
|
@ -45,6 +45,7 @@ minetest.register_node("digtron:builder", {
|
|||||||
description = S("Digtron Builder Module"),
|
description = S("Digtron Builder Module"),
|
||||||
_doc_items_longdesc = digtron.doc.builder_longdesc,
|
_doc_items_longdesc = digtron.doc.builder_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.builder_usagehelp,
|
_doc_items_usagehelp = digtron.doc.builder_usagehelp,
|
||||||
|
_digtron_formspec = builder_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 4},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 4},
|
||||||
drop = "digtron:builder",
|
drop = "digtron:builder",
|
||||||
sounds = digtron.metal_sounds,
|
sounds = digtron.metal_sounds,
|
||||||
|
@ -172,6 +172,7 @@ minetest.register_node("digtron:auto_controller", {
|
|||||||
description = S("Digtron Automatic Control Module"),
|
description = S("Digtron Automatic Control Module"),
|
||||||
_doc_items_longdesc = digtron.doc.auto_controller_longdesc,
|
_doc_items_longdesc = digtron.doc.auto_controller_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.auto_controller_usagehelp,
|
_doc_items_usagehelp = digtron.doc.auto_controller_usagehelp,
|
||||||
|
_digtron_formspec = auto_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1},
|
groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1},
|
||||||
drop = "digtron:auto_controller",
|
drop = "digtron:auto_controller",
|
||||||
sounds = digtron.metal_sounds,
|
sounds = digtron.metal_sounds,
|
||||||
@ -289,7 +290,6 @@ minetest.register_node("digtron:auto_controller", {
|
|||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
minetest.get_meta(pos):set_string("waiting", nil)
|
minetest.get_meta(pos):set_string("waiting", nil)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
---------------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -80,6 +80,7 @@ minetest.register_node("digtron:loaded_crate", {
|
|||||||
description = S("Digtron Crate (Loaded)"),
|
description = S("Digtron Crate (Loaded)"),
|
||||||
_doc_items_longdesc = digtron.doc.loaded_crate_longdesc,
|
_doc_items_longdesc = digtron.doc.loaded_crate_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.loaded_crate_usagehelp,
|
_doc_items_usagehelp = digtron.doc.loaded_crate_usagehelp,
|
||||||
|
_digtron_formspec = loaded_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, not_in_creative_inventory=1, digtron_protected=1},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, not_in_creative_inventory=1, digtron_protected=1},
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
@ -36,17 +36,17 @@ local intermittent_formspec =
|
|||||||
"button_exit[2.2,0.5;1,0.1;set;" .. S("Save") .. "]" ..
|
"button_exit[2.2,0.5;1,0.1;set;" .. S("Save") .. "]" ..
|
||||||
"tooltip[set;" .. S("Saves settings") .. "]"
|
"tooltip[set;" .. S("Saves settings") .. "]"
|
||||||
|
|
||||||
local intermittent_on_construct = function(pos)
|
if minetest.get_modpath("doc") then
|
||||||
local formspec = intermittent_formspec
|
intermittent_formspec = "size[4.5,1]" .. intermittent_formspec ..
|
||||||
if minetest.get_modpath("doc") then
|
|
||||||
formspec = "size[4.5,1]" .. formspec ..
|
|
||||||
"button_exit[3.2,0.5;1,0.1;help;" .. S("Help") .. "]" ..
|
"button_exit[3.2,0.5;1,0.1;help;" .. S("Help") .. "]" ..
|
||||||
"tooltip[help;" .. S("Show documentation about this block") .. "]"
|
"tooltip[help;" .. S("Show documentation about this block") .. "]"
|
||||||
else
|
else
|
||||||
formspec = "size[3.5,1]" .. formspec
|
intermittent_formspec = "size[3.5,1]" .. intermittent_formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local intermittent_on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", intermittent_formspec)
|
||||||
meta:set_int("period", 1)
|
meta:set_int("period", 1)
|
||||||
meta:set_int("offset", 0)
|
meta:set_int("offset", 0)
|
||||||
end
|
end
|
||||||
@ -72,6 +72,7 @@ minetest.register_node("digtron:digger", {
|
|||||||
description = S("Digtron Digger Head"),
|
description = S("Digtron Digger Head"),
|
||||||
_doc_items_longdesc = digtron.doc.digger_longdesc,
|
_doc_items_longdesc = digtron.doc.digger_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.digger_usagehelp,
|
_doc_items_usagehelp = digtron.doc.digger_usagehelp,
|
||||||
|
_digtron_formspec = intermittent_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
||||||
drop = "digtron:digger",
|
drop = "digtron:digger",
|
||||||
sounds = digtron.metal_sounds,
|
sounds = digtron.metal_sounds,
|
||||||
@ -125,6 +126,7 @@ minetest.register_node("digtron:intermittent_digger", {
|
|||||||
description = S("Digtron Intermittent Digger Head"),
|
description = S("Digtron Intermittent Digger Head"),
|
||||||
_doc_items_longdesc = digtron.doc.intermittent_digger_longdesc,
|
_doc_items_longdesc = digtron.doc.intermittent_digger_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.intermittent_digger_usagehelp,
|
_doc_items_usagehelp = digtron.doc.intermittent_digger_usagehelp,
|
||||||
|
_digtron_formspec = intermittent_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
||||||
drop = "digtron:intermittent_digger",
|
drop = "digtron:intermittent_digger",
|
||||||
sounds = digtron.metal_sounds,
|
sounds = digtron.metal_sounds,
|
||||||
@ -250,6 +252,7 @@ minetest.register_node("digtron:intermittent_soft_digger", {
|
|||||||
description = S("Digtron Intermittent Soft Material Digger Head"),
|
description = S("Digtron Intermittent Soft Material Digger Head"),
|
||||||
_doc_items_longdesc = digtron.doc.intermittent_soft_digger_longdesc,
|
_doc_items_longdesc = digtron.doc.intermittent_soft_digger_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.intermittent_soft_digger_usagehelp,
|
_doc_items_usagehelp = digtron.doc.intermittent_soft_digger_usagehelp,
|
||||||
|
_digtron_formspec = intermittent_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3},
|
||||||
drop = "digtron:intermittent_soft_digger",
|
drop = "digtron:intermittent_soft_digger",
|
||||||
sounds = digtron.metal_sounds,
|
sounds = digtron.metal_sounds,
|
||||||
|
@ -2,12 +2,27 @@
|
|||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
|
||||||
|
local inventory_formspec =
|
||||||
|
"size[8,9.3]" ..
|
||||||
|
default.gui_bg ..
|
||||||
|
default.gui_bg_img ..
|
||||||
|
default.gui_slots ..
|
||||||
|
"label[0,0;" .. S("Inventory items") .. "]" ..
|
||||||
|
"list[current_name;main;0,0.6;8,4;]" ..
|
||||||
|
"list[current_player;main;0,5.15;8,1;]" ..
|
||||||
|
"list[current_player;main;0,6.38;8,3;8]" ..
|
||||||
|
"listring[current_name;main]" ..
|
||||||
|
"listring[current_player;main]" ..
|
||||||
|
default.get_hotbar_bg(0,5.15)
|
||||||
|
|
||||||
-- Storage buffer. Builder nodes draw from this inventory and digger nodes deposit into it.
|
-- Storage buffer. Builder nodes draw from this inventory and digger nodes deposit into it.
|
||||||
-- Note that inventories are digtron group 2.
|
-- Note that inventories are digtron group 2.
|
||||||
minetest.register_node("digtron:inventory", {
|
minetest.register_node("digtron:inventory", {
|
||||||
description = S("Digtron Inventory Storage"),
|
description = S("Digtron Inventory Storage"),
|
||||||
_doc_items_longdesc = digtron.doc.inventory_longdesc,
|
_doc_items_longdesc = digtron.doc.inventory_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.inventory_usagehelp,
|
_doc_items_usagehelp = digtron.doc.inventory_usagehelp,
|
||||||
|
_digtron_formspec = inventory_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 2, tubedevice = 1, tubedevice_receiver = 1},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||||
drop = "digtron:inventory",
|
drop = "digtron:inventory",
|
||||||
sounds = digtron.metal_sounds,
|
sounds = digtron.metal_sounds,
|
||||||
@ -26,19 +41,7 @@ minetest.register_node("digtron:inventory", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec", inventory_formspec)
|
||||||
"size[8,9.3]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"label[0,0;" .. S("Inventory items") .. "]" ..
|
|
||||||
"list[current_name;main;0,0.6;8,4;]" ..
|
|
||||||
"list[current_player;main;0,5.15;8,1;]" ..
|
|
||||||
"list[current_player;main;0,6.38;8,3;8]" ..
|
|
||||||
"listring[current_name;main]" ..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
default.get_hotbar_bg(0,5.15)
|
|
||||||
)
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8*4)
|
inv:set_size("main", 8*4)
|
||||||
end,
|
end,
|
||||||
@ -71,12 +74,26 @@ minetest.register_node("digtron:inventory", {
|
|||||||
after_dig_node = (function() if minetest.get_modpath("pipeworks") then return pipeworks.after_dig end end)()
|
after_dig_node = (function() if minetest.get_modpath("pipeworks") then return pipeworks.after_dig end end)()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local fuelstore_formspec =
|
||||||
|
"size[8,9.3]" ..
|
||||||
|
default.gui_bg ..
|
||||||
|
default.gui_bg_img ..
|
||||||
|
default.gui_slots ..
|
||||||
|
"label[0,0;" .. S("Fuel items") .. "]" ..
|
||||||
|
"list[current_name;fuel;0,0.6;8,4;]" ..
|
||||||
|
"list[current_player;main;0,5.15;8,1;]" ..
|
||||||
|
"list[current_player;main;0,6.38;8,3;8]" ..
|
||||||
|
"listring[current_name;fuel]" ..
|
||||||
|
"listring[current_player;main]" ..
|
||||||
|
default.get_hotbar_bg(0,5.15)
|
||||||
|
|
||||||
-- Fuel storage. Controller node draws fuel from here.
|
-- Fuel storage. Controller node draws fuel from here.
|
||||||
-- Note that fuel stores are digtron group 5.
|
-- Note that fuel stores are digtron group 5.
|
||||||
minetest.register_node("digtron:fuelstore", {
|
minetest.register_node("digtron:fuelstore", {
|
||||||
description = S("Digtron Fuel Storage"),
|
description = S("Digtron Fuel Storage"),
|
||||||
_doc_items_longdesc = digtron.doc.fuelstore_longdesc,
|
_doc_items_longdesc = digtron.doc.fuelstore_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.fuelstore_usagehelp,
|
_doc_items_usagehelp = digtron.doc.fuelstore_usagehelp,
|
||||||
|
_digtron_formspec = fuelstore_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 5, tubedevice = 1, tubedevice_receiver = 1},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 5, tubedevice = 1, tubedevice_receiver = 1},
|
||||||
drop = "digtron:fuelstore",
|
drop = "digtron:fuelstore",
|
||||||
sounds = digtron.metal_sounds,
|
sounds = digtron.metal_sounds,
|
||||||
@ -95,19 +112,7 @@ minetest.register_node("digtron:fuelstore", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec", fuelstore_formspec)
|
||||||
"size[8,9.3]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"label[0,0;" .. S("Fuel items") .. "]" ..
|
|
||||||
"list[current_name;fuel;0,0.6;8,4;]" ..
|
|
||||||
"list[current_player;main;0,5.15;8,1;]" ..
|
|
||||||
"list[current_player;main;0,6.38;8,3;8]" ..
|
|
||||||
"listring[current_name;fuel]" ..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
default.get_hotbar_bg(0,5.15)
|
|
||||||
)
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("fuel", 8*4)
|
inv:set_size("fuel", 8*4)
|
||||||
end,
|
end,
|
||||||
@ -158,11 +163,28 @@ minetest.register_node("digtron:fuelstore", {
|
|||||||
after_dig_node = (function() if minetest.get_modpath("pipeworks")then return pipeworks.after_dig end end)()
|
after_dig_node = (function() if minetest.get_modpath("pipeworks")then return pipeworks.after_dig end end)()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local combined_storage_formspec =
|
||||||
|
"size[8,9.9]" ..
|
||||||
|
default.gui_bg ..
|
||||||
|
default.gui_bg_img ..
|
||||||
|
default.gui_slots ..
|
||||||
|
"label[0,0;" .. S("Inventory items") .. "]" ..
|
||||||
|
"list[current_name;main;0,0.6;8,3;]" ..
|
||||||
|
"label[0,3.5;" .. S("Fuel items") .. "]" ..
|
||||||
|
"list[current_name;fuel;0,4.1;8,1;]" ..
|
||||||
|
"list[current_player;main;0,5.75;8,1;]" ..
|
||||||
|
"list[current_player;main;0,6.98;8,3;8]" ..
|
||||||
|
"listring[current_name;main]" ..
|
||||||
|
"listring[current_player;main]" ..
|
||||||
|
default.get_hotbar_bg(0,5.75)
|
||||||
|
|
||||||
|
|
||||||
-- Combined storage. Group 6 has both an inventory and a fuel store
|
-- Combined storage. Group 6 has both an inventory and a fuel store
|
||||||
minetest.register_node("digtron:combined_storage", {
|
minetest.register_node("digtron:combined_storage", {
|
||||||
description = S("Digtron Combined Storage"),
|
description = S("Digtron Combined Storage"),
|
||||||
_doc_items_longdesc = digtron.doc.combined_storage_longdesc,
|
_doc_items_longdesc = digtron.doc.combined_storage_longdesc,
|
||||||
_doc_items_usagehelp = digtron.doc.combined_storage_usagehelp,
|
_doc_items_usagehelp = digtron.doc.combined_storage_usagehelp,
|
||||||
|
_digtron_formspec = combined_storage_formspec,
|
||||||
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 6, tubedevice = 1, tubedevice_receiver = 1},
|
groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 6, tubedevice = 1, tubedevice_receiver = 1},
|
||||||
drop = "digtron:combined_storage",
|
drop = "digtron:combined_storage",
|
||||||
sounds = digtron.metal_sounds,
|
sounds = digtron.metal_sounds,
|
||||||
@ -179,21 +201,7 @@ minetest.register_node("digtron:combined_storage", {
|
|||||||
},
|
},
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec", combined_storage_formspec)
|
||||||
"size[8,9.9]" ..
|
|
||||||
default.gui_bg ..
|
|
||||||
default.gui_bg_img ..
|
|
||||||
default.gui_slots ..
|
|
||||||
"label[0,0;" .. S("Inventory items") .. "]" ..
|
|
||||||
"list[current_name;main;0,0.6;8,3;]" ..
|
|
||||||
"label[0,3.5;" .. S("Fuel items") .. "]" ..
|
|
||||||
"list[current_name;fuel;0,4.1;8,1;]" ..
|
|
||||||
"list[current_player;main;0,5.75;8,1;]" ..
|
|
||||||
"list[current_player;main;0,6.98;8,3;8]" ..
|
|
||||||
"listring[current_name;main]" ..
|
|
||||||
"listring[current_player;main]" ..
|
|
||||||
default.get_hotbar_bg(0,5.75)
|
|
||||||
)
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8*3)
|
inv:set_size("main", 8*3)
|
||||||
inv:set_size("fuel", 8*1)
|
inv:set_size("fuel", 8*1)
|
||||||
|
57
upgrades.lua
Normal file
57
upgrades.lua
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
-- re-applies the "_digtron_formspec" property from all digtron node defs to the digtron node's metadata.
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "digtron:generic_formspec_sanitizer",
|
||||||
|
nodenames = {"group:digtron"},
|
||||||
|
action = function(pos, node)
|
||||||
|
local node_def = minetest.registered_nodes[node.name]
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", node_def._digtron_formspec)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "digtron:sand_digger_upgrade",
|
||||||
|
nodenames = {"digtron:sand_digger"},
|
||||||
|
action = function(pos, node)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local offset = meta:get_string("offset")
|
||||||
|
local period = meta:get_string("period")
|
||||||
|
minetest.set_node(pos, {name = "digtron:soft_digger",
|
||||||
|
param2 = node.param2})
|
||||||
|
meta:set_string("offset", offset)
|
||||||
|
meta:set_string("period", period)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "digtron:fuelstore_upgrade",
|
||||||
|
nodenames = {"digtron:fuelstore"},
|
||||||
|
action = function(pos, node)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local list = inv:get_list("main")
|
||||||
|
inv:set_list("main", {})
|
||||||
|
inv:set_list("fuel", list)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "digtron:autocontroller_lateral_upgrade",
|
||||||
|
nodenames = {"digtron:auto_controller"},
|
||||||
|
action = function(pos, node)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local cycles = meta:get_int("offset")
|
||||||
|
meta:set_int("cycles", cycles)
|
||||||
|
meta:set_int("offset", 0)
|
||||||
|
meta:set_int("slope", 0)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "digtron:builder_extrusion_upgrade",
|
||||||
|
nodenames = {"digtron:builder"},
|
||||||
|
action = function(pos, node)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_int("extrusion", 1)
|
||||||
|
end
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user