1
0
mirror of https://codeberg.org/tenplus1/mobs_animal.git synced 2024-12-22 17:00:26 +01:00

redo egg drop timer, tidy code

This commit is contained in:
TenPlus1 2017-04-13 11:19:37 +01:00
parent c674ee82ed
commit cc25b4f59b

View File

@ -60,10 +60,16 @@ mobs:register_mob("mobs_animal:chicken", {
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end,
do_custom = function(self)
do_custom = function(self, dtime)
self.egg_timer = (self.egg_timer or 0) + dtime
if self.egg_timer < 10 then
return
end
self.egg_timer = 0
if self.child
or math.random(1, 5000) > 1 then
or math.random(1, 100) > 1 then
return
end
@ -127,9 +133,9 @@ mobs:register_arrow("mobs_animal:egg_entity", {
hit_node = function(self, pos, node)
local num = math.random(1, 10)
if num == 1 then
if math.random(1, 10) > 1 then
return
end
pos.y = pos.y + 1
@ -164,7 +170,6 @@ mobs:register_arrow("mobs_animal:egg_entity", {
ent2.tamed = true
ent2.owner = self.playername
end
end
})