private void OnComponentHandleState(EntityUid uid, IdCardComponent component, ref ComponentHandleState args) { if (args.Current is IdCardComponentState state) { component.FullName = state.FullName; component.JobTitle = state.JobTitle; } }
private string GetNameAndJob(IdCardComponent id) { var jobSuffix = string.IsNullOrWhiteSpace(id.JobTitle) ? string.Empty : $" ({id.JobTitle})"; var val = string.IsNullOrWhiteSpace(id.FullName) ? Loc.GetString("access-id-card-component-owner-name-job-title-text", ("originalOwnerName", id.OriginalOwnerName), ("jobSuffix", jobSuffix)) : Loc.GetString("access-id-card-component-owner-full-name-job-title-text", ("fullName", id.FullName), ("jobSuffix", jobSuffix)); return(val); }
private void HandleIDEjection(IEntity pdaUser) { if (IdSlotEmpty) { return; } var cardEntity = ContainedID.Owner; _idSlot.Remove(cardEntity); var hands = pdaUser.GetComponent <HandsComponent>(); var cardItemComponent = cardEntity.GetComponent <ItemComponent>(); hands.PutInHandOrDrop(cardItemComponent); ContainedID = null; UpdatePDAUserInterface(); }
private bool TryInsertIdCard(InteractUsingEventArgs eventArgs, IdCardComponent idCardComponent) { var item = eventArgs.Using; if (_idSlot.Contains(item)) { return(false); } if (!eventArgs.User.TryGetComponent(out IHandsComponent? hands)) { Owner.PopupMessage(eventArgs.User, Loc.GetString("comp-pda-ui-try-insert-id-card-no-hands")); return(true); } IEntity?swap = null; if (!IdSlotEmpty) { // Swap swap = _idSlot.ContainedEntities[0]; } if (!hands.Drop(item)) { return(true); } if (swap != null) { hands.PutInHand(swap.GetComponent <ItemComponent>()); } InsertIdCard(idCardComponent); UpdatePDAUserInterface(); return(true); }
private void OnMicrowaved(EntityUid uid, IdCardComponent component, BeingMicrowavedEvent args) { if (TryComp <AccessComponent>(uid, out var access)) { float randomPick = _random.NextFloat(); // if really unlucky, burn card if (randomPick <= 0.15f) { TryComp <TransformComponent>(uid, out TransformComponent? transformComponent); if (transformComponent != null) { _popupSystem.PopupCoordinates(Loc.GetString("id-card-component-microwave-burnt", ("id", uid)), transformComponent.Coordinates, Filter.Pvs(uid)); EntityManager.SpawnEntity("FoodBadRecipe", transformComponent.Coordinates); } EntityManager.QueueDeleteEntity(uid); return; } // If they're unlucky, brick their ID if (randomPick <= 0.25f) { _popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-bricked", ("id", uid)), uid, Filter.Pvs(uid)); access.Tags.Clear(); } else { _popupSystem.PopupEntity(Loc.GetString("id-card-component-microwave-safe", ("id", uid)), uid, Filter.Pvs(uid)); } // Give them a wonderful new access to compensate for everything var random = _random.Pick(_prototypeManager.EnumeratePrototypes <AccessLevelPrototype>().ToArray()); access.Tags.Add(random.ID); } }
public void InsertIdCard(IdCardComponent card) { _idSlot.Insert(card.Owner); ContainedID = card; SoundSystem.Play(Filter.Pvs(Owner), _insertIdSound.GetSound(), Owner); }
private void InsertIdCard(IdCardComponent card) { _idSlot.Insert(card.Owner); ContainedID = card; EntitySystem.Get <AudioSystem>().PlayFromEntity("/Audio/Guns/MagIn/batrifle_magin.ogg", Owner); }
private void OnInit(EntityUid uid, IdCardComponent id, ComponentInit args) { id.OriginalOwnerName ??= EntityManager.GetComponent <MetaDataComponent>(id.Owner).EntityName; UpdateEntityName(uid, id); }
private void InsertIdCard(IdCardComponent card) { _idSlot.Insert(card.Owner); ContainedID = card; }
public void InsertIdCard(IdCardComponent card) { _idSlot.Insert(card.Owner); ContainedID = card; SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Weapons/Guns/MagIn/batrifle_magin.ogg", Owner); }
private void OnInit(EntityUid uid, IdCardComponent id, ComponentInit args) { id.OriginalOwnerName ??= id.Owner.Name; UpdateEntityName(uid, id); }
private void OnComponentGetState(EntityUid uid, IdCardComponent component, ref ComponentGetState args) { args.State = new IdCardComponentState(component.FullName, component.JobTitle); }