From 33232f163fef3193ff4d18fdd00258651f6d665d Mon Sep 17 00:00:00 2001 From: OnlyRealNubs <91900600+OnlyRealNubs@users.noreply.github.com> Date: Wed, 8 Jun 2022 15:57:50 -0400 Subject: [PATCH] Added "Satellite Radio" effect Basically just a mobile radio, it plays and is set to a random station. Can't change station, and doesn't interfere with vehicle radio. --- ChaosMod/ChaosMod.vcxproj | 1 + .../Effects/db/Player/PlayerMobileRadio.cpp | 33 +++++++++++++++++++ ConfigApp/Effects.cs | 1 + 3 files changed, 35 insertions(+) create mode 100644 ChaosMod/Effects/db/Player/PlayerMobileRadio.cpp diff --git a/ChaosMod/ChaosMod.vcxproj b/ChaosMod/ChaosMod.vcxproj index c6cc7cdf9..b83c7c830 100644 --- a/ChaosMod/ChaosMod.vcxproj +++ b/ChaosMod/ChaosMod.vcxproj @@ -155,6 +155,7 @@ + diff --git a/ChaosMod/Effects/db/Player/PlayerMobileRadio.cpp b/ChaosMod/Effects/db/Player/PlayerMobileRadio.cpp new file mode 100644 index 000000000..4e73c631b --- /dev/null +++ b/ChaosMod/Effects/db/Player/PlayerMobileRadio.cpp @@ -0,0 +1,33 @@ +#include + +static void OnStart() +{ + SET_RADIO_TO_STATION_INDEX(g_Random.GetRandomInt(0, 18)); +} + +static void OnStop() +{ + ENABLE_CONTROL_ACTION(2, 85, true); + + SET_MOBILE_PHONE_RADIO_STATE(false); + SET_AUDIO_FLAG("MobileRadioInGame", false); + SET_AUDIO_FLAG("AllowRadioDuringSwitch", false); +} + +static void OnTick() +{ + DISABLE_CONTROL_ACTION(2, 85, true); + + SET_MOBILE_PHONE_RADIO_STATE(true); + SET_AUDIO_FLAG("MobileRadioInGame", true); + SET_AUDIO_FLAG("AllowRadioDuringSwitch", true); +} + +// clang-format off +REGISTER_EFFECT(OnStart, OnStop, OnTick, EffectInfo + { + .Name = "Satellite Radio", + .Id = "mobile_radio", + .IsTimed = true + } +); \ No newline at end of file diff --git a/ConfigApp/Effects.cs b/ConfigApp/Effects.cs index e045e76e7..d362bacca 100644 --- a/ConfigApp/Effects.cs +++ b/ConfigApp/Effects.cs @@ -372,6 +372,7 @@ public enum EffectTimedType { "screen_colorfulworld", new EffectInfo("Colorful World", EffectCategory.Screen, true) }, { "screen_arc", new EffectInfo("Arced Screen", EffectCategory.Screen, true, true) }, { "world_blackhole", new EffectInfo("Black Hole", EffectCategory.Misc, true, true) }, + { "mobile_radio", new EffectInfo("Satellite Radio", EffectCategory.Player, true) }, }; } }