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:
Kara
2023-04-06 10:33:40 -07:00
committed by GitHub
parent b943d83ae1
commit 9688544e78
6 changed files with 23 additions and 64 deletions

View File

@@ -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.