diff --git a/code/Entities/Lucker.cs b/code/Entities/Lucker.cs index 4bffd2d..072b295 100644 --- a/code/Entities/Lucker.cs +++ b/code/Entities/Lucker.cs @@ -25,7 +25,10 @@ public partial class Lucker : Entity set { InternalPawn = value; - value.Owner = this; + if ( value != null ) + { + value.Owner = this; + } } } diff --git a/code/Entities/MinigameManager.cs b/code/Entities/MinigameManager.cs index e478882..f4b74ef 100644 --- a/code/Entities/MinigameManager.cs +++ b/code/Entities/MinigameManager.cs @@ -80,7 +80,7 @@ public partial class MinigameManager : Entity } InvolvedPlayers.ForEach( player => { - player.Pawn.Delete(); + player.Pawn?.Delete(); player.Pawn = null; } ); } @@ -102,6 +102,7 @@ public partial class MinigameManager : Entity } LoadedMinigame.Cleanup(); + CleanupPlayerPawns(); LoadedMinigame = null; return true; diff --git a/code/Minigames/RussianRoulette/RussianRouletteMinigame.cs b/code/Minigames/RussianRoulette/RussianRouletteMinigame.cs index 7ca3eed..c44e3b7 100644 --- a/code/Minigames/RussianRoulette/RussianRouletteMinigame.cs +++ b/code/Minigames/RussianRoulette/RussianRouletteMinigame.cs @@ -20,11 +20,13 @@ public class RussianRouletteMinigame : Minigame private const float ShooterDistance = 80f; private const float TimeBetweenShots = 7f; private const float TimeBetweenDeathAndEnd = 5f; + private const string ShooterName = "The Russian"; private int Taunted = 0; + private Pawn ShooterTarget; private List DeadVictims => Players .Select( player => player.Pawn as Pawn ) - .Where( pawn => !pawn.IsValid || pawn.LifeState != LifeState.Alive ) + .Where( pawn => pawn is not { IsValid: true } || pawn.LifeState != LifeState.Alive ) .ToList(); private TimeSince TimeSinceShot { get; set; } @@ -34,6 +36,7 @@ public class RussianRouletteMinigame : Minigame { Players = players; Shooter = new Pawn(); + Shooter.Name = ShooterName; var shooterInventory = Shooter.Components.Create(); shooterInventory.AddWeapon( new RussianPistol() ); @@ -66,11 +69,12 @@ public class RussianRouletteMinigame : Minigame public override bool Tick() { + // Someone is dead, we're getting ready to end if ( DeadVictims.Any() ) { if ( Taunted != int.MaxValue ) { - ChatBox.AddChatEntry( To.Everyone, "Shooter", "Heh, nothing personnel, kid." ); + ChatBox.AddChatEntry( To.Everyone, Shooter.Name, "Heh, nothing personnel, kid." ); Taunted = int.MaxValue; TimeSinceDeadVictim = 0; } @@ -86,21 +90,22 @@ public class RussianRouletteMinigame : Minigame Shooter.Inventory.ActiveWeapon.PrimaryAttack(); if ( !DeadVictims.Any() ) { - ChatBox.AddChatEntry( To.Everyone, "Shooter", "Fucking lag..." ); + ChatBox.AddChatEntry( To.Everyone, Shooter.Name, "Fucking lag..." ); } } else if ( TimeSinceShot > TimeBetweenShots * .8f && Taunted == 1) { - var victim = Players.Select( player => player.Pawn as Pawn ) + ShooterTarget = Players.Select( player => player.Pawn as Pawn ) .OrderBy( _ => Guid.NewGuid() ) .FirstOrDefault(); - Shooter.LookAt( victim.Position ); - ChatBox.AddChatEntry( To.Everyone, "Shooter", $"I'm gonna eat you up, {victim.Name}" ); + Shooter.LookAt( ShooterTarget.Position ); + var chance = 1f / Shooter.Inventory.ActiveWeapon.Ammo; + ChatBox.AddChatEntry( To.Everyone, Shooter.Name, $"Good luck, {ShooterTarget.Name}! You have a {chance:P0} chance to die!" ); Taunted++; } else if ( TimeSinceShot > TimeBetweenShots / 2 && Taunted == 0) { - ChatBox.AddChatEntry( To.Everyone, "Shooter", "Im gettin' ready!" ); + ChatBox.AddChatEntry( To.Everyone, Shooter.Name, "Im gettin' ready!" ); Taunted++; } diff --git a/code/UI/HudComponents/CameraCursor.razor b/code/UI/HudComponents/CameraCursor.razor index e32e736..93284e7 100644 --- a/code/UI/HudComponents/CameraCursor.razor +++ b/code/UI/HudComponents/CameraCursor.razor @@ -5,10 +5,13 @@ @attribute [StyleSheet] @inherits Panel -@if (ShouldShowCursor) -{ - -} + + @if (ShouldShowCursor) + { +
+ } + + @code { diff --git a/code/UI/HudComponents/CameraCursor.razor.scss b/code/UI/HudComponents/CameraCursor.razor.scss index 82e3b95..a8d2142 100644 --- a/code/UI/HudComponents/CameraCursor.razor.scss +++ b/code/UI/HudComponents/CameraCursor.razor.scss @@ -1,3 +1,5 @@ CameraCursor { - pointer-events: all; + .camera-cursor { + pointer-events: all; + } } \ No newline at end of file