Remove grapple if player changes class after throwing (#740)

* Remove hook if player has changed...

...their class after firing the hook.

* Make grapple don't return to...

...player inventory and improve message.

* Update ranged.lua

Co-authored-by: LoneWolfHT <lonewolf04361@gmail.com>
This commit is contained in:
David Leal 2021-01-07 19:35:34 -06:00 committed by GitHub
parent 870add029d
commit a412c02e20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,5 +85,14 @@ minetest.registered_entities["shooter_hook:hook"].on_step = function(self, dtime
self.object:remove() self.object:remove()
return return
end end
-- Remove hook if player changes class after throwing it
if not ctf_classes.get(self.user).properties.allow_grapples then
minetest.chat_send_player(self.user,
"Grapples don't work if you change class!")
self.object:remove()
return
end
return old_grapple_step(self, dtime, ...) return old_grapple_step(self, dtime, ...)
end end