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

Боди-камера #363

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions Content.Server/_CorvaxNext/BodyCam/BodyCameraComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Content.Server._CorvaxNext.BodyCam;
/// <summary>
/// A marker component for cameras that should only be active when worn.
/// </summary>
[RegisterComponent]
public sealed partial class BodyCameraComponent : Component;
53 changes: 53 additions & 0 deletions Content.Server/_CorvaxNext/BodyCam/BodyCameraSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Content.Server.SurveillanceCamera;
using Content.Shared.Clothing;
using Content.Shared.Clothing.Components;
using Robust.Shared.GameObjects;

namespace Content.Server._CorvaxNext.BodyCam;

/// <summary>
/// A system that automatically enables or disables a camera
/// depending on whether the item is currently equipped in a clothing slot.
/// </summary>
public sealed class BodyCameraSystem : EntitySystem
{
[Dependency] private readonly SurveillanceCameraSystem _surveillanceSystem = default!;

public override void Initialize()
{
// When the BodyCameraComponent is added, ensure the camera starts off.
SubscribeLocalEvent<BodyCameraComponent, ComponentStartup>(OnStartup);

// Turn camera on/off when the clothing item is equipped/unequipped.
SubscribeLocalEvent<BodyCameraComponent, ClothingGotEquippedEvent>(OnEquipped);
SubscribeLocalEvent<BodyCameraComponent, ClothingGotUnequippedEvent>(OnUnequipped);
}

/// <summary>
/// On component startup, forcibly disable the camera (if found).
/// </summary>
private void OnStartup(EntityUid uid, BodyCameraComponent component, ComponentStartup args)
{
// If there's a SurveillanceCameraComponent, turn it off immediately.
if (TryComp<SurveillanceCameraComponent>(uid, out var camComp))
_surveillanceSystem.SetActive(uid, false, camComp);
}

/// <summary>
/// When the item is equipped, turn the camera on.
/// </summary>
private void OnEquipped(EntityUid uid, BodyCameraComponent component, ref ClothingGotEquippedEvent args)
{
if (TryComp<SurveillanceCameraComponent>(uid, out var camComp))
_surveillanceSystem.SetActive(uid, true, camComp);
}

/// <summary>
/// When the item is unequipped, turn the camera off.
/// </summary>
private void OnUnequipped(EntityUid uid, BodyCameraComponent component, ref ClothingGotUnequippedEvent args)
{
if (TryComp<SurveillanceCameraComponent>(uid, out var camComp))
_surveillanceSystem.SetActive(uid, false, camComp);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-LPPClothingNeckSecBodycamera = security bodycamera
.desc = Security body camera, useful for monitoring officers and cadets on patrols
Evgencheg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-LPPClothingNeckSecBodycamera = Боди-камера
.desc = Боди-камера службы безопастности, полезна для слежки за офицерами или кадетами в патрулях
Evgencheg marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions Resources/Prototypes/Catalog/Fills/Lockers/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
- id: ClothingHeadsetSecurity
- id: ClothingHandsGlovesColorBlack
- id: ClothingShoesBootsJack
- id: LPPClothingNeckSecBodycamera
- id: LPPBookSpaceLaw
- id: WeaponMeleeNeedle
prob: 0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
ClothingHeadHelmetBasic: 2
# BreachingCharge: 8
LPPClothingHandsGlovesTacticalFingerless: 1 # Lost Paradise - Добавление тактических беспалых боевых перчаток
LPPClothingNeckSecBodycamera: 5 #LPP
LPPTelebaton: 3 #LPP
ClothingBeltHolster: 3
# security officers need to follow a diet regimen!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- 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
networkSet: true
id: "Нагрудная камера"
Evgencheg marked this conversation as resolved.
Show resolved Hide resolved
- type: BodyCamera

Evgencheg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- type: entity
parent: [ClothingNeckBase, BaseBodyCamera]
id: LPPClothingNeckSecBodycamera
name: security bodycamera
description: Security body camera, useful for monitoring officers and cadets on patrols
components:
- type: Sprite
sprite: _LostParadise/Clothing/Neck/secbodycam.rsi
- type: Clothing
sprite: _LostParadise/Clothing/Neck/secbodycam.rsi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": 1,
"license": "CC-BY-NC-SA-3.0",
"copyright": "Made by Hqlle(Github)",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "icon"
},
{
"name": "equipped-NECK",
"directions": 4
},
{
"name": "inhand-right",
"directions": 4
},
{
"name": "inhand-left",
"directions": 4
}
]
}
Loading