fix child == true when child = 1

This commit is contained in:
kno10 2024-11-10 00:46:43 +01:00
parent 932118f10b
commit 6510ea4777
3 changed files with 6 additions and 6 deletions

@ -150,9 +150,9 @@ function mob_class:mob_activate(staticdata, def, dtime)
local colbox = self.base_colbox local colbox = self.base_colbox
local selbox = self.base_selbox local selbox = self.base_selbox
if self.gotten == true and def.gotten_texture then textures = def.gotten_texture end if self.gotten and def.gotten_texture then textures = def.gotten_texture end
if self.gotten == true and def.gotten_mesh then mesh = def.gotten_mesh end if self.gotten and def.gotten_mesh then mesh = def.gotten_mesh end
if self.child == true then if self.child then
vis_size = { x = self.base_size.x * .5, y = self.base_size.y * .5 } vis_size = { x = self.base_size.x * .5, y = self.base_size.y * .5 }
if def.child_texture then textures = def.child_texture[1] end if def.child_texture then textures = def.child_texture[1] end

@ -63,7 +63,7 @@ function mob_class:feed_tame(clicker, feed_count, breed, tame, notake)
-- make children grow quicker -- make children grow quicker
if not consume_food and self.child == true then if not consume_food and self.child then
consume_food = true consume_food = true
-- deduct 10% of the time to adulthood -- deduct 10% of the time to adulthood
self.hornytimer = self.hornytimer + ((CHILD_GROW_TIME - self.hornytimer) * 0.1) self.hornytimer = self.hornytimer + ((CHILD_GROW_TIME - self.hornytimer) * 0.1)
@ -158,7 +158,7 @@ function mob_class:check_breeding()
--mcl_log("In breed function") --mcl_log("In breed function")
-- child takes a long time before growing into adult -- child takes a long time before growing into adult
if self.child == true then if self.child then
-- When a child, hornytimer is used to count age until adulthood -- When a child, hornytimer is used to count age until adulthood
self.hornytimer = self.hornytimer + 1 self.hornytimer = self.hornytimer + 1

@ -452,7 +452,7 @@ end
function mob_class:replace_node(pos) function mob_class:replace_node(pos)
if not self.replace_rate if not self.replace_rate
or not self.replace_what or not self.replace_what
or self.child == true or self.child
or self.object:get_velocity().y ~= 0 or self.object:get_velocity().y ~= 0
or random(1, self.replace_rate) > 1 then or random(1, self.replace_rate) > 1 then
return return