Fix crash with shooter_hook

This commit is contained in:
LoneWolfHT 2021-03-15 08:30:54 -07:00 committed by GitHub
parent 0ed4cadb7c
commit 844436ca3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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