diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1ff0c423..00000000 --- a/.gitattributes +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################### -# Set default behavior to automatically normalize line endings. -############################################################################### -* text=auto - -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp - -############################################################################### -# Set the merge driver for project and solution files -# -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary - -############################################################################### -# behavior for image files -# -# image files are treated as binary by default. -############################################################################### -#*.jpg binary -#*.png binary -#*.gif binary - -############################################################################### -# diff behavior for common document formats -# -# Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the -# entries below. -############################################################################### -#*.doc diff=astextplain -#*.DOC diff=astextplain -#*.docx diff=astextplain -#*.DOCX diff=astextplain -#*.dot diff=astextplain -#*.DOT diff=astextplain -#*.pdf diff=astextplain -#*.PDF diff=astextplain -#*.rtf diff=astextplain -#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index 4ce6fdde..728f0260 100644 --- a/.gitignore +++ b/.gitignore @@ -1,340 +1,5 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- Backup*.rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb \ No newline at end of file +packages +.vs +bin +obj diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..90606296 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Ricardo Lopes + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Marshmallow/Atmosphere/EffectsBuilder.cs b/Marshmallow/Atmosphere/EffectsBuilder.cs deleted file mode 100644 index 07ab1e2c..00000000 --- a/Marshmallow/Atmosphere/EffectsBuilder.cs +++ /dev/null @@ -1,31 +0,0 @@ -using OWML.ModHelper.Events; -using UnityEngine; -using Logger = Marshmallow.Utility.Logger; - -namespace Marshmallow.Atmosphere -{ - static class EffectsBuilder - { - public static void Make(GameObject body, Sector sector) - { - GameObject effectsGO = new GameObject(); - effectsGO.SetActive(false); - effectsGO.transform.parent = body.transform; - - SectorCullGroup SCG = effectsGO.AddComponent(); - SCG.SetValue("_sector", sector); - SCG.SetValue("_particleSystemSuspendMode", CullGroup.ParticleSystemSuspendMode.Stop); - SCG.SetValue("_occlusionCulling", false); - SCG.SetValue("_dynamicCullingBounds", false); - SCG.SetValue("_waitForStreaming", false); - - var rainGO = GameObject.Instantiate(GameObject.Find("Effects_GD_Rain")); - rainGO.transform.parent = effectsGO.transform; - rainGO.transform.localPosition = Vector3.zero; - - effectsGO.SetActive(true); - rainGO.SetActive(true); - Logger.Log("Finished building effects", Logger.LogType.Log); - } - } -} diff --git a/Marshmallow/External/PlanetConfig.cs b/Marshmallow/External/PlanetConfig.cs deleted file mode 100644 index a04b5b61..00000000 --- a/Marshmallow/External/PlanetConfig.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Marshmallow.Utility; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; - -namespace Marshmallow.External -{ - public class PlanetConfig : IPlanetConfig - { - public string Name { get; set; } - public MVector3 Position { get; set; } - public int OrbitAngle { get; set; } - public string PrimaryBody { get; set; } - public bool IsMoon { get; set; } - public float AtmoEndSize { get; set; } - public bool HasClouds { get; set; } - public float TopCloudSize { get; set; } - public float BottomCloudSize { get; set; } - public MColor32 TopCloudTint { get; set; } - public MColor32 BottomCloudTint { get; set; } - public bool HasWater { get; set; } - public float WaterSize { get; set; } - public bool HasRain { get; set; } - public bool HasGravity { get; set; } - public float SurfaceAcceleration { get; set; } - public bool HasMapMarker { get; set; } - public bool HasFog { get; set; } - public MColor32 FogTint { get; set; } - public float FogDensity { get; set; } - public bool HasGround { get; set; } - public float GroundSize { get; set; } - public bool IsTidallyLocked { get; set; } - public MColor32 LightTint { get; set; } - } -} diff --git a/Marshmallow/Main.cs b/Marshmallow/Main.cs deleted file mode 100644 index 6f0c63fc..00000000 --- a/Marshmallow/Main.cs +++ /dev/null @@ -1,205 +0,0 @@ -using Marshmallow.Atmosphere; -using Marshmallow.Body; -using Marshmallow.External; -using Marshmallow.General; -using Marshmallow.Utility; -using OWML.Common; -using OWML.ModHelper; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using UnityEngine; -using UnityEngine.SceneManagement; -using Logger = Marshmallow.Utility.Logger; - -namespace Marshmallow -{ - public class Main : ModBehaviour - { - public static IModHelper helper; - - public static List BodyList = new List(); - - private bool finishNextUpdate = false; - - public override object GetApi() - { - return new MarshmallowApi(); - } - - void Start() - { - SceneManager.sceneLoaded += OnSceneLoaded; - helper = base.ModHelper; - - Logger.Log("Begin load of config files...", Logger.LogType.Log); - - try - { - foreach (var file in Directory.GetFiles(ModHelper.Manifest.ModFolderPath + @"planets\")) - { - var config = ModHelper.Storage.Load(file.Replace(ModHelper.Manifest.ModFolderPath, "")); - BodyList.Add(new MarshmallowBody(config)); - - Logger.Log("* " + config.Name + " at position " + config.Position.ToVector3() + " relative to " + config.PrimaryBody + ". Moon? : " + config.IsMoon, Logger.LogType.Log); - } - } - catch (Exception ex) - { - Logger.Log("Error! - " + ex.Message, Logger.LogType.Error); - } - - if (BodyList.Count != 0) - { - Logger.Log("Loaded [" + BodyList.Count + "] config files.", Logger.LogType.Log); - } - else - { - Logger.Log("No config files found!", Logger.LogType.Warning); - } - } - - void OnSceneLoaded(Scene scene, LoadSceneMode mode) - { - if (scene.name != "SolarSystem") - { - return; - } - - foreach (var body in BodyList) - { - var planetObject = GenerateBody(body.Config); - - var primayBody = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(body.Config.PrimaryBody)); - - planetObject.transform.parent = Locator.GetRootTransform(); - planetObject.transform.position = primayBody.gameObject.transform.position + body.Config.Position.ToVector3(); - planetObject.SetActive(true); - - body.Object = planetObject; - } - - finishNextUpdate = true; - } - - void Update() - { - if (finishNextUpdate) - { - foreach (var body in BodyList) - { - OrbitlineBuilder.Make(body.Object, body.Object.GetComponent()); - } - finishNextUpdate = false; - } - } - - public static GameObject GenerateBody(IPlanetConfig config) - { - Logger.Log("Begin generation sequence of [" + config.Name + "] ...", Logger.LogType.Log); - - var body = new GameObject(config.Name); - body.SetActive(false); - - GeometryBuilder.Make(body, config.GroundSize); - - var outputTuple = BaseBuilder.Make(body, Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(config.PrimaryBody)), config); - - var owRigidbody = (OWRigidbody)outputTuple.Items[1]; - RFVolumeBuilder.Make(body, owRigidbody, config); - - if (config.HasMapMarker) - { - MarkerBuilder.Make(body, config); - } - - var sector = MakeSector.Make(body, owRigidbody, config); - - if (config.HasClouds) - { - CloudsBuilder.Make(body, sector, config); - SunOverrideBuilder.Make(body, sector, config); - } - - AirBuilder.Make(body, config.TopCloudSize / 2, config.HasRain); - - if (config.HasWater) - { - WaterBuilder.Make(body, sector, config); - } - - EffectsBuilder.Make(body, sector); - VolumesBuilder.Make(body, config); - AmbientLightBuilder.Make(body, sector, config); - AtmosphereBuilder.Make(body, config); - - Logger.Log("Generation of [" + config.Name + "] completed.", Logger.LogType.Log); - - return body; - } - - public static void CreateBody(IPlanetConfig config) - { - var planet = Main.GenerateBody(config); - - planet.transform.parent = Locator.GetRootTransform(); - planet.transform.position = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(config.PrimaryBody)).gameObject.transform.position + config.Position.ToVector3(); - planet.SetActive(true); - - planet.GetComponent().SetVelocity(Locator.GetCenterOfTheUniverse().GetOffsetVelocity()); - - var primary = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(config.PrimaryBody)).GetAttachedOWRigidbody(); - var initialMotion = primary.GetComponent(); - if (initialMotion != null) - { - planet.GetComponent().AddVelocityChange(-initialMotion.GetInitVelocity()); - planet.GetComponent().AddVelocityChange(primary.GetVelocity()); - } - } - } - - public class MarshmallowApi - { - public void Create(Dictionary config) - { - Logger.Log("Recieved API request to create planet " + (string)config["Name"] + " at position " + (Vector3)config["Position"], Logger.LogType.Log); - var planetConfig = new PlanetConfig - { - Name = (string)config["Name"], - Position = new MVector3(((Vector3)config["Position"]).x, ((Vector3)config["Position"]).y, ((Vector3)config["Position"]).z), - OrbitAngle = (int)config["OrbitAngle"], - IsMoon = (bool)config["IsMoon"], - AtmoEndSize = (float)config["AtmoEndSize"], - PrimaryBody = (string)config["PrimaryBody"], - HasClouds = (bool)config["HasClouds"], - TopCloudSize = (float)config["TopCloudSize"], - BottomCloudSize = (float)config["BottomCloudSize"], - TopCloudTint = new MColor32(((Color32)config["TopCloudTint"]).r, ((Color32)config["TopCloudTint"]).g, ((Color32)config["TopCloudTint"]).b, ((Color32)config["TopCloudTint"]).a), - BottomCloudTint = new MColor32(((Color32)config["BottomCloudTint"]).r, ((Color32)config["BottomCloudTint"]).g, ((Color32)config["BottomCloudTint"]).b, ((Color32)config["BottomCloudTint"]).a), - HasWater = (bool)config["HasWater"], - WaterSize = (float)config["WaterSize"], - HasRain = (bool)config["HasRain"], - HasGravity = (bool)config["HasGravity"], - SurfaceAcceleration = (float)config["SurfaceAcceleration"], - HasMapMarker = (bool)config["HasMapMarker"], - HasFog = (bool)config["HasFog"], - FogTint = new MColor32(((Color32)config["FogTint"]).r, ((Color32)config["FogTint"]).g, ((Color32)config["FogTint"]).b, ((Color32)config["FogTint"]).a), - FogDensity = (float)config["FogDensity"], - HasGround = (bool)config["HasGround"], - GroundSize = (float)config["GroundSize"], - IsTidallyLocked = (bool)config["IsTidallyLocked"], - LightTint = new MColor32(((Color32)config["LightTint"]).r, ((Color32)config["LightTint"]).g, ((Color32)config["LightTint"]).b, ((Color32)config["LightTint"]).a), - }; - - Main.BodyList.Add(new MarshmallowBody(planetConfig)); - - Main.helper.Events.Unity.RunWhen(() => Locator.GetCenterOfTheUniverse() != null, () => Main.CreateBody(planetConfig)); - } - - public GameObject GetPlanet(string name) - { - return Main.BodyList.FirstOrDefault(x => x.Config.Name == name).Object; - } - } -} diff --git a/Marshmallow/Marshmallow.csproj b/Marshmallow/Marshmallow.csproj deleted file mode 100644 index 4b23c588..00000000 --- a/Marshmallow/Marshmallow.csproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - AnyCPU - {6BDE7833-A385-4A73-A121-8335D5E875C0} - Library - Properties - Marshmallow - Marshmallow - v3.5 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - E:\Steam\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\Assembly-CSharp.dll - - - ..\packages\OWML.0.7.3\lib\net35\NAudio-Unity.dll - - - ..\packages\Newtonsoft.Json.12.0.3\lib\net35\Newtonsoft.Json.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.Common.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.Logging.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Assets.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Events.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Input.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Interaction.dll - - - ..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Menus.dll - - - - - - - - - E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.dll - - - E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.AudioModule.dll - - - E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll - - - E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll - - - E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.Networking.dll - - - E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.ParticleSystemModule.dll - - - E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll - - - E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.UIModule.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Marshmallow/Utility/Logger.cs b/Marshmallow/Utility/Logger.cs deleted file mode 100644 index e04518c4..00000000 --- a/Marshmallow/Utility/Logger.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Marshmallow.Utility -{ - public class Logger - { - public static void Log(string text, LogType type) - { - Main.helper.Console.WriteLine(Enum.GetName(typeof(LogType), type) + " : " + text); - } - public enum LogType - { - Log, - Error, - Warning, - Todo - } - } -} diff --git a/Marshmallow/Utility/MVector3.cs b/Marshmallow/Utility/MVector3.cs deleted file mode 100644 index 275365b9..00000000 --- a/Marshmallow/Utility/MVector3.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; - -namespace Marshmallow.Utility -{ - public class MVector3 - { - public MVector3(float x, float y, float z) - { - X = x; - Y = y; - Z = z; - } - - public float X { get; } - public float Y { get; } - public float Z { get; } - - public Vector3 ToVector3() => new Vector3(X, Y, Z); - } -} diff --git a/Marshmallow/Utility/MarshmallowBody.cs b/Marshmallow/Utility/MarshmallowBody.cs deleted file mode 100644 index 43315c59..00000000 --- a/Marshmallow/Utility/MarshmallowBody.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Marshmallow.External; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; - -namespace Marshmallow.Utility -{ - public class MarshmallowBody - { - public MarshmallowBody(IPlanetConfig config) - { - Config = config; - } - - public IPlanetConfig Config; - - public GameObject Object; - } -} diff --git a/Marshmallow/Utility/MarshmallowExtensions.cs b/Marshmallow/Utility/MarshmallowExtensions.cs deleted file mode 100644 index bc0e2e83..00000000 --- a/Marshmallow/Utility/MarshmallowExtensions.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Newtonsoft.Json.Linq; -using System.Linq; -using UnityEngine; - -namespace Marshmallow.Utility -{ - public static class MarshmallowExtensions - { - public static Vector3 ToVector3(this JArray ja) - { - var array = (JArray)ja; - var items = array.Select(jv => (float)jv).ToArray(); - var output = new Vector3(items[0], items[1], items[2]); - - return output; - } - - public static Color32 ToColor32(this JArray ja) - { - var array = (JArray)ja; - var items = array.Select(jv => (byte)jv).ToArray(); - var output = new Color32(items[0], items[1], items[2], items[3]); - - return output; - } - } -} diff --git a/Marshmallow/packages.config b/Marshmallow/packages.config deleted file mode 100644 index 1348bb92..00000000 --- a/Marshmallow/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Marshmallow.sln b/NewHorizons.sln similarity index 55% rename from Marshmallow.sln rename to NewHorizons.sln index 46bc3ada..d8ea38c5 100644 --- a/Marshmallow.sln +++ b/NewHorizons.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 -VisualStudioVersion = 16.0.29709.97 +VisualStudioVersion = 16.0.30204.135 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Marshmallow", "Marshmallow\Marshmallow.csproj", "{6BDE7833-A385-4A73-A121-8335D5E875C0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewHorizons", "NewHorizons\NewHorizons.csproj", "{8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,15 +11,15 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6BDE7833-A385-4A73-A121-8335D5E875C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6BDE7833-A385-4A73-A121-8335D5E875C0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6BDE7833-A385-4A73-A121-8335D5E875C0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6BDE7833-A385-4A73-A121-8335D5E875C0}.Release|Any CPU.Build.0 = Release|Any CPU + {8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {9FF9AB39-5AD2-4CCA-B9B8-BF3A352FFAB1} + SolutionGuid = {3C8C943F-F2D5-4733-9CD6-9DD77B9FA9A1} EndGlobalSection EndGlobal diff --git a/Marshmallow/Atmosphere/AirBuilder.cs b/NewHorizons/Atmosphere/AirBuilder.cs similarity index 86% rename from Marshmallow/Atmosphere/AirBuilder.cs rename to NewHorizons/Atmosphere/AirBuilder.cs index 98dba048..aced6765 100644 --- a/Marshmallow/Atmosphere/AirBuilder.cs +++ b/NewHorizons/Atmosphere/AirBuilder.cs @@ -1,14 +1,14 @@ -using OWML.ModHelper.Events; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.Atmosphere +namespace NewHorizons.Atmosphere { static class AirBuilder { public static void Make(GameObject body, float airScale, bool isRaining) { - GameObject airGO = new GameObject(); + GameObject airGO = new GameObject("Air"); airGO.SetActive(false); airGO.layer = 17; airGO.transform.parent = body.transform; @@ -47,11 +47,11 @@ namespace Marshmallow.Atmosphere AS.reverbZoneMix = 1f; OWAudioSource OWAS = airGO.AddComponent(); - OWAS.SetAudioLibraryClip(AudioType.GD_RainAmbient_LP); + OWAS.SetValue("_audioLibraryClip", AudioType.GD_RainAmbient_LP); OWAS.SetClipSelectionType(OWAudioSource.ClipSelectionOnPlay.RANDOM); OWAS.SetTrack(OWAudioMixer.TrackName.Environment); - /*AudioVolume av = */airGO.AddComponent(); + airGO.AddComponent(); } airGO.SetActive(true); diff --git a/Marshmallow/Atmosphere/AtmosphereBuilder.cs b/NewHorizons/Atmosphere/AtmosphereBuilder.cs similarity index 88% rename from Marshmallow/Atmosphere/AtmosphereBuilder.cs rename to NewHorizons/Atmosphere/AtmosphereBuilder.cs index 4356c383..1b9d5519 100644 --- a/Marshmallow/Atmosphere/AtmosphereBuilder.cs +++ b/NewHorizons/Atmosphere/AtmosphereBuilder.cs @@ -1,25 +1,23 @@ -using Marshmallow.External; +using NewHorizons.External; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.Atmosphere +namespace NewHorizons.Atmosphere { static class AtmosphereBuilder { public static void Make(GameObject body, IPlanetConfig config) { - GameObject atmoGO = new GameObject(); + GameObject atmoGO = new GameObject("Atmosphere"); atmoGO.SetActive(false); - atmoGO.name = "Atmosphere"; atmoGO.transform.parent = body.transform; if (config.HasFog) { - GameObject fogGO = new GameObject(); + GameObject fogGO = new GameObject("FogSphere"); fogGO.SetActive(false); - fogGO.name = "FogSphere"; fogGO.transform.parent = atmoGO.transform; - fogGO.transform.localScale = new Vector3((config.TopCloudSize / 2) + 10, (config.TopCloudSize / 2) + 10, (config.TopCloudSize / 2) + 10); + fogGO.transform.localScale = new Vector3(config.FogSize, config.FogSize, config.FogSize); MeshFilter MF = fogGO.AddComponent(); MF.mesh = GameObject.Find("Atmosphere_GD/FogSphere").GetComponent().mesh; @@ -30,7 +28,7 @@ namespace Marshmallow.Atmosphere PlanetaryFogController PFC = fogGO.AddComponent(); PFC.fogLookupTexture = GameObject.Find("Atmosphere_GD/FogSphere").GetComponent().fogLookupTexture; - PFC.fogRadius = (config.WaterSize / 2) + 50; + PFC.fogRadius = config.FogSize; PFC.fogDensity = config.FogDensity; PFC.fogExponent = 1f; PFC.fogColorRampTexture = GameObject.Find("Atmosphere_GD/FogSphere").GetComponent().fogColorRampTexture; @@ -42,10 +40,12 @@ namespace Marshmallow.Atmosphere //Logger.Log("Re-add LOD atmosphere!", Logger.LogType.Todo); + /* GameObject atmo = GameObject.Instantiate(GameObject.Find("Atmosphere_TH/AtmoSphere")); atmo.transform.parent = atmoGO.transform; atmo.transform.localPosition = Vector3.zero; atmo.transform.localScale = new Vector3(config.TopCloudSize, config.TopCloudSize, config.TopCloudSize); + */ /* GameObject lod1 = new GameObject(); @@ -96,7 +96,7 @@ namespace Marshmallow.Atmosphere lodg.fadeMode = LODFadeMode.None; */ - atmo.SetActive(true); + //atmo.SetActive(true); atmoGO.SetActive(true); Logger.Log("Finished building atmosphere.", Logger.LogType.Log); } diff --git a/Marshmallow/Atmosphere/CloudsBuilder.cs b/NewHorizons/Atmosphere/CloudsBuilder.cs similarity index 78% rename from Marshmallow/Atmosphere/CloudsBuilder.cs rename to NewHorizons/Atmosphere/CloudsBuilder.cs index dbb735a0..ecc1c644 100644 --- a/Marshmallow/Atmosphere/CloudsBuilder.cs +++ b/NewHorizons/Atmosphere/CloudsBuilder.cs @@ -1,10 +1,10 @@ -using Marshmallow.External; -using Marshmallow.Utility; -using OWML.ModHelper.Events; +using NewHorizons.External; +using NewHorizons.Utility; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.Atmosphere +namespace NewHorizons.Atmosphere { static class CloudsBuilder { @@ -13,12 +13,13 @@ namespace Marshmallow.Atmosphere GameObject cloudsMainGO = new GameObject(); cloudsMainGO.SetActive(false); cloudsMainGO.transform.parent = body.transform; + cloudsMainGO.name = "Clouds"; GameObject cloudsTopGO = new GameObject(); cloudsTopGO.SetActive(false); cloudsTopGO.transform.parent = cloudsMainGO.transform; - cloudsTopGO.transform.localScale = new Vector3(config.TopCloudSize / 2, config.TopCloudSize / 2, config.TopCloudSize / 2); - //AddDebugShape.AddSphere(cloudsTopGO, config.TopCloudSize/2, new Color32(255, 0, 255, 128)); + cloudsTopGO.transform.localScale = new Vector3(config.TopCloudSize, config.TopCloudSize, config.TopCloudSize); + cloudsTopGO.name = "TopClouds"; MeshFilter topMF = cloudsTopGO.AddComponent(); topMF.mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent().mesh; @@ -31,21 +32,19 @@ namespace Marshmallow.Atmosphere } topMR.sharedMaterials = tempArray; + foreach (var material in topMR.sharedMaterials) { material.SetColor("_Color", config.TopCloudTint.ToColor32()); + material.SetColor("_TintColor", config.TopCloudTint.ToColor32()); + + var image = Main.helper.Assets.GetTexture("assets\\default_clouds.png"); + //var cap = Main.helper.Assets.GetTexture("assets\\ringed_jewel_cap.png"); + var ramp = Main.helper.Assets.GetTexture("assets\\default_ramp.png"); - var image = ImageUtilities.LoadImage(Main.helper.Manifest.ModFolderPath + "clouds_top.png"); - image = ImageUtilities.TintImage(image, config.TopCloudTint.ToColor32()); material.SetTexture("_MainTex", image); - - image = ImageUtilities.LoadImage(Main.helper.Manifest.ModFolderPath + "clouds_top_ramp.png"); - image = ImageUtilities.TintImage(image, config.TopCloudTint.ToColor32()); - material.SetTexture("_RampTex", image); - - image = ImageUtilities.LoadImage(Main.helper.Manifest.ModFolderPath + "clouds_cap.png"); - image = ImageUtilities.TintImage(image, config.TopCloudTint.ToColor32()); - material.SetTexture("_CapTex", image); + material.SetTexture("_RampTex", ramp); + //material.SetTexture("_CapTex", cap); } @@ -66,7 +65,8 @@ namespace Marshmallow.Atmosphere GameObject cloudsBottomGO = new GameObject(); cloudsBottomGO.SetActive(false); cloudsBottomGO.transform.parent = cloudsMainGO.transform; - cloudsBottomGO.transform.localScale = new Vector3(config.BottomCloudSize / 2, config.BottomCloudSize / 2, config.BottomCloudSize / 2); + cloudsBottomGO.transform.localScale = new Vector3(config.BottomCloudSize, config.BottomCloudSize, config.BottomCloudSize); + cloudsBottomGO.name = "BottomClouds"; TessellatedSphereRenderer bottomTSR = cloudsBottomGO.AddComponent(); bottomTSR.tessellationMeshGroup = GameObject.Find("CloudsBottomLayer_GD").GetComponent().tessellationMeshGroup; @@ -87,10 +87,11 @@ namespace Marshmallow.Atmosphere cloudsFluidGO.SetActive(false); cloudsFluidGO.layer = 17; cloudsFluidGO.transform.parent = cloudsMainGO.transform; + cloudsFluidGO.name = "CloudsFluid"; SphereCollider fluidSC = cloudsFluidGO.AddComponent(); fluidSC.isTrigger = true; - fluidSC.radius = config.TopCloudSize / 2; + fluidSC.radius = config.TopCloudSize; OWShellCollider fluidOWSC = cloudsFluidGO.AddComponent(); fluidOWSC.SetValue("_innerRadius", config.BottomCloudSize); diff --git a/NewHorizons/Atmosphere/EffectsBuilder.cs b/NewHorizons/Atmosphere/EffectsBuilder.cs new file mode 100644 index 00000000..e09c5ddb --- /dev/null +++ b/NewHorizons/Atmosphere/EffectsBuilder.cs @@ -0,0 +1,58 @@ +using OWML.Utils; +using UnityEngine; +using Logger = NewHorizons.Utility.Logger; + +namespace NewHorizons.Atmosphere +{ + static class EffectsBuilder + { + public static void Make(GameObject body, Sector sector, float groundSize, float waterSize, float atmoEnd, bool hasRain, bool hasSnow) + { + GameObject effectsGO = new GameObject("Effects"); + effectsGO.SetActive(false); + effectsGO.transform.parent = body.transform; + effectsGO.transform.localPosition = Vector3.zero; + + SectorCullGroup SCG = effectsGO.AddComponent(); + SCG.SetValue("_sector", sector); + SCG.SetValue("_particleSystemSuspendMode", CullGroup.ParticleSystemSuspendMode.Stop); + SCG.SetValue("_occlusionCulling", false); + SCG.SetValue("_dynamicCullingBounds", false); + SCG.SetValue("_waitForStreaming", false); + + if(hasRain) + { + var rainGO = GameObject.Instantiate(GameObject.Find("/GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/Effects_GD_Rain"), effectsGO.transform); + rainGO.transform.localPosition = Vector3.zero; + + var pvc = rainGO.GetComponent(); + pvc.SetValue("_densityByHeight", new AnimationCurve(new Keyframe[] { new Keyframe(Mathf.Max(groundSize, waterSize), 10f), new Keyframe(atmoEnd, 0f) })); + + rainGO.GetComponent().SetValue("_activeInSector", sector); + rainGO.GetComponent().SetValue("_exclusionSectors", new Sector[] { }); + rainGO.SetActive(true); + } + + if(hasSnow) + { + var snowGO = GameObject.Instantiate(GameObject.Find("/BrittleHollow_Body/Sector_BH/Effects_BH/Effects_BH_Snowflakes"), effectsGO.transform); + snowGO.transform.localPosition = Vector3.zero; + + var pvc = snowGO.GetComponent(); + pvc.SetValue("_densityByHeight", new AnimationCurve(new Keyframe[] { new Keyframe(Mathf.Max(groundSize, waterSize), 10f), new Keyframe(atmoEnd, 0f) })); + + var particleSystem = snowGO.GetComponent(); + var e = particleSystem.emission; + e.rateOverTime = 50; + + snowGO.GetComponent().SetValue("_activeInSector", sector); + snowGO.GetComponent().SetValue("_exclusionSectors", new Sector[] { }); + snowGO.SetActive(true); + } + + effectsGO.SetActive(true); + + Logger.Log("Finished building effects", Logger.LogType.Log); + } + } +} diff --git a/Marshmallow/Atmosphere/SunOverrideBuilder.cs b/NewHorizons/Atmosphere/SunOverrideBuilder.cs similarity index 78% rename from Marshmallow/Atmosphere/SunOverrideBuilder.cs rename to NewHorizons/Atmosphere/SunOverrideBuilder.cs index d5a94fbc..150affca 100644 --- a/Marshmallow/Atmosphere/SunOverrideBuilder.cs +++ b/NewHorizons/Atmosphere/SunOverrideBuilder.cs @@ -1,23 +1,23 @@ -using Marshmallow.External; -using OWML.ModHelper.Events; +using NewHorizons.External; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.Atmosphere +namespace NewHorizons.Atmosphere { static class SunOverrideBuilder { public static void Make(GameObject body, Sector sector, IPlanetConfig config) { - GameObject overrideGO = new GameObject(); + GameObject overrideGO = new GameObject("SunOverride"); overrideGO.SetActive(false); overrideGO.transform.parent = body.transform; GiantsDeepSunOverrideVolume GDSOV = overrideGO.AddComponent(); GDSOV.SetValue("_sector", sector); - GDSOV.SetValue("_cloudsOuterRadius", config.TopCloudSize / 2); - GDSOV.SetValue("_cloudsInnerRadius", config.BottomCloudSize / 2); - GDSOV.SetValue("_waterOuterRadius", config.WaterSize / 2); + GDSOV.SetValue("_cloudsOuterRadius", config.TopCloudSize); + GDSOV.SetValue("_cloudsInnerRadius", config.BottomCloudSize); + GDSOV.SetValue("_waterOuterRadius", config.WaterSize); GDSOV.SetValue("_waterInnerRadius", 402.5f); overrideGO.SetActive(true); diff --git a/Marshmallow/Atmosphere/VolumesBuilder.cs b/NewHorizons/Atmosphere/VolumesBuilder.cs similarity index 83% rename from Marshmallow/Atmosphere/VolumesBuilder.cs rename to NewHorizons/Atmosphere/VolumesBuilder.cs index f02a37b1..6934707b 100644 --- a/Marshmallow/Atmosphere/VolumesBuilder.cs +++ b/NewHorizons/Atmosphere/VolumesBuilder.cs @@ -1,15 +1,15 @@ -using Marshmallow.External; -using OWML.ModHelper.Events; +using NewHorizons.External; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.Atmosphere +namespace NewHorizons.Atmosphere { static class VolumesBuilder { public static void Make(GameObject body, IPlanetConfig config) { - GameObject volumesGO = new GameObject(); + GameObject volumesGO = new GameObject("Volumes"); volumesGO.SetActive(false); volumesGO.transform.parent = body.transform; @@ -24,7 +24,8 @@ namespace Marshmallow.Atmosphere SS.pointChecksOnly = true; SS.radius = config.TopCloudSize; - /*OWTriggerVolume trigvol = */rulesetGO.AddComponent(); + /*OWTriggerVolume trigvol = */ + rulesetGO.AddComponent(); PlanetoidRuleset PR = rulesetGO.AddComponent(); PR.SetValue("_altitudeFloor", config.GroundSize); diff --git a/Marshmallow/Body/GeometryBuilder.cs b/NewHorizons/Body/GeometryBuilder.cs similarity index 93% rename from Marshmallow/Body/GeometryBuilder.cs rename to NewHorizons/Body/GeometryBuilder.cs index c87e7ee3..3ceaaff4 100644 --- a/Marshmallow/Body/GeometryBuilder.cs +++ b/NewHorizons/Body/GeometryBuilder.cs @@ -1,7 +1,7 @@ using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.Body +namespace NewHorizons.Body { static class GeometryBuilder { @@ -9,7 +9,7 @@ namespace Marshmallow.Body { GameObject groundGO = GameObject.CreatePrimitive(PrimitiveType.Sphere); groundGO.transform.parent = body.transform; - groundGO.transform.localScale = new Vector3(groundScale / 2, groundScale / 2, groundScale / 2); + groundGO.transform.localScale = new Vector3(groundScale, groundScale, groundScale); groundGO.GetComponent().mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent().mesh; groundGO.GetComponent().radius = 1f; groundGO.SetActive(true); @@ -29,7 +29,7 @@ namespace Marshmallow.Body Debug.LogError("6"); sphere.transform.parent = body.transform; Debug.LogError("7"); - sphere.transform.localScale = new Vector3(groundScale / 2, groundScale / 2, groundScale / 2); + sphere.transform.localScale = new Vector3(groundScale, groundScale, groundScale); Debug.LogError("8"); sphere.SetActive(true); Debug.LogError("9"); diff --git a/Marshmallow/Body/WaterBuilder.cs b/NewHorizons/Body/WaterBuilder.cs similarity index 92% rename from Marshmallow/Body/WaterBuilder.cs rename to NewHorizons/Body/WaterBuilder.cs index c0271077..92acbb21 100644 --- a/Marshmallow/Body/WaterBuilder.cs +++ b/NewHorizons/Body/WaterBuilder.cs @@ -1,19 +1,19 @@ -using Marshmallow.External; -using OWML.ModHelper.Events; +using NewHorizons.External; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.Body +namespace NewHorizons.Body { static class WaterBuilder { public static void Make(GameObject body, Sector sector, IPlanetConfig config) { - GameObject waterGO = new GameObject(); + GameObject waterGO = new GameObject("Water"); waterGO.SetActive(false); waterGO.layer = 15; waterGO.transform.parent = body.transform; - waterGO.transform.localScale = new Vector3(config.WaterSize / 2, config.WaterSize / 2, config.WaterSize / 2); + waterGO.transform.localScale = new Vector3(config.WaterSize, config.WaterSize, config.WaterSize); waterGO.DestroyAllComponents(); TessellatedSphereRenderer TSR = waterGO.AddComponent(); diff --git a/Marshmallow/External/IPlanetConfig.cs b/NewHorizons/External/IPlanetConfig.cs similarity index 54% rename from Marshmallow/External/IPlanetConfig.cs rename to NewHorizons/External/IPlanetConfig.cs index 62f007f8..f7397f0e 100644 --- a/Marshmallow/External/IPlanetConfig.cs +++ b/NewHorizons/External/IPlanetConfig.cs @@ -1,17 +1,12 @@ -using Marshmallow.Utility; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; +using NewHorizons.Utility; -namespace Marshmallow.External +namespace NewHorizons.External { public interface IPlanetConfig { string Name { get; } - MVector3 Position { get; } - int OrbitAngle { get; } + int SemiMajorAxis { get; } + int Inclination { get; } string PrimaryBody { get; } bool IsMoon { get; } float AtmoEndSize { get; } @@ -29,9 +24,24 @@ namespace Marshmallow.External bool HasFog { get; } MColor32 FogTint { get; } float FogDensity { get; } + float FogSize { get; } bool HasGround { get; } float GroundSize { get; } bool IsTidallyLocked { get; } MColor32 LightTint { get; } + bool HasSnow { get; } + float LongitudeOfAscendingNode { get; } + float Eccentricity { get; } + float ArgumentOfPeriapsis { get; } + bool HasRings { get; } + float RingInnerRadius { get; } + float RingOuterRadius { get; } + float RingInclination { get; } + float RingLongitudeOfAscendingNode { get; } + string RingTexture { get; } + bool HasBlackHole { get; } + bool HasLava { get; } + float LavaSize { get; } + bool Destroy { get; } } } diff --git a/NewHorizons/External/PlanetConfig.cs b/NewHorizons/External/PlanetConfig.cs new file mode 100644 index 00000000..d87ff5eb --- /dev/null +++ b/NewHorizons/External/PlanetConfig.cs @@ -0,0 +1,63 @@ +using NewHorizons.Utility; +using System; +using System.Collections.Generic; + +namespace NewHorizons.External +{ + public class PlanetConfig : IPlanetConfig + { + public string Name { get; set; } + public int SemiMajorAxis { get; set; } + public int Inclination { get; set; } + public string PrimaryBody { get; set; } + public bool IsMoon { get; set; } + public float AtmoEndSize { get; set; } + public bool HasClouds { get; set; } + public float TopCloudSize { get; set; } + public float BottomCloudSize { get; set; } + public MColor32 TopCloudTint { get; set; } + public MColor32 BottomCloudTint { get; set; } + public bool HasWater { get; set; } + public float WaterSize { get; set; } + public bool HasRain { get; set; } + public bool HasGravity { get; set; } + public float SurfaceAcceleration { get; set; } + public bool HasMapMarker { get; set; } + public bool HasFog { get; set; } + public MColor32 FogTint { get; set; } + public float FogDensity { get; set; } + public float FogSize { get; set; } + public bool HasGround { get; set; } + public float GroundSize { get; set; } + public bool IsTidallyLocked { get; set; } + public MColor32 LightTint { get; set; } + public bool HasSnow { get; set; } + public float LongitudeOfAscendingNode { get; set; } + public float Eccentricity { get; set; } + public float ArgumentOfPeriapsis { get; set; } + public bool HasRings { get; set; } + public float RingInnerRadius { get; set; } + public float RingOuterRadius { get; set; } + public float RingInclination { get; set; } + public float RingLongitudeOfAscendingNode { get; set; } + public string RingTexture { get; set; } + public bool HasBlackHole { get; set; } + public bool HasLava { get; set; } + public float LavaSize { get; set; } + public bool Destroy { get; set; } + + public PlanetConfig(Dictionary dict) + { + if (dict == null) + { + return; + } + foreach (var item in dict) + { + Logger.Log($"{item.Key} : {item.Value}", Logger.LogType.Log); + var field = GetType().GetField(item.Key, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); + field.SetValue(this, Convert.ChangeType(item.Value, field.FieldType)); + } + } + } +} diff --git a/Marshmallow/General/AmbientLightBuilder.cs b/NewHorizons/General/AmbientLightBuilder.cs similarity index 65% rename from Marshmallow/General/AmbientLightBuilder.cs rename to NewHorizons/General/AmbientLightBuilder.cs index e87b4ba4..bd9b1c35 100644 --- a/Marshmallow/General/AmbientLightBuilder.cs +++ b/NewHorizons/General/AmbientLightBuilder.cs @@ -1,24 +1,25 @@ -using Marshmallow.External; +using NewHorizons.External; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.General +namespace NewHorizons.General { static class AmbientLightBuilder { public static void Make(GameObject body, Sector sector, IPlanetConfig config) { - GameObject lightGO = new GameObject(); + GameObject lightGO = new GameObject("Lights"); lightGO.SetActive(false); lightGO.transform.parent = body.transform; - + Light L = lightGO.AddComponent(); L.type = LightType.Point; L.range = config.AtmoEndSize + 10; - L.color = config.LightTint.ToColor32(); + L.color = (config.LightTint != null) ? config.LightTint.ToColor32() : (Color32)Color.black; L.intensity = 0.8f; L.shadows = LightShadows.None; - L.cookie = GameObject.Find("AmbientLight_GD").GetComponent().cookie; + + L.cookie = GameObject.Find("/GiantsDeep_Body/AmbientLight_GD").GetComponent().cookie; SectorLightsCullGroup SLCG = lightGO.AddComponent(); SLCG.SetSector(sector); diff --git a/Marshmallow/General/BaseBuilder.cs b/NewHorizons/General/BaseBuilder.cs similarity index 85% rename from Marshmallow/General/BaseBuilder.cs rename to NewHorizons/General/BaseBuilder.cs index 3f36f8d7..5eaf0570 100644 --- a/Marshmallow/General/BaseBuilder.cs +++ b/NewHorizons/General/BaseBuilder.cs @@ -1,10 +1,10 @@ -using Marshmallow.External; -using Marshmallow.Utility; -using OWML.ModHelper.Events; +using NewHorizons.External; +using NewHorizons.Utility; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.General +namespace NewHorizons.General { static class BaseBuilder { @@ -28,7 +28,7 @@ namespace Marshmallow.General InitialMotion IM = body.AddComponent(); IM.SetPrimaryBody(primaryBody.GetAttachedOWRigidbody()); - IM.SetValue("_orbitAngle", config.OrbitAngle); + IM.SetValue("_orbitAngle", config.Inclination); IM.SetValue("_isGlobalAxis", false); IM.SetValue("_initAngularSpeed", 0.02f); IM.SetValue("_initLinearSpeed", 0f); @@ -37,7 +37,8 @@ namespace Marshmallow.General AstroObject AO = body.AddComponent(); AO.SetValue("_type", AstroObject.Type.Planet); - AO.SetValue("_name", AstroObject.Name.None); + AO.SetValue("_name", AstroObject.Name.CustomString); + AO.SetValue("_customName", config.Name); AO.SetValue("_primaryBody", primaryBody); if (config.HasGravity) { diff --git a/NewHorizons/General/BlackHoleBuilder.cs b/NewHorizons/General/BlackHoleBuilder.cs new file mode 100644 index 00000000..e9089a2d --- /dev/null +++ b/NewHorizons/General/BlackHoleBuilder.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace NewHorizons.General +{ + static class BlackHoleBuilder + { + public static void Make(GameObject body) + { + var blackHole = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/BlackHole_BH"), body.transform); + blackHole.transform.localPosition = Vector3.zero; + } + } +} diff --git a/Marshmallow/General/DetectorBuilder.cs b/NewHorizons/General/DetectorBuilder.cs similarity index 76% rename from Marshmallow/General/DetectorBuilder.cs rename to NewHorizons/General/DetectorBuilder.cs index b04a1f01..0b0bd7a8 100644 --- a/Marshmallow/General/DetectorBuilder.cs +++ b/NewHorizons/General/DetectorBuilder.cs @@ -1,17 +1,15 @@ -using Marshmallow.External; -using OWML.ModHelper.Events; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.General +namespace NewHorizons.General { static class DetectorBuilder { public static void Make(GameObject body, AstroObject primaryBody) { - GameObject detectorGO = new GameObject(); + GameObject detectorGO = new GameObject("FieldDetector"); detectorGO.SetActive(false); - detectorGO.name = "FieldDetector"; detectorGO.transform.parent = body.transform; detectorGO.layer = 20; diff --git a/Marshmallow/General/GravityBuilder.cs b/NewHorizons/General/GravityBuilder.cs similarity index 89% rename from Marshmallow/General/GravityBuilder.cs rename to NewHorizons/General/GravityBuilder.cs index 9ab7ab1f..5cc2a922 100644 --- a/Marshmallow/General/GravityBuilder.cs +++ b/NewHorizons/General/GravityBuilder.cs @@ -1,17 +1,16 @@ -using OWML.ModHelper.Events; +using OWML.Utils; using System.Reflection; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.General +namespace NewHorizons.General { static class GravityBuilder { public static GravityVolume Make(GameObject body, float surfaceAccel, float upperSurface, float lowerSurface) { - GameObject gravityGO = new GameObject(); + GameObject gravityGO = new GameObject("GravityWell"); gravityGO.transform.parent = body.transform; - gravityGO.name = "GravityWell"; gravityGO.layer = 17; gravityGO.SetActive(false); diff --git a/NewHorizons/General/LavaBuilder.cs b/NewHorizons/General/LavaBuilder.cs new file mode 100644 index 00000000..059859b6 --- /dev/null +++ b/NewHorizons/General/LavaBuilder.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace NewHorizons.General +{ + static class LavaBuilder + { + public static void Make(GameObject body, float lavaSize) + { + var lava = GameObject.Instantiate(GameObject.Find("VolcanicMoon_Body/MoltenCore_VM"), body.transform); + lava.transform.localPosition = Vector3.zero; + lava.transform.Find("LavaSphere").transform.localScale = Vector3.one * lavaSize; + lava.transform.Find("MoltenCore_Proxy/LavaSphere (1)").transform.localScale = Vector3.one * lavaSize; + // Destruction volume is broken + lava.transform.Find("DestructionVolume").GetComponent().radius = lavaSize; + } + } +} diff --git a/Marshmallow/General/MarkerBuilder.cs b/NewHorizons/General/MarkerBuilder.cs similarity index 83% rename from Marshmallow/General/MarkerBuilder.cs rename to NewHorizons/General/MarkerBuilder.cs index 435b8976..094667d9 100644 --- a/Marshmallow/General/MarkerBuilder.cs +++ b/NewHorizons/General/MarkerBuilder.cs @@ -1,17 +1,17 @@ -using Marshmallow.External; -using OWML.ModHelper.Events; +using NewHorizons.External; +using OWML.Utils; using System.Reflection; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.General +namespace NewHorizons.General { static class MarkerBuilder { public static void Make(GameObject body, IPlanetConfig config) { MapMarker MM = body.AddComponent(); - MM.SetValue("_labelID", (UITextType)Utility.AddToUITable.Add(config.Name)); + MM.SetValue("_labelID", (UITextType)Utility.AddToUITable.Add(config.Name.ToUpper())); if (config.IsMoon) { diff --git a/Marshmallow/General/OrbitlineBuilder.cs b/NewHorizons/General/OrbitlineBuilder.cs similarity index 52% rename from Marshmallow/General/OrbitlineBuilder.cs rename to NewHorizons/General/OrbitlineBuilder.cs index 900858a6..47b63716 100644 --- a/Marshmallow/General/OrbitlineBuilder.cs +++ b/NewHorizons/General/OrbitlineBuilder.cs @@ -1,23 +1,21 @@ -using Marshmallow.Utility; -using OWML.ModHelper.Events; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.General +namespace NewHorizons.General { static class OrbitlineBuilder { - public static void Make(GameObject body, AstroObject astroobject) + public static void Make(GameObject body, AstroObject astroobject, bool isMoon) { - GameObject orbit = new GameObject(); + GameObject orbit = new GameObject("Orbit"); orbit.transform.parent = body.transform; var LR = orbit.AddComponent(); - //LR.material = GameObject.Find("OrbitLine_TH").GetComponent().material; + + var thLR = GameObject.Find("OrbitLine_TH").GetComponent(); + + LR.material = thLR.material; LR.useWorldSpace = false; LR.loop = false; @@ -25,8 +23,9 @@ namespace Marshmallow.General var ol = orbit.AddComponent(); ol.SetValue("_astroObject", astroobject); - ol.SetValue("_fade", false); - ol.SetValue("_lineWidth", 5); + ol.SetValue("_fade", isMoon); + ol.SetValue("_lineWidth", 0.5f); + typeof(OrbitLine).GetMethod("InitializeLineRenderer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(ol, new object[] { }); Logger.Log("Finished building orbit line", Logger.LogType.Log); } diff --git a/Marshmallow/General/RFVolumeBuilder.cs b/NewHorizons/General/RFVolumeBuilder.cs similarity index 77% rename from Marshmallow/General/RFVolumeBuilder.cs rename to NewHorizons/General/RFVolumeBuilder.cs index 29f007c9..659f334b 100644 --- a/Marshmallow/General/RFVolumeBuilder.cs +++ b/NewHorizons/General/RFVolumeBuilder.cs @@ -1,13 +1,13 @@ -using Marshmallow.External; -using OWML.ModHelper.Events; +using NewHorizons.External; +using OWML.Utils; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.General +namespace NewHorizons.General { static class RFVolumeBuilder { - public static void Make(GameObject body, OWRigidbody rigidbody, IPlanetConfig config) + public static void Make(GameObject body, OWRigidbody rigidbody, float atmoEndSize) { GameObject rfGO = new GameObject("RFVolume"); rfGO.transform.parent = body.transform; @@ -16,15 +16,15 @@ namespace Marshmallow.General SphereCollider SC = rfGO.AddComponent(); SC.isTrigger = true; - SC.radius = config.AtmoEndSize * 2; + SC.radius = atmoEndSize * 2; ReferenceFrameVolume RFV = rfGO.AddComponent(); ReferenceFrame RV = new ReferenceFrame(rigidbody); RV.SetValue("_minSuitTargetDistance", 300); RV.SetValue("_maxTargetDistance", 0); - RV.SetValue("_autopilotArrivalDistance", 1000); - RV.SetValue("_autoAlignmentDistance", 1000); + RV.SetValue("_autopilotArrivalDistance", atmoEndSize * 2f); + RV.SetValue("_autoAlignmentDistance", atmoEndSize * 1.5f); //Utility.AddDebugShape.AddSphere(rfGO, 1000, new Color32(0, 255, 0, 128)); RV.SetValue("_hideLandingModePrompt", false); RV.SetValue("_matchAngularVelocity", true); @@ -34,7 +34,7 @@ namespace Marshmallow.General RFV.SetValue("_referenceFrame", RV); RFV.SetValue("_minColliderRadius", 300); - RFV.SetValue("_maxColliderRadius", config.AtmoEndSize * 2); + RFV.SetValue("_maxColliderRadius", atmoEndSize * 2f); RFV.SetValue("_isPrimaryVolume", true); RFV.SetValue("_isCloseRangeVolume", false); diff --git a/NewHorizons/General/RingBuilder.cs b/NewHorizons/General/RingBuilder.cs new file mode 100644 index 00000000..dd134554 --- /dev/null +++ b/NewHorizons/General/RingBuilder.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Logger = NewHorizons.Utility.Logger; + +namespace NewHorizons.General +{ + static class RingBuilder + { + public static void Make(GameObject body, float innerRingSize, float outerRingSize, float ringInclination, float ringLongitudeOfAscendingNode, string ringTexture) + { + var ringGO = new GameObject("Ring"); + ringGO.transform.parent = body.transform; + ringGO.transform.localPosition = Vector3.zero; + ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.up), ringLongitudeOfAscendingNode); + ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.right), ringInclination); + + var ringMF = ringGO.AddComponent(); + var ringMesh = ringMF.mesh; + var ringMR = ringGO.AddComponent(); + var texture = Main.helper.Assets.GetTexture(ringTexture ?? "assets/default_rings.png"); + + var mat = new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply")); + mat.mainTexture = texture; + mat.renderQueue = 0; + ringMR.material = mat; + + // Make mesh + var segments = (int)Math.Max(20, outerRingSize); + BuildRingMesh(ringMesh, segments, innerRingSize, outerRingSize); + + Logger.Log("Finished building rings", Logger.LogType.Log); + } + + // Thank you https://github.com/boardtobits/planet-ring-mesh/blob/master/PlanetRing.cs + public static void BuildRingMesh(Mesh ringMesh, int segments, float innerRadius, float outerRadius) + { + Vector3[] vertices = new Vector3[(segments + 1) * 2 * 2]; + int[] triangles = new int[segments * 6 * 2]; + Vector2[] uv = new Vector2[(segments + 1) * 2 * 2]; + int halfway = (segments + 1) * 2; + + for (int i = 0; i < segments + 1; i++) + { + float progress = (float)i / (float)segments; + float angle = progress * 2 * Mathf.PI; + float x = Mathf.Sin(angle); + float z = Mathf.Cos(angle); + + vertices[i * 2] = vertices[i * 2 + halfway] = new Vector3(x, 0f, z) * outerRadius; + vertices[i * 2 + 1] = vertices[i * 2 + 1 + halfway] = new Vector3(x, 0f, z) * innerRadius; + uv[i * 2] = uv[i * 2 + halfway] = new Vector2(progress, 0f); + uv[i * 2 + 1] = uv[i * 2 + 1 + halfway] = new Vector2(progress, 1f); + + if (i != segments) + { + triangles[i * 12] = i * 2; + triangles[i * 12 + 1] = triangles[i * 12 + 4] = (i + 1) * 2; + triangles[i * 12 + 2] = triangles[i * 12 + 3] = i * 2 + 1; + triangles[i * 12 + 5] = (i + 1) * 2 + 1; + + triangles[i * 12 + 6] = i * 2 + halfway; + triangles[i * 12 + 7] = triangles[i * 12 + 10] = i * 2 + 1 + halfway; + triangles[i * 12 + 8] = triangles[i * 12 + 9] = (i + 1) * 2 + halfway; + triangles[i * 12 + 11] = (i + 1) * 2 + 1 + halfway; + } + + } + + ringMesh.vertices = vertices; + ringMesh.triangles = triangles; + ringMesh.uv = uv; + ringMesh.RecalculateNormals(); + } + } +} diff --git a/Marshmallow/General/SectorBuilder.cs b/NewHorizons/General/SectorBuilder.cs similarity index 79% rename from Marshmallow/General/SectorBuilder.cs rename to NewHorizons/General/SectorBuilder.cs index 4128817d..224d66ab 100644 --- a/Marshmallow/General/SectorBuilder.cs +++ b/NewHorizons/General/SectorBuilder.cs @@ -1,16 +1,16 @@ -using Marshmallow.External; -using OWML.ModHelper.Events; +using NewHorizons.External; +using OWML.Utils; using System.Collections.Generic; using UnityEngine; -using Logger = Marshmallow.Utility.Logger; +using Logger = NewHorizons.Utility.Logger; -namespace Marshmallow.Body +namespace NewHorizons.Body { static class MakeSector { public static Sector Make(GameObject body, OWRigidbody rigidbody, IPlanetConfig config) { - GameObject sectorGO = new GameObject(); + GameObject sectorGO = new GameObject("Sector"); sectorGO.SetActive(false); sectorGO.transform.parent = body.transform; @@ -22,7 +22,7 @@ namespace Marshmallow.Body SS.radius = config.AtmoEndSize + 10; SS.center = Vector3.zero; - /*OWTriggerVolume trigVol = */sectorGO.AddComponent(); + sectorGO.AddComponent(); Sector S = sectorGO.AddComponent(); S.SetValue("_name", Sector.Name.Unnamed); diff --git a/Marshmallow/General/SpawnpointBuilder.cs b/NewHorizons/General/SpawnpointBuilder.cs similarity index 83% rename from Marshmallow/General/SpawnpointBuilder.cs rename to NewHorizons/General/SpawnpointBuilder.cs index 07239a4d..27385f72 100644 --- a/Marshmallow/General/SpawnpointBuilder.cs +++ b/NewHorizons/General/SpawnpointBuilder.cs @@ -1,12 +1,12 @@ using UnityEngine; -namespace Marshmallow.General +namespace NewHorizons.General { static class SpawnpointBuilder { public static SpawnPoint Make(GameObject body, Vector3 position) { - GameObject spawnGO = new GameObject(); + GameObject spawnGO = new GameObject("SpawnPoint"); spawnGO.transform.parent = body.transform; spawnGO.layer = 8; diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs new file mode 100644 index 00000000..a61273bb --- /dev/null +++ b/NewHorizons/Main.cs @@ -0,0 +1,271 @@ +using NewHorizons.Atmosphere; +using NewHorizons.Body; +using NewHorizons.External; +using NewHorizons.General; +using NewHorizons.Utility; +using OWML.Common; +using OWML.ModHelper; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using UnityEngine; +using UnityEngine.SceneManagement; +using Logger = NewHorizons.Utility.Logger; + +namespace NewHorizons +{ + public class Main : ModBehaviour + { + public static IModHelper helper; + + public static List BodyList = new List(); + + public static List AstroObjects = new List(); + + public override object GetApi() + { + return new NewHorizonsApi(); + } + + void Start() + { + SceneManager.sceneLoaded += OnSceneLoaded; + helper = base.ModHelper; + + Utility.Patches.Apply(); + + Logger.Log("Begin load of config files...", Logger.LogType.Log); + + foreach (var file in Directory.GetFiles(ModHelper.Manifest.ModFolderPath + @"planets\")) + { + try + { + var config = ModHelper.Storage.Load(file.Replace(ModHelper.Manifest.ModFolderPath, "")); + Logger.Log($"Loaded {config.Name}"); + BodyList.Add(new NewHorizonsBody(config)); + } + catch(Exception e) + { + Logger.LogError($"Couldn't load {file}: {e.Message}, {e.StackTrace}"); + } + } + + if (BodyList.Count != 0) + { + Logger.Log("Loaded [" + BodyList.Count + "] config files.", Logger.LogType.Log); + } + else + { + Logger.Log("No config files found!", Logger.LogType.Warning); + } + } + + void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + if (scene.name != "SolarSystem") + { + return; + } + + foreach (var ao in GameObject.FindObjectsOfType()) + { + AstroObjects.Add(ao); + } + + foreach (var body in BodyList) + { + var astroObjectName = AstroObject.StringIDToAstroObjectName(body.Config.Name.ToUpper().Replace(" ", "_")); + var existingPlanet = astroObjectName != AstroObject.Name.None; + + GameObject planetObject; + + if (existingPlanet) + { + var astroObject = Locator.GetAstroObject(astroObjectName); + planetObject = UpdateBody(body, astroObject); + } + else + { + try + { + planetObject = GenerateBody(body); + var primaryBody = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(body.Config.PrimaryBody)); + + planetObject.transform.parent = Locator.GetRootTransform(); + var a = body.Config.SemiMajorAxis; + var omega = Mathf.Deg2Rad * body.Config.LongitudeOfAscendingNode; + planetObject.transform.position = primaryBody.gameObject.transform.position + new Vector3(a * Mathf.Sin(omega), 0, a * Mathf.Cos(omega)); + planetObject.SetActive(true); + } + catch(Exception e) + { + Logger.LogError($"Couldn't generate body {body.Config?.Name}: {e.Message}, {e.StackTrace}"); + } + } + } + } + + public static GameObject UpdateBody(NewHorizonsBody body, AstroObject ao) + { + Logger.Log($"Updating existing AstroObject {ao}"); + + var go = ao.gameObject; + + if (body.Config.Destroy) + { + RemoveBody(ao); + return null; + } + + var mainSector = go.GetComponentInChildren(); + + if (body.Config.HasRings) + { + RingBuilder.Make(go, body.Config.RingInnerRadius, body.Config.RingOuterRadius, body.Config.RingInclination, body.Config.RingLongitudeOfAscendingNode, body.Config.RingTexture); + } + if (body.Config.HasLava) + { + LavaBuilder.Make(go, body.Config.LavaSize); + } + if (body.Config.HasWater) + { + WaterBuilder.Make(go, mainSector, body.Config); + } + if(body.Config.HasRain || body.Config.HasSnow) + { + EffectsBuilder.Make(go, mainSector, body.Config.WaterSize, body.Config.GroundSize, body.Config.AtmoEndSize / 2f, body.Config.HasRain, body.Config.HasSnow); + } + + return go; + } + + private static void RemoveBody(AstroObject ao) + { + Logger.Log($"Removing {ao.name}"); + + if (ao.GetAstroObjectName() == AstroObject.Name.BrittleHollow) + RemoveBody(Locator.GetAstroObject(AstroObject.Name.WhiteHole)); + + // Check if any other objects depend on it and remove them too + for(int i = 0; i < AstroObjects.Count; i++) + { + var obj = AstroObjects[i]; + if(ao.Equals(obj.GetPrimaryBody())) + { + AstroObjects.Remove(obj); + RemoveBody(obj); + i--; + } + } + Destroy(ao.gameObject); + } + + public static GameObject GenerateBody(NewHorizonsBody body) + { + Logger.Log("Begin generation sequence of [" + body.Config.Name + "] ...", Logger.LogType.Log); + + var go = new GameObject(body.Config.Name); + go.SetActive(false); + + if(body.Config.HasGround) GeometryBuilder.Make(go, body.Config.GroundSize); + + AstroObject primaryBody = Locator.GetAstroObject(AstroObject.Name.Sun); + try + { + primaryBody = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(body.Config.PrimaryBody)); + } + catch(Exception) + { + Logger.LogError($"Could not find AstroObject {body.Config.PrimaryBody}, defaulting to SUN"); + } + + var outputTuple = BaseBuilder.Make(go, primaryBody, body.Config); + + var owRigidbody = (OWRigidbody)outputTuple.Items[1]; + RFVolumeBuilder.Make(go, owRigidbody, body.Config.AtmoEndSize); + + if (body.Config.HasMapMarker) + { + MarkerBuilder.Make(go, body.Config); + } + + var sector = MakeSector.Make(go, owRigidbody, body.Config); + + if (body.Config.HasClouds) + { + CloudsBuilder.Make(go, sector, body.Config); + SunOverrideBuilder.Make(go, sector, body.Config); + } + + AirBuilder.Make(go, body.Config.TopCloudSize, body.Config.HasRain); + + if (body.Config.HasWater) + { + WaterBuilder.Make(go, sector, body.Config); + } + + EffectsBuilder.Make(go, sector, body.Config.WaterSize, body.Config.GroundSize, body.Config.AtmoEndSize/2f, body.Config.HasRain, body.Config.HasSnow); + VolumesBuilder.Make(go, body.Config); + AmbientLightBuilder.Make(go, sector, body.Config); + AtmosphereBuilder.Make(go, body.Config); + if (body.Config.HasRings) + RingBuilder.Make(go, body.Config.RingInnerRadius, body.Config.RingOuterRadius, body.Config.RingInclination, body.Config.RingLongitudeOfAscendingNode, body.Config.RingTexture); + if (body.Config.HasBlackHole) + BlackHoleBuilder.Make(go); + if (body.Config.HasLava) + LavaBuilder.Make(go, body.Config.LavaSize); + + Logger.Log("Generation of [" + body.Config.Name + "] completed.", Logger.LogType.Log); + + body.Object = go; + + helper.Events.Unity.FireOnNextUpdate(() => OrbitlineBuilder.Make(body.Object, body.Object.GetComponent(), body.Config.IsMoon)); + + return go; + } + + public static void CreateBody(NewHorizonsBody body) + { + Logger.Log($"Running CreateBody for {body.Config.Name}"); + + var planet = GenerateBody(body); + + /* + planet.transform.parent = Locator.GetRootTransform(); + planet.transform.position = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(body.Config.PrimaryBody)).gameObject.transform.position + body.Config.Position; + planet.SetActive(true); + + planet.GetComponent().SetVelocity(Locator.GetCenterOfTheUniverse().GetOffsetVelocity()); + + var primary = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(body.Config.PrimaryBody)).GetAttachedOWRigidbody(); + var initialMotion = primary.GetComponent(); + if (initialMotion != null) + { + planet.GetComponent().AddVelocityChange(-initialMotion.GetInitVelocity()); + planet.GetComponent().AddVelocityChange(primary.GetVelocity()); + } + */ + } + } + + public class NewHorizonsApi + { + public void Create(Dictionary config) + { + Logger.Log("Recieved API request to create planet " + (string)config["Name"] + " at position " + (Vector3)config["Position"], Logger.LogType.Log); + var planetConfig = new PlanetConfig(config); + + var body = new NewHorizonsBody(planetConfig); + + Main.BodyList.Add(body); + + Main.helper.Events.Unity.RunWhen(() => Locator.GetCenterOfTheUniverse() != null, () => Main.CreateBody(body)); + } + + public GameObject GetPlanet(string name) + { + return Main.BodyList.FirstOrDefault(x => x.Config.Name == name).Object; + } + } +} diff --git a/NewHorizons/NewHorizons.csproj b/NewHorizons/NewHorizons.csproj new file mode 100644 index 00000000..9e484ffb --- /dev/null +++ b/NewHorizons/NewHorizons.csproj @@ -0,0 +1,290 @@ + + + + + Debug + AnyCPU + {8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF} + Library + Properties + NewHorizons + NewHorizons + v4.8 + 512 + true + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + ..\packages\Lib.Harmony.2.1.1\lib\net48\0Harmony.dll + + + $(GameDir)\OuterWilds_Data\Managed\Assembly-CSharp.dll + + + $(GameDir)\OuterWilds_Data\Managed\Assembly-CSharp-firstpass.dll + + + $(GameDir)\OuterWilds_Data\Managed\Mono.Security.dll + + + ..\packages\OWML.2.1.0\lib\net40\NAudio-Unity.dll + + + ..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.Common.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.Logging.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Assets.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Events.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Input.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Interaction.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Menus.dll + + + ..\packages\OWML.2.1.0\lib\net40\OWML.Utils.dll + + + + + + + + + False + ..\..\..\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\Unity.InputSystem.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.AccessibilityModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.AIModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.AnimationModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.ARModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.AssetBundleModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.AudioModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.ClothModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.ClusterInputModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.ClusterRendererModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.CrashReportingModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.DirectorModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.GameCenterModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.GridModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.ImageConversionModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.InputModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.JSONSerializeModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.ParticleSystemModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.PerformanceReportingModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.Physics2DModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.ScreenCaptureModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.SharedInternalsModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.SpatialTracking.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.SpriteMaskModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.SpriteShapeModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.TerrainModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.TerrainPhysicsModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.TextRenderingModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.TilemapModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UI.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UIElementsModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UIModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UNETModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityAnalyticsModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityConnectModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityWebRequestModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityWebRequestTextureModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.VehiclesModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.VideoModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.VRModule.dll + + + $(GameDir)\OuterWilds_Data\Managed\UnityEngine.WindModule.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rmdir /s /q "$(OwmlDir)\Mods\$(ModUniqueName)" + md "$(OwmlDir)\Mods\$(ModUniqueName)" + md "$(OwmlDir)\Mods\$(ModUniqueName)\planets" + md "$(OwmlDir)\Mods\$(ModUniqueName)\planets\assets" + md "$(OwmlDir)\Mods\$(ModUniqueName)\assets" + + copy /y "$(TargetPath)" "$(OwmlDir)\Mods\$(ModUniqueName)" + copy /y "$(ProjectDir)\default-config.json" "$(OwmlDir)\Mods\$(ModUniqueName)" + copy /y "$(ProjectDir)\manifest.json" "$(OwmlDir)\Mods\$(ModUniqueName)" + copy /y "$(ProjectDir)planets\" "$(OwmlDir)\Mods\$(ModUniqueName)\planets" + copy /y "$(ProjectDir)planets\assets" "$(OwmlDir)\Mods\$(ModUniqueName)\planets\assets" + copy /y "$(ProjectDir)assets\" "$(OwmlDir)\Mods\$(ModUniqueName)\assets" + + + \ No newline at end of file diff --git a/Marshmallow/Properties/AssemblyInfo.cs b/NewHorizons/Properties/AssemblyInfo.cs similarity index 93% rename from Marshmallow/Properties/AssemblyInfo.cs rename to NewHorizons/Properties/AssemblyInfo.cs index 18162c07..fa7817c9 100644 --- a/Marshmallow/Properties/AssemblyInfo.cs +++ b/NewHorizons/Properties/AssemblyInfo.cs @@ -4,11 +4,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Marshmallow")] +[assembly: AssemblyTitle("NewHorizons")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Marshmallow")] +[assembly: AssemblyProduct("NewHorizons")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Marshmallow/Utility/AddDebugShape.cs b/NewHorizons/Utility/AddDebugShape.cs similarity index 82% rename from Marshmallow/Utility/AddDebugShape.cs rename to NewHorizons/Utility/AddDebugShape.cs index 55d9996a..48bb32e4 100644 --- a/Marshmallow/Utility/AddDebugShape.cs +++ b/NewHorizons/Utility/AddDebugShape.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; +using UnityEngine; -namespace Marshmallow.Utility +namespace NewHorizons.Utility { static class AddDebugShape { diff --git a/Marshmallow/Utility/AddToUITable.cs b/NewHorizons/Utility/AddToUITable.cs similarity index 89% rename from Marshmallow/Utility/AddToUITable.cs rename to NewHorizons/Utility/AddToUITable.cs index a8cc8e83..eca5d925 100644 --- a/Marshmallow/Utility/AddToUITable.cs +++ b/NewHorizons/Utility/AddToUITable.cs @@ -1,8 +1,8 @@ -using OWML.ModHelper.Events; +using OWML.Utils; using System.Linq; using UnityEngine; -namespace Marshmallow.Utility +namespace NewHorizons.Utility { static class AddToUITable { diff --git a/Marshmallow/Utility/ImageUtilities.cs b/NewHorizons/Utility/ImageUtilities.cs similarity index 96% rename from Marshmallow/Utility/ImageUtilities.cs rename to NewHorizons/Utility/ImageUtilities.cs index 67a69882..cd376b5f 100644 --- a/Marshmallow/Utility/ImageUtilities.cs +++ b/NewHorizons/Utility/ImageUtilities.cs @@ -1,7 +1,7 @@ using System.IO; using UnityEngine; -namespace Marshmallow.Utility +namespace NewHorizons.Utility { static class ImageUtilities { diff --git a/NewHorizons/Utility/Logger.cs b/NewHorizons/Utility/Logger.cs new file mode 100644 index 00000000..cae0fcae --- /dev/null +++ b/NewHorizons/Utility/Logger.cs @@ -0,0 +1,74 @@ +using OWML.Common; +using System; +using System.ComponentModel; +using UnityEngine; + +namespace NewHorizons.Utility +{ + public class Logger + { + public static void LogProperties(UnityEngine.Object obj) + { + foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(obj)) + { + string name = descriptor?.Name; + object value; + try + { + value = descriptor.GetValue(obj); + } + catch(Exception) + { + value = null; + } + + Log($"{obj.name} {name}={value}"); + } + } + + public static void LogPath(GameObject go) + { + if (go == null) Log("Can't print path: GameObject is null"); + else Log($"{GetPath(go.transform)}"); + } + + private static string GetPath(Transform current) + { + if (current.parent == null) return "/" + current.name; + return GetPath(current.parent) + "/" + current.name; + } + + public static void Log(string text, LogType type) + { + Main.helper.Console.WriteLine(Enum.GetName(typeof(LogType), type) + " : " + text, LogTypeToMessageType(type)); + } + + public static void Log(string text) + { + Log(text, LogType.Log); + } + public static void LogError(string text) + { + Log(text, LogType.Error); + } + public enum LogType + { + Log, + Error, + Warning, + Todo + } + private static MessageType LogTypeToMessageType(LogType t) + { + switch(t) + { + case LogType.Error: + return MessageType.Error; + case LogType.Warning: + return MessageType.Warning; + default: + return MessageType.Info; + } + } + } +} diff --git a/Marshmallow/Utility/MColor32.cs b/NewHorizons/Utility/MColor32.cs similarity index 73% rename from Marshmallow/Utility/MColor32.cs rename to NewHorizons/Utility/MColor32.cs index fc92b4f5..525e9cdc 100644 --- a/Marshmallow/Utility/MColor32.cs +++ b/NewHorizons/Utility/MColor32.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; +using UnityEngine; -namespace Marshmallow.Utility +namespace NewHorizons.Utility { public class MColor32 { diff --git a/Marshmallow/Utility/MTuple.cs b/NewHorizons/Utility/MTuple.cs similarity index 67% rename from Marshmallow/Utility/MTuple.cs rename to NewHorizons/Utility/MTuple.cs index 2d12182a..27617224 100644 --- a/Marshmallow/Utility/MTuple.cs +++ b/NewHorizons/Utility/MTuple.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; -namespace Marshmallow.Utility +namespace NewHorizons.Utility { public class MTuple { diff --git a/NewHorizons/Utility/MVector3.cs b/NewHorizons/Utility/MVector3.cs new file mode 100644 index 00000000..2621b488 --- /dev/null +++ b/NewHorizons/Utility/MVector3.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace NewHorizons.Utility +{ + public class MVector3 + { + public MVector3(float x, float y, float z) + { + X = x; + Y = y; + Z = z; + } + + public float X { get; } + public float Y { get; } + public float Z { get; } + + public static implicit operator MVector3(Vector3 vec) + { + return new MVector3(vec.x, vec.y, vec.z); + } + + public static implicit operator Vector3(MVector3 vec) + { + return new Vector3(vec.X, vec.Y, vec.Z); + } + } +} diff --git a/Marshmallow/Utility/MakeMeshDoubleFaced.cs b/NewHorizons/Utility/MakeMeshDoubleFaced.cs similarity index 92% rename from Marshmallow/Utility/MakeMeshDoubleFaced.cs rename to NewHorizons/Utility/MakeMeshDoubleFaced.cs index 4834dda5..74f5de1c 100644 --- a/Marshmallow/Utility/MakeMeshDoubleFaced.cs +++ b/NewHorizons/Utility/MakeMeshDoubleFaced.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; +using UnityEngine; -namespace Marshmallow.Utility +namespace NewHorizons.Utility { class MakeMeshDoubleFaced : MonoBehaviour { diff --git a/NewHorizons/Utility/NewHorizonBody.cs b/NewHorizons/Utility/NewHorizonBody.cs new file mode 100644 index 00000000..2c6549fc --- /dev/null +++ b/NewHorizons/Utility/NewHorizonBody.cs @@ -0,0 +1,17 @@ +using NewHorizons.External; +using UnityEngine; + +namespace NewHorizons.Utility +{ + public class NewHorizonsBody + { + public NewHorizonsBody(IPlanetConfig config) + { + Config = config; + } + + public IPlanetConfig Config; + + public GameObject Object; + } +} diff --git a/NewHorizons/Utility/NewHorizonExtensions.cs b/NewHorizons/Utility/NewHorizonExtensions.cs new file mode 100644 index 00000000..b68ee91e --- /dev/null +++ b/NewHorizons/Utility/NewHorizonExtensions.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NewHorizons.Utility +{ + public static class NewHorizonsExtensions + { + public static MVector3 ToMVector3(this Vector3 vector3) + { + return new MVector3(vector3.x, vector3.y, vector3.z); + } + + public static T GetSetting(this Dictionary dict, string settingName) + { + return (T)dict[settingName]; + } + } +} diff --git a/NewHorizons/Utility/Patches.cs b/NewHorizons/Utility/Patches.cs new file mode 100644 index 00000000..3d2b325f --- /dev/null +++ b/NewHorizons/Utility/Patches.cs @@ -0,0 +1,28 @@ +using OWML.Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.Utility +{ + public class Patches + { + public static void Apply() + { + Main.helper.HarmonyHelper.AddPrefix("GetHUDDisplayName", typeof(Patches), nameof(Patches.GetHUDDisplayName)); + } + + public static bool GetHUDDisplayName(ReferenceFrame __instance, ref string __result) + { + var ao = __instance.GetAstroObject(); + if (ao.GetAstroObjectName() == AstroObject.Name.CustomString) + { + __result = ao.GetCustomName(); + return false; + } + return true; + } + } +} diff --git a/NewHorizons/assets/default_clouds.png b/NewHorizons/assets/default_clouds.png new file mode 100644 index 00000000..c3dbe9fb Binary files /dev/null and b/NewHorizons/assets/default_clouds.png differ diff --git a/NewHorizons/assets/default_ramp.png b/NewHorizons/assets/default_ramp.png new file mode 100644 index 00000000..2b7e4f1f Binary files /dev/null and b/NewHorizons/assets/default_ramp.png differ diff --git a/NewHorizons/assets/default_rings.png b/NewHorizons/assets/default_rings.png new file mode 100644 index 00000000..50b79327 Binary files /dev/null and b/NewHorizons/assets/default_rings.png differ diff --git a/NewHorizons/default-config.json b/NewHorizons/default-config.json new file mode 100644 index 00000000..d0637618 --- /dev/null +++ b/NewHorizons/default-config.json @@ -0,0 +1,3 @@ +{ + "enabled": true +} \ No newline at end of file diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json new file mode 100644 index 00000000..714bcdd1 --- /dev/null +++ b/NewHorizons/manifest.json @@ -0,0 +1,8 @@ +{ + "filename": "NewHorizons.dll", + "author": "xen", + "name": "NewHorizons", + "uniqueName": "xen.NewHorizons", + "version": "0.1.0", + "owmlVersion": "2.0.0" +} diff --git a/NewHorizons/packages.config b/NewHorizons/packages.config new file mode 100644 index 00000000..29df5b05 --- /dev/null +++ b/NewHorizons/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NewHorizons/planets/assets/accretion_disk.png b/NewHorizons/planets/assets/accretion_disk.png new file mode 100644 index 00000000..d00ee5ec Binary files /dev/null and b/NewHorizons/planets/assets/accretion_disk.png differ diff --git a/NewHorizons/planets/assets/brimstone_clouds.png b/NewHorizons/planets/assets/brimstone_clouds.png new file mode 100644 index 00000000..adfbb803 Binary files /dev/null and b/NewHorizons/planets/assets/brimstone_clouds.png differ diff --git a/NewHorizons/planets/assets/jewel_rings.png b/NewHorizons/planets/assets/jewel_rings.png new file mode 100644 index 00000000..a03b7701 Binary files /dev/null and b/NewHorizons/planets/assets/jewel_rings.png differ diff --git a/NewHorizons/planets/assets/ringed_jewel.png b/NewHorizons/planets/assets/ringed_jewel.png new file mode 100644 index 00000000..7847bffe Binary files /dev/null and b/NewHorizons/planets/assets/ringed_jewel.png differ diff --git a/NewHorizons/planets/assets/ringed_jewel_cap.png b/NewHorizons/planets/assets/ringed_jewel_cap.png new file mode 100644 index 00000000..08ae98e5 Binary files /dev/null and b/NewHorizons/planets/assets/ringed_jewel_cap.png differ diff --git a/NewHorizons/planets/assets/ringed_jewel_ramp.png b/NewHorizons/planets/assets/ringed_jewel_ramp.png new file mode 100644 index 00000000..dec4b6cb Binary files /dev/null and b/NewHorizons/planets/assets/ringed_jewel_ramp.png differ diff --git a/NewHorizons/planets/example_attlerock.json b/NewHorizons/planets/example_attlerock.json new file mode 100644 index 00000000..3cb57963 --- /dev/null +++ b/NewHorizons/planets/example_attlerock.json @@ -0,0 +1,15 @@ +{ + "name" : "Attlerock", + "hasLava":true, + "lavalSize":100, + "hasFog":true, + "fogTint": + { + "r" : 160, + "g" : 0, + "b" : 0, + "a" : 255 + }, + "fogSize": 200, + "fogDensity":0.9, +} \ No newline at end of file diff --git a/NewHorizons/planets/example_blackhole.json b/NewHorizons/planets/example_blackhole.json new file mode 100644 index 00000000..60ff5410 --- /dev/null +++ b/NewHorizons/planets/example_blackhole.json @@ -0,0 +1,40 @@ +{ + "name" : "Devil's Maw", + "semiMajorAxis" : 1700, + "inclination" : 30, + "primaryBody" : "BRITTLE_HOLLOW", + "atmoEndSize" : 500, + "isMoon" : true, + "hasGravity" : true, + "surfaceAcceleration" : 20, + "hasMapMarker" : true, + "hasGround": false, + "isTidallyLocked" : false, + "lightTint" : + { + "r" : 160, + "g" : 0, + "b" : 0, + "a" : 255 + }, + "hasFog":true, + "fogTint": + { + "r" : 160, + "g" : 0, + "b" : 0, + "a" : 255 + }, + "fogSize": 200, + "fogDensity":0.9, + "longitudeOfAscendingNode" : 50, + "eccentricity" : 0, + "argumentOfPeriapsis": 0, + "groundSize" : 100, + "hasRings" : true, + "ringInnerRadius" : 0, + "ringOuterRadius" : 200, + "ringInclination" : 30, + "hasBlackHole" : true, + "ringTexture" : "planets/assets/accretion_disk.png", +} \ No newline at end of file diff --git a/NewHorizons/planets/example_giants_deep.json b/NewHorizons/planets/example_giants_deep.json new file mode 100644 index 00000000..601ac529 --- /dev/null +++ b/NewHorizons/planets/example_giants_deep.json @@ -0,0 +1,8 @@ +{ + "name" : "Giants Deep", + "hasRings" : true, + "ringInnerRadius" : 1800, + "ringOuterRadius" : 2200, + "ringInclination" : 20, + "ringLongitudeOfAscendingNode" : 80, +} \ No newline at end of file diff --git a/NewHorizons/planets/example_moon.json b/NewHorizons/planets/example_moon.json new file mode 100644 index 00000000..16983561 --- /dev/null +++ b/NewHorizons/planets/example_moon.json @@ -0,0 +1,43 @@ +{ + "name" : "Wetrock", + "semiMajorAxis" : 1500, + "inclination" : 10, + "primaryBody" : "TIMBER_HEARTH", + "isMoon" : true, + "atmoEndSize" : 300, + "hasWater" : true, + "waterSize" : 101, + "hasRain" : true, + "hasGravity" : true, + "surfaceAcceleration" : 4, + "hasMapMarker" : true, + "hasFog" : true, + "fogTint" : + { + "r" : 255, + "g" : 255, + "b" : 255, + "a" : 255 + }, + "fogSize": 200, + "fogDensity":0.9, + "hasGround": true, + "groundSize" : 100, + "isTidallyLocked" : true, + "lightTint" : + { + "r" : 255, + "g" : 255, + "b" : 255, + "a" : 255 + }, + "hasSnow" : true, + "longitudeOfAscendingNode" : 0, + "eccentricity" : 0, + "argumentOfPeriapsis": 0, + "hasRings" : true, + "ringInnerRadius" : 200, + "ringOuterRadius" : 210, + "ringInclination" : 20, + "ringLongitudeOfAscendingNode" : 50, +} \ No newline at end of file diff --git a/NewHorizons/planets/example_planet.json b/NewHorizons/planets/example_planet.json new file mode 100644 index 00000000..eaa117d3 --- /dev/null +++ b/NewHorizons/planets/example_planet.json @@ -0,0 +1,63 @@ +{ + "name" : "Ringed Jewel", + "semiMajorAxis" : 25000, + "inclination" : 14, + "primaryBody" : "SUN", + "isMoon" : false, + "atmoEndSize" : 500, + "hasClouds" : true, + "topCloudSize" : 500, + "bottomCloudSize" : 470, + "bottomCloudTint" : + { + "r" : 181, + "g" : 181, + "b" : 230, + "a" : 255 + }, + "topCloudTint" : + { + "r" : 181, + "g" : 255, + "b" : 230, + "a" : 255 + }, + "hasWater" : false, + "waterSize" : 101, + "hasRain" : false, + "hasGravity" : true, + "surfaceAcceleration" : 4, + "hasMapMarker" : true, + "hasFog" : true, + "fogTint" : + { + "r" : 255, + "g" : 128, + "b" : 128, + "a" : 255 + }, + "fogDensity": 0.4, + "fogSize": 450, + "hasGround": false, + "groundSize" : 100, + "isTidallyLocked" : false, + "lightTint" : + { + "r" : 200, + "g" : 240, + "b" : 255, + "a" : 255 + }, + "hasSnow" : true, + "longitudeOfAscendingNode" : 0, + "eccentricity" : 0, + "argumentOfPeriapsis": 0, + "hasRings" : true, + "ringInnerRadius" : 800, + "ringOuterRadius" : 950, + "ringInclination" : 80, + "ringLongitudeOfAscendingNode" : 30, + "ringTexture" : "planets/assets/ringed_jewel.png", + "hasLava" : true, + "lavaSize" : 300, +} \ No newline at end of file diff --git a/manifest.json b/manifest.json deleted file mode 100644 index cd2174d6..00000000 --- a/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "filename": "Marshmallow.dll", - "author": "misternebula", - "name": "Marshmallow", - "uniqueName": "misternebula.Marshmallow", - "version": "1.0.0", - "owmlVersion": "0.3.53" -}