Merge pull request #7 from minetest-mods/extrusion

add extrusion setting to builders
This commit is contained in:
FaceDeer 2017-09-11 23:26:29 -06:00 committed by GitHub
commit 3441a0d1da
11 changed files with 424 additions and 247 deletions

83
config.lua Normal file

@ -0,0 +1,83 @@
-- Enables the spray of particles out the back of a digger head and puffs of smoke from the controller
local particle_effects = minetest.settings:get_bool("enable_particles")
-- this causes digtrons to operate without consuming fuel or building materials.
local digtron_uses_resources = minetest.settings:get_bool("digtron_uses_resources")
if digtron_uses_resources == nil then digtron_uses_resources = true end
-- when true, lava counts as protected nodes.
local lava_impassible = minetest.settings:get_bool("digtron_lava_impassible")
-- when true, diggers deal damage to creatures when they trigger.
local damage_creatures = minetest.settings:get_bool("digtron_damage_creatures")
digtron.creative_mode = not digtron_uses_resources -- default false
digtron.particle_effects = particle_effects or particle_effects == nil -- default true
digtron.lava_impassible = lava_impassible or lava_impassible == nil -- default true
digtron.diggers_damage_creatures = damage_creatures or damage_creatures == nil -- default true
-- maximum distance a builder head can extrude blocks
local maximum_extrusion = tonumber(minetest.settings:get("digtron_maximum_extrusion"))
if maximum_extrusion == nil or maximum_extrusion < 1 or maximum_extrusion > 100 then
digtron.maximum_extrusion = 25
else
digtron.maximum_extrusion = maximum_extrusion
end
-- How many seconds a digtron waits between cycles. Auto-controllers can make this wait longer, but cannot make it shorter.
local digtron_cycle_time = tonumber(minetest.settings:get("digtron_cycle_time"))
if digtron_cycle_time == nil or digtron_cycle_time < 0 then
digtron.cycle_time = 1.0
else
digtron.cycle_time = digtron_cycle_time
end
-- How many digtron nodes can be moved for each adjacent solid node that the digtron has traction against
local digtron_traction_factor = tonumber(minetest.settings:get("digtron_traction_factor"))
if digtron_traction_factor == nil or digtron_traction_factor < 0 then
digtron.traction_factor = 3.0
else
digtron.traction_factor = digtron_traction_factor
end
-- fuel costs. For comparison, in the default game:
-- one default tree block is 30 units
-- one coal lump is 40 units
-- one coal block is 370 units (apparently it's slightly more productive making your coal lumps into blocks before burning)
-- one book is 3 units
-- how much fuel is required to dig a node if not in one of the following groups.
local digtron_dig_cost_default = tonumber(minetest.settings:get("digtron_dig_cost_default"))
if digtron_dig_cost_default == nil or digtron_dig_cost_default < 0 then
digtron.dig_cost_default = 0.5
else
digtron.dig_cost_default = digtron_dig_cost_default
end
-- eg, stone
local digtron_dig_cost_cracky = tonumber(minetest.settings:get("digtron_dig_cost_cracky"))
if digtron_dig_cost_cracky == nil or digtron_dig_cost_cracky < 0 then
digtron.dig_cost_cracky = 1.0
else
digtron.dig_cost_cracky = digtron_dig_cost_cracky
end
-- eg, dirt, sand
local digtron_dig_cost_crumbly = tonumber(minetest.settings:get("digtron_dig_cost_crumbly"))
if digtron_dig_cost_crumbly == nil or digtron_dig_cost_crumbly < 0 then
digtron.dig_cost_crumbly = 0.5
else
digtron.dig_cost_crumbly = digtron_dig_cost_crumbly
end
-- eg, wood
local digtron_dig_cost_choppy = tonumber(minetest.settings:get("digtron_dig_cost_choppy"))
if digtron_dig_cost_choppy == nil or digtron_dig_cost_choppy < 0 then
digtron.dig_cost_choppy = 0.75
else
digtron.dig_cost_choppy = digtron_dig_cost_choppy
end
-- how much fuel is required to build a node
local digtron_build_cost = tonumber(minetest.settings:get("digtron_build_cost"))
if digtron_build_cost == nil or digtron_build_cost < 0 then
digtron.build_cost = 1.0
else
digtron.build_cost = digtron_build_cost
end

@ -17,7 +17,11 @@ digtron.doc.core_usagehelp = S("Place the Digtron Core in the center of the craf
-------------------------------------------------------------------- --------------------------------------------------------------------
digtron.doc.builder_longdesc = S("A 'builder' module for a Digtron. By itself it does nothing, but as part of a Digtron it is used to construct user-defined blocks.") digtron.doc.builder_longdesc = S("A 'builder' module for a Digtron. By itself it does nothing, but as part of a Digtron it is used to construct user-defined blocks.")
digtron.doc.builder_usagehelp = S("A builder head is the most complex component of this system. It has period and offset properties, and also an inventory slot where you \"program\" it by placing an example of the block type that you want it to build.".."\n\n".."When the \"Save & Show\" button is clicked the properties for period and offset will be saved, and markers will briefly be shown to indicate where the nearest spots corresponding to those values are. The builder will build its output at those locations provided it is moving along the matching axis." digtron.doc.builder_usagehelp = S("A builder head is the most complex component of this system. It has period and offset properties, and also an inventory slot where you \"program\" it by placing an example of the block type that you want it to build."
.."\n\n"..
"When the \"Save & Show\" button is clicked the properties for period and offset will be saved, and markers will briefly be shown to indicate where the nearest spots corresponding to those values are. The builder will build its output at those locations provided it is moving along the matching axis."
.."\n\n"..
"There is also an \"Extrusion\" setting. This allows your builder to extrude a line of identical blocks from the builder output, in the direction the output side is facing, until it reaches an obstruction or until it reaches the extrusion limit. This can be useful for placing columns below a bridge, or for filling a large volume with a uniform block type without requiring a large number of builder heads."
.."\n\n".. .."\n\n"..
"The \"output\" side of a builder is the side with a black crosshair on it." "The \"output\" side of a builder is the side with a black crosshair on it."
.."\n\n".. .."\n\n"..

115
init.lua

@ -4,6 +4,7 @@ digtron.auto_controller_colorize = "#88000030"
digtron.pusher_controller_colorize = "#00880030" digtron.pusher_controller_colorize = "#00880030"
digtron.soft_digger_colorize = "#88880030" digtron.soft_digger_colorize = "#88880030"
dofile( minetest.get_modpath( "digtron" ) .. "/config.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/util.lua" ) dofile( minetest.get_modpath( "digtron" ) .. "/util.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/doc.lua" ) dofile( minetest.get_modpath( "digtron" ) .. "/doc.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/awards.lua" ) dofile( minetest.get_modpath( "digtron" ) .. "/awards.lua" )
@ -19,82 +20,6 @@ dofile( minetest.get_modpath( "digtron" ) .. "/node_axle.lua" ) -- Rotation cont
dofile( minetest.get_modpath( "digtron" ) .. "/node_crate.lua" ) -- Digtron portability support dofile( minetest.get_modpath( "digtron" ) .. "/node_crate.lua" ) -- Digtron portability support
dofile( minetest.get_modpath( "digtron" ) .. "/recipes.lua" ) dofile( minetest.get_modpath( "digtron" ) .. "/recipes.lua" )
-- Enables the spray of particles out the back of a digger head and puffs of smoke from the controller
local particle_effects = minetest.settings:get_bool("enable_particles")
-- this causes digtrons to operate without consuming fuel or building materials.
local digtron_uses_resources = minetest.settings:get_bool("digtron_uses_resources")
if digtron_uses_resources == nil then digtron_uses_resources = true end
-- when true, lava counts as protected nodes.
local lava_impassible = minetest.settings:get_bool("digtron_lava_impassible")
-- when true, diggers deal damage to creatures when they trigger.
local damage_creatures = minetest.settings:get_bool("digtron_damage_creatures")
digtron.creative_mode = not digtron_uses_resources -- default false
digtron.particle_effects = particle_effects or particle_effects == nil -- default true
digtron.lava_impassible = lava_impassible or lava_impassible == nil -- default true
digtron.diggers_damage_creatures = damage_creatures or damage_creatures == nil -- default true
-- How many seconds a digtron waits between cycles. Auto-controllers can make this wait longer, but cannot make it shorter.
local digtron_cycle_time = tonumber(minetest.settings:get("digtron_cycle_time"))
if digtron_cycle_time == nil or digtron_cycle_time < 0 then
digtron.cycle_time = 1.0
else
digtron.cycle_time = digtron_cycle_time
end
-- How many digtron nodes can be moved for each adjacent solid node that the digtron has traction against
local digtron_traction_factor = tonumber(minetest.settings:get("digtron_traction_factor"))
if digtron_traction_factor == nil or digtron_traction_factor < 0 then
digtron.traction_factor = 3.0
else
digtron.traction_factor = digtron_traction_factor
end
-- fuel costs. For comparison, in the default game:
-- one default tree block is 30 units
-- one coal lump is 40 units
-- one coal block is 370 units (apparently it's slightly more productive making your coal lumps into blocks before burning)
-- one book is 3 units
-- how much fuel is required to dig a node if not in one of the following groups.
local digtron_dig_cost_default = tonumber(minetest.settings:get("digtron_dig_cost_default"))
if digtron_dig_cost_default == nil or digtron_dig_cost_default < 0 then
digtron.dig_cost_default = 0.5
else
digtron.dig_cost_default = digtron_dig_cost_default
end
-- eg, stone
local digtron_dig_cost_cracky = tonumber(minetest.settings:get("digtron_dig_cost_cracky"))
if digtron_dig_cost_cracky == nil or digtron_dig_cost_cracky < 0 then
digtron.dig_cost_cracky = 1.0
else
digtron.dig_cost_cracky = digtron_dig_cost_cracky
end
-- eg, dirt, sand
local digtron_dig_cost_crumbly = tonumber(minetest.settings:get("digtron_dig_cost_crumbly"))
if digtron_dig_cost_crumbly == nil or digtron_dig_cost_crumbly < 0 then
digtron.dig_cost_crumbly = 0.5
else
digtron.dig_cost_crumbly = digtron_dig_cost_crumbly
end
-- eg, wood
local digtron_dig_cost_choppy = tonumber(minetest.settings:get("digtron_dig_cost_choppy"))
if digtron_dig_cost_choppy == nil or digtron_dig_cost_choppy < 0 then
digtron.dig_cost_choppy = 0.75
else
digtron.dig_cost_choppy = digtron_dig_cost_choppy
end
-- how much fuel is required to build a node
local digtron_build_cost = tonumber(minetest.settings:get("digtron_build_cost"))
if digtron_build_cost == nil or digtron_build_cost < 0 then
digtron.build_cost = 1.0
else
digtron.build_cost = digtron_build_cost
end
-- 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.
-- 2 - inventory-holding digtron, has a "main" inventory that the digtron can add to and take from. -- 2 - inventory-holding digtron, has a "main" inventory that the digtron can add to and take from.
@ -172,6 +97,44 @@ minetest.register_lbm({
end 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.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"),

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-26 13:42-0700\n" "POT-Creation-Date: 2017-09-10 19:05-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -321,6 +321,13 @@ msgid ""
"its output at those locations provided it is moving along the matching " "its output at those locations provided it is moving along the matching "
"axis.\n" "axis.\n"
"\n" "\n"
"There is also an \"Extrusion\" setting. This allows your builder to extrude "
"a line of identical blocks from the builder output, in the direction the "
"output side is facing, until it reaches an obstruction or until it reaches "
"the extrusion limit. This can be useful for placing columns below a bridge, "
"or for filling a large volume with a uniform block type without requiring a "
"large number of builder heads.\n"
"\n"
"The \"output\" side of a builder is the side with a black crosshair on it.\n" "The \"output\" side of a builder is the side with a black crosshair on it.\n"
"\n" "\n"
"Builders also have a \"facing\" setting. If you haven't memorized the " "Builders also have a \"facing\" setting. If you haven't memorized the "
@ -336,13 +343,13 @@ msgid ""
"avoid this for consistent results." "avoid this for consistent results."
msgstr "" msgstr ""
#: doc.lua:31 #: doc.lua:35
msgid "" msgid ""
"Stores building materials for use by builder heads and materials dug up by " "Stores building materials for use by builder heads and materials dug up by "
"digger heads." "digger heads."
msgstr "" msgstr ""
#: doc.lua:32 #: doc.lua:36
msgid "" msgid ""
"Inventory modules have the same capacity as a chest. They're used both for " "Inventory modules have the same capacity as a chest. They're used both for "
"storing the products of the digger heads and as the source of materials used " "storing the products of the digger heads and as the source of materials used "
@ -360,7 +367,7 @@ msgid ""
"capacity." "capacity."
msgstr "" msgstr ""
#: doc.lua:41 #: doc.lua:45
msgid "" msgid ""
"Digtron inventory modules are compatible with hoppers, adjacent hoppers will " "Digtron inventory modules are compatible with hoppers, adjacent hoppers will "
"add to or take from their inventories. Hoppers are not part of the Digtron " "add to or take from their inventories. Hoppers are not part of the Digtron "
@ -368,18 +375,18 @@ msgid ""
"\"docking station\" for a Digtron." "\"docking station\" for a Digtron."
msgstr "" msgstr ""
#: doc.lua:47 #: doc.lua:51
msgid "" msgid ""
"Inventory modules are compatible with Pipeworks blocks. When a Digtron moves " "Inventory modules are compatible with Pipeworks blocks. When a Digtron moves "
"one of the inventory modules adjacent to a pipe it will automatically hook " "one of the inventory modules adjacent to a pipe it will automatically hook "
"up to it, and disconnect again when it moves on." "up to it, and disconnect again when it moves on."
msgstr "" msgstr ""
#: doc.lua:50 #: doc.lua:54
msgid "Stores fuel to run a Digtron" msgid "Stores fuel to run a Digtron"
msgstr "" msgstr ""
#: doc.lua:51 #: doc.lua:55
msgid "" msgid ""
"Digtrons have an appetite. Build operations and dig operations require a " "Digtrons have an appetite. Build operations and dig operations require a "
"certain amount of fuel, and that fuel comes from fuel hopper modules. Note " "certain amount of fuel, and that fuel comes from fuel hopper modules. Note "
@ -402,7 +409,7 @@ msgid ""
"\tDig 80 dirt or sand blocks" "\tDig 80 dirt or sand blocks"
msgstr "" msgstr ""
#: doc.lua:64 #: doc.lua:68
msgid "" msgid ""
"Digtron fuel store modules are compatible with hoppers, adjacent hoppers " "Digtron fuel store modules are compatible with hoppers, adjacent hoppers "
"will add to or take from their inventories. Hoppers are not part of the " "will add to or take from their inventories. Hoppers are not part of the "
@ -410,19 +417,19 @@ msgid ""
"a \"docking station\" for a Digtron." "a \"docking station\" for a Digtron."
msgstr "" msgstr ""
#: doc.lua:70 #: doc.lua:74
msgid "" msgid ""
"Fuel modules are compatible with Pipeworks blocks. When a Digtron moves one " "Fuel modules are compatible with Pipeworks blocks. When a Digtron moves one "
"of the inventory modules adjacent to a pipe it will automatically hook up to " "of the inventory modules adjacent to a pipe it will automatically hook up to "
"it, and disconnect again when it moves on." "it, and disconnect again when it moves on."
msgstr "" msgstr ""
#: doc.lua:73 #: doc.lua:77
msgid "" msgid ""
"Stores fuel for a Digtron and also has an inventory for building materials" "Stores fuel for a Digtron and also has an inventory for building materials"
msgstr "" msgstr ""
#: doc.lua:74 #: doc.lua:78
msgid "" msgid ""
"For smaller jobs the two dedicated modules may simply be too much of a good " "For smaller jobs the two dedicated modules may simply be too much of a good "
"thing, wasting precious Digtron space to give unneeded capacity. The " "thing, wasting precious Digtron space to give unneeded capacity. The "
@ -431,7 +438,7 @@ msgid ""
"building material capacity and 1/4 fuel storage capacity." "building material capacity and 1/4 fuel storage capacity."
msgstr "" msgstr ""
#: doc.lua:79 #: doc.lua:83
msgid "" msgid ""
"Digtron inventory modules are compatible with hoppers, adjacent hoppers will " "Digtron inventory modules are compatible with hoppers, adjacent hoppers will "
"add to or take from their inventories. A hopper on top of a combined " "add to or take from their inventories. A hopper on top of a combined "
@ -442,7 +449,7 @@ msgid ""
"may be useful for creating a \"docking station\" for a Digtron." "may be useful for creating a \"docking station\" for a Digtron."
msgstr "" msgstr ""
#: doc.lua:85 #: doc.lua:89
msgid "" msgid ""
"Combination modules are compatible with Pipeworks blocks. When a Digtron " "Combination modules are compatible with Pipeworks blocks. When a Digtron "
"moves one of the inventory modules adjacent to a pipe it will automatically " "moves one of the inventory modules adjacent to a pipe it will automatically "
@ -453,11 +460,11 @@ msgid ""
"insert items into the \"fuel\" inventory instead." "insert items into the \"fuel\" inventory instead."
msgstr "" msgstr ""
#: doc.lua:90 #: doc.lua:94
msgid "An empty crate that a Digtron can be stored in" msgid "An empty crate that a Digtron can be stored in"
msgstr "" msgstr ""
#: doc.lua:91 #: doc.lua:95
msgid "" msgid ""
"Digtrons can be pushed around and rotated, and that may be enough for " "Digtrons can be pushed around and rotated, and that may be enough for "
"getting them perfectly positioned for the start of a run. But once your " "getting them perfectly positioned for the start of a run. But once your "
@ -472,11 +479,11 @@ msgid ""
"inside it." "inside it."
msgstr "" msgstr ""
#: doc.lua:95 #: doc.lua:99
msgid "A crate containing a Digtron array" msgid "A crate containing a Digtron array"
msgstr "" msgstr ""
#: doc.lua:96 #: doc.lua:100
msgid "" msgid ""
"This crate contains a Digtron assembly that was stored in it earlier. Place " "This crate contains a Digtron assembly that was stored in it earlier. Place "
"it somewhere and right-click on it to access the label text that was applied " "it somewhere and right-click on it to access the label text that was applied "
@ -487,11 +494,11 @@ msgid ""
"reused later." "reused later."
msgstr "" msgstr ""
#: doc.lua:100 #: doc.lua:104
msgid "A basic controller to make a Digtron array move and operate." msgid "A basic controller to make a Digtron array move and operate."
msgstr "" msgstr ""
#: doc.lua:101 #: doc.lua:105
msgid "" msgid ""
"Right-click on this module to make the digging machine go one step. The " "Right-click on this module to make the digging machine go one step. The "
"digging machine will go in the direction that the control module is " "digging machine will go in the direction that the control module is "
@ -504,13 +511,13 @@ msgid ""
"adjacent to it, you will be pulled along with the machine when it moves." "adjacent to it, you will be pulled along with the machine when it moves."
msgstr "" msgstr ""
#: doc.lua:107 #: doc.lua:111
msgid "" msgid ""
"A more sophisticated controller that includes the ability to set the number " "A more sophisticated controller that includes the ability to set the number "
"of cycles it will run for, as well as diagonal movement." "of cycles it will run for, as well as diagonal movement."
msgstr "" msgstr ""
#: doc.lua:108 #: doc.lua:112
msgid "" msgid ""
"An Auto-control module can be set to run for an arbitrary number of cycles. " "An Auto-control module can be set to run for an arbitrary number of cycles. "
"Once it's running, right-click on it again to interrupt its rampage. If " "Once it's running, right-click on it again to interrupt its rampage. If "
@ -543,13 +550,13 @@ msgid ""
"cobble, not stone)." "cobble, not stone)."
msgstr "" msgstr ""
#: doc.lua:118 #: doc.lua:122
msgid "" msgid ""
"A simplified controller that merely moves a Digtron around without " "A simplified controller that merely moves a Digtron around without "
"triggering its builder or digger modules" "triggering its builder or digger modules"
msgstr "" msgstr ""
#: doc.lua:119 #: doc.lua:123
msgid "" msgid ""
"Aka the \"can you rebuild it six inches to the left\" module. This is a much " "Aka the \"can you rebuild it six inches to the left\" module. This is a much "
"simplified control module that does not trigger the digger or builder heads " "simplified control module that does not trigger the digger or builder heads "
@ -561,11 +568,11 @@ msgid ""
"repositioning Digtrons let's say they have a built-in crane or something." "repositioning Digtrons let's say they have a built-in crane or something."
msgstr "" msgstr ""
#: doc.lua:123 #: doc.lua:127
msgid "A device that allows one to rotate their Digtron into new orientations" msgid "A device that allows one to rotate their Digtron into new orientations"
msgstr "" msgstr ""
#: doc.lua:124 #: doc.lua:128
msgid "" msgid ""
"This magical module can rotate a Digtron array in place around itself. Right-" "This magical module can rotate a Digtron array in place around itself. Right-"
"clicking on it will rotate the Digtron 90 degrees in the direction the " "clicking on it will rotate the Digtron 90 degrees in the direction the "
@ -575,11 +582,11 @@ msgid ""
"rotation." "rotation."
msgstr "" msgstr ""
#: doc.lua:128 #: doc.lua:132
msgid "A standard Digtron digger head" msgid "A standard Digtron digger head"
msgstr "" msgstr ""
#: doc.lua:129 #: doc.lua:133
msgid "" msgid ""
"Facing of a digger head is significant; it will excavate material from the " "Facing of a digger head is significant; it will excavate material from the "
"block on the spinning grinder wheel face of the digger head. Generally " "block on the spinning grinder wheel face of the digger head. Generally "
@ -587,11 +594,11 @@ msgid ""
"the sides can also be useful." "the sides can also be useful."
msgstr "" msgstr ""
#: doc.lua:131 #: doc.lua:135
msgid "Two standard Digtron digger heads merged at 90 degrees to each other" msgid "Two standard Digtron digger heads merged at 90 degrees to each other"
msgstr "" msgstr ""
#: doc.lua:132 #: doc.lua:136
msgid "" msgid ""
"This digger head is mainly of use when you want to build a Digtron capable " "This digger head is mainly of use when you want to build a Digtron capable "
"of digging diagonal paths. A normal one-direction dig head would be unable " "of digging diagonal paths. A normal one-direction dig head would be unable "
@ -602,13 +609,13 @@ msgid ""
"Digtron, though this is generally not of practical use." "Digtron, though this is generally not of practical use."
msgstr "" msgstr ""
#: doc.lua:136 #: doc.lua:140
msgid "" msgid ""
"Two standard soft-material Digtron digger heads merged at 90 degrees to each " "Two standard soft-material Digtron digger heads merged at 90 degrees to each "
"other" "other"
msgstr "" msgstr ""
#: doc.lua:137 #: doc.lua:141
msgid "" msgid ""
"This digger head is mainly of use when you want to build a Digtron capable " "This digger head is mainly of use when you want to build a Digtron capable "
"of digging diagonal paths. A normal one-direction dig head would be unable " "of digging diagonal paths. A normal one-direction dig head would be unable "
@ -622,23 +629,23 @@ msgid ""
"Digtron." "Digtron."
msgstr "" msgstr ""
#: doc.lua:143 #: doc.lua:147
msgid "A standard Digtron digger head that only triggers periodically" msgid "A standard Digtron digger head that only triggers periodically"
msgstr "" msgstr ""
#: doc.lua:144 #: doc.lua:148
msgid "" msgid ""
"This is a standard digger head capable of digging any material, but it will " "This is a standard digger head capable of digging any material, but it will "
"only trigger periodically as the Digtron moves. This can be useful for " "only trigger periodically as the Digtron moves. This can be useful for "
"punching regularly-spaced holes in a tunnel wall, for example." "punching regularly-spaced holes in a tunnel wall, for example."
msgstr "" msgstr ""
#: doc.lua:146 #: doc.lua:150
msgid "" msgid ""
"A standard soft-material Digtron digger head that only triggers periodically" "A standard soft-material Digtron digger head that only triggers periodically"
msgstr "" msgstr ""
#: doc.lua:147 #: doc.lua:151
msgid "" msgid ""
"This is a standard soft-material digger head capable of digging any " "This is a standard soft-material digger head capable of digging any "
"material, but it will only trigger periodically as the Digtron moves. This " "material, but it will only trigger periodically as the Digtron moves. This "
@ -646,11 +653,11 @@ msgid ""
"example." "example."
msgstr "" msgstr ""
#: doc.lua:149 #: doc.lua:153
msgid "A Digtron digger head that only excavates soft materials" msgid "A Digtron digger head that only excavates soft materials"
msgstr "" msgstr ""
#: doc.lua:150 #: doc.lua:154
msgid "" msgid ""
"This specialized digger head is designed to excavate only softer material " "This specialized digger head is designed to excavate only softer material "
"such as sand or gravel. In technical terms, this digger digs blocks " "such as sand or gravel. In technical terms, this digger digs blocks "
@ -665,11 +672,11 @@ msgid ""
"It can also serve as part of a lawnmower or tree-harvester." "It can also serve as part of a lawnmower or tree-harvester."
msgstr "" msgstr ""
#: doc.lua:158 #: doc.lua:162
msgid "Structural component for a Digtron array" msgid "Structural component for a Digtron array"
msgstr "" msgstr ""
#: doc.lua:159 #: doc.lua:163
msgid "" msgid ""
"These blocks allow otherwise-disconnected sections of digtron blocks to be " "These blocks allow otherwise-disconnected sections of digtron blocks to be "
"linked together. They are not usually necessary for simple diggers but more " "linked together. They are not usually necessary for simple diggers but more "
@ -684,11 +691,11 @@ msgid ""
"you ride your mighty mechanical leviathan through the landscape." "you ride your mighty mechanical leviathan through the landscape."
msgstr "" msgstr ""
#: doc.lua:165 #: doc.lua:169
msgid "Digtron light source" msgid "Digtron light source"
msgstr "" msgstr ""
#: doc.lua:166 #: doc.lua:170
msgid "" msgid ""
"A light source that moves along with the digging machine. Convenient if " "A light source that moves along with the digging machine. Convenient if "
"you're digging a tunnel that you don't intend to outfit with torches or " "you're digging a tunnel that you don't intend to outfit with torches or "
@ -696,53 +703,53 @@ msgid ""
"protective lens tends to get grimy while burrowing through the earth." "protective lens tends to get grimy while burrowing through the earth."
msgstr "" msgstr ""
#: doc.lua:168 #: doc.lua:172
msgid "Digtron panel" msgid "Digtron panel"
msgstr "" msgstr ""
#: doc.lua:169 #: doc.lua:173
msgid "" msgid ""
"A structural panel that can be made part of a Digtron to provide shelter for " "A structural panel that can be made part of a Digtron to provide shelter for "
"an operator, keep sand out of the Digtron's innards, or just to look cool." "an operator, keep sand out of the Digtron's innards, or just to look cool."
msgstr "" msgstr ""
#: doc.lua:171 #: doc.lua:175
msgid "Digtron edge panel" msgid "Digtron edge panel"
msgstr "" msgstr ""
#: doc.lua:172 #: doc.lua:176
msgid "" msgid ""
"A pair of structural panels that can be made part of a Digtron to provide " "A pair of structural panels that can be made part of a Digtron to provide "
"shelter for an operator, keep sand out of the Digtron's innards, or just to " "shelter for an operator, keep sand out of the Digtron's innards, or just to "
"look cool." "look cool."
msgstr "" msgstr ""
#: doc.lua:174 #: doc.lua:178
msgid "Digtron corner panel" msgid "Digtron corner panel"
msgstr "" msgstr ""
#: doc.lua:175 #: doc.lua:179
msgid "" msgid ""
"A trio of structural panels that can be made part of a Digtron to provide " "A trio of structural panels that can be made part of a Digtron to provide "
"shelter for an operator, keep sand out of the Digtron's innards, or just to " "shelter for an operator, keep sand out of the Digtron's innards, or just to "
"look cool." "look cool."
msgstr "" msgstr ""
#: doc.lua:179 #: doc.lua:183
msgid "Digtron" msgid "Digtron"
msgstr "" msgstr ""
#: doc.lua:180 #: doc.lua:184
msgid "" msgid ""
"The Digtron system is a set of blocks used to construct tunnel-boring and " "The Digtron system is a set of blocks used to construct tunnel-boring and "
"construction machines." "construction machines."
msgstr "" msgstr ""
#: doc.lua:187 #: doc.lua:191
msgid "Summary" msgid "Summary"
msgstr "" msgstr ""
#: doc.lua:188 #: doc.lua:192
msgid "" msgid ""
"Digtron blocks can be used to construct highly customizable and modular " "Digtron blocks can be used to construct highly customizable and modular "
"tunnel-boring machines, bridge-builders, road-pavers, wall-o-matics, and " "tunnel-boring machines, bridge-builders, road-pavers, wall-o-matics, and "
@ -764,11 +771,11 @@ msgid ""
"edges and corners don't count." "edges and corners don't count."
msgstr "" msgstr ""
#: doc.lua:201 #: doc.lua:205
msgid "Concepts" msgid "Concepts"
msgstr "" msgstr ""
#: doc.lua:203 #: doc.lua:207
msgid "" msgid ""
"Several general concepts are important when building more sophisticated " "Several general concepts are important when building more sophisticated "
"diggers.\n" "diggers.\n"
@ -807,11 +814,11 @@ msgid ""
"when moving in any direction." "when moving in any direction."
msgstr "" msgstr ""
#: doc.lua:217 #: doc.lua:221
msgid "Audio cues" msgid "Audio cues"
msgstr "" msgstr ""
#: doc.lua:219 #: doc.lua:223
msgid "" msgid ""
"When a digging machine is unable to complete a cycle it will make one of " "When a digging machine is unable to complete a cycle it will make one of "
"several noises to indicate what the problem is. It will also set its " "several noises to indicate what the problem is. It will also set its "
@ -857,11 +864,11 @@ msgid ""
"caution when opening the door to clear the obstruction." "caution when opening the door to clear the obstruction."
msgstr "" msgstr ""
#: doc.lua:237 #: doc.lua:241
msgid "Tips and Tricks" msgid "Tips and Tricks"
msgstr "" msgstr ""
#: doc.lua:239 #: doc.lua:243
msgid "" msgid ""
"To more easily visualize the operation of a Digtron, imagine that its cycle " "To more easily visualize the operation of a Digtron, imagine that its cycle "
"of operation follows these steps in order:\n" "of operation follows these steps in order:\n"
@ -887,8 +894,10 @@ msgstr ""
msgid "Digtron Rotation Axle" msgid "Digtron Rotation Axle"
msgstr "" msgstr ""
#: node_axle.lua:57 util_execute_cycle.lua:172 util_execute_cycle.lua:365 #: node_axle.lua:57
#: util_execute_cycle.lua:454 #: util_execute_cycle.lua:172
#: util_execute_cycle.lua:367
#: util_execute_cycle.lua:456
msgid "Digtron is obstructed." msgid "Digtron is obstructed."
msgstr "" msgstr ""
@ -896,22 +905,36 @@ msgstr ""
msgid "Block to build" msgid "Block to build"
msgstr "" msgstr ""
#: node_builders.lua:14 node_diggers.lua:32 #: node_builders.lua:14
msgid "Periodicity" msgid "Extrusion"
msgstr "" msgstr ""
#: node_builders.lua:15 #: node_builders.lua:15
msgid "" msgid ""
"Builder will extrude this many blocks in the direction it is facing.\n"
"Can be set from 1 to @1.\n"
"Note that Digtron won't build into unloaded map regions."
msgstr ""
#: node_builders.lua:16
#: node_diggers.lua:32
msgid "Periodicity"
msgstr ""
#: node_builders.lua:17
msgid ""
"Builder will build once every n steps.\n" "Builder will build once every n steps.\n"
"These steps are globally aligned, so all builders with the\n" "These steps are globally aligned, so all builders with the\n"
"same period and offset will build on the same location." "same period and offset will build on the same location."
msgstr "" msgstr ""
#: node_builders.lua:16 node_controllers.lua:91 node_diggers.lua:34 #: node_builders.lua:18
#: node_controllers.lua:91
#: node_diggers.lua:34
msgid "Offset" msgid "Offset"
msgstr "" msgstr ""
#: node_builders.lua:17 #: node_builders.lua:19
msgid "" msgid ""
"Offsets the start of periodicity counting by this amount.\n" "Offsets the start of periodicity counting by this amount.\n"
"For example, a builder with period 2 and offset 0 builds\n" "For example, a builder with period 2 and offset 0 builds\n"
@ -919,54 +942,60 @@ msgid ""
"offset 1 builds every odd-numbered block." "offset 1 builds every odd-numbered block."
msgstr "" msgstr ""
#: node_builders.lua:18 #: node_builders.lua:20
msgid "" msgid ""
"Save &\n" "Save &\n"
"Show" "Show"
msgstr "" msgstr ""
#: node_builders.lua:19 node_diggers.lua:37 #: node_builders.lua:21
#: node_diggers.lua:37
msgid "Saves settings" msgid "Saves settings"
msgstr "" msgstr ""
#: node_builders.lua:20 #: node_builders.lua:22
msgid "Facing" msgid "Facing"
msgstr "" msgstr ""
#: node_builders.lua:21 #: node_builders.lua:23
msgid "" msgid ""
"Value from 0-23. Not all block types make use of this.\n" "Value from 0-23. Not all block types make use of this.\n"
"Use the 'Read & Save' button to copy the facing of the block\n" "Use the 'Read & Save' button to copy the facing of the block\n"
"currently in the builder output location." "currently in the builder output location."
msgstr "" msgstr ""
#: node_builders.lua:22 #: node_builders.lua:24
msgid "" msgid ""
"Read &\n" "Read &\n"
"Save" "Save"
msgstr "" msgstr ""
#: node_builders.lua:23 #: node_builders.lua:25
msgid "" msgid ""
"Reads the facing of the block currently in the build location,\n" "Reads the facing of the block currently in the build location,\n"
"then saves all settings." "then saves all settings."
msgstr "" msgstr ""
#: node_builders.lua:32 node_controllers.lua:106 node_crate.lua:62 #: node_builders.lua:34
#: node_controllers.lua:106
#: node_crate.lua:62
#: node_diggers.lua:43 #: node_diggers.lua:43
msgid "Help" msgid "Help"
msgstr "" msgstr ""
#: node_builders.lua:33 node_controllers.lua:107 node_crate.lua:63 #: node_builders.lua:35
#: node_controllers.lua:107
#: node_crate.lua:63
#: node_diggers.lua:44 #: node_diggers.lua:44
msgid "Show documentation about this block" msgid "Show documentation about this block"
msgstr "" msgstr ""
#: node_builders.lua:38 #: node_builders.lua:40
msgid "Digtron Builder Module" msgid "Digtron Builder Module"
msgstr "" msgstr ""
#: node_builders.lua:241 node_builders.lua:255 #: node_builders.lua:279
#: node_builders.lua:294
#, lua-format #, lua-format
msgid "%s uses Digtron to build %s at (%d, %d, %d), displacing %s" msgid "%s uses Digtron to build %s at (%d, %d, %d), displacing %s"
msgstr "" msgstr ""
@ -975,9 +1004,12 @@ msgstr ""
msgid "Digtron Control Module" msgid "Digtron Control Module"
msgstr "" msgstr ""
#: node_controllers.lua:48 node_controllers.lua:200 util_execute_cycle.lua:110 #: node_controllers.lua:48
#: util_execute_cycle.lua:315 util_execute_cycle.lua:392 #: node_controllers.lua:200
#: util_execute_cycle.lua:503 #: util_execute_cycle.lua:110
#: util_execute_cycle.lua:317
#: util_execute_cycle.lua:394
#: util_execute_cycle.lua:505
#, lua-format #, lua-format
msgid "Heat remaining in controller furnace: %d" msgid "Heat remaining in controller furnace: %d"
msgstr "" msgstr ""
@ -1045,12 +1077,15 @@ msgstr ""
msgid "Stop block" msgid "Stop block"
msgstr "" msgstr ""
#: node_controllers.lua:128 node_controllers.lua:147 node_controllers.lua:160 #: node_controllers.lua:128
#: node_controllers.lua:147
#: node_controllers.lua:160
#, lua-format #, lua-format
msgid "Cycles remaining: %d" msgid "Cycles remaining: %d"
msgstr "" msgstr ""
#: node_controllers.lua:128 node_controllers.lua:147 #: node_controllers.lua:128
#: node_controllers.lua:147
msgid "Halted!" msgid "Halted!"
msgstr "" msgstr ""
@ -1074,39 +1109,47 @@ msgstr ""
msgid "Digtron can't be packaged, it contains protected blocks" msgid "Digtron can't be packaged, it contains protected blocks"
msgstr "" msgstr ""
#: node_crate.lua:42 node_crate.lua:43 #: node_crate.lua:42
#: node_crate.lua:43
msgid "Crated Digtron" msgid "Crated Digtron"
msgstr "" msgstr ""
#: node_crate.lua:55 node_crate.lua:70 #: node_crate.lua:55
#: node_crate.lua:70
msgid "Digtron Name" msgid "Digtron Name"
msgstr "" msgstr ""
#: node_crate.lua:56 node_crate.lua:71 #: node_crate.lua:56
#: node_crate.lua:71
msgid "" msgid ""
"Save\n" "Save\n"
"Title" "Title"
msgstr "" msgstr ""
#: node_crate.lua:57 node_crate.lua:72 #: node_crate.lua:57
#: node_crate.lua:72
msgid "Saves the title of this Digtron" msgid "Saves the title of this Digtron"
msgstr "" msgstr ""
#: node_crate.lua:58 node_crate.lua:73 #: node_crate.lua:58
#: node_crate.lua:73
msgid "" msgid ""
"Show\n" "Show\n"
"Blocks" "Blocks"
msgstr "" msgstr ""
#: node_crate.lua:59 node_crate.lua:74 #: node_crate.lua:59
#: node_crate.lua:74
msgid "Shows which blocks the packed Digtron will occupy if unpacked" msgid "Shows which blocks the packed Digtron will occupy if unpacked"
msgstr "" msgstr ""
#: node_crate.lua:60 node_crate.lua:75 #: node_crate.lua:60
#: node_crate.lua:75
msgid "Unpack" msgid "Unpack"
msgstr "" msgstr ""
#: node_crate.lua:61 node_crate.lua:76 #: node_crate.lua:61
#: node_crate.lua:76
msgid "Attempts to unpack the Digtron on this location" msgid "Attempts to unpack the Digtron on this location"
msgstr "" msgstr ""
@ -1195,7 +1238,8 @@ msgstr ""
msgid "Digtron Inventory Storage" msgid "Digtron Inventory Storage"
msgstr "" msgstr ""
#: node_storage.lua:34 node_storage.lua:190 #: node_storage.lua:34
#: node_storage.lua:187
msgid "Inventory items" msgid "Inventory items"
msgstr "" msgstr ""
@ -1203,11 +1247,12 @@ msgstr ""
msgid "Digtron Fuel Storage" msgid "Digtron Fuel Storage"
msgstr "" msgstr ""
#: node_storage.lua:103 node_storage.lua:192 #: node_storage.lua:103
#: node_storage.lua:189
msgid "Fuel items" msgid "Fuel items"
msgstr "" msgstr ""
#: node_storage.lua:166 #: node_storage.lua:163
msgid "Digtron Combined Storage" msgid "Digtron Combined Storage"
msgstr "" msgstr ""
@ -1219,27 +1264,28 @@ msgstr ""
msgid "Digtron is adjacent to unloaded nodes." msgid "Digtron is adjacent to unloaded nodes."
msgstr "" msgstr ""
#: util_execute_cycle.lua:219 #: util_execute_cycle.lua:220
msgid "Digtron needs more fuel." msgid "Digtron needs more fuel."
msgstr "" msgstr ""
#: util_execute_cycle.lua:229 #: util_execute_cycle.lua:230
msgid "" msgid ""
"Digtron connected to at least one builder with no output material assigned." "Digtron connected to at least one builder with no output material assigned."
msgstr "" msgstr ""
#: util_execute_cycle.lua:233 #: util_execute_cycle.lua:234
#, lua-format #, lua-format
msgid "Digtron has insufficient building materials. Needed: %s" msgid "Digtron has insufficient building materials. Needed: %s"
msgstr "" msgstr ""
#: util_execute_cycle.lua:302 #: util_execute_cycle.lua:304
msgid "" msgid ""
"Digtron unexpectedly failed to execute one or more build operations, likely " "Digtron unexpectedly failed to execute one or more build operations, likely "
"due to an inventory error." "due to an inventory error."
msgstr "" msgstr ""
#: util_execute_cycle.lua:327 util_execute_cycle.lua:515 #: util_execute_cycle.lua:329
#: util_execute_cycle.lua:517
#, lua-format #, lua-format
msgid "%s uses Digtron to dig %s at (%d, %d, %d)" msgid "%s uses Digtron to dig %s at (%d, %d, %d)"
msgstr "" msgstr ""

6
locale/update.bat Normal file

@ -0,0 +1,6 @@
@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
cd ..
set LIST=
for /r %%X in (*.lua) do set LIST=!LIST! %%X
..\intllib\tools\xgettext.bat %LIST%

@ -4,13 +4,17 @@ local S, NS = dofile(MP.."/intllib.lua")
-- Note: builders go in group 4 and have both test_build and execute_build methods. -- Note: builders go in group 4 and have both test_build and execute_build methods.
local builder_formspec = local builder_formspec = nil
"size[8,5.2]" ..
if minetest.get_modpath("doc") then
builder_formspec = "size[8,5.2]" ..
default.gui_bg .. default.gui_bg ..
default.gui_bg_img .. default.gui_bg_img ..
default.gui_slots .. default.gui_slots ..
"list[current_name;main;0.5,0;1,1;]" .. "list[current_name;main;0,0;1,1;]" ..
"label[0.5,0.8;" .. S("Block to build") .. "]" .. "label[0,0.8;" .. S("Block to build") .. "]" ..
"field[1.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.maximum_extrusion) .. "]" ..
"field[2.3,0.8;1,0.1;period;" .. S("Periodicity") .. ";${period}]" .. "field[2.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.") .. "]" .. "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[3.3,0.8;1,0.1;offset;" .. S("Offset") .. ";${offset}]" .. "field[3.3,0.8;1,0.1;offset;" .. S("Offset") .. ";${offset}]" ..
@ -25,12 +29,33 @@ local builder_formspec =
default.get_hotbar_bg(0,1.3) .. default.get_hotbar_bg(0,1.3) ..
"list[current_player;main;0,2.5;8,3;8]" .. "list[current_player;main;0,2.5;8,3;8]" ..
"listring[current_player;main]" .. "listring[current_player;main]" ..
"listring[current_name;main]" "listring[current_name;main]" ..
if minetest.get_modpath("doc") then
builder_formspec = builder_formspec ..
"button_exit[7.0,0.5;1,0.1;help;" .. S("Help") .. "]" .. "button_exit[7.0,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
builder_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.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 end
-- Builds objects in the targeted node. This is a complicated beastie. -- Builds objects in the targeted node. This is a complicated beastie.
@ -80,6 +105,7 @@ minetest.register_node("digtron:builder", {
meta:set_int("period", 1) meta:set_int("period", 1)
meta:set_int("offset", 0) meta:set_int("offset", 0)
meta:set_int("build_facing", 0) meta:set_int("build_facing", 0)
meta:set_int("extrusion", 1)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("main", 1) inv:set_size("main", 1)
@ -90,7 +116,9 @@ minetest.register_node("digtron:builder", {
local period = tonumber(fields.period) local period = tonumber(fields.period)
local offset = tonumber(fields.offset) local offset = tonumber(fields.offset)
local build_facing = tonumber(fields.build_facing) local build_facing = tonumber(fields.build_facing)
if period and period > 0 then local extrusion = tonumber(fields.extrusion)
if period and period > 0 then
meta:set_int("period", math.floor(tonumber(fields.period))) meta:set_int("period", math.floor(tonumber(fields.period)))
else else
period = meta:get_int("period") period = meta:get_int("period")
@ -105,6 +133,11 @@ minetest.register_node("digtron:builder", {
-- Should prevent that somehow. But not tonight. -- Should prevent that somehow. But not tonight.
meta:set_int("build_facing", math.floor(build_facing)) meta:set_int("build_facing", math.floor(build_facing))
end end
if extrusion and extrusion > 0 and extrusion <= digtron.maximum_extrusion then
meta:set_int("extrusion", math.floor(tonumber(fields.extrusion)))
else
extrusion = meta:get_int("extrusion")
end
if fields.set then if fields.set then
local buildpos = digtron.find_new_pos(pos, minetest.get_node(pos).param2) local buildpos = digtron.find_new_pos(pos, minetest.get_node(pos).param2)
@ -143,7 +176,7 @@ minetest.register_node("digtron:builder", {
end end
if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built
doc.show_entry(sender:get_player_name(), "nodes", "digtron:builder") minetest.after(0.5, doc.show_entry, sender:get_player_name(), "nodes", "digtron:builder", true)
end end
digtron.update_builder_item(pos) digtron.update_builder_item(pos)
@ -178,10 +211,10 @@ minetest.register_node("digtron:builder", {
-- If you're not supposed to build at all, or the location is obstructed, return 0 to let us know you're okay and we shouldn't abort." -- If you're not supposed to build at all, or the location is obstructed, return 0 to let us know you're okay and we shouldn't abort."
--return code and accompanying value: --return code and accompanying value:
-- 0, nil -- not supposed to build, no error -- 0, {} -- not supposed to build, no error
-- 1, {itemstack, source inventory pos} -- can build, took an item from inventory -- 1, {{itemstack, source inventory pos}, ...} -- can build, took items from inventory
-- 2, itemstack -- was supposed to build, but couldn't get the item from inventory -- 2, {{itemstack, source inventory pos}, ...}, itemstack -- was supposed to build, but couldn't get the item from inventory
-- 3, nil -- builder configuration error -- 3, {} -- builder configuration error
test_build = function(pos, test_pos, inventory_positions, protected_nodes, nodes_dug, controlling_coordinate, controller_pos) test_build = function(pos, test_pos, inventory_positions, protected_nodes, nodes_dug, controlling_coordinate, controller_pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local facing = minetest.get_node(pos).param2 local facing = minetest.get_node(pos).param2
@ -189,80 +222,113 @@ minetest.register_node("digtron:builder", {
if (buildpos[controlling_coordinate] + meta:get_int("offset")) % meta:get_int("period") ~= 0 then if (buildpos[controlling_coordinate] + meta:get_int("offset")) % meta:get_int("period") ~= 0 then
--It's not the builder's turn to build right now. --It's not the builder's turn to build right now.
return 0, nil return 0, {}
end end
if not digtron.can_move_to(buildpos, protected_nodes, nodes_dug) then local extrusion_count = 0
--using "can_move_to" instead of "can_build_to" test case in case the builder is pointed "backward", and will thus local extrusion_target = meta:get_int("extrusion")
--be building into the space that it's currently in and will be vacating after moving, or in case the builder is aimed if extrusion_target == nil or extrusion_target < 1 or extrusion_target > 100 then
--sideways and a fellow digtron node was ahead of it (will also be moving out of the way). extrusion_target = 1 -- failsafe
--If the player has built his digtron stupid (eg has another digtron node in the place the builder wants to build) this
--assumption is wrong, but I can't hold the player's hand through *every* possible bad design decision. Worst case,
--the digtron will think its inventory can't handle the next build step and abort the build when it actually could have
--managed one more cycle. That's not a bad outcome for a digtron array that was built stupidly to begin with.
--The player should be thanking me for all the error-checking I *do* do, really.
--Ungrateful wretch.
return 0, nil
end end
local return_items = {}
local inv = minetest.get_inventory({type="node", pos=pos}) local inv = minetest.get_inventory({type="node", pos=pos})
local item_stack = inv:get_stack("main", 1) local item_stack = inv:get_stack("main", 1)
if not item_stack:is_empty() then
if item_stack:is_empty() then
return 3, {} -- error code for "this builder's item slot is unset"
end
while extrusion_count < extrusion_target do
if not digtron.can_move_to(buildpos, protected_nodes, nodes_dug) then
--using "can_move_to" instead of "can_build_to" test case in case the builder is pointed "backward", and will thus
--be building into the space that it's currently in and will be vacating after moving, or in case the builder is aimed
--sideways and a fellow digtron node was ahead of it (will also be moving out of the way).
--If the player has built his digtron stupid (eg has another digtron node in the place the builder wants to build) this
--assumption is wrong, but I can't hold the player's hand through *every* possible bad design decision. Worst case,
--the digtron will think its inventory can't handle the next build step and abort the build when it actually could have
--managed one more cycle. That's not a bad outcome for a digtron array that was built stupidly to begin with.
return 1, return_items
end
local source_location = digtron.take_from_inventory(item_stack:get_name(), inventory_positions) local source_location = digtron.take_from_inventory(item_stack:get_name(), inventory_positions)
if source_location ~= nil then if source_location ~= nil then
return 1, {item=item_stack, location=source_location} table.insert(return_items, {item=item_stack, location=source_location})
else
return 2, return_items, item_stack -- error code for "needed an item but couldn't get it from inventory"
end end
return 2, item_stack -- error code for "needed an item but couldn't get it from inventory" extrusion_count = extrusion_count + 1
else buildpos = digtron.find_new_pos(buildpos, facing)
return 3, nil -- error code for "this builder's item slot is unset"
end end
return 1, return_items
end, end,
execute_build = function(pos, player, inventory_positions, protected_nodes, nodes_dug, controlling_coordinate, controller_pos) execute_build = function(pos, player, inventory_positions, protected_nodes, nodes_dug, controlling_coordinate, controller_pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local build_facing = meta:get_int("build_facing") local build_facing = tonumber(meta:get_int("build_facing"))
local facing = minetest.get_node(pos).param2 local facing = minetest.get_node(pos).param2
local buildpos = digtron.find_new_pos(pos, facing) local buildpos = digtron.find_new_pos(pos, facing)
local oldnode = minetest.get_node(buildpos)
if (buildpos[controlling_coordinate] + meta:get_int("offset")) % meta:get_int("period") ~= 0 then if (buildpos[controlling_coordinate] + meta:get_int("offset")) % meta:get_int("period") ~= 0 then
return nil return 0
end end
if digtron.can_build_to(buildpos, protected_nodes, nodes_dug) then local extrusion_count = 0
local inv = minetest.get_inventory({type="node", pos=pos}) local extrusion_target = meta:get_int("extrusion")
local item_stack = inv:get_stack("main", 1) if extrusion_target == nil or extrusion_target < 1 or extrusion_target > 100 then
if not item_stack:is_empty() then extrusion_target = 1 -- failsafe
end
local built_count = 0
if digtron.creative_mode then local inv = minetest.get_inventory({type="node", pos=pos})
local returned_stack, success = digtron.item_place_node(item_stack, player, buildpos, tonumber(build_facing)) local item_stack = inv:get_stack("main", 1)
if success == true then if item_stack:is_empty() then
minetest.log("action", string.format(S("%s uses Digtron to build %s at (%d, %d, %d), displacing %s"), player:get_player_name(), item_stack:get_name(), buildpos.x, buildpos.y, buildpos.z, oldnode.name)) return built_count
nodes_dug:set(buildpos.x, buildpos.y, buildpos.z, false) end
return true
end
return nil
end
local sourcepos = digtron.take_from_inventory(item_stack:get_name(), inventory_positions) while extrusion_count < extrusion_target do
if sourcepos == nil then if not digtron.can_build_to(buildpos, protected_nodes, nodes_dug) then
-- item not in inventory! Need to sound the angry buzzer to let the player know, so return false. return built_count
return false end
end
local returned_stack, success = digtron.item_place_node(item_stack, player, buildpos, tonumber(build_facing)) local oldnode = minetest.get_node(buildpos)
if digtron.creative_mode then
local returned_stack, success = digtron.item_place_node(item_stack, player, buildpos, build_facing)
if success == true then if success == true then
minetest.log("action", string.format(S("%s uses Digtron to build %s at (%d, %d, %d), displacing %s"), player:get_player_name(), item_stack:get_name(), buildpos.x, buildpos.y, buildpos.z, oldnode.name)) minetest.log("action", string.format(S("%s uses Digtron to build %s at (%d, %d, %d), displacing %s"), player:get_player_name(), item_stack:get_name(), buildpos.x, buildpos.y, buildpos.z, oldnode.name))
--flag this node as *not* to be dug.
nodes_dug:set(buildpos.x, buildpos.y, buildpos.z, false) nodes_dug:set(buildpos.x, buildpos.y, buildpos.z, false)
digtron.award_item_built(item_stack:get_name(), player:get_player_name()) built_count = built_count + 1
return true
else else
--failed to build, target node probably obstructed. Put the item back in inventory. return built_count
digtron.place_in_specific_inventory(item_stack, sourcepos, inventory_positions, controller_pos)
return nil
end end
end end
local sourcepos = digtron.take_from_inventory(item_stack:get_name(), inventory_positions)
if sourcepos == nil then
-- item not in inventory! Need to sound the angry buzzer to let the player know, so return a negative number.
return (built_count + 1) * -1
end
local returned_stack, success = digtron.item_place_node(item_stack, player, buildpos, build_facing)
if success == true then
minetest.log("action", string.format(S("%s uses Digtron to build %s at (%d, %d, %d), displacing %s"), player:get_player_name(), item_stack:get_name(), buildpos.x, buildpos.y, buildpos.z, oldnode.name))
--flag this node as *not* to be dug.
nodes_dug:set(buildpos.x, buildpos.y, buildpos.z, false)
digtron.award_item_built(item_stack:get_name(), player:get_player_name())
built_count = built_count + 1
else
--failed to build, target node probably obstructed. Put the item back in inventory.
--Should probably never reach this since we're guarding against can_build_to, above, but this makes things safe if we somehow do.
digtron.place_in_specific_inventory(item_stack, sourcepos, inventory_positions, controller_pos)
return built_count
end
extrusion_count = extrusion_count + 1
buildpos = digtron.find_new_pos(buildpos, facing)
end end
return built_count
end, end,
}) })

@ -275,7 +275,7 @@ minetest.register_node("digtron:auto_controller", {
end end
if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built
doc.show_entry(sender:get_player_name(), "nodes", "digtron:auto_controller") minetest.after(0.5, doc.show_entry, sender:get_player_name(), "nodes", "digtron:auto_controller", true)
end end
end, end,

@ -100,7 +100,7 @@ minetest.register_node("digtron:loaded_crate", {
end end
if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built
doc.show_entry(sender:get_player_name(), "nodes", "digtron:loaded_crate") minetest.after(0.5, doc.show_entry, sender:get_player_name(), "nodes", "digtron:loaded_crate", true)
end end
if not (fields.unpack or fields.show) then if not (fields.unpack or fields.show) then

@ -63,7 +63,7 @@ local intermittent_on_receive_fields = function(pos, formname, fields, sender)
end end
if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built
local node_name = minetest.get_node(pos).name local node_name = minetest.get_node(pos).name
doc.show_entry(sender:get_player_name(), "nodes", node_name) minetest.after(0.5, doc.show_entry, sender:get_player_name(), "nodes", node_name, true)
end end
end, end,

@ -2,17 +2,24 @@
#though they still check whether they have enough in inventory. #though they still check whether they have enough in inventory.
#It's a separate setting from regular creative mode. #It's a separate setting from regular creative mode.
digtron_uses_resources (Digtron uses resources) bool true digtron_uses_resources (Digtron uses resources) bool true
#When true, lava counts as protected blocks. #When true, lava counts as protected blocks.
digtron_lava_impassible (Lava is impassible to Digtrons) bool true digtron_lava_impassible (Lava is impassible to Digtrons) bool true
#When true, diggers deal damage to creatures when they trigger. #When true, diggers deal damage to creatures when they trigger.
digtron_damage_creatures (Digtrons cause damage) bool true digtron_damage_creatures (Digtrons cause damage) bool true
#How many seconds a digtron waits between cycles. #How many seconds a digtron waits between cycles.
#Auto-controllers can make this wait longer, but cannot make it shorter. #Auto-controllers can make this wait longer, but cannot make it shorter.
digtron_cycle_time (Minimum Digtron cycle time in seconds) float 1.0 0.0 60.0 digtron_cycle_time (Minimum Digtron cycle time in seconds) float 1.0 0.0 60.0
#How many Digtron blocks can be moved for each adjacent #How many Digtron blocks can be moved for each adjacent
#solid block that the Digtron has traction against #solid block that the Digtron has traction against
digtron_traction_factor (Digtron traction factor) float 3.0 0.0 1000.0 digtron_traction_factor (Digtron traction factor) float 3.0 0.0 1000.0
#The maximum extrusion setting permitted for a Digtron builder module.
digtron_maximum_extrusion (Digtron maximum extrusion) int 25 1 100
[Fuel costs] [Fuel costs]
#eg, stone. #eg, stone.

@ -180,7 +180,8 @@ digtron.execute_dig_cycle = function(pos, clicker)
-- Note that this test may overestimate the amount of work that will actually need to be done so don't treat its fuel cost as authoritative. -- Note that this test may overestimate the amount of work that will actually need to be done so don't treat its fuel cost as authoritative.
local can_build = true local can_build = true
local test_build_return_code = nil local test_build_return_code = nil
local test_build_return_item = nil local test_build_return_items = nil
local failed_to_find = nil
local test_items = {} local test_items = {}
local test_fuel_items = {} local test_fuel_items = {}
local test_build_fuel_cost = 0 local test_build_fuel_cost = 0
@ -189,15 +190,15 @@ digtron.execute_dig_cycle = function(pos, clicker)
local targetdef = minetest.registered_nodes[target.name] local targetdef = minetest.registered_nodes[target.name]
local test_location = vector.add(location.pos, dir) local test_location = vector.add(location.pos, dir)
if targetdef.test_build ~= nil then if targetdef.test_build ~= nil then
test_build_return_code, test_build_return_item = targetdef.test_build(location.pos, test_location, layout.inventories, layout.protected, layout.nodes_dug, controlling_coordinate, layout.controller) test_build_return_code, test_build_return_items, failed_to_find = targetdef.test_build(location.pos, test_location, layout.inventories, layout.protected, layout.nodes_dug, controlling_coordinate, layout.controller)
for k, return_item in pairs(test_build_return_items) do
table.insert(test_items, return_item)
test_build_fuel_cost = test_build_fuel_cost + digtron.build_cost
end
if test_build_return_code > 1 then if test_build_return_code > 1 then
can_build = false can_build = false
break break
end end
if test_build_return_code == 1 then
table.insert(test_items, test_build_return_item)
test_build_fuel_cost = test_build_fuel_cost + digtron.build_cost
end
else else
minetest.log(string.format("%s has builder group but is missing test_build method! This is an error in mod programming, file a bug.", targetdef.name)) minetest.log(string.format("%s has builder group but is missing test_build method! This is an error in mod programming, file a bug.", targetdef.name))
end end
@ -231,7 +232,7 @@ digtron.execute_dig_cycle = function(pos, clicker)
elseif test_build_return_code == 2 then elseif test_build_return_code == 2 then
minetest.sound_play("dingding", {gain=1.0, pos=pos}) -- Insufficient inventory minetest.sound_play("dingding", {gain=1.0, pos=pos}) -- Insufficient inventory
return_string = string.format(S("Digtron has insufficient building materials. Needed: %s") .. "\n", return_string = string.format(S("Digtron has insufficient building materials. Needed: %s") .. "\n",
test_build_return_item:get_name()) failed_to_find:get_name())
return_code = 7 return_code = 7
end end
return pos, return_string .. status_text, return_code --Abort, don't dig and don't build. return pos, return_string .. status_text, return_code --Abort, don't dig and don't build.
@ -281,13 +282,14 @@ digtron.execute_dig_cycle = function(pos, clicker)
if targetdef.execute_build ~= nil then if targetdef.execute_build ~= nil then
--using the old location of the controller as fallback so that any leftovers land with the rest of the digger output. Not that there should be any. --using the old location of the controller as fallback so that any leftovers land with the rest of the digger output. Not that there should be any.
local build_return = targetdef.execute_build(location.pos, clicker, layout.inventories, layout.protected, layout.nodes_dug, controlling_coordinate, oldpos) local build_return = targetdef.execute_build(location.pos, clicker, layout.inventories, layout.protected, layout.nodes_dug, controlling_coordinate, oldpos)
if build_return == false then if build_return < 0 then
-- This happens if there's insufficient inventory, but we should have confirmed there was sufficient inventory during test phase. -- This happens if there's insufficient inventory, but we should have confirmed there was sufficient inventory during test phase.
-- So this should never happen. However, "should never happens" happen sometimes. So -- So this should never happen. However, "should never happens" happen sometimes. So
-- don't interrupt the build cycle as a whole, we've already moved so might as well try to complete as much as possible. -- don't interrupt the build cycle as a whole, we've already moved so might as well try to complete as much as possible.
strange_failure = true strange_failure = true
elseif build_return == true and not digtron.creative_mode == true then build_return = (build_return * -1) - 1
building_fuel_cost = building_fuel_cost + digtron.build_cost elseif not digtron.creative_mode == true then
building_fuel_cost = building_fuel_cost + (digtron.build_cost * build_return)
end end
else else
minetest.log(string.format("%s has builder group but is missing execute_build method! This is an error in mod programming, file a bug.", targetdef.name)) minetest.log(string.format("%s has builder group but is missing execute_build method! This is an error in mod programming, file a bug.", targetdef.name))