mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 18:53:29 +08:00
Compare commits
3 Commits
77f5803a24
...
2dbf017a5e
| Author | SHA1 | Date | |
|---|---|---|---|
| 2dbf017a5e | |||
| 3c7744047c | |||
| a9959a2f07 |
Binary file not shown.
Binary file not shown.
@@ -15,11 +15,11 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
|
||||
private static long _oreEnergyConsume = 2000000;
|
||||
private static long _oilEnergyConsume = 3600000;
|
||||
private static long _waterEnergyConsume = 20000000;
|
||||
private static int _waterSpeed = 100;
|
||||
private static long _waterEnergyConsume = 2000000;
|
||||
private static int _waterSpeed = 10;
|
||||
private static int _miningScale;
|
||||
private static int _fuelIlsSlot = 3;
|
||||
private static int _fuelPlsSlot = 2;
|
||||
private static int _fuelPlsSlot = 3;
|
||||
|
||||
private static float _frame;
|
||||
private static float _miningCostRateByTech;
|
||||
@@ -31,8 +31,8 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
private static uint _miningCostBarrierOil;
|
||||
|
||||
private static uint _seed = (uint)Random.Range(int.MinValue, int.MaxValue);
|
||||
private static readonly Dictionary<int, VeinCacheData> PlanetVeinCacheData = new();
|
||||
private static readonly Dictionary<int, (long, bool)> Fuels = new();
|
||||
private static readonly Dictionary<int, VeinCacheData> PlanetVeinCacheData = [];
|
||||
private static readonly Dictionary<int, (long, bool)> Fuels = [];
|
||||
|
||||
private bool _cfgEnabled = true;
|
||||
|
||||
@@ -52,11 +52,11 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
.Value;
|
||||
_fuelIlsSlot = Config.Bind("General", "ILSFuelSlot", _fuelIlsSlot + 1,
|
||||
new ConfigDescription("Fuel slot for ILS, set to 0 to disable",
|
||||
new AcceptableValueRange<int>(0, 5), Array.Empty<object>()))
|
||||
new AcceptableValueRange<int>(0, 5), []))
|
||||
.Value - 1;
|
||||
_fuelPlsSlot = Config.Bind("General", "PLSFuelSlot", _fuelPlsSlot + 1,
|
||||
new ConfigDescription("Fuel slot for PLS, set to 0 to disable",
|
||||
new AcceptableValueRange<int>(0, 4), Array.Empty<object>()))
|
||||
new AcceptableValueRange<int>(0, 4), []))
|
||||
.Value - 1;
|
||||
if (!_cfgEnabled) return;
|
||||
|
||||
@@ -98,8 +98,8 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(DSPGame), "StartGame", typeof(GameDesc))]
|
||||
[HarmonyPatch(typeof(DSPGame), "StartGame", typeof(string))]
|
||||
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartGame), typeof(GameDesc))]
|
||||
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartGame), typeof(string))]
|
||||
private static void OnGameStart()
|
||||
{
|
||||
Logger.LogInfo("Game Start");
|
||||
@@ -119,7 +119,7 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameMain), "Start")]
|
||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Start))]
|
||||
private static void OnGameLoaded()
|
||||
{
|
||||
_frame = 0f;
|
||||
@@ -130,7 +130,7 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameHistoryData), "UnlockTechFunction")]
|
||||
[HarmonyPatch(typeof(GameHistoryData), nameof(GameHistoryData.UnlockTechFunction))]
|
||||
private static void OnUnlockTech(int func)
|
||||
{
|
||||
switch (func)
|
||||
@@ -145,7 +145,7 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameData), "GameTick")]
|
||||
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.OnFactoryFrameBegin))]
|
||||
private static void FrameTick()
|
||||
{
|
||||
var main = GameMain.instance;
|
||||
@@ -165,7 +165,7 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameHistoryData), "UnlockRecipe")]
|
||||
[HarmonyPatch(typeof(GameHistoryData), nameof(GameHistoryData.UnlockRecipe))]
|
||||
private static void OnUnlockRecipe(int recipeId)
|
||||
{
|
||||
if (recipeId == 119)
|
||||
@@ -175,9 +175,9 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlanetFactory), "Init")]
|
||||
[HarmonyPatch(typeof(PlanetFactory), "RecalculateVeinGroup")]
|
||||
[HarmonyPatch(typeof(PlanetFactory), "RecalculateAllVeinGroups")]
|
||||
[HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.Init))]
|
||||
[HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.RecalculateVeinGroup))]
|
||||
[HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.RecalculateAllVeinGroups))]
|
||||
private static void NeedRecalcVeins(PlanetFactory __instance)
|
||||
{
|
||||
RecalcVeins(__instance);
|
||||
@@ -204,7 +204,7 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(FactorySystem), "CheckBeforeGameTick")]
|
||||
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.FactoryBeforeGameTick))]
|
||||
private static void FactorySystemLogisticMiner(FactorySystem __instance)
|
||||
{
|
||||
if (_miningSpeedScaleLong <= 0)
|
||||
@@ -231,7 +231,7 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
var factoryProductionStat =
|
||||
GameMain.statistics.production.factoryStatPool[__instance.factory.index];
|
||||
var productRegister = factoryProductionStat?.productRegister;
|
||||
PerformanceMonitor.BeginSample(ECpuWorkEntry.Miner);
|
||||
DeepProfiler.BeginSample(DPEntry.Miner);
|
||||
do
|
||||
{
|
||||
for (var j = 1; j < planetTransport.stationCursor; j++)
|
||||
@@ -334,7 +334,7 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
vcd.FrameNext += _miningFrames;
|
||||
} while (vcd.FrameNext <= _frame);
|
||||
|
||||
PerformanceMonitor.EndSample(ECpuWorkEntry.Miner);
|
||||
DeepProfiler.EndSample(DPEntry.Miner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,9 +353,9 @@ public class LogisticMiner : BaseUnityPlugin
|
||||
|
||||
public void GenVeins(PlanetFactory factory)
|
||||
{
|
||||
_veins = new Dictionary<int, List<int>>();
|
||||
_veins = [];
|
||||
var veinPool = factory.veinPool;
|
||||
var vg = new Dictionary<int, HashSet<int>>();
|
||||
Dictionary<int, HashSet<int>> vg = [];
|
||||
for (var i = 0; i < veinPool.Length; i++)
|
||||
{
|
||||
if (veinPool[i].amount <= 0 || veinPool[i].type == EVeinType.None) continue;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<AssemblyName>LogisticMiner</AssemblyName>
|
||||
<BepInExPluginGuid>org.soardev.logisticminer</BepInExPluginGuid>
|
||||
<Description>DSP MOD - LogisticMiner</Description>
|
||||
<Version>0.1.0</Version>
|
||||
<Version>0.2.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RestoreAdditionalProjectSources>https://nuget.bepinex.dev/v3/index.json</RestoreAdditionalProjectSources>
|
||||
@@ -15,10 +15,19 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
reaches Advanced Mining Machine, otherwise 100.
|
||||
* 100/s for water by default.
|
||||
* Energy costs: 1MW/vein-group & 10MW/water-slot & 1.8MW/oil-seep(configurable)
|
||||
* Fuels burning slot. Default: 4th for ILS, 3rd for PLS. Set to 0 to disable it.
|
||||
* Fuels burning slot. Default: 4th for ILS, 4th for PLS. Set to 0 to disable it.
|
||||
|
||||
## 使用说明
|
||||
|
||||
@@ -47,4 +47,4 @@
|
||||
倍率可以设置为0(默认),此时倍率会随科技解锁而变化,默认是100%,解锁高级采矿机后变为300%。
|
||||
* 水的采集速度默认为100/s。
|
||||
* 能耗:每矿物组 1MW,单格水 10MW,每油井 1.8MW。
|
||||
* 燃料格位置。默认:星际物流塔第4格,行星内物流塔第3格。设为0则关闭燃料补充能量功能。
|
||||
* 燃料格位置。默认:星际物流塔第4格,行星内物流塔第4格。设为0则关闭燃料补充能量功能。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "LogisticMiner",
|
||||
"version_number": "0.1.0",
|
||||
"version_number": "0.2.0",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/LogisticMiner",
|
||||
"description": "Logistic Storages can mine all ores/water on current planet / 物流塔可以采集当前星球的全部矿产(以及水)",
|
||||
"dependencies": [
|
||||
|
||||
@@ -1069,10 +1069,10 @@ public static class LogisticsPatch
|
||||
var localPlanet = GameMain.data?.localPlanet;
|
||||
if (localPlanet == null || !localPlanet.factoryLoaded)
|
||||
{
|
||||
_stationTipsRoot.SetActive(false);
|
||||
if (_lastPlanetId == 0) return;
|
||||
RecycleStationTips();
|
||||
_lastPlanetId = 0;
|
||||
_stationTipsRoot.SetActive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user