mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Add new Dirty() override for Component.Owner removal (#4144)
This commit is contained in:
@@ -81,11 +81,11 @@ namespace Robust.Client.GameObjects
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dirty(Component component, MetaDataComponent? meta = null)
|
||||
public override void Dirty(EntityUid uid, Component component, MetaDataComponent? meta = null)
|
||||
{
|
||||
// Client only dirties during prediction
|
||||
if (_gameTiming.InPrediction)
|
||||
base.Dirty(component, meta);
|
||||
base.Dirty(uid, component, meta);
|
||||
}
|
||||
|
||||
public override EntityStringRepresentation ToPrettyString(EntityUid uid)
|
||||
|
||||
@@ -404,21 +404,18 @@ namespace Robust.Shared.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Dirty(Component component, MetaDataComponent? meta = null)
|
||||
[Obsolete("use override with an EntityUid")]
|
||||
public void Dirty(Component component, MetaDataComponent? meta = null)
|
||||
{
|
||||
#pragma warning disable CS0618
|
||||
var owner = component.Owner;
|
||||
#pragma warning restore CS0618
|
||||
Dirty(component.Owner, component, meta);
|
||||
}
|
||||
|
||||
// Deserialization will cause this to be true.
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
if (!owner.IsValid() || component.LifeStage >= ComponentLifeStage.Removing)
|
||||
public virtual void Dirty(EntityUid uid, Component component, MetaDataComponent? meta = null)
|
||||
{
|
||||
if (component.LifeStage >= ComponentLifeStage.Removing || !component.NetSyncEnabled)
|
||||
return;
|
||||
|
||||
if (!component.NetSyncEnabled)
|
||||
return;
|
||||
|
||||
DirtyEntity(owner, meta);
|
||||
DirtyEntity(uid, meta);
|
||||
component.LastModifiedTick = CurrentTick;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,15 @@ public partial class EntitySystem
|
||||
EntityManager.Dirty(component, meta);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks a component as dirty. This also implicitly dirties the entity this component belongs to.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected void Dirty(EntityUid uid, Component component, MetaDataComponent? meta = null)
|
||||
{
|
||||
EntityManager.Dirty(uid, component, meta);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the name of an entity.
|
||||
/// </summary>
|
||||
|
||||
@@ -102,6 +102,8 @@ namespace Robust.Shared.GameObjects
|
||||
|
||||
public void Dirty(Component component, MetaDataComponent? metadata = null);
|
||||
|
||||
public void Dirty(EntityUid uid, Component component, MetaDataComponent? meta = null);
|
||||
|
||||
public void QueueDeleteEntity(EntityUid uid);
|
||||
|
||||
public bool IsQueuedForDeletion(EntityUid uid);
|
||||
|
||||
Reference in New Issue
Block a user