mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 12:05:23 +01:00
Got Schema generation working!
This commit is contained in:
parent
73e3cfbbb3
commit
466df12003
Binary file not shown.
Binary file not shown.
@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30204.135
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewHorizons", "NewHorizons\NewHorizons.csproj", "{8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchemaExporter", "SchemaExporter\SchemaExporter.csproj", "{28E23A7D-997B-4559-BBFA-788F45125F1B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -15,6 +17,10 @@ Global
|
||||
{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
|
||||
{28E23A7D-997B-4559-BBFA-788F45125F1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{28E23A7D-997B-4559-BBFA-788F45125F1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{28E23A7D-997B-4559-BBFA-788F45125F1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{28E23A7D-997B-4559-BBFA-788F45125F1B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -13,7 +13,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
SphereCollider sc = airGO.AddComponent<SphereCollider>();
|
||||
sc.isTrigger = true;
|
||||
sc.radius = info.Scale;
|
||||
sc.radius = info.scale;
|
||||
|
||||
SimpleFluidVolume sfv = airGO.AddComponent<SimpleFluidVolume>();
|
||||
sfv._layer = 5;
|
||||
@ -23,12 +23,12 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
sfv._allowShipAutoroll = true;
|
||||
sfv._disableOnStart = false;
|
||||
|
||||
if (info.HasOxygen)
|
||||
if (info.hasOxygen)
|
||||
{
|
||||
airGO.AddComponent<OxygenVolume>();
|
||||
}
|
||||
|
||||
if (info.IsRaining)
|
||||
if (info.isRaining)
|
||||
{
|
||||
var vref = airGO.AddComponent<VisorRainEffectVolume>();
|
||||
vref._rainDirection = VisorRainEffectVolume.RainDirection.Radial;
|
||||
|
||||
@ -14,17 +14,17 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
atmoGO.SetActive(false);
|
||||
atmoGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (atmosphereModule.UseAtmosphereShader)
|
||||
if (atmosphereModule.useAtmosphereShader)
|
||||
{
|
||||
GameObject atmo = GameObject.Instantiate(GameObject.Find("TimberHearth_Body/Atmosphere_TH/AtmoSphere"), atmoGO.transform, true);
|
||||
atmo.transform.position = planetGO.transform.TransformPoint(Vector3.zero);
|
||||
atmo.transform.localScale = Vector3.one * atmosphereModule.Size * 1.2f;
|
||||
atmo.transform.localScale = Vector3.one * atmosphereModule.size * 1.2f;
|
||||
foreach (var meshRenderer in atmo.GetComponentsInChildren<MeshRenderer>())
|
||||
{
|
||||
meshRenderer.material.SetFloat(InnerRadius, atmosphereModule.Clouds != null ? atmosphereModule.Size : surfaceSize);
|
||||
meshRenderer.material.SetFloat(OuterRadius, atmosphereModule.Size * 1.2f);
|
||||
if (atmosphereModule.AtmosphereTint != null)
|
||||
meshRenderer.material.SetColor(SkyColor, atmosphereModule.AtmosphereTint.ToColor());
|
||||
meshRenderer.material.SetFloat(InnerRadius, atmosphereModule.clouds != null ? atmosphereModule.size : surfaceSize);
|
||||
meshRenderer.material.SetFloat(OuterRadius, atmosphereModule.size * 1.2f);
|
||||
if (atmosphereModule.atmosphereTint != null)
|
||||
meshRenderer.material.SetColor(SkyColor, atmosphereModule.atmosphereTint.ToColor());
|
||||
}
|
||||
|
||||
atmo.SetActive(true);
|
||||
|
||||
@ -30,16 +30,16 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
GameObject cloudsBottomGO = new GameObject("BottomClouds");
|
||||
cloudsBottomGO.SetActive(false);
|
||||
cloudsBottomGO.transform.parent = cloudsMainGO.transform;
|
||||
cloudsBottomGO.transform.localScale = Vector3.one * atmo.Clouds.InnerCloudRadius;
|
||||
cloudsBottomGO.transform.localScale = Vector3.one * atmo.clouds.innerCloudRadius;
|
||||
|
||||
TessellatedSphereRenderer bottomTSR = cloudsBottomGO.AddComponent<TessellatedSphereRenderer>();
|
||||
bottomTSR.tessellationMeshGroup = GameObject.Find("CloudsBottomLayer_QM").GetComponent<TessellatedSphereRenderer>().tessellationMeshGroup;
|
||||
var bottomTSRMaterials = GameObject.Find("CloudsBottomLayer_QM").GetComponent<TessellatedSphereRenderer>().sharedMaterials;
|
||||
|
||||
// If they set a colour apply it to all the materials else keep the default QM one
|
||||
if (atmo.Clouds.Tint != null)
|
||||
if (atmo.clouds.tint != null)
|
||||
{
|
||||
var bottomColor = atmo.Clouds.Tint.ToColor();
|
||||
var bottomColor = atmo.clouds.tint.ToColor();
|
||||
|
||||
var bottomTSRTempArray = new Material[2];
|
||||
|
||||
@ -70,10 +70,10 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
SphereCollider fluidSC = cloudsFluidGO.AddComponent<SphereCollider>();
|
||||
fluidSC.isTrigger = true;
|
||||
fluidSC.radius = atmo.Size;
|
||||
fluidSC.radius = atmo.size;
|
||||
|
||||
OWShellCollider fluidOWSC = cloudsFluidGO.AddComponent<OWShellCollider>();
|
||||
fluidOWSC._innerRadius = atmo.Size * 0.9f;
|
||||
fluidOWSC._innerRadius = atmo.size * 0.9f;
|
||||
|
||||
CloudLayerFluidVolume fluidCLFV = cloudsFluidGO.AddComponent<CloudLayerFluidVolume>();
|
||||
fluidCLFV._layer = 5;
|
||||
@ -81,15 +81,15 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
fluidCLFV._density = 1.2f;
|
||||
|
||||
var fluidType = FluidVolume.Type.CLOUD;
|
||||
if (atmo.Clouds.FluidType != null)
|
||||
if (atmo.clouds.fluidType != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(CloudFluidType), atmo.Clouds.FluidType).ToUpper());
|
||||
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(CloudFluidType), atmo.clouds.fluidType).ToUpper());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't parse fluid volume type [{atmo.Clouds.FluidType}]: {ex.Message}, {ex.StackTrace}");
|
||||
Logger.LogError($"Couldn't parse fluid volume type [{atmo.clouds.fluidType}]: {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,25 +100,25 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
// Fix the rotations once the rest is done
|
||||
cloudsMainGO.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(0, 0, 0));
|
||||
// For the base shader it has to be rotated idk
|
||||
if (atmo.Clouds.UseBasicCloudShader) cloudsMainGO.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0));
|
||||
if (atmo.clouds.useBasicCloudShader) cloudsMainGO.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(90, 0, 0));
|
||||
|
||||
// Lightning
|
||||
if (atmo.Clouds.HasLightning)
|
||||
if (atmo.clouds.hasLightning)
|
||||
{
|
||||
var lightning = _lightningPrefab.InstantiateInactive();
|
||||
lightning.transform.parent = cloudsMainGO.transform;
|
||||
lightning.transform.localPosition = Vector3.zero;
|
||||
|
||||
var lightningGenerator = lightning.GetComponent<CloudLightningGenerator>();
|
||||
lightningGenerator._altitude = (atmo.Clouds.OuterCloudRadius + atmo.Clouds.InnerCloudRadius) / 2f;
|
||||
lightningGenerator._altitude = (atmo.clouds.outerCloudRadius + atmo.clouds.innerCloudRadius) / 2f;
|
||||
lightningGenerator._audioSector = sector;
|
||||
if (atmo.Clouds.LightningGradient != null)
|
||||
if (atmo.clouds.lightningGradient != null)
|
||||
{
|
||||
var gradient = new GradientColorKey[atmo.Clouds.LightningGradient.Length];
|
||||
var gradient = new GradientColorKey[atmo.clouds.lightningGradient.Length];
|
||||
|
||||
for(int i = 0; i < atmo.Clouds.LightningGradient.Length; i++)
|
||||
for(int i = 0; i < atmo.clouds.lightningGradient.Length; i++)
|
||||
{
|
||||
var pair = atmo.Clouds.LightningGradient[i];
|
||||
var pair = atmo.clouds.lightningGradient[i];
|
||||
gradient[i] = new GradientColorKey(pair.Tint.ToColor(), pair.Time);
|
||||
}
|
||||
|
||||
@ -138,18 +138,18 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
public static GameObject MakeTopClouds(GameObject rootObject, AtmosphereModule atmo, IModBehaviour mod)
|
||||
{
|
||||
Color cloudTint = atmo.Clouds.Tint?.ToColor() ?? Color.white;
|
||||
Color cloudTint = atmo.clouds.tint?.ToColor() ?? Color.white;
|
||||
|
||||
Texture2D image, cap, ramp;
|
||||
|
||||
try
|
||||
{
|
||||
image = ImageUtilities.GetTexture(mod, atmo.Clouds.TexturePath);
|
||||
image = ImageUtilities.GetTexture(mod, atmo.clouds.texturePath);
|
||||
|
||||
if (atmo.Clouds.CapPath == null) cap = ImageUtilities.ClearTexture(128, 128);
|
||||
else cap = ImageUtilities.GetTexture(mod, atmo.Clouds.CapPath);
|
||||
if (atmo.Clouds.RampPath == null) ramp = ImageUtilities.CanvasScaled(image, 1, image.height);
|
||||
else ramp = ImageUtilities.GetTexture(mod, atmo.Clouds.RampPath);
|
||||
if (atmo.clouds.capPath == null) cap = ImageUtilities.ClearTexture(128, 128);
|
||||
else cap = ImageUtilities.GetTexture(mod, atmo.clouds.capPath);
|
||||
if (atmo.clouds.rampPath == null) ramp = ImageUtilities.CanvasScaled(image, 1, image.height);
|
||||
else ramp = ImageUtilities.GetTexture(mod, atmo.clouds.rampPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -160,7 +160,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
GameObject cloudsTopGO = new GameObject("TopClouds");
|
||||
cloudsTopGO.SetActive(false);
|
||||
cloudsTopGO.transform.parent = rootObject.transform;
|
||||
cloudsTopGO.transform.localScale = Vector3.one * atmo.Clouds.OuterCloudRadius;
|
||||
cloudsTopGO.transform.localScale = Vector3.one * atmo.clouds.outerCloudRadius;
|
||||
|
||||
MeshFilter topMF = cloudsTopGO.AddComponent<MeshFilter>();
|
||||
topMF.mesh = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshFilter>().mesh;
|
||||
@ -171,19 +171,19 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
if (_gdCloudMaterials == null) _gdCloudMaterials = GameObject.Find("CloudsTopLayer_GD").GetComponent<MeshRenderer>().sharedMaterials;
|
||||
var tempArray = new Material[2];
|
||||
|
||||
if (atmo.Clouds.UseBasicCloudShader)
|
||||
if (atmo.clouds.useBasicCloudShader)
|
||||
{
|
||||
var material = new Material(_sphereShader);
|
||||
if (atmo.Clouds.Unlit) material.renderQueue = 2550;
|
||||
material.name = atmo.Clouds.Unlit ? "BasicCloud" : "BasicShadowCloud";
|
||||
if (atmo.clouds.unlit) material.renderQueue = 2550;
|
||||
material.name = atmo.clouds.unlit ? "BasicCloud" : "BasicShadowCloud";
|
||||
|
||||
tempArray[0] = material;
|
||||
}
|
||||
else
|
||||
{
|
||||
var material = new Material(_gdCloudMaterials[0]);
|
||||
if (atmo.Clouds.Unlit) material.renderQueue = 2550;
|
||||
material.name = atmo.Clouds.Unlit ? "AdvancedCloud" : "AdvancedShadowCloud";
|
||||
if (atmo.clouds.unlit) material.renderQueue = 2550;
|
||||
material.name = atmo.clouds.unlit ? "AdvancedCloud" : "AdvancedShadowCloud";
|
||||
tempArray[0] = material;
|
||||
}
|
||||
|
||||
@ -201,14 +201,14 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
material.SetTexture(CapTex, cap);
|
||||
}
|
||||
|
||||
if (atmo.Clouds.Unlit)
|
||||
if (atmo.clouds.unlit)
|
||||
{
|
||||
cloudsTopGO.layer = LayerMask.NameToLayer("IgnoreSun");
|
||||
}
|
||||
|
||||
RotateTransform topRT = cloudsTopGO.AddComponent<RotateTransform>();
|
||||
// Idk why but the axis is weird
|
||||
topRT._localAxis = atmo.Clouds.UseBasicCloudShader ? Vector3.forward : Vector3.up;
|
||||
topRT._localAxis = atmo.clouds.useBasicCloudShader ? Vector3.forward : Vector3.up;
|
||||
topRT._degreesPerSecond = 10;
|
||||
topRT._randomizeRotationRate = false;
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
SCG._dynamicCullingBounds = false;
|
||||
SCG._waitForStreaming = false;
|
||||
|
||||
if (info.IsRaining)
|
||||
if (info.isRaining)
|
||||
{
|
||||
var rainGO = GameObject.Instantiate(SearchUtilities.CachedFind("/GiantsDeep_Body/Sector_GD/Sector_GDInterior/Effects_GDInterior/Effects_GD_Rain"), effectsGO.transform);
|
||||
rainGO.transform.position = planetGO.transform.position;
|
||||
@ -29,7 +29,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
{
|
||||
new Keyframe(surfaceSize - 0.5f, 0),
|
||||
new Keyframe(surfaceSize, 10f),
|
||||
new Keyframe(info.Scale, 0f)
|
||||
new Keyframe(info.scale, 0f)
|
||||
});
|
||||
|
||||
rainGO.GetComponent<PlanetaryVectionController>()._activeInSector = sector;
|
||||
@ -37,7 +37,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
rainGO.SetActive(true);
|
||||
}
|
||||
|
||||
if (info.IsSnowing)
|
||||
if (info.isSnowing)
|
||||
{
|
||||
var snowGO = new GameObject("SnowEffects");
|
||||
snowGO.transform.parent = effectsGO.transform;
|
||||
@ -53,7 +53,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
{
|
||||
new Keyframe(surfaceSize - 0.5f, 0),
|
||||
new Keyframe(surfaceSize, 10f),
|
||||
new Keyframe(info.Scale, 0f)
|
||||
new Keyframe(info.scale, 0f)
|
||||
});
|
||||
|
||||
snowEmitter.GetComponent<PlanetaryVectionController>()._activeInSector = sector;
|
||||
|
||||
@ -25,24 +25,24 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
PlanetaryFogController PFC = fogGO.AddComponent<PlanetaryFogController>();
|
||||
PFC.fogLookupTexture = dbPlanetaryFogController.fogLookupTexture;
|
||||
PFC.fogRadius = atmo.FogSize;
|
||||
PFC.fogDensity = atmo.FogDensity;
|
||||
PFC.fogRadius = atmo.fogSize;
|
||||
PFC.fogDensity = atmo.fogDensity;
|
||||
PFC.fogExponent = 1f;
|
||||
PFC.fogColorRampTexture = dbPlanetaryFogController.fogColorRampTexture;
|
||||
PFC.fogColorRampIntensity = 1f;
|
||||
PFC.fogTint = atmo.FogTint.ToColor();
|
||||
PFC.fogTint = atmo.fogTint.ToColor();
|
||||
|
||||
GameObject lodFogGO = new GameObject("LODFogSphere");
|
||||
lodFogGO.SetActive(false);
|
||||
lodFogGO.transform.parent = fogGO.transform;
|
||||
lodFogGO.transform.localScale = Vector3.one * atmo.Size / 320f;
|
||||
lodFogGO.transform.localScale = Vector3.one * atmo.size / 320f;
|
||||
|
||||
MeshFilter lodMF = lodFogGO.AddComponent<MeshFilter>();
|
||||
lodMF.mesh = brambleLODFog.GetComponent<MeshFilter>().mesh;
|
||||
|
||||
MeshRenderer lodMR = lodFogGO.AddComponent<MeshRenderer>();
|
||||
lodMR.material = new Material(brambleLODFog.GetComponent<MeshRenderer>().material);
|
||||
lodMR.material.color = atmo.FogTint.ToColor();
|
||||
lodMR.material.color = atmo.fogTint.ToColor();
|
||||
lodMR.material.renderQueue = 1000;
|
||||
|
||||
/*
|
||||
|
||||
@ -12,8 +12,8 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
GiantsDeepSunOverrideVolume GDSOV = overrideGO.AddComponent<GiantsDeepSunOverrideVolume>();
|
||||
GDSOV._sector = sector;
|
||||
GDSOV._cloudsOuterRadius = atmo.Size;
|
||||
GDSOV._cloudsInnerRadius = atmo.Size * 0.9f;
|
||||
GDSOV._cloudsOuterRadius = atmo.size;
|
||||
GDSOV._cloudsInnerRadius = atmo.size * 0.9f;
|
||||
GDSOV._waterOuterRadius = surfaceSize;
|
||||
GDSOV._waterInnerRadius = 0f;
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
|
||||
public static void Make(GameObject planetGO, PlanetConfig config, float sphereOfInfluence)
|
||||
{
|
||||
var innerRadius = config.Base.SurfaceSize;
|
||||
var innerRadius = config.Base.surfaceSize;
|
||||
|
||||
GameObject volumesGO = new GameObject("Volumes");
|
||||
volumesGO.SetActive(false);
|
||||
@ -30,8 +30,8 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
PlanetoidRuleset PR = rulesetGO.AddComponent<PlanetoidRuleset>();
|
||||
PR._altitudeFloor = innerRadius;
|
||||
PR._altitudeCeiling = sphereOfInfluence;
|
||||
PR._useMinimap = config.Base.ShowMinimap;
|
||||
PR._useAltimeter = config.Base.ShowMinimap;
|
||||
PR._useMinimap = config.Base.showMinimap;
|
||||
PR._useAltimeter = config.Base.showMinimap;
|
||||
|
||||
rulesetGO.AddComponent<AntiTravelMusicRuleset>();
|
||||
|
||||
@ -42,9 +42,9 @@ namespace NewHorizons.Builder.Atmosphere
|
||||
ER._material = gdRuleset._material;
|
||||
|
||||
var cloudMaterial = new Material(gdRuleset._cloudMaterial);
|
||||
if (config.Atmosphere?.Clouds?.Tint != null)
|
||||
if (config.Atmosphere?.clouds?.tint != null)
|
||||
{
|
||||
cloudMaterial.SetColor(FogColor, config.Atmosphere.Clouds.Tint.ToColor32());
|
||||
cloudMaterial.SetColor(FogColor, config.Atmosphere.clouds.tint.ToColor32());
|
||||
}
|
||||
ER._cloudMaterial = cloudMaterial;
|
||||
|
||||
|
||||
@ -13,55 +13,55 @@ namespace NewHorizons.Builder.Body
|
||||
{
|
||||
var belt = parentConfig.AsteroidBelt;
|
||||
|
||||
float minSize = belt.MinSize;
|
||||
float maxSize = belt.MaxSize;
|
||||
int count = (int)(2f * Mathf.PI * belt.InnerRadius / (10f * maxSize));
|
||||
if (belt.Amount >= 0) count = belt.Amount;
|
||||
float minSize = belt.minSize;
|
||||
float maxSize = belt.maxSize;
|
||||
int count = (int)(2f * Mathf.PI * belt.innerRadius / (10f * maxSize));
|
||||
if (belt.amount >= 0) count = belt.amount;
|
||||
if (count > 200) count = 200;
|
||||
|
||||
Random.InitState(belt.RandomSeed);
|
||||
Random.InitState(belt.randomSeed);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var size = Random.Range(minSize, maxSize);
|
||||
|
||||
var config = new PlanetConfig();
|
||||
config.Name = $"{bodyName} Asteroid {i}";
|
||||
config.StarSystem = parentConfig.StarSystem;
|
||||
config.name = $"{bodyName} Asteroid {i}";
|
||||
config.starSystem = parentConfig.starSystem;
|
||||
|
||||
config.Base = new BaseModule()
|
||||
{
|
||||
HasMapMarker = false,
|
||||
SurfaceGravity = 1,
|
||||
SurfaceSize = size,
|
||||
HasReferenceFrame = false,
|
||||
GravityFallOff = GravityFallOff.InverseSquared
|
||||
hasMapMarker = false,
|
||||
surfaceGravity = 1,
|
||||
surfaceSize = size,
|
||||
hasReferenceFrame = false,
|
||||
gravityFallOff = GravityFallOff.InverseSquared
|
||||
};
|
||||
|
||||
config.Orbit = new OrbitModule()
|
||||
{
|
||||
IsMoon = true,
|
||||
Inclination = belt.Inclination + Random.Range(-2f, 2f),
|
||||
LongitudeOfAscendingNode = belt.LongitudeOfAscendingNode,
|
||||
Inclination = belt.inclination + Random.Range(-2f, 2f),
|
||||
LongitudeOfAscendingNode = belt.longitudeOfAscendingNode,
|
||||
TrueAnomaly = 360f * (i + Random.Range(-0.2f, 0.2f)) / (float)count,
|
||||
PrimaryBody = bodyName,
|
||||
SemiMajorAxis = Random.Range(belt.InnerRadius, belt.OuterRadius),
|
||||
SemiMajorAxis = Random.Range(belt.innerRadius, belt.outerRadius),
|
||||
ShowOrbitLine = false
|
||||
};
|
||||
|
||||
config.ProcGen = belt.ProcGen;
|
||||
config.ProcGen = belt.procGen;
|
||||
if (config.ProcGen == null)
|
||||
{
|
||||
config.ProcGen = new ProcGenModule()
|
||||
{
|
||||
Scale = size,
|
||||
Color = new MColor(126, 94, 73, 255)
|
||||
scale = size,
|
||||
color = new MColor(126, 94, 73, 255)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
// Still update the size
|
||||
config.ProcGen.Scale = size;
|
||||
config.ProcGen.scale = size;
|
||||
}
|
||||
|
||||
var asteroid = new NewHorizonsBody(config, mod);
|
||||
|
||||
@ -9,10 +9,10 @@ namespace NewHorizons.Builder.Body
|
||||
var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), sector?.transform ?? planetGO.transform);
|
||||
cometTail.transform.position = planetGO.transform.position;
|
||||
cometTail.name = "CometTail";
|
||||
cometTail.transform.localScale = Vector3.one * config.Base.SurfaceSize / 110;
|
||||
cometTail.transform.localScale = Vector3.one * config.Base.surfaceSize / 110;
|
||||
|
||||
Vector3 alignment = new Vector3(0, 270, 90);
|
||||
if (config.Base.CometTailRotation != null) alignment = config.Base.CometTailRotation;
|
||||
if (config.Base.cometTailRotation != null) alignment = config.Base.cometTailRotation;
|
||||
|
||||
cometTail.transform.rotation = Quaternion.Euler(alignment);
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
public static void Make(GameObject planetGO, ConstantForceDetector detector, OWRigidbody rigidbody, FunnelModule module)
|
||||
{
|
||||
var funnelType = module.Type;
|
||||
var funnelType = module.type;
|
||||
|
||||
var funnelGO = new GameObject($"{planetGO.name.Replace("_Body", "")}Funnel_Body");
|
||||
funnelGO.SetActive(false);
|
||||
@ -68,9 +68,9 @@ namespace NewHorizons.Builder.Body
|
||||
for (int i = 0; i < waterMaterials.Length; i++)
|
||||
{
|
||||
materials[i] = new Material(waterMaterials[i]);
|
||||
if (module.Tint != null)
|
||||
if (module.tint != null)
|
||||
{
|
||||
materials[i].SetColor(FogColor, module.Tint.ToColor());
|
||||
materials[i].SetColor(FogColor, module.tint.ToColor());
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,9 +115,9 @@ namespace NewHorizons.Builder.Body
|
||||
lavaMaterial.mainTextureOffset = new Vector2(0.1f, 0.2f);
|
||||
lavaMaterial.mainTextureScale = new Vector2(1f, 3f);
|
||||
|
||||
if (module.Tint != null)
|
||||
if (module.tint != null)
|
||||
{
|
||||
lavaMaterial.SetColor(EmissionColor, module.Tint.ToColor());
|
||||
lavaMaterial.SetColor(EmissionColor, module.tint.ToColor());
|
||||
}
|
||||
|
||||
proxyGO.GetComponentInChildren<MeshRenderer>().material = lavaMaterial;
|
||||
@ -164,12 +164,12 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
private static void PostMake(GameObject funnelGO, FunnelController funnelSizeController, FunnelModule module)
|
||||
{
|
||||
var targetAO = AstroObjectLocator.GetAstroObject(module.Target);
|
||||
var targetAO = AstroObjectLocator.GetAstroObject(module.target);
|
||||
var target = targetAO?.GetAttachedOWRigidbody();
|
||||
if (target == null)
|
||||
{
|
||||
if (targetAO != null) Logger.LogError($"Found funnel target ({targetAO.name}) but couldn't find rigidbody for the funnel {funnelGO.name}");
|
||||
else Logger.LogError($"Couldn't find the target ({module.Target}) for the funnel {funnelGO.name}");
|
||||
else Logger.LogError($"Couldn't find the target ({module.target}) for the funnel {funnelGO.name}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -16,10 +16,10 @@ namespace NewHorizons.Builder.Body
|
||||
Texture2D heightMap, textureMap;
|
||||
try
|
||||
{
|
||||
if (module.HeightMap == null) heightMap = Texture2D.whiteTexture;
|
||||
else heightMap = ImageUtilities.GetTexture(mod, module.HeightMap);
|
||||
if (module.TextureMap == null) textureMap = Texture2D.whiteTexture;
|
||||
else textureMap = ImageUtilities.GetTexture(mod, module.TextureMap);
|
||||
if (module.heightMap == null) heightMap = Texture2D.whiteTexture;
|
||||
else heightMap = ImageUtilities.GetTexture(mod, module.heightMap);
|
||||
if (module.textureMap == null) textureMap = Texture2D.whiteTexture;
|
||||
else textureMap = ImageUtilities.GetTexture(mod, module.textureMap);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -32,8 +32,8 @@ namespace NewHorizons.Builder.Body
|
||||
cubeSphere.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
cubeSphere.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||
|
||||
Vector3 stretch = module.Stretch != null ? (Vector3)module.Stretch : Vector3.one;
|
||||
Mesh mesh = CubeSphere.Build(resolution, heightMap, module.MinHeight, module.MaxHeight, stretch);
|
||||
Vector3 stretch = module.stretch != null ? (Vector3)module.stretch : Vector3.one;
|
||||
Mesh mesh = CubeSphere.Build(resolution, heightMap, module.minHeight, module.maxHeight, stretch);
|
||||
|
||||
cubeSphere.AddComponent<MeshFilter>();
|
||||
cubeSphere.GetComponent<MeshFilter>().mesh = mesh;
|
||||
|
||||
@ -11,7 +11,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, LavaModule module)
|
||||
{
|
||||
var heightScale = module.Size;
|
||||
var heightScale = module.size;
|
||||
if (module.Curve != null)
|
||||
{
|
||||
var modifier = 1f;
|
||||
@ -26,13 +26,13 @@ namespace NewHorizons.Builder.Body
|
||||
moltenCore.SetActive(false);
|
||||
moltenCore.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
moltenCore.transform.position = planetGO.transform.position;
|
||||
moltenCore.transform.localScale = Vector3.one * module.Size;
|
||||
moltenCore.transform.localScale = Vector3.one * module.size;
|
||||
|
||||
var lavaSphere = GameObject.Instantiate(GameObject.Find("VolcanicMoon_Body/MoltenCore_VM/LavaSphere"), moltenCore.transform);
|
||||
lavaSphere.transform.localScale = Vector3.one;
|
||||
lavaSphere.transform.name = "LavaSphere";
|
||||
lavaSphere.GetComponent<MeshRenderer>().material.SetFloat(HeightScale, heightScale);
|
||||
if (module.Tint != null) lavaSphere.GetComponent<MeshRenderer>().material.SetColor(EmissionColor, module.Tint.ToColor());
|
||||
if (module.tint != null) lavaSphere.GetComponent<MeshRenderer>().material.SetColor(EmissionColor, module.tint.ToColor());
|
||||
|
||||
var sectorCullGroup = lavaSphere.GetComponent<SectorCullGroup>();
|
||||
sectorCullGroup.SetSector(sector);
|
||||
@ -44,7 +44,7 @@ namespace NewHorizons.Builder.Body
|
||||
proxyLavaSphere.transform.localScale = Vector3.one;
|
||||
proxyLavaSphere.name = "LavaSphere_Proxy";
|
||||
proxyLavaSphere.GetComponent<MeshRenderer>().material.SetFloat(HeightScale, heightScale);
|
||||
if (module.Tint != null) proxyLavaSphere.GetComponent<MeshRenderer>().material.SetColor(EmissionColor, module.Tint.ToColor());
|
||||
if (module.tint != null) proxyLavaSphere.GetComponent<MeshRenderer>().material.SetColor(EmissionColor, module.tint.ToColor());
|
||||
|
||||
var sectorProxy = moltenCoreProxy.GetComponent<SectorProxy>();
|
||||
sectorProxy._renderers = new List<Renderer> { proxyLavaSphere.GetComponent<MeshRenderer>() };
|
||||
@ -60,7 +60,7 @@ namespace NewHorizons.Builder.Body
|
||||
var curve = new AnimationCurve();
|
||||
foreach (var pair in module.Curve)
|
||||
{
|
||||
curve.AddKey(new Keyframe(pair.Time, module.Size * pair.Value));
|
||||
curve.AddKey(new Keyframe(pair.Time, module.size * pair.Value));
|
||||
}
|
||||
levelController._scaleCurve = curve;
|
||||
}
|
||||
|
||||
@ -20,14 +20,14 @@ namespace NewHorizons.Builder.Body
|
||||
icosphere.transform.rotation = Quaternion.Euler(90, 0, 0);
|
||||
icosphere.transform.position = planetGO.transform.position;
|
||||
|
||||
Mesh mesh = Icosphere.Build(4, module.Scale, module.Scale * 1.2f);
|
||||
Mesh mesh = Icosphere.Build(4, module.scale, module.scale * 1.2f);
|
||||
|
||||
icosphere.AddComponent<MeshFilter>();
|
||||
icosphere.GetComponent<MeshFilter>().mesh = mesh;
|
||||
|
||||
var cubeSphereMR = icosphere.AddComponent<MeshRenderer>();
|
||||
cubeSphereMR.material = new Material(Shader.Find("Standard"));
|
||||
cubeSphereMR.material.color = module.Color != null ? module.Color.ToColor() : Color.white;
|
||||
cubeSphereMR.material.color = module.color != null ? module.color.ToColor() : Color.white;
|
||||
|
||||
var cubeSphereMC = icosphere.AddComponent<MeshCollider>();
|
||||
cubeSphereMC.sharedMesh = mesh;
|
||||
|
||||
@ -31,60 +31,60 @@ namespace NewHorizons.Builder.Body
|
||||
{
|
||||
if (lavaMaterial == null) lavaMaterial = SearchUtilities.FindObjectOfTypeAndName<ProxyOrbiter>("VolcanicMoon_Body").transform.Find("LavaSphere").GetComponent<MeshRenderer>().material;
|
||||
|
||||
var proxyName = $"{body.Config.Name}_Proxy";
|
||||
var proxyName = $"{body.Config.name}_Proxy";
|
||||
|
||||
var newProxy = new GameObject(proxyName);
|
||||
|
||||
try
|
||||
{
|
||||
// We want to take the largest size I think
|
||||
var realSize = body.Config.Base.SurfaceSize;
|
||||
var realSize = body.Config.Base.surfaceSize;
|
||||
|
||||
if (body.Config.HeightMap != null)
|
||||
{
|
||||
HeightMapBuilder.Make(newProxy, null, body.Config.HeightMap, body.Mod, 20);
|
||||
if (realSize < body.Config.HeightMap.MaxHeight) realSize = body.Config.HeightMap.MaxHeight;
|
||||
if (realSize < body.Config.HeightMap.maxHeight) realSize = body.Config.HeightMap.maxHeight;
|
||||
}
|
||||
if (body.Config.Base.GroundSize != 0)
|
||||
if (body.Config.Base.groundSize != 0)
|
||||
{
|
||||
GeometryBuilder.Make(newProxy, null, body.Config.Base.GroundSize);
|
||||
if (realSize < body.Config.Base.GroundSize) realSize = body.Config.Base.GroundSize;
|
||||
GeometryBuilder.Make(newProxy, null, body.Config.Base.groundSize);
|
||||
if (realSize < body.Config.Base.groundSize) realSize = body.Config.Base.groundSize;
|
||||
}
|
||||
if (body.Config.Atmosphere?.Clouds != null)
|
||||
if (body.Config.Atmosphere?.clouds != null)
|
||||
{
|
||||
CloudsBuilder.MakeTopClouds(newProxy, body.Config.Atmosphere, body.Mod);
|
||||
if (realSize < body.Config.Atmosphere.Size) realSize = body.Config.Atmosphere.Size;
|
||||
if (realSize < body.Config.Atmosphere.size) realSize = body.Config.Atmosphere.size;
|
||||
}
|
||||
if (body.Config.Ring != null)
|
||||
{
|
||||
RingBuilder.MakeRingGraphics(newProxy, null, body.Config.Ring, body.Mod);
|
||||
if (realSize < body.Config.Ring.OuterRadius) realSize = body.Config.Ring.OuterRadius;
|
||||
if (realSize < body.Config.Ring.outerRadius) realSize = body.Config.Ring.outerRadius;
|
||||
}
|
||||
if (body.Config.Star != null)
|
||||
{
|
||||
var starGO = StarBuilder.MakeStarProxy(planetGO, newProxy, body.Config.Star);
|
||||
|
||||
if (realSize < body.Config.Star.Size) realSize = body.Config.Star.Size;
|
||||
if (realSize < body.Config.Star.size) realSize = body.Config.Star.size;
|
||||
}
|
||||
if (body.Config.ProcGen != null)
|
||||
{
|
||||
ProcGenBuilder.Make(newProxy, null, body.Config.ProcGen);
|
||||
if (realSize < body.Config.ProcGen.Scale) realSize = body.Config.ProcGen.Scale;
|
||||
if (realSize < body.Config.ProcGen.scale) realSize = body.Config.ProcGen.scale;
|
||||
}
|
||||
if (body.Config.Lava != null)
|
||||
{
|
||||
var sphere = AddColouredSphere(newProxy, body.Config.Lava.Size, body.Config.Lava.Curve, Color.black);
|
||||
if (realSize < body.Config.Lava.Size) realSize = body.Config.Lava.Size;
|
||||
var sphere = AddColouredSphere(newProxy, body.Config.Lava.size, body.Config.Lava.Curve, Color.black);
|
||||
if (realSize < body.Config.Lava.size) realSize = body.Config.Lava.size;
|
||||
|
||||
var material = new Material(lavaMaterial);
|
||||
if (body.Config.Lava.Tint != null) material.SetColor(EmissionColor, body.Config.Lava.Tint.ToColor());
|
||||
if (body.Config.Lava.tint != null) material.SetColor(EmissionColor, body.Config.Lava.tint.ToColor());
|
||||
sphere.GetComponent<MeshRenderer>().material = material;
|
||||
}
|
||||
if (body.Config.Water != null)
|
||||
{
|
||||
var colour = body.Config.Water.Tint?.ToColor() ?? Color.blue;
|
||||
AddColouredSphere(newProxy, body.Config.Water.Size, body.Config.Water.Curve, colour);
|
||||
if (realSize < body.Config.Water.Size) realSize = body.Config.Water.Size;
|
||||
var colour = body.Config.Water.tint?.ToColor() ?? Color.blue;
|
||||
AddColouredSphere(newProxy, body.Config.Water.size, body.Config.Water.Curve, colour);
|
||||
if (realSize < body.Config.Water.size) realSize = body.Config.Water.size;
|
||||
}
|
||||
if (body.Config.Sand != null)
|
||||
{
|
||||
@ -95,24 +95,24 @@ namespace NewHorizons.Builder.Body
|
||||
// Could improve this to actually use the proper renders and materials
|
||||
if (body.Config.Singularity != null)
|
||||
{
|
||||
if (body.Config.Singularity.Type == SingularityModule.SingularityType.BlackHole)
|
||||
if (body.Config.Singularity.type == SingularityModule.SingularityType.BlackHole)
|
||||
{
|
||||
MakeBlackHole(newProxy, body.Config.Singularity.Size);
|
||||
MakeBlackHole(newProxy, body.Config.Singularity.size);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeWhiteHole(newProxy, body.Config.Singularity.Size);
|
||||
MakeWhiteHole(newProxy, body.Config.Singularity.size);
|
||||
}
|
||||
|
||||
if (realSize < body.Config.Singularity.Size) realSize = body.Config.Singularity.Size;
|
||||
if (realSize < body.Config.Singularity.size) realSize = body.Config.Singularity.size;
|
||||
}
|
||||
if (body.Config.Base.HasCometTail)
|
||||
if (body.Config.Base.hasCometTail)
|
||||
{
|
||||
CometTailBuilder.Make(newProxy, null, body.Config);
|
||||
}
|
||||
if (body.Config.Props?.ProxyDetails != null)
|
||||
if (body.Config.Props?.proxyDetails != null)
|
||||
{
|
||||
foreach (var detailInfo in body.Config.Props.ProxyDetails)
|
||||
foreach (var detailInfo in body.Config.Props.proxyDetails)
|
||||
{
|
||||
DetailBuilder.Make(newProxy, null, body.Config, body.Mod, body.Mod.ModHelper.Manifest.UniqueName, detailInfo);
|
||||
}
|
||||
@ -136,12 +136,12 @@ namespace NewHorizons.Builder.Body
|
||||
}
|
||||
|
||||
var proxyController = newProxy.AddComponent<NHProxy>();
|
||||
proxyController.astroName = body.Config.Name;
|
||||
proxyController.astroName = body.Config.name;
|
||||
proxyController._realObjectDiameter = realSize;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Exception thrown when generating proxy for [{body.Config.Name}] : {ex.Message}, {ex.StackTrace}");
|
||||
Logger.LogError($"Exception thrown when generating proxy for [{body.Config.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
GameObject.Destroy(newProxy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,8 +33,8 @@ namespace NewHorizons.Builder.Body
|
||||
ringVolume.layer = LayerMask.NameToLayer("BasicEffectVolume");
|
||||
|
||||
var ringShape = ringVolume.AddComponent<RingShape>();
|
||||
ringShape.innerRadius = ring.InnerRadius;
|
||||
ringShape.outerRadius = ring.OuterRadius;
|
||||
ringShape.innerRadius = ring.innerRadius;
|
||||
ringShape.outerRadius = ring.outerRadius;
|
||||
ringShape.height = 20f;
|
||||
ringShape.center = Vector3.zero;
|
||||
ringShape.SetCollisionMode(Shape.CollisionMode.Volume);
|
||||
@ -48,15 +48,15 @@ namespace NewHorizons.Builder.Body
|
||||
var sfv = ringVolume.AddComponent<SimpleFluidVolume>();
|
||||
var fluidType = FluidVolume.Type.NONE;
|
||||
|
||||
if (ring.FluidType != null)
|
||||
if (ring.fluidType != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(CloudFluidType), ring.FluidType).ToUpper());
|
||||
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(CloudFluidType), ring.fluidType).ToUpper());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't parse fluid volume type [{ring.FluidType}]: {ex.Message}, {ex.StackTrace}");
|
||||
Logger.LogError($"Couldn't parse fluid volume type [{ring.fluidType}]: {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,12 +73,12 @@ namespace NewHorizons.Builder.Body
|
||||
public static GameObject MakeRingGraphics(GameObject rootObject, Sector sector, RingModule ring, IModBehaviour mod)
|
||||
{
|
||||
// Properly lit shader doesnt work yet
|
||||
ring.Unlit = true;
|
||||
ring.unlit = true;
|
||||
|
||||
Texture2D ringTexture;
|
||||
try
|
||||
{
|
||||
ringTexture = ImageUtilities.GetTexture(mod, ring.Texture);
|
||||
ringTexture = ImageUtilities.GetTexture(mod, ring.texture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -90,8 +90,8 @@ namespace NewHorizons.Builder.Body
|
||||
ringGO.transform.parent = sector?.transform ?? rootObject.transform;
|
||||
ringGO.transform.position = rootObject.transform.position;
|
||||
ringGO.transform.rotation = rootObject.transform.rotation;
|
||||
ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.up), ring.LongitudeOfAscendingNode);
|
||||
ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.left), ring.Inclination);
|
||||
ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.up), ring.longitudeOfAscendingNode);
|
||||
ringGO.transform.Rotate(ringGO.transform.TransformDirection(Vector3.left), ring.inclination);
|
||||
|
||||
var ringMF = ringGO.AddComponent<MeshFilter>();
|
||||
var ringMesh = ringMF.mesh;
|
||||
@ -103,26 +103,26 @@ namespace NewHorizons.Builder.Body
|
||||
if (RingShader1Pixel == null) RingShader1Pixel = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring1Pixel.shader");
|
||||
if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader");
|
||||
|
||||
var mat = new Material(ring.Unlit ? UnlitRingShader : RingShader);
|
||||
var mat = new Material(ring.unlit ? UnlitRingShader : RingShader);
|
||||
if (texture.width == 1)
|
||||
{
|
||||
mat = new Material(ring.Unlit ? UnlitRingShader1Pixel : RingShader1Pixel);
|
||||
mat = new Material(ring.unlit ? UnlitRingShader1Pixel : RingShader1Pixel);
|
||||
mat.SetFloat(InnerRadius, 0);
|
||||
}
|
||||
ringMR.receiveShadows = !ring.Unlit;
|
||||
ringMR.receiveShadows = !ring.unlit;
|
||||
|
||||
mat.mainTexture = texture;
|
||||
mat.renderQueue = 3000;
|
||||
ringMR.material = mat;
|
||||
|
||||
// Make mesh
|
||||
var segments = (int)Mathf.Clamp(ring.OuterRadius, 20, 2000);
|
||||
BuildRingMesh(ringMesh, segments, ring.InnerRadius, ring.OuterRadius);
|
||||
var segments = (int)Mathf.Clamp(ring.outerRadius, 20, 2000);
|
||||
BuildRingMesh(ringMesh, segments, ring.innerRadius, ring.outerRadius);
|
||||
|
||||
if (ring.RotationSpeed != 0)
|
||||
if (ring.rotationSpeed != 0)
|
||||
{
|
||||
var rot = ringGO.AddComponent<RotateTransform>();
|
||||
rot._degreesPerSecond = ring.RotationSpeed;
|
||||
rot._degreesPerSecond = ring.rotationSpeed;
|
||||
rot._localAxis = Vector3.down;
|
||||
}
|
||||
|
||||
|
||||
@ -20,23 +20,23 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
public static void Make(GameObject go, Sector sector, OWRigidbody OWRB, PlanetConfig config)
|
||||
{
|
||||
var size = config.Singularity.Size;
|
||||
var pairedSingularity = config.Singularity.PairedSingularity;
|
||||
var size = config.Singularity.size;
|
||||
var pairedSingularity = config.Singularity.pairedSingularity;
|
||||
|
||||
var polarity = config.Singularity.Type;
|
||||
var polarity = config.Singularity.type;
|
||||
|
||||
bool isWormHole = config.Singularity?.TargetStarSystem != null;
|
||||
bool isWormHole = config.Singularity?.targetStarSystem != null;
|
||||
bool hasHazardVolume = !isWormHole && (pairedSingularity == null);
|
||||
|
||||
bool makeZeroGVolume = config.Singularity == null ? true : config.Singularity.MakeZeroGVolume;
|
||||
bool makeZeroGVolume = config.Singularity == null ? true : config.Singularity.makeZeroGVolume;
|
||||
|
||||
Vector3 localPosition = config.Singularity?.Position == null ? Vector3.zero : (Vector3)config.Singularity.Position;
|
||||
Vector3 localPosition = config.Singularity?.position == null ? Vector3.zero : (Vector3)config.Singularity.position;
|
||||
|
||||
GameObject newSingularity = null;
|
||||
switch (polarity)
|
||||
{
|
||||
case SingularityModule.SingularityType.BlackHole:
|
||||
newSingularity = MakeBlackHole(go, sector, localPosition, size, hasHazardVolume, config.Singularity.TargetStarSystem);
|
||||
newSingularity = MakeBlackHole(go, sector, localPosition, size, hasHazardVolume, config.Singularity.targetStarSystem);
|
||||
break;
|
||||
case SingularityModule.SingularityType.WhiteHole:
|
||||
newSingularity = MakeWhiteHole(go, sector, OWRB, localPosition, size, makeZeroGVolume);
|
||||
|
||||
@ -25,7 +25,7 @@ namespace NewHorizons.Builder.Body
|
||||
var sunAudio = GameObject.Instantiate(GameObject.Find("Sun_Body/Sector_SUN/Audio_SUN"), starGO.transform);
|
||||
sunAudio.transform.localPosition = Vector3.zero;
|
||||
sunAudio.transform.localScale = Vector3.one;
|
||||
sunAudio.transform.Find("SurfaceAudio_Sun").GetComponent<AudioSource>().maxDistance = starModule.Size * 2f;
|
||||
sunAudio.transform.Find("SurfaceAudio_Sun").GetComponent<AudioSource>().maxDistance = starModule.size * 2f;
|
||||
var surfaceAudio = sunAudio.GetComponentInChildren<SunSurfaceAudioController>();
|
||||
surfaceAudio.SetSector(sector);
|
||||
surfaceAudio._sunController = null;
|
||||
@ -33,28 +33,28 @@ namespace NewHorizons.Builder.Body
|
||||
sunAudio.name = "Audio_Star";
|
||||
|
||||
GameObject sunAtmosphere = null;
|
||||
if (starModule.HasAtmosphere)
|
||||
if (starModule.hasAtmosphere)
|
||||
{
|
||||
sunAtmosphere = GameObject.Instantiate(GameObject.Find("Sun_Body/Atmosphere_SUN"), starGO.transform);
|
||||
sunAtmosphere.transform.position = planetGO.transform.position;
|
||||
sunAtmosphere.transform.localScale = Vector3.one * OuterRadiusRatio;
|
||||
sunAtmosphere.name = "Atmosphere_Star";
|
||||
PlanetaryFogController fog = sunAtmosphere.transform.Find("FogSphere").GetComponent<PlanetaryFogController>();
|
||||
if (starModule.Tint != null)
|
||||
if (starModule.tint != null)
|
||||
{
|
||||
fog.fogTint = starModule.Tint.ToColor();
|
||||
fog.fogTint = starModule.tint.ToColor();
|
||||
sunAtmosphere.transform.Find("AtmoSphere").transform.localScale = Vector3.one;
|
||||
foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>())
|
||||
{
|
||||
lod.material.SetColor(SkyColor, starModule.Tint.ToColor());
|
||||
lod.material.SetColor(AtmosFar, starModule.Tint.ToColor());
|
||||
lod.material.SetColor(AtmosNear, starModule.Tint.ToColor());
|
||||
lod.material.SetFloat(InnerRadius, starModule.Size);
|
||||
lod.material.SetFloat(OuterRadius, starModule.Size * OuterRadiusRatio);
|
||||
lod.material.SetColor(SkyColor, starModule.tint.ToColor());
|
||||
lod.material.SetColor(AtmosFar, starModule.tint.ToColor());
|
||||
lod.material.SetColor(AtmosNear, starModule.tint.ToColor());
|
||||
lod.material.SetFloat(InnerRadius, starModule.size);
|
||||
lod.material.SetFloat(OuterRadius, starModule.size * OuterRadiusRatio);
|
||||
}
|
||||
}
|
||||
fog.transform.localScale = Vector3.one;
|
||||
fog.fogRadius = starModule.Size * OuterRadiusRatio;
|
||||
fog.fogRadius = starModule.size * OuterRadiusRatio;
|
||||
fog.lodFadeDistance = fog.fogRadius * (StarBuilder.OuterRadiusRatio - 1f);
|
||||
}
|
||||
|
||||
@ -86,11 +86,11 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
var light = sunLight.AddComponent<Light>();
|
||||
light.CopyPropertiesFrom(GameObject.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<Light>());
|
||||
light.intensity *= starModule.SolarLuminosity;
|
||||
light.range *= Mathf.Sqrt(starModule.SolarLuminosity);
|
||||
light.intensity *= starModule.solarLuminosity;
|
||||
light.range *= Mathf.Sqrt(starModule.solarLuminosity);
|
||||
|
||||
Color lightColour = light.color;
|
||||
if (starModule.LightTint != null) lightColour = starModule.LightTint.ToColor();
|
||||
if (starModule.lightTint != null) lightColour = starModule.lightTint.ToColor();
|
||||
|
||||
light.color = lightColour;
|
||||
ambientLight.color = lightColour;
|
||||
@ -105,7 +105,7 @@ namespace NewHorizons.Builder.Body
|
||||
proxyShadowLight._light = light;
|
||||
|
||||
StarController starController = null;
|
||||
if (starModule.SolarLuminosity != 0)
|
||||
if (starModule.solarLuminosity != 0)
|
||||
{
|
||||
starController = planetGO.AddComponent<StarController>();
|
||||
starController.Light = light;
|
||||
@ -113,7 +113,7 @@ namespace NewHorizons.Builder.Body
|
||||
starController.FaceActiveCamera = faceActiveCamera;
|
||||
starController.CSMTextureCacher = csmTextureCacher;
|
||||
starController.ProxyShadowLight = proxyShadowLight;
|
||||
starController.Intensity = starModule.SolarLuminosity;
|
||||
starController.Intensity = starModule.solarLuminosity;
|
||||
starController.SunColor = lightColour;
|
||||
}
|
||||
|
||||
@ -121,12 +121,12 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
var controller = starGO.AddComponent<StarEvolutionController>();
|
||||
if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve();
|
||||
controller.size = starModule.Size;
|
||||
controller.size = starModule.size;
|
||||
controller.atmosphere = sunAtmosphere;
|
||||
controller.supernova = supernova;
|
||||
controller.startColour = starModule.Tint;
|
||||
controller.endColour = starModule.EndTint;
|
||||
controller.willExplode = starModule.GoSupernova;
|
||||
controller.startColour = starModule.tint;
|
||||
controller.endColour = starModule.endTint;
|
||||
controller.willExplode = starModule.goSupernova;
|
||||
|
||||
// It fucking insists on this existing and its really annoying
|
||||
var supernovaVolume = new GameObject("SupernovaVolumePlaceholder");
|
||||
@ -147,10 +147,10 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
var controller = starGO.AddComponent<StarEvolutionController>();
|
||||
if (starModule.Curve != null) controller.scaleCurve = starModule.GetAnimationCurve();
|
||||
controller.size = starModule.Size;
|
||||
controller.size = starModule.size;
|
||||
controller.supernova = supernova;
|
||||
controller.startColour = starModule.Tint;
|
||||
controller.endColour = starModule.EndTint;
|
||||
controller.startColour = starModule.tint;
|
||||
controller.endColour = starModule.endTint;
|
||||
controller.enabled = true;
|
||||
|
||||
planet.GetComponentInChildren<StarEvolutionController>().SetProxy(controller);
|
||||
@ -175,9 +175,9 @@ namespace NewHorizons.Builder.Body
|
||||
solarFlareEmitter.transform.localScale = Vector3.one;
|
||||
solarFlareEmitter.name = "SolarFlareEmitter";
|
||||
|
||||
if (starModule.Tint != null)
|
||||
if (starModule.tint != null)
|
||||
{
|
||||
var flareTint = starModule.Tint.ToColor();
|
||||
var flareTint = starModule.tint.ToColor();
|
||||
var emitter = solarFlareEmitter.GetComponent<SolarFlareEmitter>();
|
||||
emitter.tint = flareTint;
|
||||
foreach (var controller in solarFlareEmitter.GetComponentsInChildren<SolarFlareController>())
|
||||
@ -189,29 +189,29 @@ namespace NewHorizons.Builder.Body
|
||||
}
|
||||
|
||||
starGO.transform.position = rootObject.transform.position;
|
||||
starGO.transform.localScale = starModule.Size * Vector3.one;
|
||||
starGO.transform.localScale = starModule.size * Vector3.one;
|
||||
|
||||
if (starModule.Tint != null)
|
||||
if (starModule.tint != null)
|
||||
{
|
||||
TessellatedSphereRenderer surface = sunSurface.GetComponent<TessellatedSphereRenderer>();
|
||||
|
||||
var colour = starModule.Tint.ToColor();
|
||||
var colour = starModule.tint.ToColor();
|
||||
|
||||
var sun = GameObject.Find("Sun_Body");
|
||||
var mainSequenceMaterial = sun.GetComponent<SunController>().GetValue<Material>("_startSurfaceMaterial");
|
||||
var giantMaterial = sun.GetComponent<SunController>().GetValue<Material>("_endSurfaceMaterial");
|
||||
|
||||
surface.sharedMaterial = new Material(starModule.Size >= 3000 ? giantMaterial : mainSequenceMaterial);
|
||||
var mod = Mathf.Max(1f, 2f * Mathf.Sqrt(starModule.SolarLuminosity));
|
||||
surface.sharedMaterial = new Material(starModule.size >= 3000 ? giantMaterial : mainSequenceMaterial);
|
||||
var mod = Mathf.Max(1f, 2f * Mathf.Sqrt(starModule.solarLuminosity));
|
||||
var adjustedColour = new Color(colour.r * mod, colour.g * mod, colour.b * mod);
|
||||
surface.sharedMaterial.color = adjustedColour;
|
||||
|
||||
Color.RGBToHSV(adjustedColour, out float H, out float S, out float V);
|
||||
var darkenedColor = Color.HSVToRGB(H, S * 1.2f, V * 0.05f);
|
||||
|
||||
if (starModule.EndTint != null)
|
||||
if (starModule.endTint != null)
|
||||
{
|
||||
var endColour = starModule.EndTint.ToColor();
|
||||
var endColour = starModule.endTint.ToColor();
|
||||
darkenedColor = new Color(endColour.r * mod, endColour.g * mod, endColour.b * mod);
|
||||
}
|
||||
|
||||
@ -231,9 +231,9 @@ namespace NewHorizons.Builder.Body
|
||||
supernova._surface = starGO.GetComponentInChildren<TessellatedSphereRenderer>();
|
||||
supernova._supernovaVolume = null;
|
||||
|
||||
if (starModule.SupernovaTint != null)
|
||||
if (starModule.supernovaTint != null)
|
||||
{
|
||||
var colour = starModule.SupernovaTint.ToColor();
|
||||
var colour = starModule.supernovaTint.ToColor();
|
||||
|
||||
var supernovaMaterial = new Material(supernova._supernovaMaterial);
|
||||
var ramp = ImageUtilities.LerpGreyscaleImage(ImageUtilities.GetTexture(Main.Instance, "AssetBundle/Effects_SUN_Supernova_d.png"), Color.white, colour);
|
||||
|
||||
@ -14,7 +14,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, WaterModule module)
|
||||
{
|
||||
var waterSize = module.Size;
|
||||
var waterSize = module.size;
|
||||
|
||||
GameObject waterGO = new GameObject("Water");
|
||||
waterGO.SetActive(false);
|
||||
@ -38,10 +38,10 @@ namespace NewHorizons.Builder.Body
|
||||
for (int i = 0; i < GDSharedMaterials.Length; i++)
|
||||
{
|
||||
tempArray[i] = new Material(GDSharedMaterials[i]);
|
||||
if (module.Tint != null)
|
||||
if (module.tint != null)
|
||||
{
|
||||
tempArray[i].color = module.Tint.ToColor();
|
||||
tempArray[i].SetColor("_FogColor", module.Tint.ToColor());
|
||||
tempArray[i].color = module.tint.ToColor();
|
||||
tempArray[i].SetColor("_FogColor", module.tint.ToColor());
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,9 +83,9 @@ namespace NewHorizons.Builder.Body
|
||||
fogGO.transform.localPosition = Vector3.zero;
|
||||
fogGO.transform.localScale = Vector3.one;
|
||||
|
||||
if (module.Tint != null)
|
||||
if (module.tint != null)
|
||||
{
|
||||
var adjustedColour = module.Tint.ToColor() / 4f;
|
||||
var adjustedColour = module.tint.ToColor() / 4f;
|
||||
adjustedColour.a = adjustedColour.a * 4f;
|
||||
fogGO.GetComponent<MeshRenderer>().material.color = adjustedColour;
|
||||
}
|
||||
@ -100,12 +100,12 @@ namespace NewHorizons.Builder.Body
|
||||
}
|
||||
sizeController.scaleCurve = curve;
|
||||
sizeController.oceanFogMaterial = fogGO.GetComponent<MeshRenderer>().material;
|
||||
sizeController.size = module.Size;
|
||||
sizeController.size = module.size;
|
||||
}
|
||||
else
|
||||
{
|
||||
fogGO.GetComponent<MeshRenderer>().material.SetFloat(Radius, module.Size);
|
||||
fogGO.GetComponent<MeshRenderer>().material.SetFloat(Radius2, module.Size / 2f);
|
||||
fogGO.GetComponent<MeshRenderer>().material.SetFloat(Radius, module.size);
|
||||
fogGO.GetComponent<MeshRenderer>().material.SetFloat(Radius2, module.size / 2f);
|
||||
}
|
||||
|
||||
// TODO: make LOD work
|
||||
|
||||
@ -9,19 +9,19 @@ namespace NewHorizons.Builder.General
|
||||
public static NHAstroObject Make(GameObject body, AstroObject primaryBody, PlanetConfig config)
|
||||
{
|
||||
NHAstroObject astroObject = body.AddComponent<NHAstroObject>();
|
||||
astroObject.HideDisplayName = !config.Base.HasMapMarker;
|
||||
astroObject.HideDisplayName = !config.Base.hasMapMarker;
|
||||
|
||||
if (config.Orbit != null) astroObject.SetOrbitalParametersFromConfig(config.Orbit);
|
||||
|
||||
var type = AstroObject.Type.Planet;
|
||||
if (config.Orbit.IsMoon) type = AstroObject.Type.Moon;
|
||||
// else if (config.Base.IsSatellite) type = AstroObject.Type.Satellite;
|
||||
else if (config.Base.HasCometTail) type = AstroObject.Type.Comet;
|
||||
else if (config.Base.hasCometTail) type = AstroObject.Type.Comet;
|
||||
else if (config.Star != null) type = AstroObject.Type.Star;
|
||||
else if (config.FocalPoint != null) type = AstroObject.Type.None;
|
||||
astroObject._type = type;
|
||||
astroObject._name = AstroObject.Name.CustomString;
|
||||
astroObject._customName = config.Name;
|
||||
astroObject._customName = config.name;
|
||||
astroObject._primaryBody = primaryBody;
|
||||
|
||||
// Expand gravitational sphere of influence of the primary to encompass this body if needed
|
||||
@ -47,9 +47,9 @@ namespace NewHorizons.Builder.General
|
||||
}
|
||||
}
|
||||
|
||||
if (config.Base.CenterOfSolarSystem)
|
||||
if (config.Base.centerOfSolarSystem)
|
||||
{
|
||||
Logger.Log($"Setting center of universe to {config.Name}");
|
||||
Logger.Log($"Setting center of universe to {config.name}");
|
||||
// By the time it runs we'll be able to get the OWRB with the method
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => Locator.GetCenterOfTheUniverse()._staticReferenceFrame = astroObject.GetAttachedOWRigidbody(), 2);
|
||||
}
|
||||
|
||||
@ -19,13 +19,13 @@ namespace NewHorizons.Builder.General
|
||||
OWRB.RegisterAttachedForceDetector(forceDetector);
|
||||
|
||||
// For falling into sun
|
||||
if (!config.Base.InvulnerableToSun && config.Star == null && config.FocalPoint == null)
|
||||
if (!config.Base.invulnerableToSun && config.Star == null && config.FocalPoint == null)
|
||||
{
|
||||
detectorGO.layer = LayerMask.NameToLayer("AdvancedDetector");
|
||||
|
||||
var fluidDetector = detectorGO.AddComponent<DynamicFluidDetector>();
|
||||
var sphereCollider = detectorGO.AddComponent<SphereCollider>();
|
||||
sphereCollider.radius = config.Base.SurfaceSize;
|
||||
sphereCollider.radius = config.Base.surfaceSize;
|
||||
|
||||
var owCollider = detectorGO.AddComponent<OWCollider>();
|
||||
|
||||
|
||||
@ -8,17 +8,17 @@ namespace NewHorizons.Builder.General
|
||||
{
|
||||
public static GravityVolume Make(GameObject planetGO, AstroObject ao, PlanetConfig config)
|
||||
{
|
||||
var exponent = config.Base.GravityFallOff == GravityFallOff.Linear ? 1f : 2f;
|
||||
var GM = config.Base.SurfaceGravity * Mathf.Pow(config.Base.SurfaceSize, exponent);
|
||||
var exponent = config.Base.gravityFallOff == GravityFallOff.Linear ? 1f : 2f;
|
||||
var GM = config.Base.surfaceGravity * Mathf.Pow(config.Base.surfaceSize, exponent);
|
||||
|
||||
// Gravity limit will be when the acceleration it would cause is less than 0.1 m/s^2
|
||||
var gravityRadius = GM / 0.1f;
|
||||
if (exponent == 2f) gravityRadius = Mathf.Sqrt(gravityRadius);
|
||||
|
||||
// To let you actually orbit things the way you would expect we cap this at 4x the diameter if its not a star or black hole (this is what giants deep has)
|
||||
if (config.Star == null && config.Singularity == null) gravityRadius = Mathf.Min(gravityRadius, 4 * config.Base.SurfaceSize);
|
||||
else gravityRadius = Mathf.Min(gravityRadius, 15 * config.Base.SurfaceSize);
|
||||
if (config.Base.SphereOfInfluence != 0f) gravityRadius = config.Base.SphereOfInfluence;
|
||||
if (config.Star == null && config.Singularity == null) gravityRadius = Mathf.Min(gravityRadius, 4 * config.Base.surfaceSize);
|
||||
else gravityRadius = Mathf.Min(gravityRadius, 15 * config.Base.surfaceSize);
|
||||
if (config.Base.sphereOfInfluence != 0f) gravityRadius = config.Base.sphereOfInfluence;
|
||||
|
||||
var gravityGO = new GameObject("GravityWell");
|
||||
gravityGO.transform.parent = planetGO.transform;
|
||||
@ -38,21 +38,21 @@ namespace NewHorizons.Builder.General
|
||||
var gravityVolume = gravityGO.AddComponent<GravityVolume>();
|
||||
gravityVolume._cutoffAcceleration = 0.1f;
|
||||
|
||||
var falloff = config.Base.GravityFallOff == GravityFallOff.Linear? GravityVolume.FalloffType.linear : GravityVolume.FalloffType.inverseSquared;
|
||||
var falloff = config.Base.gravityFallOff == GravityFallOff.Linear? GravityVolume.FalloffType.linear : GravityVolume.FalloffType.inverseSquared;
|
||||
|
||||
gravityVolume._falloffType = falloff;
|
||||
|
||||
// Radius where your feet turn to the planet
|
||||
var alignmentRadius = config.Atmosphere?.Clouds?.OuterCloudRadius ?? 1.5f * config.Base.SurfaceSize;
|
||||
if (config.Base.SurfaceGravity == 0) alignmentRadius = 0;
|
||||
var alignmentRadius = config.Atmosphere?.clouds?.outerCloudRadius ?? 1.5f * config.Base.surfaceSize;
|
||||
if (config.Base.surfaceGravity == 0) alignmentRadius = 0;
|
||||
|
||||
gravityVolume._alignmentRadius = alignmentRadius;
|
||||
gravityVolume._upperSurfaceRadius = config.Base.SurfaceSize;
|
||||
gravityVolume._upperSurfaceRadius = config.Base.surfaceSize;
|
||||
gravityVolume._lowerSurfaceRadius = 0;
|
||||
gravityVolume._layer = 3;
|
||||
gravityVolume._priority = 0;
|
||||
gravityVolume._alignmentPriority = 0;
|
||||
gravityVolume._surfaceAcceleration = config.Base.SurfaceGravity;
|
||||
gravityVolume._surfaceAcceleration = config.Base.surfaceGravity;
|
||||
gravityVolume._inheritable = false;
|
||||
gravityVolume._isPlanetGravityVolume = true;
|
||||
gravityVolume._cutoffRadius = 0f;
|
||||
|
||||
@ -8,7 +8,7 @@ namespace NewHorizons.Builder.General
|
||||
public static void Make(GameObject body, string name, PlanetConfig config)
|
||||
{
|
||||
MapMarker mapMarker = body.AddComponent<MapMarker>();
|
||||
mapMarker._labelID = (UITextType)TranslationHandler.AddUI(config.Name);
|
||||
mapMarker._labelID = (UITextType)TranslationHandler.AddUI(config.name);
|
||||
|
||||
var markerType = MapMarker.MarkerType.Planet;
|
||||
|
||||
|
||||
@ -9,19 +9,19 @@ namespace NewHorizons.Builder.General
|
||||
public static SpawnPoint Make(GameObject planetGO, SpawnModule module, OWRigidbody owRigidBody)
|
||||
{
|
||||
SpawnPoint playerSpawn = null;
|
||||
if (!Main.Instance.IsWarping && module.PlayerSpawnPoint != null)
|
||||
if (!Main.Instance.IsWarping && module.playerSpawnPoint != null)
|
||||
{
|
||||
GameObject spawnGO = new GameObject("PlayerSpawnPoint");
|
||||
spawnGO.transform.parent = planetGO.transform;
|
||||
spawnGO.layer = 8;
|
||||
|
||||
spawnGO.transform.localPosition = module.PlayerSpawnPoint;
|
||||
spawnGO.transform.localPosition = module.playerSpawnPoint;
|
||||
|
||||
playerSpawn = spawnGO.AddComponent<SpawnPoint>();
|
||||
|
||||
if(module.PlayerSpawnRotation != null)
|
||||
if(module.playerSpawnRotation != null)
|
||||
{
|
||||
spawnGO.transform.rotation = Quaternion.Euler(module.PlayerSpawnRotation);
|
||||
spawnGO.transform.rotation = Quaternion.Euler(module.playerSpawnRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -30,13 +30,13 @@ namespace NewHorizons.Builder.General
|
||||
|
||||
spawnGO.transform.position = spawnGO.transform.position + spawnGO.transform.TransformDirection(Vector3.up) * 4f;
|
||||
}
|
||||
if (module.ShipSpawnPoint != null)
|
||||
if (module.shipSpawnPoint != null)
|
||||
{
|
||||
GameObject spawnGO = new GameObject("ShipSpawnPoint");
|
||||
spawnGO.transform.parent = planetGO.transform;
|
||||
spawnGO.layer = 8;
|
||||
|
||||
spawnGO.transform.localPosition = module.ShipSpawnPoint;
|
||||
spawnGO.transform.localPosition = module.shipSpawnPoint;
|
||||
|
||||
var spawnPoint = spawnGO.AddComponent<SpawnPoint>();
|
||||
spawnPoint._isShipSpawn = true;
|
||||
@ -44,9 +44,9 @@ namespace NewHorizons.Builder.General
|
||||
var ship = GameObject.Find("Ship_Body");
|
||||
ship.transform.position = spawnPoint.transform.position;
|
||||
|
||||
if(module.ShipSpawnRotation != null)
|
||||
if(module.shipSpawnRotation != null)
|
||||
{
|
||||
ship.transform.rotation = Quaternion.Euler(module.ShipSpawnRotation);
|
||||
ship.transform.rotation = Quaternion.Euler(module.shipSpawnRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -70,7 +70,7 @@ namespace NewHorizons.Builder.General
|
||||
playerSpawnGO.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
}
|
||||
}
|
||||
if (!Main.Instance.IsWarping && module.StartWithSuit && !suitUpQueued)
|
||||
if (!Main.Instance.IsWarping && module.startWithSuit && !suitUpQueued)
|
||||
{
|
||||
suitUpQueued = true;
|
||||
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => SuitUp());
|
||||
|
||||
@ -15,8 +15,8 @@ namespace NewHorizons.Builder.Orbital
|
||||
var module = config.FocalPoint;
|
||||
|
||||
var binary = go.AddComponent<BinaryFocalPoint>();
|
||||
binary.PrimaryName = module.Primary;
|
||||
binary.SecondaryName = module.Secondary;
|
||||
binary.PrimaryName = module.primary;
|
||||
binary.SecondaryName = module.secondary;
|
||||
|
||||
// Below is the stupid fix for making circumbinary planets or wtv
|
||||
|
||||
@ -25,11 +25,11 @@ namespace NewHorizons.Builder.Orbital
|
||||
NewHorizonsBody secondary = null;
|
||||
foreach (var body in Main.BodyDict[Main.Instance.CurrentStarSystem])
|
||||
{
|
||||
if (body.Config.Name == module.Primary)
|
||||
if (body.Config.name == module.primary)
|
||||
{
|
||||
primary = body;
|
||||
}
|
||||
else if (body.Config.Name == module.Secondary)
|
||||
else if (body.Config.name == module.secondary)
|
||||
{
|
||||
secondary = body;
|
||||
}
|
||||
@ -41,7 +41,7 @@ namespace NewHorizons.Builder.Orbital
|
||||
|
||||
if (primary == null || secondary == null)
|
||||
{
|
||||
Logger.LogError($"Couldn't make focal point between [{module.Primary} = {primary}] and [{module.Secondary} = {secondary}]");
|
||||
Logger.LogError($"Couldn't make focal point between [{module.primary} = {primary}] and [{module.secondary} = {secondary}]");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -51,15 +51,15 @@ namespace NewHorizons.Builder.Orbital
|
||||
var fakeMassConfig = new PlanetConfig();
|
||||
|
||||
// Now need to fake the 3 values to make it return this mass
|
||||
fakeMassConfig.Base.SurfaceSize = 1;
|
||||
fakeMassConfig.Base.SurfaceGravity = gravitationalMass * GravityVolume.GRAVITATIONAL_CONSTANT;
|
||||
fakeMassConfig.Base.GravityFallOff = primary.Config.Base.GravityFallOff;
|
||||
fakeMassConfig.Base.surfaceSize = 1;
|
||||
fakeMassConfig.Base.surfaceGravity = gravitationalMass * GravityVolume.GRAVITATIONAL_CONSTANT;
|
||||
fakeMassConfig.Base.gravityFallOff = primary.Config.Base.gravityFallOff;
|
||||
|
||||
// Other stuff to make the fake barycenter not interact with anything in any way
|
||||
fakeMassConfig.Name = config.Name + "_FakeBarycenterMass";
|
||||
fakeMassConfig.Base.SphereOfInfluence = 0;
|
||||
fakeMassConfig.Base.HasMapMarker = false;
|
||||
fakeMassConfig.Base.HasReferenceFrame = false;
|
||||
fakeMassConfig.name = config.name + "_FakeBarycenterMass";
|
||||
fakeMassConfig.Base.sphereOfInfluence = 0;
|
||||
fakeMassConfig.Base.hasMapMarker = false;
|
||||
fakeMassConfig.Base.hasReferenceFrame = false;
|
||||
|
||||
fakeMassConfig.Orbit = new OrbitModule();
|
||||
fakeMassConfig.Orbit.CopyPropertiesFrom(config.Orbit);
|
||||
@ -69,9 +69,9 @@ namespace NewHorizons.Builder.Orbital
|
||||
|
||||
private static float GetGravitationalMass(PlanetConfig config)
|
||||
{
|
||||
var surfaceAcceleration = config.Base.SurfaceGravity;
|
||||
var upperSurfaceRadius = config.Base.SurfaceSize;
|
||||
int falloffExponent = config.Base.GravityFallOff == GravityFallOff.Linear ? 1 : 2;
|
||||
var surfaceAcceleration = config.Base.surfaceGravity;
|
||||
var upperSurfaceRadius = config.Base.surfaceSize;
|
||||
int falloffExponent = config.Base.gravityFallOff == GravityFallOff.Linear ? 1 : 2;
|
||||
|
||||
return surfaceAcceleration * Mathf.Pow(upperSurfaceRadius, falloffExponent) / GravityVolume.GRAVITATIONAL_CONSTANT;
|
||||
}
|
||||
|
||||
@ -58,12 +58,12 @@ namespace NewHorizons.Builder.Orbital
|
||||
|
||||
var color = Color.white;
|
||||
if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor32();
|
||||
else if (config.Star != null) color = config.Star.Tint.ToColor32();
|
||||
else if (config.Atmosphere?.Clouds?.Tint != null) color = config.Atmosphere.Clouds.Tint.ToColor32();
|
||||
else if (config.Star != null) color = config.Star.tint.ToColor32();
|
||||
else if (config.Atmosphere?.clouds?.tint != null) color = config.Atmosphere.clouds.tint.ToColor32();
|
||||
else if (config.Singularity != null) color = new Color(1f, 0.5f, 1f);
|
||||
else if (config.Water != null) color = new Color(0.5f, 0.5f, 1f);
|
||||
else if (config.Lava != null) color = new Color(1f, 0.5f, 0.5f);
|
||||
else if (config.Atmosphere != null && config.Atmosphere.FogTint != null) color = config.Atmosphere.FogTint.ToColor32();
|
||||
else if (config.Atmosphere != null && config.Atmosphere.fogTint != null) color = config.Atmosphere.fogTint.ToColor32();
|
||||
|
||||
var fade = isMoon;
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
public static void Make(GameObject go, Sector sector, OWRigidbody planetBody, PlanetConfig config, IModBehaviour mod, string uniqueModName)
|
||||
{
|
||||
if (config.Props.Scatter != null)
|
||||
if (config.Props.scatter != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -21,9 +21,9 @@ namespace NewHorizons.Builder.Props
|
||||
Logger.LogError($"Couldn't make planet scatter for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
if (config.Props.Details != null)
|
||||
if (config.Props.details != null)
|
||||
{
|
||||
foreach (var detail in config.Props.Details)
|
||||
foreach (var detail in config.Props.details)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -35,9 +35,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.Geysers != null)
|
||||
if (config.Props.geysers != null)
|
||||
{
|
||||
foreach (var geyserInfo in config.Props.Geysers)
|
||||
foreach (var geyserInfo in config.Props.geysers)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -49,9 +49,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Main.HasDLC && config.Props.Rafts != null)
|
||||
if (Main.HasDLC && config.Props.rafts != null)
|
||||
{
|
||||
foreach (var raftInfo in config.Props.Rafts)
|
||||
foreach (var raftInfo in config.Props.rafts)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -63,13 +63,13 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.Tornados != null)
|
||||
if (config.Props.tornados != null)
|
||||
{
|
||||
foreach (var tornadoInfo in config.Props.Tornados)
|
||||
foreach (var tornadoInfo in config.Props.tornados)
|
||||
{
|
||||
try
|
||||
{
|
||||
TornadoBuilder.Make(go, sector, tornadoInfo, config.Atmosphere?.Clouds != null);
|
||||
TornadoBuilder.Make(go, sector, tornadoInfo, config.Atmosphere?.clouds != null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -77,9 +77,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.Volcanoes != null)
|
||||
if (config.Props.volcanoes != null)
|
||||
{
|
||||
foreach (var volcanoInfo in config.Props.Volcanoes)
|
||||
foreach (var volcanoInfo in config.Props.volcanoes)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -92,9 +92,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
// Reminder that dialogue has to be built after props if they're going to be using CharacterAnimController stuff
|
||||
if (config.Props.Dialogue != null)
|
||||
if (config.Props.dialogue != null)
|
||||
{
|
||||
foreach (var dialogueInfo in config.Props.Dialogue)
|
||||
foreach (var dialogueInfo in config.Props.dialogue)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -106,9 +106,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.Reveal != null)
|
||||
if (config.Props.reveal != null)
|
||||
{
|
||||
foreach (var revealInfo in config.Props.Reveal)
|
||||
foreach (var revealInfo in config.Props.reveal)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -120,9 +120,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.EntryLocation != null)
|
||||
if (config.Props.entryLocation != null)
|
||||
{
|
||||
foreach (var entryLocationInfo in config.Props.EntryLocation)
|
||||
foreach (var entryLocationInfo in config.Props.entryLocation)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -134,9 +134,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.NomaiText != null)
|
||||
if (config.Props.nomaiText != null)
|
||||
{
|
||||
foreach (var nomaiTextInfo in config.Props.NomaiText)
|
||||
foreach (var nomaiTextInfo in config.Props.nomaiText)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -149,9 +149,9 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
}
|
||||
}
|
||||
if (Main.HasDLC && config.Props.SlideShows != null)
|
||||
if (Main.HasDLC && config.Props.slideShows != null)
|
||||
{
|
||||
foreach (var slideReelInfo in config.Props.SlideShows)
|
||||
foreach (var slideReelInfo in config.Props.slideShows)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@ -11,7 +11,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, string uniqueModName)
|
||||
{
|
||||
MakeScatter(go, config.Props.Scatter, config.Base.SurfaceSize, sector, mod, uniqueModName, config);
|
||||
MakeScatter(go, config.Props.scatter, config.Base.surfaceSize, sector, mod, uniqueModName, config);
|
||||
}
|
||||
|
||||
private static void MakeScatter(GameObject go, PropModule.ScatterInfo[] scatterInfo, float radius, Sector sector, IModBehaviour mod, string uniqueModName, PlanetConfig config)
|
||||
@ -26,12 +26,12 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
try
|
||||
{
|
||||
heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.HeightMap);
|
||||
heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.heightMap);
|
||||
}
|
||||
catch (Exception) { }
|
||||
if (heightMapTexture == null)
|
||||
{
|
||||
radius = heightMap.MaxHeight;
|
||||
radius = heightMap.maxHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,13 +58,13 @@ namespace NewHorizons.Builder.Props
|
||||
float sampleY = heightMapTexture.height * latitude / 180f;
|
||||
|
||||
float relativeHeight = heightMapTexture.GetPixel((int)sampleX, (int)sampleY).r;
|
||||
height = (relativeHeight * (heightMap.MaxHeight - heightMap.MinHeight) + heightMap.MinHeight);
|
||||
height = (relativeHeight * (heightMap.maxHeight - heightMap.minHeight) + heightMap.minHeight);
|
||||
|
||||
// Because heightmaps are dumb gotta rotate it 90 degrees around the x axis bc UHHHHHHHHHHHHH
|
||||
point = Quaternion.Euler(90, 0, 0) * point;
|
||||
|
||||
// Keep things mostly above water
|
||||
if (config.Water != null && height - 1f < config.Water.Size) continue;
|
||||
if (config.Water != null && height - 1f < config.Water.size) continue;
|
||||
|
||||
// Move it slightly into the ground
|
||||
height -= 0.1f;
|
||||
|
||||
@ -126,7 +126,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
public static void Make(GameObject body, Sector sector, SignalModule module, IModBehaviour mod)
|
||||
{
|
||||
foreach (var info in module.Signals)
|
||||
foreach (var info in module.signals)
|
||||
{
|
||||
Make(body, sector, info, mod);
|
||||
}
|
||||
@ -134,10 +134,10 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
public static void Make(GameObject planetGO, Sector sector, SignalModule.SignalInfo info, IModBehaviour mod)
|
||||
{
|
||||
var signalGO = new GameObject($"Signal_{info.Name}");
|
||||
var signalGO = new GameObject($"Signal_{info.name}");
|
||||
signalGO.SetActive(false);
|
||||
signalGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
signalGO.transform.position = planetGO.transform.TransformPoint(info.Position != null ? (Vector3)info.Position : Vector3.zero);
|
||||
signalGO.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
|
||||
signalGO.layer = LayerMask.NameToLayer("AdvancedEffectVolume");
|
||||
|
||||
var source = signalGO.AddComponent<AudioSource>();
|
||||
@ -145,30 +145,30 @@ namespace NewHorizons.Builder.Props
|
||||
owAudioSource._audioSource = source;
|
||||
|
||||
AudioSignal audioSignal;
|
||||
if (info.InsideCloak) audioSignal = signalGO.AddComponent<CloakedAudioSignal>();
|
||||
if (info.insideCloak) audioSignal = signalGO.AddComponent<CloakedAudioSignal>();
|
||||
else audioSignal = signalGO.AddComponent<AudioSignal>();
|
||||
audioSignal._owAudioSource = owAudioSource;
|
||||
|
||||
var frequency = StringToFrequency(info.Frequency);
|
||||
var name = StringToSignalName(info.Name);
|
||||
var frequency = StringToFrequency(info.frequency);
|
||||
var name = StringToSignalName(info.name);
|
||||
|
||||
AudioClip clip = null;
|
||||
if (info.AudioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(info.AudioClip);
|
||||
else if (info.AudioFilePath != null)
|
||||
if (info.audioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(info.audioClip);
|
||||
else if (info.audioFilePath != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + info.AudioFilePath);
|
||||
clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + info.audioFilePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load audio file {info.AudioFilePath} : {e.Message}");
|
||||
Logger.LogError($"Couldn't load audio file {info.audioFilePath} : {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
Logger.LogError($"Couldn't find AudioClip {info.AudioClip} or AudioFile {info.AudioFilePath}");
|
||||
Logger.LogError($"Couldn't find AudioClip {info.audioClip} or AudioFile {info.audioFilePath}");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -178,10 +178,10 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
audioSignal._frequency = frequency;
|
||||
audioSignal._name = name;
|
||||
audioSignal._sourceRadius = info.SourceRadius;
|
||||
audioSignal._revealFactID = info.Reveals;
|
||||
audioSignal._onlyAudibleToScope = info.OnlyAudibleToScope;
|
||||
audioSignal._identificationDistance = info.IdentificationRadius;
|
||||
audioSignal._sourceRadius = info.sourceRadius;
|
||||
audioSignal._revealFactID = info.reveals;
|
||||
audioSignal._onlyAudibleToScope = info.onlyAudibleToScope;
|
||||
audioSignal._identificationDistance = info.identificationRadius;
|
||||
audioSignal._canBePickedUpByScope = true;
|
||||
|
||||
source.clip = clip;
|
||||
@ -196,7 +196,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
source.SetCustomCurve(AudioSourceCurveType.CustomRolloff, _customCurve);
|
||||
// If it can be heard regularly then we play it immediately
|
||||
source.playOnAwake = !info.OnlyAudibleToScope;
|
||||
source.playOnAwake = !info.onlyAudibleToScope;
|
||||
source.spatialBlend = 1f;
|
||||
source.volume = 0.5f;
|
||||
source.dopplerLevel = 0;
|
||||
@ -205,17 +205,17 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
// Frequency detection trigger volume
|
||||
|
||||
var signalDetectionGO = new GameObject($"SignalDetectionTrigger_{info.Name}");
|
||||
var signalDetectionGO = new GameObject($"SignalDetectionTrigger_{info.name}");
|
||||
signalDetectionGO.SetActive(false);
|
||||
signalDetectionGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
signalDetectionGO.transform.position = planetGO.transform.TransformPoint(info.Position != null ? (Vector3)info.Position : Vector3.zero);
|
||||
signalDetectionGO.transform.position = planetGO.transform.TransformPoint(info.position != null ? (Vector3)info.position : Vector3.zero);
|
||||
signalDetectionGO.layer = LayerMask.NameToLayer("AdvancedEffectVolume");
|
||||
|
||||
var sphereShape = signalDetectionGO.AddComponent<SphereShape>();
|
||||
var owTriggerVolume = signalDetectionGO.AddComponent<OWTriggerVolume>();
|
||||
var audioSignalDetectionTrigger = signalDetectionGO.AddComponent<AudioSignalDetectionTrigger>();
|
||||
|
||||
sphereShape.radius = info.DetectionRadius == 0 ? info.SourceRadius + 30 : info.DetectionRadius;
|
||||
sphereShape.radius = info.detectionRadius == 0 ? info.sourceRadius + 30 : info.detectionRadius;
|
||||
audioSignalDetectionTrigger._signal = audioSignal;
|
||||
audioSignalDetectionTrigger._trigger = owTriggerVolume;
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
{
|
||||
Material greyScaleMaterial = GameObject.Find(ShipLogHandler.PAN_ROOT_PATH + "/TimberHearth/Sprite").GetComponent<Image>().material;
|
||||
List<NewHorizonsBody> bodies = Main.BodyDict[systemName].Where(
|
||||
b => !(b.Config.ShipLog?.mapMode?.remove ?? false) && !b.Config.IsQuantumState
|
||||
b => !(b.Config.ShipLog?.mapMode?.remove ?? false) && !b.Config.isQuantumState
|
||||
).ToList();
|
||||
bool flagManualPositionUsed = systemName == "SolarSystem";
|
||||
bool flagAutoPositionUsed = false;
|
||||
@ -35,7 +35,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
flagManualPositionUsed = true;
|
||||
if (body.Config.ShipLog?.mapMode?.manualNavigationPosition == null)
|
||||
{
|
||||
Logger.LogError("Navigation position is missing for: " + body.Config.Name);
|
||||
Logger.LogError("Navigation position is missing for: " + body.Config.name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
|
||||
private static GameObject CreateMapModeGameObject(NewHorizonsBody body, GameObject parent, int layer, Vector2 position)
|
||||
{
|
||||
GameObject newGameObject = new GameObject(body.Config.Name + "_ShipLog");
|
||||
GameObject newGameObject = new GameObject(body.Config.name + "_ShipLog");
|
||||
newGameObject.layer = layer;
|
||||
newGameObject.transform.SetParent(parent.transform);
|
||||
|
||||
@ -116,8 +116,8 @@ namespace NewHorizons.Builder.ShipLog
|
||||
if (outlinePath != null) outline = ImageUtilities.GetTexture(body.Mod, outlinePath);
|
||||
if (outline == null) outline = ImageUtilities.MakeOutline(image, Color.white, 10);
|
||||
|
||||
astroObject._imageObj = CreateImage(gameObject, image, body.Config.Name + " Revealed", layer);
|
||||
astroObject._outlineObj = CreateImage(gameObject, outline, body.Config.Name + " Outline", layer);
|
||||
astroObject._imageObj = CreateImage(gameObject, image, body.Config.name + " Revealed", layer);
|
||||
astroObject._outlineObj = CreateImage(gameObject, outline, body.Config.name + " Outline", layer);
|
||||
if (ShipLogHandler.BodyHasEntries(body))
|
||||
{
|
||||
Image revealedImage = astroObject._imageObj.GetComponent<Image>();
|
||||
@ -220,8 +220,8 @@ namespace NewHorizons.Builder.ShipLog
|
||||
if (body.Config.ShipLog?.mapMode?.manualNavigationPosition == null) continue;
|
||||
|
||||
// Sometimes they got other names idk
|
||||
var name = body.Config.Name.Replace(" ", "");
|
||||
var existingBody = AstroObjectLocator.GetAstroObject(body.Config.Name);
|
||||
var name = body.Config.name.Replace(" ", "");
|
||||
var existingBody = AstroObjectLocator.GetAstroObject(body.Config.name);
|
||||
if (existingBody != null)
|
||||
{
|
||||
var astroName = existingBody.GetAstroObjectName();
|
||||
@ -242,7 +242,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
else if (Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
GameObject gameObject = SearchUtilities.CachedFind(ShipLogHandler.PAN_ROOT_PATH + "/" + name);
|
||||
if (body.Config.Destroy || (body.Config.ShipLog?.mapMode?.remove ?? false))
|
||||
if (body.Config.destroy || (body.Config.ShipLog?.mapMode?.remove ?? false))
|
||||
{
|
||||
ShipLogAstroObject astroObject = gameObject.GetComponent<ShipLogAstroObject>();
|
||||
if (astroObject != null)
|
||||
@ -363,7 +363,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
|
||||
private static MapModeObject ConstructPrimaryNode(List<NewHorizonsBody> bodies)
|
||||
{
|
||||
foreach (NewHorizonsBody body in bodies.Where(b => b.Config.Base.CenterOfSolarSystem))
|
||||
foreach (NewHorizonsBody body in bodies.Where(b => b.Config.Base.centerOfSolarSystem))
|
||||
{
|
||||
bodies.Sort((b, o) => b.Config.Orbit.SemiMajorAxis.CompareTo(o.Config.Orbit.SemiMajorAxis));
|
||||
MapModeObject newNode = new MapModeObject
|
||||
@ -388,7 +388,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
int newLevel = parent.level + 1;
|
||||
MapModeObject lastSibling = parent;
|
||||
|
||||
foreach (NewHorizonsBody body in searchList.Where(b => b.Config.Orbit.PrimaryBody == parent.mainBody.Config.Name || b.Config.Name == secondaryName))
|
||||
foreach (NewHorizonsBody body in searchList.Where(b => b.Config.Orbit.PrimaryBody == parent.mainBody.Config.name || b.Config.name == secondaryName))
|
||||
{
|
||||
bool even = newLevel % 2 == 0;
|
||||
newX = even ? newX : newX + 1;
|
||||
@ -405,8 +405,8 @@ namespace NewHorizons.Builder.ShipLog
|
||||
string newSecondaryName = "";
|
||||
if (body.Config.FocalPoint != null)
|
||||
{
|
||||
newNode.mainBody = searchList.Find(b => b.Config.Name == body.Config.FocalPoint.Primary);
|
||||
newSecondaryName = searchList.Find(b => b.Config.Name == body.Config.FocalPoint.Secondary).Config.Name;
|
||||
newNode.mainBody = searchList.Find(b => b.Config.name == body.Config.FocalPoint.primary);
|
||||
newSecondaryName = searchList.Find(b => b.Config.name == body.Config.FocalPoint.secondary).Config.name;
|
||||
}
|
||||
|
||||
newNode.children = ConstructChildrenNodes(newNode, searchList, newSecondaryName);
|
||||
@ -512,7 +512,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (body.Config?.Singularity?.Type)
|
||||
switch (body.Config?.Singularity?.type)
|
||||
{
|
||||
case SingularityModule.SingularityType.BlackHole:
|
||||
return Color.black;
|
||||
@ -520,27 +520,27 @@ namespace NewHorizons.Builder.ShipLog
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
var starColor = body.Config?.Star?.Tint;
|
||||
var starColor = body.Config?.Star?.tint;
|
||||
if (starColor != null) return starColor.ToColor();
|
||||
|
||||
var atmoColor = body.Config.Atmosphere?.AtmosphereTint;
|
||||
if (body.Config.Atmosphere?.Clouds != null && atmoColor != null) return atmoColor.ToColor();
|
||||
var atmoColor = body.Config.Atmosphere?.atmosphereTint;
|
||||
if (body.Config.Atmosphere?.clouds != null && atmoColor != null) return atmoColor.ToColor();
|
||||
|
||||
if (body.Config?.HeightMap?.TextureMap != null)
|
||||
if (body.Config?.HeightMap?.textureMap != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var texture = ImageUtilities.GetTexture(body.Mod, body.Config.HeightMap.TextureMap);
|
||||
var texture = ImageUtilities.GetTexture(body.Mod, body.Config.HeightMap.textureMap);
|
||||
var landColor = ImageUtilities.GetAverageColor(texture);
|
||||
if (landColor != null) return landColor;
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
var waterColor = body.Config.Water?.Tint;
|
||||
var waterColor = body.Config.Water?.tint;
|
||||
if (waterColor != null) return waterColor.ToColor();
|
||||
|
||||
var lavaColor = body.Config.Lava?.Tint;
|
||||
var lavaColor = body.Config.Lava?.tint;
|
||||
if (lavaColor != null) return lavaColor.ToColor();
|
||||
|
||||
var sandColor = body.Config.Sand?.Tint;
|
||||
@ -548,7 +548,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Logger.LogWarning($"Something went wrong trying to pick the colour for {body.Config.Name} but I'm too lazy to fix it.");
|
||||
Logger.LogWarning($"Something went wrong trying to pick the colour for {body.Config.name} but I'm too lazy to fix it.");
|
||||
}
|
||||
|
||||
return Color.white;
|
||||
|
||||
@ -51,7 +51,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
|
||||
public static void AddBodyToShipLog(ShipLogManager manager, NewHorizonsBody body)
|
||||
{
|
||||
string systemName = body.Config.StarSystem;
|
||||
string systemName = body.Config.starSystem;
|
||||
XElement astroBodyFile = XElement.Load(body.Mod.ModHelper.Manifest.ModFolderPath + "/" + body.Config.ShipLog.xmlFile);
|
||||
XElement astroBodyId = astroBodyFile.Element("ID");
|
||||
if (astroBodyId == null)
|
||||
|
||||
@ -11,7 +11,7 @@ namespace NewHorizons.Components
|
||||
{
|
||||
Base =
|
||||
{
|
||||
SurfaceSize = 10f
|
||||
surfaceSize = 10f
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -15,9 +15,9 @@ namespace NewHorizons.Components.Orbital
|
||||
|
||||
public Gravity(BaseModule module)
|
||||
{
|
||||
var surfaceAcceleration = module.SurfaceGravity;
|
||||
var upperSurfaceRadius = module.SurfaceSize;
|
||||
int falloffExponent = module.GravityFallOff == GravityFallOff.Linear ? 1 : 2;
|
||||
var surfaceAcceleration = module.surfaceGravity;
|
||||
var upperSurfaceRadius = module.surfaceSize;
|
||||
int falloffExponent = module.gravityFallOff == GravityFallOff.Linear ? 1 : 2;
|
||||
|
||||
Mass = surfaceAcceleration * Mathf.Pow(upperSurfaceRadius, falloffExponent) / GravityVolume.GRAVITATIONAL_CONSTANT;
|
||||
Power = falloffExponent;
|
||||
|
||||
@ -67,7 +67,7 @@ namespace NewHorizons.Components
|
||||
// Conditions to allow warping into that system (either no planets (stock system) or has a ship spawn point)
|
||||
var flag = false;
|
||||
if (starSystem.Equals("SolarSystem")) flag = true;
|
||||
else if (config.Spawn?.ShipSpawnPoint != null) flag = true;
|
||||
else if (config.Spawn?.shipSpawnPoint != null) flag = true;
|
||||
|
||||
if (!StarChartHandler.HasUnlockedSystem(starSystem)) continue;
|
||||
|
||||
|
||||
269
NewHorizons/External/Configs/PlanetConfig.cs
vendored
269
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -1,65 +1,21 @@
|
||||
using NewHorizons.External.Modules;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.External.Modules.VariableSize;
|
||||
using Newtonsoft.Json;
|
||||
using NewHorizons.Utility;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Internal;
|
||||
|
||||
namespace NewHorizons.External.Configs
|
||||
{
|
||||
/// <summary>
|
||||
/// A planet or body to generate
|
||||
/// Describes a body to generate
|
||||
/// </summary>
|
||||
[JsonObject]
|
||||
[JsonObject(Title = "Celestial Body")]
|
||||
public class PlanetConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique name of your planet
|
||||
/// Generate asteroids around this body
|
||||
/// </summary>
|
||||
public string Name;
|
||||
|
||||
/// <summary>
|
||||
/// Version of New Horizons this config is using (Doesn't do anything)
|
||||
/// </summary>
|
||||
public string Version;
|
||||
|
||||
/// <summary>
|
||||
/// Unique star system containing your planet
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue("SolarSystem")]
|
||||
public string StarSystem = "SolarSystem";
|
||||
|
||||
/// <summary>
|
||||
/// `true` if you want to delete this planet
|
||||
/// </summary>
|
||||
public bool Destroy;
|
||||
|
||||
/// <summary>
|
||||
/// A list of paths to child GameObjects to destroy on this planet
|
||||
/// </summary>
|
||||
public string[] RemoveChildren;
|
||||
|
||||
/// <summary>
|
||||
/// Set to a higher number if you wish for this body to be built sooner
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(-1)]
|
||||
public int BuildPriority = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Should this planet ever be shown on the title screen?
|
||||
/// </summary>
|
||||
public bool CanShowOnTitle = true;
|
||||
|
||||
/// <summary>
|
||||
/// Does this config describe a quantum state of a custom planet defined in another file?
|
||||
/// </summary>
|
||||
public bool IsQuantumState;
|
||||
|
||||
/// <summary>
|
||||
/// Base Properties of this Body
|
||||
/// </summary>
|
||||
public BaseModule Base;
|
||||
public AsteroidBeltModule AsteroidBelt;
|
||||
|
||||
/// <summary>
|
||||
/// Describes this Body's atmosphere
|
||||
@ -67,55 +23,97 @@ namespace NewHorizons.External.Configs
|
||||
public AtmosphereModule Atmosphere;
|
||||
|
||||
/// <summary>
|
||||
/// Describes this Body's orbit (or lack there of)
|
||||
/// Base Properties of this Body
|
||||
/// </summary>
|
||||
public OrbitModule Orbit;
|
||||
public BaseModule Base;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a ring around the planet
|
||||
/// Set to a higher number if you wish for this body to be built sooner
|
||||
/// </summary>
|
||||
public RingModule Ring;
|
||||
[DefaultValue(-1)] public int buildPriority = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Generate the surface of this planet using a heightmap
|
||||
/// Should this planet ever be shown on the title screen?
|
||||
/// </summary>
|
||||
public HeightMapModule HeightMap;
|
||||
public bool canShowOnTitle = true;
|
||||
|
||||
#region Obsolete
|
||||
|
||||
[Obsolete("ChildrenToDestroy is deprecated, please use RemoveChildren instead")]
|
||||
public string[] childrenToDestroy;
|
||||
|
||||
#endregion Obsolete
|
||||
|
||||
/// <summary>
|
||||
/// Procedural Generation
|
||||
/// `true` if you want to delete this planet
|
||||
/// </summary>
|
||||
public ProcGenModule ProcGen;
|
||||
|
||||
/// <summary>
|
||||
/// Generate asteroids around this body
|
||||
/// </summary>
|
||||
public AsteroidBeltModule AsteroidBelt;
|
||||
|
||||
/// <summary>
|
||||
/// Make this body a star
|
||||
/// </summary>
|
||||
public StarModule Star;
|
||||
public bool destroy;
|
||||
|
||||
/// <summary>
|
||||
/// Make this body into a focal point (barycenter)
|
||||
/// </summary>
|
||||
public FocalPointModule FocalPoint;
|
||||
|
||||
/// <summary>
|
||||
/// Add funnel from this planet to another
|
||||
/// </summary>
|
||||
public FunnelModule Funnel;
|
||||
|
||||
/// <summary>
|
||||
/// Generate the surface of this planet using a heightmap
|
||||
/// </summary>
|
||||
public HeightMapModule HeightMap;
|
||||
|
||||
/// <summary>
|
||||
/// Does this config describe a quantum state of a custom planet defined in another file?
|
||||
/// </summary>
|
||||
public bool isQuantumState;
|
||||
|
||||
/// <summary>
|
||||
/// Add lava to this planet
|
||||
/// </summary>
|
||||
public LavaModule Lava;
|
||||
|
||||
/// <summary>
|
||||
/// Unique name of your planet
|
||||
/// </summary>
|
||||
public string name;
|
||||
|
||||
/// <summary>
|
||||
/// Describes this Body's orbit (or lack there of)
|
||||
/// </summary>
|
||||
public OrbitModule Orbit;
|
||||
|
||||
/// <summary>
|
||||
/// Procedural Generation
|
||||
/// </summary>
|
||||
public ProcGenModule ProcGen;
|
||||
|
||||
/// <summary>
|
||||
/// Spawn various objects on this body
|
||||
/// </summary>
|
||||
public PropModule Props;
|
||||
|
||||
/// <summary>
|
||||
/// A list of paths to child GameObjects to destroy on this planet
|
||||
/// </summary>
|
||||
public string[] removeChildren;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a ring around the planet
|
||||
/// </summary>
|
||||
public RingModule Ring;
|
||||
|
||||
/// <summary>
|
||||
/// Add sand to this planet
|
||||
/// </summary>
|
||||
public SandModule Sand;
|
||||
|
||||
/// <summary>
|
||||
/// Add ship log entries to this planet and describe how it looks in map mode
|
||||
/// </summary>
|
||||
public ShipLogModule ShipLog;
|
||||
|
||||
/// <summary>
|
||||
/// Spawn the player at this planet
|
||||
/// </summary>
|
||||
public SpawnModule Spawn;
|
||||
|
||||
/// <summary>
|
||||
/// Add signals that can be heard via the signal-scope to this planet
|
||||
/// </summary>
|
||||
@ -127,32 +125,30 @@ namespace NewHorizons.External.Configs
|
||||
public SingularityModule Singularity;
|
||||
|
||||
/// <summary>
|
||||
/// Add lava to this planet
|
||||
/// Spawn the player at this planet
|
||||
/// </summary>
|
||||
public LavaModule Lava;
|
||||
public SpawnModule Spawn;
|
||||
|
||||
/// <summary>
|
||||
/// Make this body a star
|
||||
/// </summary>
|
||||
public StarModule Star;
|
||||
|
||||
/// <summary>
|
||||
/// Unique star system containing your planet
|
||||
/// </summary>
|
||||
[DefaultValue("SolarSystem")] public string starSystem = "SolarSystem";
|
||||
|
||||
/// <summary>
|
||||
/// Version of New Horizons this config is using (Doesn't do anything)
|
||||
/// </summary>
|
||||
public string version;
|
||||
|
||||
/// <summary>
|
||||
/// Add water to this planet
|
||||
/// </summary>
|
||||
public WaterModule Water;
|
||||
|
||||
/// <summary>
|
||||
/// Add sand to this planet
|
||||
/// </summary>
|
||||
public SandModule Sand;
|
||||
|
||||
/// <summary>
|
||||
/// Add funnel from this planet to another
|
||||
/// </summary>
|
||||
public FunnelModule Funnel;
|
||||
|
||||
#region Obsolete
|
||||
|
||||
[System.Obsolete("ChildrenToDestroy is deprecated, please use RemoveChildren instead")]
|
||||
public string[] ChildrenToDestroy;
|
||||
|
||||
#endregion Obsolete
|
||||
|
||||
public PlanetConfig()
|
||||
{
|
||||
// Always have to have a base module
|
||||
@ -164,91 +160,66 @@ namespace NewHorizons.External.Configs
|
||||
public void MigrateAndValidate()
|
||||
{
|
||||
// Validate
|
||||
if (Base.CenterOfSolarSystem) Orbit.IsStatic = true;
|
||||
if (Atmosphere?.Clouds?.LightningGradient != null) Atmosphere.Clouds.HasLightning = true;
|
||||
if (Base.centerOfSolarSystem) Orbit.IsStatic = true;
|
||||
if (Atmosphere?.clouds?.lightningGradient != null) Atmosphere.clouds.hasLightning = true;
|
||||
|
||||
// Backwards compatability
|
||||
// Should be the only place that obsolete things are referenced
|
||||
#pragma warning disable 612, 618
|
||||
if (Base.WaterSize != 0)
|
||||
{
|
||||
if (Base.waterSize != 0)
|
||||
Water = new WaterModule
|
||||
{
|
||||
Size = Base.WaterSize,
|
||||
Tint = Base.WaterTint
|
||||
size = Base.waterSize,
|
||||
tint = Base.waterTint
|
||||
};
|
||||
}
|
||||
|
||||
if (Base.LavaSize != 0)
|
||||
{
|
||||
if (Base.lavaSize != 0)
|
||||
Lava = new LavaModule
|
||||
{
|
||||
Size = Base.LavaSize
|
||||
size = Base.lavaSize
|
||||
};
|
||||
}
|
||||
|
||||
if (Base.BlackHoleSize != 0)
|
||||
{
|
||||
if (Base.blackHoleSize != 0)
|
||||
Singularity = new SingularityModule
|
||||
{
|
||||
Type = SingularityModule.SingularityType.BlackHole,
|
||||
Size = Base.BlackHoleSize
|
||||
type = SingularityModule.SingularityType.BlackHole,
|
||||
size = Base.blackHoleSize
|
||||
};
|
||||
}
|
||||
|
||||
if (Base.IsSatellite)
|
||||
{
|
||||
Base.ShowMinimap = false;
|
||||
}
|
||||
if (Base.isSatellite) Base.showMinimap = false;
|
||||
|
||||
if (ChildrenToDestroy != null)
|
||||
{
|
||||
RemoveChildren = ChildrenToDestroy;
|
||||
}
|
||||
if (childrenToDestroy != null) removeChildren = childrenToDestroy;
|
||||
|
||||
if (Base.HasAmbientLight)
|
||||
{
|
||||
Base.AmbientLight = 0.5f;
|
||||
}
|
||||
if (Base.hasAmbientLight) Base.ambientLight = 0.5f;
|
||||
|
||||
if (Atmosphere != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Atmosphere.Cloud))
|
||||
{
|
||||
Atmosphere.Clouds = new AtmosphereModule.CloudInfo()
|
||||
if (!string.IsNullOrEmpty(Atmosphere.cloud))
|
||||
Atmosphere.clouds = new AtmosphereModule.CloudInfo
|
||||
{
|
||||
OuterCloudRadius = Atmosphere.Size,
|
||||
InnerCloudRadius = Atmosphere.Size * 0.9f,
|
||||
Tint = Atmosphere.CloudTint,
|
||||
TexturePath = Atmosphere.Cloud,
|
||||
CapPath = Atmosphere.CloudCap,
|
||||
RampPath = Atmosphere.CloudRamp,
|
||||
FluidType = Atmosphere.FluidType,
|
||||
UseBasicCloudShader = Atmosphere.UseBasicCloudShader,
|
||||
Unlit = !Atmosphere.ShadowsOnClouds,
|
||||
outerCloudRadius = Atmosphere.size,
|
||||
innerCloudRadius = Atmosphere.size * 0.9f,
|
||||
tint = Atmosphere.cloudTint,
|
||||
texturePath = Atmosphere.cloud,
|
||||
capPath = Atmosphere.cloudCap,
|
||||
rampPath = Atmosphere.cloudRamp,
|
||||
fluidType = Atmosphere.fluidType,
|
||||
useBasicCloudShader = Atmosphere.useBasicCloudShader,
|
||||
unlit = !Atmosphere.shadowsOnClouds
|
||||
};
|
||||
}
|
||||
|
||||
// Validate
|
||||
if (Atmosphere.Clouds?.LightningGradient != null)
|
||||
{
|
||||
Atmosphere.Clouds.HasLightning = true;
|
||||
}
|
||||
if (Atmosphere.clouds?.lightningGradient != null) Atmosphere.clouds.hasLightning = true;
|
||||
|
||||
// Former is obsolete, latter is to validate
|
||||
if (Atmosphere.HasAtmosphere || Atmosphere.AtmosphereTint != null)
|
||||
{
|
||||
Atmosphere.UseAtmosphereShader = true;
|
||||
}
|
||||
if (Atmosphere.hasAtmosphere || Atmosphere.atmosphereTint != null)
|
||||
Atmosphere.useAtmosphereShader = true;
|
||||
}
|
||||
|
||||
if(Props?.Tornados != null)
|
||||
{
|
||||
foreach(var tornado in Props.Tornados)
|
||||
{
|
||||
if (tornado.downwards) tornado.type = PropModule.TornadoInfo.TornadoType.Downwards;
|
||||
}
|
||||
}
|
||||
if (Props?.tornados != null)
|
||||
foreach (var tornado in Props.tornados)
|
||||
if (tornado.downwards)
|
||||
tornado.type = PropModule.TornadoInfo.TornadoType.Downwards;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
NewHorizons/External/Configs/StarSystemConfig.cs
vendored
45
NewHorizons/External/Configs/StarSystemConfig.cs
vendored
@ -1,5 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NewHorizons.External.Configs
|
||||
{
|
||||
@ -9,20 +9,15 @@ namespace NewHorizons.External.Configs
|
||||
[JsonObject]
|
||||
public class StarSystemConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Relative path to the image file to use as the subtitle image (replaces the eote banner)
|
||||
/// </summary>
|
||||
public string subtitle;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this system can be warped to via the warp drive
|
||||
/// </summary>
|
||||
public bool canEnterViaWarpDrive = true;
|
||||
|
||||
/// <summary>
|
||||
/// Set to `true` if you want to spawn here after dying, not Timber Hearth. You can still warp back to the main star system.
|
||||
/// [DEPRECATED] Not implemented
|
||||
/// </summary>
|
||||
public bool startHere;
|
||||
public NomaiCoordinates coords;
|
||||
|
||||
/// <summary>
|
||||
/// Do you want a clean slate for this star system? Or will it be a modified version of the original.
|
||||
@ -32,11 +27,11 @@ namespace NewHorizons.External.Configs
|
||||
/// <summary>
|
||||
/// Should the time loop be enabled in this system?
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool enableTimeLoop = true;
|
||||
[DefaultValue(true)] public bool enableTimeLoop = true;
|
||||
|
||||
/// <summary>
|
||||
/// Set to the FactID that must be revealed before it can be warped to. Don't set `CanEnterViaWarpDrive` to `false` if you're using this, that would make no sense.
|
||||
/// Set to the FactID that must be revealed before it can be warped to. Don't set `CanEnterViaWarpDrive` to `false` if
|
||||
/// you're using this, that would make no sense.
|
||||
/// </summary>
|
||||
public string factRequiredForWarp;
|
||||
|
||||
@ -45,16 +40,22 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public bool mapRestricted;
|
||||
|
||||
/// <summary>
|
||||
/// [DEPRECATED] Not implemented
|
||||
/// </summary>
|
||||
public NomaiCoordinates coords;
|
||||
|
||||
/// <summary>
|
||||
/// Customize the skybox for this system
|
||||
/// </summary>
|
||||
public SkyboxConfig skybox;
|
||||
|
||||
/// <summary>
|
||||
/// Set to `true` if you want to spawn here after dying, not Timber Hearth. You can still warp back to the main star
|
||||
/// system.
|
||||
/// </summary>
|
||||
public bool startHere;
|
||||
|
||||
/// <summary>
|
||||
/// Relative path to the image file to use as the subtitle image (replaces the eote banner)
|
||||
/// </summary>
|
||||
public string subtitle;
|
||||
|
||||
public class NomaiCoordinates
|
||||
{
|
||||
public int[] x;
|
||||
@ -70,15 +71,15 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public string assetBundle;
|
||||
|
||||
/// <summary>
|
||||
/// Path to the material within the asset bundle specified by `assetBundle` to use for the skybox
|
||||
/// </summary>
|
||||
public string path;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to destroy the star field around the player
|
||||
/// </summary>
|
||||
public bool destroyStarField;
|
||||
|
||||
/// <summary>
|
||||
/// Path to the material within the asset bundle specified by `assetBundle` to use for the skybox
|
||||
/// </summary>
|
||||
public string path;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,30 +1,31 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace NewHorizons.External.Configs
|
||||
{
|
||||
public class TranslationConfig
|
||||
{
|
||||
public Dictionary<string, string> DialogueDictionary;
|
||||
public Dictionary<string, string> ShipLogDictionary;
|
||||
public Dictionary<string, string> UIDictionary;
|
||||
public Dictionary<string, string> dialogueDictionary;
|
||||
public Dictionary<string, string> shipLogDictionary;
|
||||
public Dictionary<string, string> uiDictionary;
|
||||
|
||||
public TranslationConfig(string filename)
|
||||
{
|
||||
Dictionary<string, object> dict = JObject.Parse(File.ReadAllText(filename)).ToObject<Dictionary<string, object>>();
|
||||
var dict = JObject.Parse(File.ReadAllText(filename)).ToObject<Dictionary<string, object>>();
|
||||
|
||||
if (dict.ContainsKey(nameof(DialogueDictionary)))
|
||||
{
|
||||
DialogueDictionary = (Dictionary<string, string>)(dict[nameof(DialogueDictionary)] as Newtonsoft.Json.Linq.JObject).ToObject(typeof(Dictionary<string, string>));
|
||||
}
|
||||
if (dict.ContainsKey(nameof(ShipLogDictionary)))
|
||||
{
|
||||
ShipLogDictionary = (Dictionary<string, string>)(dict[nameof(ShipLogDictionary)] as Newtonsoft.Json.Linq.JObject).ToObject(typeof(Dictionary<string, string>));
|
||||
}
|
||||
if (dict.ContainsKey(nameof(UIDictionary)))
|
||||
{
|
||||
UIDictionary = (Dictionary<string, string>)(dict[nameof(UIDictionary)] as Newtonsoft.Json.Linq.JObject).ToObject(typeof(Dictionary<string, string>));
|
||||
}
|
||||
if (dict.ContainsKey(nameof(dialogueDictionary)))
|
||||
dialogueDictionary =
|
||||
(Dictionary<string, string>) (dict[nameof(dialogueDictionary)] as JObject).ToObject(
|
||||
typeof(Dictionary<string, string>));
|
||||
if (dict.ContainsKey(nameof(shipLogDictionary)))
|
||||
shipLogDictionary =
|
||||
(Dictionary<string, string>) (dict[nameof(shipLogDictionary)] as JObject).ToObject(
|
||||
typeof(Dictionary<string, string>));
|
||||
if (dict.ContainsKey(nameof(uiDictionary)))
|
||||
uiDictionary =
|
||||
(Dictionary<string, string>) (dict[nameof(uiDictionary)] as JObject).ToObject(
|
||||
typeof(Dictionary<string, string>));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,56 +1,54 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NewHorizons.External.Modules
|
||||
{
|
||||
[JsonObject]
|
||||
public class AsteroidBeltModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Lowest distance from the planet asteroids can spawn
|
||||
/// </summary>
|
||||
public float InnerRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Greatest distance from the planet asteroids can spawn
|
||||
/// </summary>
|
||||
public float OuterRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum size of the asteroids.
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(20)]
|
||||
public float MinSize = 20;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum size of the asteroids.
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(50)]
|
||||
public float MaxSize = 50f;
|
||||
|
||||
/// <summary>
|
||||
/// Amount of asteroids to create.
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(-1)]
|
||||
public int Amount = -1;
|
||||
[DefaultValue(-1)] public int amount = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Angle between the rings and the equatorial plane of the planet.
|
||||
/// </summary>
|
||||
public float Inclination;
|
||||
public float inclination;
|
||||
|
||||
/// <summary>
|
||||
/// Lowest distance from the planet asteroids can spawn
|
||||
/// </summary>
|
||||
public float innerRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Angle defining the point where the rings rise up from the planet's equatorial plane if inclination is nonzero.
|
||||
/// </summary>
|
||||
public float LongitudeOfAscendingNode;
|
||||
public float longitudeOfAscendingNode;
|
||||
|
||||
/// <summary>
|
||||
/// Number used to randomize asteroid positions
|
||||
/// Maximum size of the asteroids.
|
||||
/// </summary>
|
||||
public int RandomSeed;
|
||||
[DefaultValue(50)] public float maxSize = 50f;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum size of the asteroids.
|
||||
/// </summary>
|
||||
[DefaultValue(20)] public float minSize = 20;
|
||||
|
||||
/// <summary>
|
||||
/// Greatest distance from the planet asteroids can spawn
|
||||
/// </summary>
|
||||
public float outerRadius;
|
||||
|
||||
/// <summary>
|
||||
/// How the asteroids are generated
|
||||
/// </summary>
|
||||
public ProcGenModule ProcGen;
|
||||
public ProcGenModule procGen;
|
||||
|
||||
/// <summary>
|
||||
/// Number used to randomize asteroid positions
|
||||
/// </summary>
|
||||
public int randomSeed;
|
||||
}
|
||||
}
|
||||
192
NewHorizons/External/Modules/AtmosphereModule.cs
vendored
192
NewHorizons/External/Modules/AtmosphereModule.cs
vendored
@ -1,6 +1,7 @@
|
||||
using System.Runtime.Serialization;
|
||||
using NewHorizons.Utility;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
@ -8,156 +9,169 @@ namespace NewHorizons.External.Modules
|
||||
{
|
||||
public enum CloudFluidType
|
||||
{
|
||||
[EnumMember(Value = @"NONE")]
|
||||
None = 0,
|
||||
[EnumMember(Value = @"NONE")] None = 0,
|
||||
|
||||
[EnumMember(Value = @"WATER")]
|
||||
Water = 1,
|
||||
[EnumMember(Value = @"WATER")] Water = 1,
|
||||
|
||||
[EnumMember(Value = @"CLOUD")]
|
||||
Cloud = 2,
|
||||
[EnumMember(Value = @"CLOUD")] Cloud = 2,
|
||||
|
||||
[EnumMember(Value = @"SAND")]
|
||||
Sand = 3,
|
||||
[EnumMember(Value = @"SAND")] Sand = 3,
|
||||
|
||||
[EnumMember(Value = @"PLASMA")]
|
||||
Plasma = 4
|
||||
[EnumMember(Value = @"PLASMA")] Plasma = 4
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class AtmosphereModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Scale height of the atmosphere
|
||||
/// </summary>
|
||||
public float Size;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of atmospheric shader on the planet.
|
||||
/// </summary>
|
||||
public MColor AtmosphereTint;
|
||||
public MColor atmosphereTint;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of fog on the planet, if you put fog.
|
||||
/// Describes the clouds in the atmosphere
|
||||
/// </summary>
|
||||
public MColor FogTint;
|
||||
public CloudInfo clouds;
|
||||
|
||||
/// <summary>
|
||||
/// How dense the fog is, if you put fog.
|
||||
/// </summary>
|
||||
// FIXME: Min & Max Needed!
|
||||
public float FogDensity;
|
||||
public float fogDensity;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of fog sphere, independent of the atmosphere. This has to be set for there to be fog.
|
||||
/// </summary>
|
||||
public float FogSize;
|
||||
public float fogSize;
|
||||
|
||||
/// <summary>
|
||||
/// Does this planet have rain?
|
||||
/// Colour of fog on the planet, if you put fog.
|
||||
/// </summary>
|
||||
public bool HasRain;
|
||||
|
||||
/// <summary>
|
||||
/// Does this planet have snow?
|
||||
/// </summary>
|
||||
public bool HasSnow;
|
||||
public MColor fogTint;
|
||||
|
||||
/// <summary>
|
||||
/// Lets you survive on the planet without a suit.
|
||||
/// </summary>
|
||||
public bool HasOxygen;
|
||||
public bool hasOxygen;
|
||||
|
||||
/// <summary>
|
||||
/// Whether we use an atmospheric shader on the planet. Doesn't affect clouds, fog, rain, snow, oxygen, etc. Purely visual.
|
||||
/// Does this planet have rain?
|
||||
/// </summary>
|
||||
public bool UseAtmosphereShader;
|
||||
public bool hasRain;
|
||||
|
||||
/// <summary>
|
||||
/// Describes the clouds in the atmosphere
|
||||
/// Does this planet have snow?
|
||||
/// </summary>
|
||||
public CloudInfo Clouds;
|
||||
public bool hasSnow;
|
||||
|
||||
/// <summary>
|
||||
/// Scale height of the atmosphere
|
||||
/// </summary>
|
||||
public float size;
|
||||
|
||||
#region Obsolete
|
||||
[System.Obsolete("CloudTint is deprecated, please use CloudInfo instead")] public MColor CloudTint;
|
||||
[System.Obsolete("CloudTint is deprecated, please use CloudInfo instead")] public string Cloud;
|
||||
[System.Obsolete("CloudCap is deprecated, please use CloudInfo instead")] public string CloudCap;
|
||||
[System.Obsolete("CloudRamp is deprecated, please use CloudInfo instead")] public string CloudRamp;
|
||||
[System.Obsolete("CloudFluidType is deprecated, please use CloudInfo instead")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public CloudFluidType? FluidType;
|
||||
[System.Obsolete("UseBasicCloudShader is deprecated, please use CloudInfo instead")] public bool UseBasicCloudShader;
|
||||
[DefaultValue(true)] [System.Obsolete("ShadowsOnClouds is deprecated, please use CloudInfo instead")] public bool ShadowsOnClouds = true;
|
||||
[System.Obsolete("HasAtmosphere is deprecated, please use UseAtmosphereShader instead")] public bool HasAtmosphere;
|
||||
#endregion Obsolete
|
||||
/// <summary>
|
||||
/// Whether we use an atmospheric shader on the planet. Doesn't affect clouds, fog, rain, snow, oxygen, etc. Purely
|
||||
/// visual.
|
||||
/// </summary>
|
||||
public bool useAtmosphereShader;
|
||||
|
||||
public class AirInfo
|
||||
{
|
||||
public float Scale;
|
||||
public bool HasOxygen;
|
||||
public bool IsRaining;
|
||||
public bool IsSnowing;
|
||||
public bool hasOxygen;
|
||||
public bool isRaining;
|
||||
public bool isSnowing;
|
||||
public float scale;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class CloudInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Radius from the center to the outer layer of the clouds.
|
||||
/// </summary>
|
||||
public float OuterCloudRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Radius from the center to the inner layer of the clouds.
|
||||
/// </summary>
|
||||
public float InnerCloudRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of the inner cloud layer.
|
||||
/// </summary>
|
||||
public MColor Tint;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the cloud texture, if the planet has clouds.
|
||||
/// </summary>
|
||||
public string TexturePath;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the cloud cap texture, if the planet has clouds.
|
||||
/// </summary>
|
||||
public string CapPath;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the cloud ramp texture, if the planet has clouds. If you don't put anything here it will be auto-generated.
|
||||
/// </summary>
|
||||
public string RampPath;
|
||||
public string capPath;
|
||||
|
||||
/// <summary>
|
||||
/// Fluid type for sounds/effects when colliding with this cloud.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public CloudFluidType? FluidType = CloudFluidType.Cloud;
|
||||
|
||||
/// <summary>
|
||||
/// Set to `false` in order to use Giant's deep shader. Set to `true` to just apply the cloud texture as is.
|
||||
/// </summary>
|
||||
public bool UseBasicCloudShader;
|
||||
|
||||
/// <summary>
|
||||
/// If the top layer shouldn't have shadows. Set to true if you're making a brown dwarf for example.
|
||||
/// </summary>
|
||||
public bool Unlit;
|
||||
public CloudFluidType? fluidType = CloudFluidType.Cloud;
|
||||
|
||||
/// <summary>
|
||||
/// Add lightning to this planet like on Giant's Deep.
|
||||
/// </summary>
|
||||
public bool HasLightning;
|
||||
public bool hasLightning;
|
||||
|
||||
/// <summary>
|
||||
/// Radius from the center to the inner layer of the clouds.
|
||||
/// </summary>
|
||||
public float innerCloudRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Colour gradient of the lightning, time is in seconds.
|
||||
/// </summary>
|
||||
public MGradient[] LightningGradient;
|
||||
public MGradient[] lightningGradient;
|
||||
|
||||
/// <summary>
|
||||
/// Radius from the center to the outer layer of the clouds.
|
||||
/// </summary>
|
||||
public float outerCloudRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the cloud ramp texture, if the planet has clouds. If you don't put anything here it will be
|
||||
/// auto-generated.
|
||||
/// </summary>
|
||||
public string rampPath;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the cloud texture, if the planet has clouds.
|
||||
/// </summary>
|
||||
public string texturePath;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of the inner cloud layer.
|
||||
/// </summary>
|
||||
public MColor tint;
|
||||
|
||||
/// <summary>
|
||||
/// If the top layer shouldn't have shadows. Set to true if you're making a brown dwarf for example.
|
||||
/// </summary>
|
||||
public bool unlit;
|
||||
|
||||
/// <summary>
|
||||
/// Set to `false` in order to use Giant's deep shader. Set to `true` to just apply the cloud texture as is.
|
||||
/// </summary>
|
||||
public bool useBasicCloudShader;
|
||||
}
|
||||
|
||||
|
||||
#region Obsolete
|
||||
|
||||
[Obsolete("CloudTint is deprecated, please use CloudInfo instead")]
|
||||
public MColor cloudTint;
|
||||
|
||||
[Obsolete("CloudTint is deprecated, please use CloudInfo instead")]
|
||||
public string cloud;
|
||||
|
||||
[Obsolete("CloudCap is deprecated, please use CloudInfo instead")]
|
||||
public string cloudCap;
|
||||
|
||||
[Obsolete("CloudRamp is deprecated, please use CloudInfo instead")]
|
||||
public string cloudRamp;
|
||||
|
||||
[Obsolete("CloudFluidType is deprecated, please use CloudInfo instead")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public CloudFluidType? fluidType;
|
||||
|
||||
[Obsolete("UseBasicCloudShader is deprecated, please use CloudInfo instead")]
|
||||
public bool useBasicCloudShader;
|
||||
|
||||
[DefaultValue(true)] [Obsolete("ShadowsOnClouds is deprecated, please use CloudInfo instead")]
|
||||
public bool shadowsOnClouds = true;
|
||||
|
||||
[Obsolete("HasAtmosphere is deprecated, please use UseAtmosphereShader instead")]
|
||||
public bool hasAtmosphere;
|
||||
|
||||
#endregion Obsolete
|
||||
}
|
||||
}
|
||||
130
NewHorizons/External/Modules/BaseModule.cs
vendored
130
NewHorizons/External/Modules/BaseModule.cs
vendored
@ -1,15 +1,15 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine.Internal;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace NewHorizons.External.Modules
|
||||
{
|
||||
public enum GravityFallOff
|
||||
{
|
||||
[EnumMember(Value = @"linear")]
|
||||
Linear = 0,
|
||||
[EnumMember(Value = @"linear")] Linear = 0,
|
||||
|
||||
[EnumMember(Value = @"inverseSquared")]
|
||||
InverseSquared = 1
|
||||
@ -18,86 +18,100 @@ namespace NewHorizons.External.Modules
|
||||
[JsonObject]
|
||||
public class BaseModule
|
||||
{
|
||||
/// <summary>
|
||||
/// If the body should have a marker on the map screen.
|
||||
/// </summary>
|
||||
public bool HasMapMarker;
|
||||
|
||||
/// <summary>
|
||||
/// The intensity of light the dark side of the body should have. Timber Hearth has `1.4` for reference
|
||||
/// </summary>
|
||||
public float AmbientLight;
|
||||
public float ambientLight;
|
||||
|
||||
/// <summary>
|
||||
/// The acceleration due to gravity felt as the surfaceSize. Timber Hearth has 12 for reference
|
||||
/// Set this to true if you are replacing the sun with a different body. Only one object in a star system should ever
|
||||
/// have this set to true.
|
||||
/// </summary>
|
||||
public float SurfaceGravity;
|
||||
public bool centerOfSolarSystem;
|
||||
|
||||
/// <summary>
|
||||
/// How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared.
|
||||
/// Radius of the cloaking field around the planet. It's a bit finicky so experiment with different values. If you
|
||||
/// don't want a cloak, leave this as 0.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
public GravityFallOff GravityFallOff = GravityFallOff.Linear;
|
||||
|
||||
/// <summary>
|
||||
/// A scale height used for a number of things. Should be the approximate radius of the body.
|
||||
/// </summary>
|
||||
public float SurfaceSize;
|
||||
|
||||
/// <summary>
|
||||
/// An override for the radius of the planet's gravitational sphere of influence. Optional
|
||||
/// </summary>
|
||||
public float SphereOfInfluence;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of a simple sphere used as the ground for the planet. If you want to use more complex terrain, leave this as 0.
|
||||
/// </summary>
|
||||
public float GroundSize;
|
||||
|
||||
/// <summary>
|
||||
/// If you want the body to have a tail like the Interloper.
|
||||
/// </summary>
|
||||
public bool HasCometTail;
|
||||
public float cloakRadius;
|
||||
|
||||
/// <summary>
|
||||
/// If it has a comet tail, it'll be oriented according to these Euler angles.
|
||||
/// </summary>
|
||||
public MVector3 CometTailRotation;
|
||||
public MVector3 cometTailRotation;
|
||||
|
||||
/// <summary>
|
||||
/// How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public GravityFallOff gravityFallOff = GravityFallOff.Linear;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of a simple sphere used as the ground for the planet. If you want to use more complex terrain, leave this as
|
||||
/// 0.
|
||||
/// </summary>
|
||||
public float groundSize;
|
||||
|
||||
/// <summary>
|
||||
/// If you want the body to have a tail like the Interloper.
|
||||
/// </summary>
|
||||
public bool hasCometTail;
|
||||
|
||||
/// <summary>
|
||||
/// If the body should have a marker on the map screen.
|
||||
/// </summary>
|
||||
public bool hasMapMarker;
|
||||
|
||||
/// <summary>
|
||||
/// Allows the object to be targeted on the map.
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(true)]
|
||||
public bool HasReferenceFrame = true;
|
||||
|
||||
/// <summary>
|
||||
/// Set this to true if you are replacing the sun with a different body. Only one object in a star system should ever have this set to true.
|
||||
/// </summary>
|
||||
public bool CenterOfSolarSystem = false;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of the cloaking field around the planet. It's a bit finicky so experiment with different values. If you don't want a cloak, leave this as 0.
|
||||
/// </summary>
|
||||
public float CloakRadius = 0f;
|
||||
[DefaultValue(true)] public bool hasReferenceFrame = true;
|
||||
|
||||
/// <summary>
|
||||
/// Can this planet survive entering a star?
|
||||
/// </summary>
|
||||
public bool InvulnerableToSun;
|
||||
public bool invulnerableToSun;
|
||||
|
||||
/// <summary>
|
||||
/// Do we show the minimap when walking around this planet?
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(true)]
|
||||
public bool ShowMinimap = true;
|
||||
[DefaultValue(true)] public bool showMinimap = true;
|
||||
|
||||
/// <summary>
|
||||
/// An override for the radius of the planet's gravitational sphere of influence. Optional
|
||||
/// </summary>
|
||||
public float sphereOfInfluence;
|
||||
|
||||
/// <summary>
|
||||
/// The acceleration due to gravity felt as the surfaceSize. Timber Hearth has 12 for reference
|
||||
/// </summary>
|
||||
public float surfaceGravity;
|
||||
|
||||
/// <summary>
|
||||
/// A scale height used for a number of things. Should be the approximate radius of the body.
|
||||
/// </summary>
|
||||
public float surfaceSize;
|
||||
|
||||
#region Obsolete
|
||||
[System.Obsolete("IsSatellite is deprecated, please use ShowMinimap instead")] public bool IsSatellite;
|
||||
[System.Obsolete("BlackHoleSize is deprecated, please use SingularityModule instead")] public float BlackHoleSize;
|
||||
[System.Obsolete("LavaSize is deprecated, please use LavaModule instead")] public float LavaSize;
|
||||
[System.Obsolete("WaterTint is deprecated, please use WaterModule instead")] public float WaterSize;
|
||||
[System.Obsolete("WaterTint is deprecated, please use WaterModule instead")] public MColor WaterTint;
|
||||
[System.Obsolete("HasAmbientLight is deprecated, please use AmbientLight instead")] public bool HasAmbientLight;
|
||||
|
||||
[Obsolete("IsSatellite is deprecated, please use ShowMinimap instead")]
|
||||
public bool isSatellite;
|
||||
|
||||
[Obsolete("BlackHoleSize is deprecated, please use SingularityModule instead")]
|
||||
public float blackHoleSize;
|
||||
|
||||
[Obsolete("LavaSize is deprecated, please use LavaModule instead")]
|
||||
public float lavaSize;
|
||||
|
||||
[Obsolete("WaterTint is deprecated, please use WaterModule instead")]
|
||||
public float waterSize;
|
||||
|
||||
[Obsolete("WaterTint is deprecated, please use WaterModule instead")]
|
||||
public MColor waterTint;
|
||||
|
||||
[Obsolete("HasAmbientLight is deprecated, please use AmbientLight instead")]
|
||||
public bool hasAmbientLight;
|
||||
|
||||
#endregion Obsolete
|
||||
}
|
||||
}
|
||||
@ -8,11 +8,11 @@ namespace NewHorizons.External.Modules
|
||||
/// <summary>
|
||||
/// Name of the primary planet in this binary system
|
||||
/// </summary>
|
||||
public string Primary;
|
||||
public string primary;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the secondary planet in this binary system
|
||||
/// </summary>
|
||||
public string Secondary;
|
||||
public string secondary;
|
||||
}
|
||||
}
|
||||
27
NewHorizons/External/Modules/HeightMapModule.cs
vendored
27
NewHorizons/External/Modules/HeightMapModule.cs
vendored
@ -1,4 +1,5 @@
|
||||
using NewHorizons.Utility;
|
||||
|
||||
namespace NewHorizons.External.Modules
|
||||
{
|
||||
public class HeightMapModule
|
||||
@ -6,26 +7,26 @@ namespace NewHorizons.External.Modules
|
||||
/// <summary>
|
||||
/// Relative filepath to the texture used for the terrain height.
|
||||
/// </summary>
|
||||
public string HeightMap;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the texture used for the terrain.
|
||||
/// </summary>
|
||||
public string TextureMap;
|
||||
|
||||
/// <summary>
|
||||
/// The lowest points on your planet will be at this height.
|
||||
/// </summary>
|
||||
public float MinHeight;
|
||||
public string heightMap;
|
||||
|
||||
/// <summary>
|
||||
/// The highest points on your planet will be at this height.
|
||||
/// </summary>
|
||||
public float MaxHeight;
|
||||
public float maxHeight;
|
||||
|
||||
/// <summary>
|
||||
/// The lowest points on your planet will be at this height.
|
||||
/// </summary>
|
||||
public float minHeight;
|
||||
|
||||
/// <summary>
|
||||
/// The scale of the terrain.
|
||||
/// </summary>
|
||||
public MVector3 Stretch;
|
||||
public MVector3 stretch;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the texture used for the terrain.
|
||||
/// </summary>
|
||||
public string textureMap;
|
||||
}
|
||||
}
|
||||
79
NewHorizons/External/Modules/OrbitModule.cs
vendored
79
NewHorizons/External/Modules/OrbitModule.cs
vendored
@ -1,24 +1,11 @@
|
||||
using NewHorizons.Components.Orbital;
|
||||
using System.ComponentModel;
|
||||
using NewHorizons.Components.Orbital;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine.Internal;
|
||||
|
||||
namespace NewHorizons.External.Modules
|
||||
{
|
||||
public class OrbitModule : IOrbitalParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// The semi-major axis of the ellipse that is the body's orbit. For a circular orbit this is the radius.
|
||||
/// </summary>
|
||||
public float SemiMajorAxis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The angle (in degrees) between the body's orbit and the plane of the star system
|
||||
/// </summary>
|
||||
public float Inclination { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the body this one will orbit around
|
||||
/// </summary>
|
||||
@ -29,27 +16,6 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public bool IsMoon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An angle (in degrees) defining the point where the orbit of the body rises above the orbital plane if it has nonzero inclination.
|
||||
/// </summary>
|
||||
public float LongitudeOfAscendingNode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// At 0 the orbit is a circle. The closer to 1 it is, the more oval-shaped the orbit is.
|
||||
/// </summary>
|
||||
// FIXME: Needs Min & Max!
|
||||
public float Eccentricity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An angle (in degrees) defining the location of the periapsis (the closest distance to it's primary body) if it has nonzero eccentricity.
|
||||
/// </summary>
|
||||
public float ArgumentOfPeriapsis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Where the planet should start off in its orbit in terms of the central angle.
|
||||
/// </summary>
|
||||
public float TrueAnomaly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The angle between the normal to the orbital plane and its axis of rotation.
|
||||
/// </summary>
|
||||
@ -66,14 +32,15 @@ namespace NewHorizons.External.Modules
|
||||
public bool IsTidallyLocked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If it is tidally locked, this direction will face towards the primary. Ex: Interloper uses `0, -1, 0`. Most planets will want something like `-1, 0, 0`.
|
||||
/// If it is tidally locked, this direction will face towards the primary. Ex: Interloper uses `0, -1, 0`. Most planets
|
||||
/// will want something like `-1, 0, 0`.
|
||||
/// </summary>
|
||||
public MVector3 AlignmentAxis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Referring to the orbit line in the map screen.
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(true)]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowOrbitLine { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
@ -96,9 +63,43 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public bool TrackingOrbitLine { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The semi-major axis of the ellipse that is the body's orbit. For a circular orbit this is the radius.
|
||||
/// </summary>
|
||||
public float SemiMajorAxis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The angle (in degrees) between the body's orbit and the plane of the star system
|
||||
/// </summary>
|
||||
public float Inclination { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An angle (in degrees) defining the point where the orbit of the body rises above the orbital plane if it has
|
||||
/// nonzero inclination.
|
||||
/// </summary>
|
||||
public float LongitudeOfAscendingNode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// At 0 the orbit is a circle. The closer to 1 it is, the more oval-shaped the orbit is.
|
||||
/// </summary>
|
||||
// FIXME: Needs Min & Max!
|
||||
public float Eccentricity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An angle (in degrees) defining the location of the periapsis (the closest distance to it's primary body) if it has
|
||||
/// nonzero eccentricity.
|
||||
/// </summary>
|
||||
public float ArgumentOfPeriapsis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Where the planet should start off in its orbit in terms of the central angle.
|
||||
/// </summary>
|
||||
public float TrueAnomaly { get; set; }
|
||||
|
||||
public OrbitalParameters GetOrbitalParameters(Gravity primaryGravity, Gravity secondaryGravity)
|
||||
{
|
||||
return OrbitalParameters.FromTrueAnomaly(primaryGravity, secondaryGravity, Eccentricity, SemiMajorAxis, Inclination, ArgumentOfPeriapsis, LongitudeOfAscendingNode, TrueAnomaly);
|
||||
return OrbitalParameters.FromTrueAnomaly(primaryGravity, secondaryGravity, Eccentricity, SemiMajorAxis,
|
||||
Inclination, ArgumentOfPeriapsis, LongitudeOfAscendingNode, TrueAnomaly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@ namespace NewHorizons.External.Modules
|
||||
[JsonObject]
|
||||
public class ProcGenModule
|
||||
{
|
||||
public float Scale;
|
||||
public MColor Color;
|
||||
public MColor color;
|
||||
public float scale;
|
||||
}
|
||||
}
|
||||
509
NewHorizons/External/Modules/PropModule.cs
vendored
509
NewHorizons/External/Modules/PropModule.cs
vendored
@ -1,6 +1,6 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using NewHorizons.Utility;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
@ -9,94 +9,89 @@ namespace NewHorizons.External.Modules
|
||||
[JsonObject]
|
||||
public class PropModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Scatter props around this planet's surface
|
||||
/// </summary>
|
||||
public ScatterInfo[] Scatter;
|
||||
|
||||
/// <summary>
|
||||
/// Place props in predefined positions on the planet
|
||||
/// </summary>
|
||||
public DetailInfo[] Details;
|
||||
|
||||
/// <summary>
|
||||
/// Add rafts to this planet
|
||||
/// </summary>
|
||||
public RaftInfo[] Rafts;
|
||||
|
||||
/// <summary>
|
||||
/// Add Geysers to this planet
|
||||
/// </summary>
|
||||
public GeyserInfo[] Geysers;
|
||||
|
||||
/// <summary>
|
||||
/// Add tornadoes to this planet
|
||||
/// </summary>
|
||||
public TornadoInfo[] Tornados;
|
||||
|
||||
/// <summary>
|
||||
/// Add volcanoes to this planet
|
||||
/// </summary>
|
||||
public VolcanoInfo[] Volcanoes;
|
||||
public DetailInfo[] details;
|
||||
|
||||
/// <summary>
|
||||
/// Add dialogue triggers to this planet
|
||||
/// </summary>
|
||||
public DialogueInfo[] Dialogue;
|
||||
|
||||
/// <summary>
|
||||
/// Add triggers that reveal parts of the ship log on this planet
|
||||
/// </summary>
|
||||
public RevealInfo[] Reveal;
|
||||
public DialogueInfo[] dialogue;
|
||||
|
||||
/// <summary>
|
||||
/// Add ship log entry locations on this planet
|
||||
/// </summary>
|
||||
public EntryLocationInfo[] EntryLocation;
|
||||
public EntryLocationInfo[] entryLocation;
|
||||
|
||||
/// <summary>
|
||||
/// Add Geysers to this planet
|
||||
/// </summary>
|
||||
public GeyserInfo[] geysers;
|
||||
|
||||
/// <summary>
|
||||
/// Add translatable text to this planet
|
||||
/// </summary>
|
||||
public NomaiTextInfo[] NomaiText;
|
||||
|
||||
/// <summary>
|
||||
/// Add slideshows (from the DLC) to the planet
|
||||
/// </summary>
|
||||
public ProjectionInfo[] SlideShows;
|
||||
public NomaiTextInfo[] nomaiText;
|
||||
|
||||
/// <summary>
|
||||
/// Details which will be shown from 50km away. Meant to be lower resolution.
|
||||
/// </summary>
|
||||
public DetailInfo[] ProxyDetails;
|
||||
public DetailInfo[] proxyDetails;
|
||||
|
||||
/// <summary>
|
||||
/// Add rafts to this planet
|
||||
/// </summary>
|
||||
public RaftInfo[] rafts;
|
||||
|
||||
/// <summary>
|
||||
/// Add triggers that reveal parts of the ship log on this planet
|
||||
/// </summary>
|
||||
public RevealInfo[] reveal;
|
||||
|
||||
/// <summary>
|
||||
/// Scatter props around this planet's surface
|
||||
/// </summary>
|
||||
public ScatterInfo[] scatter;
|
||||
|
||||
/// <summary>
|
||||
/// Add slideshows (from the DLC) to the planet
|
||||
/// </summary>
|
||||
public ProjectionInfo[] slideShows;
|
||||
|
||||
/// <summary>
|
||||
/// Add tornadoes to this planet
|
||||
/// </summary>
|
||||
public TornadoInfo[] tornados;
|
||||
|
||||
/// <summary>
|
||||
/// Add volcanoes to this planet
|
||||
/// </summary>
|
||||
public VolcanoInfo[] volcanoes;
|
||||
|
||||
[JsonObject]
|
||||
public class ScatterInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The number used as entropy for scattering the props
|
||||
/// Relative filepath to an asset-bundle"
|
||||
/// </summary>
|
||||
public int seed;
|
||||
public string assetBundle;
|
||||
|
||||
/// <summary>
|
||||
/// Number of props to scatter
|
||||
/// </summary>
|
||||
public int count;
|
||||
|
||||
/// <summary>
|
||||
/// Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle
|
||||
/// </summary>
|
||||
public string path;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to an asset-bundle"
|
||||
/// </summary>
|
||||
public string assetBundle;
|
||||
|
||||
/// <summary>
|
||||
/// Offset this prop once it is placed
|
||||
/// </summary>
|
||||
public MVector3 offset;
|
||||
|
||||
/// <summary>
|
||||
/// Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle
|
||||
/// </summary>
|
||||
public string path;
|
||||
|
||||
/// <summary>
|
||||
/// Rotate this prop once it is placed
|
||||
/// </summary>
|
||||
@ -106,36 +101,57 @@ namespace NewHorizons.External.Modules
|
||||
/// Scale this prop once it is placed
|
||||
/// </summary>
|
||||
public float scale = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// The number used as entropy for scattering the props
|
||||
/// </summary>
|
||||
public int seed;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class DetailInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle
|
||||
/// Do we override rotation and try to automatically align this object to stand upright on the body's surface?
|
||||
/// </summary>
|
||||
public string path;
|
||||
|
||||
/// <summary>
|
||||
/// [DEPRECATED] Path to the .obj file to load a 3d model from
|
||||
/// </summary>
|
||||
public string objFilePath;
|
||||
|
||||
/// <summary>
|
||||
/// [DEPRECATED] Path to the .mtl file to load a 3d model from
|
||||
/// </summary>
|
||||
public string mtlFilePath;
|
||||
public bool alignToNormal;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to an asset-bundle to load the prefab defined in `path` from/
|
||||
/// </summary>
|
||||
public string assetBundle;
|
||||
|
||||
/// <summary>
|
||||
/// [DEPRECATED] Path to the .mtl file to load a 3d model from
|
||||
/// </summary>
|
||||
public string mtlFilePath;
|
||||
|
||||
/// <summary>
|
||||
/// [DEPRECATED] Path to the .obj file to load a 3d model from
|
||||
/// </summary>
|
||||
public string objFilePath;
|
||||
|
||||
/// <summary>
|
||||
/// Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle
|
||||
/// </summary>
|
||||
public string path;
|
||||
|
||||
/// <summary>
|
||||
/// Position of this prop relative to the body's center
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// A list of children to remove from this detail
|
||||
/// </summary>
|
||||
public string[] removeChildren;
|
||||
|
||||
/// <summary>
|
||||
/// Do we reset all the components on this object? Useful for certain props that have dialogue components attached to
|
||||
/// them.
|
||||
/// </summary>
|
||||
public bool removeComponents;
|
||||
|
||||
/// <summary>
|
||||
/// Rotate this prop
|
||||
/// </summary>
|
||||
@ -144,23 +160,7 @@ namespace NewHorizons.External.Modules
|
||||
/// <summary>
|
||||
/// Scale the prop
|
||||
/// </summary>
|
||||
[DefaultValue(1f)]
|
||||
public float scale = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Do we override rotation and try to automatically align this object to stand upright on the body's surface?
|
||||
/// </summary>
|
||||
public bool alignToNormal;
|
||||
|
||||
/// <summary>
|
||||
/// A list of children to remove from this detail
|
||||
/// </summary>
|
||||
public string[] removeChildren;
|
||||
|
||||
/// <summary>
|
||||
/// Do we reset all the components on this object? Useful for certain props that have dialogue components attached to them.
|
||||
/// </summary>
|
||||
public bool removeComponents;
|
||||
[DefaultValue(1f)] public float scale = 1f;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
@ -186,20 +186,17 @@ namespace NewHorizons.External.Modules
|
||||
{
|
||||
public enum TornadoType
|
||||
{
|
||||
[EnumMember(Value = @"downwards")]
|
||||
Downwards = 0,
|
||||
[EnumMember(Value = @"downwards")] Downwards = 0,
|
||||
|
||||
[EnumMember(Value = @"upwards")]
|
||||
Upwards = 1,
|
||||
[EnumMember(Value = @"upwards")] Upwards = 1,
|
||||
|
||||
[EnumMember(Value = @"hurricane")]
|
||||
Hurricane = 2
|
||||
[EnumMember(Value = @"hurricane")] Hurricane = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Position of the tornado
|
||||
/// [DEPRECATED] Should this tornado shoot you down instead of up?
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
public bool downwards;
|
||||
|
||||
/// <summary>
|
||||
/// Alternative to setting the position. Will choose a random place at this elevation.
|
||||
@ -209,8 +206,12 @@ namespace NewHorizons.External.Modules
|
||||
/// <summary>
|
||||
/// The height of this tornado.
|
||||
/// </summary>
|
||||
[DefaultValue(30f)]
|
||||
public float height = 30f;
|
||||
[DefaultValue(30f)] public float height = 30f;
|
||||
|
||||
/// <summary>
|
||||
/// Position of the tornado
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// The colour of the tornado.
|
||||
@ -223,32 +224,51 @@ namespace NewHorizons.External.Modules
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public TornadoType type = TornadoType.Downwards;
|
||||
|
||||
/// <summary>
|
||||
/// [DEPRECATED] Should this tornado shoot you down instead of up?
|
||||
/// </summary>
|
||||
public bool downwards;
|
||||
|
||||
/// <summary>
|
||||
/// The rate at which the tornado will wander around the planet. Set to 0 for it to be stationary. Should be around 0.1.
|
||||
/// </summary>
|
||||
public float wanderRate;
|
||||
|
||||
/// <summary>
|
||||
/// Angular distance from the starting position that it will wander, in terms of the angle around the x-axis.
|
||||
/// </summary>
|
||||
[DefaultValue(45f)]
|
||||
public float wanderDegreesX = 45f;
|
||||
[DefaultValue(45f)] public float wanderDegreesX = 45f;
|
||||
|
||||
/// <summary>
|
||||
/// Angular distance from the starting position that it will wander, in terms of the angle around the z-axis.
|
||||
/// </summary>
|
||||
[DefaultValue(45f)]
|
||||
public float wanderDegreesZ = 45f;
|
||||
[DefaultValue(45f)] public float wanderDegreesZ = 45f;
|
||||
|
||||
/// <summary>
|
||||
/// The rate at which the tornado will wander around the planet. Set to 0 for it to be stationary. Should be around
|
||||
/// 0.1.
|
||||
/// </summary>
|
||||
public float wanderRate;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class VolcanoInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The colour of the meteor's lava.
|
||||
/// </summary>
|
||||
public MColor lavaTint;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum time between meteor launches.
|
||||
/// </summary>
|
||||
public float maxInterval = 20f;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum random speed at which meteors are launched.
|
||||
/// </summary>
|
||||
public float maxLaunchSpeed = 150f;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum time between meteor launches.
|
||||
/// </summary>
|
||||
public float minInterval = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum random speed at which meteors are launched.
|
||||
/// </summary>
|
||||
public float minLaunchSpeed = 50f;
|
||||
|
||||
/// <summary>
|
||||
/// Position of this volcano
|
||||
/// </summary>
|
||||
@ -263,46 +283,45 @@ namespace NewHorizons.External.Modules
|
||||
/// The colour of the meteor's stone.
|
||||
/// </summary>
|
||||
public MColor stoneTint;
|
||||
|
||||
/// <summary>
|
||||
/// The colour of the meteor's lava.
|
||||
/// </summary>
|
||||
public MColor lavaTint;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum random speed at which meteors are launched.
|
||||
/// </summary>
|
||||
public float minLaunchSpeed = 50f;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum random speed at which meteors are launched.
|
||||
/// </summary>
|
||||
public float maxLaunchSpeed = 150f;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum time between meteor launches.
|
||||
/// </summary>
|
||||
public float minInterval = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum time between meteor launches.
|
||||
/// </summary>
|
||||
public float maxInterval = 20f;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class DialogueInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Prevents the dialogue from being created after a specific persistent condition is set. Useful for remote dialogue
|
||||
/// triggers that you want to have happen only once.
|
||||
/// </summary>
|
||||
public string blockAfterPersistentCondition;
|
||||
|
||||
/// <summary>
|
||||
/// If a pathToAnimController is supplied, if you are within this distance the character will look at you. If it is set
|
||||
/// to 0, they will only look at you when spoken to.
|
||||
/// </summary>
|
||||
public float lookAtRadius;
|
||||
|
||||
/// <summary>
|
||||
/// If this dialogue is meant for a character, this is the relative path from the planet to that character's
|
||||
/// CharacterAnimController or SolanumAnimController.
|
||||
/// </summary>
|
||||
public string pathToAnimController;
|
||||
|
||||
/// <summary>
|
||||
/// When you enter into dialogue, you will look here.
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of the spherical collision volume where you get the "talk to" prompt when looking at. If you use a remoteTriggerPosition, you can set this to 0 to make the dialogue only trigger remotely.
|
||||
/// Radius of the spherical collision volume where you get the "talk to" prompt when looking at. If you use a
|
||||
/// remoteTriggerPosition, you can set this to 0 to make the dialogue only trigger remotely.
|
||||
/// </summary>
|
||||
public float radius = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to trigger dialogue from a distance when you walk into an area.
|
||||
/// </summary>
|
||||
public MVector3 remoteTriggerPosition;
|
||||
|
||||
/// <summary>
|
||||
/// The radius of the remote trigger volume.
|
||||
/// </summary>
|
||||
@ -312,26 +331,6 @@ namespace NewHorizons.External.Modules
|
||||
/// Relative path to the xml file defining the dialogue.
|
||||
/// </summary>
|
||||
public string xmlFile;
|
||||
|
||||
/// <summary>
|
||||
/// Allows you to trigger dialogue from a distance when you walk into an area.
|
||||
/// </summary>
|
||||
public MVector3 remoteTriggerPosition;
|
||||
|
||||
/// <summary>
|
||||
/// Prevents the dialogue from being created after a specific persistent condition is set. Useful for remote dialogue triggers that you want to have happen only once.
|
||||
/// </summary>
|
||||
public string blockAfterPersistentCondition;
|
||||
|
||||
/// <summary>
|
||||
/// If this dialogue is meant for a character, this is the relative path from the planet to that character's CharacterAnimController or SolanumAnimController.
|
||||
/// </summary>
|
||||
public string pathToAnimController;
|
||||
|
||||
/// <summary>
|
||||
/// If a pathToAnimController is supplied, if you are within this distance the character will look at you. If it is set to 0, they will only look at you when spoken to.
|
||||
/// </summary>
|
||||
public float lookAtRadius;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
@ -339,26 +338,22 @@ namespace NewHorizons.External.Modules
|
||||
{
|
||||
public enum RevealVolumeType
|
||||
{
|
||||
[EnumMember(Value = @"enter")]
|
||||
Enter = 0,
|
||||
[EnumMember(Value = @"enter")] Enter = 0,
|
||||
|
||||
[EnumMember(Value = @"observe")]
|
||||
Observe = 1,
|
||||
[EnumMember(Value = @"observe")] Observe = 1,
|
||||
|
||||
[EnumMember(Value = @"snapshot")]
|
||||
Snapshot = 2
|
||||
[EnumMember(Value = @"snapshot")] Snapshot = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What needs to be done to the volume to unlock the facts
|
||||
/// The max view angle (in degrees) the player can see the volume with to unlock the fact (`observe` only)
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RevealVolumeType revealOn = RevealVolumeType.Enter;
|
||||
public float maxAngle = 180f; // Observe Only
|
||||
|
||||
/// <summary>
|
||||
/// A list of facts to reveal
|
||||
/// The max distance the user can be away from the volume to reveal the fact (`snapshot` and `observe` only)
|
||||
/// </summary>
|
||||
public string[] reveals;
|
||||
public float maxDistance = -1f; // Snapshot & Observe Only
|
||||
|
||||
/// <summary>
|
||||
/// The position to place this volume at
|
||||
@ -371,29 +366,30 @@ namespace NewHorizons.External.Modules
|
||||
public float radius = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// The max distance the user can be away from the volume to reveal the fact (`snapshot` and `observe` only)
|
||||
/// What needs to be done to the volume to unlock the facts
|
||||
/// </summary>
|
||||
public float maxDistance = -1f; // Snapshot & Observe Only
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RevealVolumeType revealOn = RevealVolumeType.Enter;
|
||||
|
||||
/// <summary>
|
||||
/// The max view angle (in degrees) the player can see the volume with to unlock the fact (`observe` only)
|
||||
/// A list of facts to reveal
|
||||
/// </summary>
|
||||
public float maxAngle = 180f; // Observe Only
|
||||
public string[] reveals;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class EntryLocationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// ID of the entry this location relates to
|
||||
/// </summary>
|
||||
public string id;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this location is cloaked
|
||||
/// </summary>
|
||||
public bool cloaked;
|
||||
|
||||
/// <summary>
|
||||
/// ID of the entry this location relates to
|
||||
/// </summary>
|
||||
public string id;
|
||||
|
||||
/// <summary>
|
||||
/// The position of this entry location
|
||||
/// </summary>
|
||||
@ -405,26 +401,21 @@ namespace NewHorizons.External.Modules
|
||||
{
|
||||
public enum NomaiTextType
|
||||
{
|
||||
[EnumMember(Value = @"wall")]
|
||||
Wall = 0,
|
||||
[EnumMember(Value = @"wall")] Wall = 0,
|
||||
|
||||
[EnumMember(Value = @"scroll")]
|
||||
Scroll = 1,
|
||||
[EnumMember(Value = @"scroll")] Scroll = 1,
|
||||
|
||||
[EnumMember(Value = @"Computer")]
|
||||
Computer = 2,
|
||||
[EnumMember(Value = @"Computer")] Computer = 2,
|
||||
|
||||
[EnumMember(Value = @"Cairn")]
|
||||
Cairn = 3,
|
||||
[EnumMember(Value = @"Cairn")] Cairn = 3,
|
||||
|
||||
[EnumMember(Value = @"Recorder")]
|
||||
Recorder = 4
|
||||
[EnumMember(Value = @"Recorder")] Recorder = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Position of the root of this text
|
||||
/// Additional information about each arc in the text
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
public NomaiTextArcInfo[] arcInfo;
|
||||
|
||||
/// <summary>
|
||||
/// The normal vector for this object. Used for writing on walls and positioning computers.
|
||||
@ -432,10 +423,21 @@ namespace NewHorizons.External.Modules
|
||||
public MVector3 normal;
|
||||
|
||||
/// <summary>
|
||||
/// The euler angle rotation of this object. Not required if setting the normal. Computers and cairns will orient themselves to the surface of the planet automatically.
|
||||
/// Position of the root of this text
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// The euler angle rotation of this object. Not required if setting the normal. Computers and cairns will orient
|
||||
/// themselves to the surface of the planet automatically.
|
||||
/// </summary>
|
||||
public MVector3 rotation;
|
||||
|
||||
/// <summary>
|
||||
/// The random seed used to pick what the text arcs will look like.
|
||||
/// </summary>
|
||||
public int seed; // For randomizing arcs
|
||||
|
||||
/// <summary>
|
||||
/// The type of object this is.
|
||||
/// </summary>
|
||||
@ -446,16 +448,6 @@ namespace NewHorizons.External.Modules
|
||||
/// The relative path to the xml file for this object.
|
||||
/// </summary>
|
||||
public string xmlFile;
|
||||
|
||||
/// <summary>
|
||||
/// The random seed used to pick what the text arcs will look like.
|
||||
/// </summary>
|
||||
public int seed; // For randomizing arcs
|
||||
|
||||
/// <summary>
|
||||
/// Additional information about each arc in the text
|
||||
/// </summary>
|
||||
public NomaiTextArcInfo[] arcInfo;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
@ -463,14 +455,11 @@ namespace NewHorizons.External.Modules
|
||||
{
|
||||
public enum NomaiTextArcType
|
||||
{
|
||||
[EnumMember(Value = @"adult")]
|
||||
Adult = 0,
|
||||
[EnumMember(Value = @"adult")] Adult = 0,
|
||||
|
||||
[EnumMember(Value = @"child")]
|
||||
Child = 1,
|
||||
[EnumMember(Value = @"child")] Child = 1,
|
||||
|
||||
[EnumMember(Value = @"stranger")]
|
||||
Stranger = 2
|
||||
[EnumMember(Value = @"stranger")] Stranger = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -478,15 +467,15 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public MVector2 position;
|
||||
|
||||
/// <summary>
|
||||
/// The z euler angle for this arc.
|
||||
/// </summary>
|
||||
public float zRotation;
|
||||
|
||||
/// <summary>
|
||||
/// The type of text to display.
|
||||
/// </summary>
|
||||
public NomaiTextArcType type = NomaiTextArcType.Adult;
|
||||
|
||||
/// <summary>
|
||||
/// The z euler angle for this arc.
|
||||
/// </summary>
|
||||
public float zRotation;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
@ -494,11 +483,9 @@ namespace NewHorizons.External.Modules
|
||||
{
|
||||
public enum SlideShowType
|
||||
{
|
||||
[EnumMember(Value = @"slideReel")]
|
||||
SlideReel = 0,
|
||||
[EnumMember(Value = @"slideReel")] SlideReel = 0,
|
||||
|
||||
[EnumMember(Value = @"autoProjector")]
|
||||
AutoProjector = 1
|
||||
[EnumMember(Value = @"autoProjector")] AutoProjector = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -506,59 +493,35 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// The ship log entries revealed after finishing this slide reel.
|
||||
/// </summary>
|
||||
public string[] reveals;
|
||||
|
||||
/// <summary>
|
||||
/// The rotation of this slideshow.
|
||||
/// </summary>
|
||||
public MVector3 rotation;
|
||||
|
||||
/// <summary>
|
||||
/// The list of slides for this object.
|
||||
/// </summary>
|
||||
public SlideInfo[] slides;
|
||||
|
||||
/// <summary>
|
||||
/// The type of object this is.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public SlideShowType type = SlideShowType.SlideReel;
|
||||
|
||||
/// <summary>
|
||||
/// The ship log entries revealed after finishing this slide reel.
|
||||
/// </summary>
|
||||
public string[] reveals;
|
||||
|
||||
/// <summary>
|
||||
/// The list of slides for this object.
|
||||
/// </summary>
|
||||
public SlideInfo[] slides;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class SlideInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to the image file for this slide.
|
||||
/// Ambient light colour when viewing this slide.
|
||||
/// </summary>
|
||||
public string imagePath;
|
||||
|
||||
// SlideBeatAudioModule
|
||||
|
||||
/// <summary>
|
||||
/// The name of the AudioClip for a one-shot sound when opening the slide.
|
||||
/// </summary>
|
||||
public string beatAudio;
|
||||
|
||||
/// <summary>
|
||||
/// The time delay until the one-shot audio
|
||||
/// </summary>
|
||||
public float beatDelay;
|
||||
|
||||
// SlideBackdropAudioModule
|
||||
|
||||
/// <summary>
|
||||
/// The name of the AudioClip that will continuously play while watching these slides
|
||||
/// </summary>
|
||||
public string backdropAudio;
|
||||
|
||||
/// <summary>
|
||||
/// The time to fade into the backdrop audio
|
||||
/// </summary>
|
||||
public float backdropFadeTime;
|
||||
public MColor ambientLightColor;
|
||||
|
||||
|
||||
// SlideAmbientLightModule
|
||||
@ -573,15 +536,42 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public float ambientLightRange;
|
||||
|
||||
/// <summary>
|
||||
/// Ambient light colour when viewing this slide.
|
||||
/// </summary>
|
||||
public MColor ambientLightColor;
|
||||
// SlideBackdropAudioModule
|
||||
|
||||
/// <summary>
|
||||
/// Spotlight intensity modifier when viewing this slide.
|
||||
/// The name of the AudioClip that will continuously play while watching these slides
|
||||
/// </summary>
|
||||
public float spotIntensityMod;
|
||||
public string backdropAudio;
|
||||
|
||||
/// <summary>
|
||||
/// The time to fade into the backdrop audio
|
||||
/// </summary>
|
||||
public float backdropFadeTime;
|
||||
|
||||
// SlideBeatAudioModule
|
||||
|
||||
/// <summary>
|
||||
/// The name of the AudioClip for a one-shot sound when opening the slide.
|
||||
/// </summary>
|
||||
public string beatAudio;
|
||||
|
||||
/// <summary>
|
||||
/// The time delay until the one-shot audio
|
||||
/// </summary>
|
||||
public float beatDelay;
|
||||
|
||||
|
||||
// SlideBlackFrameModule
|
||||
|
||||
/// <summary>
|
||||
/// Before viewing this slide, there will be a black frame for this many seconds.
|
||||
/// </summary>
|
||||
public float blackFrameDuration;
|
||||
|
||||
/// <summary>
|
||||
/// The path to the image file for this slide.
|
||||
/// </summary>
|
||||
public string imagePath;
|
||||
|
||||
|
||||
// SlidePlayTimeModule
|
||||
@ -592,20 +582,17 @@ namespace NewHorizons.External.Modules
|
||||
public float playTimeDuration;
|
||||
|
||||
|
||||
// SlideBlackFrameModule
|
||||
|
||||
/// <summary>
|
||||
/// Before viewing this slide, there will be a black frame for this many seconds.
|
||||
/// </summary>
|
||||
public float blackFrameDuration;
|
||||
|
||||
|
||||
// SlideShipLogEntryModule
|
||||
|
||||
/// <summary>
|
||||
/// Ship log entry revealed when viewing this slide
|
||||
/// </summary>
|
||||
public string reveal;
|
||||
|
||||
/// <summary>
|
||||
/// Spotlight intensity modifier when viewing this slide.
|
||||
/// </summary>
|
||||
public float spotIntensityMod;
|
||||
}
|
||||
}
|
||||
}
|
||||
91
NewHorizons/External/Modules/ShipLogModule.cs
vendored
91
NewHorizons/External/Modules/ShipLogModule.cs
vendored
@ -1,6 +1,6 @@
|
||||
using NewHorizons.Utility;
|
||||
using System.ComponentModel;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace NewHorizons.External.Modules
|
||||
{
|
||||
@ -8,14 +8,14 @@ namespace NewHorizons.External.Modules
|
||||
public class ShipLogModule
|
||||
{
|
||||
/// <summary>
|
||||
/// The relative path to the xml file to load ship log entries from.
|
||||
/// List colors of curiosity entries
|
||||
/// </summary>
|
||||
public string xmlFile;
|
||||
public CuriosityColorInfo[] curiosities;
|
||||
|
||||
/// <summary>
|
||||
/// A path to the folder where entry sprites are stored.
|
||||
/// Manually layout entries in detective mode
|
||||
/// </summary>
|
||||
public string spriteFolder;
|
||||
public EntryPositionInfo[] entryPositions;
|
||||
|
||||
/// <summary>
|
||||
/// A list of fact IDs to reveal when the game starts.
|
||||
@ -28,33 +28,22 @@ namespace NewHorizons.External.Modules
|
||||
public MapModeInfo mapMode = new MapModeInfo();
|
||||
|
||||
/// <summary>
|
||||
/// List colors of curiosity entries
|
||||
/// A path to the folder where entry sprites are stored.
|
||||
/// </summary>
|
||||
public CuriosityColorInfo[] curiosities;
|
||||
public string spriteFolder;
|
||||
|
||||
/// <summary>
|
||||
/// Manually layout entries in detective mode
|
||||
/// The relative path to the xml file to load ship log entries from.
|
||||
/// </summary>
|
||||
public EntryPositionInfo[] entryPositions;
|
||||
public string xmlFile;
|
||||
|
||||
[JsonObject]
|
||||
public class MapModeInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to the sprite to show when the planet is revealed in map mode.
|
||||
/// Place non-selectable objects in map mode (like sand funnels).
|
||||
/// </summary>
|
||||
public string revealedSprite;
|
||||
|
||||
/// <summary>
|
||||
/// The path to the sprite to show when the planet is unexplored in map mode.
|
||||
/// </summary>
|
||||
public string outlineSprite;
|
||||
|
||||
/// <summary>
|
||||
/// Scale to apply to the planet in map mode.
|
||||
/// </summary>
|
||||
[DefaultValue(1f)]
|
||||
public float scale = 1f;
|
||||
public ShipLogDetailInfo[] details;
|
||||
|
||||
/// <summary>
|
||||
/// Hide the planet completely if unexplored instead of showing an outline.
|
||||
@ -62,9 +51,9 @@ namespace NewHorizons.External.Modules
|
||||
public bool invisibleWhenHidden;
|
||||
|
||||
/// <summary>
|
||||
/// Extra distance to apply to this object in map mode.
|
||||
/// Specify where this planet is in terms of navigation.
|
||||
/// </summary>
|
||||
public float offset;
|
||||
public MVector2 manualNavigationPosition;
|
||||
|
||||
/// <summary>
|
||||
/// Manually place this planet at the specified position.
|
||||
@ -72,9 +61,14 @@ namespace NewHorizons.External.Modules
|
||||
public MVector2 manualPosition;
|
||||
|
||||
/// <summary>
|
||||
/// Specify where this planet is in terms of navigation.
|
||||
/// Extra distance to apply to this object in map mode.
|
||||
/// </summary>
|
||||
public MVector2 manualNavigationPosition;
|
||||
public float offset;
|
||||
|
||||
/// <summary>
|
||||
/// The path to the sprite to show when the planet is unexplored in map mode.
|
||||
/// </summary>
|
||||
public string outlineSprite;
|
||||
|
||||
/// <summary>
|
||||
/// Completely remove this planet (and it's children) from map mode.
|
||||
@ -82,39 +76,44 @@ namespace NewHorizons.External.Modules
|
||||
public bool remove;
|
||||
|
||||
/// <summary>
|
||||
/// Place non-selectable objects in map mode (like sand funnels).
|
||||
/// The path to the sprite to show when the planet is revealed in map mode.
|
||||
/// </summary>
|
||||
public ShipLogDetailInfo[] details;
|
||||
public string revealedSprite;
|
||||
|
||||
/// <summary>
|
||||
/// Scale to apply to the planet in map mode.
|
||||
/// </summary>
|
||||
[DefaultValue(1f)] public float scale = 1f;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class ShipLogDetailInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The sprite to show when the parent AstroBody is revealed.
|
||||
/// Whether to completely hide this detail when the parent AstroBody is unexplored.
|
||||
/// </summary>
|
||||
public string revealedSprite;
|
||||
public bool invisibleWhenHidden;
|
||||
|
||||
/// <summary>
|
||||
/// The sprite to show when the parent AstroBody is rumored/unexplored.
|
||||
/// </summary>
|
||||
public string outlineSprite;
|
||||
|
||||
/// <summary>
|
||||
/// The angle in degrees to rotate the detail.
|
||||
/// </summary>
|
||||
public float rotation;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to completely hide this detail when the parent AstroBody is unexplored.
|
||||
/// </summary>
|
||||
public bool invisibleWhenHidden;
|
||||
|
||||
/// <summary>
|
||||
/// The position (relative to the parent) to place the detail.
|
||||
/// </summary>
|
||||
public MVector2 position;
|
||||
|
||||
/// <summary>
|
||||
/// The sprite to show when the parent AstroBody is revealed.
|
||||
/// </summary>
|
||||
public string revealedSprite;
|
||||
|
||||
/// <summary>
|
||||
/// The angle in degrees to rotate the detail.
|
||||
/// </summary>
|
||||
public float rotation;
|
||||
|
||||
/// <summary>
|
||||
/// The amount to scale the x and y-axis of the detail by.
|
||||
/// </summary>
|
||||
@ -124,11 +123,6 @@ namespace NewHorizons.External.Modules
|
||||
[JsonObject]
|
||||
public class CuriosityColorInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The ID of the curiosity to apply the color to.
|
||||
/// </summary>
|
||||
public string id;
|
||||
|
||||
/// <summary>
|
||||
/// The color to apply to entries with this curiosity.
|
||||
/// </summary>
|
||||
@ -138,6 +132,11 @@ namespace NewHorizons.External.Modules
|
||||
/// The color to apply to highlighted entries with this curiosity.
|
||||
/// </summary>
|
||||
public MColor highlightColor;
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the curiosity to apply the color to.
|
||||
/// </summary>
|
||||
public string id;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
|
||||
78
NewHorizons/External/Modules/SignalModule.cs
vendored
78
NewHorizons/External/Modules/SignalModule.cs
vendored
@ -1,6 +1,6 @@
|
||||
using NewHorizons.Utility;
|
||||
using System.ComponentModel;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace NewHorizons.External.Modules
|
||||
{
|
||||
@ -10,69 +10,67 @@ namespace NewHorizons.External.Modules
|
||||
/// <summary>
|
||||
/// List of signals to add (Why did xen do it like this)
|
||||
/// </summary>
|
||||
public SignalInfo[] Signals;
|
||||
public SignalInfo[] signals;
|
||||
|
||||
[JsonObject]
|
||||
public class SignalInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Position of the signal's source
|
||||
/// </summary>
|
||||
public MVector3 Position;
|
||||
|
||||
/// <summary>
|
||||
/// The frequency ID of the signal. The built-in game values are `Default`, `Traveler`, `Quantum`, `EscapePod`, `Statue`, `WarpCore`, `HideAndSeek`, and `Radio`. You can also put a custom value.
|
||||
/// </summary>
|
||||
public string Frequency;
|
||||
|
||||
/// <summary>
|
||||
/// The unique ID of the signal.
|
||||
/// </summary>
|
||||
public string Name;
|
||||
|
||||
/// <summary>
|
||||
/// Name of an existing AudioClip in the game that will player over the signal.
|
||||
/// </summary>
|
||||
public string AudioClip;
|
||||
public string audioClip;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the .wav file to use as the audio. Mutually exclusive with audioClip.
|
||||
/// </summary>
|
||||
public string AudioFilePath;
|
||||
public string audioFilePath;
|
||||
|
||||
/// <summary>
|
||||
/// A ship log fact to reveal when the signal is identified.
|
||||
/// How close the player must get to the signal to detect it. This is when you get the "Unknown Signal Detected"
|
||||
/// notification.
|
||||
/// </summary>
|
||||
[DefaultValue("")]
|
||||
public string Reveals = "";
|
||||
public float detectionRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of the sphere giving off the signal.
|
||||
/// The frequency ID of the signal. The built-in game values are `Default`, `Traveler`, `Quantum`, `EscapePod`,
|
||||
/// `Statue`, `WarpCore`, `HideAndSeek`, and `Radio`. You can also put a custom value.
|
||||
/// </summary>
|
||||
[DefaultValue(1f)]
|
||||
public float SourceRadius = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// How close the player must get to the signal to detect it. This is when you get the "Unknown Signal Detected" notification.
|
||||
/// </summary>
|
||||
public float DetectionRadius;
|
||||
public string frequency;
|
||||
|
||||
/// <summary>
|
||||
/// How close the player must get to the signal to identify it. This is when you learn its name.
|
||||
/// </summary>
|
||||
[DefaultValue(10f)]
|
||||
public float IdentificationRadius = 10f;
|
||||
|
||||
/// <summary>
|
||||
/// `false` if the player can hear the signal without equipping the signal-scope.
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool OnlyAudibleToScope = true;
|
||||
[DefaultValue(10f)] public float identificationRadius = 10f;
|
||||
|
||||
/// <summary>
|
||||
/// Only set to `true` if you are putting this signal inside a cloaking field.
|
||||
/// </summary>
|
||||
public bool InsideCloak;
|
||||
public bool insideCloak;
|
||||
|
||||
/// <summary>
|
||||
/// The unique ID of the signal.
|
||||
/// </summary>
|
||||
public string name;
|
||||
|
||||
/// <summary>
|
||||
/// `false` if the player can hear the signal without equipping the signal-scope.
|
||||
/// </summary>
|
||||
[DefaultValue(true)] public bool onlyAudibleToScope = true;
|
||||
|
||||
/// <summary>
|
||||
/// Position of the signal's source
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// A ship log fact to reveal when the signal is identified.
|
||||
/// </summary>
|
||||
[DefaultValue("")] public string reveals = "";
|
||||
|
||||
/// <summary>
|
||||
/// Radius of the sphere giving off the signal.
|
||||
/// </summary>
|
||||
[DefaultValue(1f)] public float sourceRadius = 1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
NewHorizons/External/Modules/SpawnModule.cs
vendored
13
NewHorizons/External/Modules/SpawnModule.cs
vendored
@ -7,28 +7,29 @@ namespace NewHorizons.External.Modules
|
||||
public class SpawnModule
|
||||
{
|
||||
/// <summary>
|
||||
/// If you want the player to spawn on the new body, set a value for this. Press `P` in game with Debug mode on to have the game log the position you're looking at to find a good value for this.
|
||||
/// If you want the player to spawn on the new body, set a value for this. Press `P` in game with Debug mode on to have
|
||||
/// the game log the position you're looking at to find a good value for this.
|
||||
/// </summary>
|
||||
public MVector3 PlayerSpawnPoint;
|
||||
public MVector3 playerSpawnPoint;
|
||||
|
||||
/// <summary>
|
||||
/// Euler angles by which the player will be oriented.
|
||||
/// </summary>
|
||||
public MVector3 PlayerSpawnRotation;
|
||||
public MVector3 playerSpawnRotation;
|
||||
|
||||
/// <summary>
|
||||
/// Required for the system to be accessible by warp drive.
|
||||
/// </summary>
|
||||
public MVector3 ShipSpawnPoint;
|
||||
public MVector3 shipSpawnPoint;
|
||||
|
||||
/// <summary>
|
||||
/// Euler angles by which the ship will be oriented.
|
||||
/// </summary>
|
||||
public MVector3 ShipSpawnRotation;
|
||||
public MVector3 shipSpawnRotation;
|
||||
|
||||
/// <summary>
|
||||
/// If you spawn on a planet with no oxygen, you probably want to set this to true ;;)
|
||||
/// </summary>
|
||||
public bool StartWithSuit;
|
||||
public bool startWithSuit;
|
||||
}
|
||||
}
|
||||
@ -7,37 +7,32 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
{
|
||||
public enum FunnelType
|
||||
{
|
||||
[EnumMember(Value = @"Sand")]
|
||||
Sand = 0,
|
||||
[EnumMember(Value = @"Sand")] Sand = 0,
|
||||
|
||||
[EnumMember(Value = @"Water")]
|
||||
Water = 1,
|
||||
[EnumMember(Value = @"Water")] Water = 1,
|
||||
|
||||
[EnumMember(Value = @"Lava")]
|
||||
Lava = 2,
|
||||
[EnumMember(Value = @"Lava")] Lava = 2,
|
||||
|
||||
[EnumMember(Value = @"Star")]
|
||||
Star = 3
|
||||
[EnumMember(Value = @"Star")] Star = 3
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
public class FunnelModule : VariableSizeModule
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The planet the funnel will flow to
|
||||
/// </summary>
|
||||
public string Target;
|
||||
public string target;
|
||||
|
||||
/// <summary>
|
||||
/// Tint of the funnel
|
||||
/// </summary>
|
||||
public MColor tint;
|
||||
|
||||
/// <summary>
|
||||
/// Type of fluid the funnel transfers
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public FunnelType Type = FunnelType.Sand;
|
||||
|
||||
/// <summary>
|
||||
/// Tint of the funnel
|
||||
/// </summary>
|
||||
public MColor Tint;
|
||||
public FunnelType type = FunnelType.Sand;
|
||||
}
|
||||
}
|
||||
@ -9,11 +9,11 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
/// <summary>
|
||||
/// Size of the lava sphere
|
||||
/// </summary>
|
||||
public float Size;
|
||||
public float size;
|
||||
|
||||
/// <summary>
|
||||
/// Tint of the lava
|
||||
/// </summary>
|
||||
public MColor Tint;
|
||||
public MColor tint;
|
||||
}
|
||||
}
|
||||
@ -6,43 +6,43 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
public class RingModule : VariableSizeModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Inner radius of the disk
|
||||
/// Fluid type for sounds/effects when colliding with this ring.
|
||||
/// </summary>
|
||||
public float InnerRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Outer radius of the disk
|
||||
/// </summary>
|
||||
public float OuterRadius;
|
||||
public CloudFluidType? fluidType = CloudFluidType.None;
|
||||
|
||||
/// <summary>
|
||||
/// Angle between the rings and the equatorial plane of the planet.
|
||||
/// </summary>
|
||||
public float Inclination;
|
||||
public float inclination;
|
||||
|
||||
/// <summary>
|
||||
/// Inner radius of the disk
|
||||
/// </summary>
|
||||
public float innerRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Angle defining the point where the rings rise up from the planet's equatorial plane if inclination is nonzero.
|
||||
/// </summary>
|
||||
public float LongitudeOfAscendingNode;
|
||||
public float longitudeOfAscendingNode;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the texture used for the rings.
|
||||
/// Outer radius of the disk
|
||||
/// </summary>
|
||||
public string Texture;
|
||||
|
||||
/// <summary>
|
||||
/// Should this ring be unlit?
|
||||
/// </summary>
|
||||
public bool Unlit;
|
||||
public float outerRadius;
|
||||
|
||||
/// <summary>
|
||||
/// Allows the rings to rotate.
|
||||
/// </summary>
|
||||
public float RotationSpeed;
|
||||
public float rotationSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// Fluid type for sounds/effects when colliding with this ring.
|
||||
/// Relative filepath to the texture used for the rings.
|
||||
/// </summary>
|
||||
public CloudFluidType? FluidType = CloudFluidType.None;
|
||||
public string texture;
|
||||
|
||||
/// <summary>
|
||||
/// Should this ring be unlit?
|
||||
/// </summary>
|
||||
public bool unlit;
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using NewHorizons.Utility;
|
||||
|
||||
namespace NewHorizons.External.Modules.VariableSize
|
||||
{
|
||||
public class SandModule : VariableSizeModule
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace NewHorizons.External.Modules.VariableSize
|
||||
{
|
||||
@ -11,43 +11,42 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
{
|
||||
public enum SingularityType
|
||||
{
|
||||
[EnumMember(Value = @"BlackHole")]
|
||||
BlackHole = 0,
|
||||
[EnumMember(Value = @"BlackHole")] BlackHole = 0,
|
||||
|
||||
[EnumMember(Value = @"WhiteHole")]
|
||||
WhiteHole = 1
|
||||
[EnumMember(Value = @"WhiteHole")] WhiteHole = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Radius of the singularity. Note that this isn't the same as the event horizon, but includes the entire volume that has warped effects in it.
|
||||
/// Only for White Holes. Should this white hole repel the player from it.
|
||||
/// </summary>
|
||||
public float Size;
|
||||
[DefaultValue(true)] public bool makeZeroGVolume = true;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the white hole or black hole that is paired to this one. If you don't set a value, entering will kill the player
|
||||
/// The name of the white hole or black hole that is paired to this one. If you don't set a value, entering will kill
|
||||
/// the player
|
||||
/// </summary>
|
||||
public string PairedSingularity;
|
||||
public string pairedSingularity;
|
||||
|
||||
/// <summary>
|
||||
/// Position of the singularity
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of the singularity. Note that this isn't the same as the event horizon, but includes the entire volume that
|
||||
/// has warped effects in it.
|
||||
/// </summary>
|
||||
public float size;
|
||||
|
||||
/// <summary>
|
||||
/// If you want a black hole to load a new star system scene, put its name here.
|
||||
/// </summary>
|
||||
public string TargetStarSystem;
|
||||
public string targetStarSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Type of singularity (white hole or black hole)
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public SingularityType Type;
|
||||
|
||||
/// <summary>
|
||||
/// Position of the singularity
|
||||
/// </summary>
|
||||
public MVector3 Position;
|
||||
|
||||
/// <summary>
|
||||
/// Only for White Holes. Should this white hole repel the player from it.
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool MakeZeroGVolume = true;
|
||||
public SingularityType type;
|
||||
}
|
||||
}
|
||||
@ -1,55 +1,51 @@
|
||||
using NewHorizons.Utility;
|
||||
using System.ComponentModel;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine.Internal;
|
||||
|
||||
namespace NewHorizons.External.Modules.VariableSize
|
||||
{
|
||||
[JsonObject]
|
||||
public class StarModule : VariableSizeModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Radius of the star.
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(2000f)]
|
||||
public float Size = 2000f;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of the star.
|
||||
/// </summary>
|
||||
public MColor Tint;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of the star at the end of its life.
|
||||
/// </summary>
|
||||
public MColor EndTint;
|
||||
|
||||
/// <summary>
|
||||
/// The tint of the supernova this star creates when it dies.
|
||||
/// </summary>
|
||||
public MColor SupernovaTint;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of the light given off.
|
||||
/// </summary>
|
||||
public MColor LightTint;
|
||||
|
||||
/// <summary>
|
||||
/// Relative strength of the light compared to the sun.
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(1f)]
|
||||
public float SolarLuminosity = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// The default sun has its own atmosphere that is different from regular planets. If you want that, set this to `true`.
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(true)]
|
||||
public bool HasAtmosphere = true;
|
||||
public MColor endTint;
|
||||
|
||||
/// <summary>
|
||||
/// Should this star explode after 22 minutes?
|
||||
/// </summary>
|
||||
[System.ComponentModel.DefaultValue(true)]
|
||||
public bool GoSupernova = true;
|
||||
[DefaultValue(true)] public bool goSupernova = true;
|
||||
|
||||
/// <summary>
|
||||
/// The default sun has its own atmosphere that is different from regular planets. If you want that, set this to
|
||||
/// `true`.
|
||||
/// </summary>
|
||||
[DefaultValue(true)] public bool hasAtmosphere = true;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of the light given off.
|
||||
/// </summary>
|
||||
public MColor lightTint;
|
||||
|
||||
/// <summary>
|
||||
/// Radius of the star.
|
||||
/// </summary>
|
||||
[DefaultValue(2000f)] public float size = 2000f;
|
||||
|
||||
/// <summary>
|
||||
/// Relative strength of the light compared to the sun.
|
||||
/// </summary>
|
||||
[DefaultValue(1f)] public float solarLuminosity = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// The tint of the supernova this star creates when it dies.
|
||||
/// </summary>
|
||||
public MColor supernovaTint;
|
||||
|
||||
/// <summary>
|
||||
/// Colour of the star.
|
||||
/// </summary>
|
||||
public MColor tint;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.External.Modules.VariableSize
|
||||
{
|
||||
[JsonObject]
|
||||
@ -10,23 +11,19 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
/// </summary>
|
||||
public TimeValuePair[] Curve { get; set; }
|
||||
|
||||
public AnimationCurve GetAnimationCurve(float size = 1f)
|
||||
{
|
||||
var curve = new AnimationCurve();
|
||||
if (Curve != null)
|
||||
foreach (var pair in Curve)
|
||||
curve.AddKey(new Keyframe(pair.Time, size * pair.Value));
|
||||
return curve;
|
||||
}
|
||||
|
||||
public class TimeValuePair
|
||||
{
|
||||
public float Time { get; set; }
|
||||
public float Value { get; set; }
|
||||
}
|
||||
|
||||
public AnimationCurve GetAnimationCurve(float size = 1f)
|
||||
{
|
||||
var curve = new AnimationCurve();
|
||||
if(Curve != null)
|
||||
{
|
||||
foreach (var pair in this.Curve)
|
||||
{
|
||||
curve.AddKey(new Keyframe(pair.Time, size * pair.Value));
|
||||
}
|
||||
}
|
||||
return curve;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,11 +9,11 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
/// <summary>
|
||||
/// Size of the water sphere
|
||||
/// </summary>
|
||||
public float Size;
|
||||
public float size;
|
||||
|
||||
/// <summary>
|
||||
/// Tint of the water
|
||||
/// </summary>
|
||||
public MColor Tint;
|
||||
public MColor tint;
|
||||
}
|
||||
}
|
||||
75
NewHorizons/External/NewHorizonsData.cs
vendored
75
NewHorizons/External/NewHorizonsData.cs
vendored
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.Utility;
|
||||
|
||||
namespace NewHorizons.External
|
||||
{
|
||||
@ -9,20 +9,22 @@ namespace NewHorizons.External
|
||||
private static NewHorizonsSaveFile _saveFile;
|
||||
private static NewHorizonsProfile _activeProfile;
|
||||
private static string _activeProfileName;
|
||||
private static string _fileName = "save.json";
|
||||
private static readonly string FileName = "save.json";
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
_activeProfileName = StandaloneProfileManager.SharedInstance?.currentProfile?.profileName;
|
||||
if (_activeProfileName == null)
|
||||
{
|
||||
Logger.LogError($"Couldn't find active profile, are you on Gamepass?");
|
||||
Logger.LogError("Couldn't find active profile, are you on Gamepass?");
|
||||
_activeProfileName = "XboxGamepassDefaultProfile";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_saveFile = Main.Instance.ModHelper.Storage.Load<NewHorizonsSaveFile>(_fileName);
|
||||
if (!_saveFile.Profiles.ContainsKey(_activeProfileName)) _saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile());
|
||||
_saveFile = Main.Instance.ModHelper.Storage.Load<NewHorizonsSaveFile>(FileName);
|
||||
if (!_saveFile.Profiles.ContainsKey(_activeProfileName))
|
||||
_saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile());
|
||||
_activeProfile = _saveFile.Profiles[_activeProfileName];
|
||||
Logger.Log($"Loaded save data for {_activeProfileName}");
|
||||
}
|
||||
@ -30,11 +32,11 @@ namespace NewHorizons.External
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Log($"Couldn't load save data from {_fileName}, creating a new file");
|
||||
Logger.Log($"Couldn't load save data from {FileName}, creating a new file");
|
||||
_saveFile = new NewHorizonsSaveFile();
|
||||
_saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile());
|
||||
_activeProfile = _saveFile.Profiles[_activeProfileName];
|
||||
Main.Instance.ModHelper.Storage.Save(_saveFile, _fileName);
|
||||
Main.Instance.ModHelper.Storage.Save(_saveFile, FileName);
|
||||
Logger.Log($"Loaded save data for {_activeProfileName}");
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -47,15 +49,12 @@ namespace NewHorizons.External
|
||||
public static void Save()
|
||||
{
|
||||
if (_saveFile == null) return;
|
||||
Main.Instance.ModHelper.Storage.Save(_saveFile, _fileName);
|
||||
Main.Instance.ModHelper.Storage.Save(_saveFile, FileName);
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
if (_saveFile == null || _activeProfile == null)
|
||||
{
|
||||
Load();
|
||||
}
|
||||
if (_saveFile == null || _activeProfile == null) Load();
|
||||
Logger.Log($"Resetting save data for {_activeProfileName}");
|
||||
_activeProfile = new NewHorizonsProfile();
|
||||
_saveFile.Profiles[_activeProfileName] = _activeProfile;
|
||||
@ -63,6 +62,31 @@ namespace NewHorizons.External
|
||||
Save();
|
||||
}
|
||||
|
||||
private class NewHorizonsSaveFile
|
||||
{
|
||||
public NewHorizonsSaveFile()
|
||||
{
|
||||
Profiles = new Dictionary<string, NewHorizonsProfile>();
|
||||
}
|
||||
|
||||
public Dictionary<string, NewHorizonsProfile> Profiles { get; }
|
||||
}
|
||||
|
||||
private class NewHorizonsProfile
|
||||
{
|
||||
public NewHorizonsProfile()
|
||||
{
|
||||
KnownFrequencies = new List<string>();
|
||||
KnownSignals = new List<string>();
|
||||
NewlyRevealedFactIDs = new List<string>();
|
||||
}
|
||||
|
||||
public List<string> KnownFrequencies { get; }
|
||||
public List<string> KnownSignals { get; }
|
||||
|
||||
public List<string> NewlyRevealedFactIDs { get; }
|
||||
}
|
||||
|
||||
#region Frequencies
|
||||
|
||||
public static bool KnowsFrequency(string frequency)
|
||||
@ -83,7 +107,7 @@ namespace NewHorizons.External
|
||||
|
||||
public static bool KnowsMultipleFrequencies()
|
||||
{
|
||||
return (_activeProfile != null && _activeProfile.KnownFrequencies.Count > 0);
|
||||
return _activeProfile != null && _activeProfile.KnownFrequencies.Count > 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -128,30 +152,5 @@ namespace NewHorizons.External
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private class NewHorizonsSaveFile
|
||||
{
|
||||
public NewHorizonsSaveFile()
|
||||
{
|
||||
Profiles = new Dictionary<string, NewHorizonsProfile>();
|
||||
}
|
||||
|
||||
public Dictionary<string, NewHorizonsProfile> Profiles { get; set; }
|
||||
}
|
||||
|
||||
private class NewHorizonsProfile
|
||||
{
|
||||
public NewHorizonsProfile()
|
||||
{
|
||||
KnownFrequencies = new List<string>();
|
||||
KnownSignals = new List<string>();
|
||||
NewlyRevealedFactIDs = new List<string>();
|
||||
}
|
||||
|
||||
public List<string> KnownFrequencies { get; set; }
|
||||
public List<string> KnownSignals { get; set; }
|
||||
|
||||
public List<string> NewlyRevealedFactIDs { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,25 +132,25 @@ namespace NewHorizons.Handlers
|
||||
GameObject existingPlanet = null;
|
||||
try
|
||||
{
|
||||
existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.Name).gameObject;
|
||||
existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.name).gameObject;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (body?.Config?.Name == null) Logger.LogError($"How is there no name for {body}");
|
||||
else existingPlanet = GameObject.Find(body.Config.Name.Replace(" ", "") + "_Body");
|
||||
if (body?.Config?.name == null) Logger.LogError($"How is there no name for {body}");
|
||||
else existingPlanet = GameObject.Find(body.Config.name.Replace(" ", "") + "_Body");
|
||||
}
|
||||
|
||||
if (existingPlanet != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (body.Config.Destroy)
|
||||
if (body.Config.destroy)
|
||||
{
|
||||
var ao = existingPlanet.GetComponent<AstroObject>();
|
||||
if (ao != null) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestructionHandler.RemoveBody(ao), 2);
|
||||
else Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => existingPlanet.SetActive(false), 2);
|
||||
}
|
||||
else if (body.Config.IsQuantumState)
|
||||
else if (body.Config.isQuantumState)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -193,7 +193,7 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make quantum state for [{body.Config.Name}] : {ex.Message}, {ex.StackTrace}");
|
||||
Logger.LogError($"Couldn't make quantum state for [{body.Config.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -204,13 +204,13 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't update body {body.Config?.Name}: {e.Message}, {e.StackTrace}");
|
||||
Logger.LogError($"Couldn't update body {body.Config?.name}: {e.Message}, {e.StackTrace}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (body.Config.IsQuantumState)
|
||||
if (body.Config.isQuantumState)
|
||||
{
|
||||
// If the ground state object isn't made yet do it later
|
||||
NextPassBodies.Add(body);
|
||||
@ -226,7 +226,7 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't generate body {body.Config?.Name}: {e.Message}, {e.StackTrace}");
|
||||
Logger.LogError($"Couldn't generate body {body.Config?.name}: {e.Message}, {e.StackTrace}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -248,9 +248,9 @@ namespace NewHorizons.Handlers
|
||||
UpdateBodyOrbit(body, go);
|
||||
}
|
||||
|
||||
if (body.Config.RemoveChildren != null && body.Config.RemoveChildren.Length > 0)
|
||||
if (body.Config.removeChildren != null && body.Config.removeChildren.Length > 0)
|
||||
{
|
||||
foreach (var child in body.Config.RemoveChildren)
|
||||
foreach (var child in body.Config.removeChildren)
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => GameObject.Find(go.name + "/" + child)?.SetActive(false), 2);
|
||||
}
|
||||
@ -288,9 +288,9 @@ namespace NewHorizons.Handlers
|
||||
primaryBody = null;
|
||||
}
|
||||
|
||||
Logger.Log($"Begin generation sequence of [{body.Config.Name}]");
|
||||
Logger.Log($"Begin generation sequence of [{body.Config.name}]");
|
||||
|
||||
var go = new GameObject(body.Config.Name.Replace(" ", "").Replace("'", "") + "_Body");
|
||||
var go = new GameObject(body.Config.name.Replace(" ", "").Replace("'", "") + "_Body");
|
||||
go.SetActive(false);
|
||||
|
||||
var owRigidBody = RigidBodyBuilder.Make(go, body.Config);
|
||||
@ -301,19 +301,19 @@ namespace NewHorizons.Handlers
|
||||
var sector = MakeSector.Make(go, owRigidBody, sphereOfInfluence * 2f);
|
||||
ao._rootSector = sector;
|
||||
|
||||
if (body.Config.Base.SurfaceGravity != 0)
|
||||
if (body.Config.Base.surfaceGravity != 0)
|
||||
{
|
||||
GravityBuilder.Make(go, ao, body.Config);
|
||||
}
|
||||
|
||||
if (body.Config.Base.HasReferenceFrame)
|
||||
if (body.Config.Base.hasReferenceFrame)
|
||||
{
|
||||
RFVolumeBuilder.Make(go, owRigidBody, sphereOfInfluence);
|
||||
}
|
||||
|
||||
if (body.Config.Base.HasMapMarker)
|
||||
if (body.Config.Base.hasMapMarker)
|
||||
{
|
||||
MarkerBuilder.Make(go, body.Config.Name, body.Config);
|
||||
MarkerBuilder.Make(go, body.Config.name, body.Config);
|
||||
}
|
||||
|
||||
VolumesBuilder.Make(go, body.Config, sphereOfInfluence);
|
||||
@ -338,7 +338,7 @@ namespace NewHorizons.Handlers
|
||||
if (body.Config.Spawn != null)
|
||||
{
|
||||
Logger.Log("Doing spawn point thing");
|
||||
Main.SystemDict[body.Config.StarSystem].SpawnPoint = SpawnPointBuilder.Make(go, body.Config.Spawn, owRigidBody);
|
||||
Main.SystemDict[body.Config.starSystem].SpawnPoint = SpawnPointBuilder.Make(go, body.Config.Spawn, owRigidBody);
|
||||
}
|
||||
|
||||
if (body.Config.Orbit.ShowOrbitLine && !body.Config.Orbit.IsStatic)
|
||||
@ -366,9 +366,9 @@ namespace NewHorizons.Handlers
|
||||
|
||||
private static float GetSphereOfInfluence(NewHorizonsBody body)
|
||||
{
|
||||
var atmoSize = body.Config.Atmosphere != null ? body.Config.Atmosphere.Size : 0f;
|
||||
float sphereOfInfluence = Mathf.Max(Mathf.Max(atmoSize, 50), body.Config.Base.SurfaceSize * 2f);
|
||||
var overrideSOI = body.Config.Base.SphereOfInfluence;
|
||||
var atmoSize = body.Config.Atmosphere != null ? body.Config.Atmosphere.size : 0f;
|
||||
float sphereOfInfluence = Mathf.Max(Mathf.Max(atmoSize, 50), body.Config.Base.surfaceSize * 2f);
|
||||
var overrideSOI = body.Config.Base.sphereOfInfluence;
|
||||
if (overrideSOI != 0) sphereOfInfluence = overrideSOI;
|
||||
return sphereOfInfluence;
|
||||
}
|
||||
@ -378,14 +378,14 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
var sphereOfInfluence = GetSphereOfInfluence(body);
|
||||
|
||||
if (body.Config.Base.AmbientLight != 0)
|
||||
if (body.Config.Base.ambientLight != 0)
|
||||
{
|
||||
AmbientLightBuilder.Make(go, sector, sphereOfInfluence, body.Config.Base.AmbientLight);
|
||||
AmbientLightBuilder.Make(go, sector, sphereOfInfluence, body.Config.Base.ambientLight);
|
||||
}
|
||||
|
||||
if (body.Config.Base.GroundSize != 0)
|
||||
if (body.Config.Base.groundSize != 0)
|
||||
{
|
||||
GeometryBuilder.Make(go, sector, body.Config.Base.GroundSize);
|
||||
GeometryBuilder.Make(go, sector, body.Config.Base.groundSize);
|
||||
}
|
||||
|
||||
if (body.Config.HeightMap != null)
|
||||
@ -410,10 +410,10 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if (body.Config.AsteroidBelt != null)
|
||||
{
|
||||
AsteroidBeltBuilder.Make(body.Config.Name, body.Config, body.Mod);
|
||||
AsteroidBeltBuilder.Make(body.Config.name, body.Config, body.Mod);
|
||||
}
|
||||
|
||||
if (body.Config.Base.HasCometTail)
|
||||
if (body.Config.Base.hasCometTail)
|
||||
{
|
||||
CometTailBuilder.Make(go, sector, body.Config);
|
||||
}
|
||||
@ -437,26 +437,26 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
var airInfo = new AtmosphereModule.AirInfo()
|
||||
{
|
||||
HasOxygen = body.Config.Atmosphere.HasOxygen,
|
||||
IsRaining = body.Config.Atmosphere.HasRain,
|
||||
IsSnowing = body.Config.Atmosphere.HasSnow,
|
||||
Scale = body.Config.Atmosphere.Size
|
||||
hasOxygen = body.Config.Atmosphere.hasOxygen,
|
||||
isRaining = body.Config.Atmosphere.hasRain,
|
||||
isSnowing = body.Config.Atmosphere.hasSnow,
|
||||
scale = body.Config.Atmosphere.size
|
||||
};
|
||||
|
||||
var surfaceSize = body.Config.Base.SurfaceSize;
|
||||
var surfaceSize = body.Config.Base.surfaceSize;
|
||||
|
||||
AirBuilder.Make(go, sector, airInfo);
|
||||
|
||||
if (!string.IsNullOrEmpty(body.Config.Atmosphere?.Clouds?.TexturePath))
|
||||
if (!string.IsNullOrEmpty(body.Config.Atmosphere?.clouds?.texturePath))
|
||||
{
|
||||
CloudsBuilder.Make(go, sector, body.Config.Atmosphere, body.Mod);
|
||||
SunOverrideBuilder.Make(go, sector, body.Config.Atmosphere, surfaceSize);
|
||||
}
|
||||
|
||||
if (body.Config.Atmosphere.HasRain || body.Config.Atmosphere.HasSnow)
|
||||
if (body.Config.Atmosphere.hasRain || body.Config.Atmosphere.hasSnow)
|
||||
EffectsBuilder.Make(go, sector, airInfo, surfaceSize);
|
||||
|
||||
if (body.Config.Atmosphere.FogSize != 0)
|
||||
if (body.Config.Atmosphere.fogSize != 0)
|
||||
FogBuilder.Make(go, sector, body.Config.Atmosphere);
|
||||
|
||||
AtmosphereBuilder.Make(go, sector, body.Config.Atmosphere, surfaceSize);
|
||||
@ -483,9 +483,9 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
|
||||
// Has to go last probably
|
||||
if (body.Config.Base.CloakRadius != 0f)
|
||||
if (body.Config.Base.cloakRadius != 0f)
|
||||
{
|
||||
CloakBuilder.Make(go, sector, rb, body.Config.Base.CloakRadius);
|
||||
CloakBuilder.Make(go, sector, rb, body.Config.Base.cloakRadius);
|
||||
}
|
||||
|
||||
return go;
|
||||
@ -493,7 +493,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
public static void UpdateBodyOrbit(NewHorizonsBody body, GameObject go)
|
||||
{
|
||||
Logger.Log($"Updating orbit of [{body.Config.Name}]");
|
||||
Logger.Log($"Updating orbit of [{body.Config.name}]");
|
||||
|
||||
try
|
||||
{
|
||||
@ -595,7 +595,7 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't update orbit of [{body.Config.Name}]: {ex.Message}, {ex.StackTrace}");
|
||||
Logger.LogError($"Couldn't update orbit of [{body.Config.name}]: {ex.Message}, {ex.StackTrace}");
|
||||
// If it doesn't work here there's no point trying again so we'll still return true
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ namespace NewHorizons.Handlers
|
||||
public PlanetGraphHandler(IEnumerable<NewHorizonsBody> iBodies)
|
||||
{
|
||||
var bodies = iBodies.ToArray();
|
||||
var centers = bodies.Where(b => b.Config.Base.CenterOfSolarSystem).ToArray();
|
||||
var centers = bodies.Where(b => b.Config.Base.centerOfSolarSystem).ToArray();
|
||||
if (centers.Length == 1)
|
||||
{
|
||||
_rootNode = ConstructGraph(centers[0], bodies);
|
||||
@ -37,7 +37,7 @@ namespace NewHorizons.Handlers
|
||||
if (centers.Length == 0 && Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
var SunConfig = new PlanetConfig();
|
||||
SunConfig.Name = "Sun";
|
||||
SunConfig.name = "Sun";
|
||||
_rootNode = ConstructGraph(new NewHorizonsBody(SunConfig, Main.Instance), bodies);
|
||||
}
|
||||
else
|
||||
@ -51,7 +51,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
public static List<PlanetGraphHandler> ConstructStockGraph(NewHorizonsBody[] bodies)
|
||||
{
|
||||
var astroObjects = bodies.Select(x => AstroObjectLocator.GetAstroObject(x.Config.Name)).ToArray();
|
||||
var astroObjects = bodies.Select(x => AstroObjectLocator.GetAstroObject(x.Config.name)).ToArray();
|
||||
var children = astroObjects.Select(x => AstroObjectLocator.GetChildren(x)).ToArray();
|
||||
var nodeDict = new Dictionary<NewHorizonsBody, PlanetNode>();
|
||||
|
||||
@ -74,7 +74,7 @@ namespace NewHorizons.Handlers
|
||||
childBodies.Add(bodies[j]);
|
||||
}
|
||||
// If uh the primary body straight up matches the name
|
||||
else if (bodies[j].Config.Orbit.PrimaryBody == bodies[i].Config.Name)
|
||||
else if (bodies[j].Config.Orbit.PrimaryBody == bodies[i].Config.name)
|
||||
{
|
||||
childBodies.Add(bodies[j]);
|
||||
}
|
||||
@ -108,8 +108,8 @@ namespace NewHorizons.Handlers
|
||||
// Verifying it worked
|
||||
foreach (var node in nodeDict.Values.ToList())
|
||||
{
|
||||
var childrenString = String.Join(", ", node.children.Select(x => x?.body?.Config?.Name).ToList());
|
||||
Logger.Log($"NODE: [{node?.body?.Config?.Name}], [{node?.parent?.body?.Config?.Name}], [{childrenString}]");
|
||||
var childrenString = String.Join(", ", node.children.Select(x => x?.body?.Config?.name).ToList());
|
||||
Logger.Log($"NODE: [{node?.body?.Config?.name}], [{node?.parent?.body?.Config?.name}], [{childrenString}]");
|
||||
}
|
||||
|
||||
// Return all tree roots (no parents)
|
||||
@ -118,11 +118,11 @@ namespace NewHorizons.Handlers
|
||||
|
||||
private static bool DetermineIfChildOfFocal(NewHorizonsBody body, FocalPointNode node)
|
||||
{
|
||||
var name = body.Config.Name.ToLower();
|
||||
var name = body.Config.name.ToLower();
|
||||
var primary = (body.Config.Orbit?.PrimaryBody ?? "").ToLower();
|
||||
var primaryName = node.primary.body.Config.Name.ToLower();
|
||||
var secondaryName = node.secondary.body.Config.Name.ToLower();
|
||||
return name != primaryName && name != secondaryName && (primary == node.body.Config.Name.ToLower() || primary == primaryName || primary == secondaryName);
|
||||
var primaryName = node.primary.body.Config.name.ToLower();
|
||||
var secondaryName = node.secondary.body.Config.name.ToLower();
|
||||
return name != primaryName && name != secondaryName && (primary == node.body.Config.name.ToLower() || primary == primaryName || primary == secondaryName);
|
||||
}
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
body = body,
|
||||
children = bodies
|
||||
.Where(b => string.Equals(b.Config.Orbit.PrimaryBody, body.Config.Name, StringComparison.CurrentCultureIgnoreCase))
|
||||
.Where(b => string.Equals(b.Config.Orbit.PrimaryBody, body.Config.name, StringComparison.CurrentCultureIgnoreCase))
|
||||
.Select(b => ConstructGraph(b, bodies))
|
||||
};
|
||||
}
|
||||
@ -146,7 +146,7 @@ namespace NewHorizons.Handlers
|
||||
};
|
||||
foreach (var child in bodies)
|
||||
{
|
||||
if (string.Equals(child.Config.Name, body.Config.FocalPoint.Primary, StringComparison.CurrentCultureIgnoreCase))
|
||||
if (string.Equals(child.Config.name, body.Config.FocalPoint.primary, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
newNode.primary = new PlanetNode
|
||||
{
|
||||
@ -154,7 +154,7 @@ namespace NewHorizons.Handlers
|
||||
children = new List<PlanetNode>()
|
||||
};
|
||||
}
|
||||
else if (string.Equals(child.Config.Name, body.Config.FocalPoint.Secondary, StringComparison.CurrentCultureIgnoreCase))
|
||||
else if (string.Equals(child.Config.name, body.Config.FocalPoint.secondary, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
newNode.secondary = new PlanetNode
|
||||
{
|
||||
|
||||
@ -44,16 +44,16 @@ namespace NewHorizons.Handlers
|
||||
|
||||
public static bool IsVanillaBody(NewHorizonsBody body)
|
||||
{
|
||||
var existingBody = AstroObjectLocator.GetAstroObject(body.Config.Name);
|
||||
var existingBody = AstroObjectLocator.GetAstroObject(body.Config.name);
|
||||
if (existingBody != null && existingBody.GetAstroObjectName() != AstroObject.Name.CustomString)
|
||||
return true;
|
||||
|
||||
return _vanillaBodies.Contains(body.Config.Name.Replace(" ", ""));
|
||||
return _vanillaBodies.Contains(body.Config.name.Replace(" ", ""));
|
||||
}
|
||||
|
||||
public static string GetNameFromAstroID(string astroID)
|
||||
{
|
||||
return CollectionUtilities.KeyByValue(_nhBodyToAstroIDs, astroID)?.Config.Name;
|
||||
return CollectionUtilities.KeyByValue(_nhBodyToAstroIDs, astroID)?.Config.name;
|
||||
}
|
||||
|
||||
public static NewHorizonsBody GetConfigFromEntryID(string entryID)
|
||||
@ -75,24 +75,24 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
// Nice to be able to just get the AstroID from the body
|
||||
if (!_nhBodyToEntryIDs.ContainsKey(body)) _nhBodyToEntryIDs.Add(body, entryIDs);
|
||||
else Logger.LogWarning($"Possible duplicate shiplog entry {body.Config.Name}");
|
||||
else Logger.LogWarning($"Possible duplicate shiplog entry {body.Config.name}");
|
||||
|
||||
// AstroID
|
||||
if (!_nhBodyToAstroIDs.ContainsKey(body)) _nhBodyToAstroIDs.Add(body, astroID);
|
||||
else Logger.LogWarning($"Possible duplicate shiplog entry {astroID} for {body.Config.Name}");
|
||||
else Logger.LogWarning($"Possible duplicate shiplog entry {astroID} for {body.Config.name}");
|
||||
|
||||
// EntryID to Body
|
||||
foreach (var entryID in entryIDs)
|
||||
{
|
||||
if (!_entryIDsToNHBody.ContainsKey(entryID)) _entryIDsToNHBody.Add(entryID, body);
|
||||
else Logger.LogWarning($"Possible duplicate shiplog entry {entryID} for {astroID} from NewHorizonsBody {body.Config.Name}");
|
||||
else Logger.LogWarning($"Possible duplicate shiplog entry {entryID} for {astroID} from NewHorizonsBody {body.Config.name}");
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetAstroObjectId(NewHorizonsBody body)
|
||||
{
|
||||
if (_nhBodyToAstroIDs.ContainsKey(body)) return _nhBodyToAstroIDs[body];
|
||||
else return body.Config.Name;
|
||||
else return body.Config.name;
|
||||
}
|
||||
|
||||
public static bool BodyHasEntries(NewHorizonsBody body)
|
||||
|
||||
@ -68,7 +68,7 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
foreach (var system in _systems)
|
||||
{
|
||||
if (system.Config.canEnterViaWarpDrive && system.Spawn?.ShipSpawnPoint != null && HasUnlockedSystem(system.UniqueID))
|
||||
if (system.Config.canEnterViaWarpDrive && system.Spawn?.shipSpawnPoint != null && HasUnlockedSystem(system.UniqueID))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
//Try loading one planet why not
|
||||
//var eligible = BodyDict.Values.ToList().SelectMany(x => x).ToList().Where(b => (b.Config.HeightMap != null || b.Config.Atmosphere?.Cloud != null) && b.Config.Star == null).ToArray();
|
||||
var eligible = bodies.Where(b => (b.Config.HeightMap != null || b.Config.Atmosphere?.Clouds != null) && b.Config.Star == null && b.Config.CanShowOnTitle).ToArray();
|
||||
var eligible = bodies.Where(b => (b.Config.HeightMap != null || b.Config.Atmosphere?.clouds != null) && b.Config.Star == null && b.Config.canShowOnTitle).ToArray();
|
||||
var eligibleCount = eligible.Count();
|
||||
if (eligibleCount == 0) return;
|
||||
|
||||
@ -74,26 +74,26 @@ namespace NewHorizons.Handlers
|
||||
|
||||
private static GameObject LoadTitleScreenBody(NewHorizonsBody body)
|
||||
{
|
||||
Logger.Log($"Displaying {body.Config.Name} on the title screen");
|
||||
GameObject titleScreenGO = new GameObject(body.Config.Name + "_TitleScreen");
|
||||
Logger.Log($"Displaying {body.Config.name} on the title screen");
|
||||
GameObject titleScreenGO = new GameObject(body.Config.name + "_TitleScreen");
|
||||
HeightMapModule heightMap = new HeightMapModule();
|
||||
var minSize = 15;
|
||||
var maxSize = 30;
|
||||
float size = minSize;
|
||||
if (body.Config.HeightMap != null)
|
||||
{
|
||||
size = Mathf.Clamp(body.Config.HeightMap.MaxHeight / 10, minSize, maxSize);
|
||||
heightMap.TextureMap = body.Config.HeightMap.TextureMap;
|
||||
heightMap.HeightMap = body.Config.HeightMap.HeightMap;
|
||||
heightMap.MaxHeight = size;
|
||||
heightMap.MinHeight = body.Config.HeightMap.MinHeight * size / body.Config.HeightMap.MaxHeight;
|
||||
size = Mathf.Clamp(body.Config.HeightMap.maxHeight / 10, minSize, maxSize);
|
||||
heightMap.textureMap = body.Config.HeightMap.textureMap;
|
||||
heightMap.heightMap = body.Config.HeightMap.heightMap;
|
||||
heightMap.maxHeight = size;
|
||||
heightMap.minHeight = body.Config.HeightMap.minHeight * size / body.Config.HeightMap.maxHeight;
|
||||
}
|
||||
if (body.Config.Atmosphere?.Clouds?.TexturePath != null)
|
||||
if (body.Config.Atmosphere?.clouds?.texturePath != null)
|
||||
{
|
||||
// Hacky but whatever I just want a sphere
|
||||
size = Mathf.Clamp(body.Config.Atmosphere.Size / 10, minSize, maxSize);
|
||||
heightMap.MaxHeight = heightMap.MinHeight = size + 1;
|
||||
heightMap.TextureMap = body.Config.Atmosphere.Clouds.TexturePath;
|
||||
size = Mathf.Clamp(body.Config.Atmosphere.size / 10, minSize, maxSize);
|
||||
heightMap.maxHeight = heightMap.minHeight = size + 1;
|
||||
heightMap.textureMap = body.Config.Atmosphere.clouds.texturePath;
|
||||
}
|
||||
|
||||
HeightMapBuilder.Make(titleScreenGO, null, heightMap, body.Mod);
|
||||
@ -109,9 +109,9 @@ namespace NewHorizons.Handlers
|
||||
if (body.Config.Ring != null)
|
||||
{
|
||||
RingModule newRing = new RingModule();
|
||||
newRing.InnerRadius = size * 1.2f;
|
||||
newRing.OuterRadius = size * 2f;
|
||||
newRing.Texture = body.Config.Ring.Texture;
|
||||
newRing.innerRadius = size * 1.2f;
|
||||
newRing.outerRadius = size * 2f;
|
||||
newRing.texture = body.Config.Ring.texture;
|
||||
var ring = RingBuilder.Make(titleScreenGO, null, newRing, body.Mod);
|
||||
titleScreenGO.transform.localScale = Vector3.one * 0.8f;
|
||||
}
|
||||
|
||||
@ -61,39 +61,39 @@ namespace NewHorizons.Handlers
|
||||
|
||||
public static void RegisterTranslation(TextTranslation.Language language, TranslationConfig config)
|
||||
{
|
||||
if (config.ShipLogDictionary != null && config.ShipLogDictionary.Count() > 0)
|
||||
if (config.shipLogDictionary != null && config.shipLogDictionary.Count() > 0)
|
||||
{
|
||||
if (!_shipLogTranslationDictionary.ContainsKey(language)) _shipLogTranslationDictionary.Add(language, new Dictionary<string, string>());
|
||||
foreach (var originalKey in config.ShipLogDictionary.Keys)
|
||||
foreach (var originalKey in config.shipLogDictionary.Keys)
|
||||
{
|
||||
var key = originalKey.Replace("<", "<").Replace(">", ">").Replace("<![CDATA[", "").Replace("]]>", "");
|
||||
|
||||
if (!_shipLogTranslationDictionary[language].ContainsKey(key)) _shipLogTranslationDictionary[language].Add(key, config.ShipLogDictionary[originalKey]);
|
||||
else _shipLogTranslationDictionary[language][key] = config.ShipLogDictionary[originalKey];
|
||||
if (!_shipLogTranslationDictionary[language].ContainsKey(key)) _shipLogTranslationDictionary[language].Add(key, config.shipLogDictionary[originalKey]);
|
||||
else _shipLogTranslationDictionary[language][key] = config.shipLogDictionary[originalKey];
|
||||
}
|
||||
}
|
||||
|
||||
if (config.DialogueDictionary != null && config.DialogueDictionary.Count() > 0)
|
||||
if (config.dialogueDictionary != null && config.dialogueDictionary.Count() > 0)
|
||||
{
|
||||
if (!_dialogueTranslationDictionary.ContainsKey(language)) _dialogueTranslationDictionary.Add(language, new Dictionary<string, string>());
|
||||
foreach (var originalKey in config.DialogueDictionary.Keys)
|
||||
foreach (var originalKey in config.dialogueDictionary.Keys)
|
||||
{
|
||||
var key = originalKey.Replace("<", "<").Replace(">", ">").Replace("<![CDATA[", "").Replace("]]>", "");
|
||||
|
||||
if (!_dialogueTranslationDictionary[language].ContainsKey(key)) _dialogueTranslationDictionary[language].Add(key, config.DialogueDictionary[originalKey]);
|
||||
else _dialogueTranslationDictionary[language][key] = config.DialogueDictionary[originalKey];
|
||||
if (!_dialogueTranslationDictionary[language].ContainsKey(key)) _dialogueTranslationDictionary[language].Add(key, config.dialogueDictionary[originalKey]);
|
||||
else _dialogueTranslationDictionary[language][key] = config.dialogueDictionary[originalKey];
|
||||
}
|
||||
}
|
||||
|
||||
if (config.UIDictionary != null && config.UIDictionary.Count() > 0)
|
||||
if (config.uiDictionary != null && config.uiDictionary.Count() > 0)
|
||||
{
|
||||
if (!_uiTranslationDictionary.ContainsKey(language)) _uiTranslationDictionary.Add(language, new Dictionary<string, string>());
|
||||
foreach (var originalKey in config.UIDictionary.Keys)
|
||||
foreach (var originalKey in config.uiDictionary.Keys)
|
||||
{
|
||||
var key = originalKey.Replace("<", "<").Replace(">", ">").Replace("<![CDATA[", "").Replace("]]>", "");
|
||||
|
||||
if (!_uiTranslationDictionary[language].ContainsKey(key)) _uiTranslationDictionary[language].Add(key, config.UIDictionary[originalKey]);
|
||||
else _uiTranslationDictionary[language][key] = config.UIDictionary[originalKey];
|
||||
if (!_uiTranslationDictionary[language].ContainsKey(key)) _uiTranslationDictionary[language].Add(key, config.uiDictionary[originalKey]);
|
||||
else _uiTranslationDictionary[language][key] = config.uiDictionary[originalKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using HarmonyLib;
|
||||
using NJsonSchema;
|
||||
using NewHorizons.Builder.Props;
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.External.Configs;
|
||||
@ -13,24 +12,16 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.Utility.DebugUtilities;
|
||||
using Newtonsoft.Json.Schema;
|
||||
|
||||
namespace NewHorizons
|
||||
{
|
||||
|
||||
// TODO: Test class, delete later
|
||||
[JsonObject]
|
||||
public class Test
|
||||
{
|
||||
[JsonProperty]
|
||||
public string Name;
|
||||
}
|
||||
|
||||
public class Main : ModBehaviour
|
||||
{
|
||||
public static AssetBundle NHAssetBundle { get; private set; }
|
||||
@ -48,8 +39,6 @@ namespace NewHorizons
|
||||
|
||||
public static float SecondsLeftInLoop = -1;
|
||||
|
||||
private static JsonSchema _bodySchema;
|
||||
|
||||
public static bool IsSystemReady { get; private set; }
|
||||
public static float FurthestOrbit { get; set; } = 50000f;
|
||||
|
||||
@ -161,10 +150,6 @@ namespace NewHorizons
|
||||
|
||||
Logger.Log("Begin load of config files...", Logger.LogType.Log);
|
||||
|
||||
_bodySchema = JsonSchema.FromType<Test>();
|
||||
Logger.LogWarning(_bodySchema.ToString());
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
LoadConfigs(this);
|
||||
@ -367,11 +352,11 @@ namespace NewHorizons
|
||||
if (body != null)
|
||||
{
|
||||
// Wanna track the spawn point of each system
|
||||
if (body.Config.Spawn != null) SystemDict[body.Config.StarSystem].Spawn = body.Config.Spawn;
|
||||
if (body.Config.Spawn != null) SystemDict[body.Config.starSystem].Spawn = body.Config.Spawn;
|
||||
|
||||
// Add the new planet to the planet dictionary
|
||||
if (!BodyDict.ContainsKey(body.Config.StarSystem)) BodyDict[body.Config.StarSystem] = new List<NewHorizonsBody>();
|
||||
BodyDict[body.Config.StarSystem].Add(body);
|
||||
if (!BodyDict.ContainsKey(body.Config.starSystem)) BodyDict[body.Config.starSystem] = new List<NewHorizonsBody>();
|
||||
BodyDict[body.Config.starSystem].Add(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -422,20 +407,20 @@ namespace NewHorizons
|
||||
var config = mod.ModHelper.Storage.Load<PlanetConfig>(relativeDirectory);
|
||||
config.MigrateAndValidate();
|
||||
|
||||
Logger.Log($"Loaded {config.Name}");
|
||||
Logger.Log($"Loaded {config.name}");
|
||||
|
||||
if (!SystemDict.ContainsKey(config.StarSystem))
|
||||
if (!SystemDict.ContainsKey(config.starSystem))
|
||||
{
|
||||
// Since we didn't load it earlier there shouldn't be a star system config
|
||||
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>($"systems/{config.StarSystem}.json");
|
||||
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>($"systems/{config.starSystem}.json");
|
||||
if (starSystemConfig == null) starSystemConfig = new StarSystemConfig();
|
||||
else Logger.LogWarning($"Loaded system config for {config.StarSystem}. Why wasn't this loaded earlier?");
|
||||
else Logger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?");
|
||||
|
||||
var system = new NewHorizonsSystem(config.StarSystem, starSystemConfig, mod);
|
||||
var system = new NewHorizonsSystem(config.starSystem, starSystemConfig, mod);
|
||||
|
||||
SystemDict.Add(config.StarSystem, system);
|
||||
SystemDict.Add(config.starSystem, system);
|
||||
|
||||
BodyDict.Add(config.StarSystem, new List<NewHorizonsBody>());
|
||||
BodyDict.Add(config.starSystem, new List<NewHorizonsBody>());
|
||||
}
|
||||
|
||||
body = new NewHorizonsBody(config, mod, relativeDirectory);
|
||||
|
||||
@ -11,9 +11,13 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>portable</DebugType>
|
||||
<DocumentationFile>C:\Users\bwc67\AppData\Roaming\OuterWildsModManager\OWML\Mods\xen.NewHorizons\NewHorizons.xml</DocumentationFile>
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<DocumentationFile>C:\Users\bwc67\AppData\Roaming\OuterWildsModManager\OWML\Mods\xen.NewHorizons\NewHorizons.xml</DocumentationFile>
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="..\NJsonSchema\*.dll" />
|
||||
|
||||
@ -43,8 +43,8 @@ namespace NewHorizons
|
||||
// Update it to point to their mod for textures and stuff
|
||||
body.Mod = mod ?? Main.Instance;
|
||||
|
||||
if (!Main.BodyDict.ContainsKey(body.Config.StarSystem)) Main.BodyDict.Add(body.Config.StarSystem, new List<NewHorizonsBody>());
|
||||
Main.BodyDict[body.Config.StarSystem].Add(body);
|
||||
if (!Main.BodyDict.ContainsKey(body.Config.starSystem)) Main.BodyDict.Add(body.Config.starSystem, new List<NewHorizonsBody>());
|
||||
Main.BodyDict[body.Config.starSystem].Add(body);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
@ -59,7 +59,7 @@ namespace NewHorizons
|
||||
|
||||
public GameObject GetPlanet(string name)
|
||||
{
|
||||
return Main.BodyDict.Values.SelectMany(x => x)?.ToList()?.FirstOrDefault(x => x.Config.Name == name)?.Object;
|
||||
return Main.BodyDict.Values.SelectMany(x => x)?.ToList()?.FirstOrDefault(x => x.Config.name == name)?.Object;
|
||||
}
|
||||
|
||||
public string GetCurrentStarSystem()
|
||||
|
||||
@ -234,7 +234,7 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
{
|
||||
if (body.RelativePath == null)
|
||||
{
|
||||
Logger.Log("Error loading config for " + body.Config.Name + " in " + body.Config.StarSystem);
|
||||
Logger.Log("Error loading config for " + body.Config.name + " in " + body.Config.starSystem);
|
||||
}
|
||||
|
||||
loadedConfigFiles[folder + body.RelativePath] = (body.Config as PlanetConfig);
|
||||
@ -251,8 +251,8 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
|
||||
foreach (var filePath in loadedConfigFiles.Keys)
|
||||
{
|
||||
Logger.Log("Possibly Saving... " + loadedConfigFiles[filePath].Name + " @ " + filePath);
|
||||
if (loadedConfigFiles[filePath].StarSystem != Main.Instance.CurrentStarSystem) continue;
|
||||
Logger.Log("Possibly Saving... " + loadedConfigFiles[filePath].name + " @ " + filePath);
|
||||
if (loadedConfigFiles[filePath].starSystem != Main.Instance.CurrentStarSystem) continue;
|
||||
|
||||
var relativePath = filePath.Replace(loadedMod.ModHelper.Manifest.ModFolderPath, "");
|
||||
|
||||
@ -296,16 +296,16 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
{
|
||||
Logger.Log("potentially updating copy of config at " + filePath);
|
||||
|
||||
if (loadedConfigFiles[filePath].StarSystem != Main.Instance.CurrentStarSystem) return;
|
||||
if (loadedConfigFiles[filePath].Name == null || AstroObjectLocator.GetAstroObject(loadedConfigFiles[filePath].Name) == null) { Logger.Log("Failed to update copy of config at " + filePath); continue; }
|
||||
if (loadedConfigFiles[filePath].starSystem != Main.Instance.CurrentStarSystem) return;
|
||||
if (loadedConfigFiles[filePath].name == null || AstroObjectLocator.GetAstroObject(loadedConfigFiles[filePath].name) == null) { Logger.Log("Failed to update copy of config at " + filePath); continue; }
|
||||
|
||||
var astroObjectName = DebugPropPlacer.GetAstroObjectName(loadedConfigFiles[filePath].Name);
|
||||
var astroObjectName = DebugPropPlacer.GetAstroObjectName(loadedConfigFiles[filePath].name);
|
||||
planetToConfigPath[astroObjectName] = filePath;
|
||||
|
||||
if (!newDetails.ContainsKey(astroObjectName)) continue;
|
||||
|
||||
if (loadedConfigFiles[filePath].Props == null) loadedConfigFiles[filePath].Props = new External.Modules.PropModule();
|
||||
loadedConfigFiles[filePath].Props.Details = newDetails[astroObjectName];
|
||||
loadedConfigFiles[filePath].Props.details = newDetails[astroObjectName];
|
||||
|
||||
Logger.Log("successfully updated copy of config file for " + astroObjectName);
|
||||
}
|
||||
@ -318,10 +318,10 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
|
||||
var filepath = "planets/" + Main.Instance.CurrentStarSystem + "/" + astroObjectName + ".json";
|
||||
PlanetConfig c = new PlanetConfig();
|
||||
c.StarSystem = Main.Instance.CurrentStarSystem;
|
||||
c.Name = astroObjectName;
|
||||
c.starSystem = Main.Instance.CurrentStarSystem;
|
||||
c.name = astroObjectName;
|
||||
c.Props = new PropModule();
|
||||
c.Props.Details = newDetails[astroObjectName];
|
||||
c.Props.details = newDetails[astroObjectName];
|
||||
|
||||
loadedConfigFiles[filepath] = c;
|
||||
}
|
||||
|
||||
@ -150,16 +150,16 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
|
||||
public void FindAndRegisterPropsFromConfig(PlanetConfig config)
|
||||
{
|
||||
if (config.StarSystem != Main.Instance.CurrentStarSystem) return;
|
||||
if (config.starSystem != Main.Instance.CurrentStarSystem) return;
|
||||
|
||||
AstroObject planet = AstroObjectLocator.GetAstroObject(config.Name);
|
||||
AstroObject planet = AstroObjectLocator.GetAstroObject(config.name);
|
||||
|
||||
if (planet == null) return;
|
||||
if (config.Props == null || config.Props.Details == null) return;
|
||||
if (config.Props == null || config.Props.details == null) return;
|
||||
|
||||
var astroObjectName = GetAstroObjectName(config.Name);
|
||||
var astroObjectName = GetAstroObjectName(config.name);
|
||||
|
||||
foreach (var detail in config.Props.Details)
|
||||
foreach (var detail in config.Props.details)
|
||||
{
|
||||
GameObject spawnedProp = DetailBuilder.GetSpawnedGameObjectByDetailInfo(detail);
|
||||
|
||||
|
||||
64
SchemaExporter/SchemaExporter.cs
Normal file
64
SchemaExporter/SchemaExporter.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using NewHorizons.External.Configs;
|
||||
using NJsonSchema;
|
||||
using NJsonSchema.Generation;
|
||||
|
||||
|
||||
namespace SchemaExporter;
|
||||
|
||||
public static class SchemaExporter
|
||||
{
|
||||
private struct Schema<T>
|
||||
{
|
||||
private readonly JsonSchemaGeneratorSettings _generatorSettings;
|
||||
private string _title;
|
||||
private readonly string _outFileName;
|
||||
|
||||
public Schema(string schemaTitle, string fileName, JsonSchemaGeneratorSettings settings)
|
||||
{
|
||||
_title = schemaTitle;
|
||||
_outFileName = fileName;
|
||||
_generatorSettings = settings;
|
||||
}
|
||||
|
||||
public void Output()
|
||||
{
|
||||
File.WriteAllText($"{_outFileName}.json", ToString());
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return GetJsonSchema().ToJson();
|
||||
}
|
||||
|
||||
public JsonSchema GetJsonSchema()
|
||||
{
|
||||
var schema = JsonSchema.FromType<T>(_generatorSettings);
|
||||
schema.Title = _title;
|
||||
return schema;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
const string folderName = "Schemas";
|
||||
|
||||
Directory.CreateDirectory(folderName);
|
||||
Console.WriteLine("Schema Generator: We're winning!");
|
||||
var settings = new JsonSchemaGeneratorSettings
|
||||
{
|
||||
IgnoreObsoleteProperties = true,
|
||||
};
|
||||
Console.WriteLine("Outputting Body Schema");
|
||||
var bodySchema = new Schema<PlanetConfig>("Celestial Body Schema", "body_schema", settings);
|
||||
bodySchema.Output();
|
||||
Console.WriteLine("Outputting Star System Schema");
|
||||
var systemSchema = new Schema<StarSystemConfig>("Star System Schema", "star_system_schema", settings);
|
||||
systemSchema.Output();
|
||||
Console.WriteLine("Outputting Translation Schema");
|
||||
var translationSchema = new Schema<TranslationConfig>("Translation Schema", "translation_schema", settings);
|
||||
translationSchema.Output();
|
||||
Console.WriteLine("Done!");
|
||||
}
|
||||
}
|
||||
32
SchemaExporter/SchemaExporter.csproj
Normal file
32
SchemaExporter/SchemaExporter.csproj
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<LangVersion>default</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="System.Runtime.Serialization.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="UnityEngine.CoreModule.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.14" />
|
||||
<PackageReference Include="NJsonSchema" Version="10.7.1" />
|
||||
<PackageReference Include="OuterWildsGameLibs" Version="1.1.12.168" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NewHorizons\NewHorizons.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
BIN
SchemaExporter/System.Runtime.Serialization.dll
Normal file
BIN
SchemaExporter/System.Runtime.Serialization.dll
Normal file
Binary file not shown.
BIN
SchemaExporter/UnityEngine.CoreModule.dll
Normal file
BIN
SchemaExporter/UnityEngine.CoreModule.dll
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user