Remove obsolete transform call (#24217)
* Remove obsolete transform call Shrimple PR also fixed bad flatpack call that would break on non-standard tilesizes. * Update calls * weh
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Shared.Anomaly.Effects;
|
||||
using Content.Shared.Anomaly.Effects.Components;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Anomaly.Effects;
|
||||
@@ -13,10 +14,15 @@ public sealed class EntityAnomalySystem : SharedEntityAnomalySystem
|
||||
[Dependency] private readonly SharedAnomalySystem _anomaly = default!;
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
|
||||
SubscribeLocalEvent<EntitySpawnAnomalyComponent, AnomalyPulseEvent>(OnPulse);
|
||||
SubscribeLocalEvent<EntitySpawnAnomalyComponent, AnomalySupercriticalEvent>(OnSupercritical);
|
||||
SubscribeLocalEvent<EntitySpawnAnomalyComponent, AnomalyStabilityChangedEvent>(OnStabilityChanged);
|
||||
@@ -82,7 +88,7 @@ public sealed class EntityAnomalySystem : SharedEntityAnomalySystem
|
||||
private void SpawnEntities(Entity<EntitySpawnAnomalyComponent> anomaly, EntitySpawnSettingsEntry entry, float stability, float severity)
|
||||
{
|
||||
var xform = Transform(anomaly);
|
||||
if (!TryComp<MapGridComponent>(xform.GridUid, out var grid))
|
||||
if (!TryComp(xform.GridUid, out MapGridComponent? grid))
|
||||
return;
|
||||
|
||||
var tiles = _anomaly.GetSpawningPoints(anomaly, stability, severity, entry.Settings);
|
||||
@@ -91,7 +97,7 @@ public sealed class EntityAnomalySystem : SharedEntityAnomalySystem
|
||||
|
||||
foreach (var tileref in tiles)
|
||||
{
|
||||
Spawn(_random.Pick(entry.Spawns), tileref.GridIndices.ToEntityCoordinates(xform.GridUid.Value, _map));
|
||||
Spawn(_random.Pick(entry.Spawns), _mapSystem.ToCenterCoordinates(tileref, grid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
if(_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound))
|
||||
{
|
||||
var coordinates = tile.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager);
|
||||
var coordinates = _mapSystem.ToCenterCoordinates(tile.GridIndex, tile.GridIndices);
|
||||
_audio.PlayPvs(SpaceWindSound, coordinates, AudioParams.Default.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100)));
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
gridAtmosphere.Comp.UpdateCounter,
|
||||
tile.PressureDifference,
|
||||
tile.PressureDirection, 0,
|
||||
tile.PressureSpecificTarget?.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager) ?? EntityCoordinates.Invalid,
|
||||
tile.PressureSpecificTarget != null ? _mapSystem.ToCenterCoordinates(tile.GridIndex, tile.PressureSpecificTarget.GridIndices) : EntityCoordinates.Invalid,
|
||||
gridWorldRotation,
|
||||
xforms.GetComponent(entity),
|
||||
body);
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
public sealed partial class AtmosphereSystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
|
||||
private const int HotspotSoundCooldownCycles = 200;
|
||||
|
||||
private int _hotspotSoundCooldown = 0;
|
||||
@@ -81,7 +79,8 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
if (_hotspotSoundCooldown++ == 0 && !string.IsNullOrEmpty(HotspotSound))
|
||||
{
|
||||
var coordinates = tile.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager);
|
||||
var coordinates = _mapSystem.ToCenterCoordinates(tile.GridIndex, tile.GridIndices);
|
||||
|
||||
// A few details on the audio parameters for fire.
|
||||
// The greater the fire state, the lesser the pitch variation.
|
||||
// The greater the fire state, the greater the volume.
|
||||
|
||||
@@ -25,12 +25,14 @@ public sealed partial class AtmosphereSystem : SharedAtmosphereSystem
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLog = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly InternalsSystem _internals = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containers = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly GasTileOverlaySystem _gasTileOverlaySystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly TileSystem _tile = default!;
|
||||
[Dependency] private readonly MapSystem _map = default!;
|
||||
[Dependency] public readonly PuddleSystem Puddle = default!;
|
||||
|
||||
@@ -377,9 +377,9 @@ public abstract class SharedAnomalySystem : EntitySystem
|
||||
|
||||
var physQuery = GetEntityQuery<PhysicsComponent>();
|
||||
var resultList = new List<TileRef>();
|
||||
while (resultList.Count() < amount)
|
||||
while (resultList.Count < amount)
|
||||
{
|
||||
if (tilerefs.Count() == 0)
|
||||
if (tilerefs.Count == 0)
|
||||
break;
|
||||
|
||||
var tileref = _random.Pick(tilerefs);
|
||||
@@ -414,6 +414,7 @@ public abstract class SharedAnomalySystem : EntitySystem
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
resultList.Add(tileref);
|
||||
}
|
||||
return resultList;
|
||||
|
||||
@@ -67,8 +67,9 @@ public abstract class SharedFlatpackSystem : EntitySystem
|
||||
}
|
||||
|
||||
var buildPos = _map.TileIndicesFor(grid, gridComp, xform.Coordinates);
|
||||
var intersecting = _entityLookup.GetEntitiesIntersecting(buildPos.ToEntityCoordinates(grid, _mapManager).Offset(new Vector2(0.5f, 0.5f))
|
||||
, LookupFlags.Dynamic | LookupFlags.Static);
|
||||
var coords = _map.ToCenterCoordinates(grid, buildPos);
|
||||
|
||||
var intersecting = _entityLookup.GetEntitiesIntersecting(coords, LookupFlags.Dynamic | LookupFlags.Static);
|
||||
|
||||
// todo make this logic smarter.
|
||||
// This should eventually allow for shit like building microwaves on tables and such.
|
||||
|
||||
Reference in New Issue
Block a user