summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.lua83
-rw-r--r--doc.lua6
-rw-r--r--init.lua115
-rw-r--r--locale/template.pot234
-rw-r--r--locale/update.bat6
-rw-r--r--node_builders.lua192
-rw-r--r--node_controllers.lua2
-rw-r--r--node_crate.lua2
-rw-r--r--node_diggers.lua2
-rw-r--r--settingtypes.txt7
-rw-r--r--util_execute_cycle.lua22
11 files changed, 424 insertions, 247 deletions
diff --git a/config.lua b/config.lua
new file mode 100644
index 0000000..d2d8860
--- /dev/null
+++ b/config.lua
@@ -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 \ No newline at end of file
diff --git a/doc.lua b/doc.lua
index 42fd5d2..275f5ac 100644
--- a/doc.lua
+++ b/doc.lua
@@ -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_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"..
"The \"output\" side of a builder is the side with a black crosshair on it."
.."\n\n"..
diff --git a/init.lua b/init.lua
index 324cd48..c01692e 100644
--- a/init.lua
+++ b/init.lua
@@ -4,6 +4,7 @@ digtron.auto_controller_colorize = "#88000030"
digtron.pusher_controller_colorize = "#00880030"
digtron.soft_digger_colorize = "#88880030"
+dofile( minetest.get_modpath( "digtron" ) .. "/config.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/util.lua" )
dofile( minetest.get_modpath( "digtron" ) .. "/doc.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" ) .. "/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:
-- 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.
@@ -172,6 +97,44 @@ minetest.register_lbm({
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
local digtron_nodes = {
minetest.get_content_id("digtron:inventory"),
diff --git a/locale/template.pot b/locale/template.pot
index 5d9e217..7489c3a 100644
--- a/locale/template.pot
+++ b/locale/template.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\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 "
"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"
"The \"output\" side of a builder is the side with a black crosshair on it.\n"
"\n"
"Builders also have a \"facing\" setting. If you haven't memorized the "
@@ -336,13 +343,13 @@ msgid ""
"avoid this for consistent results."
msgstr ""
-#: doc.lua:31
+#: doc.lua:35
msgid ""
"Stores building materials for use by builder heads and materials dug up by "
"digger heads."
msgstr ""
-#: doc.lua:32
+#: doc.lua:36
msgid ""
"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 "
@@ -360,7 +367,7 @@ msgid ""
"capacity."
msgstr ""
-#: doc.lua:41
+#: doc.lua:45
msgid ""
"Digtron inventory modules are compatible with hoppers, adjacent hoppers will "
"add to or take from their inventories. Hoppers are not part of the Digtron "
@@ -368,18 +375,18 @@ msgid ""
"\"docking station\" for a Digtron."
msgstr ""
-#: doc.lua:47
+#: doc.lua:51
msgid ""
"Inventory 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 it, and disconnect again when it moves on."
msgstr ""
-#: doc.lua:50
+#: doc.lua:54
msgid "Stores fuel to run a Digtron"
msgstr ""
-#: doc.lua:51
+#: doc.lua:55
msgid ""
"Digtrons have an appetite. Build operations and dig operations require a "
"certain amount of fuel, and that fuel comes from fuel hopper modules. Note "
@@ -402,7 +409,7 @@ msgid ""
"\tDig 80 dirt or sand blocks"
msgstr ""
-#: doc.lua:64
+#: doc.lua:68
msgid ""
"Digtron fuel store modules are compatible with hoppers, adjacent hoppers "
"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."
msgstr ""
-#: doc.lua:70
+#: doc.lua:74
msgid ""
"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 "
"it, and disconnect again when it moves on."
msgstr ""
-#: doc.lua:73
+#: doc.lua:77
msgid ""
"Stores fuel for a Digtron and also has an inventory for building materials"
msgstr ""
-#: doc.lua:74
+#: doc.lua:78
msgid ""
"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 "
@@ -431,7 +438,7 @@ msgid ""
"building material capacity and 1/4 fuel storage capacity."
msgstr ""
-#: doc.lua:79
+#: doc.lua:83
msgid ""
"Digtron inventory modules are compatible with hoppers, adjacent hoppers will "
"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."
msgstr ""
-#: doc.lua:85
+#: doc.lua:89
msgid ""
"Combination modules are compatible with Pipeworks blocks. When a Digtron "
"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."
msgstr ""
-#: doc.lua:90
+#: doc.lua:94
msgid "An empty crate that a Digtron can be stored in"
msgstr ""
-#: doc.lua:91
+#: doc.lua:95
msgid ""
"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 "
@@ -472,11 +479,11 @@ msgid ""
"inside it."
msgstr ""
-#: doc.lua:95
+#: doc.lua:99
msgid "A crate containing a Digtron array"
msgstr ""
-#: doc.lua:96
+#: doc.lua:100
msgid ""
"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 "
@@ -487,11 +494,11 @@ msgid ""
"reused later."
msgstr ""
-#: doc.lua:100
+#: doc.lua:104
msgid "A basic controller to make a Digtron array move and operate."
msgstr ""
-#: doc.lua:101
+#: doc.lua:105
msgid ""
"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 "
@@ -504,13 +511,13 @@ msgid ""
"adjacent to it, you will be pulled along with the machine when it moves."
msgstr ""
-#: doc.lua:107
+#: doc.lua:111
msgid ""
"A more sophisticated controller that includes the ability to set the number "
"of cycles it will run for, as well as diagonal movement."
msgstr ""
-#: doc.lua:108
+#: doc.lua:112
msgid ""
"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 "
@@ -543,13 +550,13 @@ msgid ""
"cobble, not stone)."
msgstr ""
-#: doc.lua:118
+#: doc.lua:122
msgid ""
"A simplified controller that merely moves a Digtron around without "
"triggering its builder or digger modules"
msgstr ""
-#: doc.lua:119
+#: doc.lua:123
msgid ""
"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 "
@@ -561,11 +568,11 @@ msgid ""
"repositioning Digtrons let's say they have a built-in crane or something."
msgstr ""
-#: doc.lua:123
+#: doc.lua:127
msgid "A device that allows one to rotate their Digtron into new orientations"
msgstr ""
-#: doc.lua:124
+#: doc.lua:128
msgid ""
"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 "
@@ -575,11 +582,11 @@ msgid ""
"rotation."
msgstr ""
-#: doc.lua:128
+#: doc.lua:132
msgid "A standard Digtron digger head"
msgstr ""
-#: doc.lua:129
+#: doc.lua:133
msgid ""
"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 "
@@ -587,11 +594,11 @@ msgid ""
"the sides can also be useful."
msgstr ""
-#: doc.lua:131
+#: doc.lua:135
msgid "Two standard Digtron digger heads merged at 90 degrees to each other"
msgstr ""
-#: doc.lua:132
+#: doc.lua:136
msgid ""
"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 "
@@ -602,13 +609,13 @@ msgid ""
"Digtron, though this is generally not of practical use."
msgstr ""
-#: doc.lua:136
+#: doc.lua:140
msgid ""
"Two standard soft-material Digtron digger heads merged at 90 degrees to each "
"other"
msgstr ""
-#: doc.lua:137
+#: doc.lua:141
msgid ""
"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 "
@@ -622,23 +629,23 @@ msgid ""
"Digtron."
msgstr ""
-#: doc.lua:143
+#: doc.lua:147
msgid "A standard Digtron digger head that only triggers periodically"
msgstr ""
-#: doc.lua:144
+#: doc.lua:148
msgid ""
"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 "
"punching regularly-spaced holes in a tunnel wall, for example."
msgstr ""
-#: doc.lua:146
+#: doc.lua:150
msgid ""
"A standard soft-material Digtron digger head that only triggers periodically"
msgstr ""
-#: doc.lua:147
+#: doc.lua:151
msgid ""
"This is a standard soft-material digger head capable of digging any "
"material, but it will only trigger periodically as the Digtron moves. This "
@@ -646,11 +653,11 @@ msgid ""
"example."
msgstr ""
-#: doc.lua:149
+#: doc.lua:153
msgid "A Digtron digger head that only excavates soft materials"
msgstr ""
-#: doc.lua:150
+#: doc.lua:154
msgid ""
"This specialized digger head is designed to excavate only softer material "
"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."
msgstr ""
-#: doc.lua:158
+#: doc.lua:162
msgid "Structural component for a Digtron array"
msgstr ""
-#: doc.lua:159
+#: doc.lua:163
msgid ""
"These blocks allow otherwise-disconnected sections of digtron blocks to be "
"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."
msgstr ""
-#: doc.lua:165
+#: doc.lua:169
msgid "Digtron light source"
msgstr ""
-#: doc.lua:166
+#: doc.lua:170
msgid ""
"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 "
@@ -696,53 +703,53 @@ msgid ""
"protective lens tends to get grimy while burrowing through the earth."
msgstr ""
-#: doc.lua:168
+#: doc.lua:172
msgid "Digtron panel"
msgstr ""
-#: doc.lua:169
+#: doc.lua:173
msgid ""
"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."
msgstr ""
-#: doc.lua:171
+#: doc.lua:175
msgid "Digtron edge panel"
msgstr ""
-#: doc.lua:172
+#: doc.lua:176
msgid ""
"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 "
"look cool."
msgstr ""
-#: doc.lua:174
+#: doc.lua:178
msgid "Digtron corner panel"
msgstr ""
-#: doc.lua:175
+#: doc.lua:179
msgid ""
"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 "
"look cool."
msgstr ""
-#: doc.lua:179
+#: doc.lua:183
msgid "Digtron"
msgstr ""
-#: doc.lua:180
+#: doc.lua:184
msgid ""
"The Digtron system is a set of blocks used to construct tunnel-boring and "
"construction machines."
msgstr ""
-#: doc.lua:187
+#: doc.lua:191
msgid "Summary"
msgstr ""
-#: doc.lua:188
+#: doc.lua:192
msgid ""
"Digtron blocks can be used to construct highly customizable and modular "
"tunnel-boring machines, bridge-builders, road-pavers, wall-o-matics, and "
@@ -764,11 +771,11 @@ msgid ""
"edges and corners don't count."
msgstr ""
-#: doc.lua:201
+#: doc.lua:205
msgid "Concepts"
msgstr ""
-#: doc.lua:203
+#: doc.lua:207
msgid ""
"Several general concepts are important when building more sophisticated "
"diggers.\n"
@@ -807,11 +814,11 @@ msgid ""
"when moving in any direction."
msgstr ""
-#: doc.lua:217
+#: doc.lua:221
msgid "Audio cues"
msgstr ""
-#: doc.lua:219
+#: doc.lua:223
msgid ""
"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 "
@@ -857,11 +864,11 @@ msgid ""
"caution when opening the door to clear the obstruction."
msgstr ""
-#: doc.lua:237
+#: doc.lua:241
msgid "Tips and Tricks"
msgstr ""
-#: doc.lua:239
+#: doc.lua:243
msgid ""
"To more easily visualize the operation of a Digtron, imagine that its cycle "
"of operation follows these steps in order:\n"
@@ -887,8 +894,10 @@ msgstr ""
msgid "Digtron Rotation Axle"
msgstr ""
-#: node_axle.lua:57 util_execute_cycle.lua:172 util_execute_cycle.lua:365
-#: util_execute_cycle.lua:454
+#: node_axle.lua:57
+#: util_execute_cycle.lua:172
+#: util_execute_cycle.lua:367
+#: util_execute_cycle.lua:456
msgid "Digtron is obstructed."
msgstr ""
@@ -896,22 +905,36 @@ msgstr ""
msgid "Block to build"
msgstr ""
-#: node_builders.lua:14 node_diggers.lua:32
-msgid "Periodicity"
+#: node_builders.lua:14
+msgid "Extrusion"
msgstr ""
#: node_builders.lua:15
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"
"These steps are globally aligned, so all builders with the\n"
"same period and offset will build on the same location."
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"
msgstr ""
-#: node_builders.lua:17
+#: node_builders.lua:19
msgid ""
"Offsets the start of periodicity counting by this amount.\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."
msgstr ""
-#: node_builders.lua:18
+#: node_builders.lua:20
msgid ""
"Save &\n"
"Show"
msgstr ""
-#: node_builders.lua:19 node_diggers.lua:37
+#: node_builders.lua:21
+#: node_diggers.lua:37
msgid "Saves settings"
msgstr ""
-#: node_builders.lua:20
+#: node_builders.lua:22
msgid "Facing"
msgstr ""
-#: node_builders.lua:21
+#: node_builders.lua:23
msgid ""
"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"
"currently in the builder output location."
msgstr ""
-#: node_builders.lua:22
+#: node_builders.lua:24
msgid ""
"Read &\n"
"Save"
msgstr ""
-#: node_builders.lua:23
+#: node_builders.lua:25
msgid ""
"Reads the facing of the block currently in the build location,\n"
"then saves all settings."
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
msgid "Help"
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
msgid "Show documentation about this block"
msgstr ""
-#: node_builders.lua:38
+#: node_builders.lua:40
msgid "Digtron Builder Module"
msgstr ""
-#: node_builders.lua:241 node_builders.lua:255
+#: node_builders.lua:279
+#: node_builders.lua:294
#, lua-format
msgid "%s uses Digtron to build %s at (%d, %d, %d), displacing %s"
msgstr ""
@@ -975,9 +1004,12 @@ msgstr ""
msgid "Digtron Control Module"
msgstr ""
-#: node_controllers.lua:48 node_controllers.lua:200 util_execute_cycle.lua:110
-#: util_execute_cycle.lua:315 util_execute_cycle.lua:392
-#: util_execute_cycle.lua:503
+#: node_controllers.lua:48
+#: node_controllers.lua:200
+#: util_execute_cycle.lua:110
+#: util_execute_cycle.lua:317
+#: util_execute_cycle.lua:394
+#: util_execute_cycle.lua:505
#, lua-format
msgid "Heat remaining in controller furnace: %d"
msgstr ""
@@ -1045,12 +1077,15 @@ msgstr ""
msgid "Stop block"
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
msgid "Cycles remaining: %d"
msgstr ""
-#: node_controllers.lua:128 node_controllers.lua:147
+#: node_controllers.lua:128
+#: node_controllers.lua:147
msgid "Halted!"
msgstr ""
@@ -1074,39 +1109,47 @@ msgstr ""
msgid "Digtron can't be packaged, it contains protected blocks"
msgstr ""
-#: node_crate.lua:42 node_crate.lua:43
+#: node_crate.lua:42
+#: node_crate.lua:43
msgid "Crated Digtron"
msgstr ""
-#: node_crate.lua:55 node_crate.lua:70
+#: node_crate.lua:55
+#: node_crate.lua:70
msgid "Digtron Name"
msgstr ""
-#: node_crate.lua:56 node_crate.lua:71
+#: node_crate.lua:56
+#: node_crate.lua:71
msgid ""
"Save\n"
"Title"
msgstr ""
-#: node_crate.lua:57 node_crate.lua:72
+#: node_crate.lua:57
+#: node_crate.lua:72
msgid "Saves the title of this Digtron"
msgstr ""
-#: node_crate.lua:58 node_crate.lua:73
+#: node_crate.lua:58
+#: node_crate.lua:73
msgid ""
"Show\n"
"Blocks"
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"
msgstr ""
-#: node_crate.lua:60 node_crate.lua:75
+#: node_crate.lua:60
+#: node_crate.lua:75
msgid "Unpack"
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"
msgstr ""
@@ -1195,7 +1238,8 @@ msgstr ""
msgid "Digtron Inventory Storage"
msgstr ""
-#: node_storage.lua:34 node_storage.lua:190
+#: node_storage.lua:34
+#: node_storage.lua:187
msgid "Inventory items"
msgstr ""
@@ -1203,11 +1247,12 @@ msgstr ""
msgid "Digtron Fuel Storage"
msgstr ""
-#: node_storage.lua:103 node_storage.lua:192
+#: node_storage.lua:103
+#: node_storage.lua:189
msgid "Fuel items"
msgstr ""
-#: node_storage.lua:166
+#: node_storage.lua:163
msgid "Digtron Combined Storage"
msgstr ""
@@ -1219,27 +1264,28 @@ msgstr ""
msgid "Digtron is adjacent to unloaded nodes."
msgstr ""
-#: util_execute_cycle.lua:219
+#: util_execute_cycle.lua:220
msgid "Digtron needs more fuel."
msgstr ""
-#: util_execute_cycle.lua:229
+#: util_execute_cycle.lua:230
msgid ""
"Digtron connected to at least one builder with no output material assigned."
msgstr ""
-#: util_execute_cycle.lua:233
+#: util_execute_cycle.lua:234
#, lua-format
msgid "Digtron has insufficient building materials. Needed: %s"
msgstr ""
-#: util_execute_cycle.lua:302
+#: util_execute_cycle.lua:304
msgid ""
"Digtron unexpectedly failed to execute one or more build operations, likely "
"due to an inventory error."
msgstr ""
-#: util_execute_cycle.lua:327 util_execute_cycle.lua:515
+#: util_execute_cycle.lua:329
+#: util_execute_cycle.lua:517
#, lua-format
msgid "%s uses Digtron to dig %s at (%d, %d, %d)"
msgstr ""
diff --git a/locale/update.bat b/locale/update.bat
new file mode 100644
index 0000000..e87d44c
--- /dev/null
+++ b/locale/update.bat
@@ -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% \ No newline at end of file
diff --git a/node_builders.lua b/node_builders.lua
index d7910c0..424eb67 100644
--- a/node_builders.lua
+++ b/node_builders.lua
@@ -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.
-local builder_formspec =
- "size[8,5.2]" ..
+local builder_formspec = nil
+
+if minetest.get_modpath("doc") then
+ 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") .. "]" ..
+ "list[current_name;main;0,0;1,1;]" ..
+ "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}]" ..
"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}]" ..
@@ -25,14 +29,35 @@ local builder_formspec =
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]"
-
-if minetest.get_modpath("doc") then
- builder_formspec = builder_formspec ..
+ "listring[current_name;main]" ..
"button_exit[7.0,0.5;1,0.1;help;" .. S("Help") .. "]" ..
"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
-
+
-- Builds objects in the targeted node. This is a complicated beastie.
minetest.register_node("digtron:builder", {
description = S("Digtron Builder Module"),
@@ -80,6 +105,7 @@ minetest.register_node("digtron:builder", {
meta:set_int("period", 1)
meta:set_int("offset", 0)
meta:set_int("build_facing", 0)
+ meta:set_int("extrusion", 1)
local inv = meta:get_inventory()
inv:set_size("main", 1)
@@ -90,7 +116,9 @@ minetest.register_node("digtron:builder", {
local period = tonumber(fields.period)
local offset = tonumber(fields.offset)
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)))
else
period = meta:get_int("period")
@@ -105,6 +133,11 @@ minetest.register_node("digtron:builder", {
-- Should prevent that somehow. But not tonight.
meta:set_int("build_facing", math.floor(build_facing))
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
local buildpos = digtron.find_new_pos(pos, minetest.get_node(pos).param2)
@@ -143,7 +176,7 @@ minetest.register_node("digtron:builder", {
end
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
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."
--return code and accompanying value:
- -- 0, nil -- not supposed to build, no error
- -- 1, {itemstack, source inventory pos} -- can build, took an item from inventory
- -- 2, itemstack -- was supposed to build, but couldn't get the item from inventory
- -- 3, nil -- builder configuration error
+ -- 0, {} -- not supposed to build, no error
+ -- 1, {{itemstack, source inventory pos}, ...} -- can build, took items from inventory
+ -- 2, {{itemstack, source inventory pos}, ...}, itemstack -- was supposed to build, but couldn't get the item from inventory
+ -- 3, {} -- builder configuration error
test_build = function(pos, test_pos, inventory_positions, protected_nodes, nodes_dug, controlling_coordinate, controller_pos)
local meta = minetest.get_meta(pos)
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
--It's not the builder's turn to build right now.
- return 0, nil
+ return 0, {}
end
- 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.
- --The player should be thanking me for all the error-checking I *do* do, really.
- --Ungrateful wretch.
- return 0, nil
+ local extrusion_count = 0
+ local extrusion_target = meta:get_int("extrusion")
+ if extrusion_target == nil or extrusion_target < 1 or extrusion_target > 100 then
+ extrusion_target = 1 -- failsafe
end
+ local return_items = {}
+
local inv = minetest.get_inventory({type="node", pos=pos})
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)
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
- return 2, item_stack -- error code for "needed an item but couldn't get it from inventory"
- else
- return 3, nil -- error code for "this builder's item slot is unset"
+ extrusion_count = extrusion_count + 1
+ buildpos = digtron.find_new_pos(buildpos, facing)
end
+
+ return 1, return_items
end,
execute_build = function(pos, player, inventory_positions, protected_nodes, nodes_dug, controlling_coordinate, controller_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 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
- return nil
+ return 0
end
- if digtron.can_build_to(buildpos, protected_nodes, nodes_dug) then
- local inv = minetest.get_inventory({type="node", pos=pos})
- local item_stack = inv:get_stack("main", 1)
- if not item_stack:is_empty() then
-
- if digtron.creative_mode then
- local returned_stack, success = digtron.item_place_node(item_stack, player, buildpos, tonumber(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))
- nodes_dug:set(buildpos.x, buildpos.y, buildpos.z, false)
- return true
- end
- return nil
- 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 false.
- return false
- end
- local returned_stack, success = digtron.item_place_node(item_stack, player, buildpos, tonumber(build_facing))
+ local extrusion_count = 0
+ local extrusion_target = meta:get_int("extrusion")
+ if extrusion_target == nil or extrusion_target < 1 or extrusion_target > 100 then
+ extrusion_target = 1 -- failsafe
+ end
+ local built_count = 0
+
+ local inv = minetest.get_inventory({type="node", pos=pos})
+ local item_stack = inv:get_stack("main", 1)
+ if item_stack:is_empty() then
+ return built_count
+ end
+
+ while extrusion_count < extrusion_target do
+ if not digtron.can_build_to(buildpos, protected_nodes, nodes_dug) then
+ return built_count
+ end
+
+ 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
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())
- return true
+ built_count = built_count + 1
else
- --failed to build, target node probably obstructed. Put the item back in inventory.
- digtron.place_in_specific_inventory(item_stack, sourcepos, inventory_positions, controller_pos)
- return nil
+ return built_count
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
+ return built_count
end,
}) \ No newline at end of file
diff --git a/node_controllers.lua b/node_controllers.lua
index 37805ef..a09cfbe 100644
--- a/node_controllers.lua
+++ b/node_controllers.lua
@@ -275,7 +275,7 @@ minetest.register_node("digtron:auto_controller", {
end
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,
diff --git a/node_crate.lua b/node_crate.lua
index 7e41a8e..017023d 100644
--- a/node_crate.lua
+++ b/node_crate.lua
@@ -100,7 +100,7 @@ minetest.register_node("digtron:loaded_crate", {
end
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
if not (fields.unpack or fields.show) then
diff --git a/node_diggers.lua b/node_diggers.lua
index dc8ddfc..c12b46c 100644
--- a/node_diggers.lua
+++ b/node_diggers.lua
@@ -63,7 +63,7 @@ local intermittent_on_receive_fields = function(pos, formname, fields, sender)
end
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
- 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,
diff --git a/settingtypes.txt b/settingtypes.txt
index bf1ce10..228c605 100644
--- a/settingtypes.txt
+++ b/settingtypes.txt
@@ -2,17 +2,24 @@
#though they still check whether they have enough in inventory.
#It's a separate setting from regular creative mode.
digtron_uses_resources (Digtron uses resources) bool true
+
#When true, lava counts as protected blocks.
digtron_lava_impassible (Lava is impassible to Digtrons) bool true
+
#When true, diggers deal damage to creatures when they trigger.
digtron_damage_creatures (Digtrons cause damage) bool true
+
#How many seconds a digtron waits between cycles.
#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
+
#How many Digtron blocks can be moved for each adjacent
#solid block that the Digtron has traction against
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]
#eg, stone.
diff --git a/util_execute_cycle.lua b/util_execute_cycle.lua
index 1dc47fa..0e0e092 100644
--- a/util_execute_cycle.lua
+++ b/util_execute_cycle.lua
@@ -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.
local can_build = true
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_fuel_items = {}
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 test_location = vector.add(location.pos, dir)
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
can_build = false
break
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
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
@@ -231,7 +232,7 @@ digtron.execute_dig_cycle = function(pos, clicker)
elseif test_build_return_code == 2 then
minetest.sound_play("dingding", {gain=1.0, pos=pos}) -- Insufficient inventory
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
end
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
--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)
- 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.
-- 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.
strange_failure = true
- elseif build_return == true and not digtron.creative_mode == true then
- building_fuel_cost = building_fuel_cost + digtron.build_cost
+ build_return = (build_return * -1) - 1
+ elseif not digtron.creative_mode == true then
+ building_fuel_cost = building_fuel_cost + (digtron.build_cost * build_return)
end
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))