Fix non-shooters from being able to use grappling hooks
This commit is contained in:
parent
b61b0cdac6
commit
63b543a8fb
2 changed files with 4 additions and 1 deletions
|
@ -39,6 +39,8 @@ ctf_classes.register("shooter", {
|
|||
cons = {},
|
||||
color = "#c60",
|
||||
properties = {
|
||||
allow_grapples = true,
|
||||
|
||||
initial_stuff = {
|
||||
"shooter:rifle",
|
||||
"shooter:grapple_gun_loaded",
|
||||
|
|
|
@ -45,7 +45,7 @@ local function check_grapple(itemname)
|
|||
local old_func = def.on_use
|
||||
minetest.override_item(itemname, {
|
||||
on_use = function(itemstack, user, ...)
|
||||
if ctf_classes.get(user).name ~= "shooter" then
|
||||
if not ctf_classes.get(user).properties.allow_grapples then
|
||||
minetest.chat_send_player(user:get_player_name(),
|
||||
"Your class can't use that weapon! Change your class at spawn")
|
||||
|
||||
|
@ -66,3 +66,4 @@ end
|
|||
|
||||
check_grapple("shooter:grapple_gun_loaded")
|
||||
check_grapple("shooter:grapple_gun")
|
||||
check_grapple("shooter:grapple_hook")
|
||||
|
|
Loading…
Reference in a new issue