add lava and water alerts, and an option for setting lava impassible (true by default)

This commit is contained in:
FaceDeer 2017-01-05 20:38:08 -07:00
parent 1307710a60
commit 253ff12815
7 changed files with 26 additions and 2 deletions

@ -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
================

@ -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

@ -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})

@ -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:

BIN
sounds/sploosh.ogg Normal file

Binary file not shown.

BIN
sounds/woopwoopwoop.ogg Normal file

Binary file not shown.

@ -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