From d34c48cb59d0b1e7a1763bee24ffb746dc495fcd Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 30 Jan 2019 03:37:47 +0100 Subject: [PATCH] Insta-drop minecart when its rail is destroyed --- mods/ENTITIES/mcl_minecarts/rails.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mods/ENTITIES/mcl_minecarts/rails.lua b/mods/ENTITIES/mcl_minecarts/rails.lua index 05e0855c1..1058ba352 100644 --- a/mods/ENTITIES/mcl_minecarts/rails.lua +++ b/mods/ENTITIES/mcl_minecarts/rails.lua @@ -21,6 +21,20 @@ local register_rail = function(itemstring, tiles, def_extras, creative) sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_blast_resistance = 3.5, _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 for k,v in pairs(def_extras) do