* add conscription bag * add gar mesons * remove salvage vendor restock * add code for shop vendors * make salvage vendor a shop vendor * ui fixes * :trollface: * update locker and vendor inventory * add mining hardsuit for 3k --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using Content.Server.Advertise.EntitySystems;
|
|
using Content.Shared.Advertise.Components;
|
|
using Content.Shared.DeltaV.VendingMachines;
|
|
|
|
namespace Content.Server.DeltaV.VendingMachines;
|
|
|
|
public sealed class ShopVendorSystem : SharedShopVendorSystem
|
|
{
|
|
[Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
var query = EntityQueryEnumerator<ShopVendorComponent, TransformComponent>();
|
|
var now = Timing.CurTime;
|
|
while (query.MoveNext(out var uid, out var comp, out var xform))
|
|
{
|
|
var ent = (uid, comp);
|
|
var dirty = false;
|
|
if (comp.Ejecting is {} ejecting && now > comp.NextEject)
|
|
{
|
|
Spawn(ejecting, xform.Coordinates);
|
|
comp.Ejecting = null;
|
|
dirty = true;
|
|
}
|
|
|
|
if (comp.Denying && now > comp.NextDeny)
|
|
{
|
|
comp.Denying = false;
|
|
dirty = true;
|
|
}
|
|
|
|
if (dirty)
|
|
{
|
|
Dirty(uid, comp);
|
|
UpdateVisuals(ent);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void AfterPurchase(Entity<ShopVendorComponent> ent)
|
|
{
|
|
if (TryComp<SpeakOnUIClosedComponent>(ent, out var speak))
|
|
_speakOnUIClosed.TrySetFlag((ent.Owner, speak));
|
|
}
|
|
}
|