From 232e59a2f944bedc1a6a6eb83e4dde6c98a8f0cf Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 26 Aug 2022 10:55:25 +0100 Subject: [PATCH] add timers on owl and nyan --- mobs/nyan.lua | 8 +++++++- mobs/owl.lua | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mobs/nyan.lua b/mobs/nyan.lua index e78e1ed..7a948ce 100644 --- a/mobs/nyan.lua +++ b/mobs/nyan.lua @@ -43,7 +43,13 @@ mobs:register_mob("dmobs:nyan", { run_end = 7, }, - do_custom = function(self) + do_custom = function(self, dtime) + + self.rb_count = (self.rb_count or 0) + dtime + if self.rb_count < .2 then + return + end + self.rb_count = 0 local apos = self.object:get_pos() ; if not apos then return end local vec = self.object:get_velocity() diff --git a/mobs/owl.lua b/mobs/owl.lua index 9d170bf..7b52b95 100644 --- a/mobs/owl.lua +++ b/mobs/owl.lua @@ -30,7 +30,13 @@ mobs:register_mob("dmobs:owl", { walk_end = 50 }, - do_custom = function(self) + do_custom = function(self, dtime) + + self.tod_count = (self.tod_count or 0) + dtime + if self.tod_count < 5 then + return + end + self.tod_count = 0 local daytime = minetest.get_timeofday() * 24000