1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-12-24 17:50:21 +01:00

tidy code

This commit is contained in:
TenPlus1 2018-08-08 10:15:26 +01:00
parent da0238cb84
commit 477ad59670

14
api.lua
View File

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