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

@@ -75,7 +75,7 @@ public sealed class TagSystem : EntitySystem
/// </exception>
public bool AddTag(EntityUid entity, string id)
{
return AddTag(EnsureComp<TagComponent>(entity), id);
return AddTag(entity, EnsureComp<TagComponent>(entity), id);
}
/// <summary>
@@ -91,7 +91,7 @@ public sealed class TagSystem : EntitySystem
/// </exception>
public bool AddTags(EntityUid entity, params string[] ids)
{
return AddTags(EnsureComp<TagComponent>(entity), ids);
return AddTags(entity, EnsureComp<TagComponent>(entity), ids);
}
/// <summary>
@@ -107,7 +107,7 @@ public sealed class TagSystem : EntitySystem
/// </exception>
public bool AddTags(EntityUid entity, IEnumerable<string> ids)
{
return AddTags(EnsureComp<TagComponent>(entity), ids);
return AddTags(entity, EnsureComp<TagComponent>(entity), ids);
}
/// <summary>
@@ -125,7 +125,7 @@ public sealed class TagSystem : EntitySystem
public bool TryAddTag(EntityUid entity, string id)
{
return TryComp<TagComponent>(entity, out var component) &&
AddTag(component, id);
AddTag(entity, component, id);
}
/// <summary>
@@ -143,7 +143,7 @@ public sealed class TagSystem : EntitySystem
public bool TryAddTags(EntityUid entity, params string[] ids)
{
return TryComp<TagComponent>(entity, out var component) &&
AddTags(component, ids);
AddTags(entity, component, ids);
}
/// <summary>
@@ -161,7 +161,7 @@ public sealed class TagSystem : EntitySystem
public bool TryAddTags(EntityUid entity, IEnumerable<string> ids)
{
return TryComp<TagComponent>(entity, out var component) &&
AddTags(component, ids);
AddTags(entity, component, ids);
}
/// <summary>
@@ -299,7 +299,7 @@ public sealed class TagSystem : EntitySystem
public bool RemoveTag(EntityUid entity, string id)
{
return TryComp<TagComponent>(entity, out var component) &&
RemoveTag(component, id);
RemoveTag(entity, component, id);
}
/// <summary>
@@ -316,7 +316,7 @@ public sealed class TagSystem : EntitySystem
public bool RemoveTags(EntityUid entity, params string[] ids)
{
return TryComp<TagComponent>(entity, out var component) &&
RemoveTags(component, ids);
RemoveTags(entity, component, ids);
}
/// <summary>
@@ -333,7 +333,7 @@ public sealed class TagSystem : EntitySystem
public bool RemoveTags(EntityUid entity, IEnumerable<string> ids)
{
return TryComp<TagComponent>(entity, out var component) &&
RemoveTags(component, ids);
RemoveTags(entity, component, ids);
}
/// <summary>
@@ -344,14 +344,14 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception>
public bool AddTag(TagComponent component, string id)
public bool AddTag(EntityUid uid, TagComponent component, string id)
{
AssertValidTag(id);
var added = component.Tags.Add(id);
if (added)
{
Dirty(component);
Dirty(uid, component);
return true;
}
@@ -366,9 +366,9 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public bool AddTags(TagComponent component, params string[] ids)
public bool AddTags(EntityUid uid, TagComponent component, params string[] ids)
{
return AddTags(component, ids.AsEnumerable());
return AddTags(uid, component, ids.AsEnumerable());
}
/// <summary>
@@ -379,7 +379,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public bool AddTags(TagComponent component, IEnumerable<string> ids)
public bool AddTags(EntityUid uid, TagComponent component, IEnumerable<string> ids)
{
var count = component.Tags.Count;
@@ -391,7 +391,7 @@ public sealed class TagSystem : EntitySystem
if (component.Tags.Count > count)
{
Dirty(component);
Dirty(uid, component);
return true;
}
@@ -557,13 +557,13 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception>
public bool RemoveTag(TagComponent component, string id)
public bool RemoveTag(EntityUid uid, TagComponent component, string id)
{
AssertValidTag(id);
if (component.Tags.Remove(id))
{
Dirty(component);
Dirty(uid, component);
return true;
}
@@ -580,9 +580,9 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public bool RemoveTags(TagComponent component, params string[] ids)
public bool RemoveTags(EntityUid uid, TagComponent component, params string[] ids)
{
return RemoveTags(component, ids.AsEnumerable());
return RemoveTags(uid, component, ids.AsEnumerable());
}
/// <summary>
@@ -593,7 +593,7 @@ public sealed class TagSystem : EntitySystem
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public bool RemoveTags(TagComponent component, IEnumerable<string> ids)
public bool RemoveTags(EntityUid uid, TagComponent component, IEnumerable<string> ids)
{
var count = component.Tags.Count;
@@ -605,7 +605,7 @@ public sealed class TagSystem : EntitySystem
if (component.Tags.Count < count)
{
Dirty(component);
Dirty(uid, component);
return true;
}