feature/Lucker-misc_RoundFramework #2
@@ -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())
|
||||
|
|
||||
{
|
||||
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]
|
||||
|
||||
@@ -61,6 +61,7 @@ public class RussianRouletteMinigame : Minigame
|
||||
pawn.LookAt(Shooter.Position);
|
||||
} );
|
||||
TimeSinceShot = 0;
|
||||
Taunted = 0;
|
||||
}
|
||||
|
||||
public override bool Tick()
|
||||
|
||||
Reference in New Issue
Block a user
I think this correctly caches the
Luckerlist 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 aLuckerin response to the client disconnecting, will the logic inCleanupPlayerPawns()fail / crash?Also, I feel like it'd be nice to standardize the naming of these variables to disambiguate references to
Players andLuckers. Might as well just name variables after the type to avoid clashing the names.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.
Variables should be renamed now based on the naming of 'Lucker' as opposed to player for the most part