Cleaner BoundUserInterfaces (#17736)
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Content.Server.Access.Systems
|
||||
// BUI
|
||||
SubscribeLocalEvent<AgentIDCardComponent, AfterActivatableUIOpenEvent>(AfterUIOpen);
|
||||
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardNameChangedMessage>(OnNameChanged);
|
||||
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobChangedMessage> (OnJobChanged);
|
||||
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobChangedMessage>(OnJobChanged);
|
||||
}
|
||||
|
||||
private void OnAfterInteract(EntityUid uid, AgentIDCardComponent component, AfterInteractEvent args)
|
||||
@@ -55,14 +55,14 @@ namespace Content.Server.Access.Systems
|
||||
|
||||
private void AfterUIOpen(EntityUid uid, AgentIDCardComponent component, AfterActivatableUIOpenEvent args)
|
||||
{
|
||||
if (!_uiSystem.TryGetUi(component.Owner, AgentIDCardUiKey.Key, out var ui))
|
||||
if (!_uiSystem.TryGetUi(uid, AgentIDCardUiKey.Key, out var ui))
|
||||
return;
|
||||
|
||||
if (!TryComp<IdCardComponent>(uid, out var idCard))
|
||||
return;
|
||||
|
||||
var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "");
|
||||
ui.SetState(state, args.Session);
|
||||
UserInterfaceSystem.SetUiState(ui, state, args.Session);
|
||||
}
|
||||
|
||||
private void OnJobChanged(EntityUid uid, AgentIDCardComponent comp, AgentIDCardJobChangedMessage args)
|
||||
|
||||
Reference in New Issue
Block a user