mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix meteors (final)
This commit is contained in:
parent
ab237624b2
commit
c8e88707e4
@ -24,6 +24,18 @@ namespace NewHorizons.Builder.Props
|
|||||||
meteorLauncher._detectableField = null;
|
meteorLauncher._detectableField = null;
|
||||||
meteorLauncher._launchDirection = Vector3.up;
|
meteorLauncher._launchDirection = Vector3.up;
|
||||||
meteorLauncher._dynamicProbability = 0f;
|
meteorLauncher._dynamicProbability = 0f;
|
||||||
|
var meteorPrefab = meteorLauncher._meteorPrefab.InstantiateInactive().Rename("Prefab_VM_MoltenMeteor").DontDestroyOnLoad();
|
||||||
|
var meteor = meteorPrefab.GetComponent<MeteorController>();
|
||||||
|
GameObject.DestroyImmediate(meteorPrefab.FindChild("ConstantDetectors"));
|
||||||
|
var detectors = meteorPrefab.FindChild("DynamicDetector");
|
||||||
|
var rigidbody = meteor.GetComponent<OWRigidbody>();
|
||||||
|
meteor._owRigidbody = rigidbody;
|
||||||
|
meteor._constantFluidDetector = null;
|
||||||
|
meteor._constantForceDetector = null;
|
||||||
|
rigidbody.RegisterAttachedFluidDetector(detectors.GetComponent<DynamicFluidDetector>());
|
||||||
|
rigidbody.RegisterAttachedForceDetector(detectors.AddComponent<DynamicForceDetector>());
|
||||||
|
meteor._owColliders = meteorPrefab.GetComponentsInChildren<OWCollider>();
|
||||||
|
meteorLauncher._meteorPrefab = meteorPrefab;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,6 +56,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
meteorLauncher._minInterval = info.minInterval;
|
meteorLauncher._minInterval = info.minInterval;
|
||||||
meteorLauncher._maxInterval = info.maxInterval;
|
meteorLauncher._maxInterval = info.maxInterval;
|
||||||
|
|
||||||
|
var lavaMaterial = launcherGO.FindChild("EruptionParticles_Lava").GetComponent<ParticleSystemRenderer>().sharedMaterial;
|
||||||
|
lavaMaterial.SetColor(Color1, info.stoneTint?.ToColor() ?? defaultStoneTint);
|
||||||
|
lavaMaterial.SetColor(EmissionColor, info.lavaTint?.ToColor() ?? defaultLavaTint);
|
||||||
|
|
||||||
launcherGO.SetActive(true);
|
launcherGO.SetActive(true);
|
||||||
|
|
||||||
// Have to null check else it breaks on reload configs
|
// Have to null check else it breaks on reload configs
|
||||||
@ -64,16 +80,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
mat.SetColor(Color1, info.stoneTint?.ToColor() ?? defaultStoneTint);
|
mat.SetColor(Color1, info.stoneTint?.ToColor() ?? defaultStoneTint);
|
||||||
mat.SetColor(EmissionColor, info.lavaTint?.ToColor() ?? defaultLavaTint);
|
mat.SetColor(EmissionColor, info.lavaTint?.ToColor() ?? defaultLavaTint);
|
||||||
|
|
||||||
GameObject.Destroy(meteor.transform.Find("ConstantDetectors").gameObject);
|
|
||||||
|
|
||||||
var detectors = meteor.transform.Find("DynamicDetector").gameObject;
|
|
||||||
|
|
||||||
meteor._constantFluidDetector = null;
|
|
||||||
meteor._constantForceDetector = null;
|
|
||||||
|
|
||||||
var forceDetector = detectors.gameObject.AddComponent<DynamicForceDetector>();
|
|
||||||
|
|
||||||
meteor._owColliders = meteor.gameObject.GetComponentsInChildren<OWCollider>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
NewHorizons/Patches/MeteorPatches.cs
Normal file
15
NewHorizons/Patches/MeteorPatches.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace NewHorizons.Patches
|
||||||
|
{
|
||||||
|
[HarmonyPatch]
|
||||||
|
public static class MeteorPatches
|
||||||
|
{
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(MeteorController), nameof(MeteorController.Suspend), new System.Type[0])]
|
||||||
|
public static void MeteorController_Suspend(MeteorController __instance)
|
||||||
|
{
|
||||||
|
__instance.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user