Skip to content

Commit

Permalink
Remove deprecated reload plugin button
Browse files Browse the repository at this point in the history
  • Loading branch information
EMERALD0874 committed Aug 27, 2022
1 parent 2b758d5 commit e8af9d4
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({}) => {
gamesRunning,
setActiveSound,
soundPacks,
setSoundPacks,
menuMusic,
setMenuMusic,
selectedMusic,
Expand Down Expand Up @@ -62,54 +61,6 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({}) => {
}
}

function reloadPlugin() {
dummyFuncTest();
python.resolve(python.reloadPacksDir(), () => {
python.resolve(python.getSoundPacks(), (data: any) => {
setSoundPacks(data);
});
});

python.resolve(python.getConfig(), (data: any) => {
// This just has fallbacks incase the fetch fails or the config is improperly formatted
setActiveSound(data?.selected_pack || "Default");
setSelectedMusic(data?.selected_music || "None");
});

restartMusicPlayer(selectedMusic);

unpatch(
AudioParent.GamepadUIAudio.m_AudioPlaybackManager.__proto__,
"PlayAudioURL"
);

beforePatch(
AudioParent.GamepadUIAudio.m_AudioPlaybackManager.__proto__,
"PlayAudioURL",
(args) => {
let newSoundURL: string = "";
switch (activeSound) {
case "Default":
newSoundURL = args[0];
break;
default:
const currentPack = soundPacks.find((e) => e.name === activeSound);
if (currentPack?.ignore.includes(args[0].slice(8))) {
newSoundURL = args[0];
break;
}
newSoundURL = args[0].replace(
"sounds/",
`sounds_custom/${currentPack?.path || "/error"}/`
);
break;
}
args[0] = newSoundURL;
return [newSoundURL];
}
);
}

const SoundPackDropdownOptions = useMemo(() => {
return [
{ label: "Default", data: -1 },
Expand Down Expand Up @@ -208,15 +159,6 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({}) => {
Manage Packs
</ButtonItem>
</PanelSectionRow>
<PanelSectionRow>
<ButtonItem
bottomSeparator={true}
layout="below"
onClick={() => reloadPlugin()}
>
Reload Plugin
</ButtonItem>
</PanelSectionRow>
</PanelSection>
</div>
);
Expand Down

0 comments on commit e8af9d4

Please sign in to comment.