Files
tbd-station-14/Content.Shared/PDA/PdaComponent.cs
nikthechampiongr ee434e397d Rename fix (#31654)
* Localize RenameCommand and delegate most of the process to MetaDataSystem.SetEntityName()

* Make renaming rely on the EntityRenamedEvent. Fix issue where renaming would keep old Examine text

Requires engine change

* Fix localisation strings

* Make PDA search be based on a renamed entity's Uid instead of its old name

To do this the pda component now has an PdaOwner field which gets
assigned when it is given as a loadout to a player

* Fix bad merge???

huh

* Use AllEntityQuery
2024-09-15 11:55:03 +10:00

49 lines
1.9 KiB
C#

using Robust.Shared.Prototypes;
using Robust.Shared.GameStates;
using Content.Shared.Access.Components;
using Content.Shared.Containers.ItemSlots;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.PDA
{
[RegisterComponent, NetworkedComponent]
public sealed partial class PdaComponent : Component
{
public const string PdaIdSlotId = "PDA-id";
public const string PdaPenSlotId = "PDA-pen";
public const string PdaPaiSlotId = "PDA-pai";
/// <summary>
/// The base PDA sprite state, eg. "pda", "pda-clown"
/// </summary>
[DataField("state")]
public string? State;
[DataField("idSlot")]
public ItemSlot IdSlot = new();
[DataField("penSlot")]
public ItemSlot PenSlot = new();
[DataField("paiSlot")]
public ItemSlot PaiSlot = new();
// Really this should just be using ItemSlot.StartingItem. However, seeing as we have so many different starting
// PDA's and no nice way to inherit the other fields from the ItemSlot data definition, this makes the yaml much
// nicer to read.
[DataField("id", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? IdCard;
[ViewVariables] public EntityUid? ContainedId;
[ViewVariables] public bool FlashlightOn;
[ViewVariables(VVAccess.ReadWrite)] public string? OwnerName;
// The Entity that "owns" the PDA, usually a player's character.
// This is useful when we are doing stuff like renaming a player and want to find their PDA to change the name
// as well.
[ViewVariables(VVAccess.ReadWrite)] public EntityUid? PdaOwner;
[ViewVariables] public string? StationName;
[ViewVariables] public string? StationAlertLevel;
[ViewVariables] public Color StationAlertColor = Color.White;
}
}