Convert familiars to GhostRoleMobSpawner (#9525)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -4,6 +4,7 @@ using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Content.Server.Ghost.Roles.Events;
|
||||
|
||||
namespace Content.Server.Ghost.Roles.Components
|
||||
{
|
||||
@@ -38,6 +39,11 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
throw new NullReferenceException("Prototype string cannot be null or empty!");
|
||||
|
||||
var mob = _entMan.SpawnEntity(Prototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
var xform = _entMan.GetComponent<TransformComponent>(mob);
|
||||
xform.AttachToGridOrMap();
|
||||
|
||||
var spawnedEvent = new GhostRoleSpawnerUsedEvent(Owner, mob);
|
||||
_entMan.EventBus.RaiseLocalEvent(mob, spawnedEvent, false);
|
||||
|
||||
if (MakeSentient)
|
||||
MakeSentientCommand.MakeSentient(mob, _entMan);
|
||||
@@ -53,7 +59,7 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
Taken = true;
|
||||
|
||||
if (_deleteOnSpawn)
|
||||
_entMan.DeleteEntity(Owner);
|
||||
_entMan.QueueDeleteEntity(Owner);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user