Put on_replace call in correct place (wool regrow on grass to dirt)
parent
91d94800d7
commit
908ba9fba6
|
@ -513,11 +513,8 @@ function mob_class:replace_node(pos)
|
||||||
|
|
||||||
local oldnode = {name = what, param2 = node.param2}
|
local oldnode = {name = what, param2 = node.param2}
|
||||||
local newnode = {name = with, 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
|
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
|
if self and self.object and not self.dead then
|
||||||
self.object:set_velocity(vector.new(0,0,0))
|
self.object:set_velocity(vector.new(0,0,0))
|
||||||
minetest.set_node(pos, newnode)
|
minetest.set_node(pos, newnode)
|
||||||
|
if self.on_replace then
|
||||||
|
on_replace_return = self.on_replace(self, pos, oldnode, newnode)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
minetest.after(2.5, function()
|
minetest.after(2.5, function()
|
||||||
|
|
Loading…
Reference in New Issue