mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-10 06:43:27 +08:00
WIP for logistic_hub
This commit is contained in:
33
LogisticHub/Module/AuxData.cs
Normal file
33
LogisticHub/Module/AuxData.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace LogisticHub.Module;
|
||||
|
||||
using UXAssist.Common;
|
||||
|
||||
public static class AuxData
|
||||
{
|
||||
public static (long, bool)[] Fuels;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
GameLogic.OnDataLoaded += () =>
|
||||
{
|
||||
var maxId = LDB.items.dataArray.Select(data => data.ID).Prepend(0).Max();
|
||||
Fuels = new (long, bool)[maxId + 1];
|
||||
foreach (var data in LDB.items.dataArray)
|
||||
Fuels[data.ID] = (data.HeatValue, data.Productive);
|
||||
};
|
||||
}
|
||||
|
||||
public static int AlignUpToPowerOf2(int n)
|
||||
{
|
||||
if (n < 16) return 16;
|
||||
n--;
|
||||
n |= n >> 1;
|
||||
n |= n >> 2;
|
||||
n |= n >> 4;
|
||||
n |= n >> 8;
|
||||
n |= n >> 16;
|
||||
return n + 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user