Revert "Update submodule (again)" (#7730)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Content.Server.Audio;
|
||||
using Content.Server.Damage.Systems;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Shuttles.Components;
|
||||
using Content.Shared.Damage;
|
||||
@@ -11,7 +14,11 @@ using Content.Shared.Physics;
|
||||
using Content.Shared.Temperature;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
@@ -22,7 +29,6 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
public sealed class ThrusterSystem : EntitySystem
|
||||
{
|
||||
[Robust.Shared.IoC.Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Robust.Shared.IoC.Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
|
||||
[Robust.Shared.IoC.Dependency] private readonly AmbientSoundSystem _ambient = default!;
|
||||
[Robust.Shared.IoC.Dependency] private readonly FixtureSystem _fixtureSystem = default!;
|
||||
[Robust.Shared.IoC.Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
@@ -46,7 +52,6 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
SubscribeLocalEvent<ThrusterComponent, ComponentShutdown>(OnThrusterShutdown);
|
||||
SubscribeLocalEvent<ThrusterComponent, PowerChangedEvent>(OnPowerChange);
|
||||
SubscribeLocalEvent<ThrusterComponent, AnchorStateChangedEvent>(OnAnchorChange);
|
||||
SubscribeLocalEvent<ThrusterComponent, ReAnchorEvent>(OnThrusterReAnchor);
|
||||
SubscribeLocalEvent<ThrusterComponent, RotateEvent>(OnRotate);
|
||||
SubscribeLocalEvent<ThrusterComponent, IsHotEvent>(OnIsHotEvent);
|
||||
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
|
||||
@@ -99,12 +104,9 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
private void OnTileChange(object? sender, TileChangedEventArgs e)
|
||||
{
|
||||
// If the old tile was space but the new one isn't then disable all adjacent thrusters
|
||||
if (e.NewTile.IsSpace(_tileDefManager) || !e.OldTile.IsSpace(_tileDefManager)) return;
|
||||
if (e.NewTile.IsSpace() || !e.OldTile.IsSpace()) return;
|
||||
|
||||
var tilePos = e.NewTile.GridIndices;
|
||||
var grid = _mapManager.GetGrid(e.NewTile.GridIndex);
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var thrusterQuery = GetEntityQuery<ThrusterComponent>();
|
||||
|
||||
for (var x = -1; x <= 1; x++)
|
||||
{
|
||||
@@ -113,19 +115,17 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
if (x != 0 && y != 0) continue;
|
||||
|
||||
var checkPos = tilePos + new Vector2i(x, y);
|
||||
var enumerator = grid.GetAnchoredEntitiesEnumerator(checkPos);
|
||||
|
||||
while (enumerator.MoveNext(out var ent))
|
||||
foreach (var ent in _mapManager.GetGrid(e.NewTile.GridIndex).GetAnchoredEntities(checkPos))
|
||||
{
|
||||
if (!thrusterQuery.TryGetComponent(ent.Value, out var thruster) || !thruster.RequireSpace) continue;
|
||||
if (!EntityManager.TryGetComponent(ent, out ThrusterComponent? thruster) || !thruster.RequireSpace) continue;
|
||||
|
||||
// Work out if the thruster is facing this direction
|
||||
var xform = xformQuery.GetComponent(ent.Value);
|
||||
var direction = xform.LocalRotation.ToWorldVec();
|
||||
var direction = EntityManager.GetComponent<TransformComponent>(ent).LocalRotation.ToWorldVec();
|
||||
|
||||
if (new Vector2i((int) direction.X, (int) direction.Y) != new Vector2i(x, y)) continue;
|
||||
|
||||
DisableThruster(ent.Value, thruster, xform.GridID);
|
||||
DisableThruster(ent, thruster);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,14 +195,6 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThrusterReAnchor(EntityUid uid, ThrusterComponent component, ref ReAnchorEvent args)
|
||||
{
|
||||
DisableThruster(uid, component, args.OldGrid);
|
||||
|
||||
if (CanEnable(uid, component))
|
||||
EnableThruster(uid, component);
|
||||
}
|
||||
|
||||
private void OnThrusterInit(EntityUid uid, ThrusterComponent component, ComponentInit args)
|
||||
{
|
||||
_ambient.SetAmbience(uid, false);
|
||||
@@ -300,20 +292,14 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
_ambient.SetAmbience(uid, true);
|
||||
}
|
||||
|
||||
public void DisableThruster(EntityUid uid, ThrusterComponent component, TransformComponent? xform = null, Angle? angle = null)
|
||||
{
|
||||
if (!Resolve(uid, ref xform)) return;
|
||||
DisableThruster(uid, component, xform.GridID, xform);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to disable the thruster.
|
||||
/// </summary>
|
||||
public void DisableThruster(EntityUid uid, ThrusterComponent component, GridId gridId, TransformComponent? xform = null, Angle? angle = null)
|
||||
public void DisableThruster(EntityUid uid, ThrusterComponent component, TransformComponent? xform = null, Angle? angle = null)
|
||||
{
|
||||
if (!component.IsOn ||
|
||||
!Resolve(uid, ref xform) ||
|
||||
!_mapManager.TryGetGrid(gridId, out var grid)) return;
|
||||
!_mapManager.TryGetGrid(xform.GridID, out var grid)) return;
|
||||
|
||||
component.IsOn = false;
|
||||
|
||||
@@ -365,7 +351,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
{
|
||||
if (!component.Enabled) return false;
|
||||
|
||||
var xform = Transform(uid);
|
||||
var xform = EntityManager.GetComponent<TransformComponent>(uid);
|
||||
|
||||
if (!xform.Anchored ||
|
||||
EntityManager.TryGetComponent(uid, out ApcPowerReceiverComponent? receiver) && !receiver.Powered)
|
||||
|
||||
Reference in New Issue
Block a user