1
0
Fork 0

Merge pull request 'Break minecart if it's near a cactus' (#1886) from NO11/MineClone2:minecart into master

Reviewed-on: MineClone2/MineClone2#1886
This commit is contained in:
Elias Fleckenstein 2021-11-03 19:18:01 +00:00
commit c17fc81d1f
1 changed files with 14 additions and 1 deletions

View File

@ -198,7 +198,20 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
else
self._last_float_check = self._last_float_check + dtime
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
if self._last_float_check >= mcl_minecarts.check_float_time then
pos = self.object:get_pos()