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:
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -68,6 +68,7 @@ namespace Content.Shared.Actions.Components
|
||||
|
||||
protected override void Startup()
|
||||
{
|
||||
base.Startup();
|
||||
foreach (var actionType in InnateActions)
|
||||
{
|
||||
Grant(actionType);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Content.Shared.Body.Components
|
||||
|
||||
public SharedBodyPartComponent? CenterPart => CenterSlot?.Part;
|
||||
|
||||
public override void Initialize()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Content.Shared.Body.Components
|
||||
CalculateSpeed();
|
||||
}
|
||||
|
||||
public override void OnRemove()
|
||||
protected override void OnRemove()
|
||||
{
|
||||
foreach (var slot in SlotIds.Values)
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Content.Shared.Body.Mechanism
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Content.Shared.Chemistry.Solution.Components
|
||||
public bool CanRefill => Capabilities.HasCap(SolutionContainerCaps.Refillable);
|
||||
public bool CanDrain => Capabilities.HasCap(SolutionContainerCaps.Drainable);
|
||||
|
||||
public override void Initialize()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
UpdateAppearance();
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Shared.Damage.Components
|
||||
return SupportedTypes.Contains(type);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Shared.Inventory
|
||||
[DataField("Template")]
|
||||
private string _templateName = "HumanInventory"; //stored for serialization purposes
|
||||
|
||||
public override void Initialize()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Content.Shared.MobState.State
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemove()
|
||||
protected override void OnRemove()
|
||||
{
|
||||
if (Owner.TryGetComponent(out SharedAlertsComponent? status))
|
||||
{
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Content.Shared.Movement.Components
|
||||
public bool DiagonalMovementEnabled => _configurationManager.GetCVar<bool>(CCVars.GameDiagonalMovement);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Owner.EnsureComponentWarn<PhysicsComponent>();
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Content.Shared.Movement.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
if (!Owner.HasComponent<IMoverComponent>())
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Shared.Portal.Components
|
||||
{
|
||||
public override string Name => "Portal";
|
||||
|
||||
public override void OnAdd()
|
||||
protected override void OnAdd()
|
||||
{
|
||||
base.OnAdd();
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace Content.Shared.Pulling.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemove()
|
||||
protected override void OnRemove()
|
||||
{
|
||||
TryStopPull();
|
||||
MovingTo = null;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Content.Shared.Pulling.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemove()
|
||||
protected override void OnRemove()
|
||||
{
|
||||
if (Pulling != null &&
|
||||
Pulling.TryGetComponent(out SharedPullableComponent? pullable))
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Shared.SubFloor
|
||||
|
||||
SubscribeLocalEvent<SubFloorHideComponent, ComponentStartup>(OnSubFloorStarted);
|
||||
SubscribeLocalEvent<SubFloorHideComponent, ComponentShutdown>(OnSubFloorTerminating);
|
||||
SubscribeLocalEvent<SubFloorHideComponent, SnapGridPositionChangedEvent>(OnSnapGridPositionChanged);
|
||||
SubscribeLocalEvent<SubFloorHideComponent, AnchorStateChangedEvent>(HandleAnchorChanged);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
@@ -75,11 +75,13 @@ namespace Content.Shared.SubFloor
|
||||
UpdateEntity(uid);
|
||||
}
|
||||
|
||||
private void OnSnapGridPositionChanged(EntityUid uid, SubFloorHideComponent component, SnapGridPositionChangedEvent ev)
|
||||
private void HandleAnchorChanged(EntityUid uid, SubFloorHideComponent component, AnchorStateChangedEvent args)
|
||||
{
|
||||
var transform = ComponentManager.GetComponent<ITransformComponent>(uid);
|
||||
|
||||
// We do this directly instead of calling UpdateEntity.
|
||||
if(_mapManager.TryGetGrid(ev.NewGrid, out var grid))
|
||||
UpdateTile(grid, ev.Position);
|
||||
if(_mapManager.TryGetGrid(transform.GridID, out var grid))
|
||||
UpdateTile(grid, grid.TileIndicesFor(transform.Coordinates));
|
||||
}
|
||||
|
||||
private void MapManagerOnTileChanged(object? sender, TileChangedEventArgs e)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Shared.Tag
|
||||
|
||||
public IReadOnlySet<string> Tags => _tags;
|
||||
|
||||
public override void Initialize()
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user