Updates roulette, fixes camera cursor and lucker entity setting along with minigame cleanup
This commit is contained in:
@@ -25,9 +25,12 @@ public partial class Lucker : Entity
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
InternalPawn = value;
|
InternalPawn = value;
|
||||||
|
if ( value != null )
|
||||||
|
{
|
||||||
value.Owner = this;
|
value.Owner = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Before the round has started, this player indicated they were ready
|
/// Before the round has started, this player indicated they were ready
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public partial class MinigameManager : Entity
|
|||||||
}
|
}
|
||||||
InvolvedPlayers.ForEach( player =>
|
InvolvedPlayers.ForEach( player =>
|
||||||
{
|
{
|
||||||
player.Pawn.Delete();
|
player.Pawn?.Delete();
|
||||||
player.Pawn = null;
|
player.Pawn = null;
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@@ -102,6 +102,7 @@ public partial class MinigameManager : Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoadedMinigame.Cleanup();
|
LoadedMinigame.Cleanup();
|
||||||
|
CleanupPlayerPawns();
|
||||||
LoadedMinigame = null;
|
LoadedMinigame = null;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,13 @@ public class RussianRouletteMinigame : Minigame
|
|||||||
private const float ShooterDistance = 80f;
|
private const float ShooterDistance = 80f;
|
||||||
private const float TimeBetweenShots = 7f;
|
private const float TimeBetweenShots = 7f;
|
||||||
private const float TimeBetweenDeathAndEnd = 5f;
|
private const float TimeBetweenDeathAndEnd = 5f;
|
||||||
|
private const string ShooterName = "The Russian";
|
||||||
private int Taunted = 0;
|
private int Taunted = 0;
|
||||||
|
private Pawn ShooterTarget;
|
||||||
|
|
||||||
private List<Pawn> DeadVictims => Players
|
private List<Pawn> DeadVictims => Players
|
||||||
.Select( player => player.Pawn as Pawn )
|
.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();
|
.ToList();
|
||||||
|
|
||||||
private TimeSince TimeSinceShot { get; set; }
|
private TimeSince TimeSinceShot { get; set; }
|
||||||
@@ -34,6 +36,7 @@ public class RussianRouletteMinigame : Minigame
|
|||||||
{
|
{
|
||||||
Players = players;
|
Players = players;
|
||||||
Shooter = new Pawn();
|
Shooter = new Pawn();
|
||||||
|
Shooter.Name = ShooterName;
|
||||||
var shooterInventory = Shooter.Components.Create<PawnInventory>();
|
var shooterInventory = Shooter.Components.Create<PawnInventory>();
|
||||||
shooterInventory.AddWeapon( new RussianPistol() );
|
shooterInventory.AddWeapon( new RussianPistol() );
|
||||||
|
|
||||||
@@ -66,11 +69,12 @@ public class RussianRouletteMinigame : Minigame
|
|||||||
|
|
||||||
public override bool Tick()
|
public override bool Tick()
|
||||||
{
|
{
|
||||||
|
// Someone is dead, we're getting ready to end
|
||||||
if ( DeadVictims.Any() )
|
if ( DeadVictims.Any() )
|
||||||
{
|
{
|
||||||
if ( Taunted != int.MaxValue )
|
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;
|
Taunted = int.MaxValue;
|
||||||
TimeSinceDeadVictim = 0;
|
TimeSinceDeadVictim = 0;
|
||||||
}
|
}
|
||||||
@@ -86,21 +90,22 @@ public class RussianRouletteMinigame : Minigame
|
|||||||
Shooter.Inventory.ActiveWeapon.PrimaryAttack();
|
Shooter.Inventory.ActiveWeapon.PrimaryAttack();
|
||||||
if ( !DeadVictims.Any() )
|
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)
|
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() )
|
.OrderBy( _ => Guid.NewGuid() )
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
Shooter.LookAt( victim.Position );
|
Shooter.LookAt( ShooterTarget.Position );
|
||||||
ChatBox.AddChatEntry( To.Everyone, "Shooter", $"I'm gonna eat you up, {victim.Name}" );
|
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++;
|
Taunted++;
|
||||||
}
|
}
|
||||||
else if ( TimeSinceShot > TimeBetweenShots / 2 && Taunted == 0)
|
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++;
|
Taunted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,13 @@
|
|||||||
@attribute [StyleSheet]
|
@attribute [StyleSheet]
|
||||||
@inherits Panel
|
@inherits Panel
|
||||||
|
|
||||||
|
<root>
|
||||||
@if (ShouldShowCursor)
|
@if (ShouldShowCursor)
|
||||||
{
|
{
|
||||||
<root/>
|
<div class="camera-cursor"/>
|
||||||
}
|
}
|
||||||
|
</root>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
CameraCursor {
|
CameraCursor {
|
||||||
|
.camera-cursor {
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user