Engine Entity Anchoring Changes (#4195)

* Converted all SnapGridPositionChangedEvent subscriptions to AnchorStateChangedEvent.

* Fixes power tests with new anchored requirements.

* Moved AnchorableComponent into construction.
AnchorableComponent now uses Transform.Anchored.

* Fixed bug with nodes, power works again.

* Adds lifetime stages to Component.

* Update Engine to v0.4.70.
This commit is contained in:
Acruid
2021-06-19 19:41:26 -07:00
committed by GitHub
parent 0ab7b3a5d2
commit 15fb554c28
187 changed files with 279 additions and 287 deletions

View File

@@ -12,7 +12,7 @@ namespace Content.Client.Animations
{
public override string Name => "AnimationsTest";
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -26,7 +26,7 @@ namespace Content.Client.CharacterInfo.Components
public Control Scene { get; private set; } = default!;
public UIPriority Priority => UIPriority.Info;
public override void OnAdd()
protected override void OnAdd()
{
base.OnAdd();

View File

@@ -36,7 +36,7 @@ namespace Content.Client.CharacterInterface
/// <summary>
/// Create the window with all character UIs and bind it to a keypress
/// </summary>
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -54,7 +54,7 @@ namespace Content.Client.CharacterInterface
/// <summary>
/// Dispose of window and the keypress binding
/// </summary>
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();

View File

@@ -52,7 +52,7 @@ namespace Content.Client.Clothing
}
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
ClothingEquippedPrefix = ClothingEquippedPrefix;

View File

@@ -50,7 +50,7 @@ namespace Content.Client.Cuffs.Components
}
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();

View File

@@ -33,13 +33,13 @@ namespace Content.Client.DoAfter
}
}
public override void OnAdd()
protected override void OnAdd()
{
base.OnAdd();
Enable();
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
Disable();

View File

@@ -72,14 +72,14 @@ namespace Content.Client.Hands
return GetHand(handName)?.Entity;
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
_gui?.Dispose();
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -201,6 +201,7 @@ namespace Content.Client.Hands
protected override void Startup()
{
base.Startup();
ActiveIndex = _hands.LastOrDefault()?.Name;
}

View File

@@ -59,7 +59,7 @@ namespace Content.Client.IconSmoothing
/// </summary>
internal int UpdateGeneration { get; set; }
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -263,7 +263,7 @@ namespace Content.Client.IconSmoothing
}
}
public void SnapGridOnPositionChanged()
public void AnchorStateChanged()
{
if (Owner.Transform.Anchored)
{

View File

@@ -25,8 +25,7 @@ namespace Content.Client.IconSmoothing
base.Initialize();
SubscribeLocalEvent<IconSmoothDirtyEvent>(HandleDirtyEvent);
SubscribeLocalEvent<IconSmoothComponent, SnapGridPositionChangedEvent>(HandleSnapGridMove);
SubscribeLocalEvent<IconSmoothComponent, AnchorStateChangedEvent>(HandleAnchorChanged);
}
public override void FrameUpdate(float frameTime)
@@ -92,9 +91,9 @@ namespace Content.Client.IconSmoothing
}
}
private static void HandleSnapGridMove(EntityUid uid, IconSmoothComponent component, SnapGridPositionChangedEvent args)
private static void HandleAnchorChanged(EntityUid uid, IconSmoothComponent component, AnchorStateChangedEvent args)
{
component.SnapGridOnPositionChanged();
component.AnchorStateChanged();
}
private void AddValidEntities(IEnumerable<EntityUid> candidates)

View File

@@ -196,7 +196,7 @@ namespace Content.Client.Instruments
}
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
IoCManager.InjectDependencies(this);

View File

@@ -37,7 +37,7 @@ namespace Content.Client.Inventory
[ViewVariables]
[DataField("speciesId")] public string? SpeciesId { get; set; }
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
@@ -48,7 +48,7 @@ namespace Content.Client.Inventory
InterfaceController?.Dispose();
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -10,7 +10,7 @@ namespace Content.Client.Singularity.Components
private SpriteComponent? _spriteComponent;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -96,7 +96,7 @@ namespace Content.Client.Sound
}
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
SoundSystem.OcclusionCollisionMask = (int) CollisionGroup.Impassable;

View File

@@ -17,13 +17,13 @@ namespace Content.Client.Spawners
private readonly List<IEntity> _entity = new();
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
SpawnEntities();
}
public override void OnRemove()
protected override void OnRemove()
{
RemoveEntities();
base.OnRemove();

View File

@@ -33,7 +33,7 @@ namespace Content.Client.Storage
public override IReadOnlyList<IEntity> StoredEntities => _storedEntities;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -41,14 +41,14 @@ namespace Content.Client.Storage
ChangeStorageVisualization(SharedBagState.Close);
}
public override void OnAdd()
protected override void OnAdd()
{
base.OnAdd();
_window = new StorageWindow(this) {Title = Owner.Name};
}
public override void OnRemove()
protected override void OnRemove()
{
_window?.Dispose();
base.OnRemove();

View File

@@ -128,7 +128,7 @@ namespace Content.Client.Suspicion
}
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();

View File

@@ -17,7 +17,7 @@ namespace Content.Client.Weapons.Melee.Components
private SpriteComponent? _sprite;
private Angle _baseAngle;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -21,7 +21,7 @@ namespace Content.Client.Window
private ISpriteComponent? _sprite;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -64,7 +64,7 @@ namespace Content.Client.Window
}
}
public void SnapGridOnPositionChanged()
public void AnchorStateChanged()
{
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new WindowSmoothDirtyEvent(Owner));
}

View File

@@ -14,7 +14,7 @@ namespace Content.Client.Window
base.Initialize();
SubscribeLocalEvent<WindowSmoothDirtyEvent>(HandleDirtyEvent);
SubscribeLocalEvent<WindowComponent, SnapGridPositionChangedEvent>(HandleSnapGridMove);
SubscribeLocalEvent<WindowComponent, AnchorStateChangedEvent>(HandleAnchorChanged);
}
private void HandleDirtyEvent(WindowSmoothDirtyEvent ev)
@@ -25,9 +25,9 @@ namespace Content.Client.Window
}
}
private static void HandleSnapGridMove(EntityUid uid, WindowComponent component, SnapGridPositionChangedEvent args)
private static void HandleAnchorChanged(EntityUid uid, WindowComponent component, AnchorStateChangedEvent args)
{
component.SnapGridOnPositionChanged();
component.AnchorStateChanged();
}
public override void FrameUpdate(float frameTime)

View File

@@ -9,6 +9,7 @@ using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
namespace Content.IntegrationTests.Tests
@@ -29,15 +30,15 @@ namespace Content.IntegrationTests.Tests
- type: PowerSupplier
supplyRate: 3000
- type: Anchorable
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: entity
name: ConsumerDummy
id: ConsumerDummy
components:
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: NodeContainer
nodes:
input:
@@ -68,8 +69,8 @@ namespace Content.IntegrationTests.Tests
voltage: Medium
- type: BatteryDischarger
activeSupplyRate: 1000
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: entity
name: ApcDummy
@@ -94,8 +95,8 @@ namespace Content.IntegrationTests.Tests
output:
!type:AdjacentNode
nodeGroupID: Apc
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: UserInterface
interfaces:
- key: enum.ApcUiKey.Key
@@ -119,16 +120,16 @@ namespace Content.IntegrationTests.Tests
voltage: Apc
- type: Wire
wireType: Apc
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
- type: entity
name: PowerReceiverDummy
id: PowerReceiverDummy
components:
- type: PowerReceiver
- type: SnapGrid
offset: Center
- type: Transform
anchored: true
";
[Test]
public async Task PowerNetTest()
@@ -147,6 +148,11 @@ namespace Content.IntegrationTests.Tests
mapMan.CreateMap(new MapId(1));
var grid = mapMan.CreateGrid(new MapId(1));
// Power only works when anchored
grid.SetTile(new Vector2i(0, 0), new Tile(1));
grid.SetTile(new Vector2i(0, 1), new Tile(1));
grid.SetTile(new Vector2i(0, 2), new Tile(1));
var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
var consumerEnt1 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
var consumerEnt2 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
@@ -197,6 +203,11 @@ namespace Content.IntegrationTests.Tests
mapMan.CreateMap(new MapId(1));
var grid = mapMan.CreateGrid(new MapId(1));
// Power only works when anchored
grid.SetTile(new Vector2i(0, 0), new Tile(1));
grid.SetTile(new Vector2i(0, 1), new Tile(1));
grid.SetTile(new Vector2i(0, 2), new Tile(1));
var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
var substationEnt = entityMan.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1));
var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2));
@@ -245,6 +256,11 @@ namespace Content.IntegrationTests.Tests
mapMan.CreateMap(mapId);
var grid = mapMan.CreateGrid(mapId);
// Power only works when anchored
grid.SetTile(new Vector2i(0, 0), new Tile(1));
grid.SetTile(new Vector2i(0, 1), new Tile(1));
grid.SetTile(new Vector2i(0, 2), new Tile(1));
var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 0));
var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCableDummy", grid.ToCoordinates(0, 1));
var powerReceiverEnt = entityMan.SpawnEntity("PowerReceiverDummy", grid.ToCoordinates(0, 2));

View File

@@ -32,7 +32,7 @@ namespace Content.Server.AI.Components
}
/// <inheritdoc />
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -79,7 +79,7 @@ namespace Content.Server.AI.Utility.AiLogic
}
}*/
public override void Initialize()
protected override void Initialize()
{
if (BehaviorSets.Count > 0)
{
@@ -94,7 +94,7 @@ namespace Content.Server.AI.Utility.AiLogic
_planner = EntitySystem.Get<AiActionSystem>();
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
var currentOp = CurrentAction?.ActionOperators.Peek();

View File

@@ -41,7 +41,7 @@ namespace Content.Server.AME.Components
private ContainerSlot _jarSlot = default!;
[ViewVariables] private bool HasJar => _jarSlot.ContainedEntity != null;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -32,7 +32,7 @@ namespace Content.Server.AME.Components
set => _maxFuelAmount = value;
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
_maxFuelAmount = 1000;

View File

@@ -19,7 +19,7 @@ namespace Content.Server.AME.Components
private AppearanceComponent? _appearance;
private PointLightComponent? _pointLight;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
Owner.TryGetComponent(out _appearance);

View File

@@ -53,7 +53,7 @@ namespace Content.Server.APC.Components
[ComponentDependency] private AccessReader? _accessReader = null;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -107,7 +107,7 @@ namespace Content.Server.Access.Components
return Array.Empty<string>();
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -62,7 +62,7 @@ namespace Content.Server.Access.Components
: Loc.GetString("{0}'s ID card{1}", FullName, jobSuffix);
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
// ReSharper disable once ConstantNullCoalescingCondition

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Access.Components
private bool PrivilegedIDEmpty => _privilegedIdContainer.ContainedEntities.Count < 1;
private bool TargetIDEmpty => _targetIdContainer.ContainedEntities.Count < 1;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -40,7 +40,7 @@ namespace Content.Server.Advertise
private List<string> _advertisements = new();
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -80,7 +80,7 @@ namespace Content.Server.Advertise
RefreshTimer(false);
}
public override void OnRemove()
protected override void OnRemove()
{
_cancellationSource.Cancel();
_cancellationSource.Dispose();

View File

@@ -27,7 +27,7 @@ namespace Content.Server.Alert
}
}
public override void OnRemove()
protected override void OnRemove()
{
if (EntitySystem.TryGet<WeightlessSystem>(out var weightlessSystem))
{

View File

@@ -104,7 +104,7 @@ namespace Content.Server.Arcade.Components
UserInterface?.SendMessage(new BlockGameMessages.BlockGameUserStatusMessage(_player == session), session);
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
if (UserInterface != null)

View File

@@ -76,7 +76,7 @@ namespace Content.Server.Arcade.Components
}
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -73,7 +73,7 @@ namespace Content.Server.Atmos.Components
[ViewVariables]
public bool FixVacuum => _fixVacuum;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -137,14 +137,17 @@ namespace Content.Server.Atmos.Components
}
}
public void OnSnapGridMove(SnapGridPositionChangedEvent ev)
public void AnchorStateChanged()
{
// Invalidate old position.
InvalidatePosition(ev.OldGrid, ev.OldPosition);
var gridId = Owner.Transform.GridID;
var coords = Owner.Transform.Coordinates;
var grid = _mapManager.GetGrid(gridId);
var tilePos = grid.TileIndicesFor(coords);
// Update and invalidate new position.
_lastPosition = (ev.NewGrid, ev.Position);
InvalidatePosition(ev.NewGrid, ev.Position);
_lastPosition = (gridId, tilePos);
InvalidatePosition(gridId, tilePos);
}
private void UpdatePosition()

View File

@@ -27,7 +27,7 @@ namespace Content.Server.GameObjects.Components
UserInterfaceKey = key;
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Components
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GasAnalyzerUiKey.Key);
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -124,7 +124,7 @@ namespace Content.Server.Atmos.Components
[DataField("tank")]
public string TankName { get; set; } = "tank";
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
_userInterface = Owner.GetUIOrNull(SharedGasTankUiKey.Key);

View File

@@ -203,7 +203,7 @@ namespace Content.Server.Atmos.Components
_tiles = tiles;
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -234,7 +234,7 @@ namespace Content.Server.Atmos.Components
RepopulateTiles();
}
public override void OnAdd()
protected override void OnAdd()
{
base.OnAdd();

View File

@@ -9,13 +9,13 @@ namespace Content.Server.Atmos.EntitySystems
{
public override void Initialize()
{
SubscribeLocalEvent<AirtightComponent, SnapGridPositionChangedEvent>(OnAirtightPositionChanged);
SubscribeLocalEvent<AirtightComponent, AnchorStateChangedEvent>(OnAirtightPositionChanged);
SubscribeLocalEvent<AirtightComponent, RotateEvent>(OnAirtightRotated);
}
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent component, SnapGridPositionChangedEvent args)
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent component, AnchorStateChangedEvent args)
{
component.OnSnapGridMove(args);
component.AnchorStateChanged();
}
private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, RotateEvent ev)

View File

@@ -1,5 +1,5 @@
using Content.Server.Anchor;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Construction.Components;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Server.NodeContainer;
using Content.Shared.Atmos;

View File

@@ -1,7 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using Content.Server.Anchor;
using Content.Server.Atmos.Piping.Binary.Components;
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.Construction.Components;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Server.NodeContainer;
using Content.Shared.Atmos.Piping.Unary.Components;

View File

@@ -76,7 +76,7 @@ namespace Content.Server.BarSign
Owner.Description = prototype.Description;
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -38,7 +38,7 @@ namespace Content.Server.Battery.Components
[ViewVariables] public BatteryState BatteryState { get; private set; }
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
UpdateStorageState();

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Body
part.Owner.RandomOffset(0.25f);
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -41,7 +41,7 @@ namespace Content.Server.Body.Circulatory
[ViewVariables] public SolutionContainerComponent Solution => _internalSolution;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Body.Mechanism
{
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SurgeryUIKey.Key);
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -56,7 +56,7 @@ namespace Content.Server.Body.Part
mechanism.Owner.RandomOffset(0.25f);
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Body.Scanner
UserInterface?.Open(session);
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -145,7 +145,7 @@ namespace Content.Server.Body.Surgery.Components
}
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -120,7 +120,7 @@ namespace Content.Server.Botany.Components
[ComponentDependency] private readonly SolutionContainerComponent? _solutionContainer = default!;
[ComponentDependency] private readonly AppearanceComponent? _appearanceComponent = default!;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -388,7 +388,7 @@ namespace Content.Server.Buckle.Components
UpdateBuckleStatus();
}
public override void OnRemove()
protected override void OnRemove()
{
BuckledTo?.Remove(this);
TryUnbuckle(Owner, true);

View File

@@ -132,7 +132,7 @@ namespace Content.Server.Buckle.Components
}
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();

View File

@@ -64,7 +64,7 @@ namespace Content.Server.Cargo.Components
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CargoConsoleUiKey.Key);
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -80,7 +80,7 @@ namespace Content.Server.Cargo.Components
BankAccount = _cargoConsoleSystem.StationAccount;
}
public override void OnRemove()
protected override void OnRemove()
{
if (UserInterface != null)
{

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Cargo.Components
public CargoOrderDatabase? Database { get; set; }
public bool ConnectedToDatabase => Database != null;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -22,7 +22,7 @@ namespace Content.Server.CharacterAppearance.Components
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MagicMirrorUiKey.Key);
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -32,7 +32,7 @@ namespace Content.Server.CharacterAppearance.Components
}
}
public override void OnRemove()
protected override void OnRemove()
{
if (UserInterface != null)
{

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Chemistry.Components
/// Called once per instance of this component. Gets references to any other components needed
/// by this component and initializes it's UI and other data.
/// </summary>
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -26,7 +26,7 @@ namespace Content.Server.Chemistry.Components
[DataField("transferEfficiency")]
private float _transferEfficiency = 1f;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
_solutionContainer = Owner.EnsureComponent<SolutionContainerComponent>();

View File

@@ -29,7 +29,7 @@ namespace Content.Server.Chemistry.Components
[ComponentDependency] private readonly SolutionContainerComponent? _solution = default!;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Chemistry.Components
[ViewVariables]
private SolutionContainerComponent _contents = default!;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -59,7 +59,7 @@ namespace Content.Server.Chemistry.Components
/// Called once per instance of this component. Gets references to any other components needed
/// by this component and initializes it's UI and other data.
/// </summary>
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -171,7 +171,7 @@ namespace Content.Server.Chemistry.Components
protected abstract void UpdateVisuals();
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
Inception?.Remove(this);

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Chemistry.Components
public bool Transformed { get; private set; }
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -34,7 +34,7 @@ namespace Content.Server.Chemistry.Components
private bool _running;
private float _aliveTime;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -30,7 +30,7 @@ namespace Content.Server.Climbing.Components
[DataField("delay")]
private float _climbDelay = 0.8f;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -43,7 +43,7 @@ namespace Content.Server.Cloning.Components
[ViewVariables]
public CloningPodStatus Status;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -58,7 +58,7 @@ namespace Content.Server.Cloning.Components
EntitySystem.Get<CloningSystem>().UpdateUserInterface(this);
}
public override void OnRemove()
protected override void OnRemove()
{
if (UserInterface != null)
{

View File

@@ -35,7 +35,7 @@ namespace Content.Server.Communications
public TimeSpan AnnounceCooldown { get; } = TimeSpan.FromSeconds(90);
private CancellationTokenSource _announceCooldownEndedTokenSource = new();
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -76,7 +76,7 @@ namespace Content.Server.Communications
return _gameTiming.CurTime >= LastAnnounceTime + AnnounceCooldown;
}
public override void OnRemove()
protected override void OnRemove()
{
RoundEndSystem.OnRoundEndCountdownStarted -= UpdateBoundInterface;
RoundEndSystem.OnRoundEndCountdownCancelled -= UpdateBoundInterface;

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Computer
[DataField("board")]
private string? _boardPrototype;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -47,7 +47,7 @@ namespace Content.Server.Configurable
}
}
public override void OnAdd()
protected override void OnAdd()
{
base.OnAdd();
if (UserInterface != null)
@@ -56,7 +56,7 @@ namespace Content.Server.Configurable
}
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
if (UserInterface != null)

View File

@@ -11,7 +11,7 @@ using Robust.Shared.Physics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Anchor
namespace Content.Server.Construction.Components
{
// TODO: Move this component's logic to an EntitySystem.
[RegisterComponent]
@@ -19,8 +19,6 @@ namespace Content.Server.Anchor
{
public override string Name => "Anchorable";
[ComponentDependency] private PhysicsComponent? _physicsComponent = default!;
[ViewVariables]
[DataField("tool")]
public ToolQuality Tool { get; private set; } = ToolQuality.Anchoring;
@@ -74,9 +72,6 @@ namespace Content.Server.Anchor
return false;
}
if (_physicsComponent == null)
return false;
// Snap rotation to cardinal (multiple of 90)
var rot = Owner.Transform.LocalRotation;
Owner.Transform.LocalRotation = Math.Round(rot / (Math.PI / 2)) * (Math.PI / 2);
@@ -94,7 +89,7 @@ namespace Content.Server.Anchor
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new BeforeAnchoredEvent(user, utilizing), false);
_physicsComponent.BodyType = BodyType.Static;
Owner.Transform.Anchored = true;
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new AnchoredEvent(user, utilizing), false);
@@ -115,12 +110,9 @@ namespace Content.Server.Anchor
return false;
}
if (_physicsComponent == null)
return false;
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new BeforeUnanchoredEvent(user, utilizing), false);
_physicsComponent.BodyType = BodyType.Dynamic;
Owner.Transform.Anchored = false;
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new UnanchoredEvent(user, utilizing), false);
@@ -135,10 +127,7 @@ namespace Content.Server.Anchor
/// <returns>true if toggled, false otherwise</returns>
public async Task<bool> TryToggleAnchor(IEntity user, IEntity utilizing)
{
if (_physicsComponent == null)
return false;
return _physicsComponent.BodyType == BodyType.Static ?
return Owner.Transform.Anchored ?
await TryUnAnchor(user, utilizing) :
await TryAnchor(user, utilizing);
}

View File

@@ -464,7 +464,7 @@ namespace Content.Server.Construction.Components
return _containers.Add(id);
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -18,7 +18,7 @@ namespace Content.Server.Construction.Components
private Container _boardContainer = default!;
private Container _partContainer = default!;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -107,7 +107,7 @@ namespace Content.Server.Construction.Components
public IReadOnlyDictionary<string, GenericPartInfo> TagRequirements => _tagRequirements;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Crayon
Color = Color.FromName(_color);
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
if (UserInterface != null)

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Cuffs.Components
private bool _uncuffing;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -25,7 +25,7 @@ namespace Content.Server.Destructible
public IReadOnlyList<Threshold> Thresholds => _thresholds;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -5,7 +5,7 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Content.Server.Anchor;
using Content.Server.Construction.Components;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Connections;
using Content.Server.Disposal.Tube.Components;
@@ -555,7 +555,7 @@ namespace Content.Server.Disposal.Mailing
}
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -584,7 +584,7 @@ namespace Content.Server.Disposal.Mailing
UpdateInterface();
}
public override void OnRemove()
protected override void OnRemove()
{
if (_container != null)
{

View File

@@ -54,7 +54,7 @@ namespace Content.Server.Disposal.Tube.Components
return Owner.Transform.LocalRotation.GetDir();
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -177,7 +177,7 @@ namespace Content.Server.Disposal.Tube.Components
}
}
public override void OnRemove()
protected override void OnRemove()
{
UserInterface?.CloseAll();
base.OnRemove();

View File

@@ -45,7 +45,7 @@ namespace Content.Server.Disposal.Tube.Components
return base.NextDirection(holder);
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -143,7 +143,7 @@ namespace Content.Server.Disposal.Tube.Components
}
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
UserInterface?.CloseAll();

View File

@@ -1,7 +1,7 @@
#nullable enable
using System;
using System.Linq;
using Content.Server.Anchor;
using Content.Server.Construction.Components;
using Content.Server.Disposal.Unit.Components;
using Content.Shared.Acts;
using Content.Shared.Disposal.Components;
@@ -224,7 +224,7 @@ namespace Content.Server.Disposal.Tube.Components
UpdateVisualState();
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -246,7 +246,7 @@ namespace Content.Server.Disposal.Tube.Components
UpdateVisualState();
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();

View File

@@ -58,14 +58,14 @@ namespace Content.Server.Disposal.Unit.Components
[DataField("air")]
public GasMixture Air { get; set; } = new GasMixture(Atmospherics.CellVolume);
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
_contents = ContainerHelpers.EnsureContainer<Container>(Owner, nameof(DisposalHolderComponent));
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
ExitDisposals();

View File

@@ -4,9 +4,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Content.Server.Anchor;
using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Construction.Components;
using Content.Server.Disposal.Tube.Components;
using Content.Server.DoAfter;
using Content.Server.Hands.Components;
@@ -487,7 +487,7 @@ namespace Content.Server.Disposal.Unit.Components
}
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -514,7 +514,7 @@ namespace Content.Server.Disposal.Unit.Components
UpdateInterface();
}
public override void OnRemove()
protected override void OnRemove()
{
foreach (var entity in _container.ContainedEntities.ToArray())
{

View File

@@ -103,7 +103,7 @@ namespace Content.Server.Doors.Components
[ViewVariables(VVAccess.ReadWrite)]
private bool _safety = true;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -169,7 +169,7 @@ namespace Content.Server.Doors.Components
CreateDoorElectronicsBoard();
}
public override void OnRemove()
protected override void OnRemove()
{
_stateChangeCancelTokenSource?.Cancel();
_autoCloseCancelTokenSource?.Cancel();

View File

@@ -67,8 +67,7 @@ namespace Content.Server.Explosion.Components
return true;
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Explosion.Components
{
public override string Name => "ExplosiveProjectile";
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Flash.Components
private bool _flashed;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
// Shouldn't be using this without a ProjectileComponent because it will just immediately collide with thrower

View File

@@ -46,7 +46,7 @@ namespace Content.Server.Fluids.Components
private string? _sound = "/Audio/Effects/Fluids/watersplash.ogg";
/// <inheritdoc />
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
Owner.EnsureComponentWarn<SolutionContainerComponent>();

View File

@@ -63,7 +63,7 @@ namespace Content.Server.Fluids.Components
[DataField("speed")]
private float _mopSpeed = 1;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -110,7 +110,7 @@ namespace Content.Server.Fluids.Components
private bool Slippery => Owner.TryGetComponent(out SlipperyComponent? slippery) && slippery.Slippery;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -82,7 +82,7 @@ namespace Content.Server.Fluids.Components
public ReagentUnit CurrentVolume => Owner.GetComponentOrNull<SolutionContainerComponent>()?.CurrentVolume ?? ReagentUnit.Zero;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -41,7 +41,7 @@ namespace Content.Server.Ghost.Roles.Components
[ViewVariables]
public uint Identifier { get; set; }
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -57,7 +57,7 @@ namespace Content.Server.Gravity
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GravityGeneratorUiKey.Key);
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -41,7 +41,7 @@ namespace Content.Server.Headset
public bool RadioRequested { get; set; }
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -162,7 +162,7 @@ namespace Content.Server.Instruments
Clean();
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Inventory.Components
private InventoryComponent _inventory = default!;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Inventory.Components
public event Action? OnItemChanged;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -152,7 +152,7 @@ namespace Content.Server.Inventory.Components
return !TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out ItemComponent? shoes) || EffectBlockerSystem.CanSlip(shoes.Owner);
}
public override void OnRemove()
protected override void OnRemove()
{
var slots = _slotContainers.Keys.ToList();

View File

@@ -79,7 +79,7 @@ namespace Content.Server.Kitchen.Components
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MicrowaveUiKey.Key);
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -68,7 +68,7 @@ namespace Content.Server.Kitchen.Components
[ViewVariables(VVAccess.ReadWrite)] [DataField("chamberCapacity")] private int _storageCap = 16;
[ViewVariables(VVAccess.ReadWrite)] [DataField("workTime")] private int _workTime = 3500; //3.5 seconds, completely arbitrary for now.
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
//A slot for the beaker where the grounds/juices will go.
@@ -98,7 +98,7 @@ namespace Content.Server.Kitchen.Components
}
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
if (UserInterface != null)

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Lathe.Components
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(LatheUiKey.Key);
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -37,7 +37,7 @@ namespace Content.Server.Light.Components
return TryActivate();
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

Some files were not shown because too many files have changed in this diff Show More