Skip to content
This repository was archived by the owner on Mar 8, 2026. It is now read-only.

Commit 182122a

Browse files
committed
Improve ermfish schizo randomness
1 parent d33d523 commit 182122a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

CustomHullPlates/Ermfish.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Nautilus.Utility;
1616
using UnityEngine;
1717
using Object = UnityEngine.Object;
18+
using Random = System.Random;
1819

1920
namespace SCHIZO
2021
{
@@ -82,8 +83,8 @@ Between the ears there is a single antenna-like organ that emits a faint radio-s
8283
var biomes = new List<LootDistributionData.BiomeData>();
8384
foreach (object biome in Enum.GetValues(typeof(BiomeType)))
8485
{
85-
biomes.Add(new LootDistributionData.BiomeData() { biome = (BiomeType)biome, count = 1, probability = 0.1f });
86-
biomes.Add(new LootDistributionData.BiomeData() { biome = (BiomeType)biome, count = 10, probability = 0.05f });
86+
biomes.Add(new LootDistributionData.BiomeData { biome = (BiomeType)biome, count = 1, probability = 0.1f });
87+
biomes.Add(new LootDistributionData.BiomeData { biome = (BiomeType)biome, count = 10, probability = 0.05f });
8788
}
8889

8990
ItemActionHandler.RegisterMiddleClickAction(pi.TechType, item => randomSounds.Play(), "pull ahoge", "English");
@@ -95,7 +96,7 @@ Between the ears there is a single antenna-like organ that emits a faint radio-s
9596
.WithFabricatorType(CraftTree.Type.Fabricator).WithStepsToFabricatorTab("Survival", "CookedFood"));
9697
cooked.SetGameObject(new CloneTemplate(cooked.Info, creature.TechType)
9798
{
98-
ModifyPrefab = (prefab) =>
99+
ModifyPrefab = prefab =>
99100
{
100101
Eatable eatable = prefab.EnsureComponent<Eatable>();
101102
eatable.foodValue = 23;
@@ -124,7 +125,7 @@ Between the ears there is a single antenna-like organ that emits a faint radio-s
124125
.WithFabricatorType(CraftTree.Type.Fabricator).WithStepsToFabricatorTab("Survival", "CuredFood"));
125126
cured.SetGameObject(new CloneTemplate(cured.Info, creature.TechType)
126127
{
127-
ModifyPrefab = (prefab) =>
128+
ModifyPrefab = prefab =>
128129
{
129130
Eatable eatable = prefab.EnsureComponent<Eatable>();
130131
eatable.foodValue = 23;
@@ -221,7 +222,7 @@ protected override IEnumerator ModifyPrefab(GameObject prefab, CreatureComponent
221222
yield break;
222223
}
223224

224-
protected override void ApplyMaterials(GameObject prefab) => MaterialUtils.ApplySNShaders(prefab, 1f, 1f, 1f);
225+
protected override void ApplyMaterials(GameObject prefab) => MaterialUtils.ApplySNShaders(prefab, 1f);
225226
}
226227

227228
public sealed class ErmfishNoises : MonoBehaviour
@@ -230,16 +231,20 @@ public sealed class ErmfishNoises : MonoBehaviour
230231
private FMOD_CustomEmitter _emitter;
231232
private float _inventoryTimer = -1;
232233
private float _worldTimer = -1;
234+
private Random _random;
233235

234236
private void Awake()
235237
{
236238
if (_inventoryTimer != -1) return;
237239

240+
_random = new Random(GetInstanceID());
241+
238242
_pickupable = GetComponent<Pickupable>();
239243
_emitter = gameObject.AddComponent<FMOD_CustomEmitter>();
240244
_emitter.followParent = true;
241-
_inventoryTimer = UnityEngine.Random.Range(SchizoPlugin.config.MinInventoryNoiseDelay, SchizoPlugin.config.MaxInventoryNoiseDelay);
242-
_worldTimer = UnityEngine.Random.Range(SchizoPlugin.config.MinWorldNoiseDelay, SchizoPlugin.config.MaxWorldNoiseDelay);
245+
246+
_inventoryTimer = _random.Next(SchizoPlugin.config.MinInventoryNoiseDelay, SchizoPlugin.config.MaxInventoryNoiseDelay);
247+
_worldTimer = _random.Next(SchizoPlugin.config.MinWorldNoiseDelay, SchizoPlugin.config.MaxWorldNoiseDelay);
243248
}
244249

245250
public void Update()
@@ -260,7 +265,7 @@ private void InventoryUpdate()
260265

261266
if (_inventoryTimer < 0)
262267
{
263-
_inventoryTimer = UnityEngine.Random.Range(SchizoPlugin.config.MinInventoryNoiseDelay, SchizoPlugin.config.MaxInventoryNoiseDelay);
268+
_inventoryTimer = _random.Next(SchizoPlugin.config.MinInventoryNoiseDelay, SchizoPlugin.config.MaxInventoryNoiseDelay);
264269
Ermfish.randomSounds.Play();
265270
}
266271
}
@@ -273,7 +278,7 @@ private void WorldUpdate()
273278

274279
if (_worldTimer < 0)
275280
{
276-
_worldTimer = UnityEngine.Random.Range(SchizoPlugin.config.MinWorldNoiseDelay, SchizoPlugin.config.MaxWorldNoiseDelay);
281+
_worldTimer = _random.Next(SchizoPlugin.config.MinWorldNoiseDelay, SchizoPlugin.config.MaxWorldNoiseDelay);
277282
Ermfish.ambientSounds.Play(_emitter);
278283
}
279284
}

0 commit comments

Comments
 (0)