Inline UID
This commit is contained in:
@@ -147,7 +147,7 @@ namespace Content.Client.Construction
|
||||
|
||||
var entity = EntityManager.GetEntity(args.EntityUid);
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ConstructionGhostComponent?>(entity.Uid, out var ghostComp))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ConstructionGhostComponent?>(entity, out var ghostComp))
|
||||
return false;
|
||||
|
||||
TryStartConstruction(ghostComp.GhostId);
|
||||
@@ -171,12 +171,12 @@ namespace Content.Client.Construction
|
||||
}
|
||||
|
||||
var ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||
var comp = IoCManager.Resolve<IEntityManager>().GetComponent<ConstructionGhostComponent>(ghost.Uid);
|
||||
var comp = IoCManager.Resolve<IEntityManager>().GetComponent<ConstructionGhostComponent>(ghost);
|
||||
comp.Prototype = prototype;
|
||||
comp.GhostId = _nextId++;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Uid).LocalRotation = dir.ToAngle();
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost).LocalRotation = dir.ToAngle();
|
||||
_ghosts.Add(comp.GhostId, comp);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ghost.Uid);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ghost);
|
||||
sprite.Color = new Color(48, 255, 48, 128);
|
||||
sprite.AddBlankLayer(0); // There is no way to actually check if this already exists, so we blindly insert a new one
|
||||
sprite.LayerSetSprite(0, prototype.Icon);
|
||||
@@ -191,7 +191,7 @@ namespace Content.Client.Construction
|
||||
{
|
||||
foreach (var ghost in _ghosts)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Value.Owner.Uid).Coordinates.Equals(loc)) return true;
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Value.Owner).Coordinates.Equals(loc)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -206,7 +206,7 @@ namespace Content.Client.Construction
|
||||
throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}");
|
||||
}
|
||||
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Owner.Uid);
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ghost.Owner);
|
||||
var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId);
|
||||
RaiseNetworkEvent(msg);
|
||||
}
|
||||
@@ -226,7 +226,7 @@ namespace Content.Client.Construction
|
||||
{
|
||||
if (_ghosts.TryGetValue(ghostId, out var ghost))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(ghost.Owner.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity((EntityUid) ghost.Owner);
|
||||
_ghosts.Remove(ghostId);
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ namespace Content.Client.Construction
|
||||
{
|
||||
foreach (var (_, ghost) in _ghosts)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(ghost.Owner.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity((EntityUid) ghost.Owner);
|
||||
}
|
||||
|
||||
_ghosts.Clear();
|
||||
|
||||
Reference in New Issue
Block a user