Fix some comp dirty / appearance warnings (#13193)
* Fix some comp dirty / appearance warnings * also dis
This commit is contained in:
@@ -108,7 +108,7 @@ public abstract class AlertsSystem : EntitySystem
|
||||
|
||||
AfterClearAlert(alertsComponent);
|
||||
|
||||
alertsComponent.Dirty();
|
||||
Dirty(alertsComponent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -128,7 +128,7 @@ public abstract class AlertsSystem : EntitySystem
|
||||
|
||||
AfterClearAlert(alertsComponent);
|
||||
|
||||
alertsComponent.Dirty();
|
||||
Dirty(alertsComponent);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -210,7 +210,8 @@ public abstract class AlertsSystem : EntitySystem
|
||||
private void HandleClickAlert(ClickAlertEvent msg, EntitySessionEventArgs args)
|
||||
{
|
||||
var player = args.SenderSession.AttachedEntity;
|
||||
if (player is null || !EntityManager.TryGetComponent<AlertsComponent>(player, out var alertComp)) return;
|
||||
if (player is null || !EntityManager.HasComponent<AlertsComponent>(player))
|
||||
return;
|
||||
|
||||
if (!IsShowingAlert(player.Value, msg.Type))
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Shared.Electrocution
|
||||
return;
|
||||
|
||||
insulated.SiemensCoefficient = siemensCoefficient;
|
||||
insulated.Dirty();
|
||||
Dirty(insulated);
|
||||
}
|
||||
|
||||
private void OnInsulatedElectrocutionAttempt(EntityUid uid, InsulatedComponent insulated, ElectrocutionAttemptEvent args)
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Content.Shared.Eye.Blinding
|
||||
|
||||
component.IsActive = true;
|
||||
blur.Magnitude += component.VisionBonus;
|
||||
blur.Dirty();
|
||||
Dirty(blur);
|
||||
}
|
||||
|
||||
private void OnGlassesUnequipped(EntityUid uid, VisionCorrectionComponent component, GotUnequippedEvent args)
|
||||
@@ -91,7 +91,7 @@ namespace Content.Shared.Eye.Blinding
|
||||
return;
|
||||
component.IsActive = false;
|
||||
blur.Magnitude -= component.VisionBonus;
|
||||
blur.Dirty();
|
||||
Dirty(blur);
|
||||
}
|
||||
|
||||
private void OnGetState(EntityUid uid, BlurryVisionComponent component, ref ComponentGetState args)
|
||||
@@ -129,7 +129,8 @@ namespace Content.Shared.Eye.Blinding
|
||||
{
|
||||
var ev = new BlindnessChangedEvent(true);
|
||||
RaiseLocalEvent(uid, ev, false);
|
||||
} else if (blindable.Sources == 0 && oldSources > 0)
|
||||
}
|
||||
else if (blindable.Sources == 0 && oldSources > 0)
|
||||
{
|
||||
var ev = new BlindnessChangedEvent(false);
|
||||
RaiseLocalEvent(uid, ev, false);
|
||||
@@ -149,7 +150,7 @@ namespace Content.Shared.Eye.Blinding
|
||||
{
|
||||
var blurry = EnsureComp<BlurryVisionComponent>(uid);
|
||||
blurry.Magnitude = (9 - blindable.EyeDamage);
|
||||
blurry.Dirty();
|
||||
Dirty(blurry);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace Content.Shared.Follower;
|
||||
|
||||
public sealed class FollowerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -71,7 +73,7 @@ public sealed class FollowerSystem : EntitySystem
|
||||
followedComp.Following.Add(follower);
|
||||
|
||||
var xform = Transform(follower);
|
||||
xform.AttachParent(entity);
|
||||
_transform.SetParent(xform, entity);
|
||||
xform.LocalPosition = Vector2.Zero;
|
||||
xform.LocalRotation = Angle.Zero;
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Content.Shared.Jittering
|
||||
var jitter = EnsureComp<JitteringComponent>(uid);
|
||||
jitter.Amplitude = amplitude;
|
||||
jitter.Frequency = frequency;
|
||||
jitter.Dirty();
|
||||
Dirty(jitter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace Content.Shared.Localizations
|
||||
public sealed class ContentLocalizationManager
|
||||
{
|
||||
[Dependency] private readonly ILocalizationManager _loc = default!;
|
||||
[Dependency] private readonly IEntityManager _ent = default!;
|
||||
|
||||
// If you want to change your codebase's language, do it here.
|
||||
private const string Culture = "en-US";
|
||||
|
||||
@@ -12,20 +12,9 @@ namespace Content.Shared.Projectiles
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("impactEffect", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string? ImpactEffect;
|
||||
|
||||
private bool _ignoreShooter = true;
|
||||
public EntityUid Shooter { get; set; }
|
||||
|
||||
public bool IgnoreShooter
|
||||
{
|
||||
get => _ignoreShooter;
|
||||
set
|
||||
{
|
||||
if (_ignoreShooter == value) return;
|
||||
|
||||
_ignoreShooter = value;
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
public bool IgnoreShooter = true;
|
||||
|
||||
[DataField("damage", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace Content.Shared.Standing
|
||||
{
|
||||
public sealed class StandingStateSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
|
||||
@@ -11,10 +11,12 @@ namespace Content.Shared.SubFloor;
|
||||
|
||||
public sealed class TrayScannerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private IMapManager _mapManager = default!;
|
||||
[Dependency] private IGameTiming _gameTiming = default!;
|
||||
[Dependency] private SharedSubFloorHideSystem _subfloorSystem = default!;
|
||||
[Dependency] private SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedSubFloorHideSystem _subfloorSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
private HashSet<EntityUid> _activeScanners = new();
|
||||
private RemQueue<EntityUid> _invalidScanners = new();
|
||||
@@ -50,7 +52,7 @@ public sealed class TrayScannerSystem : EntitySystem
|
||||
|
||||
if (EntityManager.TryGetComponent<AppearanceComponent>(uid, out var appearance))
|
||||
{
|
||||
appearance.SetData(TrayScannerVisual.Visual, scanner.Enabled == true ? TrayScannerVisual.On : TrayScannerVisual.Off);
|
||||
_appearance.SetData(uid, TrayScannerVisual.Visual, scanner.Enabled ? TrayScannerVisual.On : TrayScannerVisual.Off, appearance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +85,8 @@ public sealed class TrayScannerSystem : EntitySystem
|
||||
if (!_gameTiming.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
if (!_activeScanners.Any()) return;
|
||||
if (!_activeScanners.Any())
|
||||
return;
|
||||
|
||||
foreach (var scanner in _activeScanners)
|
||||
{
|
||||
@@ -96,7 +99,9 @@ public sealed class TrayScannerSystem : EntitySystem
|
||||
}
|
||||
|
||||
foreach (var invalidScanner in _invalidScanners)
|
||||
{
|
||||
_activeScanners.Remove(invalidScanner);
|
||||
}
|
||||
|
||||
_invalidScanners.List?.Clear();
|
||||
}
|
||||
@@ -148,15 +153,16 @@ public sealed class TrayScannerSystem : EntitySystem
|
||||
}
|
||||
|
||||
var pos = transform.LocalPosition;
|
||||
var parent = _transform.GetParent(transform);
|
||||
|
||||
// zero vector implies container
|
||||
//
|
||||
// this means we should get the entity transform's parent
|
||||
if (pos == Vector2.Zero
|
||||
&& transform.Parent != null
|
||||
&& parent != null
|
||||
&& _containerSystem.ContainsEntity(transform.ParentUid, uid))
|
||||
{
|
||||
pos = transform.Parent.LocalPosition;
|
||||
pos = parent.LocalPosition;
|
||||
|
||||
// if this is also zero, we can check one more time
|
||||
//
|
||||
@@ -165,7 +171,7 @@ public sealed class TrayScannerSystem : EntitySystem
|
||||
// that doesn't work, just don't bother any further
|
||||
if (pos == Vector2.Zero)
|
||||
{
|
||||
var gpTransform = transform.Parent.Parent;
|
||||
var gpTransform = _transform.GetParent(parent);
|
||||
if (gpTransform != null
|
||||
&& _containerSystem.ContainsEntity(gpTransform.Owner, transform.ParentUid))
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Throwing;
|
||||
@@ -20,6 +21,7 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
|
||||
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly ThrownItemSystem _thrownSystem = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
|
||||
@@ -58,7 +60,7 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
comp.Thrower = user;
|
||||
// Give it a l'il spin.
|
||||
if (!_tagSystem.HasTag(uid, "NoSpinOnThrow"))
|
||||
physics.ApplyAngularImpulse(ThrowAngularImpulse);
|
||||
_physics.ApplyAngularImpulse(physics, ThrowAngularImpulse);
|
||||
else
|
||||
{
|
||||
if (transform == null)
|
||||
@@ -73,24 +75,26 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
_interactionSystem.ThrownInteraction(user.Value, uid);
|
||||
|
||||
var impulseVector = direction.Normalized * strength * physics.Mass;
|
||||
physics.ApplyLinearImpulse(impulseVector);
|
||||
_physics.ApplyLinearImpulse(physics, impulseVector);
|
||||
|
||||
// Estimate time to arrival so we can apply OnGround status and slow it much faster.
|
||||
var time = (direction / strength).Length;
|
||||
|
||||
if (time < FlyTime)
|
||||
{
|
||||
physics.BodyStatus = BodyStatus.OnGround;
|
||||
_physics.SetBodyStatus(physics, BodyStatus.OnGround);
|
||||
_thrownSystem.LandComponent(comp);
|
||||
}
|
||||
else
|
||||
{
|
||||
physics.BodyStatus = BodyStatus.InAir;
|
||||
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
||||
|
||||
Timer.Spawn(TimeSpan.FromSeconds(time - FlyTime), () =>
|
||||
{
|
||||
if (physics.Deleted) return;
|
||||
physics.BodyStatus = BodyStatus.OnGround;
|
||||
if (physics.Deleted)
|
||||
return;
|
||||
|
||||
_physics.SetBodyStatus(physics, BodyStatus.OnGround);
|
||||
_thrownSystem.LandComponent(comp);
|
||||
});
|
||||
}
|
||||
@@ -105,7 +109,7 @@ public sealed class ThrowingSystem : EntitySystem
|
||||
RaiseLocalEvent(physics.Owner, msg);
|
||||
|
||||
if (!msg.Cancelled)
|
||||
userPhysics.ApplyLinearImpulse(-impulseVector * pushbackRatio);
|
||||
_physics.ApplyLinearImpulse(userPhysics, -impulseVector * pushbackRatio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,6 @@ namespace Content.Shared.Traits
|
||||
[Prototype("trait")]
|
||||
public sealed class TraitPrototype : IPrototype
|
||||
{
|
||||
private string _name = string.Empty;
|
||||
private string? _description;
|
||||
|
||||
[ViewVariables]
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
@@ -137,8 +137,8 @@ public abstract partial class SharedGunSystem
|
||||
|
||||
if (TryComp<AppearanceComponent>(magEnt, out var magAppearance))
|
||||
{
|
||||
magAppearance.TryGetData<int>(AmmoVisuals.AmmoCount, out var addCount);
|
||||
magAppearance.TryGetData<int>(AmmoVisuals.AmmoMax, out var addCapacity);
|
||||
Appearance.TryGetData<int>(magEnt, AmmoVisuals.AmmoCount, out var addCount, magAppearance);
|
||||
Appearance.TryGetData<int>(magEnt, AmmoVisuals.AmmoMax, out var addCapacity, magAppearance);
|
||||
count += addCount;
|
||||
capacity += addCapacity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user