forked from mtcontrib/mobs_redo
update do_custom to run live instead of every second
This commit is contained in:
parent
1dc909aa09
commit
4ad941523e
13
api.lua
13
api.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
-- Mobs Api (2nd May 2016)
|
-- Mobs Api (6th May 2016)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
@ -2033,6 +2033,11 @@ local mob_step = function(self, dtime)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- run custom function (defined in mob lua file)
|
||||||
|
if self.do_custom then
|
||||||
|
self.do_custom(self, dtime)
|
||||||
|
end
|
||||||
|
|
||||||
-- attack timer
|
-- attack timer
|
||||||
self.timer = self.timer + dtime
|
self.timer = self.timer + dtime
|
||||||
|
|
||||||
@ -2072,11 +2077,6 @@ local mob_step = function(self, dtime)
|
|||||||
self.env_damage_timer = 0
|
self.env_damage_timer = 0
|
||||||
|
|
||||||
do_env_damage(self)
|
do_env_damage(self)
|
||||||
|
|
||||||
-- custom function (defined in mob lua file)
|
|
||||||
if self.do_custom then
|
|
||||||
self.do_custom(self)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
monster_attack(self)
|
monster_attack(self)
|
||||||
@ -2471,6 +2471,7 @@ function mobs:register_arrow(name, def)
|
|||||||
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
|
||||||
timer = 0,
|
timer = 0,
|
||||||
switch = 0,
|
switch = 0,
|
||||||
|
arrow = true,
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
|
|
||||||
|
2
api.txt
2
api.txt
@ -122,7 +122,7 @@ The mob api also has some preset variables and functions that it will remember f
|
|||||||
'self.owner' string used to set owner of npc mobs, typically used for dogs
|
'self.owner' string used to set owner of npc mobs, typically used for dogs
|
||||||
'self.order' set to "follow" or "stand" so that npc will follow owner or stand it's ground
|
'self.order' set to "follow" or "stand" so that npc will follow owner or stand it's ground
|
||||||
'on_die' a function that is called when mob is killed
|
'on_die' a function that is called when mob is killed
|
||||||
'do_custom' a custom function that is called every second while mob is active and which has access to all of the self.* variables e.g. (self.health for health or self.standing_in for node status)
|
'do_custom' a custom function that is called while mob is active and which has access to all of the self.* variables e.g. (self.health for health or self.standing_in for node status)
|
||||||
|
|
||||||
|
|
||||||
mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle)
|
mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle)
|
||||||
|
Loading…
Reference in New Issue
Block a user