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:
@@ -54,7 +54,7 @@ public abstract partial class SharedBuckleSystem
|
||||
|
||||
private void OnBuckleMove(EntityUid uid, BuckleComponent component, ref MoveEvent ev)
|
||||
{
|
||||
if (component.BuckledTo is not {} strapUid)
|
||||
if (component.BuckledTo is not { } strapUid)
|
||||
return;
|
||||
|
||||
if (!TryComp<StrapComponent>(strapUid, out var strapComp))
|
||||
@@ -85,7 +85,7 @@ public abstract partial class SharedBuckleSystem
|
||||
{
|
||||
Act = () => TryUnbuckle(uid, args.User, buckleComp: component),
|
||||
Text = Loc.GetString("verb-categories-unbuckle"),
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/unbuckle.svg.192dpi.png"))
|
||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/unbuckle.svg.192dpi.png"))
|
||||
};
|
||||
|
||||
if (args.Target == args.User && args.Using == null)
|
||||
@@ -191,7 +191,7 @@ public abstract partial class SharedBuckleSystem
|
||||
|
||||
ActionBlocker.UpdateCanMove(buckleUid);
|
||||
UpdateBuckleStatus(buckleUid, buckleComp, strapComp);
|
||||
Dirty(buckleComp);
|
||||
Dirty(buckleUid, buckleComp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -468,8 +468,7 @@ public abstract partial class SharedBuckleSystem
|
||||
if (strapComp.BuckledEntities.Remove(buckleUid))
|
||||
{
|
||||
strapComp.OccupiedSize -= buckleComp.Size;
|
||||
//Dirty(strapUid);
|
||||
Dirty(strapComp);
|
||||
Dirty(strapUid, strapComp);
|
||||
}
|
||||
|
||||
_joints.RefreshRelay(buckleUid);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user