Merge pull request 'Clean up and fix double-starting music' (#2) from ratijas/muzika-gromche:work/r/double-trigger into master

Reviewed-on: #2
This commit is contained in:
Nikita Vilunov 2025-07-11 20:06:24 +00:00
commit 787f15944a
12 changed files with 824 additions and 178 deletions

497
.gitignore vendored
View File

@ -1,8 +1,493 @@
bin/ ## Ignore Visual Studio temporary files, build results, and
obj/ ## files generated by popular Visual Studio add-ons.
/packages/ ##
riderModule.iml ## Get latest from `dotnet new gitignore`
/_ReSharper.Caches/
# dotenv files
.env
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
.idea/ .idea/
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# Vim temporary swap files
*.swp
# Override *.user rule for templates
!*.template.props.user
!*.template.just.user
riderModule.iml
dist/
*.dll *.dll
MuzikaGromche.sln.DotSettings.user *.zip

View File

@ -1 +1,3 @@
*.mp3 filter=lfs diff=lfs merge=lfs -text *.mp3 filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text

4
Directory.Build.props Normal file
View File

@ -0,0 +1,4 @@
<Project>
<!-- Import local user props -->
<Import Project="$(SolutionDir)MuzikaGromche.props.user"/>
</Project>

28
Justfile Normal file
View File

@ -0,0 +1,28 @@
import? 'MuzikaGromche.just.user'
build: build-debug build-release
build-release:
dotnet build --configuration Release
build-debug:
dotnet build --configuration Debug
clean:
rm -rf dist MuzikaGromche/bin MuzikaGromche/obj
plugin_dir := "$HOME/.config/r2modmanPlus-local/LethalCompany/profiles" / imperium_profile / "BepInEx/plugins/Oflor-MuzikaGromche/"
install-imperium:
rm -rf "{{ plugin_dir }}"
mkdir "{{ plugin_dir }}"
unzip -q dist/MuzikaGromche-Debug.zip -d "{{ plugin_dir }}"
run-imperium:
DRI_PRIME=1 steam -applaunch 1966720 --doorstop-enable true --doorstop-target "Z:$HOME/.config/r2modmanPlus-local/LethalCompany/profiles/{{ imperium_profile }}/BepInEx/core/BepInEx.Preloader.dll" --r2profile "{{ imperium_profile }}"
bump version_number:
[[ "v{{ version_number }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || (echo "Invalid version format" && exit 1)
jq --indent 4 --arg v "{{ version_number }}" '.version_number = $v' < manifest.json > manifest.json.copy
mv manifest.json.copy manifest.json
sed -i 's/<Version>.*<\/Version>/<Version>{{ version_number }}<\/Version>/' MuzikaGromche/MuzikaGromche.csproj

View File

@ -0,0 +1,3 @@
# Copy me to MuzikaGromche.just.user and adjust tasks to your workflow
imperium_profile := "Muzika Gromche with Imperium"

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<!-- Copy this file to MuzikaGromche.props.user and uncomment one of two paths below: -->
<!-- On Linux: -->
<!-- <LethalCompanyDir>$(HOME)/.local/share/Steam/steamapps/common/Lethal Company/</LethalCompanyDir> -->
<!-- On Windows: -->
<!-- <LethalCompanyDir>C:/Program Files (x86)/Steam/steamapps/common/Lethal Company/</LethalCompanyDir> -->
</PropertyGroup>
</Project>

View File

@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>MuzikaGromche</AssemblyName> <AssemblyName>MuzikaGromche</AssemblyName>
<Description>Opa che tut u nas</Description> <Description>Opa che tut u nas</Description>
<Version>1.0.0</Version> <Version>13.37.6</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
@ -15,11 +15,56 @@
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*"/> <PackageReference Include="BepInEx.PluginInfoProps" Version="1.*"/>
<PackageReference Include="UnityEngine.Modules" Version="2022.3.9" IncludeAssets="compile"/> <PackageReference Include="UnityEngine.Modules" Version="2022.3.9" IncludeAssets="compile"/>
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" /> <PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" />
<Reference Include="Assembly-CSharp" HintPath="Assembly-CSharp.dll" Publicize="true" /> </ItemGroup>
<Reference Include="Unity.Netcode.Runtime" HintPath="Unity.Netcode.Runtime.dll" Publicize="true" />
<ItemGroup>
<Reference Include="Assembly-CSharp" Publicize="true">
<HintPath>$(LethalCompanyDir)Lethal Company_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Unity.Collections">
<HintPath>$(LethalCompanyDir)Lethal Company_Data\Managed\Unity.Collections.dll</HintPath>
</Reference>
<Reference Include="Unity.Netcode.Runtime" Publicize="true">
<HintPath>$(LethalCompanyDir)Lethal Company_Data\Managed\Unity.Netcode.Runtime.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'"> <ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all"/> <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all"/>
</ItemGroup> </ItemGroup>
<Target Name="Bundle" AfterTargets="Build">
<PropertyGroup>
<DistDir>$(TargetDir)MuzikaGromche\</DistDir>
<ZipBundle>$(TargetDir)MuzikaGromche-$(Configuration).zip</ZipBundle>
</PropertyGroup>
<ItemGroup>
<PackagedResources Include="$(SolutionDir)README.md" />
<PackagedResources Include="$(SolutionDir)icon.png" />
<PackagedResources Include="$(SolutionDir)manifest.json" />
<PackagedResources Include="$(TargetDir)MuzikaGromche.dll" />
</ItemGroup>
<ItemGroup>
<AudioFiles Include="$(SolutionDir)Assets\*.mp3" />
<AudioFiles Include="$(SolutionDir)Assets\*.ogg" />
<AudioFiles Include="$(SolutionDir)Assets\*.wav" />
</ItemGroup>
<RemoveDir Directories="$(DistDir)" />
<Copy
SourceFiles="@(AudioFiles);@(PackagedResources)"
DestinationFolder="$(DistDir)"
/>
<ZipDirectory
SourceDirectory="$(DistDir)"
DestinationFile="$(TargetDir)MuzikaGromche-$(Configuration).zip"
Overwrite="true"
/>
<Copy
SourceFiles="$(ZipBundle)"
DestinationFolder="$(SolutionDir)dist\"
/>
</Target>
</Project> </Project>

View File

@ -55,27 +55,85 @@ namespace MuzikaGromche
public static Coroutine JesterLightSwitching; public static Coroutine JesterLightSwitching;
public static Track CurrentTrack; public static Track CurrentTrack;
public static void StartLightSwitching(MonoBehaviour __instance)
{
StopLightSwitching(__instance);
JesterLightSwitching = __instance.StartCoroutine(RotateColors());
}
public static void StopLightSwitching(MonoBehaviour __instance)
{
if (JesterLightSwitching != null)
{
__instance.StopCoroutine(JesterLightSwitching);
JesterLightSwitching = null;
}
}
public static void SetLightColor(Color color)
{
foreach (var light in RoundManager.Instance.allPoweredLights)
{
light.color = color;
}
}
public static void ResetLightColor()
{
SetLightColor(Color.white);
}
// TODO: Move to Track class to make them customizable per-song
static List<Color> colors = [Color.magenta, Color.cyan, Color.green, Color.yellow];
public static IEnumerator RotateColors()
{
Debug.Log("Starting color rotation");
var i = 0;
while (true)
{
var color = colors[i];
Debug.Log("Chose color " + color);
SetLightColor(color);
i = (i + 1) % colors.Count;
if (CurrentTrack != null)
{
yield return new WaitForSeconds(60f / CurrentTrack.Bpm);
}
else
{
yield break;
}
}
}
private void Awake() private void Awake()
{ {
string text = Info.Location.TrimEnd((PluginInfo.PLUGIN_NAME + ".dll").ToCharArray()); string text = Info.Location.TrimEnd((PluginInfo.PLUGIN_NAME + ".dll").ToCharArray());
UnityWebRequest[] requests = new UnityWebRequest[Tracks.Length * 2]; UnityWebRequest[] requests = new UnityWebRequest[Tracks.Length * 2];
for (int i = 0; i < Tracks.Length; i++) { for (int i = 0; i < Tracks.Length; i++)
{
Track track = Tracks[i]; Track track = Tracks[i];
requests[i * 2] = UnityWebRequestMultimedia.GetAudioClip($"File://{text}{track.Name}Start.mp3", AudioType.MPEG); requests[i * 2] = UnityWebRequestMultimedia.GetAudioClip($"File://{text}{track.FileNameStart}", track.AudioType);
requests[i * 2 + 1] = UnityWebRequestMultimedia.GetAudioClip($"File://{text}{track.Name}Loop.mp3", AudioType.MPEG); requests[i * 2 + 1] = UnityWebRequestMultimedia.GetAudioClip($"File://{text}{track.FileNameLoop}", track.AudioType);
requests[i * 2].SendWebRequest(); requests[i * 2].SendWebRequest();
requests[i * 2 + 1].SendWebRequest(); requests[i * 2 + 1].SendWebRequest();
} }
while (!requests.All(request => request.isDone)) { } while (!requests.All(request => request.isDone)) { }
if (requests.All(request => request.result == UnityWebRequest.Result.Success)) { if (requests.All(request => request.result == UnityWebRequest.Result.Success))
for (int i = 0; i < Tracks.Length; i++) { {
Tracks[i].LoadedStart = DownloadHandlerAudioClip.GetContent(requests[i * 2]); for (int i = 0; i < Tracks.Length; i++)
Tracks[i].LoadedLoop = DownloadHandlerAudioClip.GetContent(requests[i * 2 + 1]); {
Track track = Tracks[i];
track.LoadedStart = DownloadHandlerAudioClip.GetContent(requests[i * 2]);
track.LoadedLoop = DownloadHandlerAudioClip.GetContent(requests[i * 2 + 1]);
} }
new Harmony(PluginInfo.PLUGIN_NAME).PatchAll(typeof(JesterPatch)); new Harmony(PluginInfo.PLUGIN_NAME).PatchAll(typeof(JesterPatch));
} else { }
else
{
Logger.LogError("Could not load audio file"); Logger.LogError("Could not load audio file");
} }
} }
@ -84,22 +142,54 @@ namespace MuzikaGromche
public class Track public class Track
{ {
public string Name; public string Name;
// Wind-up time can and should be shorter than the Start audio track,
// so that the "pop" effect can be baked into the Start audio and kept away
// from the looped part. This also means that the light show starts before
// the looped track does, so we need to sync them up as soon as we enter the Loop.
public float WindUpTimer; public float WindUpTimer;
// BPM for light switching in sync with the music. There is no offset,
// so the Loop track should start precisely on a beat.
public float Bpm; public float Bpm;
// MPEG is basically mp3, and it can produce gaps at the start.
// WAV is OK, but takes a lot of space. Try OGGVORBIS instead.
public AudioType AudioType = AudioType.MPEG;
public AudioClip LoadedStart; public AudioClip LoadedStart;
public AudioClip LoadedLoop; public AudioClip LoadedLoop;
public string FileNameStart => $"{Name}Start.{Ext}";
public string FileNameLoop => $"{Name}Loop.{Ext}";
private string Ext => AudioType switch
{
AudioType.MPEG => "mp3",
AudioType.WAV => "wav",
AudioType.OGGVORBIS => "ogg",
_ => "",
};
} }
[HarmonyPatch(typeof(JesterAI))] [HarmonyPatch(typeof(JesterAI))]
internal class JesterPatch internal class JesterPatch
{ {
#if DEBUG
[HarmonyPatch("SetJesterInitialValues")]
[HarmonyPostfix]
public static void AlmostInstantFollowTimerPostfix(JesterAI __instance)
{
__instance.beginCrankingTimer = 1f;
}
#endif
[HarmonyPatch("Update")] [HarmonyPatch("Update")]
[HarmonyPrefix] [HarmonyPrefix]
public static void DoNotStopTheMusicPrefix(JesterAI __instance, out State __state) public static void DoNotStopTheMusicPrefix(JesterAI __instance, out State __state)
{ {
__state = new State(); __state = new State
__state.prevStateindex = __instance.previousState; {
if (__instance.currentBehaviourStateIndex == 2 && __instance.previousBehaviourStateIndex != 2) { previousState = __instance.previousState
};
if (__instance.currentBehaviourStateIndex == 2 && __instance.previousState != 2)
{
// if just popped out // if just popped out
// then override farAudio so that vanilla logic does not stop the music // then override farAudio so that vanilla logic does not stop the music
__state.farAudio = __instance.farAudio; __state.farAudio = __instance.farAudio;
@ -107,27 +197,6 @@ namespace MuzikaGromche
} }
} }
static List<Color> colors = [Color.magenta, Color.cyan, Color.green, Color.yellow];
public static IEnumerator rotateColors()
{
Debug.Log("Starting color rotation");
var i = 0;
while (true)
{
var color = colors[i];
Debug.Log("Chose color " + color);
foreach (var light in RoundManager.Instance.allPoweredLights)
{
light.color = color;
}
i += 1;
if (i >= colors.Count) i = 0;
yield return new WaitForSeconds(60f / Plugin.CurrentTrack.Bpm);
}
}
[HarmonyPatch("Update")] [HarmonyPatch("Update")]
[HarmonyPostfix] [HarmonyPostfix]
public static void DoNotStopTheMusic(JesterAI __instance, State __state) public static void DoNotStopTheMusic(JesterAI __instance, State __state)
@ -137,7 +206,7 @@ namespace MuzikaGromche
__instance.farAudio = __state.farAudio; __instance.farAudio = __state.farAudio;
} }
if (__instance.currentBehaviourStateIndex is 1 && __state.prevStateindex != 1) if (__instance.previousState == 1 && __state.previousState != 1)
{ {
// if just started winding up // if just started winding up
// then stop the default music... // then stop the default music...
@ -167,30 +236,19 @@ namespace MuzikaGromche
__instance.farAudio.Play(); __instance.farAudio.Play();
} }
if (__instance.currentBehaviourStateIndex is 2 && __state.prevStateindex != 2) if (__instance.previousState == 2 && __state.previousState != 2)
{ {
__instance.creatureVoice.Stop(); __instance.creatureVoice.Stop();
Plugin.StartLightSwitching(__instance);
if (Plugin.JesterLightSwitching != null) {
__instance.StopCoroutine(Plugin.JesterLightSwitching);
Plugin.JesterLightSwitching = null;
}
Plugin.JesterLightSwitching = __instance.StartCoroutine(rotateColors());
} }
if (__instance.currentBehaviourStateIndex != 2 && __state.prevStateindex == 2) if (__instance.previousState != 2 && __state.previousState == 2)
{ {
if (Plugin.JesterLightSwitching != null) { Plugin.StopLightSwitching(__instance);
__instance.StopCoroutine(Plugin.JesterLightSwitching); Plugin.ResetLightColor();
Plugin.JesterLightSwitching = null;
}
foreach (var light in RoundManager.Instance.allPoweredLights)
{
light.color = Color.white;
}
} }
if (__instance.currentBehaviourStateIndex is 2 && !__instance.creatureVoice.isPlaying) if (__instance.previousState == 2 && !__instance.creatureVoice.isPlaying)
{ {
__instance.creatureVoice.maxDistance = 150; __instance.creatureVoice.maxDistance = 150;
__instance.creatureVoice.clip = Plugin.CurrentTrack.LoadedLoop; __instance.creatureVoice.clip = Plugin.CurrentTrack.LoadedLoop;
@ -206,6 +264,6 @@ namespace MuzikaGromche
internal class State internal class State
{ {
public AudioSource farAudio; public AudioSource farAudio;
public int prevStateindex; public int previousState;
} }
} }

1
README.md Normal file
View File

@ -0,0 +1 @@
Adds some content to your reverse teleports on Titan

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

10
manifest.json Normal file
View File

@ -0,0 +1,10 @@
{
"name": "MuzikaGromche",
"version_number": "13.37.6",
"author": "Oflor",
"description": "Glaza zakryvaj",
"website_url": "https://git.vilunov.me/nikita/muzika-gromche",
"dependencies": [
"BepInEx-BepInExPack-5.4.2100"
]
}