Put on_replace call in correct place (wool regrow on grass to dirt)

This commit is contained in:
epCode 2023-05-30 19:54:24 -07:00 committed by epCode
parent 91d94800d7
commit 908ba9fba6

@ -513,11 +513,8 @@ function mob_class:replace_node(pos)
local oldnode = {name = what, param2 = node.param2}
local newnode = {name = with, param2 = node.param2}
local on_replace_return
local on_replace_return = true
if self.on_replace then
on_replace_return = self.on_replace(self, pos, oldnode, newnode)
end
if on_replace_return ~= false then
@ -529,6 +526,9 @@ function mob_class:replace_node(pos)
if self and self.object and not self.dead then
self.object:set_velocity(vector.new(0,0,0))
minetest.set_node(pos, newnode)
if self.on_replace then
on_replace_return = self.on_replace(self, pos, oldnode, newnode)
end
end
end)
minetest.after(2.5, function()