Remove server-sprite references from handcuffs (#13515)
This commit is contained in:
@@ -18,6 +18,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Server.Recycling.Components;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Server.Cuffs.Components
|
||||
{
|
||||
@@ -271,22 +272,16 @@ namespace Content.Server.Cuffs.Components
|
||||
SoundSystem.Play(cuff.EndUncuffSound.GetSound(), Filter.Pvs(Owner), Owner);
|
||||
|
||||
_entMan.EntitySysManager.GetEntitySystem<HandVirtualItemSystem>().DeleteInHandsMatching(user, cuffsToRemove);
|
||||
_entMan.EntitySysManager.GetEntitySystem<SharedHandsSystem>().PickupOrDrop(user, cuffsToRemove);
|
||||
|
||||
if (cuff.BreakOnRemove)
|
||||
{
|
||||
cuff.Broken = true;
|
||||
|
||||
var meta = _entMan.GetComponent<MetaDataComponent>(cuffsToRemove);
|
||||
meta.EntityName = Loc.GetString(cuff.BrokenName);
|
||||
meta.EntityDescription = Loc.GetString(cuff.BrokenDesc);
|
||||
|
||||
if (_entMan.TryGetComponent<SpriteComponent>(cuffsToRemove, out var sprite) && cuff.BrokenState != null)
|
||||
{
|
||||
sprite.LayerSetState(0, cuff.BrokenState); // TODO: safety check to see if RSI contains the state?
|
||||
}
|
||||
|
||||
_entMan.EnsureComponent<RecyclableComponent>(cuffsToRemove);
|
||||
_entMan.QueueDeleteEntity(cuffsToRemove);
|
||||
var trash = _entMan.SpawnEntity(cuff.BrokenPrototype, MapCoordinates.Nullspace);
|
||||
_entMan.EntitySysManager.GetEntitySystem<SharedHandsSystem>().PickupOrDrop(user, trash);
|
||||
}
|
||||
else
|
||||
{
|
||||
_entMan.EntitySysManager.GetEntitySystem<SharedHandsSystem>().PickupOrDrop(user, cuffsToRemove);
|
||||
}
|
||||
|
||||
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.SortedHands.Count() > CuffedHandCount;
|
||||
|
||||
Reference in New Issue
Block a user