Updated logging

This commit is contained in:
Mister_Nebula 2020-04-18 21:08:12 +01:00
parent 1dca5245f5
commit 83d85c5339
5 changed files with 62 additions and 19 deletions

View File

@ -12,6 +12,7 @@ namespace Marshmallow
public static OWRigidbody OWRB; public static OWRigidbody OWRB;
public static Sector SECTOR; public static Sector SECTOR;
public static SpawnPoint SPAWN; public static SpawnPoint SPAWN;
public static AstroObject ASTROOBJECT;
public static IModHelper helper; public static IModHelper helper;
@ -25,6 +26,10 @@ namespace Marshmallow
helper = base.ModHelper; helper = base.ModHelper;
Main.Log("Begin load of planet config...");
try
{
foreach (var file in Directory.GetFiles(ModHelper.Manifest.ModFolderPath + @"planets\")) foreach (var file in Directory.GetFiles(ModHelper.Manifest.ModFolderPath + @"planets\"))
{ {
PlanetConfig config = ModHelper.Storage.Load<PlanetConfig>(file.Replace(ModHelper.Manifest.ModFolderPath, "")); PlanetConfig config = ModHelper.Storage.Load<PlanetConfig>(file.Replace(ModHelper.Manifest.ModFolderPath, ""));
@ -34,6 +39,11 @@ namespace Marshmallow
Log(config.GetSettingsValue<Vector3>("position").ToString()); Log(config.GetSettingsValue<Vector3>("position").ToString());
Log(config.GetSettingsValue<Color32>("fogTint").ToString()); Log(config.GetSettingsValue<Color32>("fogTint").ToString());
} }
}
catch (Exception ex)
{
Main.Log("Error! - " + ex.Message);
}
if (planetList.Count != 0) if (planetList.Count != 0)
{ {
@ -58,6 +68,8 @@ namespace Marshmallow
planet.transform.position = config.GetSettingsValue<Vector3>("position"); planet.transform.position = config.GetSettingsValue<Vector3>("position");
planet.SetActive(true); planet.SetActive(true);
General.MakeOrbitLine.Make(planet, ASTROOBJECT);
} }
} }
} }
@ -70,7 +82,9 @@ namespace Marshmallow
var name = config.GetSettingsValue<string>("name"); var name = config.GetSettingsValue<string>("name");
var topCloudSize = config.GetSettingsValue<float>("topCloudSize"); var topCloudSize = config.GetSettingsValue<float>("topCloudSize");
Log("Got top cloud size as " + topCloudSize);
var bottomCloudSize = config.GetSettingsValue<float>("bottomCloudSize"); var bottomCloudSize = config.GetSettingsValue<float>("bottomCloudSize");
Log("Got bottom cloud size as " + bottomCloudSize);
GameObject body; GameObject body;
@ -79,7 +93,7 @@ namespace Marshmallow
Body.MakeGeometry.Make(body, groundScale); Body.MakeGeometry.Make(body, groundScale);
General.MakeOrbitingAstroObject.Make(body, 0.02f, config.GetSettingsValue<float>("orbitAngle"), config.GetSettingsValue<bool>("hasGravity"), config.GetSettingsValue<float>("surfaceAcceleration"), groundScale); ASTROOBJECT = General.MakeOrbitingAstroObject.Make(body, 0.02f, config.GetSettingsValue<float>("orbitAngle"), config.GetSettingsValue<bool>("hasGravity"), config.GetSettingsValue<float>("surfaceAcceleration"), groundScale);
General.MakeRFVolume.Make(body); General.MakeRFVolume.Make(body);
if (config.GetSettingsValue<bool>("hasMapMarker")) if (config.GetSettingsValue<bool>("hasMapMarker"))
@ -119,7 +133,7 @@ namespace Marshmallow
public static void Log(string text) public static void Log(string text)
{ {
helper.Console.WriteLine("[Marshmallow] : " + text); helper.Console.WriteLine(text);
} }
} }
} }

View File

@ -0,0 +1,24 @@
using OWML.ModHelper.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace Marshmallow.General
{
static class MakeOrbitLine
{
public static void Make(GameObject body, AstroObject astroobject)
{
GameObject orbit = new GameObject();
orbit.transform.parent = body.transform;
orbit.AddComponent<LineRenderer>();
var ol = orbit.AddComponent<OrbitLine>();
ol.SetValue("_astroObject", astroobject);
ol.SetValue("_fade", false);
}
}
}

View File

@ -5,7 +5,7 @@ namespace Marshmallow.General
{ {
static class MakeOrbitingAstroObject static class MakeOrbitingAstroObject
{ {
public static void Make(GameObject body, float angularSpeed, float orbitAngle, bool hasGravity, float surfaceAccel, float groundSize) public static AstroObject Make(GameObject body, float angularSpeed, float orbitAngle, bool hasGravity, float surfaceAccel, float groundSize)
{ {
Rigidbody RB = body.AddComponent<Rigidbody>(); Rigidbody RB = body.AddComponent<Rigidbody>();
RB.mass = 10000; RB.mass = 10000;
@ -25,6 +25,7 @@ namespace Marshmallow.General
InitialMotion IM = body.AddComponent<InitialMotion>(); InitialMotion IM = body.AddComponent<InitialMotion>();
IM.SetPrimaryBody(Locator.GetAstroObject(AstroObject.Name.Sun).GetAttachedOWRigidbody()); IM.SetPrimaryBody(Locator.GetAstroObject(AstroObject.Name.Sun).GetAttachedOWRigidbody());
IM.SetValue("_orbitAngle", orbitAngle); IM.SetValue("_orbitAngle", orbitAngle);
Main.Log("Got orbit angle as " + orbitAngle);
IM.SetValue("_isGlobalAxis", false); IM.SetValue("_isGlobalAxis", false);
IM.SetValue("_initAngularSpeed", angularSpeed); IM.SetValue("_initAngularSpeed", angularSpeed);
IM.SetValue("_initLinearSpeed", 0f); IM.SetValue("_initLinearSpeed", 0f);
@ -47,6 +48,9 @@ namespace Marshmallow.General
GravityVolume GV = MakeGravityWell.Make(body, surfaceAccel, groundSize, groundSize); GravityVolume GV = MakeGravityWell.Make(body, surfaceAccel, groundSize, groundSize);
AO.SetValue("_gravityVolume", GV); AO.SetValue("_gravityVolume", GV);
} }
return AO;
//General.MakeOrbitLine.Make(body, AO);
} }
} }
} }

View File

@ -31,35 +31,35 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="0Harmony, Version=1.2.0.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="0Harmony, Version=2.0.0.9, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll</HintPath> <HintPath>..\packages\Lib.Harmony.2.0.0.9\lib\net35\0Harmony.dll</HintPath>
</Reference> </Reference>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\Assembly-CSharp.dll</HintPath> <HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.43\lib\net35\NAudio-Unity.dll</HintPath> <HintPath>..\packages\OWML.0.3.44\lib\net35\NAudio-Unity.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.43\lib\net35\OWML.dll</HintPath> <HintPath>..\packages\OWML.0.3.44\lib\net35\OWML.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.43\lib\net35\OWML.Common.dll</HintPath> <HintPath>..\packages\OWML.0.3.44\lib\net35\OWML.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.43\lib\net35\OWML.ModHelper.dll</HintPath> <HintPath>..\packages\OWML.0.3.44\lib\net35\OWML.ModHelper.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Assets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Assets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.43\lib\net35\OWML.ModHelper.Assets.dll</HintPath> <HintPath>..\packages\OWML.0.3.44\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Events, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Events, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.43\lib\net35\OWML.ModHelper.Events.dll</HintPath> <HintPath>..\packages\OWML.0.3.44\lib\net35\OWML.ModHelper.Events.dll</HintPath>
</Reference> </Reference>
<Reference Include="OWML.ModHelper.Menus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="OWML.ModHelper.Menus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OWML.0.3.43\lib\net35\OWML.ModHelper.Menus.dll</HintPath> <HintPath>..\packages\OWML.0.3.44\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -105,6 +105,7 @@
<Compile Include="MakeGravityWell.cs" /> <Compile Include="MakeGravityWell.cs" />
<Compile Include="MakeMapMarker.cs" /> <Compile Include="MakeMapMarker.cs" />
<Compile Include="MakeOrbitingAstroObject.cs" /> <Compile Include="MakeOrbitingAstroObject.cs" />
<Compile Include="MakeOrbitLine.cs" />
<Compile Include="MakeRFVolume.cs" /> <Compile Include="MakeRFVolume.cs" />
<Compile Include="MakeSector.cs" /> <Compile Include="MakeSector.cs" />
<Compile Include="MakeSpawnPoint.cs" /> <Compile Include="MakeSpawnPoint.cs" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" /> <package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" />
<package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" /> <package id="Lib.Harmony" version="2.0.0.9" targetFramework="net35" />
<package id="OWML" version="0.3.43" targetFramework="net35" /> <package id="OWML" version="0.3.44" targetFramework="net35" />
</packages> </packages>