diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2016-05-06 11:19:28 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2016-05-06 11:19:28 +0100 |
commit | 171098a215cd07365b7a9ceeaf8cc2b37f50f321 (patch) | |
tree | 2a49300008d0b259d4b7d126d44d778a6e09c48a | |
parent | deaada8a8b75f484eba60eb1b384034a2d95a571 (diff) |
updated do_custom example with timer
-rw-r--r-- | rat.lua | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -30,9 +30,17 @@ mobs:register_mob("mobs_animal:rat", { mobs:capture_mob(self, clicker, 25, 80, 0, true, nil) end, --[[ - do_custom = function(self) + do_custom = function(self, dtime) + + self.rat_timer = (self.rat_timer or 0) + dtime + + if self.rat_timer < 1 then return end -- every 1 second + + self.rat_timer = 0 + local pos = self.object:getpos() - print("rat pos", pos.x, pos.y, pos.z) + + print("rat pos", pos.x, pos.y, pos.z, dtime) end, ]] --[[ |