Skip to content

Commit

Permalink
Merge branch 'Blaubeeree-additions-for-ulx-addon' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyWing committed Apr 1, 2021
2 parents 8400655 + 24e5dc8 commit 3ec6ef3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/gamemodes/amongus/gamemode/sv_game.moon
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,27 @@ GM.Game_Start = =>
-- memo[a] = 1
-- if not b.entity\IsBot!
-- memo[b] = 1

memo[a] = memo[a] or math.random!
memo[b] = memo[b] or math.random!
if not memo[a]
if @PlayersMarkedForImposter[a.entity]
memo[a] = math.random! + 1
elseif @PlayersMarkedForCrew[a.entity]
memo[a] = math.random! - 1
else
memo[a] = math.random!

if not memo[b]
if @PlayersMarkedForImposter[b.entity]
memo[b] = math.random! + 1
elseif @PlayersMarkedForCrew[b.entity]
memo[b] = math.random! - 1
else
memo[b] = math.random!

memo[a] > memo[b]

@PlayersMarkedForCrew = {}
@PlayersMarkedForImposter = {}

imposterCount = math.min GAMEMODE.ConVarSnapshots.ImposterCount\GetInt!, @GetImposterCount #initializedPlayers
for index, ply in ipairs @GameData.PlayerTables
-- Make the first N players imposters.
Expand Down
22 changes: 22 additions & 0 deletions src/gamemodes/amongus/gamemode/sv_player.moon
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,28 @@ GM.GetFullyInitializedPlayers = => return for ply in *player.GetAll!
else
continue

GM.PlayersMarkedForCrew or= {}
GM.PlayersMarkedForImposter or= {}
--- Marks a player to become crewmate next round.
-- This function doesn't overwrite the imposter count and therefor will be ignored if too many players are marked.
-- @param ply Player entity.
GM.Player_MarkCrew = (ply) =>
@PlayersMarkedForCrew[ply] = true
@PlayersMarkedForImposter[ply] = false

--- Marks a player to become crewmate next round.
-- This function doesn't overwrite the imposter count and therefor will be ignored if too many players are marked.
-- @param ply Player entity.
GM.Player_MarkImposter = (ply) =>
@PlayersMarkedForCrew[ply] = false
@PlayersMarkedForImposter[ply] = true

--- Unmarks a player
-- @param ply Player entity.
GM.Player_UnMark = (ply) =>
@PlayersMarkedForCrew[ply] = false
@PlayersMarkedForImposter[ply] = false

hook.Add "PlayerInitialSpawn", "NMW AU AutoPilot", (ply) -> with GAMEMODE
oldAutoPilot = \IsOnAutoPilot!

Expand Down

0 comments on commit 3ec6ef3

Please sign in to comment.