Skip to content

Commit

Permalink
Add detective and traitor radio
Browse files Browse the repository at this point in the history
  • Loading branch information
Simyon264 committed Oct 19, 2024
1 parent 0da515d commit 9f6ca53
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ public sealed partial class SuspicionRuleComponent : Component
public string DetectiveImplant = "SusDetectiveUplinkImplant";


[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<RadioChannelPrototype>))]
public string TraitorRadio = "Syndicate";
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string TraitorRadio = "EncryptionKeySyndie";

[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<NpcFactionPrototype>))]
public string TraitorFaction = "Syndicate";

[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string DetectiveRadio = "EncryptionKeySecurity";

/// <summary>
/// How much TC to give to traitors/detectives for their performance
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ private void StartRound(EntityUid uid, SuspicionRuleComponent component, GameRul
// Hijacking the nuke op systems to show fellow traitors. Don't have to reinvent the wheel.
EnsureComp<NukeOperativeComponent>(ownedEntity.Value);
EnsureComp<ShowSyndicateIconsComponent>(ownedEntity.Value);
EnsureComp<IntrinsicRadioTransmitterComponent>(ownedEntity.Value).Channels.Add(component.TraitorRadio);

AddKeyToRadio(ownedEntity.Value, component.TraitorRadio);

_npcFactionSystem.AddFaction(ownedEntity.Value, component.TraitorFaction);

Expand All @@ -126,6 +127,8 @@ private void StartRound(EntityUid uid, SuspicionRuleComponent component, GameRul

EnsureComp<CriminalRecordComponent>(ownedEntity.Value).StatusIcon = "SecurityIconDischarged";

AddKeyToRadio(ownedEntity.Value, component.DetectiveRadio);

_subdermalImplant.AddImplants(ownedEntity.Value, new List<string> {component.DetectiveImplant});

_antagSelectionSystem.SendBriefing(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Roles;
using Robust.Server.Containers;
using Robust.Shared.Map;
using Robust.Shared.Physics.Components;

namespace Content.Server._SSS.SuspicionGameRule;

Expand Down Expand Up @@ -65,4 +68,20 @@ private void SendAnnouncement(string message, Color? colorOverride = null)

return result;
}

public void AddKeyToRadio(EntityUid entity, string keyProto)
{
if (!_inventory.TryGetSlotEntity(entity, "ears", out var headset))
return;

if (!_containerSystem.TryGetContainer(headset.Value, "key_slots", out var container))
return;

var key = Spawn(keyProto, MapCoordinates.Nullspace);
var transform = Comp<TransformComponent>(key);
var meta = Comp<MetaDataComponent>(key);
var physics = Comp<PhysicsComponent>(key);

_containerSystem.Insert((key, transform, meta, physics), container, null, true);
}
}
4 changes: 4 additions & 0 deletions Content.Server/_SSS/SuspicionGameRule/SuspicionRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
using Content.Shared.Damage;
using Content.Shared.Examine;
using Content.Shared.GameTicking.Components;
using Content.Shared.Inventory;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Systems;
using Content.Shared.NPC.Systems;
using Robust.Server.Containers;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Audio;
Expand Down Expand Up @@ -53,6 +55,8 @@ public sealed partial class SuspicionRuleSystem : GameRuleSystem<SuspicionRuleCo
[Dependency] private readonly IdCardSystem _idCardSystem = default!;
[Dependency] private readonly EntityLookupSystem _entityLookupSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly ContainerSystem _containerSystem = default!;

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

Expand Down

0 comments on commit 9f6ca53

Please sign in to comment.