Skip to content

Commit 3ec6ef3

Browse files
committed
Merge branch 'Blaubeeree-additions-for-ulx-addon' into master
2 parents 8400655 + 24e5dc8 commit 3ec6ef3

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

src/gamemodes/amongus/gamemode/sv_game.moon

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,27 @@ GM.Game_Start = =>
172172
-- memo[a] = 1
173173
-- if not b.entity\IsBot!
174174
-- memo[b] = 1
175-
176-
memo[a] = memo[a] or math.random!
177-
memo[b] = memo[b] or math.random!
175+
if not memo[a]
176+
if @PlayersMarkedForImposter[a.entity]
177+
memo[a] = math.random! + 1
178+
elseif @PlayersMarkedForCrew[a.entity]
179+
memo[a] = math.random! - 1
180+
else
181+
memo[a] = math.random!
182+
183+
if not memo[b]
184+
if @PlayersMarkedForImposter[b.entity]
185+
memo[b] = math.random! + 1
186+
elseif @PlayersMarkedForCrew[b.entity]
187+
memo[b] = math.random! - 1
188+
else
189+
memo[b] = math.random!
190+
178191
memo[a] > memo[b]
179192

193+
@PlayersMarkedForCrew = {}
194+
@PlayersMarkedForImposter = {}
195+
180196
imposterCount = math.min GAMEMODE.ConVarSnapshots.ImposterCount\GetInt!, @GetImposterCount #initializedPlayers
181197
for index, ply in ipairs @GameData.PlayerTables
182198
-- Make the first N players imposters.

src/gamemodes/amongus/gamemode/sv_player.moon

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,28 @@ GM.GetFullyInitializedPlayers = => return for ply in *player.GetAll!
384384
else
385385
continue
386386

387+
GM.PlayersMarkedForCrew or= {}
388+
GM.PlayersMarkedForImposter or= {}
389+
--- Marks a player to become crewmate next round.
390+
-- This function doesn't overwrite the imposter count and therefor will be ignored if too many players are marked.
391+
-- @param ply Player entity.
392+
GM.Player_MarkCrew = (ply) =>
393+
@PlayersMarkedForCrew[ply] = true
394+
@PlayersMarkedForImposter[ply] = false
395+
396+
--- Marks a player to become crewmate next round.
397+
-- This function doesn't overwrite the imposter count and therefor will be ignored if too many players are marked.
398+
-- @param ply Player entity.
399+
GM.Player_MarkImposter = (ply) =>
400+
@PlayersMarkedForCrew[ply] = false
401+
@PlayersMarkedForImposter[ply] = true
402+
403+
--- Unmarks a player
404+
-- @param ply Player entity.
405+
GM.Player_UnMark = (ply) =>
406+
@PlayersMarkedForCrew[ply] = false
407+
@PlayersMarkedForImposter[ply] = false
408+
387409
hook.Add "PlayerInitialSpawn", "NMW AU AutoPilot", (ply) -> with GAMEMODE
388410
oldAutoPilot = \IsOnAutoPilot!
389411

0 commit comments

Comments
 (0)