-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* nv toggling * sound and fixes * playsound parameter * sound tweaks * less variables
- Loading branch information
Showing
6 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
Content.Shared/Stories/Nightvision/SharedNightvisionSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Robust.Shared.Audio.Systems; | ||
using Robust.Shared.Timing; | ||
namespace Content.Shared.Stories.Nightvision; | ||
|
||
public sealed class SharedNightvisionSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IGameTiming _timing = default!; | ||
[Dependency] private readonly SharedAudioSystem _audio = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<NightvisionComponent, ToggleNightvisionEvent>(OnToggle); | ||
} | ||
private void OnToggle(EntityUid uid, NightvisionComponent component, ToggleNightvisionEvent args) | ||
{ | ||
if (!_timing.IsFirstTimePredicted) | ||
return; | ||
component.Enabled = !component.Enabled; | ||
if (component.Enabled && component.ToggleOnSound != null) | ||
_audio.PlayLocal(component.ToggleOnSound, uid, uid); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- type: entity | ||
id: ToggleNightvisionAction | ||
name: Ночное зрение | ||
description: Переключить своё ночное зрение. | ||
components: | ||
- type: InstantAction | ||
useDelay: 5 | ||
icon: { sprite: Stories/Clothing/Eyes/Glasses/nvg.rsi, state: icon } | ||
event: !type:ToggleNightvisionEvent |