mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +01:00
Re-Adds the radio noise volume slider (#96602)
## About The Pull Request As the title said, re-adds the radio noise volume slider in the preferences menu. <details> <summary>Images</summary> Before: <img width="920" height="770" alt="image" src="https://github.com/user-attachments/assets/d182f6ed-7968-4fa7-a4df-73d1125e9c32" /> After: <img width="920" height="770" alt="image" src="https://github.com/user-attachments/assets/3e414130-ca04-4f76-8dbb-608bca1b84f4" /> </details> ## Why It's Good For The Game People should be able to adjust the volume of radio beeps, since it can be overwhelmingly loud when radio is really going off. ## Changelog 🆑 fix: Fixed the radio volume slider being missing in game preferences /🆑 --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -497,7 +497,6 @@
|
||||
data["subspace"] = subspace_transmission
|
||||
data["subspaceSwitchable"] = subspace_switchable
|
||||
data["headset"] = FALSE
|
||||
data["radio_noises"] = (user.client?.prefs.read_preference(/datum/preference/numeric/volume/sound_radio_noise))
|
||||
|
||||
return data
|
||||
|
||||
@@ -506,7 +505,6 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/mob/user = ui.user
|
||||
switch(action)
|
||||
if("frequency")
|
||||
if(freqlock != RADIO_FREQENCY_UNLOCKED)
|
||||
@@ -557,15 +555,6 @@
|
||||
else
|
||||
recalculateChannels()
|
||||
. = TRUE
|
||||
if("set_radio_volume")
|
||||
if(!user.client)
|
||||
return
|
||||
user.client.prefs.write_preference(GLOB.preference_entries[/datum/preference/numeric/volume/sound_radio_noise], params["volume"])
|
||||
//let them know what it'll sound like
|
||||
//we get their read prefs instead of just taking the params beacuse write_preference is what handles ensuring
|
||||
//there's no href exploits.
|
||||
var/volume_modifier = (user.client.prefs.read_preference(/datum/preference/numeric/volume/sound_radio_noise))
|
||||
SEND_SOUND(user, sound('sound/items/radio/radio_receive.ogg', volume = volume_modifier))
|
||||
|
||||
/obj/item/radio/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
|
||||
/// Controls radio noise volume
|
||||
/datum/preference/numeric/volume/sound_radio_noise
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "sound_radio_noise"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
|
||||
+7
@@ -135,6 +135,13 @@ export const sound_achievement: FeatureChoiced = {
|
||||
component: FeatureDropdownInput,
|
||||
};
|
||||
|
||||
export const sound_radio_noise: Feature<number> = {
|
||||
name: 'Radio sound volume',
|
||||
category: 'SOUND',
|
||||
description: 'Volume of the bloops that play when a radio message is said or received.',
|
||||
component: FeatureSliderInput,
|
||||
};
|
||||
|
||||
export const sound_ai_vox: Feature<number> = {
|
||||
name: 'AI VOX announcements volume',
|
||||
category: 'SOUND',
|
||||
|
||||
@@ -18,7 +18,6 @@ store.set(gameDataAtom, {
|
||||
subspace: 0,
|
||||
subspaceSwitchable: 1,
|
||||
channels: {},
|
||||
radio_noises: 0,
|
||||
});
|
||||
|
||||
describe('Radio tests', () => {
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
LabeledList,
|
||||
NumberInput,
|
||||
Section,
|
||||
Slider,
|
||||
Stack,
|
||||
} from 'tgui-core/components';
|
||||
import { toFixed } from 'tgui-core/math';
|
||||
@@ -27,7 +26,6 @@ type RadioData = {
|
||||
subspace: BooleanLike;
|
||||
subspaceSwitchable: BooleanLike;
|
||||
channels: Record<string, BooleanLike>;
|
||||
radio_noises: number;
|
||||
};
|
||||
|
||||
export const Radio = (props) => {
|
||||
@@ -43,7 +41,6 @@ export const Radio = (props) => {
|
||||
useCommand,
|
||||
subspace,
|
||||
subspaceSwitchable,
|
||||
radio_noises,
|
||||
} = data;
|
||||
const tunedChannel = RADIO_CHANNELS.find(
|
||||
(channel) => channel.freq === frequency,
|
||||
@@ -53,14 +50,14 @@ export const Radio = (props) => {
|
||||
status: !!value,
|
||||
}));
|
||||
// Calculate window height
|
||||
let height = 133;
|
||||
let height = 105;
|
||||
if (channels.length > 0) {
|
||||
height += channels.length * 25 + 8;
|
||||
} else if (subspace) {
|
||||
height += 24;
|
||||
}
|
||||
return (
|
||||
<Window width={380} height={height}>
|
||||
<Window width={330} height={height}>
|
||||
<Window.Content>
|
||||
<Section>
|
||||
<LabeledList>
|
||||
@@ -127,20 +124,6 @@ export const Radio = (props) => {
|
||||
/>
|
||||
)}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Radio Noise Volume">
|
||||
<Slider
|
||||
onChange={(e, value) => {
|
||||
act('set_radio_volume', {
|
||||
volume: value,
|
||||
});
|
||||
}}
|
||||
minValue={0}
|
||||
maxValue={100}
|
||||
step={1}
|
||||
value={radio_noises}
|
||||
stepPixelSize={10}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
{(!!subspace || channels.length > 0) && (
|
||||
<LabeledList.Item label="Channels">
|
||||
{channels.length === 0 && (
|
||||
|
||||
Reference in New Issue
Block a user