Content PR for auto-componentstate sourcegen (#14845)
* Content PR for auto-componentstate sourcegen # Conflicts: # Content.Shared/Chat/TypingIndicator/TypingIndicatorComponent.cs # Content.Shared/Content.Shared.csproj # SpaceStation14.sln * shared file too * afterautohandlestate example * oops * anudda * access fixed * smart
This commit is contained in:
@@ -11,28 +11,6 @@ public abstract class SharedIdCardSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<IdCardComponent, ComponentGetState>(OnComponentGetState);
|
||||
SubscribeLocalEvent<IdCardComponent, ComponentHandleState>(OnComponentHandleState);
|
||||
}
|
||||
|
||||
private void OnComponentGetState(EntityUid uid, IdCardComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new IdCardComponentState(component.FullName, component.JobTitle);
|
||||
}
|
||||
|
||||
private void OnComponentHandleState(EntityUid uid, IdCardComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is IdCardComponentState state)
|
||||
{
|
||||
component.FullName = state.FullName;
|
||||
component.JobTitle = state.JobTitle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to find an ID card on an entity. This will look in the entity itself, in the entity's hands, and
|
||||
/// in the entity's inventory.
|
||||
|
||||
Reference in New Issue
Block a user