salvage points shop (#2510)
* 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>
This commit is contained in:
47
Content.Server/DeltaV/VendingMachines/ShopVendorSystem.cs
Normal file
47
Content.Server/DeltaV/VendingMachines/ShopVendorSystem.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user