summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-05 20:38:08 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-05 20:38:08 -0700
commit253ff1281571b888cfbfeb1a719eb98a1b5b98de (patch)
treed0995c9782df97af058b9b3757acba805d80676d
parent1307710a60589555f7f08da90b28b78ae111f565 (diff)
add lava and water alerts, and an option for setting lava impassible (true by default)
-rw-r--r--README.txt4
-rw-r--r--init.lua5
-rw-r--r--node_controllers.lua6
-rw-r--r--sounds/license.txt2
-rw-r--r--sounds/sploosh.oggbin0 -> 17787 bytes
-rw-r--r--sounds/woopwoopwoop.oggbin0 -> 20289 bytes
-rw-r--r--util.lua11
7 files changed, 26 insertions, 2 deletions
diff --git a/README.txt b/README.txt
index d0d33cf..9c62cef 100644
--- a/README.txt
+++ b/README.txt
@@ -136,6 +136,10 @@ A ringing bell indicates that there are insufficient materials in inventory to s
A short high-pitched honk means that one or more of the builder heads don't have an item set. A common oversight, especially with large and elaborate digging machines, that might be hard to notice and annoying to fix if not noticed right away.
+Splooshing water sounds means your Digtron is digging adjacent to (or through) water-containing nodes. Digtrons are waterproof, but this might be a useful indication that you should take care when installing doors in the tunnel walls you've placed here.
+
+A triple "voop voop voop!" alarm indicates that there is lava adjacent to your Digtron. Digtrons can't penetrate lava by default, and although they are not destroyed by lava this alarm indicates that a non-lava-proof Digtron operator may wish to exercise caution when backing up.
+
Crafting recipes
================
diff --git a/init.lua b/init.lua
index fc18dc6..1576130 100644
--- a/init.lua
+++ b/init.lua
@@ -7,8 +7,9 @@ dofile( minetest.get_modpath( "digtron" ) .. "/node_builders.lua" ) -- contains
dofile( minetest.get_modpath( "digtron" ) .. "/node_controllers.lua" ) -- controllers
dofile( minetest.get_modpath( "digtron" ) .."/recipes.lua" )
-digtron.creative_mode = false
-digtron.particle_effects = true
+digtron.creative_mode = false -- this causes digtrons to operate without consuming fuel or building materials.
+digtron.particle_effects = true -- Enables the spray of particles out the back of a digger head
+digtron.lava_impassible = true -- when true, lava counts as protected nodes.
digtron.cycle_time = 1 -- How many seconds a digtron waits between cycles. Auto-controllers can make this wait longer, but cannot make it shorter.
digtron.traction_factor = 3.0 -- How many digtron nodes can be moved for each adjacent solid node that the digtron has traction against
diff --git a/node_controllers.lua b/node_controllers.lua
index cfd449b..c897502 100644
--- a/node_controllers.lua
+++ b/node_controllers.lua
@@ -32,6 +32,12 @@ local execute_cycle = function(pos, clicker)
return pos, "Digtron is adjacent to unloaded nodes.\n" .. status_text
end
+ if layout.water_touching == true then
+ minetest.sound_play("sploosh", {gain=1.0, pos=pos})
+ end
+ if layout.lava_touching == true then
+ minetest.sound_play("woopwoopwoop", {gain=1.0, pos=pos})
+ end
if layout.traction * digtron.traction_factor < table.getn(layout.all) then
-- digtrons can't fly
minetest.sound_play("squeal", {gain=1.0, pos=pos})
diff --git a/sounds/license.txt b/sounds/license.txt
index 77f5a88..165e797 100644
--- a/sounds/license.txt
+++ b/sounds/license.txt
@@ -6,6 +6,8 @@ dingding.ogg - https://www.freesound.org/people/JohnsonBrandEditing/sounds/17393
squeal.ogg - https://www.freesound.org/people/RutgerMuller/sounds/104026/ public domain via CC 1.0 by RutgerMuller
honk.ogg - https://freesound.org/people/bigmanjoe/sounds/349922/ public domain via CC 1.0 by bigmanjoe
truck.ogg - https://www.freesound.org/people/jberkuta14/sounds/134898/ public domain via CC 1.0 by jberkuta14
+sploosh.ogg - https://www.freesound.org/people/mr_marcello/sounds/257609/ public domain via CC 1.0 by mr_marcello
+woopwoopwoop.ogg - https://www.freesound.org/people/gregconquest/sounds/188012/ public domain via CC 1.0 by gregconquest
Creative Commons Attribution 3.0 license:
diff --git a/sounds/sploosh.ogg b/sounds/sploosh.ogg
new file mode 100644
index 0000000..5e7a226
--- /dev/null
+++ b/sounds/sploosh.ogg
Binary files differ
diff --git a/sounds/woopwoopwoop.ogg b/sounds/woopwoopwoop.ogg
new file mode 100644
index 0000000..beb26be
--- /dev/null
+++ b/sounds/woopwoopwoop.ogg
Binary files differ
diff --git a/util.lua b/util.lua
index 2c1c967..a74f21f 100644
--- a/util.lua
+++ b/util.lua
@@ -138,6 +138,8 @@ digtron.get_all_digtron_neighbours = function(pos, player)
layout.diggers = {}
layout.builders = {}
layout.extents = {}
+ layout.water_touching = false
+ layout.lava_touching = false
layout.protected = Pointset.create() -- if any nodes we look at are protected, make note of that. That way we don't need to keep re-testing protection state later.
layout.controller = {x=pos.x, y=pos.y, z=pos.z} --Make a deep copy of the pos parameter just in case the calling code wants to play silly buggers with it
@@ -182,6 +184,15 @@ digtron.get_all_digtron_neighbours = function(pos, player)
layout.protected:set(testpos.x, testpos.y, testpos.z, true)
end
+ if minetest.get_item_group(node.name, "water") ~= 0 then
+ layout.water_touching = true
+ elseif minetest.get_item_group(node.name, "lava") ~= 0 then
+ layout.lava_touching = true
+ if digtron.lava_impassible == true then
+ layout.protected:set(testpos.x, testpos.y, testpos.z, true)
+ end
+ end
+
local group_number = minetest.get_item_group(node.name, "digtron")
if group_number > 0 then
--found one. Add it to the digtrons output