Use EntitySystem dependencies in a bunch of systems.
This commit is contained in:
@@ -19,6 +19,7 @@ namespace Content.Client.Atmos.EntitySystems
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
// Gas overlays
|
// Gas overlays
|
||||||
private readonly float[] _timer = new float[Atmospherics.TotalNumberOfGases];
|
private readonly float[] _timer = new float[Atmospherics.TotalNumberOfGases];
|
||||||
@@ -38,16 +39,12 @@ namespace Content.Client.Atmos.EntitySystems
|
|||||||
private readonly Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>> _tileData =
|
private readonly Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>> _tileData =
|
||||||
new();
|
new();
|
||||||
|
|
||||||
private AtmosphereSystem _atmosphereSystem = default!;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeNetworkEvent<GasOverlayMessage>(HandleGasOverlayMessage);
|
SubscribeNetworkEvent<GasOverlayMessage>(HandleGasOverlayMessage);
|
||||||
_mapManager.OnGridRemoved += OnGridRemoved;
|
_mapManager.OnGridRemoved += OnGridRemoved;
|
||||||
|
|
||||||
_atmosphereSystem = Get<AtmosphereSystem>();
|
|
||||||
|
|
||||||
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
|
for (var i = 0; i < Atmospherics.TotalNumberOfGases; i++)
|
||||||
{
|
{
|
||||||
var overlay = _atmosphereSystem.GetOverlay(i);
|
var overlay = _atmosphereSystem.GetOverlay(i);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace Content.Client.Audio
|
|||||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||||
[Dependency] private readonly IBaseClient _client = default!;
|
[Dependency] private readonly IBaseClient _client = default!;
|
||||||
|
[Dependency] private readonly ClientGameTicker _gameTicker = default!;
|
||||||
|
|
||||||
private SoundCollectionPrototype _ambientCollection = default!;
|
private SoundCollectionPrototype _ambientCollection = default!;
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ namespace Content.Client.Audio
|
|||||||
_client.PlayerJoinedServer += OnJoin;
|
_client.PlayerJoinedServer += OnJoin;
|
||||||
_client.PlayerLeaveServer += OnLeave;
|
_client.PlayerLeaveServer += OnLeave;
|
||||||
|
|
||||||
Get<ClientGameTicker>().LobbyStatusUpdated += LobbySongReceived;
|
_gameTicker.LobbyStatusUpdated += LobbySongReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Shutdown()
|
public override void Shutdown()
|
||||||
@@ -60,7 +61,7 @@ namespace Content.Client.Audio
|
|||||||
_client.PlayerJoinedServer -= OnJoin;
|
_client.PlayerJoinedServer -= OnJoin;
|
||||||
_client.PlayerLeaveServer -= OnLeave;
|
_client.PlayerLeaveServer -= OnLeave;
|
||||||
|
|
||||||
Get<ClientGameTicker>().LobbyStatusUpdated -= LobbySongReceived;
|
_gameTicker.LobbyStatusUpdated -= LobbySongReceived;
|
||||||
|
|
||||||
EndAmbience();
|
EndAmbience();
|
||||||
EndLobbyMusic();
|
EndLobbyMusic();
|
||||||
@@ -165,7 +166,7 @@ namespace Content.Client.Audio
|
|||||||
private void StartLobbyMusic()
|
private void StartLobbyMusic()
|
||||||
{
|
{
|
||||||
EndLobbyMusic();
|
EndLobbyMusic();
|
||||||
var file = Get<ClientGameTicker>().LobbySong;
|
var file = _gameTicker.LobbySong;
|
||||||
if (file == null) // We have not received the lobby song yet.
|
if (file == null) // We have not received the lobby song yet.
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ namespace Content.Client.DragDrop
|
|||||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||||
|
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||||
|
|
||||||
// how often to recheck possible targets (prevents calling expensive
|
// how often to recheck possible targets (prevents calling expensive
|
||||||
// check logic each update)
|
// check logic each update)
|
||||||
@@ -69,8 +71,6 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
private ShaderInstance? _dropTargetInRangeShader;
|
private ShaderInstance? _dropTargetInRangeShader;
|
||||||
private ShaderInstance? _dropTargetOutOfRangeShader;
|
private ShaderInstance? _dropTargetOutOfRangeShader;
|
||||||
private SharedInteractionSystem _interactionSystem = default!;
|
|
||||||
private InputSystem _inputSystem = default!;
|
|
||||||
|
|
||||||
private readonly List<ISpriteComponent> _highlightedSprites = new();
|
private readonly List<ISpriteComponent> _highlightedSprites = new();
|
||||||
|
|
||||||
@@ -80,8 +80,6 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
_dropTargetInRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetInRange).Instance();
|
_dropTargetInRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetInRange).Instance();
|
||||||
_dropTargetOutOfRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetOutOfRange).Instance();
|
_dropTargetOutOfRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetOutOfRange).Instance();
|
||||||
_interactionSystem = Get<SharedInteractionSystem>();
|
|
||||||
_inputSystem = Get<InputSystem>();
|
|
||||||
// needs to fire on mouseup and mousedown so we can detect a drag / drop
|
// needs to fire on mouseup and mousedown so we can detect a drag / drop
|
||||||
CommandBinds.Builder
|
CommandBinds.Builder
|
||||||
.Bind(EngineKeyFunctions.Use, new PointerInputCmdHandler(OnUse, false))
|
.Bind(EngineKeyFunctions.Use, new PointerInputCmdHandler(OnUse, false))
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace Content.Client.Weapons.Melee
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
[Dependency] private readonly EffectSystem _effectSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -67,7 +68,6 @@ namespace Content.Client.Weapons.Melee
|
|||||||
source.TryGetComponent(out ISpriteComponent? sourceSprite) &&
|
source.TryGetComponent(out ISpriteComponent? sourceSprite) &&
|
||||||
sourceSprite.BaseRSI?.Path != null)
|
sourceSprite.BaseRSI?.Path != null)
|
||||||
{
|
{
|
||||||
var sys = Get<EffectSystem>();
|
|
||||||
var curTime = _gameTiming.CurTime;
|
var curTime = _gameTiming.CurTime;
|
||||||
var effect = new EffectSystemMessage
|
var effect = new EffectSystemMessage
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,8 @@ namespace Content.Client.Weapons.Melee
|
|||||||
Born = curTime,
|
Born = curTime,
|
||||||
DeathTime = curTime.Add(TimeSpan.FromMilliseconds(300f)),
|
DeathTime = curTime.Add(TimeSpan.FromMilliseconds(300f)),
|
||||||
};
|
};
|
||||||
sys.CreateEffect(effect);
|
|
||||||
|
_effectSystem.CreateEffect(effect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,21 +24,12 @@ namespace Content.Client.Weapons.Ranged
|
|||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||||
|
[Dependency] private readonly CombatModeSystem _combatModeSystem = default!;
|
||||||
|
|
||||||
private InputSystem _inputSystem = default!;
|
|
||||||
private CombatModeSystem _combatModeSystem = default!;
|
|
||||||
private bool _blocked;
|
private bool _blocked;
|
||||||
private int _shotCounter;
|
private int _shotCounter;
|
||||||
|
|
||||||
public override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
|
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
_inputSystem = Get<InputSystem>();
|
|
||||||
_combatModeSystem = Get<CombatModeSystem>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
|||||||
*/
|
*/
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
[Dependency] private readonly PathfindingSystem _pathfindingSystem = default!;
|
||||||
private PathfindingSystem _pathfindingSystem = default!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queued region updates
|
/// Queued region updates
|
||||||
@@ -80,7 +79,6 @@ namespace Content.Server.AI.Pathfinding.Accessible
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
_pathfindingSystem = Get<PathfindingSystem>();
|
|
||||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
||||||
SubscribeLocalEvent<PathfindingChunkUpdateMessage>(RecalculateNodeRegions);
|
SubscribeLocalEvent<PathfindingChunkUpdateMessage>(RecalculateNodeRegions);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ namespace Content.Server.AI.Steering
|
|||||||
// http://www.red3d.com/cwr/papers/1999/gdc99steer.html for a steering overview
|
// http://www.red3d.com/cwr/papers/1999/gdc99steer.html for a steering overview
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IPauseManager _pauseManager = default!;
|
[Dependency] private readonly IPauseManager _pauseManager = default!;
|
||||||
|
[Dependency] private readonly PathfindingSystem _pathfindingSystem = default!;
|
||||||
private PathfindingSystem _pathfindingSystem = default!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether we try to avoid non-blocking physics objects
|
/// Whether we try to avoid non-blocking physics objects
|
||||||
@@ -87,7 +86,6 @@ namespace Content.Server.AI.Steering
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_pathfindingSystem = Get<PathfindingSystem>();
|
|
||||||
|
|
||||||
for (var i = 0; i < AgentListCount; i++)
|
for (var i = 0; i < AgentListCount; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
public class AirtightSystem : EntitySystem
|
public class AirtightSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -42,7 +43,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
if (airtight.FixVacuum)
|
if (airtight.FixVacuum)
|
||||||
{
|
{
|
||||||
Get<AtmosphereSystem>().FixVacuum(airtight.LastPosition.Item1, airtight.LastPosition.Item2);
|
_atmosphereSystem.FixVacuum(airtight.LastPosition.Item1, airtight.LastPosition.Item2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,9 +94,8 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (!gridId.IsValid())
|
if (!gridId.IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
_atmosphereSystem.UpdateAdjacent(gridId, pos);
|
||||||
atmosphereSystem.UpdateAdjacent(gridId, pos);
|
_atmosphereSystem.InvalidateTile(gridId, pos);
|
||||||
atmosphereSystem.InvalidateTile(gridId, pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private AtmosDirection Rotate(AtmosDirection myDirection, Angle myAngle)
|
private AtmosDirection Rotate(AtmosDirection myDirection, Angle myAngle)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Players allowed to see the atmos debug overlay.
|
/// Players allowed to see the atmos debug overlay.
|
||||||
@@ -127,7 +128,6 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
AccumulatedFrameTime -= _updateCooldown;
|
AccumulatedFrameTime -= _updateCooldown;
|
||||||
|
|
||||||
var currentTick = _gameTiming.CurTick;
|
var currentTick = _gameTiming.CurTick;
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
|
||||||
|
|
||||||
// Now we'll go through each player, then through each chunk in range of that player checking if the player is still in range
|
// Now we'll go through each player, then through each chunk in range of that player checking if the player is still in range
|
||||||
// If they are, check if they need the new data to send (i.e. if there's an overlay for the gas).
|
// If they are, check if they need the new data to send (i.e. if there's an overlay for the gas).
|
||||||
@@ -157,7 +157,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
for (var x = 0; x < LocalViewRange; x++)
|
for (var x = 0; x < LocalViewRange; x++)
|
||||||
{
|
{
|
||||||
var Vector2i = new Vector2i(baseTile.X + x, baseTile.Y + y);
|
var Vector2i = new Vector2i(baseTile.X + x, baseTile.Y + y);
|
||||||
debugOverlayContent[index++] = ConvertTileToData(atmosphereSystem.GetTileAtmosphereOrCreateSpace(grid, gam, Vector2i));
|
debugOverlayContent[index++] = ConvertTileToData(_atmosphereSystem.GetTileAtmosphereOrCreateSpace(grid, gam, Vector2i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,10 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
public partial class AtmosphereSystem
|
public partial class AtmosphereSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||||
|
[Dependency] private readonly GasTileOverlaySystem _gasTileOverlaySystem = default!;
|
||||||
private GasTileOverlaySystem _gasTileOverlaySystem = default!;
|
|
||||||
|
|
||||||
private void InitializeGrid()
|
private void InitializeGrid()
|
||||||
{
|
{
|
||||||
_gasTileOverlaySystem = Get<GasTileOverlaySystem>();
|
|
||||||
|
|
||||||
SubscribeLocalEvent<GridAtmosphereComponent, ComponentInit>(OnGridAtmosphereInit);
|
SubscribeLocalEvent<GridAtmosphereComponent, ComponentInit>(OnGridAtmosphereInit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
using Content.Server.Atmos.Components;
|
using Content.Server.Atmos.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems
|
namespace Content.Server.Atmos.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasTankSystem : EntitySystem
|
public class GasTankSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
private const float TimerDelay = 0.5f;
|
private const float TimerDelay = 0.5f;
|
||||||
private float _timer = 0f;
|
private float _timer = 0f;
|
||||||
|
|
||||||
@@ -19,11 +22,9 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
if (_timer < TimerDelay) return;
|
if (_timer < TimerDelay) return;
|
||||||
_timer -= TimerDelay;
|
_timer -= TimerDelay;
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
|
||||||
|
|
||||||
foreach (var gasTank in EntityManager.ComponentManager.EntityQuery<GasTankComponent>())
|
foreach (var gasTank in EntityManager.ComponentManager.EntityQuery<GasTankComponent>())
|
||||||
{
|
{
|
||||||
atmosphereSystem.React(gasTank.Air, gasTank);
|
_atmosphereSystem.React(gasTank.Air, gasTank);
|
||||||
gasTank.CheckStatus();
|
gasTank.CheckStatus();
|
||||||
gasTank.UpdateUserInterface();
|
gasTank.UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The tiles that have had their atmos data updated since last tick
|
/// The tiles that have had their atmos data updated since last tick
|
||||||
@@ -58,8 +59,6 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private float _updateCooldown;
|
private float _updateCooldown;
|
||||||
|
|
||||||
private AtmosphereSystem _atmosphereSystem = default!;
|
|
||||||
|
|
||||||
private int _thresholds;
|
private int _thresholds;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -68,7 +67,6 @@ namespace Content.Server.Atmos.EntitySystems
|
|||||||
|
|
||||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
||||||
|
|
||||||
_atmosphereSystem = Get<AtmosphereSystem>();
|
|
||||||
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
|
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
|
||||||
_mapManager.OnGridRemoved += OnGridRemoved;
|
_mapManager.OnGridRemoved += OnGridRemoved;
|
||||||
var configManager = IoCManager.Resolve<IConfigurationManager>();
|
var configManager = IoCManager.Resolve<IConfigurationManager>();
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ using Content.Shared.Atmos.Visuals;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasDualPortVentPumpSystem : EntitySystem
|
public class GasDualPortVentPumpSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -46,8 +49,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
|| !nodeContainer.TryGetNode(vent.OutletName, out PipeNode? outlet))
|
|| !nodeContainer.TryGetNode(vent.OutletName, out PipeNode? outlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
var environment = _atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
||||||
var environment = atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
|
||||||
|
|
||||||
// We're in an air-blocked tile... Do nothing.
|
// We're in an air-blocked tile... Do nothing.
|
||||||
if (environment == null)
|
if (environment == null)
|
||||||
@@ -68,7 +70,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
{
|
{
|
||||||
var transferMoles = pressureDelta * environment.Volume / inlet.Air.Temperature * Atmospherics.R;
|
var transferMoles = pressureDelta * environment.Volume / inlet.Air.Temperature * Atmospherics.R;
|
||||||
var removed = inlet.Air.Remove(transferMoles);
|
var removed = inlet.Air.Remove(transferMoles);
|
||||||
atmosphereSystem.Merge(environment, removed);
|
_atmosphereSystem.Merge(environment, removed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vent.PumpDirection == VentPumpDirection.Siphoning && environment.Pressure > 0f)
|
else if (vent.PumpDirection == VentPumpDirection.Siphoning && environment.Pressure > 0f)
|
||||||
@@ -89,7 +91,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
{
|
{
|
||||||
var removed = environment.Remove(molesDelta);
|
var removed = environment.Remove(molesDelta);
|
||||||
|
|
||||||
Get<AtmosphereSystem>().Merge(outlet.Air, removed);
|
_atmosphereSystem.Merge(outlet.Air, removed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasVolumePumpSystem : EntitySystem
|
public class GasVolumePumpSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -56,13 +57,12 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
// Some of the gas from the mixture leaks when overclocked.
|
// Some of the gas from the mixture leaks when overclocked.
|
||||||
if (pump.Overclocked)
|
if (pump.Overclocked)
|
||||||
{
|
{
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
var tile = _atmosphereSystem.GetTileMixture(pump.Owner.Transform.Coordinates, true);
|
||||||
var tile = atmosphereSystem.GetTileMixture(pump.Owner.Transform.Coordinates, true);
|
|
||||||
|
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
var leaked = removed.RemoveRatio(pump.LeakRatio);
|
var leaked = removed.RemoveRatio(pump.LeakRatio);
|
||||||
atmosphereSystem.Merge(tile, leaked);
|
_atmosphereSystem.Merge(tile, leaked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
public class AtmosDeviceSystem : EntitySystem
|
public class AtmosDeviceSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private IGameTiming _gameTiming = default!;
|
[Dependency] private IGameTiming _gameTiming = default!;
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -35,7 +36,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// We try to add the device to a valid atmosphere.
|
// We try to add the device to a valid atmosphere.
|
||||||
if (!Get<AtmosphereSystem>().AddAtmosDevice(component))
|
if (!_atmosphereSystem.AddAtmosDevice(component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
component.LastProcess = _gameTiming.CurTime;
|
component.LastProcess = _gameTiming.CurTime;
|
||||||
@@ -45,7 +46,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
|
|
||||||
public void LeaveAtmosphere(AtmosDeviceComponent component)
|
public void LeaveAtmosphere(AtmosDeviceComponent component)
|
||||||
{
|
{
|
||||||
if (!Get<AtmosphereSystem>().RemoveAtmosDevice(component))
|
if (!_atmosphereSystem.RemoveAtmosDevice(component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
component.LastProcess = TimeSpan.Zero;
|
component.LastProcess = TimeSpan.Zero;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Content.Shared.Atmos;
|
|||||||
using Content.Shared.Notification.Managers;
|
using Content.Shared.Notification.Managers;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.EntitySystems
|
namespace Content.Server.Atmos.Piping.EntitySystems
|
||||||
@@ -15,6 +16,8 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class AtmosUnsafeUnanchorSystem : EntitySystem
|
public class AtmosUnsafeUnanchorSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, BeforeUnanchoredEvent>(OnBeforeUnanchored);
|
SubscribeLocalEvent<AtmosUnsafeUnanchorComponent, BeforeUnanchoredEvent>(OnBeforeUnanchored);
|
||||||
@@ -26,7 +29,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Get<AtmosphereSystem>().GetTileMixture(component.Owner.Transform.Coordinates) is not {} environment)
|
if (_atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates) is not {} environment)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var node in nodes.Nodes.Values)
|
foreach (var node in nodes.Nodes.Values)
|
||||||
@@ -47,9 +50,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
if (!component.Enabled || !ComponentManager.TryGetComponent(uid, out NodeContainerComponent? nodes))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
if (_atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is not {} environment)
|
||||||
|
|
||||||
if (atmosphereSystem.GetTileMixture(component.Owner.Transform.Coordinates, true) is not {} environment)
|
|
||||||
environment = GasMixture.SpaceGas;
|
environment = GasMixture.SpaceGas;
|
||||||
|
|
||||||
var lost = 0f;
|
var lost = 0f;
|
||||||
@@ -71,10 +72,10 @@ namespace Content.Server.Atmos.Piping.EntitySystems
|
|||||||
{
|
{
|
||||||
if (node is not PipeNode pipe) continue;
|
if (node is not PipeNode pipe) continue;
|
||||||
|
|
||||||
atmosphereSystem.Merge(buffer, pipe.Air.Remove(sharedLoss));
|
_atmosphereSystem.Merge(buffer, pipe.Air.Remove(sharedLoss));
|
||||||
}
|
}
|
||||||
|
|
||||||
atmosphereSystem.Merge(environment, buffer);
|
_atmosphereSystem.Merge(environment, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ using Content.Server.Atmos.Piping.Other.Components;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Other.EntitySystems
|
namespace Content.Server.Atmos.Piping.Other.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasMinerSystem : EntitySystem
|
public class GasMinerSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -21,9 +24,7 @@ namespace Content.Server.Atmos.Piping.Other.EntitySystems
|
|||||||
|
|
||||||
private void OnMinerUpdated(EntityUid uid, GasMinerComponent miner, AtmosDeviceUpdateEvent args)
|
private void OnMinerUpdated(EntityUid uid, GasMinerComponent miner, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
if (!CheckMinerOperation(miner, out var environment) || !miner.Enabled || !miner.SpawnGas.HasValue || miner.SpawnAmount <= 0f)
|
||||||
|
|
||||||
if (!CheckMinerOperation(atmosphereSystem, miner, out var environment) || !miner.Enabled || !miner.SpawnGas.HasValue || miner.SpawnAmount <= 0f)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Time to mine some gas.
|
// Time to mine some gas.
|
||||||
@@ -31,15 +32,15 @@ namespace Content.Server.Atmos.Piping.Other.EntitySystems
|
|||||||
var merger = new GasMixture(1) { Temperature = miner.SpawnTemperature };
|
var merger = new GasMixture(1) { Temperature = miner.SpawnTemperature };
|
||||||
merger.SetMoles(miner.SpawnGas.Value, miner.SpawnAmount);
|
merger.SetMoles(miner.SpawnGas.Value, miner.SpawnAmount);
|
||||||
|
|
||||||
atmosphereSystem.Merge(environment, merger);
|
_atmosphereSystem.Merge(environment, merger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckMinerOperation(AtmosphereSystem atmosphereSystem, GasMinerComponent miner, [NotNullWhen(true)] out GasMixture? environment)
|
private bool CheckMinerOperation(GasMinerComponent miner, [NotNullWhen(true)] out GasMixture? environment)
|
||||||
{
|
{
|
||||||
environment = atmosphereSystem.GetTileMixture(miner.Owner.Transform.Coordinates, true);
|
environment = _atmosphereSystem.GetTileMixture(miner.Owner.Transform.Coordinates, true);
|
||||||
|
|
||||||
// Space.
|
// Space.
|
||||||
if (atmosphereSystem.IsTileSpace(miner.Owner.Transform.Coordinates))
|
if (_atmosphereSystem.IsTileSpace(miner.Owner.Transform.Coordinates))
|
||||||
{
|
{
|
||||||
miner.Broken = true;
|
miner.Broken = true;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
@@ -26,6 +27,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasCanisterSystem : EntitySystem
|
public class GasCanisterSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -131,23 +134,21 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(canister.PortName, out PortablePipeNode? portNode))
|
if (!nodeContainer.TryGetNode(canister.PortName, out PortablePipeNode? portNode))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
_atmosphereSystem.React(canister.Air, portNode);
|
||||||
|
|
||||||
atmosphereSystem.React(canister.Air, portNode);
|
|
||||||
|
|
||||||
if (portNode.NodeGroup is PipeNet {NodeCount: > 1} net)
|
if (portNode.NodeGroup is PipeNet {NodeCount: > 1} net)
|
||||||
{
|
{
|
||||||
var buffer = new GasMixture(net.Air.Volume + canister.Air.Volume);
|
var buffer = new GasMixture(net.Air.Volume + canister.Air.Volume);
|
||||||
|
|
||||||
atmosphereSystem.Merge(buffer, net.Air);
|
_atmosphereSystem.Merge(buffer, net.Air);
|
||||||
atmosphereSystem.Merge(buffer, canister.Air);
|
_atmosphereSystem.Merge(buffer, canister.Air);
|
||||||
|
|
||||||
net.Air.Clear();
|
net.Air.Clear();
|
||||||
atmosphereSystem.Merge(net.Air, buffer);
|
_atmosphereSystem.Merge(net.Air, buffer);
|
||||||
net.Air.Multiply(net.Air.Volume / buffer.Volume);
|
net.Air.Multiply(net.Air.Volume / buffer.Volume);
|
||||||
|
|
||||||
canister.Air.Clear();
|
canister.Air.Clear();
|
||||||
atmosphereSystem.Merge(canister.Air, buffer);
|
_atmosphereSystem.Merge(canister.Air, buffer);
|
||||||
canister.Air.Multiply(canister.Air.Volume / buffer.Volume);
|
canister.Air.Multiply(canister.Air.Volume / buffer.Volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,12 +162,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (container.ContainedEntities.Count > 0)
|
if (container.ContainedEntities.Count > 0)
|
||||||
{
|
{
|
||||||
var gasTank = container.ContainedEntities[0].GetComponent<GasTankComponent>();
|
var gasTank = container.ContainedEntities[0].GetComponent<GasTankComponent>();
|
||||||
atmosphereSystem.ReleaseGasTo(canister.Air, gasTank.Air, canister.ReleasePressure);
|
_atmosphereSystem.ReleaseGasTo(canister.Air, gasTank.Air, canister.ReleasePressure);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var environment = atmosphereSystem.GetTileMixture(canister.Owner.Transform.Coordinates, true);
|
var environment = _atmosphereSystem.GetTileMixture(canister.Owner.Transform.Coordinates, true);
|
||||||
atmosphereSystem.ReleaseGasTo(canister.Air, environment, canister.ReleasePressure);
|
_atmosphereSystem.ReleaseGasTo(canister.Air, environment, canister.ReleasePressure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ using Content.Server.NodeContainer.Nodes;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasOutletInjectorSystem : EntitySystem
|
public class GasOutletInjectorSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -32,8 +35,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet))
|
if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
var environment = _atmosphereSystem.GetTileMixture(injector.Owner.Transform.Coordinates, true);
|
||||||
var environment = atmosphereSystem.GetTileMixture(injector.Owner.Transform.Coordinates, true);
|
|
||||||
|
|
||||||
if (environment == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
@@ -44,7 +46,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
var removed = inlet.Air.Remove(transferMoles);
|
var removed = inlet.Air.Remove(transferMoles);
|
||||||
|
|
||||||
atmosphereSystem.Merge(environment, removed);
|
_atmosphereSystem.Merge(environment, removed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ using Content.Server.NodeContainer.Nodes;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasPassiveVentSystem : EntitySystem
|
public class GasPassiveVentSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -22,8 +25,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
|
|
||||||
private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, AtmosDeviceUpdateEvent args)
|
private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
var environment = _atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
||||||
var environment = atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
|
||||||
|
|
||||||
if (environment == null)
|
if (environment == null)
|
||||||
return;
|
return;
|
||||||
@@ -44,7 +46,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
var airTemperature = environment.Temperature > 0 ? environment.Temperature : inlet.Air.Temperature;
|
var airTemperature = environment.Temperature > 0 ? environment.Temperature : inlet.Air.Temperature;
|
||||||
var transferMoles = pressureDelta * environment.Volume / (airTemperature * Atmospherics.R);
|
var transferMoles = pressureDelta * environment.Volume / (airTemperature * Atmospherics.R);
|
||||||
var removed = inlet.Air.Remove(transferMoles);
|
var removed = inlet.Air.Remove(transferMoles);
|
||||||
atmosphereSystem.Merge(environment, removed);
|
_atmosphereSystem.Merge(environment, removed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ using Content.Shared.Atmos.Piping;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasThermoMachineSystem : EntitySystem
|
public class GasThermoMachineSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -35,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(thermoMachine.InletName, out PipeNode? inlet))
|
if (!nodeContainer.TryGetNode(thermoMachine.InletName, out PipeNode? inlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var airHeatCapacity = Get<AtmosphereSystem>().GetHeatCapacity(inlet.Air);
|
var airHeatCapacity = _atmosphereSystem.GetHeatCapacity(inlet.Air);
|
||||||
var combinedHeatCapacity = airHeatCapacity + thermoMachine.HeatCapacity;
|
var combinedHeatCapacity = airHeatCapacity + thermoMachine.HeatCapacity;
|
||||||
var oldTemperature = inlet.Air.Temperature;
|
var oldTemperature = inlet.Air.Temperature;
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,15 @@ using Content.Shared.Atmos.Visuals;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasVentPumpSystem : EntitySystem
|
public class GasVentPumpSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -44,8 +47,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(vent.InletName, out PipeNode? pipe))
|
if (!nodeContainer.TryGetNode(vent.InletName, out PipeNode? pipe))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
var environment = _atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
||||||
var environment = atmosphereSystem.GetTileMixture(vent.Owner.Transform.Coordinates, true);
|
|
||||||
|
|
||||||
// We're in an air-blocked tile... Do nothing.
|
// We're in an air-blocked tile... Do nothing.
|
||||||
if (environment == null)
|
if (environment == null)
|
||||||
@@ -66,7 +68,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
{
|
{
|
||||||
var transferMoles = pressureDelta * environment.Volume / (pipe.Air.Temperature * Atmospherics.R);
|
var transferMoles = pressureDelta * environment.Volume / (pipe.Air.Temperature * Atmospherics.R);
|
||||||
|
|
||||||
atmosphereSystem.Merge(environment, pipe.Air.Remove(transferMoles));
|
_atmosphereSystem.Merge(environment, pipe.Air.Remove(transferMoles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vent.PumpDirection == VentPumpDirection.Siphoning && environment.Pressure > 0)
|
else if (vent.PumpDirection == VentPumpDirection.Siphoning && environment.Pressure > 0)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Content.Shared.Atmos.Piping.Unary.Visuals;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
@@ -16,6 +17,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasVentScrubberSystem : EntitySystem
|
public class GasVentScrubberSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -45,17 +48,16 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!nodeContainer.TryGetNode(scrubber.OutletName, out PipeNode? outlet))
|
if (!nodeContainer.TryGetNode(scrubber.OutletName, out PipeNode? outlet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var atmosphereSystem = Get<AtmosphereSystem>();
|
var environment = _atmosphereSystem.GetTileMixture(scrubber.Owner.Transform.Coordinates, true);
|
||||||
var environment = atmosphereSystem.GetTileMixture(scrubber.Owner.Transform.Coordinates, true);
|
|
||||||
|
|
||||||
Scrub(atmosphereSystem, scrubber, appearance, environment, outlet);
|
Scrub(_atmosphereSystem, scrubber, appearance, environment, outlet);
|
||||||
|
|
||||||
if (!scrubber.WideNet) return;
|
if (!scrubber.WideNet) return;
|
||||||
|
|
||||||
// Scrub adjacent tiles too.
|
// Scrub adjacent tiles too.
|
||||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(scrubber.Owner.Transform.Coordinates, false, true))
|
foreach (var adjacent in _atmosphereSystem.GetAdjacentTileMixtures(scrubber.Owner.Transform.Coordinates, false, true))
|
||||||
{
|
{
|
||||||
Scrub(atmosphereSystem, scrubber, null, adjacent, outlet);
|
Scrub(_atmosphereSystem, scrubber, null, adjacent, outlet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ using Content.Shared.Interaction.Events;
|
|||||||
using Content.Shared.Interaction.Helpers;
|
using Content.Shared.Interaction.Helpers;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Server.Body.Surgery.Components
|
namespace Content.Server.Body.Surgery.Components
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class SurgeryToolSystem : EntitySystem
|
public class SurgeryToolSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||||
|
|
||||||
private readonly HashSet<SurgeryToolComponent> _openSurgeryUIs = new();
|
private readonly HashSet<SurgeryToolComponent> _openSurgeryUIs = new();
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -54,7 +57,7 @@ namespace Content.Server.Body.Surgery.Components
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Get<ActionBlockerSystem>().CanInteract(tool.PerformerCache) ||
|
if (!_actionBlockerSystem.CanInteract(tool.PerformerCache) ||
|
||||||
!tool.PerformerCache.InRangeUnobstructed(tool.BodyCache))
|
!tool.PerformerCache.InRangeUnobstructed(tool.BodyCache))
|
||||||
{
|
{
|
||||||
tool.CloseAllSurgeryUIs();
|
tool.CloseAllSurgeryUIs();
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ namespace Content.Server.Construction
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
|
[Dependency] private readonly StackSystem _stackSystem = default!;
|
||||||
|
|
||||||
private readonly Dictionary<ICommonSession, HashSet<int>> _beingBuilt = new();
|
private readonly Dictionary<ICommonSession, HashSet<int>> _beingBuilt = new();
|
||||||
|
|
||||||
@@ -170,7 +172,7 @@ namespace Content.Server.Construction
|
|||||||
if (!materialStep.EntityValid(entity, out var stack))
|
if (!materialStep.EntityValid(entity, out var stack))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var splitStack = Get<StackSystem>().Split(entity.Uid, stack, materialStep.Amount, user.ToCoordinates());
|
var splitStack = _stackSystem.Split(entity.Uid, stack, materialStep.Amount, user.ToCoordinates());
|
||||||
|
|
||||||
if (splitStack == null)
|
if (splitStack == null)
|
||||||
continue;
|
continue;
|
||||||
@@ -226,8 +228,6 @@ namespace Content.Server.Construction
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var doAfterSystem = Get<DoAfterSystem>();
|
|
||||||
|
|
||||||
var doAfterArgs = new DoAfterEventArgs(user, doAfterTime)
|
var doAfterArgs = new DoAfterEventArgs(user, doAfterTime)
|
||||||
{
|
{
|
||||||
BreakOnDamage = true,
|
BreakOnDamage = true,
|
||||||
@@ -237,7 +237,7 @@ namespace Content.Server.Construction
|
|||||||
NeedHand = false,
|
NeedHand = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (await doAfterSystem.WaitDoAfter(doAfterArgs) == DoAfterStatus.Cancelled)
|
if (await _doAfterSystem.WaitDoAfter(doAfterArgs) == DoAfterStatus.Cancelled)
|
||||||
{
|
{
|
||||||
FailCleanup();
|
FailCleanup();
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -11,17 +11,7 @@ namespace Content.Server.Destructible
|
|||||||
public class DestructibleSystem : EntitySystem
|
public class DestructibleSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] public readonly IRobustRandom Random = default!;
|
[Dependency] public readonly IRobustRandom Random = default!;
|
||||||
|
[Dependency] public readonly AudioSystem AudioSystem = default!;
|
||||||
public AudioSystem AudioSystem { get; private set; } = default!;
|
[Dependency] public readonly ActSystem ActSystem = default!;
|
||||||
|
|
||||||
public ActSystem ActSystem { get; private set; } = default!;
|
|
||||||
|
|
||||||
public override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
|
|
||||||
AudioSystem = Get<AudioSystem>();
|
|
||||||
ActSystem = Get<ActSystem>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace Content.Server.Engineering.EntitySystems
|
|||||||
public class SpawnAfterInteractSystem : EntitySystem
|
public class SpawnAfterInteractSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||||
|
[Dependency] private readonly StackSystem _stackSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -41,7 +43,7 @@ namespace Content.Server.Engineering.EntitySystems
|
|||||||
if (!IsTileClear())
|
if (!IsTileClear())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.DoAfterTime > 0 && TryGet<DoAfterSystem>(out var doAfterSystem))
|
if (component.DoAfterTime > 0)
|
||||||
{
|
{
|
||||||
var doAfterArgs = new DoAfterEventArgs(args.User, component.DoAfterTime)
|
var doAfterArgs = new DoAfterEventArgs(args.User, component.DoAfterTime)
|
||||||
{
|
{
|
||||||
@@ -49,7 +51,7 @@ namespace Content.Server.Engineering.EntitySystems
|
|||||||
BreakOnStun = true,
|
BreakOnStun = true,
|
||||||
PostCheck = IsTileClear,
|
PostCheck = IsTileClear,
|
||||||
};
|
};
|
||||||
var result = await doAfterSystem.WaitDoAfter(doAfterArgs);
|
var result = await _doAfterSystem.WaitDoAfter(doAfterArgs);
|
||||||
|
|
||||||
if (result != DoAfterStatus.Finished)
|
if (result != DoAfterStatus.Finished)
|
||||||
return;
|
return;
|
||||||
@@ -59,7 +61,7 @@ namespace Content.Server.Engineering.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.Owner.TryGetComponent<SharedStackComponent>(out var stackComp)
|
if (component.Owner.TryGetComponent<SharedStackComponent>(out var stackComp)
|
||||||
&& component.RemoveOnInteract && !Get<StackSystem>().Use(uid, stackComp, 1))
|
&& component.RemoveOnInteract && !_stackSystem.Use(uid, stackComp, 1))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using Robust.Server.Player;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -29,6 +30,9 @@ namespace Content.Server.Hands
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
internal sealed class HandsSystem : SharedHandsSystem
|
internal sealed class HandsSystem : SharedHandsSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly InteractionSystem _interactionSystem = default!;
|
||||||
|
[Dependency] private readonly StackSystem _stackSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -113,12 +117,12 @@ namespace Content.Server.Hands
|
|||||||
if (!hands.TryGetActiveHeldEntity(out var throwEnt))
|
if (!hands.TryGetActiveHeldEntity(out var throwEnt))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Get<InteractionSystem>().TryThrowInteraction(hands.Owner, throwEnt))
|
if (!_interactionSystem.TryThrowInteraction(hands.Owner, throwEnt))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (throwEnt.TryGetComponent(out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually)
|
if (throwEnt.TryGetComponent(out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually)
|
||||||
{
|
{
|
||||||
var splitStack = Get<StackSystem>().Split(throwEnt.Uid, stack, 1, playerEnt.Transform.Coordinates);
|
var splitStack = _stackSystem.Split(throwEnt.Uid, stack, 1, playerEnt.Transform.Coordinates);
|
||||||
|
|
||||||
if (splitStack == null)
|
if (splitStack == null)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Buckle.Components;
|
using Content.Server.Buckle.Components;
|
||||||
using Content.Server.CombatMode;
|
using Content.Server.CombatMode;
|
||||||
|
using Content.Server.DoAfter;
|
||||||
using Content.Server.Hands.Components;
|
using Content.Server.Hands.Components;
|
||||||
using Content.Server.Items;
|
using Content.Server.Items;
|
||||||
using Content.Server.Pulling;
|
using Content.Server.Pulling;
|
||||||
@@ -46,6 +47,7 @@ namespace Content.Server.Interaction
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -175,9 +177,7 @@ namespace Content.Server.Interaction
|
|||||||
|
|
||||||
private void InteractionActivate(IEntity user, IEntity used)
|
private void InteractionActivate(IEntity user, IEntity used)
|
||||||
{
|
{
|
||||||
var actionBlocker = Get<ActionBlockerSystem>();
|
if (!_actionBlockerSystem.CanInteract(user) || ! _actionBlockerSystem.CanUse(user))
|
||||||
|
|
||||||
if (!actionBlocker.CanInteract(user) || ! actionBlocker.CanUse(user))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// all activates should only fire when in range / unobstructed
|
// all activates should only fire when in range / unobstructed
|
||||||
@@ -275,7 +275,7 @@ namespace Content.Server.Interaction
|
|||||||
if (!ValidateInteractAndFace(user, coordinates))
|
if (!ValidateInteractAndFace(user, coordinates))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Get<ActionBlockerSystem>().CanInteract(user))
|
if (!_actionBlockerSystem.CanInteract(user))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null
|
// Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null
|
||||||
@@ -344,7 +344,7 @@ namespace Content.Server.Interaction
|
|||||||
if (diff.LengthSquared <= 0.01f)
|
if (diff.LengthSquared <= 0.01f)
|
||||||
return;
|
return;
|
||||||
var diffAngle = Angle.FromWorldVec(diff);
|
var diffAngle = Angle.FromWorldVec(diff);
|
||||||
if (Get<ActionBlockerSystem>().CanChangeDirection(user))
|
if (_actionBlockerSystem.CanChangeDirection(user))
|
||||||
{
|
{
|
||||||
user.Transform.WorldRotation = diffAngle;
|
user.Transform.WorldRotation = diffAngle;
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ namespace Content.Server.Interaction
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task InteractUsing(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation)
|
public async Task InteractUsing(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation)
|
||||||
{
|
{
|
||||||
if (!Get<ActionBlockerSystem>().CanInteract(user))
|
if (!_actionBlockerSystem.CanInteract(user))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// all interactions should only happen when in range / unobstructed, so no range check is needed
|
// all interactions should only happen when in range / unobstructed, so no range check is needed
|
||||||
@@ -424,7 +424,7 @@ namespace Content.Server.Interaction
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void InteractHand(IEntity user, IEntity target)
|
public void InteractHand(IEntity user, IEntity target)
|
||||||
{
|
{
|
||||||
if (!Get<ActionBlockerSystem>().CanInteract(user))
|
if (!_actionBlockerSystem.CanInteract(user))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// all interactions should only happen when in range / unobstructed, so no range check is needed
|
// all interactions should only happen when in range / unobstructed, so no range check is needed
|
||||||
@@ -457,7 +457,7 @@ namespace Content.Server.Interaction
|
|||||||
/// <param name="used"></param>
|
/// <param name="used"></param>
|
||||||
public void TryUseInteraction(IEntity user, IEntity used)
|
public void TryUseInteraction(IEntity user, IEntity used)
|
||||||
{
|
{
|
||||||
if (user != null && used != null && Get<ActionBlockerSystem>().CanUse(user))
|
if (user != null && used != null && _actionBlockerSystem.CanUse(user))
|
||||||
{
|
{
|
||||||
UseInteraction(user, used);
|
UseInteraction(user, used);
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ namespace Content.Server.Interaction
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool TryThrowInteraction(IEntity user, IEntity item)
|
public bool TryThrowInteraction(IEntity user, IEntity item)
|
||||||
{
|
{
|
||||||
if (user == null || item == null || !Get<ActionBlockerSystem>().CanThrow(user)) return false;
|
if (user == null || item == null || !_actionBlockerSystem.CanThrow(user)) return false;
|
||||||
|
|
||||||
ThrownInteraction(user, item);
|
ThrownInteraction(user, item);
|
||||||
return true;
|
return true;
|
||||||
@@ -618,7 +618,7 @@ namespace Content.Server.Interaction
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool TryDroppedInteraction(IEntity user, IEntity item, bool intentional)
|
public bool TryDroppedInteraction(IEntity user, IEntity item, bool intentional)
|
||||||
{
|
{
|
||||||
if (user == null || item == null || !Get<ActionBlockerSystem>().CanDrop(user)) return false;
|
if (user == null || item == null || !_actionBlockerSystem.CanDrop(user)) return false;
|
||||||
|
|
||||||
DroppedInteraction(user, item, intentional);
|
DroppedInteraction(user, item, intentional);
|
||||||
return true;
|
return true;
|
||||||
@@ -726,7 +726,7 @@ namespace Content.Server.Interaction
|
|||||||
if (!ValidateInteractAndFace(user, coordinates))
|
if (!ValidateInteractAndFace(user, coordinates))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Get<ActionBlockerSystem>().CanAttack(user))
|
if (!_actionBlockerSystem.CanAttack(user))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IEntity? targetEnt = null;
|
IEntity? targetEnt = null;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
|
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||||
|
|
||||||
private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f);
|
private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f);
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ namespace Content.Server.Pointing.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EntitySystem.Get<ActionBlockerSystem>().CanChangeDirection(player))
|
if (_actionBlockerSystem.CanChangeDirection(player))
|
||||||
{
|
{
|
||||||
var diff = coords.ToMapPos(EntityManager) - player.Transform.MapPosition.Position;
|
var diff = coords.ToMapPos(EntityManager) - player.Transform.MapPosition.Position;
|
||||||
if (diff.LengthSquared > 0.01f)
|
if (diff.LengthSquared > 0.01f)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Notification.Managers;
|
|||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -17,6 +18,8 @@ namespace Content.Shared.Interaction
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class SharedInteractionSystem : EntitySystem
|
public class SharedInteractionSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SharedBroadphaseSystem _sharedBroadphaseSystem = default!;
|
||||||
|
|
||||||
public const float InteractionRange = 2;
|
public const float InteractionRange = 2;
|
||||||
public const float InteractionRangeSquared = InteractionRange * InteractionRange;
|
public const float InteractionRangeSquared = InteractionRange * InteractionRange;
|
||||||
|
|
||||||
@@ -46,7 +49,7 @@ namespace Content.Shared.Interaction
|
|||||||
|
|
||||||
predicate ??= _ => false;
|
predicate ??= _ => false;
|
||||||
var ray = new CollisionRay(origin.Position, dir.Normalized, collisionMask);
|
var ray = new CollisionRay(origin.Position, dir.Normalized, collisionMask);
|
||||||
var rayResults = Get<SharedBroadphaseSystem>().IntersectRayWithPredicate(origin.MapId, ray, dir.Length, predicate.Invoke, false).ToList();
|
var rayResults = _sharedBroadphaseSystem.IntersectRayWithPredicate(origin.MapId, ray, dir.Length, predicate.Invoke, false).ToList();
|
||||||
|
|
||||||
if (rayResults.Count == 0) return dir.Length;
|
if (rayResults.Count == 0) return dir.Length;
|
||||||
return (rayResults[0].HitPos - origin.Position).Length;
|
return (rayResults[0].HitPos - origin.Position).Length;
|
||||||
@@ -122,7 +125,7 @@ namespace Content.Shared.Interaction
|
|||||||
predicate ??= _ => false;
|
predicate ??= _ => false;
|
||||||
|
|
||||||
var ray = new CollisionRay(origin.Position, dir.Normalized, (int) collisionMask);
|
var ray = new CollisionRay(origin.Position, dir.Normalized, (int) collisionMask);
|
||||||
var rayResults = Get<SharedBroadphaseSystem>().IntersectRayWithPredicate(origin.MapId, ray, dir.Length, predicate.Invoke, false).ToList();
|
var rayResults = _sharedBroadphaseSystem.IntersectRayWithPredicate(origin.MapId, ray, dir.Length, predicate.Invoke, false).ToList();
|
||||||
|
|
||||||
if (rayResults.Count == 0) return true;
|
if (rayResults.Count == 0) return true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user