mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-05 03:02:20 +08:00
bug fix
This commit is contained in:
@@ -263,6 +263,19 @@ public static class PlanetFunctions
|
|||||||
factory.factoryStorage = new FactoryStorage(planet);
|
factory.factoryStorage = new FactoryStorage(planet);
|
||||||
factory.powerSystem = new PowerSystem(planet);
|
factory.powerSystem = new PowerSystem(planet);
|
||||||
factory.constructionSystem = new ConstructionSystem(planet);
|
factory.constructionSystem = new ConstructionSystem(planet);
|
||||||
|
if (factory.veinPool != null)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < factory.veinPool.Length; i++)
|
||||||
|
{
|
||||||
|
ref var vein = ref factory.veinPool[i];
|
||||||
|
if (vein.id != i) continue;
|
||||||
|
vein.minerCount = 0;
|
||||||
|
vein.minerId0 = 0;
|
||||||
|
vein.minerId1 = 0;
|
||||||
|
vein.minerId2 = 0;
|
||||||
|
vein.minerId3 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
factory.InitVeinHashAddress();
|
factory.InitVeinHashAddress();
|
||||||
factory.RecalculateAllVeinGroups();
|
factory.RecalculateAllVeinGroups();
|
||||||
factory.InitVegeHashAddress();
|
factory.InitVegeHashAddress();
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ public class UIPatch : PatchImpl<UIPatch>
|
|||||||
#region Helper functions
|
#region Helper functions
|
||||||
private static void ProcessVeinData(VeinTypeInfo[] veinCount, VeinData[] veinPool)
|
private static void ProcessVeinData(VeinTypeInfo[] veinCount, VeinData[] veinPool)
|
||||||
{
|
{
|
||||||
|
if (veinPool == null) return;
|
||||||
lock (veinPool)
|
lock (veinPool)
|
||||||
{
|
{
|
||||||
foreach (VeinData veinData in veinPool)
|
foreach (VeinData veinData in veinPool)
|
||||||
@@ -272,21 +273,19 @@ public class UIPatch : PatchImpl<UIPatch>
|
|||||||
}
|
}
|
||||||
foreach (PlanetData planet in __instance.star.planets)
|
foreach (PlanetData planet in __instance.star.planets)
|
||||||
{
|
{
|
||||||
if (planet.runtimeVeinGroups == null) { continue; }
|
|
||||||
PlanetFactory factory = planet.factory;
|
PlanetFactory factory = planet.factory;
|
||||||
if (factory != null)
|
if (factory != null)
|
||||||
{
|
{
|
||||||
ProcessVeinData(starVeinCount, factory.veinPool);
|
ProcessVeinData(starVeinCount, factory.veinPool);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else
|
VeinGroup[] veinGroups = planet.veinGroups;
|
||||||
|
if (veinGroups == null) continue;
|
||||||
|
lock (planet.veinGroupsLock)
|
||||||
{
|
{
|
||||||
VeinGroup[] veinGroups = planet.runtimeVeinGroups;
|
for (int i = 1; i < veinGroups.Length; i++)
|
||||||
lock (planet.veinGroupsLock)
|
|
||||||
{
|
{
|
||||||
for (int i = 1; i < veinGroups.Length; i++)
|
starVeinCount[(int)veinGroups[i].type].numVeinGroups++;
|
||||||
{
|
|
||||||
starVeinCount[(int)veinGroups[i].type].numVeinGroups++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user