Clean up StoreSystem (#14027)

This commit is contained in:
Nemanja
2023-02-12 07:39:14 -05:00
committed by GitHub
parent e7b18b33aa
commit 351c53e774
9 changed files with 108 additions and 101 deletions

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Traitor.Uplink
public int GetTCBalance(StoreComponent component)
{
FixedPoint2? tcBalance = component.Balance.GetValueOrDefault(TelecrystalCurrencyPrototype);
return tcBalance != null ? tcBalance.Value.Int() : 0;
return tcBalance?.Int() ?? 0;
}
/// <summary>
@@ -46,15 +46,14 @@ namespace Content.Server.Traitor.Uplink
}
var store = EnsureComp<StoreComponent>(uplinkEntity.Value);
_store.InitializeFromPreset(uplinkPresetId, store);
_store.InitializeFromPreset(uplinkPresetId, uplinkEntity.Value, store);
store.AccountOwner = user;
store.Balance.Clear();
if (balance != null)
{
store.Balance.Clear();
_store.TryAddCurrency(
new Dictionary<string, FixedPoint2>() { { TelecrystalCurrencyPrototype, balance.Value } }, store);
_store.TryAddCurrency(new Dictionary<string, FixedPoint2> { { TelecrystalCurrencyPrototype, balance.Value } }, uplinkEntity.Value, store);
}
// TODO add BUI. Currently can't be done outside of yaml -_-