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
|
.vs
|
||||||
bin
|
bin
|
||||||
obj
|
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"
|
||||||
|
}
|
||||||
@ -15,22 +15,57 @@ namespace NewHorizons.Builder.General
|
|||||||
{
|
{
|
||||||
public static class HeavenlyBodyBuilder
|
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)
|
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 size = new Position.Size(config.Base.SurfaceSize, SOI);
|
||||||
var G = GravityVolume.GRAVITATIONAL_CONSTANT;
|
var G = GravityVolume.GRAVITATIONAL_CONSTANT;
|
||||||
var gravity = new Gravity(G, bodyGravity == null ? 0 : bodyGravity.GetFalloffExponent(), bodyGravity == null ? 0 : bodyGravity.GetStandardGravitationalParameter() / G);
|
var gravity = Gravity.of(bodyGravity == null ? 2f : bodyGravity.GetFalloffExponent(), bodyGravity == null ? 0 : bodyGravity.GetStandardGravitationalParameter() / G);
|
||||||
var parent = HeavenlyBody.FromString(config.Orbit.PrimaryBody);
|
var parent = getBody(config.Orbit.PrimaryBody);
|
||||||
var orbit = OrbitalHelper.KeplerCoordinatesFromOrbitModule(config.Orbit);
|
var orbit = OrbitalHelper.KeplerCoordinatesFromOrbitModule(config.Orbit);
|
||||||
|
|
||||||
var hb = new HeavenlyBody(config.Name);
|
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 planetoid = new Planet.Plantoid(size, gravity, body.transform.rotation, initialMotion._initAngularSpeed, parent, orbit);
|
||||||
|
|
||||||
Planet.mapping.Add(hb, planetoid);
|
var mapping = Planet.defaultMapping;
|
||||||
Planet.defaultMapping.Add(hb, planetoid);
|
mapping[hb] = planetoid;
|
||||||
|
Planet.defaultMapping = mapping;
|
||||||
|
}
|
||||||
|
|
||||||
Position.AstroLookup.Add(hb, () => ao);
|
private static HeavenlyBody addHeavenlyBody(string name)
|
||||||
Position.BodyLookup.Add(hb, () => ao?.GetAttachedOWRigidbody());
|
{
|
||||||
|
var hb = new HeavenlyBody(name);
|
||||||
|
bodyName.Add(name, hb);
|
||||||
|
|
||||||
|
var astroLookup = Position.AstroLookup;
|
||||||
|
astroLookup.Add(hb, () => AstroObjectLocator.GetAstroObject(name));
|
||||||
|
Position.AstroLookup = astroLookup;
|
||||||
|
|
||||||
|
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;
|
var ecc = config.Orbit.Eccentricity;
|
||||||
|
|
||||||
OrbitLine orbitLine;
|
OrbitLine orbitLine;
|
||||||
if (ecc == 0) orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
if (ecc == 0) orbitLine = orbitGO.AddComponent<OrbitLine>();
|
||||||
else if (ecc > 0 && ecc < 1) orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
else if (ecc > 0 && ecc < 1) orbitLine = orbitGO.AddComponent<EllipticOrbitLine>();
|
||||||
else orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
else orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
||||||
|
|
||||||
var color = Color.white;
|
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>
|
<PropertyGroup>
|
||||||
<ProjectGuid>{8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}</ProjectGuid>
|
<ProjectGuid>{8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}</ProjectGuid>
|
||||||
<TargetFramework>net48</TargetFramework>
|
<TargetFramework>net48</TargetFramework>
|
||||||
@ -27,12 +28,32 @@
|
|||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="NewHorizons.csproj.user" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="PacificEngine.OW_CommonResources">
|
<Reference Include="PacificEngine.OW_CommonResources">
|
||||||
<HintPath>$(OuterWildsModsDirectory)\PacificEngine.OW_CommonResources\PacificEngine.OW_CommonResources.dll</HintPath>
|
<HintPath>$(OuterWildsModsDirectory)\PacificEngine.OW_CommonResources\PacificEngine.OW_CommonResources.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</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>
|
</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