diff --git a/.sbproj b/.sbproj
index 0e6ffda..1a078c6 100644
--- a/.sbproj
+++ b/.sbproj
@@ -46,7 +46,7 @@
"Choices": [],
"ConVarName": "lucker_minigames_per_round",
"DisplayName": "Minigames Per Round",
- "DefaultValue": "0",
+ "DefaultValue": "1",
"Description": "The number of minigames played per round",
"Group": "Other",
"Minimum": 1,
diff --git a/code/Entities/Lucker.cs b/code/Entities/Lucker.cs
index 072b295..996c762 100644
--- a/code/Entities/Lucker.cs
+++ b/code/Entities/Lucker.cs
@@ -6,18 +6,18 @@ using Sandbox;
namespace LuckerGame.Entities;
///
-/// Represents a Player.
+/// Represents a person playing the game.
/// This could belong to a Client or a Bot and represents a common entity to operate on for games and keeping score
///
public partial class Lucker : Entity
{
///
- /// The entity this player controls. This value is networked and should be accessed through .
+ /// The entity this lucker controls. This value is networked and should be accessed through .
///
[Net] private Entity InternalPawn { get; set; }
///
- /// Accesses or sets the entity this player current controls
+ /// Accesses or sets the entity this lucker currently controls
///
public Entity Pawn
{
@@ -33,7 +33,7 @@ public partial class Lucker : Entity
}
///
- /// Before the round has started, this player indicated they were ready
+ /// Before the round has started, this lucker indicated they were ready
///
[Net] public bool Ready { get; set; }
@@ -45,20 +45,20 @@ public partial class Lucker : Entity
[BindComponent] public LuckerStats Stats { get; }
///
- /// Creates and properly sets up a Player entity for a given client
+ /// Creates and properly sets up a entity for a given client
///
- /// the client to own the player
- /// the newly created player
+ /// the client to own the lucker
+ /// the newly created lucker
public static Lucker CreateLuckerForClient( IClient client )
{
- var player = new Lucker();
- client.Pawn = player;
- player.Owner = client as Entity;
- player.Name = client.Name;
- var camera = player.Components.Create();
- var stats = player.Components.Create();
+ var lucker = new Lucker();
+ client.Pawn = lucker;
+ lucker.Owner = client as Entity;
+ lucker.Name = client.Name;
+ lucker.Components.Create();
+ lucker.Components.Create();
- return player;
+ return lucker;
}
///
@@ -69,12 +69,12 @@ public partial class Lucker : Entity
public static void ReadyUpCommand(bool readyState)
{
var client = ConsoleSystem.Caller;
- var player = client.Pawn as Lucker;
- player.SetReady( readyState );
+ var lucker = client.Pawn as Lucker;
+ lucker.SetReady( readyState );
}
///
- /// Sets this player's ready state
+ /// Sets this lucker's ready state
///
/// the ready state being set
public void SetReady(bool ready)
@@ -82,7 +82,7 @@ public partial class Lucker : Entity
Ready = ready;
if ( Game.IsServer )
{
- Event.Run( LuckerEvent.PlayerReady, this, ready );
+ Event.Run( LuckerEvent.LuckerReady, this, ready );
}
}
diff --git a/code/Entities/MinigameManager.cs b/code/Entities/MinigameManager.cs
index f4b74ef..d2ee6d8 100644
--- a/code/Entities/MinigameManager.cs
+++ b/code/Entities/MinigameManager.cs
@@ -23,9 +23,9 @@ public partial class MinigameManager : Entity
private List AvailableMinigames { get; set; }
///
- /// The players involved in the current minigame
+ /// The luckers involved in the current minigame
///
- private List InvolvedPlayers { get; set; }
+ private List InvolvedLuckers { get; set; }
public override void Spawn()
{
@@ -33,14 +33,17 @@ public partial class MinigameManager : Entity
FindMinigames();
}
- public void StartMinigame(List players, string minigameName = null)
+ public void StartMinigame(List luckers, string minigameName = null)
{
- InvolvedPlayers = players.ToList();
+ InvolvedLuckers = luckers.ToList();
if (CheckForMinigames())
{
- LoadedMinigame = string.IsNullOrEmpty( minigameName ) ? TypeLibrary.Create(AvailableMinigames.OrderBy( _ => Guid.NewGuid() ).FirstOrDefault().TargetType) : TypeLibrary.Create( minigameName );
+ LoadedMinigame = string.IsNullOrEmpty( minigameName )
+ ? TypeLibrary.Create( AvailableMinigames.OrderBy( _ => Guid.NewGuid() ).FirstOrDefault()
+ .TargetType )
+ : TypeLibrary.Create( minigameName );
ChatBox.AddInformation( To.Everyone, $"Starting {LoadedMinigame.Name}" );
- LoadedMinigame.Initialize( players );
+ LoadedMinigame.Initialize( luckers );
}
}
@@ -69,19 +72,19 @@ public partial class MinigameManager : Entity
}
///
- /// Goes through the players included in the loaded minigame and deletes and nulls out any pawns assigned to them
+ /// Goes through the luckers included in the loaded minigame and deletes and nulls out any pawns assigned to them
///
- private void CleanupPlayerPawns()
+ private void CleanupLuckerPawns()
{
- if ( LoadedMinigame is not { IsValid: true } || InvolvedPlayers == null)
+ if ( LoadedMinigame is not { IsValid: true } || InvolvedLuckers == null)
{
Log.Warning( "Attempted to clean up players without a minigame loaded!" );
return;
}
- InvolvedPlayers.ForEach( player =>
+ InvolvedLuckers.ForEach( lucker =>
{
- player.Pawn?.Delete();
- player.Pawn = null;
+ lucker.Pawn?.Delete();
+ lucker.Pawn = null;
} );
}
@@ -100,11 +103,16 @@ public partial class MinigameManager : Entity
{
return false;
}
-
- LoadedMinigame.Cleanup();
- CleanupPlayerPawns();
- LoadedMinigame = null;
+ EndMinigame();
return true;
+ }
+ private void EndMinigame()
+ {
+ LoadedMinigame.Cleanup();
+ CleanupLuckerPawns();
+ LoadedMinigame.Delete();
+ LoadedMinigame = null;
+ InvolvedLuckers = null;
}
}
diff --git a/code/Entities/RoundManager.cs b/code/Entities/RoundManager.cs
index 5a384b6..a6e5357 100644
--- a/code/Entities/RoundManager.cs
+++ b/code/Entities/RoundManager.cs
@@ -52,7 +52,7 @@ public partial class RoundManager : Entity
[ConVar.Replicated("lucker_minigames_per_round")]
public static int MinigamesLeftInRound { get; set; }
- private List Players { get; set; }
+ private List Luckers { get; set; }
#endregion
///
@@ -83,7 +83,7 @@ public partial class RoundManager : Entity
MinigamesLeftInRound--;
if ( MinigamesLeftInRound > 0 )
{
- MinigameManager.StartMinigame( Players );
+ MinigameManager.StartMinigame( Luckers );
}
else
{
@@ -94,11 +94,12 @@ public partial class RoundManager : Entity
}
///
- /// Is triggered whenever a player readies up
+ /// Is triggered whenever a lucker readies up or readies down
///
- /// the player that readied up, discarded
- [LuckerEvent.PlayerReady]
- public void HandlePlayerReady( Lucker readyLucker, bool ready )
+ /// the lucker that readied up
+ /// the lucker's ready state
+ [LuckerEvent.LuckerReady]
+ public void HandleLuckerReady( Lucker readyLucker, bool ready )
{
if ( RoundState != RoundState.NotStarted && RoundState != RoundState.StartCountdown )
{
@@ -107,9 +108,9 @@ public partial class RoundManager : Entity
Log.Info( $"{readyLucker.Client.Name} set ready to {ready}" );
var message = $"{readyLucker.Client.Name} is {(ready ? "now ready." : "no longer ready.")}";
ChatBox.AddInformation( To.Everyone, message );
- var players = All.OfType().ToList();
- var readiedCount = players.Count( player => player.Ready );
- var totalCount = players.Count;
+ var luckers = All.OfType().ToList();
+ var readiedCount = luckers.Count( lucker => lucker.Ready );
+ var totalCount = luckers.Count;
if ( (float)readiedCount / totalCount > RequiredReadyPercent && RoundState == RoundState.NotStarted )
{
Log.Info( "Countdown started" );
@@ -132,13 +133,13 @@ public partial class RoundManager : Entity
}
RoundState = RoundState.InProgress;
- Players = All.OfType().ToList();
- Players.ForEach( player =>
+ Luckers = All.OfType().ToList();
+ Luckers.ForEach( lucker =>
{
- player.Ready = false;
+ lucker.Ready = false;
} );
MinigamesLeftInRound = MinigamesPerRound;
- MinigameManager.StartMinigame( Players, minigameName );
+ MinigameManager.StartMinigame( Luckers, minigameName );
}
[ConCmd.Server( "start_round" )]
diff --git a/code/Entities/Weapons/Weapon.cs b/code/Entities/Weapons/Weapon.cs
index 95ec514..e6658b0 100644
--- a/code/Entities/Weapons/Weapon.cs
+++ b/code/Entities/Weapons/Weapon.cs
@@ -76,7 +76,7 @@ public partial class Weapon : AnimatedEntity
}
///
- /// Called when the weapon is either removed from the player, or holstered.
+ /// Called when the weapon is either removed from the pawn, or holstered.
///
public void OnHolster()
{
diff --git a/code/Events/PlayerReadyEvent.cs b/code/Events/PlayerReadyEvent.cs
index 2bfde23..d587f9c 100644
--- a/code/Events/PlayerReadyEvent.cs
+++ b/code/Events/PlayerReadyEvent.cs
@@ -4,16 +4,16 @@ namespace LuckerGame.Events;
public static partial class LuckerEvent
{
- public const string PlayerReady = "lucker.playerReady";
+ public const string LuckerReady = "lucker.luckerReady";
///
- /// Event is run on the server whenever a player changes ready state
- /// The event handler is given the player that readied up and their new ready state
+ /// Event is run on the server whenever a lucker changes ready state
+ /// The event handler is given the lucker that readied up and their new ready state
///
[MethodArguments(typeof(Entities.Lucker), typeof(bool))]
- public class PlayerReadyAttribute : EventAttribute
+ public class LuckerReadyAttribute : EventAttribute
{
- public PlayerReadyAttribute() : base(PlayerReady)
+ public LuckerReadyAttribute() : base(LuckerReady)
{
}
}
diff --git a/code/Minigames/Minigame.cs b/code/Minigames/Minigame.cs
index ada9d05..200691a 100644
--- a/code/Minigames/Minigame.cs
+++ b/code/Minigames/Minigame.cs
@@ -15,8 +15,8 @@ public abstract class Minigame : Entity
///
/// Initializes the minigame with a list of luckers playing it.
///
- /// the players who made it into the minigame
- public abstract void Initialize(List players);
+ /// the luckers who made it into the minigame
+ public abstract void Initialize(List luckers);
///
/// Once a minigame is loaded and initialized, this method is called once per server tick.
diff --git a/code/Minigames/RussianRoulette/RussianRouletteMinigame.cs b/code/Minigames/RussianRoulette/RussianRouletteMinigame.cs
index c44e3b7..e9a0a33 100644
--- a/code/Minigames/RussianRoulette/RussianRouletteMinigame.cs
+++ b/code/Minigames/RussianRoulette/RussianRouletteMinigame.cs
@@ -14,7 +14,7 @@ namespace LuckerGame.Minigames.RussianRoulette;
public class RussianRouletteMinigame : Minigame
{
public override string Name => "Russian Roulette";
- private List Players { get; set; }
+ private List Luckers { get; set; }
private Pawn Shooter { get; set; }
private const float ShooterDistance = 80f;
@@ -24,43 +24,43 @@ public class RussianRouletteMinigame : Minigame
private int Taunted = 0;
private Pawn ShooterTarget;
- private List DeadVictims => Players
- .Select( player => player.Pawn as Pawn )
+ private List DeadVictims => Luckers
+ .Select( lucker => lucker.Pawn as Pawn )
.Where( pawn => pawn is not { IsValid: true } || pawn.LifeState != LifeState.Alive )
.ToList();
private TimeSince TimeSinceShot { get; set; }
private TimeSince TimeSinceDeadVictim { get; set; }
- public override void Initialize( List players )
+ public override void Initialize( List luckers )
{
- Players = players;
+ Luckers = luckers;
Shooter = new Pawn();
Shooter.Name = ShooterName;
var shooterInventory = Shooter.Components.Create();
shooterInventory.AddWeapon( new RussianPistol() );
- // Setup cameras for players
- Players.ForEach( player =>
+ // Setup cameras for luckers
+ Luckers.ForEach( lucker =>
{
- player.Components.Create();
- player.Position = Shooter.Position;
+ lucker.Components.Create();
+ lucker.Position = Shooter.Position;
} );
- Players.Select((player, i) => (Player: player, Index: i) ).ToList().ForEach( pair =>
+ Luckers.Select((lucker, i) => (Lucker: lucker, Index: i) ).ToList().ForEach( pair =>
{
- var player = pair.Player;
+ var lucker = pair.Lucker;
var index = pair.Index;
var pawn = new Pawn();
- pawn.Name = player.Name;
+ pawn.Name = lucker.Name;
pawn.Tags.Add( "victim" );
pawn.Health = 1;
- player.Pawn = pawn;
- pawn.DressFromClient( player.Client );
+ lucker.Pawn = pawn;
+ pawn.DressFromClient( lucker.Client );
var pawnOffset = ShooterDistance * (index % 2 == 0 ? Vector3.Forward : Vector3.Right) * (index % 4 >= 2 ? -1 : 1);
- player.Pawn.Position = Shooter.Position + pawnOffset;
+ lucker.Pawn.Position = Shooter.Position + pawnOffset;
pawn.LookAt(Shooter.Position);
} );
TimeSinceShot = 0;
@@ -95,7 +95,7 @@ public class RussianRouletteMinigame : Minigame
}
else if ( TimeSinceShot > TimeBetweenShots * .8f && Taunted == 1)
{
- ShooterTarget = Players.Select( player => player.Pawn as Pawn )
+ ShooterTarget = Luckers.Select( lucker => lucker.Pawn as Pawn )
.OrderBy( _ => Guid.NewGuid() )
.FirstOrDefault();
Shooter.LookAt( ShooterTarget.Position );
diff --git a/code/UI/HudComponents/Scoreboard.razor b/code/UI/HudComponents/Scoreboard.razor
index 113d83c..ebf704c 100644
--- a/code/UI/HudComponents/Scoreboard.razor
+++ b/code/UI/HudComponents/Scoreboard.razor
@@ -10,9 +10,9 @@
- @foreach (var player in Luckers)
+ @foreach (var lucker in Luckers)
{
-
+
}
@@ -23,7 +23,7 @@
protected override int BuildHash()
{
- return HashCode.Combine(Luckers.Select(player => player.Name).ToList());
+ return HashCode.Combine(Luckers.Select(lucker => lucker.Name).ToList());
}
}
\ No newline at end of file
diff --git a/code/UI/Menus/VotingLobby.razor b/code/UI/Menus/VotingLobby.razor
index 3a1bf8e..1123163 100644
--- a/code/UI/Menus/VotingLobby.razor
+++ b/code/UI/Menus/VotingLobby.razor
@@ -27,7 +27,7 @@