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 11 commits into
base: master
Choose a base branch
from
7 changes: 7 additions & 0 deletions Content.Server/_LostParadise/BodyCam/BodyCameraComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server._LostParadise.BodyCam;
/// Taken from _CorvaxNext
/// <summary>
/// A marker component for cameras that should only be active when worn.
/// </summary>
Evgencheg marked this conversation as resolved.
Show resolved Hide resolved
[RegisterComponent]
public sealed partial class BodyCameraComponent : Component;
55 changes: 55 additions & 0 deletions Content.Server/_LostParadise/BodyCam/BodyCameraSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Content.Server.SurveillanceCamera;
using Content.Shared.Clothing;
using Content.Shared.Clothing.Components;
using Robust.Shared.GameObjects;

/// Taken from _CorvaxNext

namespace Content.Server._LostParadise.BodyCam;

/// <summary>
/// A system that automatically enables or disables a camera
/// depending on whether the item is currently equipped in a clothing slot.
/// </summary>
Evgencheg marked this conversation as resolved.
Show resolved Hide resolved
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,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
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: "Нагрудная камера"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Замените русский текст на английский

Согласно правилам, в прототипах запрещено использование русского языка. ID камеры должен быть на английском.

Предлагаемые изменения:

- id: "Нагрудная камера"
+ id: "Body Camera"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
id: "Нагрудная камера"
id: "Body Camera"

- type: BodyCamera

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