Modernize GhostComponent & Ghost API (#36858)

* Move CanReturnToBody to system

* Move CanGhostInteract to system

* Cleanup redundant datafields and viewvariables

* Document datafields

* Document component

* Add SetTimeOfDeath Entity<T> overload, obsolete old version

* Document public methods

* Cleanup obsoleted method calls
This commit is contained in:
Tayrtahn
2025-04-23 14:28:10 -04:00
committed by GitHub
parent a7b9694d10
commit 6d88dd910d
5 changed files with 92 additions and 47 deletions

View File

@@ -62,7 +62,7 @@ public sealed class MindSystem : SharedMindSystem
{
TransferTo(mindId, visiting, mind: mind);
if (TryComp(visiting, out GhostComponent? ghostComp))
_ghosts.SetCanReturnToBody(ghostComp, false);
_ghosts.SetCanReturnToBody((visiting, ghostComp), false);
return;
}
@@ -214,7 +214,7 @@ public sealed class MindSystem : SharedMindSystem
entity = Spawn(GameTicker.ObserverPrototypeName, position);
component = EnsureComp<MindContainerComponent>(entity.Value);
var ghostComponent = Comp<GhostComponent>(entity.Value);
_ghosts.SetCanReturnToBody(ghostComponent, false);
_ghosts.SetCanReturnToBody((entity.Value, ghostComponent), false);
}
var oldEntity = mind.OwnedEntity;