diff options
author | FaceDeer <derksenmobile@gmail.com> | 2017-01-06 23:48:48 -0700 |
---|---|---|
committer | FaceDeer <derksenmobile@gmail.com> | 2017-01-06 23:48:48 -0700 |
commit | 257863b8884837623f39d8381ce4d7454b52add5 (patch) | |
tree | 4ddfeebe53138aa3c1c092d2b087392171b438c5 /node_diggers.lua | |
parent | ee0cf5538a865ebaeaafa93d5303e820dfcd1ea3 (diff) |
Add damage-dealing to the digger heads
Diffstat (limited to 'node_diggers.lua')
-rw-r--r-- | node_diggers.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/node_diggers.lua b/node_diggers.lua index 579cb12..3a7d9f8 100644 --- a/node_diggers.lua +++ b/node_diggers.lua @@ -83,6 +83,10 @@ minetest.register_node("digtron:digger", { return digtron.mark_diggable(digpos, nodes_dug) end, + + damage_creatures = function(player, pos, targetpos, controlling_coordinate) + digtron.damage_creatures(player, targetpos, 8) + end, }) -- Digs out nodes that are "in front" of the digger head. @@ -138,6 +142,13 @@ minetest.register_node("digtron:intermittent_digger", { return digtron.mark_diggable(digpos, nodes_dug) end, + + damage_creatures = function(player, pos, targetpos, controlling_coordinate) + local meta = minetest.get_meta(pos) + if (targetpos[controlling_coordinate] + meta:get_int("offset")) % meta:get_int("period") == 0 then + digtron.damage_creatures(player, targetpos, 8) + end + end }) -- A special-purpose digger to deal with stuff like sand and gravel in the ceiling. It always digs (no periodicity or offset), but it only digs falling_block nodes @@ -192,6 +203,10 @@ minetest.register_node("digtron:soft_digger", { return 0, nil end, + + damage_creatures = function(player, pos, targetpos, controlling_coordinate) + digtron.damage_creatures(player, targetpos, 4) + end, }) minetest.register_node("digtron:intermittent_soft_digger", { @@ -254,4 +269,11 @@ minetest.register_node("digtron:intermittent_soft_digger", { return 0, nil end, + + damage_creatures = function(player, pos, targetpos, controlling_coordinate) + local meta = minetest.get_meta(pos) + if (targetpos[controlling_coordinate] + meta:get_int("offset")) % meta:get_int("period") == 0 then + digtron.damage_creatures(player, targetpos, 4) + end + end, })
\ No newline at end of file |