Revert "Update submodule (again)" (#7730)
This commit is contained in:
@@ -38,7 +38,6 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
SubscribeLocalEvent<DockingComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<DockingComponent, PowerChangedEvent>(OnPowerChange);
|
||||
SubscribeLocalEvent<DockingComponent, AnchorStateChangedEvent>(OnAnchorChange);
|
||||
SubscribeLocalEvent<DockingComponent, ReAnchorEvent>(OnDockingReAnchor);
|
||||
|
||||
SubscribeLocalEvent<DockingComponent, GetVerbsEvent<InteractionVerb>>(OnVerb);
|
||||
SubscribeLocalEvent<DockingComponent, BeforeDoorAutoCloseEvent>(OnAutoClose);
|
||||
@@ -257,16 +256,6 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDockingReAnchor(EntityUid uid, DockingComponent component, ref ReAnchorEvent args)
|
||||
{
|
||||
if (!component.Docked) return;
|
||||
|
||||
var other = Comp<DockingComponent>(component.DockedWith!.Value);
|
||||
|
||||
Undock(component);
|
||||
Dock(component, other);
|
||||
}
|
||||
|
||||
private void OnPowerChange(EntityUid uid, DockingComponent component, PowerChangedEvent args)
|
||||
{
|
||||
// This is because power can change during startup for <Reasons> and undock
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Shuttles.Components;
|
||||
using Content.Shared.CCVar;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
namespace Content.Server.Shuttles.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class ShuttleSystem : EntitySystem
|
||||
internal sealed class ShuttleSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly FixtureSystem _fixtures = default!;
|
||||
|
||||
public const float TileMassMultiplier = 0.5f;
|
||||
public const float TileMassMultiplier = 4f;
|
||||
|
||||
public float ShuttleMaxLinearSpeed;
|
||||
|
||||
@@ -73,15 +74,11 @@ namespace Content.Server.Shuttles.EntitySystems
|
||||
// Look this is jank but it's a placeholder until we design it.
|
||||
if (args.NewFixtures.Count == 0) return;
|
||||
|
||||
var manager = Comp<FixturesComponent>(args.NewFixtures[0].Body.Owner);
|
||||
|
||||
foreach (var fixture in args.NewFixtures)
|
||||
{
|
||||
_fixtures.SetMass(fixture, fixture.Area * TileMassMultiplier, manager, false);
|
||||
_fixtures.SetRestitution(fixture, 0.1f, manager, false);
|
||||
fixture.Mass = fixture.Area * TileMassMultiplier;
|
||||
fixture.Restitution = 0.1f;
|
||||
}
|
||||
|
||||
_fixtures.FixtureUpdate(manager, args.NewFixtures[0].Body);
|
||||
}
|
||||
|
||||
private void OnGridInit(GridInitializeEvent ev)
|
||||
|
||||
@@ -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