private BoundUserInterface?GetUIOrNull(EntityUid uid, Enum?key, IntrinsicUIComponent?component = null) { if (!Resolve(uid, ref component)) { return(null); } return(key is null ? null : uid.GetUIOrNull(key)); }
public void ToggleInstrumentUi(EntityUid uid, IPlayerSession session, InstrumentComponent?component = null) { if (!Resolve(uid, ref component)) { return; } var ui = uid.GetUIOrNull(InstrumentUiKey.Key); ui?.Toggle(session); }
private void OnOpenStripComplete(EntityUid uid, StrippableComponent component, OpenStrippingCompleteEvent args) { component.CancelTokens.Remove(args.User); if (!TryComp <ActorComponent>(args.User, out var actor)) { return; } uid.GetUIOrNull(StrippingUiKey.Key)?.Open(actor.PlayerSession); }
public void SendUpdate(EntityUid uid, StrippableComponent?strippableComponent = null) { var bui = uid.GetUIOrNull(StrippingUiKey.Key); if (!Resolve(uid, ref strippableComponent, false) || bui == null) { return; } var cuffs = new Dictionary <EntityUid, string>(); var inventory = new Dictionary <(string ID, string Name), string>(); var hands = new Dictionary <string, string>(); if (TryComp(uid, out CuffableComponent? cuffed)) { foreach (var entity in cuffed.StoredEntities) { var name = Name(entity); cuffs.Add(entity, name); } } if (_inventorySystem.TryGetSlots(uid, out var slots)) { foreach (var slot in slots) { var name = "None"; if (_inventorySystem.TryGetSlotEntity(uid, slot.Name, out var item)) { if (!slot.StripHidden) { name = Name(item.Value); } else { name = Loc.GetString("strippable-bound-user-interface-stripping-menu-obfuscate"); } } inventory[(slot.Name, slot.DisplayName)] = name;