Change HORNY_TIMER to BREED_TIMER

This commit is contained in:
jordan4ibanez 2021-04-12 08:11:55 -04:00
parent 00759da39d
commit a564009e4a
1 changed files with 10 additions and 12 deletions

View File

@ -15,13 +15,11 @@ local math_atan = math.atan
local math_random = math.random local math_random = math.random
local math_floor = math.floor local math_floor = math.floor
mobs = {} mobs = {}
local MAX_MOB_NAME_LENGTH = 30 local MAX_MOB_NAME_LENGTH = 30
local HORNY_TIME = 30 local BREED_TIME = 30
local HORNY_AGAIN_TIME = 300 local BREED_TIME_AGAIN = 300
local CHILD_GROW_TIME = 60*20 local CHILD_GROW_TIME = 60*20
local DEATH_DELAY = 0.5 local DEATH_DELAY = 0.5
local DEFAULT_FALL_SPEED = -10 local DEFAULT_FALL_SPEED = -10
@ -1603,14 +1601,14 @@ local breed = function(self)
return return
end end
-- horny animal can mate for HORNY_TIME seconds, -- horny animal can mate for BREED_TIME seconds,
-- afterwards horny animal cannot mate again for HORNY_AGAIN_TIME seconds -- afterwards horny animal cannot mate again for BREED_TIME_AGAIN seconds
if self.horny == true if self.horny == true
and self.hornytimer < HORNY_TIME + HORNY_AGAIN_TIME then and self.hornytimer < BREED_TIME + BREED_TIME_AGAIN then
self.hornytimer = self.hornytimer + 1 self.hornytimer = self.hornytimer + 1
if self.hornytimer >= HORNY_TIME + HORNY_AGAIN_TIME then if self.hornytimer >= BREED_TIME + BREED_TIME_AGAIN then
self.hornytimer = 0 self.hornytimer = 0
self.horny = false self.horny = false
end end
@ -1618,7 +1616,7 @@ local breed = function(self)
-- find another same animal who is also horny and mate if nearby -- find another same animal who is also horny and mate if nearby
if self.horny == true if self.horny == true
and self.hornytimer <= HORNY_TIME then and self.hornytimer <= BREED_TIME then
local pos = self.object:get_pos() local pos = self.object:get_pos()
@ -1657,15 +1655,15 @@ local breed = function(self)
if ent if ent
and canmate == true and canmate == true
and ent.horny == true and ent.horny == true
and ent.hornytimer <= HORNY_TIME then and ent.hornytimer <= BREED_TIME then
num = num + 1 num = num + 1
end end
-- found your mate? then have a baby -- found your mate? then have a baby
if num > 1 then if num > 1 then
self.hornytimer = HORNY_TIME + 1 self.hornytimer = BREED_TIME + 1
ent.hornytimer = HORNY_TIME + 1 ent.hornytimer = BREED_TIME + 1
-- spawn baby -- spawn baby
minetest.after(5, function(parent1, parent2, pos) minetest.after(5, function(parent1, parent2, pos)