mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-23 02:51:06 +01:00
Insta-drop minecart when its rail is destroyed
This commit is contained in:
parent
6748576f8e
commit
d34c48cb59
1 changed files with 14 additions and 0 deletions
|
@ -21,6 +21,20 @@ local register_rail = function(itemstring, tiles, def_extras, creative)
|
||||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||||
_mcl_blast_resistance = 3.5,
|
_mcl_blast_resistance = 3.5,
|
||||||
_mcl_hardness = 0.7,
|
_mcl_hardness = 0.7,
|
||||||
|
after_destruct = function(pos)
|
||||||
|
-- Scan for minecarts in this pos and force them to execute their "floating" check.
|
||||||
|
-- Normally, this will make them drop.
|
||||||
|
local objs = minetest.get_objects_inside_radius(pos, 1)
|
||||||
|
for o=1, #objs do
|
||||||
|
local le = objs[o]:get_luaentity()
|
||||||
|
if le then
|
||||||
|
-- All entities in this mod are minecarts, so this works
|
||||||
|
if string.sub(le.name, 1, 14) == "mcl_minecarts:" then
|
||||||
|
le._last_float_check = mcl_minecarts.check_float_time
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
if def_extras then
|
if def_extras then
|
||||||
for k,v in pairs(def_extras) do
|
for k,v in pairs(def_extras) do
|
||||||
|
|
Loading…
Reference in a new issue