Fix non-shooters from being able to use grappling hooks

This commit is contained in:
rubenwardy 2020-03-14 19:37:31 +00:00
parent b61b0cdac6
commit 63b543a8fb
2 changed files with 4 additions and 1 deletions

View file

@ -39,6 +39,8 @@ ctf_classes.register("shooter", {
cons = {}, cons = {},
color = "#c60", color = "#c60",
properties = { properties = {
allow_grapples = true,
initial_stuff = { initial_stuff = {
"shooter:rifle", "shooter:rifle",
"shooter:grapple_gun_loaded", "shooter:grapple_gun_loaded",

View file

@ -45,7 +45,7 @@ local function check_grapple(itemname)
local old_func = def.on_use local old_func = def.on_use
minetest.override_item(itemname, { minetest.override_item(itemname, {
on_use = function(itemstack, user, ...) 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(), minetest.chat_send_player(user:get_player_name(),
"Your class can't use that weapon! Change your class at spawn") "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_loaded")
check_grapple("shooter:grapple_gun") check_grapple("shooter:grapple_gun")
check_grapple("shooter:grapple_hook")