Skip to content

Commit

Permalink
Bodycam (#347)
Browse files Browse the repository at this point in the history
* Bodycam

* Missing Gear

* Moved to its own PR

* Fix

* Update bodycam.yml

* Update BodycamComponent.cs
  • Loading branch information
dvir001 authored Oct 11, 2023
1 parent 1376f19 commit c3d209e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
10 changes: 1 addition & 9 deletions Content.Server/_NF/Bodycam/BodycamComponent.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Content.Server._NF.Bodycam;
using Content.Server.SurveillanceCamera;
using Robust.Shared.Serialization;

namespace Content.Shared._NF.Bodycam
{
[RegisterComponent]
[Access(typeof(BodycamSystem))]
public sealed partial class BodycamComponent : Component
{
/// <summary>
/// Choose a random camera mode when item is spawned.
/// </summary>
[DataField("randomMode")]
public bool RandomMode = false;

/// <summary>
/// If true user can't change camera mode
/// </summary>
Expand Down Expand Up @@ -43,7 +35,7 @@ public sealed partial class BodycamComponent : Component
/// How often does camera update its owners status (in seconds). Limited by the system update rate.
/// </summary>
[DataField("updateRate")]
public TimeSpan UpdateRate = TimeSpan.FromSeconds(2f);
public TimeSpan UpdateRate = TimeSpan.FromSeconds(30);

/// <summary>
/// Current user that wears camera. Null if nobody wearing it.
Expand Down
9 changes: 4 additions & 5 deletions Content.Server/_NF/Bodycam/BodycamSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public override void Update(float frameTime)

var curTime = _gameTiming.CurTime;
var cameras = EntityManager.EntityQueryEnumerator<BodycamComponent, DeviceNetworkComponent>();
bool power = false;

while (cameras.MoveNext(out var uid, out var camera, out var device))
{
Expand All @@ -52,11 +51,11 @@ public override void Update(float frameTime)

// get camera status
var status = GetCameraState(uid, camera);
if (status == null);
else
{

var power = false;
if (status != null)
power = true;
}

_surveillanceCameras.SetActive(uid, power);
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/_NF/Bodycam/SharedBodycam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public BodycamStatus(NetEntity bodycamUid)
public enum BodycamMode : byte
{
/// <summary>
/// Sensor doesn't send any information about owner
/// Bodycam off
/// </summary>
CameraOff = 0,

/// <summary>
/// Sensor sends only binary status (alive/dead)
/// Bodycam on
/// </summary>
CameraOn = 1,
}
Expand Down
3 changes: 1 addition & 2 deletions Resources/Prototypes/_NF/Entities/Clothing/Neck/bodycam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# - SurveillanceCameraMonitor
# - RadioSpeaker
# - type: ActiveListener
# range: 10
# range: 1 # Only the sound from the person using it
- type: UserInterface
interfaces:
- key: enum.SurveillanceCameraSetupUiKey.Camera
Expand All @@ -43,4 +43,3 @@
- type: StaticPrice
price: 50
- type: Bodycam
mode: CameraOn

0 comments on commit c3d209e

Please sign in to comment.