mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
commit
0fbb659878
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,3 +3,5 @@ packages
|
||||
.vs
|
||||
bin
|
||||
obj
|
||||
|
||||
*.csproj.user
|
||||
BIN
NewHorizons.zip
Normal file
BIN
NewHorizons.zip
Normal file
Binary file not shown.
BIN
NewHorizons/Build/NewHorizons.dll
Normal file
BIN
NewHorizons/Build/NewHorizons.dll
Normal file
Binary file not shown.
BIN
NewHorizons/Build/NewHorizons.pdb
Normal file
BIN
NewHorizons/Build/NewHorizons.pdb
Normal file
Binary file not shown.
BIN
NewHorizons/Build/PacificEngine.OW_CommonResources.dll
Normal file
BIN
NewHorizons/Build/PacificEngine.OW_CommonResources.dll
Normal file
Binary file not shown.
3
NewHorizons/Build/default-config.json
Normal file
3
NewHorizons/Build/default-config.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"enabled": true
|
||||
}
|
||||
8
NewHorizons/Build/manifest.json
Normal file
8
NewHorizons/Build/manifest.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"filename": "NewHorizons.dll",
|
||||
"author": "xen",
|
||||
"name": "New Horizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "0.1.5",
|
||||
"owmlVersion": "2.1.0"
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using NewHorizons.Utility;
|
||||
using NewHorizons.Utility;
|
||||
using PacificEngine.OW_CommonResources.Game.Resource;
|
||||
using PacificEngine.OW_CommonResources.Game.State;
|
||||
using PacificEngine.OW_CommonResources.Geometry.Orbits;
|
||||
@ -15,22 +15,57 @@ namespace NewHorizons.Builder.General
|
||||
{
|
||||
public static class HeavenlyBodyBuilder
|
||||
{
|
||||
private static Dictionary<string, HeavenlyBody> bodyName = new Dictionary<string, HeavenlyBody>();
|
||||
|
||||
public static void Make(GameObject body, IPlanetConfig config, float SOI, GravityVolume bodyGravity, InitialMotion initialMotion, AstroObject ao)
|
||||
{
|
||||
var size = new Position.Size(config.Base.SurfaceSize, SOI);
|
||||
var G = GravityVolume.GRAVITATIONAL_CONSTANT;
|
||||
var gravity = new Gravity(G, bodyGravity == null ? 0 : bodyGravity.GetFalloffExponent(), bodyGravity == null ? 0 : bodyGravity.GetStandardGravitationalParameter() / G);
|
||||
var parent = HeavenlyBody.FromString(config.Orbit.PrimaryBody);
|
||||
var gravity = Gravity.of(bodyGravity == null ? 2f : bodyGravity.GetFalloffExponent(), bodyGravity == null ? 0 : bodyGravity.GetStandardGravitationalParameter() / G);
|
||||
var parent = getBody(config.Orbit.PrimaryBody);
|
||||
var orbit = OrbitalHelper.KeplerCoordinatesFromOrbitModule(config.Orbit);
|
||||
|
||||
var hb = new HeavenlyBody(config.Name);
|
||||
var planetoid = new Planet.Plantoid(size, gravity, body.transform.rotation, initialMotion._initAngularSpeed, parent, orbit);
|
||||
var hb = getBody(config.Name);
|
||||
if (hb == null)
|
||||
{
|
||||
hb = addHeavenlyBody(config.Name);
|
||||
}
|
||||
var planetoid = new Planet.Plantoid(size, gravity, body.transform.rotation, initialMotion._initAngularSpeed, parent, orbit);
|
||||
|
||||
var mapping = Planet.defaultMapping;
|
||||
mapping[hb] = planetoid;
|
||||
Planet.defaultMapping = mapping;
|
||||
}
|
||||
|
||||
Planet.mapping.Add(hb, planetoid);
|
||||
Planet.defaultMapping.Add(hb, planetoid);
|
||||
private static HeavenlyBody addHeavenlyBody(string name)
|
||||
{
|
||||
var hb = new HeavenlyBody(name);
|
||||
bodyName.Add(name, hb);
|
||||
|
||||
var astroLookup = Position.AstroLookup;
|
||||
astroLookup.Add(hb, () => AstroObjectLocator.GetAstroObject(name));
|
||||
Position.AstroLookup = astroLookup;
|
||||
|
||||
Position.AstroLookup.Add(hb, () => ao);
|
||||
Position.BodyLookup.Add(hb, () => ao?.GetAttachedOWRigidbody());
|
||||
var bodyLookup = Position.BodyLookup;
|
||||
bodyLookup.Add(hb, () => AstroObjectLocator.GetAstroObject(name)?.GetAttachedOWRigidbody());
|
||||
Position.BodyLookup = bodyLookup;
|
||||
|
||||
return hb;
|
||||
}
|
||||
|
||||
private static HeavenlyBody getBody(string name)
|
||||
{
|
||||
if (bodyName.ContainsKey(name))
|
||||
{
|
||||
return bodyName[name];
|
||||
}
|
||||
|
||||
var hb = Position.find(AstroObjectLocator.GetAstroObject(name));
|
||||
if (hb != null)
|
||||
{
|
||||
bodyName.Add(name, hb);
|
||||
}
|
||||
return hb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,8 +24,8 @@ namespace NewHorizons.Builder.Orbital
|
||||
var ecc = config.Orbit.Eccentricity;
|
||||
|
||||
OrbitLine orbitLine;
|
||||
if (ecc == 0) orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
||||
else if (ecc > 0 && ecc < 1) orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
||||
if (ecc == 0) orbitLine = orbitGO.AddComponent<OrbitLine>();
|
||||
else if (ecc > 0 && ecc < 1) orbitLine = orbitGO.AddComponent<EllipticOrbitLine>();
|
||||
else orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
||||
|
||||
var color = Color.white;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}</ProjectGuid>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
@ -27,12 +28,32 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="NewHorizons.csproj.user" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PacificEngine.OW_CommonResources">
|
||||
<HintPath>$(OuterWildsModsDirectory)\PacificEngine.OW_CommonResources\PacificEngine.OW_CommonResources.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
rmdir /Q /S "$(OuterWildsModsDirectory)\$(ProjectName)"
|
||||
md "$(OuterWildsModsDirectory)\$(ProjectName)"
|
||||
md "$(OuterWildsModsDirectory)\$(ProjectName)\AssetBundle"
|
||||
copy /y "$(ProjectDir)default-config.json" "$(OuterWildsModsDirectory)\$(ProjectName)"
|
||||
copy /y "$(ProjectDir)manifest.json" "$(OuterWildsModsDirectory)\$(ProjectName)"
|
||||
copy /y "$(ProjectDir)AssetBundle" "$(OuterWildsModsDirectory)\$(ProjectName)\AssetBundle"
|
||||
copy /y "$(TargetPath)" "$(OuterWildsModsDirectory)\$(ProjectName)"
|
||||
|
||||
rmdir /Q /S "$(ProjectDir)$(ProjectName)"
|
||||
md "$(ProjectDir)$(ProjectName)"
|
||||
md "$(ProjectDir)$(ProjectName)\AssetBundle"
|
||||
copy /y "$(ProjectDir)default-config.json" "$(ProjectDir)$(ProjectName)"
|
||||
copy /y "$(ProjectDir)manifest.json" "$(ProjectDir)$(ProjectName)"
|
||||
copy /y "$(ProjectDir)AssetBundle" "$(ProjectDir)$(ProjectName)\AssetBundle"
|
||||
copy /y "$(TargetPath)" "$(ProjectDir)$(ProjectName)"
|
||||
del /q "$(ProjectDir)..\$(ProjectName).zip"
|
||||
powershell Compress-Archive "$(ProjectDir)$(ProjectName)" "$(ProjectDir)..\$(ProjectName).zip"
|
||||
rmdir /Q /S "$(ProjectDir)$(ProjectName)"
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
<OutputPath>$(AppData)\OuterWildsModManager\OWML\Mods\xen.NewHorizons</OutputPath>
|
||||
<OuterWildsModsDirectory>$(AppData)\OuterWildsModManager\OWML\Mods</OuterWildsModsDirectory>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Loading…
x
Reference in New Issue
Block a user