From 844436ca3d6f0320abdaf1c72643a6e9891ed9ff Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Mon, 15 Mar 2021 08:30:54 -0700 Subject: [PATCH] Fix crash with shooter_hook --- mods/ctf/ctf_classes/ranged.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mods/ctf/ctf_classes/ranged.lua b/mods/ctf/ctf_classes/ranged.lua index 2abcffa..4939dda 100644 --- a/mods/ctf/ctf_classes/ranged.lua +++ b/mods/ctf/ctf_classes/ranged.lua @@ -73,6 +73,11 @@ check_grapple("shooter_hook:grapple_hook") -- Override grappling hook entity to check if player has flag before teleporting local old_grapple_step = minetest.registered_entities["shooter_hook:hook"].on_step minetest.registered_entities["shooter_hook:hook"].on_step = function(self, dtime, ...) + -- User left the game. Life is no longer worth living for this poor hook + if not self.user then + self.object:remove() + end + -- Remove entity if player has flag -- This is to prevent players from firing the hook, and then punching the flag if ctf_flag.has_flag(self.user) then