Separate "thank you" messages from general ads (#25867)
* Separated "thank you" messages from general ads * Moved MessagePackPrototype to shared, cleaned up AdvertiseComponent, and actually killed AdvertisementsPackPrototype. +More suggests changes. * Rename PackPrototypeID to Pack in both components.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server.Advertise;
|
||||
using Content.Server.Advertise.Components;
|
||||
using Content.Server.Cargo.Systems;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Emp;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Actions;
|
||||
@@ -25,7 +24,6 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.VendingMachines
|
||||
{
|
||||
@@ -39,7 +37,7 @@ namespace Content.Server.VendingMachines
|
||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly AdvertiseSystem _advertise = default!;
|
||||
[Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -58,7 +56,6 @@ namespace Content.Server.VendingMachines
|
||||
Subs.BuiEvents<VendingMachineComponent>(VendingMachineUiKey.Key, subs =>
|
||||
{
|
||||
subs.Event<BoundUIOpenedEvent>(OnBoundUIOpened);
|
||||
subs.Event<BoundUIClosedEvent>(OnBoundUIClosed);
|
||||
subs.Event<VendingMachineEjectMessage>(OnInventoryEjectMessage);
|
||||
});
|
||||
|
||||
@@ -114,16 +111,6 @@ namespace Content.Server.VendingMachines
|
||||
UpdateVendingMachineInterfaceState(uid, component);
|
||||
}
|
||||
|
||||
private void OnBoundUIClosed(EntityUid uid, VendingMachineComponent component, BoundUIClosedEvent args)
|
||||
{
|
||||
// Only vendors that advertise will send message after dispensing
|
||||
if (component.ShouldSayThankYou && TryComp<AdvertiseComponent>(uid, out var advertise))
|
||||
{
|
||||
_advertise.SayThankYou(uid, advertise);
|
||||
component.ShouldSayThankYou = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateVendingMachineInterfaceState(EntityUid uid, VendingMachineComponent component)
|
||||
{
|
||||
var state = new VendingMachineInterfaceState(GetAllInventory(uid, component));
|
||||
@@ -294,7 +281,10 @@ namespace Content.Server.VendingMachines
|
||||
vendComponent.Ejecting = true;
|
||||
vendComponent.NextItemToEject = entry.ID;
|
||||
vendComponent.ThrowNextItem = throwItem;
|
||||
vendComponent.ShouldSayThankYou = true;
|
||||
|
||||
if (TryComp(uid, out SpeakOnUIClosedComponent? speakComponent))
|
||||
_speakOnUIClosed.TrySetFlag((uid, speakComponent));
|
||||
|
||||
entry.Amount--;
|
||||
UpdateVendingMachineInterfaceState(uid, vendComponent);
|
||||
TryUpdateVisualState(uid, vendComponent);
|
||||
|
||||
Reference in New Issue
Block a user