mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-25 18:20:20 +01:00
added mobs:boom functin to replace mobs:explosion
This commit is contained in:
parent
f985d00b61
commit
7fba32b8d9
21
api.lua
21
api.lua
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
-- Mobs Api (9th July 2017)
|
-- Mobs Api (13th July 2017)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
mobs.version = "20170709"
|
mobs.version = "20170713"
|
||||||
|
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
@ -1694,7 +1694,8 @@ local do_states = function(self, dtime)
|
|||||||
|
|
||||||
self.object:remove()
|
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, {
|
tnt.boom(pos, {
|
||||||
radius = radius,
|
radius = radius,
|
||||||
@ -2973,14 +2974,24 @@ function mobs:register_arrow(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- compatibility function
|
||||||
function mobs:explosion(pos, radius)
|
function mobs:explosion(pos, radius)
|
||||||
|
local self = {sounds = {}}
|
||||||
|
self.sounds.explode = "tnt_explode"
|
||||||
|
mobs:boom(self, pos, radius)
|
||||||
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("tnt") and tnt and tnt.boom then
|
|
||||||
|
-- make explosion with protection and tnt mod check
|
||||||
|
function mobs:boom(self, pos, radius)
|
||||||
|
|
||||||
|
if minetest.get_modpath("tnt") and tnt and tnt.boom
|
||||||
|
and not minetest.is_protected(pos, "") then
|
||||||
|
|
||||||
tnt.boom(pos, {
|
tnt.boom(pos, {
|
||||||
radius = radius,
|
radius = radius,
|
||||||
damage_radius = radius,
|
damage_radius = radius,
|
||||||
-- sound = self.sounds.explode,
|
sound = self.sounds.explode,
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
mob_sound(self, self.sounds.explode)
|
mob_sound(self, self.sounds.explode)
|
||||||
|
11
api.txt
11
api.txt
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
MOB API (8th July 2017)
|
MOB API (13th July 2017)
|
||||||
|
|
||||||
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
|
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
|
||||||
|
|
||||||
@ -229,15 +229,14 @@ This function registers a spawn egg which can be used by admin to properly spawn
|
|||||||
'no_creative' when set to true this stops spawn egg appearing in creative mode for destructive mobs like Dungeon Masters
|
'no_creative' when set to true this stops spawn egg appearing in creative mode for destructive mobs like Dungeon Masters
|
||||||
|
|
||||||
|
|
||||||
mobs:explosion(pos, radius, fire, smoke) -- DEPRECATED!!! use tnt mod's tnt.boom function instead
|
mobs:explosion(pos, radius) -- DEPRECATED!!! use mobs:boom() instead
|
||||||
|
|
||||||
This function generates an explosion which removes nodes in a specific radius and replace them with fire or air. Protection nodes, obsidian and locked chests will not be destroyed although a normal chest will drop it's contents.
|
mobs:boom(self, pos, radius)
|
||||||
|
This function generates an explosion which removes nodes in a specific radius and damages any entity caught inside the blast radius. Protection will limit node destruction but not entity damage.
|
||||||
|
|
||||||
|
'self' mob entity
|
||||||
'pos' centre position of explosion
|
'pos' centre position of explosion
|
||||||
'radius' radius of explosion (typically set to 3)
|
'radius' radius of explosion (typically set to 3)
|
||||||
'fire' should fire appear in explosion (1=yes, 0=no)
|
|
||||||
'smoke' should smoke appear in explosion (1=yes, 0=no)
|
|
||||||
'sound' sound played when mob explodes
|
|
||||||
|
|
||||||
|
|
||||||
mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith)
|
mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith)
|
||||||
|
Loading…
Reference in New Issue
Block a user