Rehydratable component attaches spawned entities to grid or map.
Also fix crash when injecting rehydratable with a solution. - Fixes #2969
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.Utility;
|
|||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -67,7 +68,8 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
Owner.PopupMessageEveryone(Loc.GetString("{0:TheName} expands!", Owner));
|
Owner.PopupMessageEveryone(Loc.GetString("{0:TheName} expands!", Owner));
|
||||||
if (!string.IsNullOrEmpty(_targetPrototype))
|
if (!string.IsNullOrEmpty(_targetPrototype))
|
||||||
{
|
{
|
||||||
Owner.EntityManager.SpawnEntity(_targetPrototype, Owner.Transform.Coordinates);
|
var ent = Owner.EntityManager.SpawnEntity(_targetPrototype, Owner.Transform.Coordinates);
|
||||||
|
ent.Transform.AttachToGridOrMap();
|
||||||
}
|
}
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,8 +171,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
|
|||||||
|
|
||||||
private void SolutionChanged()
|
private void SolutionChanged()
|
||||||
{
|
{
|
||||||
EntitySystem.Get<ChemistrySystem>()
|
EntitySystem.Get<ChemistrySystem>().HandleSolutionChange(Owner);
|
||||||
.HandleSolutionChange(Owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessReactions()
|
private void ProcessReactions()
|
||||||
@@ -212,7 +211,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
|
|||||||
|
|
||||||
private void UpdateAppearance()
|
private void UpdateAppearance()
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<SharedAppearanceComponent>(out var appearance))
|
if (Owner.Deleted || !Owner.TryGetComponent<SharedAppearanceComponent>(out var appearance))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
appearance.SetData(SolutionContainerVisuals.VisualState, GetVisualState());
|
appearance.SetData(SolutionContainerVisuals.VisualState, GetVisualState());
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
foreach (var solutionChangeArg in solutionChangeArgs)
|
foreach (var solutionChangeArg in solutionChangeArgs)
|
||||||
{
|
{
|
||||||
solutionChangeArg.SolutionChanged(eventArgs);
|
solutionChangeArg.SolutionChanged(eventArgs);
|
||||||
|
|
||||||
|
if (owner.Deleted)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user