Transform refactor. (#139)

space-wizards/space-station-14#725
This commit is contained in:
Pieter-Jan Briers
2019-01-18 11:40:30 +01:00
committed by GitHub
parent e8e1c9dd1f
commit 415b7e96fd
30 changed files with 71 additions and 71 deletions

View File

@@ -45,7 +45,7 @@ namespace Content.Client
PopupMessage(_eyeManager.WorldToScreen(message.Coordinates), message.Message); PopupMessage(_eyeManager.WorldToScreen(message.Coordinates), message.Message);
} }
public override void PopupMessage(GridLocalCoordinates coordinates, IEntity viewer, string message) public override void PopupMessage(GridCoordinates coordinates, IEntity viewer, string message)
{ {
if (viewer != _playerManager.LocalPlayer.ControlledEntity) if (viewer != _playerManager.LocalPlayer.ControlledEntity)
{ {
@@ -59,7 +59,7 @@ namespace Content.Client
{ {
var label = new PopupLabel {Text = message}; var label = new PopupLabel {Text = message};
var minimumSize = label.CombinedMinimumSize; var minimumSize = label.CombinedMinimumSize;
label.InitialPos = label.Position = coordinates.AsVector - minimumSize / 2; label.InitialPos = label.Position = coordinates.Position - minimumSize / 2;
_userInterfaceManager.StateRoot.AddChild(label); _userInterfaceManager.StateRoot.AddChild(label);
_aliveLabels.Add(label); _aliveLabels.Add(label);
} }

View File

@@ -192,7 +192,7 @@ namespace Content.Client.Construction
if (prototype.Type != ConstructionType.Structure) if (prototype.Type != ConstructionType.Structure)
{ {
// In-hand attackby doesn't exist so this is the best alternative. // In-hand attackby doesn't exist so this is the best alternative.
var loc = Owner.Owner.GetComponent<ITransformComponent>().LocalPosition; var loc = Owner.Owner.GetComponent<ITransformComponent>().GridPosition;
Owner.SpawnGhost(prototype, loc, Direction.North); Owner.SpawnGhost(prototype, loc, Direction.North);
return; return;
} }

View File

@@ -23,7 +23,7 @@ namespace Content.Client.Construction
Owner = owner; Owner = owner;
} }
public override bool HijackPlacementRequest(GridLocalCoordinates coords) public override bool HijackPlacementRequest(GridCoordinates coords)
{ {
if (Prototype != null) if (Prototype != null)
{ {

View File

@@ -60,7 +60,7 @@ namespace Content.Client.GameObjects.Components.Construction
Button?.Dispose(); Button?.Dispose();
} }
public void SpawnGhost(ConstructionPrototype prototype, GridLocalCoordinates loc, Direction dir) public void SpawnGhost(ConstructionPrototype prototype, GridCoordinates loc, Direction dir)
{ {
var entMgr = IoCManager.Resolve<IClientEntityManager>(); var entMgr = IoCManager.Resolve<IClientEntityManager>();
var ghost = entMgr.ForceSpawnEntityAt("constructionghost", loc); var ghost = entMgr.ForceSpawnEntityAt("constructionghost", loc);
@@ -80,7 +80,7 @@ namespace Content.Client.GameObjects.Components.Construction
{ {
var ghost = Ghosts[ghostId]; var ghost = Ghosts[ghostId];
var transform = ghost.Owner.GetComponent<ITransformComponent>(); var transform = ghost.Owner.GetComponent<ITransformComponent>();
var msg = new TryStartStructureConstructionMessage(transform.LocalPosition, ghost.Prototype.ID, transform.LocalRotation, ghostId); var msg = new TryStartStructureConstructionMessage(transform.GridPosition, ghost.Prototype.ID, transform.LocalRotation, ghostId);
SendNetworkMessage(msg); SendNetworkMessage(msg);
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged
private TimeSpan _lastFireTime; private TimeSpan _lastFireTime;
private int _tick; private int _tick;
public void TryFire(GridLocalCoordinates worldPos) public void TryFire(GridCoordinates worldPos)
{ {
var curTime = IoCManager.Resolve<IGameTiming>().CurTime; var curTime = IoCManager.Resolve<IGameTiming>().CurTime;
var span = curTime - _lastFireTime; var span = curTime - _lastFireTime;

View File

@@ -73,7 +73,7 @@ namespace Content.Client.GameObjects.EntitySystems
RaiseNetworkEvent(new VerbSystemMessages.RequestVerbsMessage(_currentEntity)); RaiseNetworkEvent(new VerbSystemMessages.RequestVerbsMessage(_currentEntity));
var size = vBox.CombinedMinimumSize; var size = vBox.CombinedMinimumSize;
var box = UIBox2.FromDimensions(screenCoordinates.AsVector, size); var box = UIBox2.FromDimensions(screenCoordinates.Position, size);
_currentPopup.Open(box); _currentPopup.Open(box);
} }

View File

@@ -31,7 +31,7 @@ namespace Content.Server.Administration
{ {
var entityManager = IoCManager.Resolve<IEntityManager>(); var entityManager = IoCManager.Resolve<IEntityManager>();
var ghost = entityManager.ForceSpawnEntityAt("AdminObserver", var ghost = entityManager.ForceSpawnEntityAt("AdminObserver",
player.AttachedEntity.Transform.LocalPosition); player.AttachedEntity.Transform.GridPosition);
mind.Visit(ghost); mind.Visit(ghost);
} }

View File

@@ -53,7 +53,7 @@ namespace Content.Server.GameObjects.Components.Construction
{ {
// Oh boy we get to finish construction! // Oh boy we get to finish construction!
var entMgr = IoCManager.Resolve<IServerEntityManager>(); var entMgr = IoCManager.Resolve<IServerEntityManager>();
var ent = entMgr.ForceSpawnEntityAt(Prototype.Result, Transform.LocalPosition); var ent = entMgr.ForceSpawnEntityAt(Prototype.Result, Transform.GridPosition);
ent.GetComponent<ITransformComponent>().LocalRotation = Transform.LocalRotation; ent.GetComponent<ITransformComponent>().LocalRotation = Transform.LocalRotation;
Owner.Delete(); Owner.Delete();
return true; return true;
@@ -105,9 +105,9 @@ namespace Content.Server.GameObjects.Components.Construction
return false; return false;
} }
if (matStep.Material == MaterialType.Cable) if (matStep.Material == MaterialType.Cable)
AudioSystem.Play("/Audio/items/zip.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/zip.ogg", Transform.GridPosition);
else else
AudioSystem.Play("/Audio/items/deconstruct.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/deconstruct.ogg", Transform.GridPosition);
return true; return true;
case ConstructionStepTool toolStep: case ConstructionStepTool toolStep:
switch (toolStep.Tool) switch (toolStep.Tool)
@@ -115,7 +115,7 @@ namespace Content.Server.GameObjects.Components.Construction
case ToolType.Crowbar: case ToolType.Crowbar:
if (slapped.HasComponent<CrowbarComponent>()) if (slapped.HasComponent<CrowbarComponent>())
{ {
AudioSystem.Play("/Audio/items/crowbar.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/crowbar.ogg", Transform.GridPosition);
return true; return true;
} }
return false; return false;
@@ -123,16 +123,16 @@ namespace Content.Server.GameObjects.Components.Construction
if (slapped.TryGetComponent(out WelderComponent welder) && welder.TryUse(toolStep.Amount)) if (slapped.TryGetComponent(out WelderComponent welder) && welder.TryUse(toolStep.Amount))
{ {
if (random.NextDouble() > 0.5) if (random.NextDouble() > 0.5)
AudioSystem.Play("/Audio/items/welder.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/welder.ogg", Transform.GridPosition);
else else
AudioSystem.Play("/Audio/items/welder2.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/welder2.ogg", Transform.GridPosition);
return true; return true;
} }
return false; return false;
case ToolType.Wrench: case ToolType.Wrench:
if (slapped.HasComponent<WrenchComponent>()) if (slapped.HasComponent<WrenchComponent>())
{ {
AudioSystem.Play("/Audio/items/ratchet.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/ratchet.ogg", Transform.GridPosition);
return true; return true;
} }
return false; return false;
@@ -140,16 +140,16 @@ namespace Content.Server.GameObjects.Components.Construction
if (slapped.HasComponent<ScrewdriverComponent>()) if (slapped.HasComponent<ScrewdriverComponent>())
{ {
if (random.NextDouble() > 0.5) if (random.NextDouble() > 0.5)
AudioSystem.Play("/Audio/items/screwdriver.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/screwdriver.ogg", Transform.GridPosition);
else else
AudioSystem.Play("/Audio/items/screwdriver2.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/screwdriver2.ogg", Transform.GridPosition);
return true; return true;
} }
return false; return false;
case ToolType.Wirecutters: case ToolType.Wirecutters:
if (slapped.HasComponent<WirecutterComponent>()) if (slapped.HasComponent<WirecutterComponent>())
{ {
AudioSystem.Play("/Audio/items/wirecutter.ogg", Transform.LocalPosition); AudioSystem.Play("/Audio/items/wirecutter.ogg", Transform.GridPosition);
return true; return true;
} }
return false; return false;

View File

@@ -33,13 +33,13 @@ namespace Content.Server.GameObjects.Components.Construction
} }
} }
void TryStartStructureConstruction(GridLocalCoordinates loc, string prototypeName, Angle angle, int ack) void TryStartStructureConstruction(GridCoordinates loc, string prototypeName, Angle angle, int ack)
{ {
var protoMan = IoCManager.Resolve<IPrototypeManager>(); var protoMan = IoCManager.Resolve<IPrototypeManager>();
var prototype = protoMan.Index<ConstructionPrototype>(prototypeName); var prototype = protoMan.Index<ConstructionPrototype>(prototypeName);
var transform = Owner.GetComponent<ITransformComponent>(); var transform = Owner.GetComponent<ITransformComponent>();
if (!loc.InRange(transform.LocalPosition, InteractionSystem.INTERACTION_RANGE)) if (!loc.InRange(transform.GridPosition, InteractionSystem.INTERACTION_RANGE))
{ {
return; return;
} }

View File

@@ -151,7 +151,7 @@ namespace Content.Server.GameObjects
// TODO: The item should be dropped to the container our owner is in, if any. // TODO: The item should be dropped to the container our owner is in, if any.
var itemTransform = item.Owner.GetComponent<ITransformComponent>(); var itemTransform = item.Owner.GetComponent<ITransformComponent>();
itemTransform.LocalPosition = Owner.GetComponent<ITransformComponent>().LocalPosition; itemTransform.GridPosition = Owner.GetComponent<ITransformComponent>().GridPosition;
Dirty(); Dirty();
return true; return true;
} }

View File

@@ -171,7 +171,7 @@ namespace Content.Server.GameObjects
return null; return null;
} }
public bool Drop(string slot, GridLocalCoordinates coords) public bool Drop(string slot, GridCoordinates coords)
{ {
if (!CanDrop(slot)) if (!CanDrop(slot))
{ {
@@ -188,13 +188,13 @@ namespace Content.Server.GameObjects
item.RemovedFromSlot(); item.RemovedFromSlot();
// TODO: The item should be dropped to the container our owner is in, if any. // TODO: The item should be dropped to the container our owner is in, if any.
item.Owner.Transform.LocalPosition = coords; item.Owner.Transform.GridPosition = coords;
Dirty(); Dirty();
return true; return true;
} }
public bool Drop(IEntity entity, GridLocalCoordinates coords) public bool Drop(IEntity entity, GridCoordinates coords)
{ {
if (entity == null) if (entity == null)
{ {
@@ -227,7 +227,7 @@ namespace Content.Server.GameObjects
item.RemovedFromSlot(); item.RemovedFromSlot();
// TODO: The item should be dropped to the container our owner is in, if any. // TODO: The item should be dropped to the container our owner is in, if any.
item.Owner.Transform.LocalPosition = Owner.Transform.LocalPosition; item.Owner.Transform.GridPosition = Owner.Transform.GridPosition;
Dirty(); Dirty();
return true; return true;
@@ -451,7 +451,7 @@ namespace Content.Server.GameObjects
if (playerEntity == Owner && used != null) if (playerEntity == Owner && used != null)
{ {
InteractionSystem.Interaction(Owner, used, slot.ContainedEntity, InteractionSystem.Interaction(Owner, used, slot.ContainedEntity,
GridLocalCoordinates.Nullspace); GridCoordinates.Nullspace);
} }
break; break;

View File

@@ -148,7 +148,7 @@ namespace Content.Server.GameObjects.Components.Interactable
if (!user.TryGetComponent(out HandsComponent hands) if (!user.TryGetComponent(out HandsComponent hands)
|| !hands.PutInHand(cell.Owner.GetComponent<ItemComponent>())) || !hands.PutInHand(cell.Owner.GetComponent<ItemComponent>()))
cell.Owner.Transform.LocalPosition = user.Transform.LocalPosition; cell.Owner.Transform.GridPosition = user.Transform.GridPosition;
} }
[Verb] [Verb]

View File

@@ -256,7 +256,7 @@ namespace Content.Server.GameObjects
var ourtransform = Owner.GetComponent<ITransformComponent>(); var ourtransform = Owner.GetComponent<ITransformComponent>();
var playertransform = playerentity.GetComponent<ITransformComponent>(); var playertransform = playerentity.GetComponent<ITransformComponent>();
if (playertransform.LocalPosition.InRange(ourtransform.LocalPosition, 2) if (playertransform.GridPosition.InRange(ourtransform.GridPosition, 2)
&& (ourtransform.IsMapTransform || playertransform.ContainsEntity(ourtransform))) && (ourtransform.IsMapTransform || playertransform.ContainsEntity(ourtransform)))
{ {
var remove = (RemoveEntityMessage)message; var remove = (RemoveEntityMessage)message;

View File

@@ -11,7 +11,7 @@ namespace Content.Server.GameObjects.Components.Power
{ {
public class PowerDebugTool : SharedPowerDebugTool, IAfterAttack public class PowerDebugTool : SharedPowerDebugTool, IAfterAttack
{ {
void IAfterAttack.Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked) void IAfterAttack.Afterattack(IEntity user, GridCoordinates clicklocation, IEntity attacked)
{ {
if (attacked == null) if (attacked == null)
{ {
@@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Power
foreach (var provider in device.AvailableProviders) foreach (var provider in device.AvailableProviders)
{ {
var providerTransform = provider.Owner.GetComponent<ITransformComponent>(); var providerTransform = provider.Owner.GetComponent<ITransformComponent>();
builder.AppendFormat(" {0} ({1}) @ {2}", provider.Owner.Name, provider.Owner.Uid, providerTransform.LocalPosition); builder.AppendFormat(" {0} ({1}) @ {2}", provider.Owner.Name, provider.Owner.Uid, providerTransform.GridPosition);
if (device.Provider == provider) if (device.Provider == provider)
{ {
builder.Append(" (CURRENT)"); builder.Append(" (CURRENT)");

View File

@@ -32,11 +32,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
serializer.DataField(ref ArcWidth, "arcwidth", 90); serializer.DataField(ref ArcWidth, "arcwidth", 90);
} }
void IAfterAttack.Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked) void IAfterAttack.Afterattack(IEntity user, GridCoordinates clicklocation, IEntity attacked)
{ {
var location = user.GetComponent<ITransformComponent>().LocalPosition; var location = user.GetComponent<ITransformComponent>().GridPosition;
var angle = new Angle(clicklocation.ToWorld().Position - location.ToWorld().Position); var angle = new Angle(clicklocation.ToWorld().Position - location.ToWorld().Position);
var entities = IoCManager.Resolve<IServerEntityManager>().GetEntitiesInArc(user.GetComponent<ITransformComponent>().LocalPosition, Range, angle, ArcWidth); var entities = IoCManager.Resolve<IServerEntityManager>().GetEntitiesInArc(user.GetComponent<ITransformComponent>().GridPosition, Range, angle, ArcWidth);
foreach (var entity in entities) foreach (var entity in entities)
{ {

View File

@@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
rangedWeapon.FireHandler = Fire; rangedWeapon.FireHandler = Fire;
} }
private void Fire(IEntity user, GridLocalCoordinates clickLocation) private void Fire(IEntity user, GridCoordinates clickLocation)
{ {
var userPosition = user.Transform.WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously var userPosition = user.Transform.WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously
var angle = new Angle(clickLocation.Position - userPosition); var angle = new Angle(clickLocation.Position - userPosition);
@@ -72,7 +72,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
Born = time, Born = time,
DeathTime = time + TimeSpan.FromSeconds(1), DeathTime = time + TimeSpan.FromSeconds(1),
Size = new Vector2(dist, 1f), Size = new Vector2(dist, 1f),
Coordinates = user.Transform.LocalPosition.Translated(offset), Coordinates = user.Transform.GridPosition.Translated(offset),
//Rotated from east facing //Rotated from east facing
Rotation = (float) angle.Theta, Rotation = (float) angle.Theta,
ColorDelta = new Vector4(0, 0, 0, -1500f), ColorDelta = new Vector4(0, 0, 0, -1500f),

View File

@@ -59,9 +59,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
serializer.DataField(ref _spreadStdDev, "spreadstddev", 3); serializer.DataField(ref _spreadStdDev, "spreadstddev", 3);
} }
private void Fire(IEntity user, GridLocalCoordinates clickLocation) private void Fire(IEntity user, GridCoordinates clickLocation)
{ {
var userPosition = user.Transform.LocalPosition; //Remember world positions are ephemeral and can only be used instantaneously var userPosition = user.Transform.GridPosition; //Remember world positions are ephemeral and can only be used instantaneously
var angle = new Angle(clickLocation.Position - userPosition.Position); var angle = new Angle(clickLocation.Position - userPosition.Position);
if (Spread) if (Spread)

View File

@@ -19,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
public Func<bool> WeaponCanFireHandler; public Func<bool> WeaponCanFireHandler;
public Func<IEntity, bool> UserCanFireHandler; public Func<IEntity, bool> UserCanFireHandler;
public Action<IEntity, GridLocalCoordinates> FireHandler; public Action<IEntity, GridCoordinates> FireHandler;
private const int MaxFireDelayAttempts = 2; private const int MaxFireDelayAttempts = 2;
@@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
return UserCanFireHandler == null || UserCanFireHandler(user); return UserCanFireHandler == null || UserCanFireHandler(user);
} }
private void Fire(IEntity user, GridLocalCoordinates clickLocation) private void Fire(IEntity user, GridCoordinates clickLocation)
{ {
_lastFireTime = IoCManager.Resolve<IGameTiming>().CurTime; _lastFireTime = IoCManager.Resolve<IGameTiming>().CurTime;
FireHandler?.Invoke(user, clickLocation); FireHandler?.Invoke(user, clickLocation);
@@ -60,7 +60,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
} }
} }
private void _tryFire(IEntity user, GridLocalCoordinates coordinates, int attemptCount) private void _tryFire(IEntity user, GridCoordinates coordinates, int attemptCount)
{ {
if (!user.TryGetComponent(out HandsComponent hands) || hands.GetActiveHand.Owner != Owner) if (!user.TryGetComponent(out HandsComponent hands) || hands.GetActiveHand.Owner != Owner)
{ {

View File

@@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.EntitySystems
inputSys.BindMap.BindFunction(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine)); inputSys.BindMap.BindFunction(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine));
} }
private void HandleExamine(ICommonSession session, GridLocalCoordinates coords, EntityUid uid) private void HandleExamine(ICommonSession session, GridCoordinates coords, EntityUid uid)
{ {
if (!(session is IPlayerSession svSession)) if (!(session is IPlayerSession svSession))
return; return;

View File

@@ -57,7 +57,7 @@ namespace Content.Server.GameObjects.EntitySystems
/// <param name="attackwith"></param> /// <param name="attackwith"></param>
/// <param name="clicklocation"></param> /// <param name="clicklocation"></param>
/// <returns></returns> /// <returns></returns>
bool RangedAttackby(IEntity user, IEntity attackwith, GridLocalCoordinates clicklocation); bool RangedAttackby(IEntity user, IEntity attackwith, GridCoordinates clicklocation);
} }
/// <summary> /// <summary>
@@ -72,7 +72,7 @@ namespace Content.Server.GameObjects.EntitySystems
/// <param name="user"></param> /// <param name="user"></param>
/// <param name="clicklocation"></param> /// <param name="clicklocation"></param>
/// <param name="attacked">The entity that was clicked on out of range. May be null if no entity was clicked on.true</param> /// <param name="attacked">The entity that was clicked on out of range. May be null if no entity was clicked on.true</param>
void Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked); void Afterattack(IEntity user, GridCoordinates clicklocation, IEntity attacked);
} }
/// <summary> /// <summary>
@@ -115,7 +115,7 @@ namespace Content.Server.GameObjects.EntitySystems
inputSys.BindMap.BindFunction(ContentKeyFunctions.ActivateItemInWorld, new PointerInputCmdHandler((HandleUseItemInWorld))); inputSys.BindMap.BindFunction(ContentKeyFunctions.ActivateItemInWorld, new PointerInputCmdHandler((HandleUseItemInWorld)));
} }
private void HandleUseItemInWorld(ICommonSession session, GridLocalCoordinates coords, EntityUid uid) private void HandleUseItemInWorld(ICommonSession session, GridCoordinates coords, EntityUid uid)
{ {
if(!EntityManager.TryGetEntity(uid, out var used)) if(!EntityManager.TryGetEntity(uid, out var used))
return; return;
@@ -128,13 +128,13 @@ namespace Content.Server.GameObjects.EntitySystems
if(playerEnt == null || !playerEnt.IsValid()) if(playerEnt == null || !playerEnt.IsValid())
return; return;
if (!playerEnt.Transform.LocalPosition.InRange(used.Transform.LocalPosition, INTERACTION_RANGE)) if (!playerEnt.Transform.GridPosition.InRange(used.Transform.GridPosition, INTERACTION_RANGE))
return; return;
activateComp.Activate(playerEnt); activateComp.Activate(playerEnt);
} }
private void HandleUseItemInHand(ICommonSession session, GridLocalCoordinates coords, EntityUid uid) private void HandleUseItemInHand(ICommonSession session, GridCoordinates coords, EntityUid uid)
{ {
// client sanitization // client sanitization
if(!coords.IsValidLocation()) if(!coords.IsValidLocation())
@@ -152,7 +152,7 @@ namespace Content.Server.GameObjects.EntitySystems
UserInteraction(((IPlayerSession)session).AttachedEntity, coords, uid); UserInteraction(((IPlayerSession)session).AttachedEntity, coords, uid);
} }
private void UserInteraction(IEntity player, GridLocalCoordinates coordinates, EntityUid clickedUid) private void UserInteraction(IEntity player, GridCoordinates coordinates, EntityUid clickedUid)
{ {
//Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null //Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null
if (!EntityManager.TryGetEntity(clickedUid, out var attacked)) if (!EntityManager.TryGetEntity(clickedUid, out var attacked))
@@ -244,7 +244,7 @@ namespace Content.Server.GameObjects.EntitySystems
/// <param name="user"></param> /// <param name="user"></param>
/// <param name="weapon"></param> /// <param name="weapon"></param>
/// <param name="clicklocation"></param> /// <param name="clicklocation"></param>
public static void InteractAfterattack(IEntity user, IEntity weapon, GridLocalCoordinates clicklocation) public static void InteractAfterattack(IEntity user, IEntity weapon, GridCoordinates clicklocation)
{ {
List<IAfterAttack> afterattacks = weapon.GetAllComponents<IAfterAttack>().ToList(); List<IAfterAttack> afterattacks = weapon.GetAllComponents<IAfterAttack>().ToList();
@@ -261,7 +261,7 @@ namespace Content.Server.GameObjects.EntitySystems
/// <param name="user"></param> /// <param name="user"></param>
/// <param name="weapon"></param> /// <param name="weapon"></param>
/// <param name="attacked"></param> /// <param name="attacked"></param>
public static void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridLocalCoordinates clicklocation) public static void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clicklocation)
{ {
List<IAttackby> interactables = attacked.GetAllComponents<IAttackby>().ToList(); List<IAttackby> interactables = attacked.GetAllComponents<IAttackby>().ToList();
@@ -347,7 +347,7 @@ namespace Content.Server.GameObjects.EntitySystems
/// <param name="user"></param> /// <param name="user"></param>
/// <param name="weapon"></param> /// <param name="weapon"></param>
/// <param name="attacked"></param> /// <param name="attacked"></param>
public static void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, GridLocalCoordinates clicklocation) public static void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clicklocation)
{ {
List<IRangedAttackby> rangedusables = attacked.GetAllComponents<IRangedAttackby>().ToList(); List<IRangedAttackby> rangedusables = attacked.GetAllComponents<IRangedAttackby>().ToList();

View File

@@ -106,7 +106,7 @@ namespace Content.Server.GameObjects.EntitySystems
handsComp.SwapHands(); handsComp.SwapHands();
} }
private static void HandleDrop(ICommonSession session, GridLocalCoordinates coords, EntityUid uid) private static void HandleDrop(ICommonSession session, GridCoordinates coords, EntityUid uid)
{ {
var ent = ((IPlayerSession) session).AttachedEntity; var ent = ((IPlayerSession) session).AttachedEntity;
@@ -118,7 +118,7 @@ namespace Content.Server.GameObjects.EntitySystems
var transform = ent.Transform; var transform = ent.Transform;
if (transform.LocalPosition.InRange(coords, InteractionSystem.INTERACTION_RANGE)) if (transform.GridPosition.InRange(coords, InteractionSystem.INTERACTION_RANGE))
{ {
handsComp.Drop(handsComp.ActiveIndex, coords); handsComp.Drop(handsComp.ActiveIndex, coords);
} }
@@ -136,7 +136,7 @@ namespace Content.Server.GameObjects.EntitySystems
handsComp.ActivateItem(); handsComp.ActivateItem();
} }
private static void HandleThrowItem(ICommonSession session, GridLocalCoordinates coords, EntityUid uid) private static void HandleThrowItem(ICommonSession session, GridCoordinates coords, EntityUid uid)
{ {
var plyEnt = ((IPlayerSession)session).AttachedEntity; var plyEnt = ((IPlayerSession)session).AttachedEntity;
@@ -159,7 +159,7 @@ namespace Content.Server.GameObjects.EntitySystems
else else
{ {
stackComp.Use(1); stackComp.Use(1);
throwEnt = throwEnt.EntityManager.ForceSpawnEntityAt(throwEnt.Prototype.ID, plyEnt.Transform.LocalPosition); throwEnt = throwEnt.EntityManager.ForceSpawnEntityAt(throwEnt.Prototype.ID, plyEnt.Transform.GridPosition);
} }
if (!throwEnt.TryGetComponent(out CollidableComponent colComp)) if (!throwEnt.TryGetComponent(out CollidableComponent colComp))

View File

@@ -63,7 +63,7 @@ namespace Content.Server.GameTicking
private const float LobbyDuration = 20; private const float LobbyDuration = 20;
[ViewVariables] private bool _initialized; [ViewVariables] private bool _initialized;
[ViewVariables(VVAccess.ReadWrite)] private GridLocalCoordinates _spawnPoint; [ViewVariables(VVAccess.ReadWrite)] private GridCoordinates _spawnPoint;
[ViewVariables] private GameRunLevel _runLevel; [ViewVariables] private GameRunLevel _runLevel;
[ViewVariables] private bool LobbyEnabled => _configurationManager.GetCVar<bool>("game.lobbyenabled"); [ViewVariables] private bool LobbyEnabled => _configurationManager.GetCVar<bool>("game.lobbyenabled");
@@ -272,7 +272,7 @@ namespace Content.Server.GameTicking
var startTime = _gameTiming.RealTime; var startTime = _gameTiming.RealTime;
var grid = _mapLoader.LoadBlueprint(newMap, MapFile); var grid = _mapLoader.LoadBlueprint(newMap, MapFile);
_spawnPoint = new GridLocalCoordinates(Vector2.Zero, grid); _spawnPoint = new GridCoordinates(Vector2.Zero, grid);
var timeSpan = _gameTiming.RealTime - startTime; var timeSpan = _gameTiming.RealTime - startTime;
Logger.InfoS("ticker", $"Loaded map in {timeSpan.TotalMilliseconds:N2}ms."); Logger.InfoS("ticker", $"Loaded map in {timeSpan.TotalMilliseconds:N2}ms.");

View File

@@ -107,7 +107,7 @@ namespace Content.Server.Interfaces.GameObjects
/// <param name="slot">The slot to drop the item from.</param> /// <param name="slot">The slot to drop the item from.</param>
/// <param name="coords"></param> /// <param name="coords"></param>
/// <returns>True if an item was dropped, false otherwise.</returns> /// <returns>True if an item was dropped, false otherwise.</returns>
bool Drop(string slot, GridLocalCoordinates coords); bool Drop(string slot, GridCoordinates coords);
/// <summary> /// <summary>
/// Drop the specified entity in our hands to a certain position. /// Drop the specified entity in our hands to a certain position.
@@ -128,7 +128,7 @@ namespace Content.Server.Interfaces.GameObjects
/// <exception cref="ArgumentException"> /// <exception cref="ArgumentException">
/// Thrown if <see cref="entity"/> is not actually held in any hand. /// Thrown if <see cref="entity"/> is not actually held in any hand.
/// </exception> /// </exception>
bool Drop(IEntity entity, GridLocalCoordinates coords); bool Drop(IEntity entity, GridCoordinates coords);
/// <summary> /// <summary>
/// Drop the item contained in a slot into another container. /// Drop the item contained in a slot into another container.

View File

@@ -21,11 +21,11 @@ namespace Content.Server.Placement
{ {
var entMan = IoCManager.Resolve<IServerEntityManager>(); var entMan = IoCManager.Resolve<IServerEntityManager>();
var tBase = entMan.SpawnEntity("TurretBase"); var tBase = entMan.SpawnEntity("TurretBase");
tBase.GetComponent<ITransformComponent>().LocalPosition = new GridLocalCoordinates(localPosition, grid); tBase.GetComponent<ITransformComponent>().GridPosition = new GridCoordinates(localPosition, grid);
var tTop = entMan.SpawnEntity("TurretTopLight"); var tTop = entMan.SpawnEntity("TurretTopLight");
var topTransform = tTop.GetComponent<ITransformComponent>(); var topTransform = tTop.GetComponent<ITransformComponent>();
topTransform.LocalPosition = new GridLocalCoordinates(localPosition, grid); topTransform.GridPosition = new GridCoordinates(localPosition, grid);
topTransform.AttachParent(tBase); topTransform.AttachParent(tBase);
} }
} }

View File

@@ -29,7 +29,7 @@ namespace Content.Server
_initialized = true; _initialized = true;
} }
public override void PopupMessage(GridLocalCoordinates coordinates, IEntity viewer, string message) public override void PopupMessage(GridCoordinates coordinates, IEntity viewer, string message)
{ {
if (!viewer.TryGetComponent(out IActorComponent actor)) if (!viewer.TryGetComponent(out IActorComponent actor))
{ {

View File

@@ -24,7 +24,7 @@ namespace Content.Shared.GameObjects.Components.Construction
/// <summary> /// <summary>
/// Position to start building. /// Position to start building.
/// </summary> /// </summary>
public readonly GridLocalCoordinates Location; public readonly GridCoordinates Location;
/// <summary> /// <summary>
/// The construction prototype to start building. /// The construction prototype to start building.
@@ -38,7 +38,7 @@ namespace Content.Shared.GameObjects.Components.Construction
/// </summary> /// </summary>
public readonly int Ack; public readonly int Ack;
public TryStartStructureConstructionMessage(GridLocalCoordinates loc, string prototypeName, Angle angle, int ack) public TryStartStructureConstructionMessage(GridCoordinates loc, string prototypeName, Angle angle, int ack)
{ {
Directed = true; Directed = true;
Location = loc; Location = loc;

View File

@@ -33,10 +33,10 @@ namespace Content.Shared.GameObjects.Components.Weapons.Ranged
[Serializable, NetSerializable] [Serializable, NetSerializable]
protected class FireMessage : ComponentMessage protected class FireMessage : ComponentMessage
{ {
public readonly GridLocalCoordinates Target; public readonly GridCoordinates Target;
public readonly int Tick; public readonly int Tick;
public FireMessage(GridLocalCoordinates target, int tick) public FireMessage(GridCoordinates target, int tick)
{ {
Target = target; Target = target;
Tick = tick; Tick = tick;

View File

@@ -7,7 +7,7 @@ namespace Content.Shared.Interfaces
public interface ISharedNotifyManager public interface ISharedNotifyManager
{ {
void PopupMessage(IEntity source, IEntity viewer, string message); void PopupMessage(IEntity source, IEntity viewer, string message);
void PopupMessage(GridLocalCoordinates coordinates, IEntity viewer, string message); void PopupMessage(GridCoordinates coordinates, IEntity viewer, string message);
} }
public static class NotifyManagerExt public static class NotifyManagerExt

View File

@@ -14,10 +14,10 @@ namespace Content.Shared
{ {
// TODO: we might eventually want for this to pass the actual entity, // TODO: we might eventually want for this to pass the actual entity,
// so the notify could track the entity movement visually. // so the notify could track the entity movement visually.
PopupMessage(source.Transform.LocalPosition, viewer, message); PopupMessage(source.Transform.GridPosition, viewer, message);
} }
public abstract void PopupMessage(GridLocalCoordinates coordinates, IEntity viewer, string message); public abstract void PopupMessage(GridCoordinates coordinates, IEntity viewer, string message);
protected class MsgDoNotify : NetMessage protected class MsgDoNotify : NetMessage
{ {
@@ -30,7 +30,7 @@ namespace Content.Shared
#endregion #endregion
public string Message { get; set; } public string Message { get; set; }
public GridLocalCoordinates Coordinates; public GridCoordinates Coordinates;
public override void ReadFromBuffer(NetIncomingMessage buffer) public override void ReadFromBuffer(NetIncomingMessage buffer)
{ {

2
engine

Submodule engine updated: 6873ad70f4...6d9a1a4e43