Fix arcade goodbye message implementation (#26514)

This commit is contained in:
Tayrtahn
2024-03-28 12:56:49 -04:00
committed by GitHub
parent 192f092f35
commit 7759d404c6
9 changed files with 41 additions and 68 deletions

View File

@@ -2,7 +2,6 @@ using Content.Server.Power.Components;
using Content.Shared.UserInterface;
using Content.Server.Advertise;
using Content.Server.Advertise.Components;
using Content.Server.Advertise.EntitySystems;
using Content.Shared.Arcade;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
@@ -12,7 +11,7 @@ namespace Content.Server.Arcade.BlockGame;
public sealed class BlockGameArcadeSystem : EntitySystem
{
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly AdvertiseSystem _advertise = default!;
[Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
public override void Initialize()
{
@@ -92,16 +91,6 @@ public sealed class BlockGameArcadeSystem : EntitySystem
component.Spectators.Remove(component.Player);
UpdatePlayerStatus(uid, component.Player, blockGame: component);
}
else
{
// Everybody's gone
component.Player = null;
if (component.ShouldSayThankYou && TryComp<AdvertiseComponent>(uid, out var advertise))
{
_advertise.SayAdvertisement(uid, advertise);
component.ShouldSayThankYou = false;
}
}
UpdatePlayerStatus(uid, temp, blockGame: component);
}
@@ -115,7 +104,6 @@ public sealed class BlockGameArcadeSystem : EntitySystem
_uiSystem.CloseAll(bui);
component.Player = null;
component.Spectators.Clear();
component.ShouldSayThankYou = false;
}
private void OnPlayerAction(EntityUid uid, BlockGameArcadeComponent component, BlockGameMessages.BlockGamePlayerActionMessage msg)
@@ -135,7 +123,8 @@ public sealed class BlockGameArcadeSystem : EntitySystem
return;
}
component.ShouldSayThankYou = true;
if (TryComp<SpeakOnUIClosedComponent>(uid, out var speakComponent))
_speakOnUIClosed.TrySetFlag((uid, speakComponent));
component.Game.ProcessInput(msg.PlayerAction);
}