mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix meteors + document
This commit is contained in:
parent
2e7028be66
commit
54f341d16e
@ -49,9 +49,9 @@ namespace NewHorizons.Builder.Props
|
|||||||
TornadoBuilder.Make(go, sector, tornadoInfo, config.Atmosphere?.Cloud != null);
|
TornadoBuilder.Make(go, sector, tornadoInfo, config.Atmosphere?.Cloud != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.Props.Volcanos != null)
|
if (config.Props.Volcanoes != null)
|
||||||
{
|
{
|
||||||
foreach (var volcanoInfo in config.Props.Volcanos)
|
foreach (var volcanoInfo in config.Props.Volcanoes)
|
||||||
{
|
{
|
||||||
VolcanoBuilder.Make(go, sector, volcanoInfo);
|
VolcanoBuilder.Make(go, sector, volcanoInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
var launcherGO = prefab.InstantiateInactive();
|
var launcherGO = prefab.InstantiateInactive();
|
||||||
launcherGO.transform.parent = sector.transform;
|
launcherGO.transform.parent = sector.transform;
|
||||||
launcherGO.transform.localPosition = info.position == null ? Vector3.zero : (Vector3) info.position;
|
launcherGO.transform.localPosition = info.position == null ? Vector3.zero : (Vector3) info.position;
|
||||||
|
launcherGO.transform.rotation = Quaternion.FromToRotation(launcherGO.transform.TransformDirection(Vector3.up), ((Vector3)info.position).normalized).normalized;
|
||||||
launcherGO.name = "MeteorLauncher";
|
launcherGO.name = "MeteorLauncher";
|
||||||
|
|
||||||
var meteorLauncher = launcherGO.GetComponent<MeteorLauncher>();
|
var meteorLauncher = launcherGO.GetComponent<MeteorLauncher>();
|
||||||
@ -24,30 +25,49 @@ namespace NewHorizons.Builder.Props
|
|||||||
meteorLauncher._detectableFluid = null;
|
meteorLauncher._detectableFluid = null;
|
||||||
meteorLauncher._detectableField = null;
|
meteorLauncher._detectableField = null;
|
||||||
|
|
||||||
meteorLauncher._launchDirection = info.position == null ? Vector3.up : ((Vector3)info.position).normalized;
|
meteorLauncher._launchDirection = Vector3.up;
|
||||||
|
|
||||||
var meteorPrefab = GameObject.Instantiate(meteorLauncher._meteorPrefab);
|
meteorLauncher._dynamicProbability = 0f;
|
||||||
FixMeteor(meteorPrefab, info);
|
|
||||||
|
|
||||||
meteorLauncher._meteorPrefab = meteorPrefab;
|
meteorLauncher._minLaunchSpeed = info.minLaunchSpeed;
|
||||||
|
meteorLauncher._maxLaunchSpeed = info.maxLaunchSpeed;
|
||||||
|
meteorLauncher._minInterval = info.minInterval;
|
||||||
|
meteorLauncher._maxInterval = info.maxInterval;
|
||||||
|
|
||||||
launcherGO.SetActive(true);
|
launcherGO.SetActive(true);
|
||||||
|
|
||||||
// Kill the prefab when its done with it
|
// Have to null check else it breaks on reload configs
|
||||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => meteorPrefab.SetActive(false));
|
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady && meteorLauncher._meteorPool != null, () => {
|
||||||
|
foreach (var meteor in meteorLauncher._meteorPool)
|
||||||
|
{
|
||||||
|
FixMeteor(meteor, info);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
private static void FixMeteor(GameObject meteor, PropModule.VolcanoInfo info)
|
private static void FixMeteor(MeteorController meteor, PropModule.VolcanoInfo info)
|
||||||
{
|
{
|
||||||
var mat = meteor.GetComponentInChildren<MeshRenderer>().material;
|
var mat = meteor.GetComponentInChildren<MeshRenderer>().material;
|
||||||
mat.SetColor("_Color", info.stoneTint == null ? defaultStoneTint : info.stoneTint.ToColor());
|
mat.SetColor("_Color", info.stoneTint == null ? defaultStoneTint : info.stoneTint.ToColor());
|
||||||
mat.SetColor("_EmissionColor", info.lavaTint == null ? defaultLavaTint : info.lavaTint.ToColor());
|
mat.SetColor("_EmissionColor", info.lavaTint == null ? defaultLavaTint : info.lavaTint.ToColor());
|
||||||
|
|
||||||
var detectors = meteor.transform.Find("ConstantDetectors");
|
var detectors = meteor.transform.Find("ConstantDetectors").gameObject;
|
||||||
GameObject.Destroy(detectors.GetComponent<ConstantForceDetector>());
|
GameObject.Destroy(detectors.GetComponent<ConstantForceDetector>());
|
||||||
GameObject.Destroy(detectors.GetComponent<ConstantFluidDetector>());
|
GameObject.Destroy(detectors.GetComponent<ConstantFluidDetector>());
|
||||||
|
|
||||||
detectors.gameObject.AddComponent<DynamicForceDetector>();
|
var forceDetector = detectors.gameObject.AddComponent<DynamicForceDetector>();
|
||||||
detectors.gameObject.AddComponent<DynamicFluidDetector>();
|
detectors.gameObject.AddComponent<DynamicFluidDetector>();
|
||||||
|
|
||||||
|
detectors.layer = LayerMask.NameToLayer("BasicDetector");
|
||||||
|
|
||||||
|
var sphere = detectors.AddComponent<SphereCollider>();
|
||||||
|
sphere.radius = 1;
|
||||||
|
|
||||||
|
var sphere2 = detectors.AddComponent<SphereShape>();
|
||||||
|
sphere2._collisionMode = Shape.CollisionMode.Detector;
|
||||||
|
sphere2.radius = 1;
|
||||||
|
|
||||||
|
forceDetector._collider = sphere;
|
||||||
|
forceDetector._shape = sphere2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
NewHorizons/External/PropModule.cs
vendored
6
NewHorizons/External/PropModule.cs
vendored
@ -14,7 +14,7 @@ namespace NewHorizons.External
|
|||||||
public RaftInfo[] Rafts;
|
public RaftInfo[] Rafts;
|
||||||
public GeyserInfo[] Geysers;
|
public GeyserInfo[] Geysers;
|
||||||
public TornadoInfo[] Tornados;
|
public TornadoInfo[] Tornados;
|
||||||
public VolcanoInfo[] Volcanos;
|
public VolcanoInfo[] Volcanoes;
|
||||||
public DialogueInfo[] Dialogue;
|
public DialogueInfo[] Dialogue;
|
||||||
public RevealInfo[] Reveal;
|
public RevealInfo[] Reveal;
|
||||||
public EntryLocationInfo[] EntryLocation;
|
public EntryLocationInfo[] EntryLocation;
|
||||||
@ -67,6 +67,10 @@ namespace NewHorizons.External
|
|||||||
public MVector3 position = null;
|
public MVector3 position = null;
|
||||||
public MColor stoneTint = null;
|
public MColor stoneTint = null;
|
||||||
public MColor lavaTint = null;
|
public MColor lavaTint = null;
|
||||||
|
public float minLaunchSpeed = 50f;
|
||||||
|
public float maxLaunchSpeed = 150f;
|
||||||
|
public float minInterval = 5f;
|
||||||
|
public float maxInterval = 20f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DialogueInfo
|
public class DialogueInfo
|
||||||
|
|||||||
@ -135,6 +135,7 @@ namespace NewHorizons
|
|||||||
SearchUtilities.ClearCache();
|
SearchUtilities.ClearCache();
|
||||||
ImageUtilities.ClearCache();
|
ImageUtilities.ClearCache();
|
||||||
AudioUtilities.ClearCache();
|
AudioUtilities.ClearCache();
|
||||||
|
IsSystemReady = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
"author": "xen, Bwc9876, & Book",
|
"author": "xen, Bwc9876, & Book",
|
||||||
"name": "New Horizons",
|
"name": "New Horizons",
|
||||||
"uniqueName": "xen.NewHorizons",
|
"uniqueName": "xen.NewHorizons",
|
||||||
"version": "0.10.3",
|
"version": "0.11.0",
|
||||||
"owmlVersion": "2.1.0",
|
"owmlVersion": "2.1.0",
|
||||||
"dependencies": [ "PacificEngine.OW_CommonResources" ],
|
"dependencies": [ "PacificEngine.OW_CommonResources" ],
|
||||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "Vesper.OuterWildsMMO", "Vesper.AutoResume" ],
|
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "Vesper.OuterWildsMMO", "Vesper.AutoResume" ],
|
||||||
|
|||||||
@ -760,6 +760,48 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"volcanoes": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "A set of meteor-spewing volcanoes",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"position": {
|
||||||
|
"$ref": "#/$defs/vector3",
|
||||||
|
"description": "The position of this volcano."
|
||||||
|
},
|
||||||
|
"stoneTint": {
|
||||||
|
"$ref": "#/$defs/color",
|
||||||
|
"description": "The colour of the meteor's stone."
|
||||||
|
},
|
||||||
|
"lavaTint": {
|
||||||
|
"$ref": "#/$defs/color",
|
||||||
|
"description": "The colour of the meteor's lava."
|
||||||
|
},
|
||||||
|
"minLaunchSpeed": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Minimum random speed at which meteors are launched.",
|
||||||
|
"default": 50
|
||||||
|
},
|
||||||
|
"maxLaunchSpeed": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Maximum random speed at which meteors are launched.",
|
||||||
|
"default": 150
|
||||||
|
},
|
||||||
|
"minInterval": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Minimum time between meteor launches.",
|
||||||
|
"default": 5
|
||||||
|
},
|
||||||
|
"maxInterval": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Maximum time between meteor launches."
|
||||||
|
"default": 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user