-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUtil.cs
34 lines (28 loc) · 1.23 KB
/
Util.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
namespace SmartEjectors
{
public static class Util
{
public static bool IsSphereFilled(DysonSphere sphere)
{
if (!Config.enableLockEjector.ActiveValue()) return false;
return sphere.totalConstructedCellPoint + sphere.swarm.sailCount >= sphere.totalCellPoint;
}
public static bool IsNodeLimitReached(DysonSphere sphere)
{
if (!Config.enableLockEjector.ActiveValue()) return false;
if (Config.nodeToSailRatio.ActiveValue() == 0) return false;
int avaliableNodeCount = 0;
for (int i = 1; i < sphere.layersIdBased.Length; i++)
{
if (sphere.layersIdBased[i] == null || sphere.layersIdBased[i].id != i) continue;
DysonNode[] nodePool = sphere.layersIdBased[i].nodePool;
for (int j = 1; j < nodePool.Length; j++)
{
if (nodePool[j] == null || nodePool[j].id != j) continue;
if (nodePool[j].totalSp > 30 && nodePool[j].totalCp < nodePool[j].totalCpMax) avaliableNodeCount++;
}
}
return sphere.swarm.sailCount >= avaliableNodeCount * Config.nodeToSailRatio.ActiveValue();
}
}
}