Remove or fix broken Dirty() calls. (#18933)
This commit is contained in:
@@ -70,8 +70,8 @@ public partial class SharedBodySystem
|
||||
organ.ParentSlot = slot;
|
||||
organ.Body = CompOrNull<BodyPartComponent>(slot.Parent)?.Body;
|
||||
|
||||
Dirty(slot.Parent);
|
||||
Dirty(organId.Value);
|
||||
DirtyAllComponents(slot.Parent);
|
||||
Dirty(organId.Value, organ);
|
||||
|
||||
if (organ.Body == null)
|
||||
{
|
||||
@@ -85,6 +85,20 @@ public partial class SharedBodySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
public void DirtyAllComponents(EntityUid uid)
|
||||
{
|
||||
// TODO just use containers. Please
|
||||
if (TryComp(uid, out BodyPartComponent? part))
|
||||
Dirty(uid, part);
|
||||
|
||||
if (TryComp(uid, out OrganComponent? organ))
|
||||
Dirty(uid, organ);
|
||||
|
||||
if (TryComp(uid, out BodyComponent? body))
|
||||
Dirty(uid, body);
|
||||
}
|
||||
|
||||
|
||||
public bool AddOrganToFirstValidSlot(
|
||||
EntityUid? childId,
|
||||
EntityUid? parentId,
|
||||
|
||||
@@ -55,7 +55,7 @@ public partial class SharedBodySystem
|
||||
if (part.ParentSlot is { } slot)
|
||||
{
|
||||
slot.Child = null;
|
||||
Dirty(slot.Parent);
|
||||
DirtyAllComponents(slot.Parent);
|
||||
}
|
||||
|
||||
foreach (var childSlot in part.Children.Values.ToArray())
|
||||
@@ -207,8 +207,8 @@ public partial class SharedBodySystem
|
||||
part.Body = null;
|
||||
}
|
||||
|
||||
Dirty(slot.Parent);
|
||||
Dirty(partId.Value);
|
||||
DirtyAllComponents(slot.Parent);
|
||||
DirtyAllComponents(partId.Value);
|
||||
|
||||
if (part.Body is { } newBody)
|
||||
{
|
||||
@@ -226,7 +226,7 @@ public partial class SharedBodySystem
|
||||
RaiseLocalEvent(organ.Id, new AddedToBodyEvent(newBody), true);
|
||||
}
|
||||
|
||||
Dirty(newBody);
|
||||
DirtyAllComponents(newBody);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -281,8 +281,8 @@ public partial class SharedBodySystem
|
||||
}
|
||||
}
|
||||
|
||||
Dirty(slot.Parent);
|
||||
Dirty(partId.Value);
|
||||
DirtyAllComponents(slot.Parent);
|
||||
DirtyAllComponents(partId.Value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user