Cleaner BoundUserInterfaces (#17736)

This commit is contained in:
TemporalOroboros
2023-07-08 09:02:17 -07:00
committed by GitHub
parent 55b4fb1649
commit 3ac4cf85db
137 changed files with 1069 additions and 972 deletions

View File

@@ -13,12 +13,14 @@ namespace Content.Shared.Shuttles.Components
[NetworkedComponent]
public sealed class PilotComponent : Component
{
[ViewVariables] public SharedShuttleConsoleComponent? Console { get; set; }
[ViewVariables]
public EntityUid? Console { get; set; }
/// <summary>
/// Where we started piloting from to check if we should break from moving too far.
/// </summary>
[ViewVariables] public EntityCoordinates? Position { get; set; }
[ViewVariables]
public EntityCoordinates? Position { get; set; }
public const float BreakDistance = 0.25f;

View File

@@ -13,7 +13,7 @@ public sealed class RadarConsoleComponent : Component
set => IoCManager
.Resolve<IEntitySystemManager>()
.GetEntitySystem<SharedRadarConsoleSystem>()
.SetRange(this, value);
.SetRange(Owner, value, this);
}
[DataField("maxRange")]

View File

@@ -18,7 +18,9 @@ public abstract class SharedRadarConsoleSystem : EntitySystem
private void OnHandleState(EntityUid uid, RadarConsoleComponent component, ref ComponentHandleState args)
{
if (args.Current is not RadarConsoleComponentState state) return;
if (args.Current is not RadarConsoleComponentState state)
return;
component.MaxRange = state.Range;
}
@@ -30,14 +32,18 @@ public abstract class SharedRadarConsoleSystem : EntitySystem
};
}
protected virtual void UpdateState(RadarConsoleComponent component) {}
public void SetRange(RadarConsoleComponent component, float value)
protected virtual void UpdateState(EntityUid uid, RadarConsoleComponent component)
{
if (component.MaxRange.Equals(value)) return;
}
public void SetRange(EntityUid uid, float value, RadarConsoleComponent component)
{
if (component.MaxRange.Equals(value))
return;
component.MaxRange = value;
Dirty(component);
UpdateState(component);
Dirty(uid, component);
UpdateState(uid, component);
}
[Serializable, NetSerializable]

View File

@@ -1,5 +1,4 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Movement;
using Content.Shared.Movement.Events;
using Content.Shared.Shuttles.Components;
using Robust.Shared.Serialization;
@@ -43,8 +42,9 @@ namespace Content.Shared.Shuttles.Systems
{
if (component.LifeStage > ComponentLifeStage.Running)
return;
if (component.Console == null)
return;
if (component.Console == null) return;
args.Cancel();
}
}