Skip to content

Commit

Permalink
RainSound and Particle amount tied to RainIntensity
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeMoriya committed Jan 24, 2022
1 parent 1690b06 commit ae210c6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Downpour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Downpour : PartialityMod
// Version - increase this by 1 when you upload a new version of the mod.
// The first upload should be with version 0, the next version 1, the next version 2, etc.
// If you ever lose track of the version you're meant to be using, ask Pastebin.
public int version = 11;
public int version = 13;
// Public key in base64 - don't touch!
public string keyE = "AQAB";
public string keyN = "lDaM5h0hJUvZcIdiWXH4qfdia/V8UWzikqRIiC9jVGA87jMrafo4EWOTk0MMIQZWHVy+msVzvEAVR3V45wZShFu7ylUndroL5u4zyqHfVeAeDIALfBrM3J4BIM1rMi4wieYdLIF6t2Uj4GVH7iU59AIfobew1vICUILu9Zib/Aw2QY6Nc+0Cz6Lw3xh7DL/trIMaW7yQfYRZUaEZBHelN2JGyUjKkbby4vL6gySfGlVl1OH0hYYhrhNwnQrOow8WXFMIu/WyTA3cY3wqkjd4/WRJ+EvYtMKTwfG+TZiHGst9Bg1ZTFfvEvrTFiPadTf19iUnfyL/QJaTAD8qe+rba5KwirIElovqFpYNH9tAr7SpjixjbT3Igmz+SlqGa9wSbm1QWt/76QqpyAYV/b5G/VzbytoZrhkEVdGuaotD4tXh462AhK5xoigB8PEt+T3nWuPdoZlVo5hRCxoNleH4yxLpVv8C7TpQgQHDqzHMcEX79xjiYiCvigCq7lLEdxUD0fhnxSYVK0O+y7T+NXkk3is/XqJxdesgyYUMT81MSou9Ur/2nv9H8IvA9QeIqso05hK3c496UOaRJS27WJhrxABtU+HHtxo9SifmXjisDj3IV46uTeVp5bivDTu1yBymgnU8qli/xmwWxKvOisi9ZOZsg4vFHaY31gdUBWOz4dU=";
Expand Down
12 changes: 6 additions & 6 deletions Downpour.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>E:\Games\Rain World\Mods\</OutputPath>
<OutputPath>..\..\..\..\..\Program Files %28x86%29\Steam\steamapps\common\Rain World - Backup\Mods\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -32,23 +32,23 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>E:\Games\Rain World\Mods\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Rain World - Backup\Mods\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ConfigMachine, Version=1.5.4.4, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>E:\Games\Rain World\Mods\ConfigMachine.dll</HintPath>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Rain World - Backup\Mods\ConfigMachine.dll</HintPath>
</Reference>
<Reference Include="HOOKS-Assembly-CSharp">
<HintPath>E:\Games\Rain World\Mods\HOOKS-Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Rain World - Backup\Mods\HOOKS-Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MonoMod.RuntimeDetour, Version=18.6.0.33006, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>E:\Games\Rain World\BepInEx\core\MonoMod.RuntimeDetour.dll</HintPath>
</Reference>
<Reference Include="Partiality">
<HintPath>E:\Games\Rain World\BepInEx\plugins\PartialityWrapper\Partiality.dll</HintPath>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Rain World - Backup\BepInEx\plugins\PartialityWrapper\Partiality.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
Expand All @@ -58,7 +58,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>E:\Games\Rain World\Mods\UnityEngine.dll</HintPath>
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Rain World - Backup\Mods\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Precipitator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ public override void Update(bool eu)
this.room.AddObject(this.blizzard);
}
this.rainAmount = Mathf.Lerp(Downpour.rainAmount * 0.5f, Downpour.rainAmount, RainFall.rainIntensity);
this.rainLimit = (int)Mathf.Lerp(this.rainAmount * 50, (this.rainAmount * 80), RainFall.rainIntensity);
this.rainLimit = (int)Mathf.Lerp(Mathf.Lerp(0f, this.rainAmount * 50,this.room.roomSettings.RainIntensity), Mathf.Lerp(this.rainAmount * 50,(this.rainAmount * 80), this.room.roomSettings.RainIntensity), RainFall.rainIntensity);
}
else
{
this.rainAmount = Mathf.Lerp(0, Downpour.rainAmount, RainFall.rainIntensity);
this.rainLimit = (int)Mathf.Lerp(0, (this.rainAmount * 9), RainFall.rainIntensity);
this.rainLimit = (int)Mathf.Lerp(0, Mathf.Lerp(0f,(this.rainAmount * 9), this.room.roomSettings.RainIntensity), RainFall.rainIntensity);
}
this.player = (room.game.Players.Count <= 0) ? null : (room.game.Players[0].realizedCreature as Player);

Expand Down Expand Up @@ -233,7 +233,7 @@ public override void Update(bool eu)
{
this.AddSnowflakes(rainLimit - this.snowFlakes);
}
if (this.room.lightning != null && this.room.BeingViewed && this.room.roomRain != null && this.room.roomRain.dangerType == RoomRain.DangerType.Rain && UnityEngine.Random.value < 0.0004f)
if (this.room.lightning != null && this.room.BeingViewed && this.room.roomRain != null && this.room.roomRain.dangerType == RoomRain.DangerType.Rain && Downpour.strike && UnityEngine.Random.value < RainFall.rainIntensity * 0.0010f)
{
this.room.AddObject(new LightningStrike(this));
}
Expand Down
2 changes: 1 addition & 1 deletion RainFall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ private static void Room_Loaded(On.Room.orig_Loaded orig, Room self)
if (!noRain)
{
//Add Rain Sound Object
if (self.game != null)
if (self.game != null && self.roomRain != null)
{
self.AddObject(new RainSound(self));
}
Expand Down
41 changes: 22 additions & 19 deletions RainSound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,30 @@ public override void Update(bool eu)
{
this.Destroy();
}
else if(RainFall.rainIntensity >0f)
else if(RainFall.rainIntensity > 0f)
{
if (interiorRainSound != null)
if (this.room.roomRain != null && this.room.roomSettings.RainIntensity > 0f)
{
interiorRainSound.Volume = Mathf.Lerp(0f, 0.3f, RainFall.rainIntensity);
interiorRainSound.Update();
}
if (normalRainSound != null)
{
normalRainSound.Volume = Mathf.Lerp(0f, 1f, RainFall.rainIntensity * 1.7f);
normalRainSound.Update();
}
if (heavyRainSound != null)
{
heavyRainSound.Volume = Mathf.Lerp(0f, 0.55f, RainFall.rainIntensity * 1.2f);
heavyRainSound.Update();
}
if (rumbleSound != null)
{
rumbleSound.Volume = Mathf.Lerp(0f, 0.4f, RainFall.rainIntensity);
rumbleSound.Update();
if (interiorRainSound != null)
{
interiorRainSound.Volume = Mathf.Lerp(0f, Mathf.Lerp(0f, 0.3f, this.room.roomSettings.RainIntensity), RainFall.rainIntensity);
interiorRainSound.Update();
}
if (normalRainSound != null)
{
normalRainSound.Volume = Mathf.Lerp(0f, Mathf.Lerp(0f, 1f, this.room.roomSettings.RainIntensity), RainFall.rainIntensity * 1.7f);
normalRainSound.Update();
}
if (heavyRainSound != null)
{
heavyRainSound.Volume = Mathf.Lerp(0f, Mathf.Lerp(0f, 0.55f, this.room.roomSettings.RainIntensity), RainFall.rainIntensity * 1.2f);
heavyRainSound.Update();
}
if (rumbleSound != null)
{
rumbleSound.Volume = Mathf.Lerp(0f, Mathf.Lerp(0f, 0.4f, this.room.roomSettings.RainIntensity), RainFall.rainIntensity);
rumbleSound.Update();
}
}
}
}
Expand Down

0 comments on commit ae210c6

Please sign in to comment.