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

@@ -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();

View File

@@ -57,7 +57,7 @@ namespace Content.Server.Light.Components
/// </summary>
private byte? _lastLevel;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
@@ -67,7 +67,7 @@ namespace Content.Server.Light.Components
Dirty();
}
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();
Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));

View File

@@ -110,7 +110,7 @@ namespace Content.Server.Light.Components
sprite.Color = Color;
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
UpdateColor();

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Light.Components
// bulbs that were inserted inside light replacer
[ViewVariables] private IContainer _insertedBulbs = default!;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
_insertedBulbs = ContainerHelpers.EnsureContainer<Container>(Owner, "light_replacer_storage");

View File

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

View File

@@ -11,7 +11,7 @@ namespace Content.Server.MachineLinking.Components
[ViewVariables]
public SignalTransmitterComponent? Link { get; set; }
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -19,7 +19,7 @@ namespace Content.Server.MachineLinking.Components
[DataField("on")]
private bool _on;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

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

View File

@@ -54,7 +54,7 @@ namespace Content.Server.Medical.Components
public bool IsOccupied => _bodyContainer.ContainedEntity != null;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Mind.Components
[ViewVariables] public Mind Mind { get; set; } = default!;
public override void OnRemove()
protected override void OnRemove()
{
base.OnRemove();

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Mining.Components
public override string Name => "AsteroidRock";
private static readonly string[] SpriteStates = {"0", "1", "2", "3", "4"};
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -35,7 +35,7 @@ namespace Content.Server.Morgue.Components
[ViewVariables] public ContainerSlot? LabelContainer { get; private set; }
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
_appearance?.SetData(BodyBagVisuals.Label, false);

View File

@@ -48,8 +48,7 @@ namespace Content.Server.Morgue.Components
[ViewVariables]
[ComponentDependency] protected readonly AppearanceComponent? Appearance = null;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
Appearance?.SetData(MorgueVisuals.Open, false);

View File

@@ -11,11 +11,11 @@ namespace Content.Server.NodeContainer.EntitySystems
{
base.Initialize();
SubscribeLocalEvent<NodeContainerComponent, PhysicsBodyTypeChangedEvent>(OnBodyTypeChanged);
SubscribeLocalEvent<NodeContainerComponent, AnchorStateChangedEvent>(OnAnchorStateChanged);
SubscribeLocalEvent<NodeContainerComponent, RotateEvent>(OnRotateEvent);
}
private void OnBodyTypeChanged(EntityUid uid, NodeContainerComponent component, PhysicsBodyTypeChangedEvent args)
private void OnAnchorStateChanged(EntityUid uid, NodeContainerComponent component, AnchorStateChangedEvent args)
{
component.AnchorUpdate();
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Content.Server.NodeContainer.NodeGroups;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
@@ -10,21 +10,6 @@ namespace Content.Server.NodeContainer.EntitySystems
{
private readonly HashSet<INodeGroup> _dirtyNodeGroups = new();
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<NodeContainerComponent, SnapGridPositionChangedEvent>(OnSnapGridPositionChanged);
}
private void OnSnapGridPositionChanged(EntityUid uid, NodeContainerComponent component, SnapGridPositionChangedEvent args)
{
foreach (var node in component.Nodes.Values)
{
node.OnSnapGridMove();
}
}
public void AddDirtyNodeGroup(INodeGroup nodeGroup)
{
_dirtyNodeGroups.Add(nodeGroup);

View File

@@ -29,7 +29,7 @@ namespace Content.Server.NodeContainer
[DataField("examinable")]
private bool _examinable = false;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
foreach (var node in _nodes.Values)
@@ -62,6 +62,7 @@ namespace Content.Server.NodeContainer
foreach (var node in Nodes.Values)
{
node.AnchorUpdate();
node.AnchorStateChanged();
}
}

View File

@@ -41,7 +41,7 @@ namespace Content.Server.NodeContainer.Nodes
/// </summary>
public bool Connectable => !_deleting && Anchored;
protected bool Anchored => !NeedAnchored || !Owner.TryGetComponent<IPhysBody>(out var physics) || physics.BodyType == BodyType.Static;
protected bool Anchored => !NeedAnchored || Owner.Transform.Anchored;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("needAnchored")]
@@ -76,7 +76,7 @@ namespace Content.Server.NodeContainer.Nodes
}
}
public virtual void OnSnapGridMove()
public virtual void AnchorStateChanged()
{
}

View File

@@ -125,11 +125,6 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
UpdateAdjacentConnectedDirections();
}
public override void OnSnapGridMove()
{
OnConnectedDirectionsNeedsUpdating();
}
public void JoinPipeNet(IPipeNet pipeNet)
{
_pipeNet = pipeNet;

View File

@@ -81,7 +81,7 @@ namespace Content.Server.Nutrition.Components
[DataField("burstSound")]
private string _burstSound = "/Audio/Effects/flash_bang.ogg";
public override void Initialize()
protected override void Initialize()
{
base.Initialize();

View File

@@ -54,7 +54,7 @@ namespace Content.Server.Nutrition.Components
}
}
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
Owner.EnsureComponentWarn<SolutionContainerComponent>();

View File

@@ -37,7 +37,7 @@ namespace Content.Server.Nutrition.Components
private int _count = 0;
public override void Initialize()
protected override void Initialize()
{
base.Initialize();
Owner.TryGetComponent(out _appearance);

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