mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
commit
e303ba59fd
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.External;
|
using NewHorizons.External;
|
||||||
|
using NewHorizons.External.Configs;
|
||||||
using OWML.Utils;
|
using OWML.Utils;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -11,18 +12,17 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
public static class CometTailBuilder
|
public static class CometTailBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject go, BaseModule module, AstroObject primary)
|
public static void Make(GameObject go, IPlanetConfig config, AstroObject primary)
|
||||||
{
|
{
|
||||||
var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), go.transform);
|
var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), go.transform);
|
||||||
cometTail.transform.localPosition = Vector3.zero;
|
cometTail.transform.localPosition = Vector3.zero;
|
||||||
cometTail.name = "CometTail";
|
cometTail.name = "CometTail";
|
||||||
cometTail.transform.localScale = Vector3.one * module.SurfaceSize / 110;
|
cometTail.transform.localScale = Vector3.one * config.Base.SurfaceSize / 110;
|
||||||
cometTail.transform.localRotation = Quaternion.Euler(0, 90, 90);
|
|
||||||
/*
|
Vector3 alignment = new Vector3(0, 270, 90);
|
||||||
var alignment = cometTail.AddComponent<AlignWithTargetBody>();
|
if (config.Base.CometTailRotation != null) alignment = config.Base.CometTailRotation;
|
||||||
alignment.SetTargetBody(primary.GetAttachedOWRigidbody());
|
|
||||||
alignment.SetValue("_usePhysicsToRotate", true);
|
cometTail.transform.rotation = Quaternion.Euler(alignment);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.Builder.Body.Geometry;
|
using NewHorizons.Builder.Body.Geometry;
|
||||||
|
using NewHorizons.Builder.Props;
|
||||||
using NewHorizons.External;
|
using NewHorizons.External;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
@ -42,7 +43,9 @@ namespace NewHorizons.Builder.Body
|
|||||||
cubeSphere.AddComponent<MeshFilter>();
|
cubeSphere.AddComponent<MeshFilter>();
|
||||||
cubeSphere.GetComponent<MeshFilter>().mesh = mesh;
|
cubeSphere.GetComponent<MeshFilter>().mesh = mesh;
|
||||||
|
|
||||||
if(PlanetShader == null) PlanetShader = Main.ShaderBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapper.shader");
|
// TODO: fix UVs so we can switch to the default shader
|
||||||
|
if (PlanetShader == null) PlanetShader = Main.ShaderBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapper.shader");
|
||||||
|
//if (PlanetShader == null) PlanetShader = Shader.Find("Standard");
|
||||||
|
|
||||||
var cubeSphereMR = cubeSphere.AddComponent<MeshRenderer>();
|
var cubeSphereMR = cubeSphere.AddComponent<MeshRenderer>();
|
||||||
cubeSphereMR.material = new Material(PlanetShader);
|
cubeSphereMR.material = new Material(PlanetShader);
|
||||||
|
|||||||
@ -66,6 +66,15 @@ namespace NewHorizons.Builder.General
|
|||||||
var alignment = body.AddComponent<AlignWithTargetBody>();
|
var alignment = body.AddComponent<AlignWithTargetBody>();
|
||||||
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
|
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
|
||||||
alignment.SetValue("_usePhysicsToRotate", true);
|
alignment.SetValue("_usePhysicsToRotate", true);
|
||||||
|
if(config.Orbit.AlignmentAxis == null)
|
||||||
|
{
|
||||||
|
alignment._localAlignmentAxis = new Vector3(0, -1, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alignment._localAlignmentAxis = config.Orbit.AlignmentAxis;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.Base.CenterOfSolarSystem)
|
if (config.Base.CenterOfSolarSystem)
|
||||||
|
|||||||
@ -23,6 +23,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
if (detail.assetBundle != null)
|
if (detail.assetBundle != null)
|
||||||
{
|
{
|
||||||
var prefab = PropBuildManager.LoadPrefab(detail.assetBundle, detail.path, uniqueModName, mod);
|
var prefab = PropBuildManager.LoadPrefab(detail.assetBundle, detail.path, uniqueModName, mod);
|
||||||
|
|
||||||
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
||||||
}
|
}
|
||||||
else if (detail.objFilePath != null)
|
else if (detail.objFilePath != null)
|
||||||
@ -30,6 +31,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var prefab = mod.ModHelper.Assets.Get3DObject(detail.objFilePath, detail.mtlFilePath);
|
var prefab = mod.ModHelper.Assets.Get3DObject(detail.objFilePath, detail.mtlFilePath);
|
||||||
|
PropBuildManager.ReplaceShaders(prefab);
|
||||||
prefab.SetActive(false);
|
prefab.SetActive(false);
|
||||||
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,7 +104,26 @@ namespace NewHorizons.Builder.Props
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReplaceShaders(prefab);
|
||||||
|
|
||||||
return prefab;
|
return prefab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ReplaceShaders(GameObject prefab)
|
||||||
|
{
|
||||||
|
foreach (var renderer in prefab.GetComponentsInChildren<Renderer>(true))
|
||||||
|
{
|
||||||
|
foreach (var material in renderer.sharedMaterials)
|
||||||
|
{
|
||||||
|
if (material == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var replacementShader = Shader.Find(material.shader.name);
|
||||||
|
if (replacementShader != null) material.shader = replacementShader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ namespace NewHorizons.Builder.Updater
|
|||||||
var planetoid = new Planet.Plantoid(
|
var planetoid = new Planet.Plantoid(
|
||||||
original.size,
|
original.size,
|
||||||
original.gravity,
|
original.gravity,
|
||||||
go.transform.rotation,
|
mapping[heavenlyBody].state.orbit.orientation.rotation,
|
||||||
InitialMotionBuilder.SiderealPeriodToAngularSpeed(body.Config.Orbit.SiderealPeriod),
|
InitialMotionBuilder.SiderealPeriodToAngularSpeed(body.Config.Orbit.SiderealPeriod),
|
||||||
parent,
|
parent,
|
||||||
coords
|
coords
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace NewHorizons.Components
|
|||||||
GlobalMessenger<OWRigidbody>.AddListener("EnterFlightConsole", new Callback<OWRigidbody>(OnEnterFlightConsole));
|
GlobalMessenger<OWRigidbody>.AddListener("EnterFlightConsole", new Callback<OWRigidbody>(OnEnterFlightConsole));
|
||||||
|
|
||||||
_nextCardIndex = 0;
|
_nextCardIndex = 0;
|
||||||
foreach (var starSystem in Main.BodyDict.Keys)
|
foreach (var starSystem in Main.SystemDict.Keys)
|
||||||
{
|
{
|
||||||
// Get rid of the warp option for the current system
|
// Get rid of the warp option for the current system
|
||||||
if (starSystem == Main.Instance.CurrentStarSystem) continue;
|
if (starSystem == Main.Instance.CurrentStarSystem) continue;
|
||||||
@ -70,6 +70,15 @@ namespace NewHorizons.Components
|
|||||||
AddSystemCard(starSystem);
|
AddSystemCard(starSystem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//AddSystemCard("EyeOfTheUniverse");
|
||||||
|
|
||||||
|
/* Ship log manager isnt initiatiized yet
|
||||||
|
if(Locator.GetShipLogManager().IsFactRevealed("OPC_EYE_COORDINATES_X1"))
|
||||||
|
{
|
||||||
|
AddSystemCard("EyeOfTheUniverse");
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddSystemCard(string starSystem)
|
public void AddSystemCard(string starSystem)
|
||||||
|
|||||||
1
NewHorizons/External/BaseModule.cs
vendored
1
NewHorizons/External/BaseModule.cs
vendored
@ -17,6 +17,7 @@ namespace NewHorizons.External
|
|||||||
public float SphereOfInfluence { get; set; }
|
public float SphereOfInfluence { get; set; }
|
||||||
public float GroundSize { get; set; }
|
public float GroundSize { get; set; }
|
||||||
public bool HasCometTail { get; set; }
|
public bool HasCometTail { get; set; }
|
||||||
|
public MVector3 CometTailRotation { get; set; }
|
||||||
public bool HasReferenceFrame { get; set; } = true;
|
public bool HasReferenceFrame { get; set; } = true;
|
||||||
public bool CenterOfSolarSystem { get; set; } = false;
|
public bool CenterOfSolarSystem { get; set; } = false;
|
||||||
public bool IsSatellite { get; set; }
|
public bool IsSatellite { get; set; }
|
||||||
|
|||||||
1
NewHorizons/External/OrbitModule.cs
vendored
1
NewHorizons/External/OrbitModule.cs
vendored
@ -22,6 +22,7 @@ namespace NewHorizons.External
|
|||||||
public float AxialTilt { get; set; }
|
public float AxialTilt { get; set; }
|
||||||
public float SiderealPeriod { get; set; }
|
public float SiderealPeriod { get; set; }
|
||||||
public bool IsTidallyLocked { get; set; }
|
public bool IsTidallyLocked { get; set; }
|
||||||
|
public MVector3 AlignmentAxis { get; set; }
|
||||||
public bool ShowOrbitLine { get; set; } = true;
|
public bool ShowOrbitLine { get; set; } = true;
|
||||||
public bool IsStatic { get; set; }
|
public bool IsStatic { get; set; }
|
||||||
public MColor Tint { get; set; }
|
public MColor Tint { get; set; }
|
||||||
|
|||||||
@ -292,7 +292,7 @@ namespace NewHorizons.Handlers
|
|||||||
AsteroidBeltBuilder.Make(body.Config.Name, body.Config, body.Mod);
|
AsteroidBeltBuilder.Make(body.Config.Name, body.Config, body.Mod);
|
||||||
|
|
||||||
if (body.Config.Base.HasCometTail)
|
if (body.Config.Base.HasCometTail)
|
||||||
CometTailBuilder.Make(go, body.Config.Base, go.GetComponent<AstroObject>().GetPrimaryBody());
|
CometTailBuilder.Make(go, body.Config, go.GetComponent<AstroObject>().GetPrimaryBody());
|
||||||
|
|
||||||
// Backwards compatability
|
// Backwards compatability
|
||||||
if (body.Config.Base.LavaSize != 0)
|
if (body.Config.Base.LavaSize != 0)
|
||||||
|
|||||||
@ -58,6 +58,8 @@ namespace NewHorizons
|
|||||||
private bool _firstLoad = true;
|
private bool _firstLoad = true;
|
||||||
private ShipWarpController _shipWarpController;
|
private ShipWarpController _shipWarpController;
|
||||||
|
|
||||||
|
private GameObject _ship;
|
||||||
|
|
||||||
public override object GetApi()
|
public override object GetApi()
|
||||||
{
|
{
|
||||||
return new NewHorizonsApi();
|
return new NewHorizonsApi();
|
||||||
@ -95,6 +97,7 @@ namespace NewHorizons
|
|||||||
GlobalMessenger.AddListener("WakeUp", new Callback(OnWakeUp));
|
GlobalMessenger.AddListener("WakeUp", new Callback(OnWakeUp));
|
||||||
ShaderBundle = Main.Instance.ModHelper.Assets.LoadBundle("AssetBundle/shader");
|
ShaderBundle = Main.Instance.ModHelper.Assets.LoadBundle("AssetBundle/shader");
|
||||||
BodyDict["SolarSystem"] = new List<NewHorizonsBody>();
|
BodyDict["SolarSystem"] = new List<NewHorizonsBody>();
|
||||||
|
BodyDict["EyeOfTheUniverse"] = new List<NewHorizonsBody>(); // Keep this empty tho fr
|
||||||
SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), this);
|
SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), this);
|
||||||
|
|
||||||
Tools.Patches.Apply();
|
Tools.Patches.Apply();
|
||||||
@ -191,11 +194,30 @@ namespace NewHorizons
|
|||||||
TitleSceneHandler.DisplayBodyOnTitleScreen(BodyDict.Values.ToList().SelectMany(x => x).ToList());
|
TitleSceneHandler.DisplayBodyOnTitleScreen(BodyDict.Values.ToList().SelectMany(x => x).ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(scene.name == "EyeOfTheUniverse" && IsWarping)
|
||||||
|
{
|
||||||
|
if(_ship != null) SceneManager.MoveGameObjectToScene(_ship, SceneManager.GetActiveScene());
|
||||||
|
_ship.transform.position = new Vector3(50, 0, 0);
|
||||||
|
_ship.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
if(scene.name == "SolarSystem")
|
if(scene.name == "SolarSystem")
|
||||||
{
|
{
|
||||||
|
foreach(var body in GameObject.FindObjectsOfType<AstroObject>())
|
||||||
|
{
|
||||||
|
Logger.Log($"{body.name}, {body.transform.rotation}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_ship != null)
|
||||||
|
{
|
||||||
|
_ship = GameObject.Find("Ship_Body").InstantiateInactive();
|
||||||
|
DontDestroyOnLoad(_ship);
|
||||||
|
}
|
||||||
|
|
||||||
IsSystemReady = false;
|
IsSystemReady = false;
|
||||||
|
|
||||||
HeavenlyBodyBuilder.Reset();
|
HeavenlyBodyBuilder.Reset();
|
||||||
|
CommonResourcesFix.Apply();
|
||||||
NewHorizonsData.Load();
|
NewHorizonsData.Load();
|
||||||
SignalBuilder.Init();
|
SignalBuilder.Init();
|
||||||
AstroObjectLocator.RefreshList();
|
AstroObjectLocator.RefreshList();
|
||||||
@ -348,7 +370,15 @@ namespace NewHorizons
|
|||||||
// We kill them so they don't move as much
|
// We kill them so they don't move as much
|
||||||
Locator.GetDeathManager().KillPlayer(DeathType.Meditation);
|
Locator.GetDeathManager().KillPlayer(DeathType.Meditation);
|
||||||
|
|
||||||
LoadManager.LoadSceneAsync(OWScene.SolarSystem, true, LoadManager.FadeType.ToBlack, 0.1f, true);
|
if(newStarSystem == "EyeOfTheUniverse")
|
||||||
|
{
|
||||||
|
PlayerData.SaveWarpedToTheEye(60);
|
||||||
|
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToBlack, 0.1f, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LoadManager.LoadSceneAsync(OWScene.SolarSystem, true, LoadManager.FadeType.ToBlack, 0.1f, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDeath(DeathType _)
|
void OnDeath(DeathType _)
|
||||||
@ -390,7 +420,12 @@ namespace NewHorizons
|
|||||||
|
|
||||||
public GameObject GetPlanet(string name)
|
public GameObject GetPlanet(string name)
|
||||||
{
|
{
|
||||||
return Main.BodyDict.Values.SelectMany(x => x).ToList().FirstOrDefault(x => x.Config.Name == name).Object;
|
return Main.BodyDict.Values.SelectMany(x => x)?.ToList()?.FirstOrDefault(x => x.Config.Name == name)?.Object;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetCurrentStarSystem()
|
||||||
|
{
|
||||||
|
return Main.Instance.CurrentStarSystem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion API
|
#endregion API
|
||||||
|
|||||||
@ -59,6 +59,9 @@ namespace NewHorizons.Tools
|
|||||||
|
|
||||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<PlayerSpawner>("SpawnPlayer", typeof(Patches), nameof(Patches.OnPlayerSpawnerSpawnPlayerPreFix));
|
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<PlayerSpawner>("SpawnPlayer", typeof(Patches), nameof(Patches.OnPlayerSpawnerSpawnPlayerPreFix));
|
||||||
|
|
||||||
|
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<DeathManager>("KillPlayer", typeof(Patches), nameof(Patches.OnDeathManagerKillPlayer));
|
||||||
|
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipThrusterController>("ReadTranslationalInput", typeof(Patches), nameof(Patches.OnShipThrusterControllerReadTranslationalInput));
|
||||||
|
|
||||||
// Postfixes
|
// Postfixes
|
||||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<MapController>("Awake", typeof(Patches), nameof(Patches.OnMapControllerAwake));
|
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<MapController>("Awake", typeof(Patches), nameof(Patches.OnMapControllerAwake));
|
||||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<MapController>("OnTargetReferenceFrame", typeof(Patches), nameof(Patches.OnMapControllerOnTargetReferenceFrame));
|
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<MapController>("OnTargetReferenceFrame", typeof(Patches), nameof(Patches.OnMapControllerOnTargetReferenceFrame));
|
||||||
@ -360,5 +363,97 @@ namespace NewHorizons.Tools
|
|||||||
Logger.Log("Player spawning");
|
Logger.Log("Player spawning");
|
||||||
__instance.SetInitialSpawnPoint(Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint);
|
__instance.SetInitialSpawnPoint(Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool OnDeathManagerKillPlayer()
|
||||||
|
{
|
||||||
|
return (Main.Instance.CurrentStarSystem != "EyeOfTheUniverse");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool OnShipThrusterControllerReadTranslationalInput(ShipThrusterController __instance, ref Vector3 __result)
|
||||||
|
{
|
||||||
|
if (Main.Instance.CurrentStarSystem != "EyeOfTheUniverse") return true;
|
||||||
|
|
||||||
|
float value = OWInput.GetValue(InputLibrary.thrustX, InputMode.All);
|
||||||
|
float value2 = OWInput.GetValue(InputLibrary.thrustZ, InputMode.All);
|
||||||
|
float value3 = OWInput.GetValue(InputLibrary.thrustUp, InputMode.All);
|
||||||
|
float value4 = OWInput.GetValue(InputLibrary.thrustDown, InputMode.All);
|
||||||
|
if (!OWInput.IsInputMode(InputMode.ShipCockpit | InputMode.LandingCam))
|
||||||
|
{
|
||||||
|
__result = Vector3.zero;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!__instance._shipResources.AreThrustersUsable())
|
||||||
|
{
|
||||||
|
__result = Vector3.zero;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (__instance._autopilot.IsFlyingToDestination())
|
||||||
|
{
|
||||||
|
__result = Vector3.zero;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Vector3 vector = new Vector3(value, 0f, value2);
|
||||||
|
if (vector.sqrMagnitude > 1f)
|
||||||
|
{
|
||||||
|
vector.Normalize();
|
||||||
|
}
|
||||||
|
vector.y = value3 - value4;
|
||||||
|
if (__instance._requireIgnition && __instance._landingManager.IsLanded())
|
||||||
|
{
|
||||||
|
vector.x = 0f;
|
||||||
|
vector.z = 0f;
|
||||||
|
vector.y = Mathf.Clamp01(vector.y);
|
||||||
|
if (!__instance._isIgniting && __instance._lastTranslationalInput.y <= 0f && vector.y > 0f)
|
||||||
|
{
|
||||||
|
__instance._isIgniting = true;
|
||||||
|
__instance._ignitionTime = Time.time;
|
||||||
|
GlobalMessenger.FireEvent("StartShipIgnition");
|
||||||
|
}
|
||||||
|
if (__instance._isIgniting)
|
||||||
|
{
|
||||||
|
if (vector.y <= 0f)
|
||||||
|
{
|
||||||
|
__instance._isIgniting = false;
|
||||||
|
GlobalMessenger.FireEvent("CancelShipIgnition");
|
||||||
|
}
|
||||||
|
if (Time.time < __instance._ignitionTime + __instance._ignitionDuration)
|
||||||
|
{
|
||||||
|
vector.y = 0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__instance._isIgniting = false;
|
||||||
|
__instance._requireIgnition = false;
|
||||||
|
GlobalMessenger.FireEvent("CompleteShipIgnition");
|
||||||
|
RumbleManager.PlayShipIgnition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float d = __instance._thrusterModel.GetMaxTranslationalThrust() / __instance._thrusterModel.GetMaxTranslationalThrust();
|
||||||
|
Vector3 vector2 = vector * d;
|
||||||
|
if (__instance._limitOrbitSpeed && vector2.magnitude > 0f)
|
||||||
|
{
|
||||||
|
Vector3 vector3 = __instance._landingRF.GetOWRigidBody().GetWorldCenterOfMass() - __instance._shipBody.GetWorldCenterOfMass();
|
||||||
|
Vector3 vector4 = __instance._shipBody.GetVelocity() - __instance._landingRF.GetVelocity();
|
||||||
|
Vector3 vector5 = vector4 - Vector3.Project(vector4, vector3);
|
||||||
|
Vector3 vector6 = Quaternion.FromToRotation(-__instance._shipBody.transform.up, vector3) * __instance._shipBody.transform.TransformDirection(vector2 * __instance._thrusterModel.GetMaxTranslationalThrust());
|
||||||
|
Vector3 vector7 = Vector3.Project(vector6, vector3);
|
||||||
|
Vector3 vector8 = vector6 - vector7;
|
||||||
|
Vector3 a = vector5 + vector8 * Time.deltaTime;
|
||||||
|
float magnitude = a.magnitude;
|
||||||
|
float orbitSpeed = __instance._landingRF.GetOrbitSpeed(vector3.magnitude);
|
||||||
|
if (magnitude > orbitSpeed)
|
||||||
|
{
|
||||||
|
a = a.normalized * orbitSpeed;
|
||||||
|
vector8 = (a - vector5) / Time.deltaTime;
|
||||||
|
vector6 = vector7 + vector8;
|
||||||
|
vector2 = __instance._shipBody.transform.InverseTransformDirection(vector6 / __instance._thrusterModel.GetMaxTranslationalThrust());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__instance._lastTranslationalInput = vector;
|
||||||
|
__result = vector2;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
42
NewHorizons/Utility/CommonResources/CommonResourcesFix.cs
Normal file
42
NewHorizons/Utility/CommonResources/CommonResourcesFix.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using PacificEngine.OW_CommonResources.Game.Resource;
|
||||||
|
using PacificEngine.OW_CommonResources.Game.State;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Utility.CommonResources
|
||||||
|
{
|
||||||
|
public static class CommonResourcesFix
|
||||||
|
{
|
||||||
|
public static void Apply()
|
||||||
|
{
|
||||||
|
var mapping = Planet.defaultMapping;
|
||||||
|
|
||||||
|
var DB = mapping[HeavenlyBodies.DarkBramble];
|
||||||
|
mapping[HeavenlyBodies.DarkBramble] = new Planet.Plantoid(
|
||||||
|
DB.size,
|
||||||
|
DB.gravity,
|
||||||
|
DB.state.orbit.orientation.rotation * Quaternion.AngleAxis(180, Vector3.left),
|
||||||
|
DB.state.orbit.orientation.angularVelocity.magnitude,
|
||||||
|
DB.state.parent,
|
||||||
|
DB.state.orbit.coordinates
|
||||||
|
);
|
||||||
|
|
||||||
|
var TT = mapping[HeavenlyBodies.AshTwin];
|
||||||
|
mapping[HeavenlyBodies.AshTwin] = new Planet.Plantoid(
|
||||||
|
TT.size,
|
||||||
|
TT.gravity,
|
||||||
|
TT.state.orbit.orientation.rotation * Quaternion.AngleAxis(180, Vector3.left),
|
||||||
|
TT.state.orbit.orientation.angularVelocity.magnitude,
|
||||||
|
TT.state.parent,
|
||||||
|
TT.state.orbit.coordinates
|
||||||
|
);
|
||||||
|
|
||||||
|
Planet.defaultMapping = mapping;
|
||||||
|
Planet.mapping = mapping;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -104,5 +104,18 @@ namespace NewHorizons.Utility
|
|||||||
"$1 $2"
|
"$1 $2"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GameObject InstantiateInactive(this GameObject original)
|
||||||
|
{
|
||||||
|
if (!original.activeSelf)
|
||||||
|
{
|
||||||
|
return UnityEngine.Object.Instantiate(original);
|
||||||
|
}
|
||||||
|
|
||||||
|
original.SetActive(false);
|
||||||
|
var copy = UnityEngine.Object.Instantiate(original);
|
||||||
|
original.SetActive(true);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
"author": "xen, Idiot, & Book",
|
"author": "xen, Idiot, & Book",
|
||||||
"name": "New Horizons",
|
"name": "New Horizons",
|
||||||
"uniqueName": "xen.NewHorizons",
|
"uniqueName": "xen.NewHorizons",
|
||||||
"version": "0.9.4",
|
"version": "0.9.5",
|
||||||
"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" ]
|
||||||
|
|||||||
@ -131,12 +131,12 @@
|
|||||||
"hasMapMarker": {
|
"hasMapMarker": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
"description" : "If the body should have a marker on the map screen."
|
"description": "If the body should have a marker on the map screen."
|
||||||
},
|
},
|
||||||
"hasAmbientLight": {
|
"hasAmbientLight": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
"description" : "If the dark side of the body should have some slight ammount of light"
|
"description": "If the dark side of the body should have some slight ammount of light"
|
||||||
},
|
},
|
||||||
"surfaceGravity": {
|
"surfaceGravity": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
@ -150,7 +150,7 @@
|
|||||||
"inverseSquared"
|
"inverseSquared"
|
||||||
],
|
],
|
||||||
"default": "linear",
|
"default": "linear",
|
||||||
"description" : "How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared."
|
"description": "How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared."
|
||||||
},
|
},
|
||||||
"surfaceSize": {
|
"surfaceSize": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
@ -170,7 +170,11 @@
|
|||||||
"hasCometTail": {
|
"hasCometTail": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
"description" : "If you want the body to have a tail like the Interloper."
|
"description": "If you want the body to have a tail like the Interloper."
|
||||||
|
},
|
||||||
|
"cometTailRotation": {
|
||||||
|
"type": "#/$defs/vector3",
|
||||||
|
"description": "If it has a comet tail, it'll be oriented according to these Euler angles."
|
||||||
},
|
},
|
||||||
"hasReferenceFrame": {
|
"hasReferenceFrame": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
@ -286,41 +290,45 @@
|
|||||||
},
|
},
|
||||||
"longitudeOfAscendingNode": {
|
"longitudeOfAscendingNode": {
|
||||||
"$ref": "#/$defs/angle",
|
"$ref": "#/$defs/angle",
|
||||||
"description" : "An angle (in degrees) defining the point where the orbit of the body rises above the orbital plane if it has nonzero inclination."
|
"description": "An angle (in degrees) defining the point where the orbit of the body rises above the orbital plane if it has nonzero inclination."
|
||||||
},
|
},
|
||||||
"eccentricity": {
|
"eccentricity": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": 0,
|
"default": 0,
|
||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
"maximum": 0.99999,
|
"maximum": 0.99999,
|
||||||
"description" : "At 0 the orbit is a circle. The closer to 1 it is, the more oval-shaped the orbit is."
|
"description": "At 0 the orbit is a circle. The closer to 1 it is, the more oval-shaped the orbit is."
|
||||||
},
|
},
|
||||||
"argumentOfPeriapsis": {
|
"argumentOfPeriapsis": {
|
||||||
"$ref": "#/$defs/angle",
|
"$ref": "#/$defs/angle",
|
||||||
"description" : "An angle (in degrees) defining the location of the periapsis (closest distance to it's primary body) if it has nonzero eccentricity."
|
"description": "An angle (in degrees) defining the location of the periapsis (closest distance to it's primary body) if it has nonzero eccentricity."
|
||||||
},
|
},
|
||||||
"trueAnomaly": {
|
"trueAnomaly": {
|
||||||
"$ref": "#/$defs/angle",
|
"$ref": "#/$defs/angle",
|
||||||
"description" : "Where the planet should start off in its orbit in terms of the central angle."
|
"description": "Where the planet should start off in its orbit in terms of the central angle."
|
||||||
},
|
},
|
||||||
"axialTilt": {
|
"axialTilt": {
|
||||||
"$ref": "#/$defs/angle",
|
"$ref": "#/$defs/angle",
|
||||||
"description" : "The angle between the normal to the orbital plane and its axis of rotation."
|
"description": "The angle between the normal to the orbital plane and its axis of rotation."
|
||||||
},
|
},
|
||||||
"siderealPeriod": {
|
"siderealPeriod": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": 0,
|
"default": 0,
|
||||||
"description" : "Rotation period in minutes."
|
"description": "Rotation period in minutes."
|
||||||
},
|
},
|
||||||
"isTidallyLocked": {
|
"isTidallyLocked": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
"description" : "Should the body always have one side facing its primary?"
|
"description": "Should the body always have one side facing its primary?"
|
||||||
|
},
|
||||||
|
"alignmentAxis": {
|
||||||
|
"type": "#/$defs/vector3",
|
||||||
|
"description": "If it is tidally locked, this direction will face towards the primary. Ex) Interloper uses 0, -1, 0. Most planets will want something like -1, 0, 0."
|
||||||
},
|
},
|
||||||
"showOrbitLine": {
|
"showOrbitLine": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
"description" : "Referring to the orbit line in the map screen."
|
"description": "Referring to the orbit line in the map screen."
|
||||||
},
|
},
|
||||||
"isStatic": {
|
"isStatic": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user