diff --git a/Content.Server/_CorvaxNext/BodyCam/BodyCameraComponent.cs b/Content.Server/_CorvaxNext/BodyCam/BodyCameraComponent.cs new file mode 100644 index 00000000000..75f4442adde --- /dev/null +++ b/Content.Server/_CorvaxNext/BodyCam/BodyCameraComponent.cs @@ -0,0 +1,12 @@ +using Robust.Shared.GameObjects; + +namespace Content.Server.Camera +{ + /// + /// A marker component for cameras that should only be active when worn. + /// + [RegisterComponent] + public sealed partial class BodyCameraComponent : Component + { + } +} \ No newline at end of file diff --git a/Content.Server/_CorvaxNext/BodyCam/BodyCameraSystem.cs b/Content.Server/_CorvaxNext/BodyCam/BodyCameraSystem.cs new file mode 100644 index 00000000000..0e7bab5eb90 --- /dev/null +++ b/Content.Server/_CorvaxNext/BodyCam/BodyCameraSystem.cs @@ -0,0 +1,62 @@ +using Content.Server.SurveillanceCamera; +using Content.Shared.Clothing; +using Content.Shared.Clothing.Components; +using Robust.Shared.GameObjects; + +namespace Content.Server.Camera +{ + /// + /// A system that automatically enables or disables a camera + /// depending on whether the item is currently equipped in a clothing slot. + /// + public sealed class BodyCameraSystem : EntitySystem + { + [Dependency] private readonly SurveillanceCameraSystem _surveillanceSystem = default!; + + public override void Initialize() + { + base.Initialize(); + + // When the BodyCameraComponent is added, ensure the camera starts off. + SubscribeLocalEvent(OnStartup); + + // Turn camera on/off when the clothing item is equipped/unequipped. + SubscribeLocalEvent(OnEquipped); + SubscribeLocalEvent(OnUnequipped); + } + + /// + /// On component startup, forcibly disable the camera (if found). + /// + private void OnStartup(EntityUid uid, BodyCameraComponent component, ComponentStartup args) + { + // If there's a SurveillanceCameraComponent, turn it off immediately. + if (TryComp(uid, out var camComp)) + { + _surveillanceSystem.SetActive(uid, false, camComp); + } + } + + /// + /// When the item is equipped, turn the camera on. + /// + private void OnEquipped(EntityUid uid, BodyCameraComponent component, ref ClothingGotEquippedEvent args) + { + if (TryComp(uid, out var camComp)) + { + _surveillanceSystem.SetActive(uid, true, camComp); + } + } + + /// + /// When the item is unequipped, turn the camera off. + /// + private void OnUnequipped(EntityUid uid, BodyCameraComponent component, ref ClothingGotUnequippedEvent args) + { + if (TryComp(uid, out var camComp)) + { + _surveillanceSystem.SetActive(uid, false, camComp); + } + } + } +} diff --git a/Resources/Prototypes/_CorvaxNext/Entities/Clothing/Neck/secbadge.yml b/Resources/Prototypes/_CorvaxNext/Entities/Clothing/Neck/secbadge.yml index b69529f2143..6fa8e8edce8 100644 --- a/Resources/Prototypes/_CorvaxNext/Entities/Clothing/Neck/secbadge.yml +++ b/Resources/Prototypes/_CorvaxNext/Entities/Clothing/Neck/secbadge.yml @@ -1,5 +1,5 @@ - type: entity - parent: ClothingNeckBase + parent: [ClothingNeckBase, BaseBodyCamera] id: ClothingNeckSecBadgeBase name: badge description: Respect my authority! diff --git a/Resources/Prototypes/_CorvaxNext/Entities/Objects/Tools/bodycamera.yml b/Resources/Prototypes/_CorvaxNext/Entities/Objects/Tools/bodycamera.yml new file mode 100644 index 00000000000..7390c1ff002 --- /dev/null +++ b/Resources/Prototypes/_CorvaxNext/Entities/Objects/Tools/bodycamera.yml @@ -0,0 +1,26 @@ +- type: entity + abstract: true + parent: BaseItem + id: BaseBodyCamera + components: + - type: Eye + - type: WirelessNetworkConnection + - type: UserInterface + interfaces: + enum.SurveillanceCameraSetupUiKey.Camera: + type: SurveillanceCameraSetupBoundUi + - type: DeviceNetwork + deviceNetId: Wired + receiveFrequencyId: SurveillanceCameraSecurity + transmitFrequencyId: SurveillanceCamera + - type: SurveillanceCamera + setupAvailableNetworks: + - SurveillanceCameraSecurity + isOffable: true + isOffableVisuals: true + networkSet: true + id: "Нагрудная камера" + - type: SurveillanceCameraMicrophone + - type: ActiveListener + range: 6 + - type: BodyCamera \ No newline at end of file