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
2 changed files with 4 additions and 3 deletions
Showing only changes of commit 35b16afd9a - Show all commits

View File

@@ -13,7 +13,7 @@ namespace LuckerGame.Entities;
public partial class MinigameManager : Entity
{
[Net] public Minigame LoadedMinigame { get; private set; }
private List<Minigame> AvailableMinigames { get; set; }
private List<TypeDescription> AvailableMinigames { get; set; }
private List<Lucker> InvolvedPlayers { get; set; }
public override void Spawn()
@@ -27,7 +27,7 @@ public partial class MinigameManager : Entity
InvolvedPlayers = players.ToList();
if (CheckForMinigames())
Outdated
Review

I think this correctly caches the Lucker list when the minigame is created, which is nice. Although I'm wondering how we deal with Luckers who leave before a minigame is ended. If there's other logic that deletes a Lucker in response to the client disconnecting, will the logic in CleanupPlayerPawns() fail / crash?

Also, I feel like it'd be nice to standardize the naming of these variables to disambiguate references to Players and Luckers. Might as well just name variables after the type to avoid clashing the names.

I think this correctly caches the `Lucker` list when the minigame is created, which is nice. Although I'm wondering how we deal with Luckers who leave before a minigame is ended. If there's other logic that deletes a `Lucker` in response to the client disconnecting, will the logic in `CleanupPlayerPawns()` fail / crash? Also, I feel like it'd be nice to standardize the naming of these variables to disambiguate references to `Player`s and `Lucker`s. Might as well just name variables after the type to avoid clashing the names.
Outdated
Review

I agree with the variable naming, and will go through and do that.

I think an investigation into handling client disconnects should be done in another ticket however, as I believe there's both an investigation in how S&box handles a client disconnect by default, and also a discussion in how we handle it, such as keeping the player around for the remainder of the round but assigning them to a bot, only a minigame, leave it up to the minigames, etc.

I agree with the variable naming, and will go through and do that. I think an investigation into handling client disconnects should be done in another ticket however, as I believe there's both an investigation in how S&box handles a client disconnect by default, and also a discussion in how we handle it, such as keeping the player around for the remainder of the round but assigning them to a bot, only a minigame, leave it up to the minigames, etc.
Outdated
Review

Variables should be renamed now based on the naming of 'Lucker' as opposed to player for the most part

Variables should be renamed now based on the naming of 'Lucker' as opposed to player for the most part
{
LoadedMinigame = string.IsNullOrEmpty( minigameName ) ? AvailableMinigames.OrderBy( _ => Guid.NewGuid() ).FirstOrDefault() : TypeLibrary.Create<Minigame>( minigameName );
LoadedMinigame = string.IsNullOrEmpty( minigameName ) ? TypeLibrary.Create<Minigame>(AvailableMinigames.OrderBy( _ => Guid.NewGuid() ).FirstOrDefault().TargetType) : TypeLibrary.Create<Minigame>( minigameName );
ChatBox.AddInformation( To.Everyone, $"Starting {LoadedMinigame.Name}" );
LoadedMinigame.Initialize( players );
}
@@ -48,7 +48,7 @@ public partial class MinigameManager : Entity
{
AvailableMinigames = TypeLibrary.GetTypes<Minigame>()
.Where( type => !type.IsAbstract && !type.IsInterface )
.Select( td => TypeLibrary.Create<Minigame>( td.TargetType ) ).ToList();
.ToList();
}
[Event.Hotload]

View File

@@ -61,6 +61,7 @@ public class RussianRouletteMinigame : Minigame
pawn.LookAt(Shooter.Position);
} );
TimeSinceShot = 0;
Taunted = 0;
}
public override bool Tick()