1
0
mirror of https://codeberg.org/tenplus1/mobs_animal.git synced 2024-12-23 01:10:25 +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) mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end, 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 if self.child
or math.random(1, 5000) > 1 then or math.random(1, 100) > 1 then
return return
end end
@ -127,9 +133,9 @@ mobs:register_arrow("mobs_animal:egg_entity", {
hit_node = function(self, pos, node) hit_node = function(self, pos, node)
local num = math.random(1, 10) if math.random(1, 10) > 1 then
return
if num == 1 then end
pos.y = pos.y + 1 pos.y = pos.y + 1
@ -164,7 +170,6 @@ mobs:register_arrow("mobs_animal:egg_entity", {
ent2.tamed = true ent2.tamed = true
ent2.owner = self.playername ent2.owner = self.playername
end end
end
}) })