feature/Lucker-misc_RoundFramework #2

Merged
para merged 8 commits from feature/Lucker-misc_RoundFramework into master 2023-08-07 05:13:13 +00:00
5 changed files with 28 additions and 14 deletions
Showing only changes of commit 1b34af21ee - Show all commits

View File

@@ -25,7 +25,10 @@ public partial class Lucker : Entity
set
{
InternalPawn = value;
value.Owner = this;
if ( value != null )
{
value.Owner = this;
}
Review

According to Bing Chat this can be

value?.Owner = this
According to Bing Chat this can be ```cs value?.Owner = this ```
Review


Please ask bing chat which version of C# it believes supports this feature

![](https://media.discordapp.net/attachments/501842091983241218/1137254962603241543/image.png) Please ask bing chat which version of C# it believes supports this feature
Review

Yeah that's what I thought. I asked it and it just confidently lies about it and doesn't admit it's wrong. I found this stack overflow article on the topic and they just suggest a setValue() method but that's kinda dumb for one-offs.

Yeah that's what I thought. I asked it and it just confidently lies about it and doesn't admit it's wrong. [I found this stack overflow article on the topic and they just suggest a `setValue()` method but that's kinda dumb for one-offs.](https://stackoverflow.com/questions/35887106/using-the-null-conditional-operator-on-the-left-hand-side-of-an-assignment)
}
}

View File

@@ -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;
Outdated
Review

Should we clear InvolvedPlayers here?

Should we clear `InvolvedPlayers` here?
Outdated
Review

we can, but I don't believe it would be necessary. Since LoadedMinigame gets nulled out (which actually should be deleted before we do so, need to fix), the manager shouldn't necessarily be doing anything with the list until a new one is loaded (along with a new list), although some additional checks would be nice.

we can, but I don't believe it would be necessary. Since LoadedMinigame gets nulled out (which actually should be deleted before we do so, need to fix), the manager shouldn't necessarily be doing anything with the list until a new one is loaded (along with a new list), although some additional checks would be nice.
Outdated
Review

Done

Done
return true;

View File

@@ -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<Pawn> 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<PawnInventory>();
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++;
}

View File

@@ -5,10 +5,13 @@
@attribute [StyleSheet]
@inherits Panel
@if (ShouldShowCursor)
{
<root/>
}
<root>
@if (ShouldShowCursor)
{
<div class="camera-cursor"/>
}
</root>
@code {

View File

@@ -1,3 +1,5 @@
CameraCursor {
pointer-events: all;
.camera-cursor {
pointer-events: all;
}
}