mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
ND fixes & optimization
This commit is contained in:
1 parent
f9213f7450
commit
7531f58447
2 files changed
+21
-19
No files matched your search
+2
-2
@@ -33,12 +33,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2025.11.18" PrivateAssets="all" Condition="'$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug'" />
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2026.3.31" PrivateAssets="all" Condition="'$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug'" />
|
||||
<PackageReference Include="AmongUs.GameLibs.Android" Version="2025.10.14" PrivateAssets="all" Condition="'$(Configuration)' == 'Android'"/>
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1"/>
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" Private="false" ExcludeAssets="runtime;native"/>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4" />
|
||||
<PackageReference Include="Samboy063.Cpp2IL.Core" Version="2022.1.0-pre-release.20"/>
|
||||
<PackageReference Include="Samboy063.Cpp2IL.Core" Version="2022.1.0-pre-release.20" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using EHR.Roles;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
@@ -270,14 +269,13 @@ public static class NaturalDisasters
|
||||
AllDisasters.RemoveAll(x => x.Name is "Earthquake" or "VolcanoEruption" or "Tornado" or "Thunderstorm" or "SandStorm" or "Tsunami");
|
||||
break;
|
||||
}
|
||||
case 1 or 2 when ActiveDisasters.Count == 0 || IRandom.Instance.Next(AllDisasters.Count) == 0:
|
||||
{
|
||||
Sinkhole.RemoveRandomSinkhole();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (IRandom.Instance.Next(AllDisasters.Count) == 0)
|
||||
{
|
||||
Sinkhole.RemoveRandomSinkhole();
|
||||
return;
|
||||
}
|
||||
|
||||
Disaster remove = PreferRemovingThunderstorm.GetBool() ? ActiveDisasters.Find(x => x is Thunderstorm) : ActiveDisasters.RandomElement();
|
||||
if (remove != null) remove.Duration = 0;
|
||||
remove?.RemoveIfExpired();
|
||||
@@ -309,6 +307,13 @@ public static class NaturalDisasters
|
||||
disasters.RemoveAll(x => x.Name == "BuildingCollapse");
|
||||
|
||||
Type disaster = disasters.SelectMany(x => Enumerable.Repeat(x, DisasterSpawnChances[x.Name].GetInt() / 5)).RandomElement();
|
||||
|
||||
if (disaster.Name == "Thunderstorm")
|
||||
{
|
||||
_ = new Thunderstorm(Vector2.zero, null);
|
||||
return;
|
||||
}
|
||||
|
||||
KeyValuePair<SystemTypes, Vector2> roomKvp;
|
||||
|
||||
if (Main.LIMap)
|
||||
@@ -324,16 +329,15 @@ public static class NaturalDisasters
|
||||
.RandomElement();
|
||||
}
|
||||
|
||||
Vector2 position = disaster.Name switch
|
||||
{
|
||||
"BuildingCollapse" => roomKvp.Value,
|
||||
"Thunderstorm" => Pelican.GetBlackRoomPS(),
|
||||
_ => IRandom.Instance.Next(2) == 0 && Options.CurrentGameMode == CustomGameMode.NaturalDisasters
|
||||
bool bc = disaster.Name == "BuildingCollapse";
|
||||
|
||||
Vector2 position = bc
|
||||
? roomKvp.Value
|
||||
: IRandom.Instance.Next(2) == 0 && Options.CurrentGameMode == CustomGameMode.NaturalDisasters
|
||||
? Main.EnumerateAlivePlayerControls().RandomElement().Pos()
|
||||
: new(Random.Range(MapBounds.X.Left, MapBounds.X.Right), Random.Range(MapBounds.Y.Top, MapBounds.Y.Bottom))
|
||||
};
|
||||
: new(Random.Range(MapBounds.X.Left, MapBounds.X.Right), Random.Range(MapBounds.Y.Top, MapBounds.Y.Bottom));
|
||||
|
||||
SystemTypes? room = disaster.Name == "BuildingCollapse" ? roomKvp.Key : null;
|
||||
SystemTypes? room = bc ? roomKvp.Key : null;
|
||||
AddPreparingDisaster(position, disaster.Name, room);
|
||||
}
|
||||
|
||||
@@ -714,8 +718,6 @@ public static class NaturalDisasters
|
||||
NetObject = naturalDisaster;
|
||||
Update();
|
||||
|
||||
naturalDisaster.Despawn();
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
RebuildSuffixText();
|
||||
|
||||
Reference in new issue
Block a user