Skip to content

Commit

Permalink
Update 8.11 (#26)
Browse files Browse the repository at this point in the history
this is only for changelog bot

**Changelog**
:cl:
- add: Items in bags will now drop from a person once they die.
- remove: Removed blastdoors on Central Command.
- fix: Fixed TC finding message on Traitors for detectives apperaing
multiple times.
  • Loading branch information
Simyon264 authored Nov 9, 2024
2 parents e31dc7e + 449d950 commit 8bb7fa1
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 389 deletions.
27 changes: 16 additions & 11 deletions Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.Rules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SuspicionRuleComponent, GameRuleComponent>();
while (query.MoveNext(out var ruleId, out var sus, out var gameRule))
{
Expand Down Expand Up @@ -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
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<InventoryComponent?>(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<EntityUid>(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))
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -60,6 +61,7 @@ public sealed partial class SuspicionRuleSystem : GameRuleSystem<SuspicionRuleCo
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly ContainerSystem _containerSystem = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly IRobustRandom _random = default!;

private readonly SoundSpecifier _traitorStartSound = new SoundPathSpecifier("/Audio/Ambience/Antag/traitor_start.ogg");

Expand Down
Loading

0 comments on commit 8bb7fa1

Please sign in to comment.