mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-12-24 01:40:36 +01:00
make hunters avoid repaired ancient lanterns
This commit is contained in:
parent
bc07e123ce
commit
cdaeb36b14
@ -13,6 +13,9 @@ if minetest.get_modpath("hunter_statue") and df_underworld_items.config.underwor
|
||||
tnt_vulnerable = true,
|
||||
tnt_debris = "df_underworld_items:slade_sand",
|
||||
groups = {hunter_statue = 1, falling_node = 1, immortal = 1},
|
||||
hunters_allowed_here = function(pos)
|
||||
return not minetest.find_node_near(pos, 6, "df_underworld_items:ancient_lantern_slade", true)
|
||||
end,
|
||||
other_overrides = {
|
||||
can_dig = function(pos, player)
|
||||
if player then
|
||||
|
@ -37,6 +37,7 @@ local test_array = {
|
||||
-- knockback = 16
|
||||
-- tnt_vulnerable = false
|
||||
-- tnt_debris =
|
||||
-- hunters_allowed_here = -- function(pos)
|
||||
-- other_overrides =
|
||||
--}
|
||||
|
||||
@ -74,6 +75,7 @@ hunter_statue.register_hunter_statue = function(node_name, statue_def)
|
||||
|
||||
local knockback = statue_def.knockback or 16
|
||||
local damage = statue_def.damage or 8
|
||||
local hunters_allowed_here = statue_def.hunters_allowed_here
|
||||
|
||||
minetest.register_node(node_name, def)
|
||||
|
||||
@ -124,24 +126,26 @@ hunter_statue.register_hunter_statue = function(node_name, statue_def)
|
||||
local new_pos = vector.round(vector.add(pos, player_dir))
|
||||
for _, add_pos in ipairs(test_array) do
|
||||
local test_base = vector.add(new_pos, add_pos)
|
||||
local test_base_node = minetest.get_node(test_base)
|
||||
local test_base_node_def = minetest.registered_nodes[test_base_node.name]
|
||||
if test_base_node_def and test_base_node_def.buildable_to then
|
||||
local test_above = vector.add(test_base, {x=0, y=1, z=0})
|
||||
local test_above_node = minetest.get_node(test_above)
|
||||
local test_above_node_def = minetest.registered_nodes[test_above_node.name]
|
||||
if test_above_node_def and test_above_node_def.buildable_to then
|
||||
local test_below = vector.add(test_base, {x=0, y=-1, z=0})
|
||||
local test_below_node = minetest.get_node(test_below)
|
||||
local test_below_node_def = minetest.registered_nodes[test_below_node.name]
|
||||
if test_below_node_def and test_below_node_def.walkable then
|
||||
minetest.set_node(pos, {name="air"}) -- old location
|
||||
minetest.set_node(test_above, {name="air"}) -- some kind of filler node?
|
||||
node.param2 = new_facedir
|
||||
minetest.set_node(test_base, node)
|
||||
minetest.check_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
minetest.sound_play({name="hunter_statue_brick_step"}, {pos = pos, gain = 0.5})
|
||||
return
|
||||
if hunters_allowed_here == nil or hunters_allowed_here(test_base) then
|
||||
local test_base_node = minetest.get_node(test_base)
|
||||
local test_base_node_def = minetest.registered_nodes[test_base_node.name]
|
||||
if test_base_node_def and test_base_node_def.buildable_to then
|
||||
local test_above = vector.add(test_base, {x=0, y=1, z=0})
|
||||
local test_above_node = minetest.get_node(test_above)
|
||||
local test_above_node_def = minetest.registered_nodes[test_above_node.name]
|
||||
if test_above_node_def and test_above_node_def.buildable_to then
|
||||
local test_below = vector.add(test_base, {x=0, y=-1, z=0})
|
||||
local test_below_node = minetest.get_node(test_below)
|
||||
local test_below_node_def = minetest.registered_nodes[test_below_node.name]
|
||||
if test_below_node_def and test_below_node_def.walkable then
|
||||
minetest.set_node(pos, {name="air"}) -- old location
|
||||
minetest.set_node(test_above, {name="air"}) -- some kind of filler node?
|
||||
node.param2 = new_facedir
|
||||
minetest.set_node(test_base, node)
|
||||
minetest.check_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
minetest.sound_play({name="hunter_statue_brick_step"}, {pos = pos, gain = 0.5})
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user