diff --git a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs index d8ab4a99ed..72f6bf49cd 100644 --- a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs +++ b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs @@ -51,6 +51,8 @@ private void OnMobStateChanged(EntityUid uid, SuspicionPlayerComponent component if (args.NewMobState != MobState.Dead) // Someone died. return; + DropAllItemsOnEntity(args.Target); + var query = EntityQueryEnumerator(); while (query.MoveNext(out var ruleId, out var sus, out var gameRule)) { @@ -152,18 +154,21 @@ private void OnExamine(EntityUid uid, SuspicionPlayerComponent component, ref Ex AddTcToPlayer(args.Examiner, tc); implantT.Value.Comp.Balance.Clear(); - if (_playerManager.TryGetSessionByEntity(args.Examiner, out var session)) + if (tc >= 0) { - var msgFound = Loc.GetString("suspicion-found-tc", ("tc", tc)); - _chatManager.ChatMessageToOne( - ChatChannel.Server, - msgFound, - msgFound, - EntityUid.Invalid, - false, - client: session.Channel, - recordReplay:true - ); + if (_playerManager.TryGetSessionByEntity(args.Examiner, out var session)) + { + var msgFound = Loc.GetString("suspicion-found-tc", ("tc", tc)); + _chatManager.ChatMessageToOne( + ChatChannel.Server, + msgFound, + msgFound, + EntityUid.Invalid, + false, + client: session.Channel, + recordReplay:true + ); + } } } } diff --git a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Utility.cs b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Utility.cs index 5f56d83774..452aac2918 100644 --- a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Utility.cs +++ b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Utility.cs @@ -3,9 +3,11 @@ using Content.Shared.FixedPoint; using Content.Shared.Humanoid; using Content.Shared.Implants.Components; +using Content.Shared.Inventory; using Content.Shared.Mind; using Content.Shared.Mind.Components; using Content.Shared.Roles; +using Content.Shared.Storage; using Content.Shared.Store.Components; using Robust.Shared.Map; using Robust.Shared.Physics.Components; @@ -120,6 +122,32 @@ private void AddTcToPlayer(EntityUid player, int amount, bool displayMessage = t return result; } + public void DropAllItemsOnEntity(EntityUid entity) + { + if (!TryComp(entity, out InventoryComponent? inventory)) + return; + + var slots = _inventory.GetSlotEnumerator(new Entity(entity, inventory), SlotFlags.All); + var targetPos = _transformSystem.GetWorldPosition(entity); + + while (slots.MoveNext(out var slot)) + { + foreach (var rootContainerEnt in slot.ContainedEntities) + { + if (!TryComp(rootContainerEnt, out StorageComponent? storage)) + continue; + + var dumpQueue = new Queue(storage.Container.ContainedEntities); + + foreach (var item in dumpQueue) + { + var transform = Transform(item); + _transformSystem.SetWorldPositionRotation(item, targetPos + _random.NextVector2Box() / 4, _random.NextAngle(), transform); + } + } + } + } + public void AddKeyToRadio(EntityUid entity, string keyProto) { if (!_inventory.TryGetSlotEntity(entity, "ears", out var headset)) diff --git a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs index cd13d4f57e..09f91a6b67 100644 --- a/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs +++ b/Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs @@ -31,6 +31,7 @@ using Robust.Server.Player; using Robust.Shared.Audio; using Robust.Shared.Prototypes; +using Robust.Shared.Random; using Robust.Shared.Timing; namespace Content.Server._SSS.SuspicionGameRule; @@ -60,6 +61,7 @@ public sealed partial class SuspicionRuleSystem : GameRuleSystem