summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2017-07-13 10:16:24 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2017-07-13 10:16:24 +0100
commit7fba32b8d9933dc1dbb73774f192d13d209b0746 (patch)
tree1542a0f1ec3f276b00e83ed72bce114a9fe43c12 /api.lua
parentf985d00b6115cf31a8beeb7cefdaa5e0fcf78b66 (diff)
added mobs:boom functin to replace mobs:explosion
Diffstat (limited to 'api.lua')
-rw-r--r--api.lua21
1 files changed, 16 insertions, 5 deletions
diff --git a/api.lua b/api.lua
index 8fa2149..359325c 100644
--- a/api.lua
+++ b/api.lua
@@ -1,9 +1,9 @@
--- Mobs Api (9th July 2017)
+-- Mobs Api (13th July 2017)
mobs = {}
mobs.mod = "redo"
-mobs.version = "20170709"
+mobs.version = "20170713"
-- Intllib
@@ -1694,7 +1694,8 @@ local do_states = function(self, dtime)
self.object:remove()
- if minetest.get_modpath("tnt") and tnt and tnt.boom then
+ if minetest.get_modpath("tnt") and tnt and tnt.boom
+ and not minetest.is_protected(pos, "") then
tnt.boom(pos, {
radius = radius,
@@ -2973,14 +2974,24 @@ function mobs:register_arrow(name, def)
end
+-- compatibility function
function mobs:explosion(pos, radius)
+ local self = {sounds = {}}
+ self.sounds.explode = "tnt_explode"
+ mobs:boom(self, pos, radius)
+end
+
+
+-- make explosion with protection and tnt mod check
+function mobs:boom(self, pos, radius)
- if minetest.get_modpath("tnt") and tnt and tnt.boom then
+ if minetest.get_modpath("tnt") and tnt and tnt.boom
+ and not minetest.is_protected(pos, "") then
tnt.boom(pos, {
radius = radius,
damage_radius = radius,
--- sound = self.sounds.explode,
+ sound = self.sounds.explode,
})
else
mob_sound(self, self.sounds.explode)