diff --git a/code/Entities/Lucker.cs b/code/Entities/Lucker.cs
index 3394cd4..4bffd2d 100644
--- a/code/Entities/Lucker.cs
+++ b/code/Entities/Lucker.cs
@@ -1,4 +1,5 @@
using LuckerGame.Components.Lucker.Cameras;
+using LuckerGame.EntityComponents.Lucker;
using LuckerGame.Events;
using Sandbox;
@@ -11,9 +12,22 @@ namespace LuckerGame.Entities;
public partial class Lucker : Entity
{
///
- /// The entity this Player currently controls
+ /// The entity this player controls. This value is networked and should be accessed through .
///
- public Entity Pawn { get; set; }
+ [Net] private Entity InternalPawn { get; set; }
+
+ ///
+ /// Accesses or sets the entity this player current controls
+ ///
+ public Entity Pawn
+ {
+ get => InternalPawn;
+ set
+ {
+ InternalPawn = value;
+ value.Owner = this;
+ }
+ }
///
/// Before the round has started, this player indicated they were ready
@@ -24,6 +38,8 @@ public partial class Lucker : Entity
/// This Lucker's camera
///
[BindComponent] public AbstractCamera Camera { get; }
+
+ [BindComponent] public LuckerStats Stats { get; }
///
/// Creates and properly sets up a Player entity for a given client
@@ -37,6 +53,7 @@ public partial class Lucker : Entity
player.Owner = client as Entity;
player.Name = client.Name;
var camera = player.Components.Create();
+ var stats = player.Components.Create();
return player;
}
diff --git a/code/Entities/MinigameManager.cs b/code/Entities/MinigameManager.cs
index 73f1fcf..e478882 100644
--- a/code/Entities/MinigameManager.cs
+++ b/code/Entities/MinigameManager.cs
@@ -12,8 +12,19 @@ namespace LuckerGame.Entities;
///
public partial class MinigameManager : Entity
{
+ ///
+ /// The currently loaded minigame
+ ///
[Net] public Minigame LoadedMinigame { get; private set; }
+
+ ///
+ /// A cached list of available minigames. Gets reloaded on a hotreload
+ ///
private List AvailableMinigames { get; set; }
+
+ ///
+ /// The players involved in the current minigame
+ ///
private List InvolvedPlayers { get; set; }
public override void Spawn()
diff --git a/code/EntityComponents/Lucker/LuckerClientInput.cs b/code/EntityComponents/Lucker/LuckerClientInput.cs
deleted file mode 100644
index 0f0575d..0000000
--- a/code/EntityComponents/Lucker/LuckerClientInput.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Sandbox;
-
-namespace LuckerGame.EntityComponents.Lucker;
-
-///
-/// A component for capturing and passing around a client's input for an attached Lucker
-///
-public class LuckerClientInput : EntityComponent
-{
- [ClientInput]
- public Vector3 InputDirection { get; set; }
-
- [ClientInput]
- public Angles ViewAngles { get; set; }
-}
diff --git a/code/EntityComponents/Lucker/LuckerStats.cs b/code/EntityComponents/Lucker/LuckerStats.cs
new file mode 100644
index 0000000..3e801ca
--- /dev/null
+++ b/code/EntityComponents/Lucker/LuckerStats.cs
@@ -0,0 +1,48 @@
+using Sandbox;
+using Sandbox.UI;
+
+namespace LuckerGame.EntityComponents.Lucker;
+
+///
+/// Handles the stats associated with a lucker during a lobby.
+///
+public partial class LuckerStats : EntityComponent, ISingletonComponent
+{
+ ///
+ /// The lucker's current score.
+ ///
+ [Net] private long Score { get; set; }
+
+ ///
+ /// Adds points to this lucker's score
+ ///
+ /// points to add (or remove if negative)
+ public void AddScore( long points )
+ {
+ Score += points;
+ if ( points == 0 )
+ {
+ return;
+ }
+
+ var message = $"{Entity.Name} {(points > 0 ? "gained" : "lost")} {points} points!";
+ ChatBox.AddInformation( To.Everyone, message );
+ }
+
+ ///
+ /// Resets this lucker's score to zero
+ ///
+ public void ResetScore()
+ {
+ Score = 0;
+ }
+
+ ///
+ /// Gets this lucker's current score
+ ///
+ /// this lucker's current score
+ public long GetScore()
+ {
+ return Score;
+ }
+}