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
1 changed files with 9 additions and 0 deletions

View File

@ -85,5 +85,14 @@ minetest.registered_entities["shooter_hook:hook"].on_step = function(self, dtime
self.object:remove()
return
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, ...)
end