tidy code

This commit is contained in:
TenPlus1 2018-08-08 10:15:26 +01:00
parent da0238cb84
commit 477ad59670
1 changed files with 8 additions and 6 deletions

14
api.lua
View File

@ -3,7 +3,7 @@
mobs = {}
mobs.mod = "redo"
mobs.version = "20180803"
mobs.version = "20180808"
-- Intllib
@ -182,7 +182,7 @@ local set_animation = function(self, anim)
self.animation.current = self.animation.current or ""
-- only set different animation
-- only set different animation for attacks when setting to same set
if anim ~= "punch" and anim ~= "shoot"
and string.find(self.animation.current, anim) then
return
@ -1171,7 +1171,7 @@ local smart_mobs = function(self, s, p, dist, dtime)
end, self)
end
if math.abs(vector.subtract(s,target_pos).y) > self.stepheight then
if abs(vector.subtract(s,target_pos).y) > self.stepheight then
if height_switcher then
use_pathfind = true
@ -3457,8 +3457,9 @@ end
-- compatibility function
function mobs:explosion(pos, radius)
local self = {sounds = {}}
self.sounds.explode = "tnt_explode"
local self = {sounds = {explode = "tnt_explode"}}
mobs:boom(self, pos, radius)
end
@ -3473,6 +3474,7 @@ function mobs:safe_boom(self, pos, radius)
})
entity_physics(pos, radius)
effect(pos, 32, "tnt_smoke.png", radius * 3, radius * 5, radius, 1, 0)
end
@ -3945,7 +3947,7 @@ function mobs:alias_mob(old_name, new_name)
physical = false,
on_step = function(self)
on_activate = function(self)
if minetest.registered_entities[new_name] then
minetest.add_entity(self.object:get_pos(), new_name)