Implanters and Subdermal Implants (#11840)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Content.Server.Cuffs.Components
|
||||
[ViewVariables]
|
||||
public int CuffedHandCount => Container.ContainedEntities.Count * 2;
|
||||
|
||||
private EntityUid LastAddedCuffs => Container.ContainedEntities[^1];
|
||||
public EntityUid LastAddedCuffs => Container.ContainedEntities[^1];
|
||||
|
||||
public IReadOnlyList<EntityUid> StoredEntities => Container.ContainedEntities;
|
||||
|
||||
@@ -254,70 +254,7 @@ namespace Content.Server.Cuffs.Components
|
||||
|
||||
if (result != DoAfterStatus.Cancelled)
|
||||
{
|
||||
SoundSystem.Play(cuff.EndUncuffSound.GetSound(), Filter.Pvs(Owner), Owner);
|
||||
|
||||
_entMan.EntitySysManager.GetEntitySystem<HandVirtualItemSystem>().DeleteInHandsMatching(user, cuffsToRemove.Value);
|
||||
_entMan.EntitySysManager.GetEntitySystem<SharedHandsSystem>().PickupOrDrop(user, cuffsToRemove.Value);
|
||||
|
||||
if (cuff.BreakOnRemove)
|
||||
{
|
||||
cuff.Broken = true;
|
||||
|
||||
var meta = _entMan.GetComponent<MetaDataComponent>(cuffsToRemove.Value);
|
||||
meta.EntityName = cuff.BrokenName;
|
||||
meta.EntityDescription = 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.AddComponent<RecyclableComponent>(cuffsToRemove.Value);
|
||||
}
|
||||
|
||||
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.SortedHands.Count() > CuffedHandCount;
|
||||
_entMan.EntitySysManager.GetEntitySystem<ActionBlockerSystem>().UpdateCanMove(Owner);
|
||||
|
||||
var ev = new CuffedStateChangeEvent();
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ref ev, true);
|
||||
UpdateAlert();
|
||||
Dirty(_entMan);
|
||||
|
||||
if (CuffedHandCount == 0)
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("cuffable-component-remove-cuffs-success-message"));
|
||||
|
||||
if (!isOwner)
|
||||
{
|
||||
user.PopupMessage(Owner, Loc.GetString("cuffable-component-remove-cuffs-by-other-success-message", ("otherName", user)));
|
||||
}
|
||||
|
||||
if (user == Owner)
|
||||
{
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{_entMan.ToPrettyString(user):player} has successfully uncuffed themselves");
|
||||
}
|
||||
else
|
||||
{
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{_entMan.ToPrettyString(user):player} has successfully uncuffed {_entMan.ToPrettyString(Owner):player}");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isOwner)
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message",
|
||||
("cuffedHandCount", CuffedHandCount),
|
||||
("otherName", user)));
|
||||
user.PopupMessage(Owner, Loc.GetString("cuffable-component-remove-cuffs-by-other-partial-success-message",
|
||||
("otherName", user),
|
||||
("cuffedHandCount", CuffedHandCount)));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message", ("cuffedHandCount", CuffedHandCount)));
|
||||
}
|
||||
}
|
||||
Uncuff(user, cuffsToRemove.Value, cuff, isOwner);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -326,5 +263,71 @@ namespace Content.Server.Cuffs.Components
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Lord forgive me for putting this here
|
||||
//Cuff ECS when
|
||||
public void Uncuff(EntityUid user, EntityUid cuffsToRemove, HandcuffComponent cuff, bool isOwner)
|
||||
{
|
||||
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 = cuff.BrokenName;
|
||||
meta.EntityDescription = 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.AddComponent<RecyclableComponent>(cuffsToRemove);
|
||||
}
|
||||
|
||||
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.SortedHands.Count() > CuffedHandCount;
|
||||
_entMan.EntitySysManager.GetEntitySystem<ActionBlockerSystem>().UpdateCanMove(Owner);
|
||||
|
||||
var ev = new CuffedStateChangeEvent();
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ref ev, true);
|
||||
UpdateAlert();
|
||||
Dirty(_entMan);
|
||||
|
||||
if (CuffedHandCount == 0)
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("cuffable-component-remove-cuffs-success-message"));
|
||||
|
||||
if (!isOwner)
|
||||
{
|
||||
user.PopupMessage(Owner, Loc.GetString("cuffable-component-remove-cuffs-by-other-success-message", ("otherName", user)));
|
||||
}
|
||||
|
||||
if (user == Owner)
|
||||
{
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{_entMan.ToPrettyString(user):player} has successfully uncuffed themselves");
|
||||
}
|
||||
else
|
||||
{
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{_entMan.ToPrettyString(user):player} has successfully uncuffed {_entMan.ToPrettyString(Owner):player}");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isOwner)
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message", ("cuffedHandCount", CuffedHandCount), ("otherName", user)));
|
||||
user.PopupMessage(Owner, Loc.GetString("cuffable-component-remove-cuffs-by-other-partial-success-message", ("otherName", user), ("cuffedHandCount", CuffedHandCount)));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message", ("cuffedHandCount", CuffedHandCount)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user