Fix sheep not regrow wool if mobs_griefing=false

This commit is contained in:
Wuzzy 2019-09-10 17:09:17 +02:00
parent 8618b42bc7
commit 9416305fa6
2 changed files with 7 additions and 5 deletions

View File

@ -1101,8 +1101,7 @@ end
-- find and replace what mob is looking for (grass, wheat etc.) -- find and replace what mob is looking for (grass, wheat etc.)
local replace = function(self, pos) local replace = function(self, pos)
if not mobs_griefing if not self.replace_rate
or not self.replace_rate
or not self.replace_what or not self.replace_what
or self.child == true or self.child == true
or self.object:get_velocity().y ~= 0 or self.object:get_velocity().y ~= 0
@ -1139,7 +1138,9 @@ local replace = function(self, pos)
if on_replace_return ~= false then if on_replace_return ~= false then
minetest.set_node(pos, {name = with}) if mobs_griefing then
minetest.set_node(pos, {name = with})
end
-- when cow/sheep eats grass, replace wool and milk -- when cow/sheep eats grass, replace wool and milk
if self.gotten == true then if self.gotten == true then

View File

@ -243,8 +243,9 @@ eating.
'replace_rate' how random should the replace rate be (typically 10) 'replace_rate' how random should the replace rate be (typically 10)
'replace_offset' +/- value to check specific node to replace 'replace_offset' +/- value to check specific node to replace
'on_replace(self, pos, oldnode, newnode)' is called when mob is about to 'on_replace(self, pos, oldnode, newnode)'
replace a node. is called when mob is about to replace a node. Also called
when not actually replacing due to mobs_griefing setting being false.
'self' ObjectRef of mob 'self' ObjectRef of mob
'pos' Position of node to replace 'pos' Position of node to replace
'oldnode' Current node 'oldnode' Current node