Skip to content

Commit

Permalink
Don't reset initial stuff for captured teams
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneWolfHT committed Nov 14, 2023
1 parent 202361e commit dde18eb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions mods/ctf/ctf_modebase/features.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ local item_levels = {
}

local delete_queue = {}
local team_switch_after_capture = false

return {
on_new_match = function()
Expand Down Expand Up @@ -553,18 +554,22 @@ return {
table.remove(team_list, table.indexof(team_list, lost_team))

for lost_player in pairs(ctf_teams.online_players[lost_team].players) do
ctf_teams.allocate_player(lost_player)
team_switch_after_capture = true
ctf_teams.allocate_player(lost_player)
team_switch_after_capture = false
end
end
end
end,
on_allocplayer = function(player, new_team)
player:set_hp(player:get_properties().hp_max)

ctf_modebase.update_wear.cancel_player_updates(player)
if not team_switch_after_capture then
ctf_modebase.update_wear.cancel_player_updates(player)

ctf_modebase.player.remove_bound_items(player)
ctf_modebase.player.give_initial_stuff(player)
ctf_modebase.player.remove_bound_items(player)
ctf_modebase.player.give_initial_stuff(player)
end

local tcolor = ctf_teams.team[new_team].color
player:hud_set_hotbar_image("gui_hotbar.png^[colorize:" .. tcolor .. ":128")
Expand Down

0 comments on commit dde18eb

Please sign in to comment.