Forked
Renamed to new horizons, updated to current versions of OWML and Outer Wilds, added BlackHoleBuilder, LavaBuilder, RingBuilder. Added support to modify existing planets with configs.
63
.gitattributes
vendored
@ -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
|
||||
343
.gitignore
vendored
@ -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
|
||||
packages
|
||||
.vs
|
||||
bin
|
||||
obj
|
||||
|
||||
21
LICENSE
Normal file
@ -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.
|
||||
@ -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<SectorCullGroup>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Marshmallow/External/PlanetConfig.cs
vendored
@ -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; }
|
||||
}
|
||||
}
|
||||
@ -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<MarshmallowBody> BodyList = new List<MarshmallowBody>();
|
||||
|
||||
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<PlanetConfig>(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<AstroObject>());
|
||||
}
|
||||
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<OWRigidbody>().SetVelocity(Locator.GetCenterOfTheUniverse().GetOffsetVelocity());
|
||||
|
||||
var primary = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(config.PrimaryBody)).GetAttachedOWRigidbody();
|
||||
var initialMotion = primary.GetComponent<InitialMotion>();
|
||||
if (initialMotion != null)
|
||||
{
|
||||
planet.GetComponent<OWRigidbody>().AddVelocityChange(-initialMotion.GetInitVelocity());
|
||||
planet.GetComponent<OWRigidbody>().AddVelocityChange(primary.GetVelocity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MarshmallowApi
|
||||
{
|
||||
public void Create(Dictionary<string, object> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,140 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{6BDE7833-A385-4A73-A121-8335D5E875C0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Marshmallow</RootNamespace>
|
||||
<AssemblyName>Marshmallow</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>E:\Steam\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\NAudio-Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Logging, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Events.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Input.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.0.7.3\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AudioModule">
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.Networking">
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.Networking.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ParticleSystemModule">
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.ParticleSystemModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.PhysicsModule">
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UIModule">
|
||||
<HintPath>E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\UnityEngine.UIModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="External\IPlanetConfig.cs" />
|
||||
<Compile Include="External\PlanetConfig.cs" />
|
||||
<Compile Include="Utility\AddDebugShape.cs" />
|
||||
<Compile Include="Utility\AddToUITable.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="Atmosphere\AirBuilder.cs" />
|
||||
<Compile Include="General\AmbientLightBuilder.cs" />
|
||||
<Compile Include="Atmosphere\AtmosphereBuilder.cs" />
|
||||
<Compile Include="Atmosphere\EffectsBuilder.cs" />
|
||||
<Compile Include="Atmosphere\CloudsBuilder.cs" />
|
||||
<Compile Include="General\DetectorBuilder.cs" />
|
||||
<Compile Include="Body\GeometryBuilder.cs" />
|
||||
<Compile Include="General\GravityBuilder.cs" />
|
||||
<Compile Include="General\MarkerBuilder.cs" />
|
||||
<Compile Include="General\BaseBuilder.cs" />
|
||||
<Compile Include="General\OrbitlineBuilder.cs" />
|
||||
<Compile Include="General\RFVolumeBuilder.cs" />
|
||||
<Compile Include="General\SectorBuilder.cs" />
|
||||
<Compile Include="General\SpawnpointBuilder.cs" />
|
||||
<Compile Include="Atmosphere\SunOverrideBuilder.cs" />
|
||||
<Compile Include="Atmosphere\VolumesBuilder.cs" />
|
||||
<Compile Include="Body\WaterBuilder.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utility\ImageUtilities.cs" />
|
||||
<Compile Include="Utility\Logger.cs" />
|
||||
<Compile Include="Utility\MakeMeshDoubleFaced.cs" />
|
||||
<Compile Include="Utility\MarshmallowExtensions.cs" />
|
||||
<Compile Include="Utility\MVector3.cs" />
|
||||
<Compile Include="Utility\MColor32.cs" />
|
||||
<Compile Include="Utility\MarshmallowBody.cs" />
|
||||
<Compile Include="Utility\MTuple.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" />
|
||||
<package id="Lib.Harmony" version="2.0.0.9" targetFramework="net35" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net35" />
|
||||
<package id="OWML" version="0.7.3" targetFramework="net35" />
|
||||
</packages>
|
||||
@ -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
|
||||
@ -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<OWAudioSource>();
|
||||
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<AudioVolume>();
|
||||
airGO.AddComponent<AudioVolume>();
|
||||
}
|
||||
|
||||
airGO.SetActive(true);
|
||||
@ -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<MeshFilter>();
|
||||
MF.mesh = GameObject.Find("Atmosphere_GD/FogSphere").GetComponent<MeshFilter>().mesh;
|
||||
@ -30,7 +28,7 @@ namespace Marshmallow.Atmosphere
|
||||
|
||||
PlanetaryFogController PFC = fogGO.AddComponent<PlanetaryFogController>();
|
||||
PFC.fogLookupTexture = GameObject.Find("Atmosphere_GD/FogSphere").GetComponent<PlanetaryFogController>().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<PlanetaryFogController>().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);
|
||||
}
|
||||
@ -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<MeshFilter>();
|
||||
topMF.mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshFilter>().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<TessellatedSphereRenderer>();
|
||||
bottomTSR.tessellationMeshGroup = GameObject.Find("CloudsBottomLayer_GD").GetComponent<TessellatedSphereRenderer>().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<SphereCollider>();
|
||||
fluidSC.isTrigger = true;
|
||||
fluidSC.radius = config.TopCloudSize / 2;
|
||||
fluidSC.radius = config.TopCloudSize;
|
||||
|
||||
OWShellCollider fluidOWSC = cloudsFluidGO.AddComponent<OWShellCollider>();
|
||||
fluidOWSC.SetValue("_innerRadius", config.BottomCloudSize);
|
||||
58
NewHorizons/Atmosphere/EffectsBuilder.cs
Normal file
@ -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<SectorCullGroup>();
|
||||
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<PlanetaryVectionController>();
|
||||
pvc.SetValue("_densityByHeight", new AnimationCurve(new Keyframe[] { new Keyframe(Mathf.Max(groundSize, waterSize), 10f), new Keyframe(atmoEnd, 0f) }));
|
||||
|
||||
rainGO.GetComponent<PlanetaryVectionController>().SetValue("_activeInSector", sector);
|
||||
rainGO.GetComponent<PlanetaryVectionController>().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<PlanetaryVectionController>();
|
||||
pvc.SetValue("_densityByHeight", new AnimationCurve(new Keyframe[] { new Keyframe(Mathf.Max(groundSize, waterSize), 10f), new Keyframe(atmoEnd, 0f) }));
|
||||
|
||||
var particleSystem = snowGO.GetComponent<ParticleSystem>();
|
||||
var e = particleSystem.emission;
|
||||
e.rateOverTime = 50;
|
||||
|
||||
snowGO.GetComponent<PlanetaryVectionController>().SetValue("_activeInSector", sector);
|
||||
snowGO.GetComponent<PlanetaryVectionController>().SetValue("_exclusionSectors", new Sector[] { });
|
||||
snowGO.SetActive(true);
|
||||
}
|
||||
|
||||
effectsGO.SetActive(true);
|
||||
|
||||
Logger.Log("Finished building effects", Logger.LogType.Log);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<GiantsDeepSunOverrideVolume>();
|
||||
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);
|
||||
@ -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>();
|
||||
/*OWTriggerVolume trigvol = */
|
||||
rulesetGO.AddComponent<OWTriggerVolume>();
|
||||
|
||||
PlanetoidRuleset PR = rulesetGO.AddComponent<PlanetoidRuleset>();
|
||||
PR.SetValue("_altitudeFloor", config.GroundSize);
|
||||
@ -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<MeshFilter>().mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshFilter>().mesh;
|
||||
groundGO.GetComponent<SphereCollider>().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");
|
||||
@ -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<SphereCollider>();
|
||||
|
||||
TessellatedSphereRenderer TSR = waterGO.AddComponent<TessellatedSphereRenderer>();
|
||||
@ -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; }
|
||||
}
|
||||
}
|
||||
63
NewHorizons/External/PlanetConfig.cs
vendored
Normal file
@ -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<string, object> 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<Light>();
|
||||
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<Light>().cookie;
|
||||
|
||||
L.cookie = GameObject.Find("/GiantsDeep_Body/AmbientLight_GD").GetComponent<Light>().cookie;
|
||||
|
||||
SectorLightsCullGroup SLCG = lightGO.AddComponent<SectorLightsCullGroup>();
|
||||
SLCG.SetSector(sector);
|
||||
@ -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<InitialMotion>();
|
||||
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<AstroObject>();
|
||||
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)
|
||||
{
|
||||
18
NewHorizons/General/BlackHoleBuilder.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
22
NewHorizons/General/LavaBuilder.cs
Normal file
@ -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<SphereCollider>().radius = lavaSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<MapMarker>();
|
||||
MM.SetValue("_labelID", (UITextType)Utility.AddToUITable.Add(config.Name));
|
||||
MM.SetValue("_labelID", (UITextType)Utility.AddToUITable.Add(config.Name.ToUpper()));
|
||||
|
||||
if (config.IsMoon)
|
||||
{
|
||||
@ -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<LineRenderer>();
|
||||
//LR.material = GameObject.Find("OrbitLine_TH").GetComponent<LineRenderer>().material;
|
||||
|
||||
var thLR = GameObject.Find("OrbitLine_TH").GetComponent<LineRenderer>();
|
||||
|
||||
LR.material = thLR.material;
|
||||
LR.useWorldSpace = false;
|
||||
LR.loop = false;
|
||||
|
||||
@ -25,8 +23,9 @@ namespace Marshmallow.General
|
||||
|
||||
var ol = orbit.AddComponent<OrbitLine>();
|
||||
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);
|
||||
}
|
||||
@ -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<SphereCollider>();
|
||||
SC.isTrigger = true;
|
||||
SC.radius = config.AtmoEndSize * 2;
|
||||
SC.radius = atmoEndSize * 2;
|
||||
|
||||
ReferenceFrameVolume RFV = rfGO.AddComponent<ReferenceFrameVolume>();
|
||||
|
||||
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);
|
||||
|
||||
79
NewHorizons/General/RingBuilder.cs
Normal file
@ -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<MeshFilter>();
|
||||
var ringMesh = ringMF.mesh;
|
||||
var ringMR = ringGO.AddComponent<MeshRenderer>();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<OWTriggerVolume>();
|
||||
sectorGO.AddComponent<OWTriggerVolume>();
|
||||
|
||||
Sector S = sectorGO.AddComponent<Sector>();
|
||||
S.SetValue("_name", Sector.Name.Unnamed);
|
||||
@ -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;
|
||||
|
||||
271
NewHorizons/Main.cs
Normal file
@ -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<NewHorizonsBody> BodyList = new List<NewHorizonsBody>();
|
||||
|
||||
public static List<AstroObject> AstroObjects = new List<AstroObject>();
|
||||
|
||||
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<PlanetConfig>(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<AstroObject>())
|
||||
{
|
||||
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<Sector>();
|
||||
|
||||
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<AstroObject>(), 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<OWRigidbody>().SetVelocity(Locator.GetCenterOfTheUniverse().GetOffsetVelocity());
|
||||
|
||||
var primary = Locator.GetAstroObject(AstroObject.StringIDToAstroObjectName(body.Config.PrimaryBody)).GetAttachedOWRigidbody();
|
||||
var initialMotion = primary.GetComponent<InitialMotion>();
|
||||
if (initialMotion != null)
|
||||
{
|
||||
planet.GetComponent<OWRigidbody>().AddVelocityChange(-initialMotion.GetInitVelocity());
|
||||
planet.GetComponent<OWRigidbody>().AddVelocityChange(primary.GetVelocity());
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
public class NewHorizonsApi
|
||||
{
|
||||
public void Create(Dictionary<string, object> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
290
NewHorizons/NewHorizons.csproj
Normal file
@ -0,0 +1,290 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NewHorizons</RootNamespace>
|
||||
<AssemblyName>NewHorizons</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony, Version=2.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Lib.Harmony.2.1.1\lib\net48\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp-firstpass">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Security">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\Mono.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\NAudio-Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<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>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Common, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Logging, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Assets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Events.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Input.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.ModHelper.Menus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Utils, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.2.1.0\lib\net40\OWML.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Unity.InputSystem, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\Unity.InputSystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AccessibilityModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AccessibilityModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AIModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AnimationModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ARModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.ARModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AssetBundleModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AudioModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ClothModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.ClothModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ClusterInputModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.ClusterInputModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ClusterRendererModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.ClusterRendererModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CrashReportingModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.CrashReportingModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.DirectorModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.DirectorModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.GameCenterModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.GameCenterModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.GridModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.GridModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ImageConversionModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.InputModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.JSONSerializeModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.JSONSerializeModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ParticleSystemModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.ParticleSystemModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.PerformanceReportingModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.PerformanceReportingModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.Physics2DModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.Physics2DModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.PhysicsModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ScreenCaptureModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.ScreenCaptureModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.SharedInternalsModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.SharedInternalsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.SpatialTracking">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.SpatialTracking.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.SpriteMaskModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.SpriteMaskModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.SpriteShapeModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.SpriteShapeModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TerrainModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.TerrainModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TerrainPhysicsModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.TerrainPhysicsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TilemapModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.TilemapModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UIElementsModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UIElementsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UIModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UNETModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UNETModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UnityAnalyticsModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityAnalyticsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UnityConnectModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityConnectModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UnityWebRequestAudioModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UnityWebRequestModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityWebRequestModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UnityWebRequestTextureModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityWebRequestTextureModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.VehiclesModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.VehiclesModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.VideoModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.VideoModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.VRModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.VRModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.WindModule">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.WindModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="General\BaseBuilder.cs" />
|
||||
<Compile Include="General\BlackHoleBuilder.cs" />
|
||||
<Compile Include="General\DetectorBuilder.cs" />
|
||||
<Compile Include="General\GravityBuilder.cs" />
|
||||
<Compile Include="General\LavaBuilder.cs" />
|
||||
<Compile Include="General\MarkerBuilder.cs" />
|
||||
<Compile Include="General\OrbitlineBuilder.cs" />
|
||||
<Compile Include="General\RFVolumeBuilder.cs" />
|
||||
<Compile Include="General\RingBuilder.cs" />
|
||||
<Compile Include="General\SectorBuilder.cs" />
|
||||
<Compile Include="General\SpawnpointBuilder.cs" />
|
||||
<Compile Include="Utility\AddDebugShape.cs" />
|
||||
<Compile Include="General\AmbientLightBuilder.cs" />
|
||||
<Compile Include="External\IPlanetConfig.cs" />
|
||||
<Compile Include="External\PlanetConfig.cs" />
|
||||
<Compile Include="Body\GeometryBuilder.cs" />
|
||||
<Compile Include="Body\WaterBuilder.cs" />
|
||||
<Compile Include="Atmosphere\AirBuilder.cs" />
|
||||
<Compile Include="Atmosphere\AtmosphereBuilder.cs" />
|
||||
<Compile Include="Atmosphere\CloudsBuilder.cs" />
|
||||
<Compile Include="Atmosphere\EffectsBuilder.cs" />
|
||||
<Compile Include="Atmosphere\SunOverrideBuilder.cs" />
|
||||
<Compile Include="Atmosphere\VolumesBuilder.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utility\AddToUITable.cs" />
|
||||
<Compile Include="Utility\ImageUtilities.cs" />
|
||||
<Compile Include="Utility\Logger.cs" />
|
||||
<Compile Include="Utility\MakeMeshDoubleFaced.cs" />
|
||||
<Compile Include="Utility\NewHorizonBody.cs" />
|
||||
<Compile Include="Utility\NewHorizonExtensions.cs" />
|
||||
<Compile Include="Utility\MColor32.cs" />
|
||||
<Compile Include="Utility\MTuple.cs" />
|
||||
<Compile Include="Utility\MVector3.cs" />
|
||||
<Compile Include="Utility\Patches.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="default-config.json" />
|
||||
<None Include="manifest.json" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
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"
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -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("")]
|
||||
@ -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
|
||||
{
|
||||
@ -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
|
||||
{
|
||||
@ -1,7 +1,7 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Marshmallow.Utility
|
||||
namespace NewHorizons.Utility
|
||||
{
|
||||
static class ImageUtilities
|
||||
{
|
||||
74
NewHorizons/Utility/Logger.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
{
|
||||
@ -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
|
||||
{
|
||||
28
NewHorizons/Utility/MVector3.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
{
|
||||
17
NewHorizons/Utility/NewHorizonBody.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
18
NewHorizons/Utility/NewHorizonExtensions.cs
Normal file
@ -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<T>(this Dictionary<string, object> dict, string settingName)
|
||||
{
|
||||
return (T)dict[settingName];
|
||||
}
|
||||
}
|
||||
}
|
||||
28
NewHorizons/Utility/Patches.cs
Normal file
@ -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<ReferenceFrame>("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;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
NewHorizons/assets/default_clouds.png
Normal file
|
After Width: | Height: | Size: 4.3 MiB |
BIN
NewHorizons/assets/default_ramp.png
Normal file
|
After Width: | Height: | Size: 196 B |
BIN
NewHorizons/assets/default_rings.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
3
NewHorizons/default-config.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"enabled": true
|
||||
}
|
||||
8
NewHorizons/manifest.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"filename": "NewHorizons.dll",
|
||||
"author": "xen",
|
||||
"name": "NewHorizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "0.1.0",
|
||||
"owmlVersion": "2.0.0"
|
||||
}
|
||||
6
NewHorizons/packages.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net48" />
|
||||
<package id="Lib.Harmony" version="2.1.1" targetFramework="net48" />
|
||||
<package id="OWML" version="2.1.0" targetFramework="net48" />
|
||||
</packages>
|
||||
BIN
NewHorizons/planets/assets/accretion_disk.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
NewHorizons/planets/assets/brimstone_clouds.png
Normal file
|
After Width: | Height: | Size: 7.9 MiB |
BIN
NewHorizons/planets/assets/jewel_rings.png
Normal file
|
After Width: | Height: | Size: 759 B |
BIN
NewHorizons/planets/assets/ringed_jewel.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
NewHorizons/planets/assets/ringed_jewel_cap.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
NewHorizons/planets/assets/ringed_jewel_ramp.png
Normal file
|
After Width: | Height: | Size: 206 B |
15
NewHorizons/planets/example_attlerock.json
Normal file
@ -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,
|
||||
}
|
||||
40
NewHorizons/planets/example_blackhole.json
Normal file
@ -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",
|
||||
}
|
||||
8
NewHorizons/planets/example_giants_deep.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name" : "Giants Deep",
|
||||
"hasRings" : true,
|
||||
"ringInnerRadius" : 1800,
|
||||
"ringOuterRadius" : 2200,
|
||||
"ringInclination" : 20,
|
||||
"ringLongitudeOfAscendingNode" : 80,
|
||||
}
|
||||
43
NewHorizons/planets/example_moon.json
Normal file
@ -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,
|
||||
}
|
||||
63
NewHorizons/planets/example_planet.json
Normal file
@ -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,
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"filename": "Marshmallow.dll",
|
||||
"author": "misternebula",
|
||||
"name": "Marshmallow",
|
||||
"uniqueName": "misternebula.Marshmallow",
|
||||
"version": "1.0.0",
|
||||
"owmlVersion": "0.3.53"
|
||||
}
|
||||