Skip to content

Commit

Permalink
Make player speed adjustable
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyWing committed Dec 16, 2020
1 parent 8822b51 commit 9ab2ba4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/gamemodes/amongus/gamemode/cl_init.moon
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ GM.ConVarsDisplay = {
{ "Mod" , "KillDistanceMod" }
{ "Bool" , "AllTalk" }
{ "Select" , "TaskbarUpdates" }
{ "Mod" , "PlayerSpeedMod" }
}
}
{
Expand Down
15 changes: 15 additions & 0 deletions src/gamemodes/amongus/gamemode/init.moon
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,18 @@ GM.Initialize = =>

-- screw implicit returns man
return

cvars.AddChangeCallback GAMEMODE.ConVars.PlayerSpeedMod\GetName!, ((_, _, new) ->
return if GAMEMODE\IsGameInProgress! or GAMEMODE\IsGameCommencing!

new = tonumber new
return if not new

for ply in *player.GetAll!
with movementSpeed = 190 * new
ply\SetSlowWalkSpeed movementSpeed
ply\SetWalkSpeed movementSpeed
ply\SetRunSpeed movementSpeed
ply\SetMaxSpeed movementSpeed

), "speedmod"
1 change: 1 addition & 0 deletions src/gamemodes/amongus/gamemode/lang/au_default.moon
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ with GM.Lang\Get "en"
au_killdistance_mod: "Kill Distance"
sv_alltalk: "All Talk"
au_taskbar_updates: "Taskbar Updates"
au_player_speed_mod: "Player Speed"

au_meeting_available: "Meetings per Player"
au_meeting_cooldown: "Meeting Button Cooldown"
Expand Down
1 change: 1 addition & 0 deletions src/gamemodes/amongus/gamemode/lang/au_default_ru.moon
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ with GM.Lang\Get "ru"
au_killdistance_mod: "Дистанция убийства"
sv_alltalk: "Разговор без ограничений"
au_taskbar_updates: "Обновления шкалы заданий"
au_player_speed_mod: "Скорость передвижения"

au_meeting_available: "Экстренных собраний"
au_meeting_cooldown: "Перезарядка собраний"
Expand Down
1 change: 1 addition & 0 deletions src/gamemodes/amongus/gamemode/shared.moon
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ GM.ConVars =
ConfirmEjects: CreateConVar "au_confirm_ejects" , 1 , flags, "", 0, 1
AllTalk: GetConVar "sv_alltalk"
TaskbarUpdates: CreateConVar "au_taskbar_updates" , 0 , flags, "", 0, 2
PlayerSpeedMod: CreateConVar "au_player_speed_mod", 1 , flags, "", 0.5, 3

MeetingCooldown: CreateConVar "au_meeting_cooldown" , 20, flags, "", 1, 60
MeetingsPerPlayer: CreateConVar "au_meeting_available" , 2 , flags, "", 1, 5
Expand Down
10 changes: 5 additions & 5 deletions src/gamemodes/amongus/gamemode/sv_player.moon
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ GM.PlayerSpawn = (ply) =>
if nil == hook.Call "PlayerSetModel", @, ply
ply\SetModel defaultModel

with defaultSpeed = 200
ply\SetSlowWalkSpeed defaultSpeed
ply\SetWalkSpeed defaultSpeed
ply\SetRunSpeed defaultSpeed
ply\SetMaxSpeed defaultSpeed
with movementSpeed = 190 * @ConVarSnapshots.PlayerSpeedMod\GetFloat!
ply\SetSlowWalkSpeed movementSpeed
ply\SetWalkSpeed movementSpeed
ply\SetRunSpeed movementSpeed
ply\SetMaxSpeed movementSpeed

ply\SetViewOffset Vector 0, 0, 64 - 16
ply\SetTeam 1
Expand Down

0 comments on commit 9ab2ba4

Please sign in to comment.