make cargo balance ui updating its own component (#28295)
* add BankClientComponent and event * query BankClient instead of hardcoded CargoOrderConsole for updating * add BankClient to all ordering consoles * :trollface: * add Balance field to BankClient * forgor Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> * m --------- Co-authored-by: deltanedas <@deltanedas:kde.org> Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
This commit is contained in:
@@ -81,18 +81,18 @@ public sealed partial class CargoSystem : SharedCargoSystem
|
||||
public void UpdateBankAccount(EntityUid uid, StationBankAccountComponent component, int balanceAdded)
|
||||
{
|
||||
component.Balance += balanceAdded;
|
||||
var query = EntityQueryEnumerator<CargoOrderConsoleComponent>();
|
||||
var query = EntityQueryEnumerator<BankClientComponent, TransformComponent>();
|
||||
|
||||
while (query.MoveNext(out var oUid, out var _))
|
||||
var ev = new BankBalanceUpdatedEvent(uid, component.Balance);
|
||||
while (query.MoveNext(out var client, out var comp, out var xform))
|
||||
{
|
||||
if (!_uiSystem.IsUiOpen(oUid, CargoConsoleUiKey.Orders))
|
||||
continue;
|
||||
|
||||
var station = _station.GetOwningStation(oUid);
|
||||
var station = _station.GetOwningStation(client, xform);
|
||||
if (station != uid)
|
||||
continue;
|
||||
|
||||
UpdateOrderState(oUid, station);
|
||||
comp.Balance = component.Balance;
|
||||
Dirty(client, comp);
|
||||
RaiseLocalEvent(client, ref ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user