Fix build ghosts not being placeable on a new round. (#35097)
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Content.Client.Construction
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class ConstructionGhostComponent : Component
|
public sealed partial class ConstructionGhostComponent : Component
|
||||||
{
|
{
|
||||||
|
public int GhostId { get; set; }
|
||||||
[ViewVariables] public ConstructionPrototype? Prototype { get; set; }
|
[ViewVariables] public ConstructionPrototype? Prototype { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ namespace Content.Client.Construction
|
|||||||
.Register<ConstructionSystem>();
|
.Register<ConstructionSystem>();
|
||||||
|
|
||||||
SubscribeLocalEvent<ConstructionGhostComponent, ExaminedEvent>(HandleConstructionGhostExamined);
|
SubscribeLocalEvent<ConstructionGhostComponent, ExaminedEvent>(HandleConstructionGhostExamined);
|
||||||
|
SubscribeLocalEvent<ConstructionGhostComponent, ComponentShutdown>(HandleGhostComponentShutdown);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleGhostComponentShutdown(EntityUid uid, ConstructionGhostComponent component, ComponentShutdown args)
|
||||||
|
{
|
||||||
|
ClearGhost(component.GhostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnConstructionGuideReceived(ResponseConstructionGuide ev)
|
private void OnConstructionGuideReceived(ResponseConstructionGuide ev)
|
||||||
@@ -205,8 +211,9 @@ namespace Content.Client.Construction
|
|||||||
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||||
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
||||||
comp.Prototype = prototype;
|
comp.Prototype = prototype;
|
||||||
|
comp.GhostId = ghost.GetHashCode();
|
||||||
EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
|
EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
|
||||||
_ghosts.Add(ghost.GetHashCode(), ghost.Value);
|
_ghosts.Add(comp.GhostId, ghost.Value);
|
||||||
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
|
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
|
||||||
sprite.Color = new Color(48, 255, 48, 128);
|
sprite.Color = new Color(48, 255, 48, 128);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user