mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 19:33:27 +08:00
minor fixes
This commit is contained in:
@@ -130,6 +130,20 @@ public static class PlanetFunctions
|
||||
planet.audio?.RemoveAudioData(ed.audioId);
|
||||
}
|
||||
|
||||
for (var id = factory.prebuildCursor - 1; id > 0; id--)
|
||||
{
|
||||
ref var pb = ref factory.prebuildPool[id];
|
||||
if (pb.id != id) continue;
|
||||
if (pb.colliderId != 0)
|
||||
{
|
||||
planet.physics.RemoveLinkedColliderData(pb.colliderId);
|
||||
}
|
||||
if (pb.modelId != 0)
|
||||
{
|
||||
GameMain.gpuiManager.RemovePrebuildModel(pb.modelIndex, pb.modelId);
|
||||
}
|
||||
}
|
||||
|
||||
var hives = GameMain.spaceSector?.dfHives;
|
||||
if (hives != null)
|
||||
{
|
||||
@@ -202,7 +216,7 @@ public static class PlanetFunctions
|
||||
factory.PlanetReformRevert();
|
||||
}
|
||||
|
||||
planet.UnloadFactory();
|
||||
GameMain.data.LeavePlanet();
|
||||
var index = factory.index;
|
||||
var warningSystem = GameMain.data.warningSystem;
|
||||
var warningPool = warningSystem.warningPool;
|
||||
@@ -275,12 +289,7 @@ public static class PlanetFunctions
|
||||
factory.digitalSystem = new DigitalSystem(planet);
|
||||
|
||||
//GameMain.data.statistics.production.CreateFactoryStat(index);
|
||||
planet.LoadFactory();
|
||||
while (!planet.factoryLoaded)
|
||||
{
|
||||
PlanetModelingManager.Update();
|
||||
Thread.Sleep(0);
|
||||
}
|
||||
GameMain.data.ArrivePlanet(planet);
|
||||
}
|
||||
|
||||
public static void BuildOrbitalCollectors()
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.CompilerServices;
|
||||
using BepInEx.Configuration;
|
||||
using CommonAPI.Systems;
|
||||
using HarmonyLib;
|
||||
@@ -310,27 +311,15 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
_nightlightInitialized = false;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void UpdateSunlightAngle()
|
||||
{
|
||||
if (!_sunlight) return;
|
||||
_sunlight.transform.rotation = Quaternion.LookRotation(-GameMain.mainPlayer.transform.up + GameMain.mainPlayer.transform.forward * NightLightAngleX.Value / 10f +
|
||||
_sunlight.transform.rotation =
|
||||
Quaternion.LookRotation(-GameMain.mainPlayer.transform.up + GameMain.mainPlayer.transform.forward * NightLightAngleX.Value / 10f +
|
||||
GameMain.mainPlayer.transform.right * NightLightAngleY.Value / 10f);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameData), nameof(GameData.ArriveStar))]
|
||||
public static void GameData_ArriveStar_Postfix()
|
||||
{
|
||||
_sunlight = GameMain.universeSimulator?.LocalStarSimulator()?.sunLight;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameData), nameof(GameData.LeaveStar))]
|
||||
public static void GameData_LeaveStar_Prefix()
|
||||
{
|
||||
_sunlight = null;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))]
|
||||
public static void GameMain_LateUpdate_Postfix(GameMain __instance)
|
||||
@@ -341,7 +330,6 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
{
|
||||
if (!GameMain.mainPlayer.controller.model.gameObject.activeInHierarchy) return;
|
||||
if (_sail == null) _sail = GameMain.mainPlayer.animator.sails[GameMain.mainPlayer.animator.sailAnimIndex];
|
||||
_sunlight = GameMain.universeSimulator?.LocalStarSimulator()?.sunLight;
|
||||
_nightlightInitialized = true;
|
||||
}
|
||||
|
||||
@@ -362,6 +350,10 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
|
||||
if (sailing) return;
|
||||
_mechaOnEarth = true;
|
||||
if (_sunlight == null)
|
||||
{
|
||||
_sunlight = GameMain.universeSimulator?.LocalStarSimulator()?.sunLight;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
|
||||
Reference in New Issue
Block a user