Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream20242707 #5

Merged
merged 66 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
7381df4
Handless mobs can no longer wipe devices (#30149)
Scribbles0 Jul 23, 2024
ec071ce
Automatic changelog update
PJBot Jul 23, 2024
a32f9ff
Fix Reagent Grinder being able to do work without being powered (#30267)
bVelliquette Jul 23, 2024
4f8b634
Automatic changelog update
PJBot Jul 23, 2024
e1f3bdc
Add spicy rock pizza (#30116)
mkanke-real Jul 23, 2024
8b27ef8
Fix: Shelfs and Mannequin disassemble (#30313)
BombasterDS Jul 24, 2024
fc09540
Automatic changelog update
PJBot Jul 24, 2024
343496f
tweak(chameleon): Add clown suit to chameleon tech (#29307)
Brandon-Huu Jul 24, 2024
688a46f
Move some disabilities traits into a new category (#30102)
Killerqu00 Jul 24, 2024
c4dcc90
tweak(GunRequiresWield): State the requirement for gun wielding in th…
Brandon-Huu Jul 24, 2024
aa886ca
Make `NeedHand` modifiable for injectorSystem (#29870)
osjarw Jul 24, 2024
492fb52
fix(Meta): Resolve every issue. (#30308)
Brandon-Huu Jul 24, 2024
4536a52
Update Bagel (#30326)
lzk228 Jul 24, 2024
ee641c2
Update Marathon (#30328)
lzk228 Jul 24, 2024
bd4020b
Update Cluster (#30327)
lzk228 Jul 24, 2024
687e2c5
Update Fland (#30330)
lzk228 Jul 24, 2024
9def96d
Update Box (#30329)
lzk228 Jul 24, 2024
f210325
Update Atlas (#30331)
lzk228 Jul 24, 2024
620aed5
Fix QSI Link Range (#30332)
Cojoke-dot Jul 24, 2024
54e7600
Automatic changelog update
PJBot Jul 24, 2024
06d1366
Perma escape crate fills and spawner (#29497)
IProduceWidgets Jul 25, 2024
b6811d3
Medical borg add chem glasses (#27843)
marboww Jul 25, 2024
8f6326c
prevent borgs unlocking eachother and robotics console (#27888)
deltanedas Jul 25, 2024
0d12ce5
Automatic changelog update
PJBot Jul 25, 2024
b0cc97f
Fix Ripley control panel (#30325)
themias Jul 25, 2024
61efd12
Automatic changelog update
PJBot Jul 25, 2024
2d124c5
fix(train): Anchor botany machine, add second artifact spawner. (#30309)
Brandon-Huu Jul 25, 2024
8de6b74
fix borg light being on by default (#30342)
deltanedas Jul 25, 2024
50ba20c
fix(bounties): Make winter counts count as a single warm item. (#30306)
Brandon-Huu Jul 25, 2024
f56e4f6
Replace some to do with TODO (#30346)
lzk228 Jul 25, 2024
bcd7a7a
Space adder now butcherable, snake drops snake meat (#29629)
timurjavid Jul 25, 2024
e95aaef
Automatic changelog update
PJBot Jul 25, 2024
7388b91
Replace noSpawn: true with categories: [ HideSpawnMenu ] (#30100)
Plykiya Jul 25, 2024
2a7883b
Update vomit organ smite to not use Component.owner (#29926)
Plykiya Jul 25, 2024
e161a02
fix the bigest news admin notification typo in the game (#30349)
lzk228 Jul 25, 2024
6f77190
Update Saltern (#30357)
lzk228 Jul 25, 2024
769967a
Update Packed (#30358)
lzk228 Jul 25, 2024
d1663ca
Update Omega (#30356)
lzk228 Jul 25, 2024
818f43b
Update Meta (#30348)
lzk228 Jul 25, 2024
0a07203
Lets atmos build gas pipes in walls (#28707)
Plykiya Jul 25, 2024
ff581d4
Automatic changelog update
PJBot Jul 25, 2024
d5236d8
give nukie reinforcements full operative gear (#30173)
Ilya246 Jul 25, 2024
af47cbd
Automatic changelog update
PJBot Jul 25, 2024
4419999
twek(BoxStation): Reorganize atmos TEG room to be more user friendly.…
Brandon-Huu Jul 26, 2024
4e1fe97
tweak(StatusIcons): Hide revolutionary icons in the dark. (#30367)
Brandon-Huu Jul 26, 2024
333bb38
Add Identity Blocker to a Couple Things (#30305)
Cojoke-dot Jul 26, 2024
76096b2
Automatic changelog update
PJBot Jul 26, 2024
a99ae62
fix(cmd-Jobwhitelistadd): Fixed typo in Loc.GetString (#30355)
Brandon-Huu Jul 26, 2024
5905767
changed some radio colors to be more distinguishable (#30133)
Moomoobeef Jul 26, 2024
f083d08
Automatic changelog update
PJBot Jul 26, 2024
a7fa66e
Replayspawn logic fix (yes, again) (#30273)
Errant-4 Jul 26, 2024
811da0e
Automatic changelog update
PJBot Jul 26, 2024
eab5030
Add vox naming convention to Rules (#30284)
Errant-4 Jul 26, 2024
e72393d
Fix arcade machines (#30376)
themias Jul 26, 2024
18506e1
Automatic changelog update
PJBot Jul 26, 2024
b1d5436
fix(ExtinguisherCabinet): Fix cabinet whitelist to allow fire extingu…
Brandon-Huu Jul 26, 2024
582e6d2
Localization of the title of the job (#30353)
chavonadelal Jul 26, 2024
7c7f4a9
Fix zombie uncuffing (#30321)
themias Jul 26, 2024
e7aa779
Automatic changelog update
PJBot Jul 26, 2024
8f25058
Fix VGRoid grid spam (#29946)
metalgearsloth Jul 27, 2024
d5d8c14
Automatic changelog update
PJBot Jul 27, 2024
1149290
Security Clown Mask (#30249)
GoldenCan Jul 27, 2024
5485ae2
Automatic changelog update
PJBot Jul 27, 2024
45a481d
Oasis updoot (#30388)
IProduceWidgets Jul 27, 2024
b9090e8
Update Evac-Accordia (#30389)
IProduceWidgets Jul 27, 2024
3e46e38
Merge remote-tracking branch 'upstream/master' into upstream20242707
invalid-email-address Jul 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Content.Client/Arcade/BlockGameMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private Control SetupGameGrid(Texture panelTex)
{
PanelOverride = back,
HorizontalExpand = true,
SizeFlagsStretchRatio = 60
SizeFlagsStretchRatio = 34.25f
};
var backgroundPanel = new PanelContainer
{
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Arcade/UI/BlockGameBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ protected override void Open()
base.Open();

_menu = this.CreateWindow<BlockGameMenu>();
_menu.OnAction += SendAction;
}

protected override void ReceiveMessage(BoundUserInterfaceMessage message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected override void Open()
base.Open();

_menu = this.CreateWindow<SpaceVillainArcadeMenu>();
_menu.OnPlayerAction += SendAction;
}

protected override void ReceiveMessage(BoundUserInterfaceMessage message)
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Mech/Ui/MechMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed partial class MechMenu : FancyWindow
{
[Dependency] private readonly IEntityManager _ent = default!;

private readonly EntityUid _mech;
private EntityUid _mech;

public event Action<EntityUid>? OnRemoveButtonPressed;

Expand All @@ -25,6 +25,7 @@ public MechMenu()
public void SetEntity(EntityUid uid)
{
MechView.SetEntity(uid);
_mech = uid;
}

public void UpdateMechStats()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,12 @@ private bool TryFindFallbackSpawn(out EntityCoordinates coords)
{
var size = grid.LocalAABB.Size.LengthSquared();

if (maxSize is not null && size < maxSize)
continue;

var station = HasComp<StationMemberComponent>(uid);

//We want the first station grid to overwrite any previous non-station grids no matter the size, in case the vgroid was found first
if (maxSize is not null && size < maxSize && !(!stationFound && station))
continue;

if (!station && stationFound)
continue;

Expand All @@ -183,7 +184,6 @@ private bool TryFindFallbackSpawn(out EntityCoordinates coords)

if (station)
stationFound = true;

}

coords = new EntityCoordinates(maxUid ?? default, default);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using Content.Server.GameTicking;
using Content.Server.GameTicking.Presets;
using Content.Shared.CCVar;
Expand Down Expand Up @@ -36,7 +36,7 @@ public sealed class FailAndStartPresetTest
- type: entity
id: TestRule
parent: BaseGameRule
noSpawn: true
categories: [ GameRules ]
components:
- type: GameRule
minPlayers: 0
Expand All @@ -45,7 +45,7 @@ public sealed class FailAndStartPresetTest
- type: entity
id: TestRuleTenPlayers
parent: BaseGameRule
noSpawn: true
categories: [ GameRules ]
components:
- type: GameRule
minPlayers: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override async void Execute(IConsoleShell shell, string argStr, string[]
var isWhitelisted = await _db.IsJobWhitelisted(guid, job);
if (isWhitelisted)
{
shell.WriteLine(Loc.GetString("cmd-jobwhitelist-already-whitelisted",
shell.WriteLine(Loc.GetString("cmd-jobwhitelistadd-already-whitelisted",
("player", player),
("jobId", job.Id),
("jobName", jobPrototype.LocalizedName)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,18 @@ private void AddSmiteVerbs(GetVerbsEvent<Verb> args)
{
Text = "admin-smite-remove-hands-name",
Category = VerbCategory.Smite,
Icon = new SpriteSpecifier.Rsi(new ("/Textures/Fluids/vomit_toxin.rsi"), "vomit_toxin-1"),
Icon = new SpriteSpecifier.Rsi(new("/Textures/Fluids/vomit_toxin.rsi"), "vomit_toxin-1"),
Act = () =>
{
_vomitSystem.Vomit(args.Target, -1000, -1000); // You feel hollow!
var organs = _bodySystem.GetBodyOrganComponents<TransformComponent>(args.Target, body);
var organs = _bodySystem.GetBodyOrganEntityComps<TransformComponent>((args.Target, body));
var baseXform = Transform(args.Target);
foreach (var (xform, organ) in organs)
foreach (var organ in organs)
{
if (HasComp<BrainComponent>(xform.Owner) || HasComp<EyeComponent>(xform.Owner))
if (HasComp<BrainComponent>(organ.Owner) || HasComp<EyeComponent>(organ.Owner))
continue;

_transformSystem.AttachToGridOrMap(organ.Owner);
_transformSystem.PlaceNextTo((organ.Owner, organ.Comp1), (args.Target, baseXform));
}

_popupSystem.PopupEntity(Loc.GetString("admin-smite-vomit-organs-self"), args.Target,
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Anomaly/AnomalySynchronizerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void ConnectToAnomaly(Entity<AnomalySynchronizerComponent> ent, Entity<A
_audio.PlayPvs(ent.Comp.ConnectedSound, ent);
}

//TO DO: disconnection from the anomaly should also be triggered if the anomaly is far away from the synchronizer.
//TODO: disconnection from the anomaly should also be triggered if the anomaly is far away from the synchronizer.
//Currently only bluespace anomaly can do this, but for some reason it is the only one that cannot be connected to the synchronizer.
private void DisconneсtFromAnomaly(Entity<AnomalySynchronizerComponent> ent, AnomalyComponent anomaly)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public override void Update(float frameTime)
if (anomaly.Severity >= 0.97) reagentProducingAmount *= component.SupercriticalReagentProducingModifier;

newSol.AddReagent(component.ProducingReagent, reagentProducingAmount);
_solutionContainer.TryAddSolution(component.Solution.Value, newSol); //TO DO - the container is not fully filled.
_solutionContainer.TryAddSolution(component.Solution.Value, newSol); // TODO - the container is not fully filled.

component.AccumulatedFrametime = 0;

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Arcade/BlockGame/BlockGame.Ui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void InputTick(float frameTime)
/// <param name="message">The message to broadcase to all players/spectators.</param>
private void SendMessage(BoundUserInterfaceMessage message)
{
_uiSystem.ServerSendUiMessage(_entityManager.GetEntity(message.Entity), BlockGameUiKey.Key, message);
_uiSystem.ServerSendUiMessage(_owner, BlockGameUiKey.Key, message);
}

/// <summary>
Expand All @@ -167,7 +167,7 @@ private void SendMessage(BoundUserInterfaceMessage message)
/// <param name="actor">The target recipient.</param>
private void SendMessage(BoundUserInterfaceMessage message, EntityUid actor)
{
_uiSystem.ServerSendUiMessage(_entityManager.GetEntity(message.Entity), BlockGameUiKey.Key, message, actor);
_uiSystem.ServerSendUiMessage(_owner, BlockGameUiKey.Key, message, actor);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/CharacterInfo/CharacterInfoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private void OnRequestCharacterInfoEvent(RequestCharacterInfoEvent msg, EntitySe
var entity = args.SenderSession.AttachedEntity.Value;

var objectives = new Dictionary<string, List<ObjectiveInfo>>();
var jobTitle = "No Profession";
var jobTitle = Loc.GetString("character-info-no-profession");
string? briefing = null;
if (_minds.TryGetMind(entity, out var mindId, out var mind))
{
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Chemistry/EntitySystems/InjectorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ private void InjectDoAfter(Entity<InjectorComponent> injector, EntityUid target,
BreakOnMove = true,
BreakOnWeightlessMove = false,
BreakOnDamage = true,
NeedHand = true,
BreakOnHandChange = true,
MovementThreshold = 0.1f,
NeedHand = injector.Comp.NeedHand,
BreakOnHandChange = injector.Comp.BreakOnHandChange,
MovementThreshold = injector.Comp.MovementThreshold,
});
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Flash/DamagedByFlashingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private void OnFlashAttempt(Entity<DamagedByFlashingComponent> ent, ref FlashAtt
{
_damageable.TryChangeDamage(ent, ent.Comp.FlashDamage);

//To Do: It would be more logical if different flashes had different power,
//TODO: It would be more logical if different flashes had different power,
//and the damage would be inflicted depending on the strength of the flash.
}
}
2 changes: 1 addition & 1 deletion Content.Server/Ghost/Roles/ToggleableGhostRoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private void UpdateAppearance(EntityUid uid, ToggleableGhostRoleStatus status)

private void AddWipeVerb(EntityUid uid, ToggleableGhostRoleComponent component, GetVerbsEvent<ActivationVerb> args)
{
if (!args.CanAccess || !args.CanInteract)
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
return;

if (TryComp<MindContainerComponent>(uid, out var mind) && mind.HasMind)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void OnContainerModified(EntityUid uid, ReagentGrinderComponent reagentG
var outputContainer = _itemSlotsSystem.GetItemOrNull(uid, SharedReagentGrinder.BeakerSlotId);
_appearanceSystem.SetData(uid, ReagentGrinderVisualState.BeakerAttached, outputContainer.HasValue);

if (reagentGrinder.AutoMode != GrinderAutoMode.Off && !HasComp<ActiveReagentGrinderComponent>(uid))
if (reagentGrinder.AutoMode != GrinderAutoMode.Off && !HasComp<ActiveReagentGrinderComponent>(uid) && this.IsPowered(uid, EntityManager))
{
var program = reagentGrinder.AutoMode == GrinderAutoMode.Grind ? GrinderProgram.Grind : GrinderProgram.Juice;
DoWork(uid, reagentGrinder, program);
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Lightning/LightningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public void ShootLightning(EntityUid user, EntityUid target, string lightningPro
/// <param name="triggerLightningEvents">if the lightnings being fired should trigger lightning events.</param>
public void ShootRandomLightnings(EntityUid user, float range, int boltCount, string lightningPrototype = "Lightning", int arcDepth = 0, bool triggerLightningEvents = true)
{
//To Do: add support to different priority target tablem for different lightning types
//To Do: Remove Hardcode LightningTargetComponent (this should be a parameter of the SharedLightningComponent)
//To Do: This is still pretty bad for perf but better than before and at least it doesn't re-allocate
//TODO: add support to different priority target tablem for different lightning types
//TODO: Remove Hardcode LightningTargetComponent (this should be a parameter of the SharedLightningComponent)
//TODO: This is still pretty bad for perf but better than before and at least it doesn't re-allocate
// several hashsets every time

var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(_transform.GetMapCoordinates(user), range).ToList();
Expand Down
21 changes: 21 additions & 0 deletions Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Shuttles.Components;
using Content.Shared.CCVar;
using Content.Shared.Shuttles.BUIStates;
using Content.Shared.Shuttles.Components;
using Content.Shared.Shuttles.Events;
Expand All @@ -12,6 +13,26 @@ private void InitializeIFF()
SubscribeLocalEvent<IFFConsoleComponent, AnchorStateChangedEvent>(OnIFFConsoleAnchor);
SubscribeLocalEvent<IFFConsoleComponent, IFFShowIFFMessage>(OnIFFShow);
SubscribeLocalEvent<IFFConsoleComponent, IFFShowVesselMessage>(OnIFFShowVessel);
SubscribeLocalEvent<GridSplitEvent>(OnGridSplit);
}

private void OnGridSplit(ref GridSplitEvent ev)
{
var splitMass = _cfg.GetCVar(CCVars.HideSplitGridsUnder);

if (splitMass < 0)
return;

foreach (var grid in ev.NewGrids)
{
if (!_physicsQuery.TryGetComponent(grid, out var physics) ||
physics.Mass > splitMass)
{
continue;
}

AddIFFFlag(grid, IFFFlags.HideLabel);
}
}

private void OnIFFShow(EntityUid uid, IFFConsoleComponent component, IFFShowIFFMessage args)
Expand Down
24 changes: 24 additions & 0 deletions Content.Shared/Body/Systems/SharedBodySystem.Organs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,30 @@ public bool AddOrganToFirstValidSlot(
return list;
}

/// <summary>
/// Returns a list of Entity<<see cref="T"/>, <see cref="OrganComponent"/>>
/// for each organ of the body
/// </summary>
/// <typeparam name="T">The component that we want to return</typeparam>
/// <param name="entity">The body to check the organs of</param>
public List<Entity<T, OrganComponent>> GetBodyOrganEntityComps<T>(
Entity<BodyComponent?> entity)
where T : IComponent
{
if (!Resolve(entity, ref entity.Comp))
return new List<Entity<T, OrganComponent>>();

var query = GetEntityQuery<T>();
var list = new List<Entity<T, OrganComponent>>(3);
foreach (var organ in GetBodyOrgans(entity.Owner, entity.Comp))
{
if (query.TryGetComponent(organ.Id, out var comp))
list.Add((organ.Id, comp, organ.Component));
}

return list;
}

/// <summary>
/// Tries to get a list of ValueTuples of <see cref="T"/> and OrganComponent on each organs
/// in the given body.
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,13 @@ public static readonly CVarDef<int>
public static readonly CVarDef<bool> GodmodeArrivals =
CVarDef.Create("shuttle.godmode_arrivals", false, CVar.SERVERONLY);

/// <summary>
/// If a grid is split then hide any smaller ones under this mass (kg) from the map.
/// This is useful to avoid split grids spamming out labels.
/// </summary>
public static readonly CVarDef<int> HideSplitGridsUnder =
CVarDef.Create("shuttle.hide_split_grids_under", 30, CVar.SERVERONLY);

/// <summary>
/// Whether to automatically spawn escape shuttles.
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions Content.Shared/Chemistry/Components/InjectorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ public sealed partial class InjectorComponent : Component
[AutoNetworkedField]
[DataField]
public InjectorToggleMode ToggleState = InjectorToggleMode.Draw;

#region Arguments for injection doafter

/// <inheritdoc cref=DoAfterArgs.NeedHand>
[DataField]
public bool NeedHand = true;

/// <inheritdoc cref=DoAfterArgs.BreakOnHandChange>
[DataField]
public bool BreakOnHandChange = true;

/// <inheritdoc cref=DoAfterArgs.MovementThreshold>
[DataField]
public float MovementThreshold = 0.1f;

#endregion
}

/// <summary>
Expand Down
25 changes: 8 additions & 17 deletions Content.Shared/Cuffs/SharedCuffableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<HandCountChangedEvent>(OnHandCountChanged);
SubscribeLocalEvent<CuffableComponent, HandCountChangedEvent>(OnHandCountChanged);
SubscribeLocalEvent<UncuffAttemptEvent>(OnUncuffAttempt);

SubscribeLocalEvent<CuffableComponent, EntRemovedFromContainerMessage>(OnCuffsRemovedFromContainer);
Expand Down Expand Up @@ -380,33 +380,24 @@ private void OnCuffVirtualItemDeleted(EntityUid uid, HandcuffComponent component
/// <summary>
/// Check the current amount of hands the owner has, and if there's less hands than active cuffs we remove some cuffs.
/// </summary>
private void OnHandCountChanged(HandCountChangedEvent message)
private void OnHandCountChanged(Entity<CuffableComponent> ent, ref HandCountChangedEvent message)
{
var owner = message.Sender;

if (!TryComp(owner, out CuffableComponent? cuffable) ||
!cuffable.Initialized)
{
return;
}

var dirty = false;
var handCount = CompOrNull<HandsComponent>(owner)?.Count ?? 0;
var handCount = CompOrNull<HandsComponent>(ent.Owner)?.Count ?? 0;

while (cuffable.CuffedHandCount > handCount && cuffable.CuffedHandCount > 0)
while (ent.Comp.CuffedHandCount > handCount && ent.Comp.CuffedHandCount > 0)
{
dirty = true;

var container = cuffable.Container;
var entity = container.ContainedEntities[^1];
var handcuffContainer = ent.Comp.Container;
var handcuffEntity = handcuffContainer.ContainedEntities[^1];

_container.Remove(entity, container);
_transform.SetWorldPosition(entity, _transform.GetWorldPosition(owner));
_transform.PlaceNextTo(handcuffEntity, ent.Owner);
}

if (dirty)
{
UpdateCuffState(owner, cuffable);
UpdateCuffState(ent.Owner, ent.Comp);
}
}

Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/Lock/LockComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public sealed partial class LockComponent : Component
[ByRefEvent]
public record struct LockToggleAttemptEvent(EntityUid User, bool Silent = false, bool Cancelled = false);

/// <summary>
/// Event raised on the user when a toggle is attempted.
/// Can be cancelled to prevent it.
/// </summary>
[ByRefEvent]
public record struct UserLockToggleAttemptEvent(EntityUid Target, bool Silent = false, bool Cancelled = false);

/// <summary>
/// Event raised on a lock after it has been toggled.
/// </summary>
Expand Down
Loading
Loading