Skip to content

Commit

Permalink
less variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pheenty committed Oct 22, 2024
1 parent 46f931a commit 85de1b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Content.Shared/Stories/Nightvision/NightvisionComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ public sealed partial class NightvisionComponent : Component
public string ToggleAction = "ToggleNightvisionAction";
[DataField, AutoNetworkedField]
public EntityUid? ToggleActionEntity;
[ViewVariables(VVAccess.ReadWrite), DataField("playSound"), AutoNetworkedField]
public bool PlaySound { get; set; } = true; // For dragon
[DataField("toggleOnSound")]
public SoundSpecifier ToggleOnSound = new SoundPathSpecifier("/Audio/Stories/Misc/night_vision.ogg");
public SoundSpecifier? ToggleOnSound = new SoundPathSpecifier("/Audio/Stories/Misc/night_vision.ogg");
}

[RegisterComponent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private void OnToggle(EntityUid uid, NightvisionComponent component, ToggleNight
if (!_timing.IsFirstTimePredicted)
return;
component.Enabled = !component.Enabled;
if (component.Enabled && component.PlaySound)
if (component.Enabled && component.ToggleOnSound != null)
_audio.PlayLocal(component.ToggleOnSound, uid, uid);
}
}

0 comments on commit 85de1b2

Please sign in to comment.