Replace every usage of GridCoordinates with EntityCoordinates (#2021)
* Update RobustToolbox * Transition direct type usages * More updates * Fix invalid use of to map * Update RobustToolbox * Fix dropping items * Rename name usages of "GridCoordinates" to "EntityCoordinates" * Revert "Update RobustToolbox" This reverts commit 9f334a17c5908ded0043a63158bb671e4aa3f346. * Revert "Update RobustToolbox" This reverts commit 3a9c8cfa3606fa501aa84407796d2ad920853a09. # Conflicts: # RobustToolbox * Fix cursed IMapGrid method usage. * GridTileLookupTest now uses EntityCoordinates Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
This commit is contained in:
@@ -49,7 +49,7 @@ namespace Content.Client
|
|||||||
|
|
||||||
private void DoNotifyCoordinates(MsgDoNotifyCoordinates message)
|
private void DoNotifyCoordinates(MsgDoNotifyCoordinates message)
|
||||||
{
|
{
|
||||||
PopupMessage(_eyeManager.WorldToScreen(message.Coordinates), message.Message);
|
PopupMessage(_eyeManager.CoordinatesToScreen(message.Coordinates), message.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoNotifyEntity(MsgDoNotifyEntity message)
|
private void DoNotifyEntity(MsgDoNotifyEntity message)
|
||||||
@@ -59,27 +59,27 @@ namespace Content.Client
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupMessage(_eyeManager.WorldToScreen(entity.Transform.GridPosition), message.Message);
|
PopupMessage(_eyeManager.CoordinatesToScreen(entity.Transform.Coordinates), message.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PopupMessage(IEntity source, IEntity viewer, string message)
|
public override void PopupMessage(IEntity source, IEntity viewer, string message)
|
||||||
{
|
{
|
||||||
if (viewer != _playerManager.LocalPlayer.ControlledEntity)
|
if (viewer != _playerManager.LocalPlayer?.ControlledEntity)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupMessage(_eyeManager.WorldToScreen(source.Transform.GridPosition), message);
|
PopupMessage(_eyeManager.CoordinatesToScreen(source.Transform.Coordinates), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PopupMessage(GridCoordinates coordinates, IEntity viewer, string message)
|
public override void PopupMessage(EntityCoordinates coordinates, IEntity viewer, string message)
|
||||||
{
|
{
|
||||||
if (viewer != _playerManager.LocalPlayer.ControlledEntity)
|
if (viewer != _playerManager.LocalPlayer.ControlledEntity)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupMessage(_eyeManager.WorldToScreen(coordinates), message);
|
PopupMessage(_eyeManager.CoordinatesToScreen(coordinates), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PopupMessageCursor(IEntity viewer, string message)
|
public override void PopupMessageCursor(IEntity viewer, string message)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Content.Client.Construction
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool HijackPlacementRequest(GridCoordinates coordinates)
|
public override bool HijackPlacementRequest(EntityCoordinates coordinates)
|
||||||
{
|
{
|
||||||
if (_prototype != null)
|
if (_prototype != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
_overlayEntity = Owner.EntityManager.SpawnEntity("LowWallOverlay", Owner.Transform.GridPosition);
|
_overlayEntity = Owner.EntityManager.SpawnEntity("LowWallOverlay", Owner.Transform.Coordinates);
|
||||||
_overlayEntity.Transform.AttachParent(Owner);
|
_overlayEntity.Transform.AttachParent(Owner);
|
||||||
|
|
||||||
_overlaySprite = _overlayEntity.GetComponent<ISpriteComponent>();
|
_overlaySprite = _overlayEntity.GetComponent<ISpriteComponent>();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Content.Client.GameObjects.Components.Movement
|
|||||||
[ComponentReference(typeof(IMoverComponent))]
|
[ComponentReference(typeof(IMoverComponent))]
|
||||||
public class PlayerInputMoverComponent : SharedPlayerInputMoverComponent
|
public class PlayerInputMoverComponent : SharedPlayerInputMoverComponent
|
||||||
{
|
{
|
||||||
public override GridCoordinates LastPosition { get; set; }
|
public override EntityCoordinates LastPosition { get; set; }
|
||||||
public override float StepSoundDistance { get; set; }
|
public override float StepSoundDistance { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Content.Client.GameObjects.EntitySystems.AI
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (x, y) = _eyeManager.WorldToScreen(entity.Transform.GridPosition).Position;
|
var (x, y) = _eyeManager.CoordinatesToScreen(entity.Transform.Coordinates).Position;
|
||||||
var offsetPosition = new Vector2(x - panel.Width / 2, y - panel.Height - 50f);
|
var offsetPosition = new Vector2(x - panel.Width / 2, y - panel.Height - 50f);
|
||||||
panel.Visible = true;
|
panel.Visible = true;
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a construction ghost at the given location.
|
/// Creates a construction ghost at the given location.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SpawnGhost(ConstructionPrototype prototype, GridCoordinates loc, Direction dir)
|
public void SpawnGhost(ConstructionPrototype prototype, EntityCoordinates loc, Direction dir)
|
||||||
{
|
{
|
||||||
if (GhostPresent(loc))
|
if (GhostPresent(loc))
|
||||||
{
|
{
|
||||||
@@ -174,11 +174,11 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if any construction ghosts are present at the given position
|
/// Checks if any construction ghosts are present at the given position
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool GhostPresent(GridCoordinates loc)
|
private bool GhostPresent(EntityCoordinates loc)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<int, ConstructionGhostComponent> ghost in _ghosts)
|
foreach (var ghost in _ghosts)
|
||||||
{
|
{
|
||||||
if (ghost.Value.Owner.Transform.GridPosition.Equals(loc))
|
if (ghost.Value.Owner.Transform.Coordinates.Equals(loc))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
var ghost = _ghosts[ghostId];
|
var ghost = _ghosts[ghostId];
|
||||||
var transform = ghost.Owner.Transform;
|
var transform = ghost.Owner.Transform;
|
||||||
var msg = new TryStartStructureConstructionMessage(transform.GridPosition, ghost.Prototype.ID, transform.LocalRotation, ghostId);
|
var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId);
|
||||||
RaiseNetworkEvent(msg);
|
RaiseNetworkEvent(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set position ready for 2nd+ frames.
|
// Set position ready for 2nd+ frames.
|
||||||
_playerPosition = _eyeManager.WorldToScreen(AttachedEntity.Transform.GridPosition);
|
_playerPosition = _eyeManager.CoordinatesToScreen(AttachedEntity.Transform.Coordinates);
|
||||||
LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f));
|
LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f));
|
||||||
|
|
||||||
if (_firstDraw)
|
if (_firstDraw)
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var userGrid = _player.Transform.GridPosition;
|
var userGrid = _player.Transform.Coordinates;
|
||||||
|
|
||||||
// Check cancellations / finishes
|
// Check cancellations / finishes
|
||||||
foreach (var (id, doAfter) in doAfters)
|
foreach (var (id, doAfter) in doAfters)
|
||||||
@@ -133,7 +133,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
|||||||
{
|
{
|
||||||
var targetEntity = _entityManager.GetEntity(doAfter.TargetUid);
|
var targetEntity = _entityManager.GetEntity(doAfter.TargetUid);
|
||||||
|
|
||||||
if (targetEntity.Transform.GridPosition != doAfter.TargetGrid)
|
if (targetEntity.Transform.Coordinates != doAfter.TargetGrid)
|
||||||
{
|
{
|
||||||
doAfterComponent.Cancel(id, currentTime);
|
doAfterComponent.Cancel(id, currentTime);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HandleExamine(ICommonSession session, GridCoordinates coords, EntityUid uid)
|
private bool HandleExamine(ICommonSession session, EntityCoordinates coords, EntityUid uid)
|
||||||
{
|
{
|
||||||
if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined))
|
if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
var lunge = attacker.EnsureComponent<MeleeLungeComponent>();
|
var lunge = attacker.EnsureComponent<MeleeLungeComponent>();
|
||||||
lunge.SetData(msg.Angle);
|
lunge.SetData(msg.Angle);
|
||||||
|
|
||||||
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.GridPosition);
|
var entity = EntityManager.SpawnEntity(weaponArc.Prototype, attacker.Transform.Coordinates);
|
||||||
entity.Transform.LocalRotation = msg.Angle;
|
entity.Transform.LocalRotation = msg.Angle;
|
||||||
|
|
||||||
var weaponArcAnimation = entity.GetComponent<MeleeWeaponArcAnimationComponent>();
|
var weaponArcAnimation = entity.GetComponent<MeleeWeaponArcAnimationComponent>();
|
||||||
@@ -68,7 +68,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
EffectSprite = sourceSprite.BaseRSI.Path.ToString(),
|
EffectSprite = sourceSprite.BaseRSI.Path.ToString(),
|
||||||
RsiState = sourceSprite.LayerGetState(0).Name,
|
RsiState = sourceSprite.LayerGetState(0).Name,
|
||||||
Coordinates = attacker.Transform.GridPosition,
|
Coordinates = attacker.Transform.Coordinates,
|
||||||
Color = Vector4.Multiply(new Vector4(255, 255, 255, 125), 1.0f),
|
Color = Vector4.Multiply(new Vector4(255, 255, 255, 125), 1.0f),
|
||||||
ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f),
|
ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f),
|
||||||
Velocity = msg.Angle.ToVec(),
|
Velocity = msg.Angle.ToVec(),
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Content.Client.State;
|
using Content.Client.State;
|
||||||
using Content.Client.UserInterface;
|
using Content.Client.UserInterface;
|
||||||
using Content.Client.Utility;
|
using Content.Client.Utility;
|
||||||
using Content.Shared.GameObjects.EntitySystemMessages;
|
using Content.Shared.GameObjects.EntitySystemMessages;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
|
||||||
using Content.Shared.GameObjects.Verbs;
|
using Content.Shared.GameObjects.Verbs;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using Content.Shared.Physics;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects.EntitySystems;
|
using Robust.Client.GameObjects.EntitySystems;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Graphics.Drawing;
|
using Robust.Client.Graphics.Drawing;
|
||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
using Robust.Client.Interfaces.Graphics.ClientEye;
|
|
||||||
using Robust.Client.Interfaces.Input;
|
using Robust.Client.Interfaces.Input;
|
||||||
using Robust.Client.Interfaces.ResourceManagement;
|
using Robust.Client.Interfaces.ResourceManagement;
|
||||||
using Robust.Client.Interfaces.State;
|
using Robust.Client.Interfaces.State;
|
||||||
@@ -27,12 +23,9 @@ using Robust.Client.UserInterface.Controls;
|
|||||||
using Robust.Client.Utility;
|
using Robust.Client.Utility;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
|
||||||
using Robust.Shared.Input;
|
using Robust.Shared.Input;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
|
||||||
using Robust.Shared.Interfaces.Physics;
|
|
||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
@@ -53,7 +46,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
|
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
|
||||||
|
|
||||||
private EntityList _currentEntityList;
|
private EntityList _currentEntityList;
|
||||||
private VerbPopup _currentVerbListRoot;
|
private VerbPopup _currentVerbListRoot;
|
||||||
@@ -119,7 +111,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapCoordinates = args.Coordinates.ToMap(_mapManager);
|
var mapCoordinates = args.Coordinates.ToMap(_entityManager);
|
||||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
|
|
||||||
if (playerEntity == null || !TryGetContextEntities(playerEntity, mapCoordinates, out var entities))
|
if (playerEntity == null || !TryGetContextEntities(playerEntity, mapCoordinates, out var entities))
|
||||||
@@ -469,7 +461,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
var funcId = _master._inputManager.NetworkBindMap.KeyFunctionID(args.Function);
|
var funcId = _master._inputManager.NetworkBindMap.KeyFunctionID(args.Function);
|
||||||
|
|
||||||
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction, funcId, BoundKeyState.Down,
|
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction, funcId, BoundKeyState.Down,
|
||||||
_entity.Transform.GridPosition,
|
_entity.Transform.Coordinates,
|
||||||
args.PointerLocation, _entity.Uid);
|
args.PointerLocation, _entity.Uid);
|
||||||
|
|
||||||
// client side command handlers will always be sent the local player session.
|
// client side command handlers will always be sent the local player session.
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Collections.Immutable;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Client.GameObjects.Components;
|
using Content.Client.GameObjects.Components;
|
||||||
using Content.Client.Utility;
|
using Content.Client.Utility;
|
||||||
using Content.Shared.Utility;
|
|
||||||
using Robust.Client.GameObjects.EntitySystems;
|
using Robust.Client.GameObjects.EntitySystems;
|
||||||
using Robust.Client.Interfaces.GameObjects;
|
using Robust.Client.Interfaces.GameObjects;
|
||||||
using Robust.Client.Interfaces.Graphics.ClientEye;
|
using Robust.Client.Interfaces.Graphics.ClientEye;
|
||||||
@@ -111,9 +110,9 @@ namespace Content.Client.State
|
|||||||
return entitiesUnderPosition.Count > 0 ? entitiesUnderPosition[0] : null;
|
return entitiesUnderPosition.Count > 0 ? entitiesUnderPosition[0] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<IEntity> GetEntitiesUnderPosition(GridCoordinates coordinates)
|
public IList<IEntity> GetEntitiesUnderPosition(EntityCoordinates coordinates)
|
||||||
{
|
{
|
||||||
return GetEntitiesUnderPosition(coordinates.ToMap(MapManager));
|
return GetEntitiesUnderPosition(coordinates.ToMap(EntityManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<IEntity> GetEntitiesUnderPosition(MapCoordinates coordinates)
|
public IList<IEntity> GetEntitiesUnderPosition(MapCoordinates coordinates)
|
||||||
@@ -152,7 +151,7 @@ namespace Content.Client.State
|
|||||||
/// <param name="stateManager">state manager to use to get the current game screen</param>
|
/// <param name="stateManager">state manager to use to get the current game screen</param>
|
||||||
/// <param name="coordinates">coordinates to check</param>
|
/// <param name="coordinates">coordinates to check</param>
|
||||||
/// <returns>the entities under the position, empty list if none found</returns>
|
/// <returns>the entities under the position, empty list if none found</returns>
|
||||||
public static IList<IEntity> GetEntitiesUnderPosition(IStateManager stateManager, GridCoordinates coordinates)
|
public static IList<IEntity> GetEntitiesUnderPosition(IStateManager stateManager, EntityCoordinates coordinates)
|
||||||
{
|
{
|
||||||
if (stateManager.CurrentState is GameScreenBase gameScreenBase)
|
if (stateManager.CurrentState is GameScreenBase gameScreenBase)
|
||||||
{
|
{
|
||||||
@@ -184,7 +183,7 @@ namespace Content.Client.State
|
|||||||
|
|
||||||
var transx = x.clicked.Transform;
|
var transx = x.clicked.Transform;
|
||||||
var transy = y.clicked.Transform;
|
var transy = y.clicked.Transform;
|
||||||
val = transx.GridPosition.Y.CompareTo(transy.GridPosition.Y);
|
val = transx.Coordinates.Y.CompareTo(transy.Coordinates.Y);
|
||||||
if (val != 0)
|
if (val != 0)
|
||||||
{
|
{
|
||||||
return val;
|
return val;
|
||||||
|
|||||||
@@ -56,15 +56,15 @@ namespace Content.Client.Utility
|
|||||||
|
|
||||||
public static bool InRangeUnobstructed(
|
public static bool InRangeUnobstructed(
|
||||||
this LocalPlayer origin,
|
this LocalPlayer origin,
|
||||||
GridCoordinates other,
|
EntityCoordinates other,
|
||||||
float range = InteractionRange,
|
float range = InteractionRange,
|
||||||
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
||||||
Ignored predicate = null,
|
Ignored predicate = null,
|
||||||
bool ignoreInsideBlocker = false,
|
bool ignoreInsideBlocker = false,
|
||||||
bool popup = false)
|
bool popup = false)
|
||||||
{
|
{
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var otherPosition = other.ToMap(mapManager);
|
var otherPosition = other.ToMap(entityManager);
|
||||||
|
|
||||||
return origin.InRangeUnobstructed(otherPosition, range, collisionMask, predicate, ignoreInsideBlocker,
|
return origin.InRangeUnobstructed(otherPosition, range, collisionMask, predicate, ignoreInsideBlocker,
|
||||||
popup);
|
popup);
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ namespace Content.IntegrationTests
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridCoordinates GetLateJoinSpawnPoint() => GridCoordinates.InvalidGrid;
|
public EntityCoordinates GetLateJoinSpawnPoint() => EntityCoordinates.Invalid;
|
||||||
public GridCoordinates GetJobSpawnPoint(string jobId) => GridCoordinates.InvalidGrid;
|
public EntityCoordinates GetJobSpawnPoint(string jobId) => EntityCoordinates.Invalid;
|
||||||
public GridCoordinates GetObserverSpawnPoint() => GridCoordinates.InvalidGrid;
|
public EntityCoordinates GetObserverSpawnPoint() => EntityCoordinates.Invalid;
|
||||||
|
|
||||||
public void EquipStartingGear(IEntity entity, StartingGearPrototype startingGear)
|
public void EquipStartingGear(IEntity entity, StartingGearPrototype startingGear)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.GameObjects.Components.Movement;
|
using Content.Server.GameObjects.Components.Movement;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Server.AI;
|
using Robust.Server.AI;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -50,7 +51,7 @@ namespace Content.IntegrationTests.Tests.AI
|
|||||||
|
|
||||||
if (!comps.ContainsKey("AiController")) continue;
|
if (!comps.ContainsKey("AiController")) continue;
|
||||||
|
|
||||||
var aiEntity = entityManager.SpawnEntity(entity.ID, new GridCoordinates(new Vector2(0, 0), grid.Index));
|
var aiEntity = entityManager.SpawnEntity(entity.ID, grid.ToCoordinates());
|
||||||
var aiController = aiEntity.GetComponent<AiControllerComponent>();
|
var aiController = aiEntity.GetComponent<AiControllerComponent>();
|
||||||
Assert.That(processorNames.Contains(aiController.LogicName), $"Could not find valid processor named {aiController.LogicName} on entity {entity.ID}");
|
Assert.That(processorNames.Contains(aiController.LogicName), $"Could not find valid processor named {aiController.LogicName} on entity {entity.ID}");
|
||||||
}
|
}
|
||||||
@@ -58,6 +59,5 @@ namespace Content.IntegrationTests.Tests.AI
|
|||||||
|
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Atmos;
|
using Content.Server.Atmos;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Atmos
|
namespace Content.IntegrationTests.Tests.Atmos
|
||||||
@@ -10,17 +11,23 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
public class AtmosHelpersTest : ContentIntegrationTest
|
public class AtmosHelpersTest : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public async Task GetTileAtmosphereGridCoordinatesNullTest()
|
public async Task GetTileAtmosphereEntityCoordinatesNullTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
var entityManager = server.ResolveDependency<IEntityManager>();
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
Assert.DoesNotThrow(() =>
|
Assert.DoesNotThrow(() =>
|
||||||
{
|
{
|
||||||
var atmosphere = default(GridCoordinates).GetTileAtmosphere();
|
var atmosphere1 = default(EntityCoordinates).GetTileAtmosphere();
|
||||||
|
var atmosphere2 = default(EntityCoordinates).GetTileAtmosphere(entityManager);
|
||||||
|
|
||||||
Assert.Null(atmosphere);
|
Assert.Null(atmosphere1);
|
||||||
|
Assert.Null(atmosphere2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -28,7 +35,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task GetTileAirGridCoordinatesNullTest()
|
public async Task GetTileAirEntityCoordinatesNullTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
@@ -36,7 +43,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
{
|
{
|
||||||
Assert.DoesNotThrow(() =>
|
Assert.DoesNotThrow(() =>
|
||||||
{
|
{
|
||||||
var air = default(GridCoordinates).GetTileAir();
|
var air = default(EntityCoordinates).GetTileAir();
|
||||||
|
|
||||||
Assert.Null(air);
|
Assert.Null(air);
|
||||||
});
|
});
|
||||||
@@ -46,7 +53,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TryGetTileAtmosphereGridCoordinatesNullTest()
|
public async Task TryGetTileAtmosphereEntityCoordinatesNullTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
@@ -54,7 +61,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
{
|
{
|
||||||
Assert.DoesNotThrow(() =>
|
Assert.DoesNotThrow(() =>
|
||||||
{
|
{
|
||||||
var hasAtmosphere = default(GridCoordinates).TryGetTileAtmosphere(out var atmosphere);
|
var hasAtmosphere = default(EntityCoordinates).TryGetTileAtmosphere(out var atmosphere);
|
||||||
|
|
||||||
Assert.False(hasAtmosphere);
|
Assert.False(hasAtmosphere);
|
||||||
Assert.Null(atmosphere);
|
Assert.Null(atmosphere);
|
||||||
@@ -65,7 +72,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TryGetTileTileAirGridCoordinatesNullTest()
|
public async Task TryGetTileTileAirEntityCoordinatesNullTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
@@ -73,7 +80,7 @@ namespace Content.IntegrationTests.Tests.Atmos
|
|||||||
{
|
{
|
||||||
Assert.DoesNotThrow(() =>
|
Assert.DoesNotThrow(() =>
|
||||||
{
|
{
|
||||||
var hasAir = default(GridCoordinates).TryGetTileAir(out var air);
|
var hasAir = default(EntityCoordinates).TryGetTileAir(out var air);
|
||||||
|
|
||||||
Assert.False(hasAir);
|
Assert.False(hasAir);
|
||||||
Assert.Null(air);
|
Assert.Null(air);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Content.Shared.Damage;
|
|||||||
using Content.Shared.GameObjects.Components.Buckle;
|
using Content.Shared.GameObjects.Components.Buckle;
|
||||||
using Content.Shared.GameObjects.Components.Damage;
|
using Content.Shared.GameObjects.Components.Damage;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
@@ -193,7 +194,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var gridId = new GridId(1);
|
var gridId = new GridId(1);
|
||||||
var grid = mapManager.CreateGrid(mapId, gridId);
|
var grid = mapManager.CreateGrid(mapId, gridId);
|
||||||
var coordinates = new GridCoordinates((0, 0), gridId);
|
var coordinates = grid.GridEntityId.ToCoordinates();
|
||||||
var tileManager = IoCManager.Resolve<ITileDefinitionManager>();
|
var tileManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||||
var tileId = tileManager["underplating"].TileId;
|
var tileId = tileManager["underplating"].TileId;
|
||||||
var tile = new Tile(tileId);
|
var tile = new Tile(tileId);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Server.Interfaces.Timing;
|
using Robust.Server.Interfaces.Timing;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -52,7 +53,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
var tileDefinition = tileDefinitionManager["underplating"];
|
var tileDefinition = tileDefinitionManager["underplating"];
|
||||||
var tile = new Tile(tileDefinition.TileId);
|
var tile = new Tile(tileDefinition.TileId);
|
||||||
var coordinates = new GridCoordinates(0, 0, gridId);
|
var coordinates = grid.ToCoordinates();
|
||||||
|
|
||||||
grid.SetTile(coordinates, tile);
|
grid.SetTile(coordinates, tile);
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
var testLocation = new GridCoordinates(new Vector2(0, 0), grid);
|
var testLocation = grid.ToCoordinates();
|
||||||
|
|
||||||
//Generate list of non-abstract prototypes to test
|
//Generate list of non-abstract prototypes to test
|
||||||
foreach (var prototype in prototypeMan.EnumeratePrototypes<EntityPrototype>())
|
foreach (var prototype in prototypeMan.EnumeratePrototypes<EntityPrototype>())
|
||||||
@@ -160,7 +161,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
var tileDefinition = tileDefinitionManager["underplating"];
|
var tileDefinition = tileDefinitionManager["underplating"];
|
||||||
var tile = new Tile(tileDefinition.TileId);
|
var tile = new Tile(tileDefinition.TileId);
|
||||||
var coordinates = new GridCoordinates(0, 0, gridId);
|
var coordinates = grid.ToCoordinates();
|
||||||
|
|
||||||
grid.SetTile(coordinates, tile);
|
grid.SetTile(coordinates, tile);
|
||||||
|
|
||||||
@@ -169,7 +170,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
var testLocation = new GridCoordinates(new Vector2(0, 0), grid);
|
var testLocation = grid.ToCoordinates();
|
||||||
|
|
||||||
foreach (var type in componentFactory.AllRegisteredTypes)
|
foreach (var type in componentFactory.AllRegisteredTypes)
|
||||||
{
|
{
|
||||||
@@ -255,7 +256,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
var tileDefinition = tileDefinitionManager["underplating"];
|
var tileDefinition = tileDefinitionManager["underplating"];
|
||||||
var tile = new Tile(tileDefinition.TileId);
|
var tile = new Tile(tileDefinition.TileId);
|
||||||
var coordinates = new GridCoordinates(0, 0, gridId);
|
var coordinates = grid.ToCoordinates();
|
||||||
|
|
||||||
grid.SetTile(coordinates, tile);
|
grid.SetTile(coordinates, tile);
|
||||||
|
|
||||||
@@ -300,7 +301,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
{
|
{
|
||||||
foreach (var distinct in distinctComponents)
|
foreach (var distinct in distinctComponents)
|
||||||
{
|
{
|
||||||
var testLocation = new GridCoordinates(new Vector2(0, 0), grid);
|
var testLocation = grid.ToCoordinates();
|
||||||
var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation);
|
var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation);
|
||||||
|
|
||||||
Assert.That(entity.Initialized);
|
Assert.That(entity.Initialized);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.GameObjects.Components.Fluids;
|
using Content.Server.GameObjects.Components.Fluids;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Server.Interfaces.Timing;
|
using Robust.Server.Interfaces.Timing;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
@@ -23,7 +24,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
var pauseManager = server.ResolveDependency<IPauseManager>();
|
var pauseManager = server.ResolveDependency<IPauseManager>();
|
||||||
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
var tileDefinitionManager = server.ResolveDependency<ITileDefinitionManager>();
|
||||||
|
|
||||||
GridCoordinates coordinates = default;
|
EntityCoordinates coordinates = default;
|
||||||
|
|
||||||
// Build up test environment
|
// Build up test environment
|
||||||
server.Post(() =>
|
server.Post(() =>
|
||||||
@@ -42,7 +43,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
|
|
||||||
var tileDefinition = tileDefinitionManager["underplating"];
|
var tileDefinition = tileDefinitionManager["underplating"];
|
||||||
var tile = new Tile(tileDefinition.TileId);
|
var tile = new Tile(tileDefinition.TileId);
|
||||||
coordinates = new GridCoordinates(0, 0, gridId);
|
coordinates = grid.ToCoordinates();
|
||||||
|
|
||||||
grid.SetTile(coordinates, tile);
|
grid.SetTile(coordinates, tile);
|
||||||
|
|
||||||
@@ -69,6 +70,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
var pauseManager = server.ResolveDependency<IPauseManager>();
|
var pauseManager = server.ResolveDependency<IPauseManager>();
|
||||||
|
IMapGrid grid = null;
|
||||||
|
|
||||||
// Build up test environment
|
// Build up test environment
|
||||||
server.Post(() =>
|
server.Post(() =>
|
||||||
@@ -79,9 +81,9 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
|
|
||||||
var gridId = new GridId(1);
|
var gridId = new GridId(1);
|
||||||
|
|
||||||
if (!mapManager.GridExists(gridId))
|
if (!mapManager.TryGetGrid(gridId, out grid))
|
||||||
{
|
{
|
||||||
mapManager.CreateGrid(mapId, gridId);
|
grid = mapManager.CreateGrid(mapId, gridId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -90,7 +92,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
|||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
{
|
{
|
||||||
var gridId = new GridId(1);
|
var gridId = new GridId(1);
|
||||||
var coordinates = new GridCoordinates(0, 0, gridId);
|
var coordinates = grid.ToCoordinates();
|
||||||
var solution = new Solution("water", ReagentUnit.New(20));
|
var solution = new Solution("water", ReagentUnit.New(20));
|
||||||
var puddle = solution.SpillAt(coordinates, "PuddleSmear");
|
var puddle = solution.SpillAt(coordinates, "PuddleSmear");
|
||||||
Assert.Null(puddle);
|
Assert.Null(puddle);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.GameObjects.Components.Gravity;
|
using Content.Server.GameObjects.Components.Gravity;
|
||||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
@@ -37,7 +38,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
generator = entityMan.SpawnEntity("GravityGenerator", new GridCoordinates(new Vector2(0, 0), grid2.Index));
|
generator = entityMan.SpawnEntity("GravityGenerator", grid2.ToCoordinates());
|
||||||
Assert.That(generator.HasComponent<GravityGeneratorComponent>());
|
Assert.That(generator.HasComponent<GravityGeneratorComponent>());
|
||||||
Assert.That(generator.HasComponent<PowerReceiverComponent>());
|
Assert.That(generator.HasComponent<PowerReceiverComponent>());
|
||||||
var generatorComponent = generator.GetComponent<GravityGeneratorComponent>();
|
var generatorComponent = generator.GetComponent<GravityGeneratorComponent>();
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ namespace Content.IntegrationTests.Tests
|
|||||||
entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(1000, 1000)).ToList();
|
entities = tileLookup.GetEntitiesIntersecting(gridOne.Index, new MapIndices(1000, 1000)).ToList();
|
||||||
Assert.That(entities.Count, Is.EqualTo(0));
|
Assert.That(entities.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
var entityOne = entityManager.SpawnEntity("HumanMob_Content", new GridCoordinates(Vector2.Zero, gridOne));
|
var entityOne = entityManager.SpawnEntity("HumanMob_Content", new EntityCoordinates(gridOne.GridEntityId, Vector2.Zero));
|
||||||
entityManager.SpawnEntity("HumanMob_Content", new GridCoordinates(Vector2.One, gridOne));
|
entityManager.SpawnEntity("HumanMob_Content", new EntityCoordinates(gridOne.GridEntityId, Vector2.One));
|
||||||
|
|
||||||
var entityTiles = tileLookup.GetIndices(entityOne);
|
var entityTiles = tileLookup.GetIndices(entityOne);
|
||||||
Assert.That(entityTiles.Count, Is.EqualTo(2));
|
Assert.That(entityTiles.Count, Is.EqualTo(2));
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
IEntity other = null;
|
IEntity other = null;
|
||||||
IContainer container = null;
|
IContainer container = null;
|
||||||
IComponent component = null;
|
IComponent component = null;
|
||||||
GridCoordinates gridCoordinates = default;
|
EntityCoordinates entityCoordinates = default;
|
||||||
MapCoordinates mapCoordinates = default;
|
MapCoordinates mapCoordinates = default;
|
||||||
|
|
||||||
server.Assert(() =>
|
server.Assert(() =>
|
||||||
@@ -53,7 +53,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
other = entityManager.SpawnEntity(HumanId, coordinates);
|
other = entityManager.SpawnEntity(HumanId, coordinates);
|
||||||
container = ContainerManagerComponent.Ensure<Container>("InRangeUnobstructedTestOtherContainer", other);
|
container = ContainerManagerComponent.Ensure<Container>("InRangeUnobstructedTestOtherContainer", other);
|
||||||
component = other.Transform;
|
component = other.Transform;
|
||||||
gridCoordinates = other.Transform.GridPosition;
|
entityCoordinates = other.Transform.Coordinates;
|
||||||
mapCoordinates = other.Transform.MapPosition;
|
mapCoordinates = other.Transform.MapPosition;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -73,9 +73,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
Assert.True(origin.InRangeUnobstructed(container));
|
Assert.True(origin.InRangeUnobstructed(container));
|
||||||
Assert.True(container.InRangeUnobstructed(origin));
|
Assert.True(container.InRangeUnobstructed(origin));
|
||||||
|
|
||||||
// Entity <-> GridCoordinates
|
// Entity <-> EntityCoordinates
|
||||||
Assert.True(origin.InRangeUnobstructed(gridCoordinates));
|
Assert.True(origin.InRangeUnobstructed(entityCoordinates));
|
||||||
Assert.True(gridCoordinates.InRangeUnobstructed(origin));
|
Assert.True(entityCoordinates.InRangeUnobstructed(origin));
|
||||||
|
|
||||||
// Entity <-> MapCoordinates
|
// Entity <-> MapCoordinates
|
||||||
Assert.True(origin.InRangeUnobstructed(mapCoordinates));
|
Assert.True(origin.InRangeUnobstructed(mapCoordinates));
|
||||||
@@ -97,9 +97,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
Assert.True(origin.InRangeUnobstructed(container));
|
Assert.True(origin.InRangeUnobstructed(container));
|
||||||
Assert.True(container.InRangeUnobstructed(origin));
|
Assert.True(container.InRangeUnobstructed(origin));
|
||||||
|
|
||||||
// Entity <-> GridCoordinates
|
// Entity <-> EntityCoordinates
|
||||||
Assert.True(origin.InRangeUnobstructed(gridCoordinates));
|
Assert.True(origin.InRangeUnobstructed(entityCoordinates));
|
||||||
Assert.True(gridCoordinates.InRangeUnobstructed(origin));
|
Assert.True(entityCoordinates.InRangeUnobstructed(origin));
|
||||||
|
|
||||||
// Entity <-> MapCoordinates
|
// Entity <-> MapCoordinates
|
||||||
Assert.True(origin.InRangeUnobstructed(mapCoordinates));
|
Assert.True(origin.InRangeUnobstructed(mapCoordinates));
|
||||||
@@ -121,9 +121,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
Assert.False(origin.InRangeUnobstructed(container));
|
Assert.False(origin.InRangeUnobstructed(container));
|
||||||
Assert.False(container.InRangeUnobstructed(origin));
|
Assert.False(container.InRangeUnobstructed(origin));
|
||||||
|
|
||||||
// Entity <-> GridCoordinates
|
// Entity <-> EntityCoordinates
|
||||||
Assert.False(origin.InRangeUnobstructed(gridCoordinates));
|
Assert.False(origin.InRangeUnobstructed(entityCoordinates));
|
||||||
Assert.False(gridCoordinates.InRangeUnobstructed(origin));
|
Assert.False(entityCoordinates.InRangeUnobstructed(origin));
|
||||||
|
|
||||||
// Entity <-> MapCoordinates
|
// Entity <-> MapCoordinates
|
||||||
Assert.False(origin.InRangeUnobstructed(mapCoordinates));
|
Assert.False(origin.InRangeUnobstructed(mapCoordinates));
|
||||||
@@ -144,9 +144,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
|||||||
Assert.True(origin.InRangeUnobstructed(container, InteractionRangeDivided15Times3));
|
Assert.True(origin.InRangeUnobstructed(container, InteractionRangeDivided15Times3));
|
||||||
Assert.True(container.InRangeUnobstructed(origin, InteractionRangeDivided15Times3));
|
Assert.True(container.InRangeUnobstructed(origin, InteractionRangeDivided15Times3));
|
||||||
|
|
||||||
// Entity <-> GridCoordinates
|
// Entity <-> EntityCoordinates
|
||||||
Assert.True(origin.InRangeUnobstructed(gridCoordinates, InteractionRangeDivided15Times3));
|
Assert.True(origin.InRangeUnobstructed(entityCoordinates, InteractionRangeDivided15Times3));
|
||||||
Assert.True(gridCoordinates.InRangeUnobstructed(origin, InteractionRangeDivided15Times3));
|
Assert.True(entityCoordinates.InRangeUnobstructed(origin, InteractionRangeDivided15Times3));
|
||||||
|
|
||||||
// Entity <-> MapCoordinates
|
// Entity <-> MapCoordinates
|
||||||
Assert.True(origin.InRangeUnobstructed(mapCoordinates, InteractionRangeDivided15Times3));
|
Assert.True(origin.InRangeUnobstructed(mapCoordinates, InteractionRangeDivided15Times3));
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Mobs;
|
using Content.Server.Mobs;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
using Robust.Server.Interfaces.Player;
|
using Robust.Server.Interfaces.Player;
|
||||||
@@ -128,7 +129,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
|
|
||||||
mapMan.CreateNewMapEntity(MapId.Nullspace);
|
mapMan.CreateNewMapEntity(MapId.Nullspace);
|
||||||
|
|
||||||
playerEnt = entMgr.SpawnEntity(null, new GridCoordinates(Vector2.Zero, grid.Index));
|
playerEnt = entMgr.SpawnEntity(null, grid.ToCoordinates());
|
||||||
|
|
||||||
mind = new Mind(player.SessionId);
|
mind = new Mind(player.SessionId);
|
||||||
player.ContentData().Mind = mind;
|
player.ContentData().Mind = mind;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
|||||||
var lastSvEntity = svEntityManager.GetEntities().Last();
|
var lastSvEntity = svEntityManager.GetEntities().Last();
|
||||||
var lastClEntity = clEntityManager.GetEntity(lastSvEntity.Uid);
|
var lastClEntity = clEntityManager.GetEntity(lastSvEntity.Uid);
|
||||||
|
|
||||||
Assert.That(lastClEntity.Transform.GridPosition, Is.EqualTo(lastSvEntity.Transform.GridPosition));
|
Assert.That(lastClEntity.Transform.Coordinates, Is.EqualTo(lastSvEntity.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Shared.IoC;
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Content.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests
|
namespace Content.IntegrationTests.Tests
|
||||||
{
|
{
|
||||||
@@ -30,9 +31,9 @@ namespace Content.IntegrationTests.Tests
|
|||||||
mapMan.CreateMap(new MapId(1));
|
mapMan.CreateMap(new MapId(1));
|
||||||
var grid = mapMan.CreateGrid(new MapId(1));
|
var grid = mapMan.CreateGrid(new MapId(1));
|
||||||
|
|
||||||
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", new GridCoordinates(new Vector2(0, 0), grid.Index));
|
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", grid.ToCoordinates());
|
||||||
var consumerEnt1 = entityMan.SpawnEntity("DebugConsumer", new GridCoordinates(new Vector2(0, 1), grid.Index));
|
var consumerEnt1 = entityMan.SpawnEntity("DebugConsumer", grid.ToCoordinates(0, 1));
|
||||||
var consumerEnt2 = entityMan.SpawnEntity("DebugConsumer", new GridCoordinates(new Vector2(0, 2), grid.Index));
|
var consumerEnt2 = entityMan.SpawnEntity("DebugConsumer", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
Assert.That(generatorEnt.TryGetComponent(out supplier));
|
Assert.That(generatorEnt.TryGetComponent(out supplier));
|
||||||
Assert.That(consumerEnt1.TryGetComponent(out consumer1));
|
Assert.That(consumerEnt1.TryGetComponent(out consumer1));
|
||||||
@@ -74,9 +75,9 @@ namespace Content.IntegrationTests.Tests
|
|||||||
mapMan.CreateMap(new MapId(1));
|
mapMan.CreateMap(new MapId(1));
|
||||||
var grid = mapMan.CreateGrid(new MapId(1));
|
var grid = mapMan.CreateGrid(new MapId(1));
|
||||||
|
|
||||||
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", new GridCoordinates(new Vector2(0, 0), grid.Index));
|
var generatorEnt = entityMan.SpawnEntity("DebugGenerator", grid.ToCoordinates());
|
||||||
var substationEnt = entityMan.SpawnEntity("DebugSubstation", new GridCoordinates(new Vector2(0, 1), grid.Index));
|
var substationEnt = entityMan.SpawnEntity("DebugSubstation", grid.ToCoordinates(0, 1));
|
||||||
var apcEnt = entityMan.SpawnEntity("DebugApc", new GridCoordinates(new Vector2(0, 2), grid.Index));
|
var apcEnt = entityMan.SpawnEntity("DebugApc", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
Assert.That(generatorEnt.TryGetComponent<PowerSupplierComponent>(out var generatorSupplier));
|
Assert.That(generatorEnt.TryGetComponent<PowerSupplierComponent>(out var generatorSupplier));
|
||||||
|
|
||||||
@@ -120,9 +121,9 @@ namespace Content.IntegrationTests.Tests
|
|||||||
mapMan.CreateMap(new MapId(1));
|
mapMan.CreateMap(new MapId(1));
|
||||||
var grid = mapMan.CreateGrid(new MapId(1));
|
var grid = mapMan.CreateGrid(new MapId(1));
|
||||||
|
|
||||||
var apcEnt = entityMan.SpawnEntity("DebugApc", new GridCoordinates(new Vector2(0, 0), grid.Index));
|
var apcEnt = entityMan.SpawnEntity("DebugApc", grid.ToCoordinates(0, 0));
|
||||||
var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCable", new GridCoordinates(new Vector2(0, 1), grid.Index));
|
var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCable", grid.ToCoordinates(0, 1));
|
||||||
var powerReceiverEnt = entityMan.SpawnEntity("DebugPowerReceiver", new GridCoordinates(new Vector2(0, 2), grid.Index));
|
var powerReceiverEnt = entityMan.SpawnEntity("DebugPowerReceiver", grid.ToCoordinates(0, 2));
|
||||||
|
|
||||||
Assert.That(apcEnt.TryGetComponent<ApcComponent>(out var apc));
|
Assert.That(apcEnt.TryGetComponent<ApcComponent>(out var apc));
|
||||||
Assert.That(apcExtensionEnt.TryGetComponent<PowerProviderComponent>(out var provider));
|
Assert.That(apcExtensionEnt.TryGetComponent<PowerProviderComponent>(out var provider));
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace Content.Server.AI.Operators.Combat.Melee
|
|||||||
var meleeWeapon = hands.GetActiveHand.Owner;
|
var meleeWeapon = hands.GetActiveHand.Owner;
|
||||||
meleeWeapon.TryGetComponent(out MeleeWeaponComponent meleeWeaponComponent);
|
meleeWeapon.TryGetComponent(out MeleeWeaponComponent meleeWeaponComponent);
|
||||||
|
|
||||||
if ((_target.Transform.GridPosition.Position - _owner.Transform.GridPosition.Position).Length >
|
if ((_target.Transform.Coordinates.Position - _owner.Transform.Coordinates.Position).Length >
|
||||||
meleeWeaponComponent.Range)
|
meleeWeaponComponent.Range)
|
||||||
{
|
{
|
||||||
return Outcome.Failed;
|
return Outcome.Failed;
|
||||||
@@ -74,7 +74,7 @@ namespace Content.Server.AI.Operators.Combat.Melee
|
|||||||
|
|
||||||
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
||||||
|
|
||||||
interactionSystem.UseItemInHand(_owner, _target.Transform.GridPosition, _target.Uid);
|
interactionSystem.UseItemInHand(_owner, _target.Transform.Coordinates, _target.Uid);
|
||||||
_elapsedTime += frameTime;
|
_elapsedTime += frameTime;
|
||||||
return Outcome.Continuing;
|
return Outcome.Continuing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,14 +72,14 @@ namespace Content.Server.AI.Operators.Combat.Melee
|
|||||||
return Outcome.Failed;
|
return Outcome.Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_target.Transform.GridPosition.Position - _owner.Transform.GridPosition.Position).Length >
|
if ((_target.Transform.Coordinates.Position - _owner.Transform.Coordinates.Position).Length >
|
||||||
_unarmedCombat.Range)
|
_unarmedCombat.Range)
|
||||||
{
|
{
|
||||||
return Outcome.Failed;
|
return Outcome.Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
||||||
interactionSystem.UseItemInHand(_owner, _target.Transform.GridPosition, _target.Uid);
|
interactionSystem.UseItemInHand(_owner, _target.Transform.Coordinates, _target.Uid);
|
||||||
_elapsedTime += frameTime;
|
_elapsedTime += frameTime;
|
||||||
return Outcome.Continuing;
|
return Outcome.Continuing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Content.Server.AI.Operators.Inventory
|
|||||||
|
|
||||||
// Click on da thing
|
// Click on da thing
|
||||||
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
var interactionSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<InteractionSystem>();
|
||||||
interactionSystem.UseItemInHand(_owner, _useTarget.Transform.GridPosition, _useTarget.Uid);
|
interactionSystem.UseItemInHand(_owner, _useTarget.Transform.Coordinates, _useTarget.Uid);
|
||||||
|
|
||||||
return Outcome.Success;
|
return Outcome.Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ namespace Content.Server.AI.Operators.Movement
|
|||||||
{
|
{
|
||||||
private readonly IEntity _owner;
|
private readonly IEntity _owner;
|
||||||
private GridTargetSteeringRequest _request;
|
private GridTargetSteeringRequest _request;
|
||||||
private readonly GridCoordinates _target;
|
private readonly EntityCoordinates _target;
|
||||||
public float DesiredRange { get; set; }
|
public float DesiredRange { get; set; }
|
||||||
|
|
||||||
public MoveToGridOperator(IEntity owner, GridCoordinates target, float desiredRange = 1.5f)
|
public MoveToGridOperator(IEntity owner, EntityCoordinates target, float desiredRange = 1.5f)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
_owner = owner;
|
||||||
_target = target;
|
_target = target;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Content.Server.AI.Utility.Actions.Idle
|
|||||||
var robustRandom = IoCManager.Resolve<IRobustRandom>();
|
var robustRandom = IoCManager.Resolve<IRobustRandom>();
|
||||||
var randomGrid = FindRandomGrid(robustRandom);
|
var randomGrid = FindRandomGrid(robustRandom);
|
||||||
float waitTime;
|
float waitTime;
|
||||||
if (randomGrid != GridCoordinates.InvalidGrid)
|
if (randomGrid != EntityCoordinates.Invalid)
|
||||||
{
|
{
|
||||||
waitTime = robustRandom.Next(3, 8);
|
waitTime = robustRandom.Next(3, 8);
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ namespace Content.Server.AI.Utility.Actions.Idle
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private GridCoordinates FindRandomGrid(IRobustRandom robustRandom)
|
private EntityCoordinates FindRandomGrid(IRobustRandom robustRandom)
|
||||||
{
|
{
|
||||||
// Very inefficient (should weight each region by its node count) but better than the old system
|
// Very inefficient (should weight each region by its node count) but better than the old system
|
||||||
var reachableSystem = EntitySystem.Get<AiReachableSystem>();
|
var reachableSystem = EntitySystem.Get<AiReachableSystem>();
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace Content.Server.AI.Utility.Actions.Test
|
|||||||
|
|
||||||
public override void SetupOperators(Blackboard context)
|
public override void SetupOperators(Blackboard context)
|
||||||
{
|
{
|
||||||
var currentPosition = Owner.Transform.GridPosition;
|
var currentPosition = Owner.Transform.Coordinates;
|
||||||
var nextPosition = Owner.Transform.GridPosition.Offset(new Vector2(10.0f, 0.0f));
|
var nextPosition = Owner.Transform.Coordinates.Offset(new Vector2(10.0f, 0.0f));
|
||||||
var originalPosOp = new MoveToGridOperator(Owner, currentPosition, 0.25f);
|
var originalPosOp = new MoveToGridOperator(Owner, currentPosition, 0.25f);
|
||||||
var newPosOp = new MoveToGridOperator(Owner, nextPosition, 0.25f);
|
var newPosOp = new MoveToGridOperator(Owner, nextPosition, 0.25f);
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Considerations.Movement
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Anything further than 100 tiles gets clamped
|
// Anything further than 100 tiles gets clamped
|
||||||
return (target.Transform.GridPosition.Position - self.Transform.GridPosition.Position).Length / 100;
|
return (target.Transform.Coordinates.Position - self.Transform.Coordinates.Position).Length / 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Content.Server.AI.Utils
|
|||||||
|
|
||||||
if (owner.TryGetComponent(out AiControllerComponent controller))
|
if (owner.TryGetComponent(out AiControllerComponent controller))
|
||||||
{
|
{
|
||||||
var targetRange = (target.Transform.GridPosition.Position - owner.Transform.GridPosition.Position).Length;
|
var targetRange = (target.Transform.Coordinates.Position - owner.Transform.Coordinates.Position).Length;
|
||||||
if (targetRange > controller.VisionRadius)
|
if (targetRange > controller.VisionRadius)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -35,9 +35,9 @@ namespace Content.Server.AI.Utils
|
|||||||
range = controller.VisionRadius;
|
range = controller.VisionRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
var angle = new Angle(target.Transform.GridPosition.Position - owner.Transform.GridPosition.Position);
|
var angle = new Angle(target.Transform.Coordinates.Position - owner.Transform.Coordinates.Position);
|
||||||
var ray = new CollisionRay(
|
var ray = new CollisionRay(
|
||||||
owner.Transform.GridPosition.Position,
|
owner.Transform.Coordinates.Position,
|
||||||
angle.ToVec(),
|
angle.ToVec(),
|
||||||
(int)(CollisionGroup.Opaque | CollisionGroup.Impassable | CollisionGroup.MobImpassable));
|
(int)(CollisionGroup.Opaque | CollisionGroup.Impassable | CollisionGroup.MobImpassable));
|
||||||
|
|
||||||
@@ -47,25 +47,25 @@ namespace Content.Server.AI.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Should this be in robust or something? Fark it
|
// Should this be in robust or something? Fark it
|
||||||
public static IEnumerable<IEntity> GetNearestEntities(GridCoordinates grid, Type component, float range)
|
public static IEnumerable<IEntity> GetNearestEntities(EntityCoordinates grid, Type component, float range)
|
||||||
{
|
{
|
||||||
var inRange = GetEntitiesInRange(grid, component, range).ToList();
|
var inRange = GetEntitiesInRange(grid, component, range).ToList();
|
||||||
var sortedInRange = inRange.OrderBy(o => (o.Transform.GridPosition.Position - grid.Position).Length);
|
var sortedInRange = inRange.OrderBy(o => (o.Transform.Coordinates.Position - grid.Position).Length);
|
||||||
|
|
||||||
return sortedInRange;
|
return sortedInRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<IEntity> GetEntitiesInRange(GridCoordinates grid, Type component, float range)
|
public static IEnumerable<IEntity> GetEntitiesInRange(EntityCoordinates grid, Type component, float range)
|
||||||
{
|
{
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
foreach (var entity in entityManager.GetEntities(new TypeEntityQuery(component)))
|
foreach (var entity in entityManager.GetEntities(new TypeEntityQuery(component)))
|
||||||
{
|
{
|
||||||
if (entity.Transform.GridPosition.GridID != grid.GridID)
|
if (entity.Transform.Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((entity.Transform.GridPosition.Position - grid.Position).Length <= range)
|
if ((entity.Transform.Coordinates.Position - grid.Position).Length <= range)
|
||||||
{
|
{
|
||||||
yield return entity;
|
yield return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Content.Server.AI.WorldState.States.Clothing
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility
|
foreach (var entity in Visibility
|
||||||
.GetNearestEntities(Owner.Transform.GridPosition, typeof(ClothingComponent), controller.VisionRadius))
|
.GetNearestEntities(Owner.Transform.Coordinates, typeof(ClothingComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
if (ContainerHelpers.TryGetContainer(entity, out var container))
|
if (ContainerHelpers.TryGetContainer(entity, out var container))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.Server.AI.WorldState.States.Combat.Nearby
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility
|
foreach (var entity in Visibility
|
||||||
.GetNearestEntities(Owner.Transform.GridPosition, typeof(MeleeWeaponComponent), controller.VisionRadius))
|
.GetNearestEntities(Owner.Transform.Coordinates, typeof(MeleeWeaponComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
result.Add(entity);
|
result.Add(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Content.Server.AI.WorldState.States.Mobs
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility.GetEntitiesInRange(Owner.Transform.GridPosition, typeof(ISharedBodyManagerComponent), controller.VisionRadius))
|
foreach (var entity in Visibility.GetEntitiesInRange(Owner.Transform.Coordinates, typeof(ISharedBodyManagerComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
if (entity == Owner) continue;
|
if (entity == Owner) continue;
|
||||||
result.Add(entity);
|
result.Add(entity);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Server.AI.WorldState.States.Mobs
|
|||||||
}
|
}
|
||||||
|
|
||||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||||
var nearbyPlayers = playerManager.GetPlayersInRange(Owner.Transform.GridPosition, (int) controller.VisionRadius);
|
var nearbyPlayers = playerManager.GetPlayersInRange(Owner.Transform.Coordinates, (int) controller.VisionRadius);
|
||||||
|
|
||||||
foreach (var player in nearbyPlayers)
|
foreach (var player in nearbyPlayers)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility
|
foreach (var entity in Visibility
|
||||||
.GetNearestEntities(Owner.Transform.GridPosition, typeof(DrinkComponent), controller.VisionRadius))
|
.GetNearestEntities(Owner.Transform.Coordinates, typeof(DrinkComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
if (ContainerHelpers.TryGetContainer(entity, out var container))
|
if (ContainerHelpers.TryGetContainer(entity, out var container))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in Visibility
|
foreach (var entity in Visibility
|
||||||
.GetNearestEntities(Owner.Transform.GridPosition, typeof(FoodComponent), controller.VisionRadius))
|
.GetNearestEntities(Owner.Transform.Coordinates, typeof(FoodComponent), controller.VisionRadius))
|
||||||
{
|
{
|
||||||
if (ContainerHelpers.TryGetContainer(entity, out var container))
|
if (ContainerHelpers.TryGetContainer(entity, out var container))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,32 +60,36 @@ namespace Content.Server.Administration
|
|||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var currentMap = player.AttachedEntity.Transform.MapID;
|
var currentMap = player.AttachedEntity.Transform.MapID;
|
||||||
var currentGrid = player.AttachedEntity.Transform.GridID;
|
var currentGrid = player.AttachedEntity.Transform.GridID;
|
||||||
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
var found = comp.EntityQuery<WarpPointComponent>()
|
var found = comp.EntityQuery<WarpPointComponent>()
|
||||||
.Where(p => p.Location == location)
|
.Where(p => p.Location == location)
|
||||||
.Select(p => p.Owner.Transform.GridPosition)
|
.Select(p => p.Owner.Transform.Coordinates)
|
||||||
.OrderBy(p => p, Comparer<GridCoordinates>.Create((a, b) =>
|
.OrderBy(p => p, Comparer<EntityCoordinates>.Create((a, b) =>
|
||||||
{
|
{
|
||||||
// Sort so that warp points on the same grid/map are first.
|
// Sort so that warp points on the same grid/map are first.
|
||||||
// So if you have two maps loaded with the same warp points,
|
// So if you have two maps loaded with the same warp points,
|
||||||
// it will prefer the warp points on the map you're currently on.
|
// it will prefer the warp points on the map you're currently on.
|
||||||
if (a.GridID == b.GridID)
|
var aGrid = a.GetGridId(entityManager);
|
||||||
|
var bGrid = b.GetGridId(entityManager);
|
||||||
|
|
||||||
|
if (aGrid == bGrid)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.GridID == currentGrid)
|
if (aGrid == currentGrid)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b.GridID == currentGrid)
|
if (bGrid == currentGrid)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapA = mapManager.GetGrid(a.GridID).ParentMapId;
|
var mapA = mapManager.GetGrid(aGrid).ParentMapId;
|
||||||
var mapB = mapManager.GetGrid(b.GridID).ParentMapId;
|
var mapB = mapManager.GetGrid(bGrid).ParentMapId;
|
||||||
|
|
||||||
if (mapA == mapB)
|
if (mapA == mapB)
|
||||||
{
|
{
|
||||||
@@ -106,9 +110,9 @@ namespace Content.Server.Administration
|
|||||||
}))
|
}))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (found.GridID != GridId.Invalid)
|
if (found.GetGridId(entityManager) != GridId.Invalid)
|
||||||
{
|
{
|
||||||
player.AttachedEntity.Transform.GridPosition = found;
|
player.AttachedEntity.Transform.Coordinates = found;
|
||||||
if (player.AttachedEntity.TryGetComponent(out ICollidableComponent collidable))
|
if (player.AttachedEntity.TryGetComponent(out ICollidableComponent collidable))
|
||||||
{
|
{
|
||||||
collidable.Stop();
|
collidable.Stop();
|
||||||
|
|||||||
@@ -2,31 +2,35 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Server.Atmos
|
namespace Content.Server.Atmos
|
||||||
{
|
{
|
||||||
public static class AtmosHelpers
|
public static class AtmosHelpers
|
||||||
{
|
{
|
||||||
public static TileAtmosphere? GetTileAtmosphere(this GridCoordinates coordinates)
|
public static TileAtmosphere? GetTileAtmosphere(this EntityCoordinates coordinates, IEntityManager? entityManager = null)
|
||||||
{
|
{
|
||||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates.GridID);
|
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
|
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates.GetGridId(entityManager));
|
||||||
|
|
||||||
return gridAtmos?.GetTile(coordinates);
|
return gridAtmos?.GetTile(coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GasMixture? GetTileAir(this GridCoordinates coordinates)
|
public static GasMixture? GetTileAir(this EntityCoordinates coordinates)
|
||||||
{
|
{
|
||||||
return coordinates.GetTileAtmosphere()?.Air;
|
return coordinates.GetTileAtmosphere()?.Air;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TryGetTileAtmosphere(this GridCoordinates coordinates, [MaybeNullWhen(false)] out TileAtmosphere atmosphere)
|
public static bool TryGetTileAtmosphere(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out TileAtmosphere atmosphere)
|
||||||
{
|
{
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
return !Equals(atmosphere = coordinates.GetTileAtmosphere()!, default);
|
return !Equals(atmosphere = coordinates.GetTileAtmosphere()!, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TryGetTileAir(this GridCoordinates coordinates, [MaybeNullWhen(false)] out GasMixture air)
|
public static bool TryGetTileAir(this EntityCoordinates coordinates, [MaybeNullWhen(false)] out GasMixture air)
|
||||||
{
|
{
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||||
return !Equals(air = coordinates.GetTileAir()!, default);
|
return !Equals(air = coordinates.GetTileAir()!, default);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Content.Server.Atmos
|
|||||||
{
|
{
|
||||||
tank.TryRemoveReagent(_fuelType, ReagentUnit.New(_fuelCost));
|
tank.TryRemoveReagent(_fuelType, ReagentUnit.New(_fuelCost));
|
||||||
|
|
||||||
var playerPos = eventArgs.User.Transform.GridPosition;
|
var playerPos = eventArgs.User.Transform.Coordinates;
|
||||||
var direction = (eventArgs.ClickLocation.Position - playerPos.Position).Normalized;
|
var direction = (eventArgs.ClickLocation.Position - playerPos.Position).Normalized;
|
||||||
playerPos.Offset(direction/2);
|
playerPos.Offset(direction/2);
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ using Robust.Shared.IoC;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using Content.Server.GameObjects.Components.Atmos;
|
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Server.Atmos
|
namespace Content.Server.Atmos
|
||||||
{
|
{
|
||||||
@@ -18,6 +18,8 @@ namespace Content.Server.Atmos
|
|||||||
class GasVaporComponent : Component, ICollideBehavior, IGasMixtureHolder
|
class GasVaporComponent : Component, ICollideBehavior, IGasMixtureHolder
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
public override string Name => "GasVapor";
|
public override string Name => "GasVapor";
|
||||||
|
|
||||||
[ViewVariables] public GasMixture Air { get; set; }
|
[ViewVariables] public GasMixture Air { get; set; }
|
||||||
@@ -76,10 +78,10 @@ namespace Content.Server.Atmos
|
|||||||
|
|
||||||
foreach (var tile in tiles)
|
foreach (var tile in tiles)
|
||||||
{
|
{
|
||||||
var pos = tile.GridIndices.ToGridCoordinates(_mapManager, tile.GridIndex);
|
var pos = tile.GridIndices.ToEntityCoordinates(_mapManager, tile.GridIndex);
|
||||||
var atmos = AtmosHelpers.GetTileAtmosphere(pos);
|
var atmos = pos.GetTileAtmosphere(_entityManager);
|
||||||
|
|
||||||
if (atmos.Air == null)
|
if (atmos?.Air == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Content.Server.Atmos
|
|||||||
private const float ThrowForce = 100f;
|
private const float ThrowForce = 100f;
|
||||||
|
|
||||||
public void ExperiencePressureDifference(int cycle, float pressureDifference, AtmosDirection direction,
|
public void ExperiencePressureDifference(int cycle, float pressureDifference, AtmosDirection direction,
|
||||||
float pressureResistanceProbDelta, GridCoordinates throwTarget)
|
float pressureResistanceProbDelta, EntityCoordinates throwTarget)
|
||||||
{
|
{
|
||||||
if (ControlledComponent == null)
|
if (ControlledComponent == null)
|
||||||
return;
|
return;
|
||||||
@@ -52,10 +52,10 @@ namespace Content.Server.Atmos
|
|||||||
|
|
||||||
if (maxForce > ThrowForce)
|
if (maxForce > ThrowForce)
|
||||||
{
|
{
|
||||||
if (throwTarget != GridCoordinates.InvalidGrid)
|
if (throwTarget != EntityCoordinates.Invalid)
|
||||||
{
|
{
|
||||||
var moveForce = maxForce * MathHelper.Clamp(moveProb, 0, 100) / 150f;
|
var moveForce = maxForce * MathHelper.Clamp(moveProb, 0, 100) / 150f;
|
||||||
var pos = ((throwTarget.Position - transform.GridPosition.Position).Normalized + direction.ToDirection().ToVec()).Normalized;
|
var pos = ((throwTarget.Position - transform.Coordinates.Position).Normalized + direction.ToDirection().ToVec()).Normalized;
|
||||||
LinearVelocity = pos * moveForce;
|
LinearVelocity = pos * moveForce;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ namespace Content.Server.Atmos
|
|||||||
{
|
{
|
||||||
base.UpdateAfterProcessing();
|
base.UpdateAfterProcessing();
|
||||||
|
|
||||||
if (ControlledComponent != null && !_physicsManager.IsWeightless(ControlledComponent.Owner.Transform.GridPosition))
|
if (ControlledComponent != null && !_physicsManager.IsWeightless(ControlledComponent.Owner.Transform.Coordinates))
|
||||||
{
|
{
|
||||||
LinearVelocity *= 0.85f;
|
LinearVelocity *= 0.85f;
|
||||||
if (MathF.Abs(LinearVelocity.Length) < 1f)
|
if (MathF.Abs(LinearVelocity.Length) < 1f)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace Content.Server.Atmos
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="coordinates"></param>
|
/// <param name="coordinates"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
TileAtmosphere GetTile(GridCoordinates coordinates, bool createSpace = true);
|
TileAtmosphere GetTile(EntityCoordinates coordinates, bool createSpace = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns if the tile in question is air-blocked.
|
/// Returns if the tile in question is air-blocked.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Server.Interfaces;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.GameObjects.EntitySystems.TileLookup;
|
using Robust.Server.GameObjects.EntitySystems.TileLookup;
|
||||||
@@ -188,7 +189,7 @@ namespace Content.Server.Atmos
|
|||||||
{
|
{
|
||||||
if(_soundCooldown == 0)
|
if(_soundCooldown == 0)
|
||||||
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Effects/space_wind.ogg",
|
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Effects/space_wind.ogg",
|
||||||
GridIndices.ToGridCoordinates(_mapManager, GridIndex), AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(PressureDifference / 10, 10, 100)));
|
GridIndices.ToEntityCoordinates(_mapManager, GridIndex), AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(PressureDifference / 10, 10, 100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in _gridTileLookupSystem.GetEntitiesIntersecting(GridIndex, GridIndices))
|
foreach (var entity in _gridTileLookupSystem.GetEntitiesIntersecting(GridIndex, GridIndices))
|
||||||
@@ -203,7 +204,7 @@ namespace Content.Server.Atmos
|
|||||||
var pressureMovements = physics.EnsureController<HighPressureMovementController>();
|
var pressureMovements = physics.EnsureController<HighPressureMovementController>();
|
||||||
if (pressure.LastHighPressureMovementAirCycle < _gridAtmosphereComponent.UpdateCounter)
|
if (pressure.LastHighPressureMovementAirCycle < _gridAtmosphereComponent.UpdateCounter)
|
||||||
{
|
{
|
||||||
pressureMovements.ExperiencePressureDifference(_gridAtmosphereComponent.UpdateCounter, PressureDifference, _pressureDirection, 0, PressureSpecificTarget?.GridIndices.ToGridCoordinates(_mapManager, GridIndex) ?? GridCoordinates.InvalidGrid);
|
pressureMovements.ExperiencePressureDifference(_gridAtmosphereComponent.UpdateCounter, PressureDifference, _pressureDirection, 0, PressureSpecificTarget?.GridIndices.ToEntityCoordinates(_mapManager, GridIndex) ?? EntityCoordinates.Invalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ namespace Content.Server.Body
|
|||||||
SizeUsed -= mechanismTarget.Size;
|
SizeUsed -= mechanismTarget.Size;
|
||||||
|
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var position = dropLocation.Transform.GridPosition;
|
var position = dropLocation.Transform.Coordinates;
|
||||||
var mechanismEntity = entityManager.SpawnEntity("BaseDroppedMechanism", position);
|
var mechanismEntity = entityManager.SpawnEntity("BaseDroppedMechanism", position);
|
||||||
|
|
||||||
dropped = mechanismEntity.GetComponent<DroppedMechanismComponent>();
|
dropped = mechanismEntity.GetComponent<DroppedMechanismComponent>();
|
||||||
@@ -524,7 +524,7 @@ namespace Content.Server.Body
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dropped = IoCManager.Resolve<IEntityManager>().SpawnEntity("BaseDroppedBodyPart", Body.Owner.Transform.GridPosition);
|
dropped = IoCManager.Resolve<IEntityManager>().SpawnEntity("BaseDroppedBodyPart", Body.Owner.Transform.Coordinates);
|
||||||
|
|
||||||
dropped.GetComponent<DroppedBodyPartComponent>().TransferBodyPartData(this);
|
dropped.GetComponent<DroppedBodyPartComponent>().TransferBodyPartData(this);
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace Content.Server.Chat
|
|||||||
// Ensure the first letter inside the message string is always a capital letter
|
// Ensure the first letter inside the message string is always a capital letter
|
||||||
message = message[0].ToString().ToUpper() + message.Remove(0,1);
|
message = message[0].ToString().ToUpper() + message.Remove(0,1);
|
||||||
|
|
||||||
var pos = source.Transform.GridPosition;
|
var pos = source.Transform.Coordinates;
|
||||||
var clients = _playerManager.GetPlayersInRange(pos, VoiceRange).Select(p => p.ConnectedClient);
|
var clients = _playerManager.GetPlayersInRange(pos, VoiceRange).Select(p => p.ConnectedClient);
|
||||||
|
|
||||||
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
|
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
|
||||||
@@ -144,7 +144,7 @@ namespace Content.Server.Chat
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = source.Transform.GridPosition;
|
var pos = source.Transform.Coordinates;
|
||||||
var clients = _playerManager.GetPlayersInRange(pos, VoiceRange).Select(p => p.ConnectedClient);
|
var clients = _playerManager.GetPlayersInRange(pos, VoiceRange).Select(p => p.ConnectedClient);
|
||||||
|
|
||||||
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
|
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
int finalHeavyImpactRange = (int)MathF.Round(_heavyImpactRange * floatIntensity);
|
int finalHeavyImpactRange = (int)MathF.Round(_heavyImpactRange * floatIntensity);
|
||||||
int finalLightImpactRange = (int)MathF.Round(_lightImpactRange * floatIntensity);
|
int finalLightImpactRange = (int)MathF.Round(_lightImpactRange * floatIntensity);
|
||||||
int finalFlashRange = (int)MathF.Round(_flashRange * floatIntensity);
|
int finalFlashRange = (int)MathF.Round(_flashRange * floatIntensity);
|
||||||
ExplosionHelper.SpawnExplosion(solutionEntity.Transform.GridPosition, finalDevastationRange,
|
ExplosionHelper.SpawnExplosion(solutionEntity.Transform.Coordinates, finalDevastationRange,
|
||||||
finalHeavyImpactRange, finalLightImpactRange, finalFlashRange);
|
finalHeavyImpactRange, finalLightImpactRange, finalFlashRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,14 @@ namespace Content.Server.Explosions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static Vector2 _epicenterDistance = (0.1f, 0.1f);
|
private static Vector2 _epicenterDistance = (0.1f, 0.1f);
|
||||||
|
|
||||||
public static void SpawnExplosion(GridCoordinates coords, int devastationRange, int heavyImpactRange, int lightImpactRange, int flashRange)
|
public static void SpawnExplosion(EntityCoordinates coords, int devastationRange, int heavyImpactRange, int lightImpactRange, int flashRange)
|
||||||
{
|
{
|
||||||
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||||
var serverEntityManager = IoCManager.Resolve<IServerEntityManager>();
|
var serverEntityManager = IoCManager.Resolve<IServerEntityManager>();
|
||||||
var entitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
var entitySystemManager = IoCManager.Resolve<IEntitySystemManager>();
|
||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var robustRandom = IoCManager.Resolve<IRobustRandom>();
|
var robustRandom = IoCManager.Resolve<IRobustRandom>();
|
||||||
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
var maxRange = MathHelper.Max(devastationRange, heavyImpactRange, lightImpactRange, 0f);
|
var maxRange = MathHelper.Max(devastationRange, heavyImpactRange, lightImpactRange, 0f);
|
||||||
//Entity damage calculation
|
//Entity damage calculation
|
||||||
@@ -45,17 +46,21 @@ namespace Content.Server.Explosions
|
|||||||
if (!entity.Transform.IsMapTransform)
|
if (!entity.Transform.IsMapTransform)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var distanceFromEntity = (int)entity.Transform.GridPosition.Distance(mapManager, coords);
|
if (!entity.Transform.Coordinates.TryDistance(entityManager, coords, out var distance))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ExplosionSeverity severity;
|
ExplosionSeverity severity;
|
||||||
if (distanceFromEntity < devastationRange)
|
if (distance < devastationRange)
|
||||||
{
|
{
|
||||||
severity = ExplosionSeverity.Destruction;
|
severity = ExplosionSeverity.Destruction;
|
||||||
}
|
}
|
||||||
else if (distanceFromEntity < heavyImpactRange)
|
else if (distance < heavyImpactRange)
|
||||||
{
|
{
|
||||||
severity = ExplosionSeverity.Heavy;
|
severity = ExplosionSeverity.Heavy;
|
||||||
}
|
}
|
||||||
else if (distanceFromEntity < lightImpactRange)
|
else if (distance < lightImpactRange)
|
||||||
{
|
{
|
||||||
severity = ExplosionSeverity.Light;
|
severity = ExplosionSeverity.Light;
|
||||||
}
|
}
|
||||||
@@ -70,7 +75,7 @@ namespace Content.Server.Explosions
|
|||||||
|
|
||||||
//Tile damage calculation mockup
|
//Tile damage calculation mockup
|
||||||
//TODO: make it into some sort of actual damage component or whatever the boys think is appropriate
|
//TODO: make it into some sort of actual damage component or whatever the boys think is appropriate
|
||||||
var mapGrid = mapManager.GetGrid(coords.GridID);
|
var mapGrid = mapManager.GetGrid(coords.GetGridId(entityManager));
|
||||||
var circle = new Circle(coords.Position, maxRange);
|
var circle = new Circle(coords.Position, maxRange);
|
||||||
var tiles = mapGrid.GetTilesIntersecting(circle);
|
var tiles = mapGrid.GetTilesIntersecting(circle);
|
||||||
foreach (var tile in tiles)
|
foreach (var tile in tiles)
|
||||||
@@ -82,12 +87,16 @@ namespace Content.Server.Explosions
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var distanceFromTile = (int) tileLoc.Distance(mapManager, coords);
|
|
||||||
|
if (!tileLoc.TryDistance(entityManager, coords, out var distance))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var zeroTile = new Tile(tileDefinitionManager[baseTurfs[0]].TileId);
|
var zeroTile = new Tile(tileDefinitionManager[baseTurfs[0]].TileId);
|
||||||
var previousTile = new Tile(tileDefinitionManager[baseTurfs[^1]].TileId);
|
var previousTile = new Tile(tileDefinitionManager[baseTurfs[^1]].TileId);
|
||||||
|
|
||||||
switch (distanceFromTile)
|
switch (distance)
|
||||||
{
|
{
|
||||||
case var d when d < devastationRange:
|
case var d when d < devastationRange:
|
||||||
mapGrid.SetTile(tileLoc, zeroTile);
|
mapGrid.SetTile(tileLoc, zeroTile);
|
||||||
@@ -137,7 +146,7 @@ namespace Content.Server.Explosions
|
|||||||
}
|
}
|
||||||
|
|
||||||
var playerPos = player.AttachedEntity.Transform.WorldPosition;
|
var playerPos = player.AttachedEntity.Transform.WorldPosition;
|
||||||
var delta = coords.ToMapPos(mapManager) - playerPos;
|
var delta = coords.ToMapPos(entityManager) - playerPos;
|
||||||
//Change if zero. Will result in a NaN later breaking camera shake if not changed
|
//Change if zero. Will result in a NaN later breaking camera shake if not changed
|
||||||
if (delta.EqualsApprox((0.0f, 0.0f)))
|
if (delta.EqualsApprox((0.0f, 0.0f)))
|
||||||
delta = _epicenterDistance;
|
delta = _epicenterDistance;
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ namespace Content.Server.GameObjects.Components.ActionBlocking
|
|||||||
|
|
||||||
var entity = _container.ContainedEntities[_container.ContainedEntities.Count - 1];
|
var entity = _container.ContainedEntities[_container.ContainedEntities.Count - 1];
|
||||||
_container.Remove(entity);
|
_container.Remove(entity);
|
||||||
entity.Transform.WorldPosition = Owner.Transform.GridPosition.Position;
|
entity.Transform.WorldPosition = Owner.Transform.Coordinates.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirty)
|
if (dirty)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Robust.Server.Interfaces.GameObjects;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components.Transform;
|
using Robust.Shared.GameObjects.Components.Transform;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
@@ -17,6 +18,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
public class AirtightComponent : Component, IMapInit
|
public class AirtightComponent : Component, IMapInit
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
private (GridId, MapIndices) _lastPosition;
|
private (GridId, MapIndices) _lastPosition;
|
||||||
|
|
||||||
@@ -89,7 +91,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
if (_fixVacuum)
|
if (_fixVacuum)
|
||||||
{
|
{
|
||||||
var mapIndices = Owner.Transform.GridPosition.ToMapIndices(_mapManager);
|
var mapIndices = Owner.Transform.Coordinates.ToMapIndices(_entityManager, _mapManager);
|
||||||
EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID)?.FixVacuum(mapIndices);
|
EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID)?.FixVacuum(mapIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +111,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
private void UpdatePosition()
|
private void UpdatePosition()
|
||||||
{
|
{
|
||||||
var mapIndices = Owner.Transform.GridPosition.ToMapIndices(_mapManager);
|
var mapIndices = Owner.Transform.Coordinates.ToMapIndices(_entityManager, _mapManager);
|
||||||
UpdatePosition(Owner.Transform.GridID, mapIndices);
|
UpdatePosition(Owner.Transform.GridID, mapIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Damage;
|
|||||||
using Content.Shared.GameObjects.Components.Mobs;
|
using Content.Shared.GameObjects.Components.Mobs;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Atmos
|
namespace Content.Server.GameObjects.Components.Atmos
|
||||||
{
|
{
|
||||||
@@ -18,6 +19,8 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class BarotraumaComponent : Component
|
public class BarotraumaComponent : Component
|
||||||
{
|
{
|
||||||
|
[Robust.Shared.IoC.Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
public override string Name => "Barotrauma";
|
public override string Name => "Barotrauma";
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -26,8 +29,8 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
if (!Owner.TryGetComponent(out IDamageableComponent damageable)) return;
|
if (!Owner.TryGetComponent(out IDamageableComponent damageable)) return;
|
||||||
Owner.TryGetComponent(out ServerStatusEffectsComponent status);
|
Owner.TryGetComponent(out ServerStatusEffectsComponent status);
|
||||||
|
|
||||||
var coordinates = Owner.Transform.GridPosition;
|
var coordinates = Owner.Transform.Coordinates;
|
||||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates.GridID);
|
var gridAtmos = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(coordinates.GetGridId(_entityManager));
|
||||||
var tile = gridAtmos?.GetTile(coordinates);
|
var tile = gridAtmos?.GetTile(coordinates);
|
||||||
|
|
||||||
var pressure = 1f;
|
var pressure = 1f;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Robust.Server.Interfaces.GameObjects;
|
|||||||
using Robust.Server.Interfaces.Player;
|
using Robust.Server.Interfaces.Player;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
@@ -25,12 +26,13 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse
|
public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
private GasAnalyzerDanger _pressureDanger;
|
private GasAnalyzerDanger _pressureDanger;
|
||||||
private float _timeSinceSync;
|
private float _timeSinceSync;
|
||||||
private const float TimeBetweenSyncs = 2f;
|
private const float TimeBetweenSyncs = 2f;
|
||||||
private bool _checkPlayer = false; // Check at the player pos or at some other tile?
|
private bool _checkPlayer = false; // Check at the player pos or at some other tile?
|
||||||
private GridCoordinates? _position; // The tile that we scanned
|
private EntityCoordinates? _position; // The tile that we scanned
|
||||||
|
|
||||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GasAnalyzerUiKey.Key);
|
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GasAnalyzerUiKey.Key);
|
||||||
|
|
||||||
@@ -69,7 +71,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="session">The session to open the ui for</param>
|
/// <param name="session">The session to open the ui for</param>
|
||||||
/// <param name="pos">The position to analyze the gas</param>
|
/// <param name="pos">The position to analyze the gas</param>
|
||||||
public void OpenInterface(IPlayerSession session, GridCoordinates pos)
|
public void OpenInterface(IPlayerSession session, EntityCoordinates pos)
|
||||||
{
|
{
|
||||||
_checkPlayer = false;
|
_checkPlayer = false;
|
||||||
_position = pos;
|
_position = pos;
|
||||||
@@ -100,7 +102,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
// Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth
|
// Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth
|
||||||
var pressure = 0f;
|
var pressure = 0f;
|
||||||
var gam = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID);
|
var gam = EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID);
|
||||||
var tile = gam?.GetTile(Owner.Transform.GridPosition).Air;
|
var tile = gam?.GetTile(Owner.Transform.Coordinates).Air;
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
pressure = tile.Pressure;
|
pressure = tile.Pressure;
|
||||||
@@ -148,18 +150,18 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = Owner.Transform.GridPosition;
|
var pos = Owner.Transform.Coordinates;
|
||||||
if (!_checkPlayer && _position.HasValue)
|
if (!_checkPlayer && _position.HasValue)
|
||||||
{
|
{
|
||||||
// Check if position is out of range => don't update
|
// Check if position is out of range => don't update
|
||||||
if (!_position.Value.InRange(_mapManager, pos, SharedInteractionSystem.InteractionRange))
|
if (!_position.Value.InRange(_entityManager, pos, SharedInteractionSystem.InteractionRange))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pos = _position.Value;
|
pos = _position.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
var gam = atmosSystem.GetGridAtmosphere(pos.GridID);
|
var gam = atmosSystem.GetGridAtmosphere(pos.GetGridId(_entityManager));
|
||||||
var tile = gam?.GetTile(pos).Air;
|
var tile = gam?.GetTile(pos).Air;
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -374,9 +374,9 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public TileAtmosphere? GetTile(GridCoordinates coordinates, bool createSpace = true)
|
public TileAtmosphere? GetTile(EntityCoordinates coordinates, bool createSpace = true)
|
||||||
{
|
{
|
||||||
return GetTile(coordinates.ToMapIndices(_mapManager), createSpace);
|
return GetTile(coordinates.ToMapIndices(_serverEntityManager, _mapManager), createSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ using Robust.Shared.GameObjects.Systems;
|
|||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
@@ -14,6 +16,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseSiphonComponent : PipeNetDeviceComponent
|
public abstract class BaseSiphonComponent : PipeNetDeviceComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private PipeNode _scrubberOutlet;
|
private PipeNode _scrubberOutlet;
|
||||||
|
|
||||||
@@ -40,11 +44,11 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
var tileAtmos = AtmosHelpers.GetTileAtmosphere(Owner.Transform.GridPosition);
|
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
|
||||||
if (tileAtmos == null)
|
if (tileAtmos == null)
|
||||||
return;
|
return;
|
||||||
ScrubGas(tileAtmos.Air, _scrubberOutlet.Air);
|
ScrubGas(tileAtmos.Air, _scrubberOutlet.Air);
|
||||||
_atmosSystem.GetGridAtmosphere(Owner.Transform.GridID).Invalidate(tileAtmos.GridIndices);
|
_atmosSystem.GetGridAtmosphere(Owner.Transform.GridID)?.Invalidate(tileAtmos.GridIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void ScrubGas(GasMixture inletGas, GasMixture outletGas);
|
protected abstract void ScrubGas(GasMixture inletGas, GasMixture outletGas);
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ using Robust.Shared.GameObjects.Systems;
|
|||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
@@ -14,13 +16,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseVentComponent : PipeNetDeviceComponent
|
public abstract class BaseVentComponent : PipeNetDeviceComponent
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private PipeNode _ventInlet;
|
private PipeNode _ventInlet;
|
||||||
|
|
||||||
private AtmosphereSystem _atmosSystem;
|
private AtmosphereSystem _atmosSystem;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -42,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
|||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
var tileAtmos = AtmosHelpers.GetTileAtmosphere(Owner.Transform.GridPosition);
|
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
|
||||||
if (tileAtmos == null)
|
if (tileAtmos == null)
|
||||||
return;
|
return;
|
||||||
VentGas(_ventInlet.Air, tileAtmos.Air);
|
VentGas(_ventInlet.Air, tileAtmos.Air);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace Content.Server.GameObjects.Components.Body.Respiratory
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Owner.Transform.GridPosition.TryGetTileAir(out var tileAir))
|
if (!Owner.Transform.Coordinates.TryGetTileAir(out var tileAir))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ namespace Content.Server.GameObjects.Components.Body.Respiratory
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Owner.Transform.GridPosition.TryGetTileAir(out var tileAir))
|
if (!Owner.Transform.Coordinates.TryGetTileAir(out var tileAir))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,9 +426,9 @@ namespace Content.Server.GameObjects.Components.Buckle
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bucklePosition = BuckledTo.Owner.Transform.GridPosition.Offset(BuckleOffset.Value);
|
var bucklePosition = BuckledTo.Owner.Transform.Coordinates.Offset(BuckleOffset.Value);
|
||||||
|
|
||||||
if (moveEvent.NewPosition.InRange(_mapManager, bucklePosition, 0.2f))
|
if (moveEvent.NewPosition.InRange(_entityManager, bucklePosition, 0.2f))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ namespace Content.Server.GameObjects.Components.Cargo
|
|||||||
continue;
|
continue;
|
||||||
for (var i = 0; i < order.Amount; i++)
|
for (var i = 0; i < order.Amount; i++)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.SpawnEntity(product.Product, Owner.Transform.GridPosition);
|
Owner.EntityManager.SpawnEntity(product.Product, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
var actualVolume = ReagentUnit.Min(individualVolume, ReagentUnit.New(30));
|
var actualVolume = ReagentUnit.Min(individualVolume, ReagentUnit.New(30));
|
||||||
for (int i = 0; i < bottleAmount; i++)
|
for (int i = 0; i < bottleAmount; i++)
|
||||||
{
|
{
|
||||||
var bottle = Owner.EntityManager.SpawnEntity("bottle", Owner.Transform.GridPosition);
|
var bottle = Owner.EntityManager.SpawnEntity("bottle", Owner.Transform.Coordinates);
|
||||||
|
|
||||||
var bufferSolution = BufferSolution.Solution.SplitSolution(actualVolume);
|
var bufferSolution = BufferSolution.Solution.SplitSolution(actualVolume);
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Put it on the floor
|
//Put it on the floor
|
||||||
bottle.Transform.GridPosition = user.Transform.GridPosition;
|
bottle.Transform.Coordinates = user.Transform.Coordinates;
|
||||||
//Give it an offset
|
//Give it an offset
|
||||||
bottle.RandomOffset(0.2f);
|
bottle.RandomOffset(0.2f);
|
||||||
}
|
}
|
||||||
@@ -313,7 +313,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
var actualVolume = ReagentUnit.Min(individualVolume, ReagentUnit.New(50));
|
var actualVolume = ReagentUnit.Min(individualVolume, ReagentUnit.New(50));
|
||||||
for (int i = 0; i < pillAmount; i++)
|
for (int i = 0; i < pillAmount; i++)
|
||||||
{
|
{
|
||||||
var pill = Owner.EntityManager.SpawnEntity("pill", Owner.Transform.GridPosition);
|
var pill = Owner.EntityManager.SpawnEntity("pill", Owner.Transform.Coordinates);
|
||||||
|
|
||||||
var bufferSolution = BufferSolution.Solution.SplitSolution(actualVolume);
|
var bufferSolution = BufferSolution.Solution.SplitSolution(actualVolume);
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Put it on the floor
|
//Put it on the floor
|
||||||
pill.Transform.GridPosition = user.Transform.GridPosition;
|
pill.Transform.Coordinates = user.Transform.Coordinates;
|
||||||
//Give it an offset
|
//Give it an offset
|
||||||
pill.RandomOffset(0.2f);
|
pill.RandomOffset(0.2f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Play reaction sound client-side
|
//Play reaction sound client-side
|
||||||
_audioSystem.PlayAtCoords("/Audio/Effects/Chemistry/bubbles.ogg", Owner.Transform.GridPosition);
|
_audioSystem.PlayAtCoords("/Audio/Effects/Chemistry/bubbles.ogg", Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
var amount = _transferAmount / ReagentUnit.New(tiles.Count());
|
var amount = _transferAmount / ReagentUnit.New(tiles.Count());
|
||||||
foreach (var tile in tiles)
|
foreach (var tile in tiles)
|
||||||
{
|
{
|
||||||
var pos = tile.GridIndices.ToGridCoordinates(_mapManager, tile.GridIndex);
|
var pos = tile.GridIndices.ToEntityCoordinates(_mapManager, tile.GridIndex);
|
||||||
contents.SplitSolution(amount).SpillAt(pos, "PuddleSmear", false); // TODO: Make non PuddleSmear?
|
contents.SplitSolution(amount).SpillAt(pos, "PuddleSmear", false); // TODO: Make non PuddleSmear?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace Content.Server.GameObjects.Components.Damage
|
|||||||
_actSystem.HandleBreakage(Owner);
|
_actSystem.HandleBreakage(Owner);
|
||||||
if (!Owner.Deleted && DestroySound != string.Empty)
|
if (!Owner.Deleted && DestroySound != string.Empty)
|
||||||
{
|
{
|
||||||
var pos = Owner.Transform.GridPosition;
|
var pos = Owner.Transform.Coordinates;
|
||||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(DestroySound, pos);
|
EntitySystem.Get<AudioSystem>().PlayAtCoords(DestroySound, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.Components.Damage
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(SpawnOnDestroy) && eventArgs.IsSpawnWreck)
|
if (!string.IsNullOrWhiteSpace(SpawnOnDestroy) && eventArgs.IsSpawnWreck)
|
||||||
{
|
{
|
||||||
Owner.EntityManager.SpawnEntity(SpawnOnDestroy, Owner.Transform.GridPosition);
|
Owner.EntityManager.SpawnEntity(SpawnOnDestroy, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ namespace Content.Server.GameObjects.Components.Damage
|
|||||||
{
|
{
|
||||||
if (!Owner.Deleted)
|
if (!Owner.Deleted)
|
||||||
{
|
{
|
||||||
var pos = Owner.Transform.GridPosition;
|
var pos = Owner.Transform.Coordinates;
|
||||||
ActSystem.HandleDestruction(Owner,
|
ActSystem.HandleDestruction(Owner,
|
||||||
true); //This will call IDestroyAct.OnDestroy on this component (and all other components on this entity)
|
true); //This will call IDestroyAct.OnDestroy on this component (and all other components on this entity)
|
||||||
if (DestroySound != string.Empty)
|
if (DestroySound != string.Empty)
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Content.Server.GameObjects.Components.Damage
|
|||||||
|
|
||||||
if (!Owner.Deleted && DestroySound != string.Empty)
|
if (!Owner.Deleted && DestroySound != string.Empty)
|
||||||
{
|
{
|
||||||
var pos = Owner.Transform.GridPosition;
|
var pos = Owner.Transform.Coordinates;
|
||||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(DestroySound, pos);
|
EntitySystem.Get<AudioSystem>().PlayAtCoords(DestroySound, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
PreviousTube = CurrentTube;
|
PreviousTube = CurrentTube;
|
||||||
}
|
}
|
||||||
|
|
||||||
Owner.Transform.GridPosition = tube.Owner.Transform.GridPosition;
|
Owner.Transform.Coordinates = tube.Owner.Transform.Coordinates;
|
||||||
CurrentTube = tube;
|
CurrentTube = tube;
|
||||||
NextTube = tube.NextTube(this);
|
NextTube = tube.NextTube(this);
|
||||||
StartingTime = 0.1f;
|
StartingTime = 0.1f;
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
|||||||
}
|
}
|
||||||
|
|
||||||
_lastClang = _gameTiming.CurTime;
|
_lastClang = _gameTiming.CurTime;
|
||||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(_clangSound, Owner.Transform.GridPosition);
|
EntitySystem.Get<AudioSystem>().PlayAtCoords(_clangSound, Owner.Transform.Coordinates);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.Server.GameObjects.Components.Explosion
|
|||||||
if (_beingExploded) return true;
|
if (_beingExploded) return true;
|
||||||
_beingExploded = true;
|
_beingExploded = true;
|
||||||
|
|
||||||
ExplosionHelper.SpawnExplosion(Owner.Transform.GridPosition, DevastationRange, HeavyImpactRange, LightImpactRange, FlashRange);
|
ExplosionHelper.SpawnExplosion(Owner.Transform.Coordinates, DevastationRange, HeavyImpactRange, LightImpactRange, FlashRange);
|
||||||
|
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Explosion
|
|||||||
|
|
||||||
if (_sound != null)
|
if (_sound != null)
|
||||||
{
|
{
|
||||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(_sound, Owner.Transform.GridPosition);
|
EntitySystem.Get<AudioSystem>().PlayAtCoords(_sound, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_deleteOnFlash && !Owner.Deleted)
|
if (_deleteOnFlash && !Owner.Deleted)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
}
|
}
|
||||||
else if (ItemContainer.Remove(ItemContainer.ContainedEntity))
|
else if (ItemContainer.Remove(ItemContainer.ContainedEntity))
|
||||||
{
|
{
|
||||||
ItemContainer.ContainedEntity.Transform.GridPosition = Owner.Transform.GridPosition;
|
ItemContainer.ContainedEntity.Transform.Coordinates = Owner.Transform.Coordinates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Server.GameObjects.Components
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
ItemContainer.Insert(Owner.EntityManager.SpawnEntity("FireExtinguisher", Owner.Transform.GridPosition));
|
ItemContainer.Insert(Owner.EntityManager.SpawnEntity("FireExtinguisher", Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
{
|
{
|
||||||
var solutionComponent = component.Owner.GetComponent<SolutionComponent>();
|
var solutionComponent = component.Owner.GetComponent<SolutionComponent>();
|
||||||
// Need this as when we split the component's owner may be deleted
|
// Need this as when we split the component's owner may be deleted
|
||||||
var entityLocation = component.Owner.Transform.GridPosition;
|
var entityLocation = component.Owner.Transform.Coordinates;
|
||||||
var solution = solutionComponent.SplitSolution(solutionComponent.CurrentVolume);
|
var solution = solutionComponent.SplitSolution(solutionComponent.CurrentVolume);
|
||||||
solution.SpillAt(entityLocation, "PuddleSmear");
|
solution.SpillAt(entityLocation, "PuddleSmear");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntitySystem.Get<AudioSystem>().PlayAtCoords(_spillSound, Owner.Transform.GridPosition);
|
EntitySystem.Get<AudioSystem>().PlayAtCoords(_spillSound, Owner.Transform.Coordinates);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,7 +354,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
|
|
||||||
var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID);
|
var mapGrid = _mapManager.GetGrid(Owner.Transform.GridID);
|
||||||
|
|
||||||
if (!Owner.Transform.GridPosition.Offset(direction).TryGetTileRef(out var tile))
|
if (!Owner.Transform.Coordinates.Offset(direction).TryGetTileRef(out var tile))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
/// <returns>The puddle if one was created, null otherwise.</returns>
|
/// <returns>The puddle if one was created, null otherwise.</returns>
|
||||||
public static PuddleComponent? SpillAt(this Solution solution, IEntity entity, string prototype, bool sound = true)
|
public static PuddleComponent? SpillAt(this Solution solution, IEntity entity, string prototype, bool sound = true)
|
||||||
{
|
{
|
||||||
var coordinates = entity.Transform.GridPosition;
|
var coordinates = entity.Transform.Coordinates;
|
||||||
return solution.SpillAt(coordinates, prototype, sound);
|
return solution.SpillAt(coordinates, prototype, sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
/// <param name="prototype">The prototype to use.</param>
|
/// <param name="prototype">The prototype to use.</param>
|
||||||
/// <param name="sound">Whether or not to play the spill sound.</param>
|
/// <param name="sound">Whether or not to play the spill sound.</param>
|
||||||
/// <returns>The puddle if one was created, null otherwise.</returns>
|
/// <returns>The puddle if one was created, null otherwise.</returns>
|
||||||
public static PuddleComponent? SpillAt(this Solution solution, GridCoordinates coordinates, string prototype, bool sound = true)
|
public static PuddleComponent? SpillAt(this Solution solution, EntityCoordinates coordinates, string prototype, bool sound = true)
|
||||||
{
|
{
|
||||||
if (solution.TotalVolume == 0)
|
if (solution.TotalVolume == 0)
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,8 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
var serverEntityManager = IoCManager.Resolve<IServerEntityManager>();
|
var serverEntityManager = IoCManager.Resolve<IServerEntityManager>();
|
||||||
|
|
||||||
var mapGrid = mapManager.GetGrid(coordinates.GridID);
|
var gridId = coordinates.GetGridId(entityManager);
|
||||||
|
var mapGrid = mapManager.GetGrid(gridId);
|
||||||
|
|
||||||
// If space return early, let that spill go out into the void
|
// If space return early, let that spill go out into the void
|
||||||
var tileRef = mapGrid.GetTileRef(coordinates);
|
var tileRef = mapGrid.GetTileRef(coordinates);
|
||||||
@@ -74,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
|
|
||||||
// Get normalized co-ordinate for spill location and spill it in the centre
|
// Get normalized co-ordinate for spill location and spill it in the centre
|
||||||
// TODO: Does SnapGrid or something else already do this?
|
// TODO: Does SnapGrid or something else already do this?
|
||||||
var spillTileMapGrid = mapManager.GetGrid(coordinates.GridID);
|
var spillTileMapGrid = mapManager.GetGrid(gridId);
|
||||||
var spillTileRef = spillTileMapGrid.GetTileRef(coordinates).GridIndices;
|
var spillTileRef = spillTileMapGrid.GetTileRef(coordinates).GridIndices;
|
||||||
var spillGridCoords = spillTileMapGrid.GridTileToLocal(spillTileRef);
|
var spillGridCoords = spillTileMapGrid.GridTileToLocal(spillTileRef);
|
||||||
|
|
||||||
@@ -119,7 +120,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
/// <param name="puddle">The puddle if one was created, null otherwise.</param>
|
/// <param name="puddle">The puddle if one was created, null otherwise.</param>
|
||||||
/// <param name="sound">Play the spill sound.</param>
|
/// <param name="sound">Play the spill sound.</param>
|
||||||
/// <returns>True if a puddle was created, false otherwise.</returns>
|
/// <returns>True if a puddle was created, false otherwise.</returns>
|
||||||
public static bool TrySpillAt(this Solution solution, GridCoordinates coordinates, string prototype, [NotNullWhen(true)] out PuddleComponent? puddle, bool sound = true)
|
public static bool TrySpillAt(this Solution solution, EntityCoordinates coordinates, string prototype, [NotNullWhen(true)] out PuddleComponent? puddle, bool sound = true)
|
||||||
{
|
{
|
||||||
puddle = solution.SpillAt(coordinates, prototype, sound);
|
puddle = solution.SpillAt(coordinates, prototype, sound);
|
||||||
return puddle != null;
|
return puddle != null;
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var playerPos = eventArgs.User.Transform.GridPosition;
|
var playerPos = eventArgs.User.Transform.Coordinates;
|
||||||
if (eventArgs.ClickLocation.GridID != playerPos.GridID)
|
if (eventArgs.ClickLocation.GetGridId(_serverEntityManager) != playerPos.GetGridId(_serverEntityManager))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Owner.TryGetComponent(out SolutionComponent contents))
|
if (!Owner.TryGetComponent(out SolutionComponent contents))
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
{
|
{
|
||||||
if (!PutInHand(item, mobCheck))
|
if (!PutInHand(item, mobCheck))
|
||||||
{
|
{
|
||||||
item.Owner.Transform.GridPosition = Owner.Transform.GridPosition;
|
item.Owner.Transform.Coordinates = Owner.Transform.Coordinates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Drop(string slot, GridCoordinates coords, bool doMobChecks = true)
|
public bool Drop(string slot, EntityCoordinates coords, bool doMobChecks = true)
|
||||||
{
|
{
|
||||||
var hand = GetHand(slot);
|
var hand = GetHand(slot);
|
||||||
if (!CanDrop(slot) || hand?.Entity == null)
|
if (!CanDrop(slot) || hand?.Entity == null)
|
||||||
@@ -264,7 +264,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
item.RemovedFromSlot();
|
item.RemovedFromSlot();
|
||||||
item.Owner.Transform.GridPosition = coords;
|
item.Owner.Transform.Coordinates = coords;
|
||||||
|
|
||||||
if (ContainerHelpers.TryGetContainer(Owner, out var container))
|
if (ContainerHelpers.TryGetContainer(Owner, out var container))
|
||||||
{
|
{
|
||||||
@@ -277,7 +277,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Drop(IEntity entity, GridCoordinates coords, bool doMobChecks = true)
|
public bool Drop(IEntity entity, EntityCoordinates coords, bool doMobChecks = true)
|
||||||
{
|
{
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
@@ -311,7 +311,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
item.RemovedFromSlot();
|
item.RemovedFromSlot();
|
||||||
item.Owner.Transform.GridPosition = Owner.Transform.GridPosition;
|
item.Owner.Transform.Coordinates = Owner.Transform.Coordinates;
|
||||||
|
|
||||||
if (item.Owner.TryGetComponent<SpriteComponent>(out var spriteComponent))
|
if (item.Owner.TryGetComponent<SpriteComponent>(out var spriteComponent))
|
||||||
{
|
{
|
||||||
@@ -564,7 +564,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
controller.StartPull(Owner.GetComponent<ICollidableComponent>());
|
controller.StartPull(Owner.GetComponent<ICollidableComponent>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MovePulledObject(GridCoordinates puller, GridCoordinates to)
|
public void MovePulledObject(EntityCoordinates puller, EntityCoordinates to)
|
||||||
{
|
{
|
||||||
if (PulledObject != null &&
|
if (PulledObject != null &&
|
||||||
PulledObject.TryGetController(out PullController controller))
|
PulledObject.TryGetController(out PullController controller))
|
||||||
@@ -655,7 +655,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
if (used != null)
|
if (used != null)
|
||||||
{
|
{
|
||||||
interactionSystem.Interaction(Owner, used, hand.Entity,
|
interactionSystem.Interaction(Owner, used, hand.Entity,
|
||||||
GridCoordinates.InvalidGrid);
|
EntityCoordinates.Invalid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
if (activeHand != null)
|
if (activeHand != null)
|
||||||
{
|
{
|
||||||
interactionSystem.Interaction(Owner, activeHand.Owner, itemContainedInSlot.Owner,
|
interactionSystem.Interaction(Owner, activeHand.Owner, itemContainedInSlot.Owner,
|
||||||
new GridCoordinates());
|
new EntityCoordinates());
|
||||||
}
|
}
|
||||||
else if (Unequip(msg.Inventoryslot))
|
else if (Unequip(msg.Inventoryslot))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
|
|
||||||
if (!hands.PutInHand(cell.Owner.GetComponent<ItemComponent>()))
|
if (!hands.PutInHand(cell.Owner.GetComponent<ItemComponent>()))
|
||||||
{
|
{
|
||||||
cell.Owner.Transform.GridPosition = user.Transform.GridPosition;
|
cell.Owner.Transform.Coordinates = user.Transform.Coordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Items/pistol_magout.ogg", Owner);
|
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Items/pistol_magout.ogg", Owner);
|
||||||
@@ -292,7 +292,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cell = Owner.EntityManager.SpawnEntity("PowerCellSmallStandard", Owner.Transform.GridPosition);
|
var cell = Owner.EntityManager.SpawnEntity("PowerCellSmallStandard", Owner.Transform.Coordinates);
|
||||||
_cellContainer.Insert(cell);
|
_cellContainer.Insert(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Server.GameObjects.EntitySystems.Click;
|
using Content.Shared.GameObjects.Components.Interactable;
|
||||||
using Content.Shared.GameObjects.Components.Interactable;
|
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
@@ -15,7 +14,6 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class TilePryingComponent : Component, IAfterInteract
|
public class TilePryingComponent : Component, IAfterInteract
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
|
||||||
@@ -33,12 +31,12 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
serializer.DataField(ref _toolComponentNeeded, "toolComponentNeeded", true);
|
serializer.DataField(ref _toolComponentNeeded, "toolComponentNeeded", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void TryPryTile(IEntity user, GridCoordinates clickLocation)
|
public async void TryPryTile(IEntity user, EntityCoordinates clickLocation)
|
||||||
{
|
{
|
||||||
if (!Owner.TryGetComponent<ToolComponent>(out var tool) && _toolComponentNeeded)
|
if (!Owner.TryGetComponent<ToolComponent>(out var tool) && _toolComponentNeeded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var mapGrid = _mapManager.GetGrid(clickLocation.GridID);
|
var mapGrid = _mapManager.GetGrid(clickLocation.GetGridId(Owner.EntityManager));
|
||||||
var tile = mapGrid.GetTileRef(clickLocation);
|
var tile = mapGrid.GetTileRef(clickLocation);
|
||||||
|
|
||||||
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
||||||
@@ -53,7 +51,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
if (_toolComponentNeeded && !await tool!.UseTool(user, null, 0f, ToolQuality.Prying))
|
if (_toolComponentNeeded && !await tool!.UseTool(user, null, 0f, ToolQuality.Prying))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
coordinates.PryTile(_mapManager, _tileDefinitionManager, Owner.EntityManager);
|
coordinates.PryTile(Owner.EntityManager, _mapManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
var playerGrid = player.AttachedEntity.Transform.GridID;
|
var playerGrid = player.AttachedEntity.Transform.GridID;
|
||||||
var mapGrid = mapManager.GetGrid(playerGrid);
|
var mapGrid = mapManager.GetGrid(playerGrid);
|
||||||
var playerPosition = player.AttachedEntity.Transform.GridPosition;
|
var playerPosition = player.AttachedEntity.Transform.Coordinates;
|
||||||
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
|
||||||
|
|
||||||
for (var i = -radius; i <= radius; i++)
|
for (var i = -radius; i <= radius; i++)
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
PlaySoundCollection("WelderOn", -5);
|
PlaySoundCollection("WelderOn", -5);
|
||||||
_welderSystem.Subscribe(this);
|
_welderSystem.Subscribe(this);
|
||||||
|
|
||||||
Owner.Transform.GridPosition
|
Owner.Transform.Coordinates
|
||||||
.GetTileAtmosphere()?.HotspotExpose(700f, 50f, true);
|
.GetTileAtmosphere()?.HotspotExpose(700f, 50f, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -243,7 +243,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
|
|
||||||
_solutionComponent?.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
|
_solutionComponent?.TryRemoveReagent("chem.WeldingFuel", ReagentUnit.New(FuelLossRate * frameTime));
|
||||||
|
|
||||||
Owner.Transform.GridPosition
|
Owner.Transform.Coordinates
|
||||||
.GetTileAtmosphere()?.HotspotExpose(700f, 50f, true);
|
.GetTileAtmosphere()?.HotspotExpose(700f, 50f, true);
|
||||||
|
|
||||||
if (Fuel == 0)
|
if (Fuel == 0)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Items
|
|||||||
if (!Owner.TryGetComponent(out StackComponent stack)) return;
|
if (!Owner.TryGetComponent(out StackComponent stack)) return;
|
||||||
|
|
||||||
var attacked = eventArgs.Target;
|
var attacked = eventArgs.Target;
|
||||||
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GetGridId(Owner.EntityManager));
|
||||||
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
||||||
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD
|
|||||||
//No changing mode mid-RCD
|
//No changing mode mid-RCD
|
||||||
var startingMode = _mode;
|
var startingMode = _mode;
|
||||||
|
|
||||||
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GetGridId(Owner.EntityManager));
|
||||||
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
||||||
var snapPos = mapGrid.SnapGridCellFor(eventArgs.ClickLocation, SnapGridOffset.Center);
|
var snapPos = mapGrid.SnapGridCellFor(eventArgs.ClickLocation, SnapGridOffset.Center);
|
||||||
|
|
||||||
@@ -166,8 +166,8 @@ namespace Content.Server.GameObjects.Components.Items.RCD
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
var coordinates = mapGrid.ToCoordinates(tile.GridIndices);
|
||||||
if (coordinates == GridCoordinates.InvalidGrid || !eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
|
if (coordinates == EntityCoordinates.Invalid || !eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(Owner.EntityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(Owner.EntityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
Spawn("MopItem");
|
Spawn("MopItem");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(Owner.EntityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(Owner.EntityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (random.Prob(0.4f))
|
if (random.Prob(0.4f))
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
Spawn("Brutepack");
|
Spawn("Brutepack");
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var prototype in _contents)
|
foreach (var prototype in _contents)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(Owner.EntityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(Owner.EntityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (random.Prob(0.4f))
|
if (random.Prob(0.4f))
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
Spawn("Screwdriver");
|
Spawn("Screwdriver");
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
Spawn("BreathMaskClothing");
|
Spawn("BreathMaskClothing");
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
Spawn("GoldStack");
|
Spawn("GoldStack");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage.Fill
|
|||||||
|
|
||||||
void Spawn(string prototype)
|
void Spawn(string prototype)
|
||||||
{
|
{
|
||||||
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.GridPosition));
|
storage.Insert(_entityManager.SpawnEntity(prototype, Owner.Transform.Coordinates));
|
||||||
}
|
}
|
||||||
|
|
||||||
Spawn("Crowbar");
|
Spawn("Crowbar");
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using Content.Server.GameObjects.Components.GUI;
|
using Content.Server.GameObjects.Components.GUI;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
|
||||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||||
using Content.Server.Throw;
|
using Content.Server.Throw;
|
||||||
using Content.Server.Utility;
|
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Items;
|
using Content.Shared.GameObjects.Components.Items;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
@@ -14,8 +12,6 @@ using Robust.Shared.Containers;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
@@ -26,8 +22,6 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
[ComponentReference(typeof(IItemComponent))]
|
[ComponentReference(typeof(IItemComponent))]
|
||||||
public class ItemComponent : StorableComponent, IInteractHand, IExAct, IEquipped, IUnequipped, IItemComponent
|
public class ItemComponent : StorableComponent, IInteractHand, IExAct, IEquipped, IUnequipped, IItemComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "Item";
|
public override string Name => "Item";
|
||||||
public override uint? NetID => ContentNetIDs.ITEM;
|
public override uint? NetID => ContentNetIDs.ITEM;
|
||||||
|
|
||||||
@@ -142,8 +136,8 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
public void OnExplosion(ExplosionEventArgs eventArgs)
|
public void OnExplosion(ExplosionEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
var sourceLocation = eventArgs.Source;
|
var sourceLocation = eventArgs.Source;
|
||||||
var targetLocation = eventArgs.Target.Transform.GridPosition;
|
var targetLocation = eventArgs.Target.Transform.Coordinates;
|
||||||
var dirVec = (targetLocation.ToMapPos(_mapManager) - sourceLocation.ToMapPos(_mapManager)).Normalized;
|
var dirVec = (targetLocation.ToMapPos(Owner.EntityManager) - sourceLocation.ToMapPos(Owner.EntityManager)).Normalized;
|
||||||
|
|
||||||
var throwForce = 1.0f;
|
var throwForce = 1.0f;
|
||||||
|
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
var ownerTransform = Owner.Transform;
|
var ownerTransform = Owner.Transform;
|
||||||
var playerTransform = player.Transform;
|
var playerTransform = player.Transform;
|
||||||
|
|
||||||
if (!playerTransform.GridPosition.InRange(_mapManager, ownerTransform.GridPosition, 2) ||
|
if (!playerTransform.Coordinates.InRange(_entityManager, ownerTransform.Coordinates, 2) ||
|
||||||
!ownerTransform.IsMapTransform &&
|
!ownerTransform.IsMapTransform &&
|
||||||
!playerTransform.ContainsEntity(ownerTransform))
|
!playerTransform.ContainsEntity(ownerTransform))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
if (recipeToCook != null)
|
if (recipeToCook != null)
|
||||||
{
|
{
|
||||||
var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName;
|
var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName;
|
||||||
_entityManager.SpawnEntity(entityToSpawn, Owner.Transform.GridPosition);
|
_entityManager.SpawnEntity(entityToSpawn, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f));
|
_audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f));
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace Content.Server.GameObjects.Components.MachineLinking
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transmitter.Range > 0 && !Owner.Transform.GridPosition.InRange(_mapManager, transmitter.Owner.Transform.GridPosition, transmitter.Range))
|
if (transmitter.Range > 0 && !Owner.Transform.Coordinates.InRange(Owner.EntityManager, transmitter.Owner.Transform.Coordinates, transmitter.Range))
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, Loc.GetString("Out of range."));
|
Owner.PopupMessage(user, Loc.GetString("Out of range."));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Content.Server.GameObjects.Components.MachineLinking
|
|||||||
|
|
||||||
foreach (var receiver in _receivers)
|
foreach (var receiver in _receivers)
|
||||||
{
|
{
|
||||||
if (Range > 0 && !Owner.Transform.GridPosition.InRange(_mapManager, receiver.Owner.Transform.GridPosition, Range))
|
if (Range > 0 && !Owner.Transform.Coordinates.InRange(Owner.EntityManager, receiver.Owner.Transform.Coordinates, Range))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!Owner.Deleted)
|
if(!Owner.Deleted)
|
||||||
_entityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.GridPosition);
|
_entityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void MapInit()
|
public virtual void MapInit()
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
for (int i = 0; i < number; i++)
|
for (int i = 0; i < number; i++)
|
||||||
{
|
{
|
||||||
var entity = _robustRandom.Pick(Prototypes);
|
var entity = _robustRandom.Pick(Prototypes);
|
||||||
_entityManager.SpawnEntity(entity, Owner.Transform.GridPosition);
|
_entityManager.SpawnEntity(entity, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user