Fix zipties/makeshift cuffs dropping multiple broken entities on removal (#23095)
This commit is contained in:
@@ -45,6 +45,13 @@ public sealed partial class HandcuffComponent : Component
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public EntProtoId? BrokenPrototype;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not these cuffs are in the process of being removed.
|
||||
/// Used simply to prevent spawning multiple <see cref="BrokenPrototype"/>.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool Removing;
|
||||
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public DamageSpecifier DamageOnResist = new()
|
||||
{
|
||||
|
||||
@@ -621,7 +621,7 @@ namespace Content.Shared.Cuffs
|
||||
if (!Resolve(target, ref cuffable) || !Resolve(cuffsToRemove, ref cuff))
|
||||
return;
|
||||
|
||||
if (TerminatingOrDeleted(cuffsToRemove) || TerminatingOrDeleted(target))
|
||||
if (cuff.Removing || TerminatingOrDeleted(cuffsToRemove) || TerminatingOrDeleted(target))
|
||||
return;
|
||||
|
||||
if (user != null)
|
||||
@@ -632,6 +632,7 @@ namespace Content.Shared.Cuffs
|
||||
return;
|
||||
}
|
||||
|
||||
cuff.Removing = true;
|
||||
_audio.PlayPredicted(cuff.EndUncuffSound, target, user);
|
||||
|
||||
_container.Remove(cuffsToRemove, cuffable.Container);
|
||||
@@ -688,6 +689,7 @@ namespace Content.Shared.Cuffs
|
||||
}
|
||||
}
|
||||
}
|
||||
cuff.Removing = false;
|
||||
}
|
||||
|
||||
#region ActionBlocker
|
||||
|
||||
@@ -52,6 +52,14 @@
|
||||
- type: Construction
|
||||
graph: makeshifthandcuffs
|
||||
node: cuffscable
|
||||
- type: Item
|
||||
inhandVisuals:
|
||||
left:
|
||||
- state: inhand-left
|
||||
color: forestgreen
|
||||
right:
|
||||
- state: inhand-right
|
||||
color: forestgreen
|
||||
- type: Sprite
|
||||
sprite: Objects/Misc/cablecuffs.rsi
|
||||
state: cuff
|
||||
@@ -120,6 +128,14 @@
|
||||
sprite: Objects/Misc/cablecuffs.rsi
|
||||
state: cuff-broken
|
||||
color: forestgreen
|
||||
- type: Item
|
||||
inhandVisuals:
|
||||
left:
|
||||
- state: inhand-left
|
||||
color: forestgreen
|
||||
right:
|
||||
- state: inhand-right
|
||||
color: forestgreen
|
||||
|
||||
- type: entity
|
||||
parent: Handcuffs
|
||||
|
||||
Reference in New Issue
Block a user