Skip to content

Commit

Permalink
fix merge issues (?)
Browse files Browse the repository at this point in the history
  • Loading branch information
Techbot121 committed Mar 4, 2024
1 parent d8e979b commit 9a87233
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
86 changes: 43 additions & 43 deletions gamemodes/terrortown/gamemode/server/sv_roleselection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -652,26 +652,26 @@ local function SetSubRoles(plys, availableRoles, selectableRoles, selectedForced
roleCount = roleCount - selectedForcedRoles[subrole]
end

local minKarmaCVar = GetConVar("ttt_" .. roleData.name .. "_karma_min")
local minKarma = minKarmaCVar and minKarmaCVar:GetInt() or 0

local giveIfWanted = not ply:GetAvoidRole(subrole) -- if the player wants the role
and ply:GetBaseKarma() > minKarma -- and the player has enough karma
local giveIfVariety = plysAmount <= roleCount -- or if there aren't enough players anymore to have a greater role variety
local giveIfRandom = math.random(RANDOMFORCEROLE_CHANCE) == 1 -- or if the randomness decides (to avoid deadlocks)

if giveIfWanted or giveIfVariety or giveIfRandom then
print("Giving subrole", roleData.name, "to", ply,
giveIfWanted and ""
or giveIfVariety and "because of minimum role variety"
or giveIfRandom and "because of deadlock avoidance"
or "because ?????"
)
if not giveIfWanted then
ply:ChatPrint("Sorry; your role selection was ignored due to deadlock prevention.")
end

table.remove(plys, pick)
local minKarmaCVar = GetConVar("ttt_" .. roleData.name .. "_karma_min")
local minKarma = minKarmaCVar and minKarmaCVar:GetInt() or 0

local giveIfWanted = not ply:GetAvoidRole(subrole) -- if the player wants the role
and ply:GetBaseKarma() > minKarma -- and the player has enough karma
local giveIfVariety = plysAmount <= roleCount -- or if there aren't enough players anymore to have a greater role variety
local giveIfRandom = math.random(RANDOMFORCEROLE_CHANCE) == 1 -- or if the randomness decides (to avoid deadlocks)

if giveIfWanted or giveIfVariety or giveIfRandom then
print("Giving subrole", roleData.name, "to", ply,
giveIfWanted and ""
or giveIfVariety and "because of minimum role variety"
or giveIfRandom and "because of deadlock avoidance"
or "because ?????"
)
if not giveIfWanted then
ply:ChatPrint("Sorry; your role selection was ignored due to deadlock prevention.")
end

table.remove(plys, pick)

roleselection.finalRoles[ply] = subrole

Expand Down Expand Up @@ -867,12 +867,12 @@ end
-- @realm server
-- @internal
local function SelectBaseRolePlayers(plys, subrole, roleAmount)
local curRoles = 0
local plysList = {}
local curRoles = 0
local plysList = {}

local roleData = roles.GetByIndex(subrole)
local minKarmaCVar = GetConVar("ttt_" .. roleData.name .. "_karma_min")
local min_karmas = minKarmaCVar and minKarmaCVar:GetInt() or 0
local roleData = roles.GetByIndex(subrole)
local minKarmaCVar = GetConVar("ttt_" .. roleData.name .. "_karma_min")
local min_karmas = minKarmaCVar and minKarmaCVar:GetInt() or 0

while curRoles < roleAmount and #plys > 0 do
-- select random index in plys table
Expand All @@ -881,24 +881,24 @@ local function SelectBaseRolePlayers(plys, subrole, roleAmount)
-- the player we consider
local ply = plys[pick]

local giveIfWanted = not ply:GetAvoidRole(subrole) -- if the player wants the role
and ply:GetBaseKarma() > min_karmas -- and the player has enough karma
local giveIfInnocent = subrole == ROLE_INNOCENT -- or if the role is innocent (players cannot avoid being innocent)
local giveIfVariety = #plys <= curRoles -- or there aren't enough players anymore to have a greater role variety
local giveIfRandom = math.random(RANDOMFORCEROLE_CHANCE) == 1 -- or if the randomness decides (to avoid deadlocks)

if giveIfWanted or giveIfInnocent or giveIfVariety or giveIfRandom then
print("Giving role", roleData.name, "to", ply,
giveIfWanted and ""
or giveIfInnocent and ""
or giveIfVariety and "because of minimum role variety"
or giveIfRandom and "because of deadlock avoidance"
or "because ?????"
)
if not giveIfWanted then
ply:ChatPrint("Sorry; your role selection was ignored due to deadlock prevention.")
end
table.remove(plys, pick)
local giveIfWanted = not ply:GetAvoidRole(subrole) -- if the player wants the role
and ply:GetBaseKarma() > min_karmas -- and the player has enough karma
local giveIfInnocent = subrole == ROLE_INNOCENT -- or if the role is innocent (players cannot avoid being innocent)
local giveIfVariety = #plys <= curRoles -- or there aren't enough players anymore to have a greater role variety
local giveIfRandom = math.random(RANDOMFORCEROLE_CHANCE) == 1 -- or if the randomness decides (to avoid deadlocks)

if giveIfWanted or giveIfInnocent or giveIfVariety or giveIfRandom then
print("Giving role", roleData.name, "to", ply,
giveIfWanted and ""
or giveIfInnocent and ""
or giveIfVariety and "because of minimum role variety"
or giveIfRandom and "because of deadlock avoidance"
or "because ?????"
)
if not giveIfWanted then
ply:ChatPrint("Sorry; your role selection was ignored due to deadlock prevention.")
end
table.remove(plys, pick)

curRoles = curRoles + 1
plysList[curRoles] = ply
Expand Down
4 changes: 2 additions & 2 deletions lua/terrortown/entities/roles/traitor/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function ROLE:PreInitialize()
ragdollPinning = 1,
credits = 2,
creditsAwardDeadEnable = 1,
creditsAwardKillEnable = 1,,
togglable = true
creditsAwardKillEnable = 1,
togglable = true
}
end

0 comments on commit 9a87233

Please sign in to comment.