forked from LizzyFleckenstein03/Memeclone
Break minecart it's near a cactus (Fix #924)
This commit is contained in:
parent
d85f143fde
commit
28b7304211
|
@ -198,7 +198,20 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||||
else
|
else
|
||||||
self._last_float_check = self._last_float_check + dtime
|
self._last_float_check = self._last_float_check + dtime
|
||||||
end
|
end
|
||||||
local pos, rou_pos, node
|
|
||||||
|
local pos, rou_pos, node = self.object:get_pos()
|
||||||
|
local r = 0.6
|
||||||
|
for _, node_pos in pairs({{r, 0}, {0, r}, {-r, 0}, {0, -r}}) do
|
||||||
|
if minetest.get_node(vector.offset(pos, node_pos[1], 0, node_pos[2])).name == "mcl_core:cactus" then
|
||||||
|
detach_driver(self)
|
||||||
|
for d = 1, #drop do
|
||||||
|
minetest.add_item(pos, drop[d])
|
||||||
|
end
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Drop minecart if it isn't on a rail anymore
|
-- Drop minecart if it isn't on a rail anymore
|
||||||
if self._last_float_check >= mcl_minecarts.check_float_time then
|
if self._last_float_check >= mcl_minecarts.check_float_time then
|
||||||
pos = self.object:get_pos()
|
pos = self.object:get_pos()
|
||||||
|
|
Loading…
Reference in New Issue