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

Портативная консоль атмосферных угроз всем инженерам и атмосам. #754

Merged
merged 9 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Content.Server/Atmos/Consoles/AtmosAlertsComputerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
using Robust.Shared.Timing;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;

namespace Content.Server.Atmos.Monitor.Systems;

Expand All @@ -31,6 +34,7 @@ public sealed class AtmosAlertsComputerSystem : SharedAtmosAlertsComputerSystem
[Dependency] private readonly NavMapSystem _navMapSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly DeviceListSystem _deviceListSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;

private const float UpdateTime = 1.0f;

Expand All @@ -54,7 +58,7 @@ public override void Initialize()
SubscribeLocalEvent<AtmosAlertsDeviceComponent, AnchorStateChangedEvent>(OnDeviceAnchorChanged);
}

#region Event handling
#region Event handling

private void OnConsoleInit(EntityUid uid, AtmosAlertsComputerComponent component, ComponentInit args)
{
Expand Down Expand Up @@ -194,6 +198,14 @@ public override void Update(float frameTime)
if (TryComp<AppearanceComponent>(ent, out var entAppearance))
_appearance.SetData(ent, AtmosAlertsComputerVisuals.ComputerLayerScreen, (int) highestAlert, entAppearance);

// Sunrise-start
if (entConsole.NextBeep < _gameTiming.CurTime && highestAlert == AtmosAlarmType.Danger && entConsole.BeepSound != null)
{
_audio.PlayPvs(entConsole.BeepSound, ent);
entConsole.NextBeep = _gameTiming.CurTime + entConsole.Timer;
}
// Sunrise-end

// If the console UI is open, send UI data to each subscribed session
UpdateUIState(ent, airAlarmEntries, fireAlarmEntries, entConsole, entXform);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Atmos.Consoles;
using Content.Shared.Atmos.Monitor;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
Expand Down Expand Up @@ -27,6 +28,17 @@ public sealed partial class AtmosAlertsComputerComponent : Component
/// </summary>
[ViewVariables, AutoNetworkedField]
public HashSet<NetEntity> SilencedDevices = new();

// Sunrise-start
[DataField]
public SoundSpecifier? BeepSound;

[DataField]
public TimeSpan Timer = TimeSpan.FromSeconds(5);

[DataField]
public TimeSpan NextBeep = TimeSpan.Zero;
// Sunrise-end
}

[Serializable, NetSerializable]
Expand Down Expand Up @@ -77,7 +89,7 @@ public struct AtmosAlertsFocusDeviceData
public (float, AtmosAlarmType) PressureData;

/// <summary>
/// Moles, percentage, and related alert state, for all detected gases
/// Moles, percentage, and related alert state, for all detected gases
/// </summary>
public Dictionary<Gas, (float, float, AtmosAlarmType)> GasData;

Expand Down Expand Up @@ -200,7 +212,7 @@ public sealed class AtmosAlertsComputerDeviceSilencedMessage : BoundUserInterfac
public bool SilenceDevice = true;

/// <summary>
/// Used to inform the server that the client has silenced alerts from the specified device to this atmos monitoring console
/// Used to inform the server that the client has silenced alerts from the specified device to this atmos monitoring console
/// </summary>
public AtmosAlertsComputerDeviceSilencedMessage(NetEntity atmosDevice, bool silenceDevice = true)
{
Expand Down
Binary file added Resources/Audio/_Sunrise/Effects/beeps.ogg
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ loadout-group-adj-jumpsuit = Адъютант, комбинезон
loadout-group-adj-backpack = Адъютант, рюкзак
loadout-group-adj-head = Адъютант, головной убор
loadout-group-adj-outerClothing = Адъютант, верхняя одежда
loadout-group-atmos-console = Атмос консоль
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,14 @@ ent-BaseHandheldCamera = бодикамера
ent-HandheldCamera = { ent-BaseHandheldCamera }
.desc = { ent-BaseHandheldCamera.desc }
.suffix = Камера
ent-BaseAtmosAlertsMonitor = портативная консоль атмосферных угроз
.desc = Позволяет вам в любом месте смотреть за атмосферными угрозами.
ent-AtmosAlertsMonitor = { ent-BaseAtmosAlertsMonitor }
.desc = { ent-BaseAtmosAlertsMonitor.desc }
.suffix = Переносной, Требует энергию
ent-AtmosAlertsMonitorEmpty = { ent-BaseAtmosAlertsMonitor }
.desc = { ent-BaseAtmosAlertsMonitor.desc }
.suffix = Переносной, Пустой
ent-AtmosAlertsMonitorUnpowered = { ent-BaseAtmosAlertsMonitor }
.desc = { ent-BaseAtmosAlertsMonitor.desc }
.suffix = Переносной, Не требует энергии
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ loadout-group-adj-jumpsuit = Адъютант, комбинезон
loadout-group-adj-backpack = Адъютант, рюкзак
loadout-group-adj-head = Адъютант, головной убор
loadout-group-adj-outerClothing = Адъютант, верхняя одежда
loadout-group-atmos-console = Атмос консоль
3 changes: 3 additions & 0 deletions Resources/Prototypes/Loadouts/role_loadouts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@
- Trinkets
- GroupSpeciesBreathTool
# Sunrise-start
- AtmosphericsConsole
- Bra
- Pants
- Socks
Expand Down Expand Up @@ -367,6 +368,7 @@
- Trinkets
- GroupSpeciesBreathTool
# Sunrise-start
- AtmosphericsConsole
- Bra
- Pants
- Socks
Expand All @@ -384,6 +386,7 @@
- Trinkets
- GroupSpeciesBreathTool
# Sunrise-start
- AtmosphericsConsole
- Bra
- Pants
- Socks
Expand Down
114 changes: 93 additions & 21 deletions Resources/Prototypes/_Sunrise/Entities/Objects/Devices/handheld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@
enum.PowerDeviceVisualLayers.Powered:
True: { visible: true }
False: { visible: false }

- type: entity
id: PortableSurveillanceCameraMonitor
parent:
parent:
- BasePortableSurveillanceCameraMonitor
- BaseHandheldComputer
suffix: Handheld, Powered

- type: entity
id: PortableSurveillanceCameraMonitorEmpty
parent: PortableSurveillanceCameraMonitor
suffix: Handheld, Empty
components:
- type: Sprite
sprite: _Sunrise/Objects/Devices/portable_camera_viewer.rsi
sprite: _Sunrise/Objects/Devices/portable_camera_viewer.rsi # TODO: sprite
state: icon
layers:
- state: icon
Expand All @@ -72,7 +72,7 @@
slots:
cell_slot:
name: power-cell-slot-component-slot-name-default

- type: entity
id: PortableSurveillanceCameraMonitorUnpowered
parent: BasePortableSurveillanceCameraMonitor
Expand Down Expand Up @@ -118,10 +118,10 @@
enum.PowerDeviceVisualLayers.Powered:
True: { visible: true }
False: { visible: false }

- type: entity
id: HandheldCriminalRecordsMonitor
parent:
parent:
- BaseHandheldCriminalRecordsMonitor
- BaseHandheldComputer
suffix: HandHeld, Powered
Expand All @@ -144,12 +144,12 @@
slots:
cell_slot:
name: power-cell-slot-component-slot-name-default

- type: entity
id: HandheldCriminalRecordsMonitorUnpowered
parent: BaseHandheldCriminalRecordsMonitor
suffix: Handheld, Unpowered

# Handheld RoboAnalyzer

- type: entity
Expand Down Expand Up @@ -195,14 +195,14 @@
- type: GuideHelp
guides:
- Robotics

- type: entity
id: HandheldRoboAnalyzer
parent:
parent:
- BaseHandheldRoboAnalyzer
- BaseHandheldComputer
suffix: HandHeld, Powered

- type: entity
id: HandheldRoboAnalyzerEmpty
parent: HandheldRoboAnalyzer
Expand All @@ -221,12 +221,12 @@
slots:
cell_slot:
name: power-cell-slot-component-slot-name-default

- type: entity
id: HandheldRoboAnalyzerUnpowered
parent: BaseHandheldRoboAnalyzer
suffix: Handheld, Unpowered

# Handheld Mech Analyzer

- type: entity
Expand Down Expand Up @@ -271,14 +271,14 @@
- type: GuideHelp
guides:
- Robotics

- type: entity
id: HandheldMechAnalyzer
parent:
parent:
- BaseHandheldMechAnalyzer
- BaseHandheldComputer
suffix: HandHeld, Powered

- type: entity
id: HandheldMechAnalyzerEmpty
parent: HandheldMechAnalyzer
Expand All @@ -297,12 +297,12 @@
slots:
cell_slot:
name: power-cell-slot-component-slot-name-default

- type: entity
id: HandheldMechAnalyzerUnpowered
parent: BaseHandheldMechAnalyzer
suffix: Handheld, Unpowered

# Handheld Camera

- type: entity
Expand Down Expand Up @@ -346,8 +346,80 @@
volume: -8
maxDistance: 10
variation: 0.05

- type: entity
id: HandheldCamera
parent: BaseHandheldCamera
suffix: HandHeld
suffix: HandHeld

# Atmos alerts console

- type: entity
name: handheld atmos console
parent: BaseItem
id: BaseAtmosAlertsMonitor
description: A hand-held crew monitor displaying the status of wanted persons on station.
abstract: true
components:
- type: Sprite
sprite: _Sunrise/Objects/Devices/handheld_atmos_console.rsi
state: icon
layers:
- state: icon
- state: scanner
shader: unshaded
visible: true
map: [ "enum.PowerDeviceVisualLayers.Powered" ]
- type: AtmosAlertsComputer
beepSound:
path: /Audio/_Sunrise/Effects/beeps.ogg
- type: ActivatableUI
singleUser: true
key: enum.AtmosAlertsComputerUiKey.Key
- type: UserInterface
interfaces:
enum.AtmosAlertsComputerUiKey.Key:
type: AtmosAlertsComputerBoundUserInterface
enum.WiresUiKey.Key:
type: WiresBoundUserInterface
- type: WirelessNetworkConnection
range: 500
- type: StationLimitedNetwork
- type: Appearance
- type: GenericVisualizer
visuals:
enum.PowerCellSlotVisuals.Enabled:
enum.PowerDeviceVisualLayers.Powered:
True: { visible: true }
False: { visible: false }

- type: entity
id: AtmosAlertsMonitor
parent:
- BaseAtmosAlertsMonitor
- BaseHandheldComputer
suffix: HandHeld, Powered

- type: entity
id: AtmosAlertsMonitorEmpty
parent: AtmosAlertsMonitor
suffix: HandHeld, Empty
components:
- type: Sprite
sprite: _Sunrise/Objects/Devices/handheld_atmos_console.rsi
state: icon
layers:
- state: icon
- state: scanner
shader: unshaded
visible: false
map: [ "enum.PowerDeviceVisualLayers.Powered" ]
- type: ItemSlots
slots:
cell_slot:
name: power-cell-slot-component-slot-name-default

- type: entity
id: AtmosAlertsMonitorUnpowered
parent: BaseAtmosAlertsMonitor
suffix: Handheld, Unpowered
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- type: loadout
id: AtmosphericsConsole
storage:
back:
- AtmosAlertsMonitor
5 changes: 5 additions & 0 deletions Resources/Prototypes/_Sunrise/Loadouts/loadout_groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,8 @@
loadouts:
- AdjutantCoat

- type: loadoutGroup
id: AtmosphericsConsole
name: loadout-group-atmos-console
loadouts:
- AtmosphericsConsole
2 changes: 2 additions & 0 deletions Resources/Prototypes/_Sunrise/Loadouts/role_loadouts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
- StationEngineerBackpack
- StationEngineerOuterClothing
- StationEngineerShoes
- AtmosphericsConsole
- SurvivalExtended
- Trinkets
- GroupSpeciesBreathTool
Expand Down Expand Up @@ -157,6 +158,7 @@
- StationEngineerBackpack
- StationEngineerOuterClothing
- StationEngineerShoes
- AtmosphericsConsole
- Trinkets
- SurvivalExtended
- GroupSpeciesBreathTool
Expand Down
4 changes: 4 additions & 0 deletions Resources/Prototypes/borg_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
collection: FootstepCyborgSpider
params:
volume: -15
addComponents:
- type: InnateItem
instantActions:
- AtmosAlertsMonitor
# Sunrise-End

# Visual
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading