[Hotfix] Wizard Rod doesn't gib the wizard. (#40041)

* Title

* Tired

* That shit did nothing goddamn

* Fix for real

* Use og code

* Hmmm borgaer

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
Princess Cheeseballs
2025-09-06 02:18:17 -07:00
committed by Princess Cheeseballs
parent 8a1a1b98c4
commit 3ea9321d25
2 changed files with 20 additions and 12 deletions

View File

@@ -20,6 +20,12 @@ public sealed partial class PolymorphedEntityComponent : Component
[DataField(required: true)] [DataField(required: true)]
public EntityUid? Parent; public EntityUid? Parent;
/// <summary>
/// Whether this polymorph has been reverted.
/// </summary>
[DataField]
public bool Reverted;
/// <summary> /// <summary>
/// The amount of time that has passed since the entity was created /// The amount of time that has passed since the entity was created
/// used for tracking the duration /// used for tracking the duration

View File

@@ -128,13 +128,12 @@ public sealed partial class PolymorphSystem : EntitySystem
private void OnBeforeFullySliced(Entity<PolymorphedEntityComponent> ent, ref BeforeFullySlicedEvent args) private void OnBeforeFullySliced(Entity<PolymorphedEntityComponent> ent, ref BeforeFullySlicedEvent args)
{ {
var (_, comp) = ent; if (ent.Comp.Reverted || !ent.Comp.Configuration.RevertOnEat)
if (comp.Configuration.RevertOnEat) return;
{
args.Cancel(); args.Cancel();
Revert((ent, ent)); Revert((ent, ent));
} }
}
/// <summary> /// <summary>
/// It is possible to be polymorphed into an entity that can't "die", but is instead /// It is possible to be polymorphed into an entity that can't "die", but is instead
@@ -142,14 +141,17 @@ public sealed partial class PolymorphSystem : EntitySystem
/// </summary> /// </summary>
private void OnDestruction(Entity<PolymorphedEntityComponent> ent, ref DestructionEventArgs args) private void OnDestruction(Entity<PolymorphedEntityComponent> ent, ref DestructionEventArgs args)
{ {
if (ent.Comp.Configuration.RevertOnDeath) if (ent.Comp.Reverted || !ent.Comp.Configuration.RevertOnDeath)
{ return;
Revert((ent, ent)); Revert((ent, ent));
} }
}
private void OnPolymorphedTerminating(Entity<PolymorphedEntityComponent> ent, ref EntityTerminatingEvent args) private void OnPolymorphedTerminating(Entity<PolymorphedEntityComponent> ent, ref EntityTerminatingEvent args)
{ {
if (ent.Comp.Reverted)
return;
if (ent.Comp.Configuration.RevertOnDelete) if (ent.Comp.Configuration.RevertOnDelete)
Revert(ent.AsNullable()); Revert(ent.AsNullable());
@@ -298,8 +300,6 @@ public sealed partial class PolymorphSystem : EntitySystem
if (component.Parent is not { } parent) if (component.Parent is not { } parent)
return null; return null;
// Clear our reference to the original entity
component.Parent = null;
if (Deleted(parent)) if (Deleted(parent))
return null; return null;
@@ -316,6 +316,8 @@ public sealed partial class PolymorphSystem : EntitySystem
_transform.SetParent(parent, parentXform, uidXform.ParentUid); _transform.SetParent(parent, parentXform, uidXform.ParentUid);
_transform.SetCoordinates(parent, parentXform, uidXform.Coordinates, uidXform.LocalRotation); _transform.SetCoordinates(parent, parentXform, uidXform.Coordinates, uidXform.LocalRotation);
component.Reverted = true;
if (component.Configuration.TransferDamage && if (component.Configuration.TransferDamage &&
TryComp<DamageableComponent>(parent, out var damageParent) && TryComp<DamageableComponent>(parent, out var damageParent) &&
_mobThreshold.GetScaledDamage(uid, parent, out var damage) && _mobThreshold.GetScaledDamage(uid, parent, out var damage) &&