Code cleanup: Dirty(Comp) (#26238)

* Replaced uses of Dirty(Component) with Dirty(Uid, Component)
Modified some systems (notably pulling-related) to use uids.

* Missed a few

* Revert changes to pulling

* No
This commit is contained in:
Tayrtahn
2024-03-19 23:27:02 -04:00
committed by GitHub
parent c28cbe40c3
commit 4a83c36585
74 changed files with 245 additions and 249 deletions

View File

@@ -20,22 +20,22 @@ public abstract partial class SharedBuckleSystem
{
SubscribeLocalEvent<StrapComponent, ComponentStartup>(OnStrapStartup);
SubscribeLocalEvent<StrapComponent, ComponentShutdown>(OnStrapShutdown);
SubscribeLocalEvent<StrapComponent, ComponentRemove>((_, c, _) => StrapRemoveAll(c));
SubscribeLocalEvent<StrapComponent, ComponentRemove>((e, c, _) => StrapRemoveAll(e, c));
SubscribeLocalEvent<StrapComponent, EntInsertedIntoContainerMessage>(OnStrapEntModifiedFromContainer);
SubscribeLocalEvent<StrapComponent, EntRemovedFromContainerMessage>(OnStrapEntModifiedFromContainer);
SubscribeLocalEvent<StrapComponent, GetVerbsEvent<InteractionVerb>>(AddStrapVerbs);
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnStrapContainerGettingInsertedAttempt);
SubscribeLocalEvent<StrapComponent, InteractHandEvent>(OnStrapInteractHand);
SubscribeLocalEvent<StrapComponent, DestructionEventArgs>((_,c,_) => StrapRemoveAll(c));
SubscribeLocalEvent<StrapComponent, BreakageEventArgs>((_, c, _) => StrapRemoveAll(c));
SubscribeLocalEvent<StrapComponent, DestructionEventArgs>((e, c, _) => StrapRemoveAll(e, c));
SubscribeLocalEvent<StrapComponent, BreakageEventArgs>((e, c, _) => StrapRemoveAll(e, c));
SubscribeLocalEvent<StrapComponent, DragDropTargetEvent>(OnStrapDragDropTarget);
SubscribeLocalEvent<StrapComponent, CanDropTargetEvent>(OnCanDropTarget);
SubscribeLocalEvent<StrapComponent, FoldAttemptEvent>(OnAttemptFold);
SubscribeLocalEvent<StrapComponent, MoveEvent>(OnStrapMoveEvent);
SubscribeLocalEvent<StrapComponent, MachineDeconstructedEvent>((_, c, _) => StrapRemoveAll(c));
SubscribeLocalEvent<StrapComponent, MachineDeconstructedEvent>((e, c, _) => StrapRemoveAll(e, c));
}
private void OnStrapStartup(EntityUid uid, StrapComponent component, ComponentStartup args)
@@ -48,7 +48,7 @@ public abstract partial class SharedBuckleSystem
if (LifeStage(uid) > EntityLifeStage.MapInitialized)
return;
StrapRemoveAll(component);
StrapRemoveAll(uid, component);
}
private void OnStrapEntModifiedFromContainer(EntityUid uid, StrapComponent component, ContainerModifiedMessage message)
@@ -153,7 +153,7 @@ public abstract partial class SharedBuckleSystem
}
// If the user is currently holding/pulling an entity that can be buckled, add a verb for that.
if (args.Using is {Valid: true} @using &&
if (args.Using is { Valid: true } @using &&
TryComp<BuckleComponent>(@using, out var usingBuckle) &&
StrapHasSpace(uid, usingBuckle, component) &&
_interaction.InRangeUnobstructed(@using, args.Target, range: usingBuckle.Range))
@@ -232,7 +232,7 @@ public abstract partial class SharedBuckleSystem
}
ReAttach(buckledEntity, uid, buckled, component);
Dirty(buckled);
Dirty(buckledEntity, buckled);
}
}
@@ -258,7 +258,7 @@ public abstract partial class SharedBuckleSystem
/// <summary>
/// Remove everything attached to the strap
/// </summary>
private void StrapRemoveAll(StrapComponent strapComp)
private void StrapRemoveAll(EntityUid uid, StrapComponent strapComp)
{
foreach (var entity in strapComp.BuckledEntities.ToArray())
{
@@ -267,7 +267,7 @@ public abstract partial class SharedBuckleSystem
strapComp.BuckledEntities.Clear();
strapComp.OccupiedSize = 0;
Dirty(strapComp);
Dirty(uid, strapComp);
}
private bool StrapHasSpace(EntityUid strapUid, BuckleComponent buckleComp, StrapComponent? strapComp = null)
@@ -313,6 +313,6 @@ public abstract partial class SharedBuckleSystem
strapComp.Enabled = enabled;
if (!enabled)
StrapRemoveAll(strapComp);
StrapRemoveAll(strapUid, strapComp);
}
}