Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable usage of classes abilities during build time #1195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions mods/ctf/ctf_modes/ctf_mode_classes/classes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ctf_melee.simple_register_sword("ctf_mode_classes:knight_sword", {

local pname = user:get_player_name()

if itemstack:get_wear() == 0 then
if itemstack:get_wear() == 0 and ctf_modebase.match_started then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way the player will get the "Can't use during build time" message even when match has started but item's wear is 0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fixed

local step = math.floor(65534 / KNIGHT_USAGE_TIME)
ctf_modebase.update_wear.start_update(pname, "ctf_melee:sword_diamond", step, false, function()
local player = minetest.get_player_by_name(pname)
Expand Down Expand Up @@ -179,7 +179,14 @@ ctf_melee.simple_register_sword("ctf_mode_classes:knight_sword", {
end)

return "ctf_melee:sword_diamond"
end
else
hud_events.new(user, {
quick = true,
text = "Can't use during build time",
color = "warning",
})
return
end
end,
})

Expand Down Expand Up @@ -222,15 +229,22 @@ ctf_ranged.simple_register_gun("ctf_mode_classes:ranged_rifle", {
return
end

if itemstack:get_wear() == 0 then
if itemstack:get_wear() == 0 and ctf_modebase.match_started then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as L154

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fixed

grenades.throw_grenade("grenades:frag", 24, user)

local step = math.floor(65534 / RANGED_COOLDOWN_TIME)
ctf_modebase.update_wear.start_update(user:get_player_name(), "ctf_mode_classes:ranged_rifle_loaded", step, true)

itemstack:set_wear(65534)
return itemstack
end
else
hud_events.new(user, {
quick = true,
text = "Can't use during build time",
color = "warning",
})
return
end
end
})

Expand Down Expand Up @@ -314,7 +328,14 @@ ctf_healing.register_bandage("ctf_mode_classes:support_bandage", {
})
return
end

if not ctf_modebase.match_started then
hud_events.new(user, {
quick = true,
text = "Can't use during build time",
color = "warning",
})
return
end
ctf_modebase.give_immunity(user)

local step = math.floor(65534 / IMMUNITY_TIME)
Expand Down
Loading