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)]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public EntProtoId? BrokenPrototype;
|
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)]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public DamageSpecifier DamageOnResist = new()
|
public DamageSpecifier DamageOnResist = new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ namespace Content.Shared.Cuffs
|
|||||||
if (!Resolve(target, ref cuffable) || !Resolve(cuffsToRemove, ref cuff))
|
if (!Resolve(target, ref cuffable) || !Resolve(cuffsToRemove, ref cuff))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TerminatingOrDeleted(cuffsToRemove) || TerminatingOrDeleted(target))
|
if (cuff.Removing || TerminatingOrDeleted(cuffsToRemove) || TerminatingOrDeleted(target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
@@ -632,6 +632,7 @@ namespace Content.Shared.Cuffs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cuff.Removing = true;
|
||||||
_audio.PlayPredicted(cuff.EndUncuffSound, target, user);
|
_audio.PlayPredicted(cuff.EndUncuffSound, target, user);
|
||||||
|
|
||||||
_container.Remove(cuffsToRemove, cuffable.Container);
|
_container.Remove(cuffsToRemove, cuffable.Container);
|
||||||
@@ -688,6 +689,7 @@ namespace Content.Shared.Cuffs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cuff.Removing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ActionBlocker
|
#region ActionBlocker
|
||||||
|
|||||||
@@ -52,6 +52,14 @@
|
|||||||
- type: Construction
|
- type: Construction
|
||||||
graph: makeshifthandcuffs
|
graph: makeshifthandcuffs
|
||||||
node: cuffscable
|
node: cuffscable
|
||||||
|
- type: Item
|
||||||
|
inhandVisuals:
|
||||||
|
left:
|
||||||
|
- state: inhand-left
|
||||||
|
color: forestgreen
|
||||||
|
right:
|
||||||
|
- state: inhand-right
|
||||||
|
color: forestgreen
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Misc/cablecuffs.rsi
|
sprite: Objects/Misc/cablecuffs.rsi
|
||||||
state: cuff
|
state: cuff
|
||||||
@@ -120,6 +128,14 @@
|
|||||||
sprite: Objects/Misc/cablecuffs.rsi
|
sprite: Objects/Misc/cablecuffs.rsi
|
||||||
state: cuff-broken
|
state: cuff-broken
|
||||||
color: forestgreen
|
color: forestgreen
|
||||||
|
- type: Item
|
||||||
|
inhandVisuals:
|
||||||
|
left:
|
||||||
|
- state: inhand-left
|
||||||
|
color: forestgreen
|
||||||
|
right:
|
||||||
|
- state: inhand-right
|
||||||
|
color: forestgreen
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: Handcuffs
|
parent: Handcuffs
|
||||||
|
|||||||
Reference in New Issue
Block a user