uplink locking/unlocking, minor pda refactor (#15842)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-05-01 06:30:08 +00:00
committed by GitHub
parent 904d61baee
commit 44f9c098ec
13 changed files with 134 additions and 49 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Mind.Components;
using Content.Server.PDA.Ringer;
using Content.Server.Store.Components;
using Content.Server.UserInterface;
using Content.Shared.FixedPoint;
@@ -72,9 +73,9 @@ public sealed partial class StoreSystem : EntitySystem
if (args.Target == null || !TryComp<StoreComponent>(args.Target, out var store))
return;
// require the store to be open before inserting currency
// if the store can be locked, it must be unlocked first before inserting currency
var user = args.User;
if (!TryComp<ActorComponent>(user, out var actor) || !_ui.SessionHasOpenUi(uid, StoreUiKey.Key, actor.PlayerSession))
if (TryComp<RingerUplinkComponent>(args.Target, out var uplink) && !uplink.Unlocked)
return;
args.Handled = TryAddCurrency(GetCurrencyValue(uid, component), args.Target.Value, store);
@@ -183,6 +184,8 @@ public sealed partial class StoreSystem : EntitySystem
var ui = _ui.GetUiOrNull(uid, StoreUiKey.Key);
if (ui != null)
{
_ui.SetUiState(ui, new StoreInitializeState(preset.StoreName));
}
}
}