Fix arcade goodbye message implementation (#26514)
This commit is contained in:
@@ -19,9 +19,4 @@ public sealed partial class BlockGameArcadeComponent : Component
|
|||||||
/// The players currently viewing (but not playing) the active session of NT-BG.
|
/// The players currently viewing (but not playing) the active session of NT-BG.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly List<ICommonSession> Spectators = new();
|
public readonly List<ICommonSession> Spectators = new();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the game machine should thank (or otherwise talk to) the player when they leave
|
|
||||||
/// </summary>
|
|
||||||
public bool ShouldSayThankYou;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using Content.Server.Power.Components;
|
|||||||
using Content.Shared.UserInterface;
|
using Content.Shared.UserInterface;
|
||||||
using Content.Server.Advertise;
|
using Content.Server.Advertise;
|
||||||
using Content.Server.Advertise.Components;
|
using Content.Server.Advertise.Components;
|
||||||
using Content.Server.Advertise.EntitySystems;
|
|
||||||
using Content.Shared.Arcade;
|
using Content.Shared.Arcade;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -12,7 +11,7 @@ namespace Content.Server.Arcade.BlockGame;
|
|||||||
public sealed class BlockGameArcadeSystem : EntitySystem
|
public sealed class BlockGameArcadeSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
[Dependency] private readonly AdvertiseSystem _advertise = default!;
|
[Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -92,16 +91,6 @@ public sealed class BlockGameArcadeSystem : EntitySystem
|
|||||||
component.Spectators.Remove(component.Player);
|
component.Spectators.Remove(component.Player);
|
||||||
UpdatePlayerStatus(uid, component.Player, blockGame: component);
|
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);
|
UpdatePlayerStatus(uid, temp, blockGame: component);
|
||||||
}
|
}
|
||||||
@@ -115,7 +104,6 @@ public sealed class BlockGameArcadeSystem : EntitySystem
|
|||||||
_uiSystem.CloseAll(bui);
|
_uiSystem.CloseAll(bui);
|
||||||
component.Player = null;
|
component.Player = null;
|
||||||
component.Spectators.Clear();
|
component.Spectators.Clear();
|
||||||
component.ShouldSayThankYou = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPlayerAction(EntityUid uid, BlockGameArcadeComponent component, BlockGameMessages.BlockGamePlayerActionMessage msg)
|
private void OnPlayerAction(EntityUid uid, BlockGameArcadeComponent component, BlockGameMessages.BlockGamePlayerActionMessage msg)
|
||||||
@@ -135,7 +123,8 @@ public sealed class BlockGameArcadeSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
component.ShouldSayThankYou = true;
|
if (TryComp<SpeakOnUIClosedComponent>(uid, out var speakComponent))
|
||||||
|
_speakOnUIClosed.TrySetFlag((uid, speakComponent));
|
||||||
|
|
||||||
component.Game.ProcessInput(msg.PlayerAction);
|
component.Game.ProcessInput(msg.PlayerAction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,9 +110,4 @@ public sealed partial class SpaceVillainArcadeComponent : SharedSpaceVillainArca
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public int RewardAmount = 0;
|
public int RewardAmount = 0;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the game machine should thank (or otherwise talk to) the player when they leave
|
|
||||||
/// </summary>
|
|
||||||
public bool ShouldSayThankYou;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using Content.Server.Power.Components;
|
|||||||
using Content.Shared.UserInterface;
|
using Content.Shared.UserInterface;
|
||||||
using Content.Server.Advertise;
|
using Content.Server.Advertise;
|
||||||
using Content.Server.Advertise.Components;
|
using Content.Server.Advertise.Components;
|
||||||
using Content.Server.Advertise.EntitySystems;
|
|
||||||
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
|
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
@@ -16,7 +15,7 @@ public sealed partial class SpaceVillainArcadeSystem : EntitySystem
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
[Dependency] private readonly AdvertiseSystem _advertise = default!;
|
[Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -26,7 +25,6 @@ public sealed partial class SpaceVillainArcadeSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<SpaceVillainArcadeComponent, AfterActivatableUIOpenEvent>(OnAfterUIOpenSV);
|
SubscribeLocalEvent<SpaceVillainArcadeComponent, AfterActivatableUIOpenEvent>(OnAfterUIOpenSV);
|
||||||
SubscribeLocalEvent<SpaceVillainArcadeComponent, SpaceVillainArcadePlayerActionMessage>(OnSVPlayerAction);
|
SubscribeLocalEvent<SpaceVillainArcadeComponent, SpaceVillainArcadePlayerActionMessage>(OnSVPlayerAction);
|
||||||
SubscribeLocalEvent<SpaceVillainArcadeComponent, PowerChangedEvent>(OnSVillainPower);
|
SubscribeLocalEvent<SpaceVillainArcadeComponent, PowerChangedEvent>(OnSVillainPower);
|
||||||
SubscribeLocalEvent<SpaceVillainArcadeComponent, BoundUIClosedEvent>(OnBoundUIClosed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -84,7 +82,9 @@ public sealed partial class SpaceVillainArcadeSystem : EntitySystem
|
|||||||
case PlayerAction.Heal:
|
case PlayerAction.Heal:
|
||||||
case PlayerAction.Recharge:
|
case PlayerAction.Recharge:
|
||||||
component.Game.ExecutePlayerAction(uid, msg.PlayerAction, component);
|
component.Game.ExecutePlayerAction(uid, msg.PlayerAction, component);
|
||||||
component.ShouldSayThankYou = true; // Any sort of gameplay action counts
|
// Any sort of gameplay action counts
|
||||||
|
if (TryComp<SpeakOnUIClosedComponent>(uid, out var speakComponent))
|
||||||
|
_speakOnUIClosed.TrySetFlag((uid, speakComponent));
|
||||||
break;
|
break;
|
||||||
case PlayerAction.NewGame:
|
case PlayerAction.NewGame:
|
||||||
_audioSystem.PlayPvs(component.NewGameSound, uid, AudioParams.Default.WithVolume(-4f));
|
_audioSystem.PlayPvs(component.NewGameSound, uid, AudioParams.Default.WithVolume(-4f));
|
||||||
@@ -112,19 +112,5 @@ public sealed partial class SpaceVillainArcadeSystem : EntitySystem
|
|||||||
|
|
||||||
if (_uiSystem.TryGetUi(uid, SpaceVillainArcadeUiKey.Key, out var bui))
|
if (_uiSystem.TryGetUi(uid, SpaceVillainArcadeUiKey.Key, out var bui))
|
||||||
_uiSystem.CloseAll(bui);
|
_uiSystem.CloseAll(bui);
|
||||||
|
|
||||||
component.ShouldSayThankYou = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnBoundUIClosed(Entity<SpaceVillainArcadeComponent> ent, ref BoundUIClosedEvent args)
|
|
||||||
{
|
|
||||||
if (args.UiKey is not SpaceVillainArcadeUiKey || (SpaceVillainArcadeUiKey) args.UiKey != SpaceVillainArcadeUiKey.Key)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ent.Comp.ShouldSayThankYou && TryComp<AdvertiseComponent>(ent.Owner, out var advertise))
|
|
||||||
{
|
|
||||||
_advertise.SayAdvertisement(ent.Owner, advertise);
|
|
||||||
ent.Comp.ShouldSayThankYou = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,16 +14,3 @@
|
|||||||
- advertisement-block-game-11
|
- advertisement-block-game-11
|
||||||
- advertisement-block-game-12
|
- advertisement-block-game-12
|
||||||
- advertisement-block-game-13
|
- advertisement-block-game-13
|
||||||
# thankyous:
|
|
||||||
# - thankyou-block-game-1
|
|
||||||
# - thankyou-block-game-2
|
|
||||||
# - thankyou-block-game-3
|
|
||||||
# - thankyou-block-game-4
|
|
||||||
# - thankyou-block-game-5
|
|
||||||
# - thankyou-block-game-6
|
|
||||||
# - thankyou-block-game-7
|
|
||||||
# - thankyou-block-game-8
|
|
||||||
# - thankyou-block-game-9
|
|
||||||
# - thankyou-block-game-10
|
|
||||||
# - thankyou-block-game-11
|
|
||||||
# - thankyou-block-game-12
|
|
||||||
|
|||||||
@@ -16,16 +16,3 @@
|
|||||||
- advertisement-space-villain-13
|
- advertisement-space-villain-13
|
||||||
- advertisement-space-villain-14
|
- advertisement-space-villain-14
|
||||||
- advertisement-space-villain-15
|
- advertisement-space-villain-15
|
||||||
# thankyous:
|
|
||||||
# - thankyou-space-villain-1
|
|
||||||
# - thankyou-space-villain-2
|
|
||||||
# - thankyou-space-villain-3
|
|
||||||
# - thankyou-space-villain-4
|
|
||||||
# - thankyou-space-villain-5
|
|
||||||
# - thankyou-space-villain-6
|
|
||||||
# - thankyou-space-villain-7
|
|
||||||
# - thankyou-space-villain-8
|
|
||||||
# - thankyou-space-villain-9
|
|
||||||
# - thankyou-space-villain-10
|
|
||||||
# - thankyou-space-villain-11
|
|
||||||
# - thankyou-space-villain-12
|
|
||||||
|
|||||||
15
Resources/Prototypes/Catalog/Arcade/Goodbyes/blockgame.yml
Normal file
15
Resources/Prototypes/Catalog/Arcade/Goodbyes/blockgame.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
- type: messagePack
|
||||||
|
id: BlockGameGoodbyes
|
||||||
|
messages:
|
||||||
|
- thankyou-block-game-1
|
||||||
|
- thankyou-block-game-2
|
||||||
|
- thankyou-block-game-3
|
||||||
|
- thankyou-block-game-4
|
||||||
|
- thankyou-block-game-5
|
||||||
|
- thankyou-block-game-6
|
||||||
|
- thankyou-block-game-7
|
||||||
|
- thankyou-block-game-8
|
||||||
|
- thankyou-block-game-9
|
||||||
|
- thankyou-block-game-10
|
||||||
|
- thankyou-block-game-11
|
||||||
|
- thankyou-block-game-12
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
- type: messagePack
|
||||||
|
id: SpaceVillainGoodbyes
|
||||||
|
messages:
|
||||||
|
- thankyou-space-villain-1
|
||||||
|
- thankyou-space-villain-2
|
||||||
|
- thankyou-space-villain-3
|
||||||
|
- thankyou-space-villain-4
|
||||||
|
- thankyou-space-villain-5
|
||||||
|
- thankyou-space-villain-6
|
||||||
|
- thankyou-space-villain-7
|
||||||
|
- thankyou-space-villain-8
|
||||||
|
- thankyou-space-villain-9
|
||||||
|
- thankyou-space-villain-10
|
||||||
|
- thankyou-space-villain-11
|
||||||
|
- thankyou-space-villain-12
|
||||||
@@ -148,6 +148,8 @@
|
|||||||
pack: SpaceVillainAds
|
pack: SpaceVillainAds
|
||||||
minWait: 60 # Arcades are noisy
|
minWait: 60 # Arcades are noisy
|
||||||
maxWait: 240
|
maxWait: 240
|
||||||
|
- type: SpeakOnUIClosed
|
||||||
|
pack: SpaceVillainGoodbyes
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: SpaceVillainArcadeFilled
|
id: SpaceVillainArcadeFilled
|
||||||
@@ -190,3 +192,5 @@
|
|||||||
pack: BlockGameAds
|
pack: BlockGameAds
|
||||||
minWait: 60 # Arcades are noisy
|
minWait: 60 # Arcades are noisy
|
||||||
maxWait: 240
|
maxWait: 240
|
||||||
|
- type: SpeakOnUIClosed
|
||||||
|
pack: BlockGameGoodbyes
|
||||||
|
|||||||
Reference in New Issue
Block a user