1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-02-04 15:12:17 +08:00

Compare commits

6 Commits

Author SHA1 Message Date
157c86112b optimized batch building 2026-02-04 14:54:06 +08:00
d0c20693e3 updated dlls 2026-02-04 14:49:48 +08:00
8ae88f4b41 CheatEnabler: Immediate Build fix optimization 2026-02-04 13:22:29 +08:00
c1428f6aee CheatEnabler: Immediate Build fix 2026-02-04 03:07:25 +08:00
260e419855 UXAssist 1.5.2 2026-02-04 03:07:05 +08:00
6e0484f035 UXAssist v1.5.2 2026-01-31 00:28:56 +08:00
20 changed files with 176 additions and 68 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
</ItemGroup>

View File

@@ -119,9 +119,6 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
}
private static HashSet<int> _beltIds = [];
private static HashSet<int> _alterBeltRendererIds;
private static HashSet<int> _alterPathRendererIds;
private static HashSet<int> _refreshPathUVIds;
private static void OnDataLoaded()
{
@@ -168,16 +165,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
var prebuilds = factory.prebuildPool;
if (imm)
{
var anyBelt = false;
var anyBuilt = false;
_alterBeltRendererIds ??= [];
_alterPathRendererIds ??= [];
_refreshPathUVIds ??= [];
CargoTrafficPatch.IsBatchBuilding = true;
factory.BeginFlattenTerrain();
factory.cargoTraffic._batch_buffer_no_refresh = true;
PlanetFactory.batchBuild = true;
CargoTrafficPatch.DisableRefreshBatchesBuffers = true;
var player = GameMain.mainPlayer;
for (var i = factory.prebuildCursor - 1; i > 0; i--)
{
ref var pb = ref prebuilds[i];
@@ -187,14 +175,49 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
if (!architect) continue;
pb.itemRequired = 0;
}
anyBelt = anyBelt || _beltIds.Contains(pb.protoId);
factory.BuildFinally(GameMain.mainPlayer, i, false);
anyBuilt = true;
CargoTrafficPatch.InstantBuild(player, factory, i);
}
CargoTrafficPatch.TryEndBatchBuilding(factory);
}
else if (architect)
{
for (var i = factory.prebuildCursor - 1; i > 0; i--)
{
ref var pb = ref prebuilds[i];
if (pb.id != i || pb.isDestroyed || pb.itemRequired == 0) continue;
pb.itemRequired = 0;
factory.AlterPrebuildModelState(i);
}
}
}
private class CargoTrafficPatch : PatchImpl<CargoTrafficPatch>
{
private static bool _isBatchBuilding;
private static bool _disableRefreshBatchesBuffers;
private static bool _anyBelt;
private static readonly HashSet<int> _alterBeltRendererIds = [];
private static readonly HashSet<int> _alterPathRendererIds = [];
private static readonly HashSet<int> _refreshPathUVIds = [];
public static bool IsBatchBuilding => _isBatchBuilding;
public static void StartBatchBuilding(PlanetFactory factory)
{
factory.BeginFlattenTerrain();
factory.cargoTraffic._batch_buffer_no_refresh = true;
PlanetFactory.batchBuild = true;
_isBatchBuilding = true;
_disableRefreshBatchesBuffers = true;
_anyBelt = false;
}
public static void EndBatchBuilding(PlanetFactory factory)
{
PlanetFactory.batchBuild = false;
factory.cargoTraffic._batch_buffer_no_refresh = false;
factory.EndFlattenTerrain();
CargoTrafficPatch.IsBatchBuilding = false;
_isBatchBuilding = false;
var cargoTraffic = factory.cargoTraffic;
var entityPool = factory.entityPool;
var colChunks = factory.planet.physics?.colChunks;
@@ -213,40 +236,36 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
_alterBeltRendererIds.Clear();
_alterPathRendererIds.Clear();
_refreshPathUVIds.Clear();
CargoTrafficPatch.DisableRefreshBatchesBuffers = false;
if (anyBelt)
_disableRefreshBatchesBuffers = false;
if (_anyBelt)
{
factory.cargoTraffic.RefreshBeltBatchesBuffers();
factory.cargoTraffic.RefreshPathBatchesBuffers();
}
if (anyBuilt)
{
factory.planet.physics?.raycastLogic?.NotifyBatchObjectRemove();
factory.planet.audio?.SetPlanetAudioDirty();
}
_anyBelt = false;
factory.planet.physics?.raycastLogic?.NotifyBatchObjectRemove();
factory.planet.audio?.SetPlanetAudioDirty();
}
public static void TryEndBatchBuilding(PlanetFactory factory)
{
if (!_isBatchBuilding) return;
EndBatchBuilding(factory);
}
public static void InstantBuild(Player player, PlanetFactory factory, int id)
{
if (!_isBatchBuilding) StartBatchBuilding(factory);
_anyBelt = _anyBelt || _beltIds.Contains(factory.prebuildPool[id].protoId);
factory.BuildFinally(player, id, false);
}
else if (architect)
{
for (var i = factory.prebuildCursor - 1; i > 0; i--)
{
ref var pb = ref prebuilds[i];
if (pb.id != i || pb.isDestroyed || pb.itemRequired == 0) continue;
pb.itemRequired = 0;
factory.AlterPrebuildModelState(i);
}
}
}
private class CargoTrafficPatch : PatchImpl<CargoTrafficPatch>
{
public static bool IsBatchBuilding;
public static bool DisableRefreshBatchesBuffers;
[HarmonyPrefix]
[HarmonyPriority(Priority.First)]
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.AlterBeltRenderer))]
private static bool CargoTraffic_AlterBeltRenderer_Prefix(int beltId)
{
if (!IsBatchBuilding) return true;
if (!_isBatchBuilding) return true;
_alterBeltRendererIds.Add(beltId);
return false;
}
@@ -256,7 +275,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.AlterPathRenderer))]
private static bool CargoTraffic_AlterPathRenderer_Prefix(int pathId)
{
if (!IsBatchBuilding) return true;
if (!_isBatchBuilding) return true;
_alterPathRendererIds.Add(pathId);
return false;
}
@@ -266,7 +285,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.RefreshPathUV))]
private static bool CargoTraffic_RefreshPathUV_Prefix(int pathId)
{
if (!IsBatchBuilding) return true;
if (!_isBatchBuilding) return true;
_refreshPathUVIds.Add(pathId);
return false;
}
@@ -277,7 +296,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.RefreshPathBatchesBuffers))]
private static bool CargoTraffic_RefreshBeltBatchesBuffers_Prefix()
{
return !DisableRefreshBatchesBuffers;
return !_disableRefreshBatchesBuffers;
}
}
@@ -419,6 +438,87 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
return matcher.InstructionEnumeration();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ConstructionSystem), nameof(ConstructionSystem.GameTick))]
private static void ConstructionSystem_GameTick_Prefix(ConstructionSystem __instance, long time)
{
if (time % 6 != 0) return;
var factory = __instance.factory;
if (factory.prebuildCount <= 0) return;
var player = GameMain.mainPlayer;
var total = factory.prebuildCursor - 1;
var stepCount = total switch {
< 256 => 1,
< 2048 => 3,
< 16384 => 10,
_ => 20,
};
var step = (int)(time / 6 % stepCount);
var start = 1 + total * step / stepCount;
var end = 1 + total * (step + 1) / stepCount;
for (var i = start; i < end; i++)
{
ref var prebuild = ref factory.prebuildPool[i];
if (prebuild.id != i || prebuild.isDestroyed) continue;
if (prebuild.itemRequired > 0)
{
int itemId = prebuild.protoId;
int count = prebuild.itemRequired;
player.package.TakeTailItems(ref itemId, ref count, out var _, false);
if (count > 0)
{
prebuild.itemRequired -= count;
if (prebuild.itemRequired <= 0)
{
CargoTrafficPatch.InstantBuild(player, factory, i);
}
}
}
}
if (CargoTrafficPatch.IsBatchBuilding)
{
for (var i = start - 1; i > 0; i--)
{
ref var prebuild = ref factory.prebuildPool[i];
if (prebuild.id != i || prebuild.isDestroyed) continue;
if (prebuild.itemRequired > 0)
{
int itemId = prebuild.protoId;
int count = prebuild.itemRequired;
player.package.TakeTailItems(ref itemId, ref count, out var _, false);
if (count > 0)
{
prebuild.itemRequired -= count;
if (prebuild.itemRequired <= 0)
{
CargoTrafficPatch.InstantBuild(player, factory, i);
}
}
}
}
for (var i = end; i <= total; i++)
{
ref var prebuild = ref factory.prebuildPool[i];
if (prebuild.id != i || prebuild.isDestroyed) continue;
if (prebuild.itemRequired > 0)
{
int itemId = prebuild.protoId;
int count = prebuild.itemRequired;
player.package.TakeTailItems(ref itemId, ref count, out var _, false);
if (count > 0)
{
prebuild.itemRequired -= count;
if (prebuild.itemRequired <= 0)
{
CargoTrafficPatch.InstantBuild(player, factory, i);
}
}
}
}
CargoTrafficPatch.EndBatchBuilding(factory);
}
}
/*
[HarmonyTranspiler]
[HarmonyPatch(typeof(ConstructionSystem), nameof(ConstructionSystem.AddBuildTargetToModules))]

View File

@@ -19,7 +19,7 @@
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
<PackageReference Include="DysonSphereProgram.Modding.NebulaMultiplayerModApi" Version="2.0.0" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -15,7 +15,7 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -16,7 +16,7 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -16,7 +16,7 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -15,7 +15,7 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -16,7 +16,7 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -17,7 +17,7 @@
<PackageReference Include="NLua" Version="1.*" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
<PackageReference Include="obs-websocket-dotnet" Version="5.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" /> -->
</ItemGroup>

View File

@@ -16,7 +16,7 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -18,7 +18,7 @@
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -16,7 +16,7 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>

View File

@@ -3,6 +3,10 @@
## Changlog
* 1.5.2
* Fix crash while error occurs on milkyway login/upload.
* 1.5.1
* Support game version 0.10.34.28392
* 1.5.0
* Support game version 0.10.34
* New features:
@@ -365,6 +369,10 @@
## 更新日志
* 1.5.2
* 修复在银河系登录/上传出错时崩溃的问题
* 1.5.1
* 支持游戏版本 0.10.34.28392
* 1.5.0
* 支持游戏版本 0.10.34
* 新功能:

View File

@@ -181,16 +181,16 @@ public class PersistPatch : PatchImpl<PersistPatch>
switch (errorType)
{
case DSPWeb.HTTP_ERROR_TYPE.NETWORK_ERROR:
Functions.UIFunctions.AddClusterUploadResult(-10001, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(-10001, 0f);
break;
case DSPWeb.HTTP_ERROR_TYPE.HTTP_ERROR:
Functions.UIFunctions.AddClusterUploadResult(-10010 - errorCode, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(-10010 - errorCode, 0f);
break;
case DSPWeb.HTTP_ERROR_TYPE.USER_ABORT:
Functions.UIFunctions.AddClusterUploadResult(-10003, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(-10003, 0f);
break;
case DSPWeb.HTTP_ERROR_TYPE.UNEXPECTED_ERROR:
Functions.UIFunctions.AddClusterUploadResult(-10004, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(-10004, 0f);
break;
}
}
@@ -202,16 +202,16 @@ public class PersistPatch : PatchImpl<PersistPatch>
switch (errorType)
{
case DSPWeb.HTTP_ERROR_TYPE.NETWORK_ERROR:
Functions.UIFunctions.AddClusterUploadResult(-101, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(-101, 0f);
break;
case DSPWeb.HTTP_ERROR_TYPE.HTTP_ERROR:
Functions.UIFunctions.AddClusterUploadResult(-110 - errorCode, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(-110 - errorCode, 0f);
break;
case DSPWeb.HTTP_ERROR_TYPE.USER_ABORT:
Functions.UIFunctions.AddClusterUploadResult(-103, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(-103, 0f);
break;
case DSPWeb.HTTP_ERROR_TYPE.UNEXPECTED_ERROR:
Functions.UIFunctions.AddClusterUploadResult(-104, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(-104, 0f);
break;
}
}
@@ -222,7 +222,7 @@ public class PersistPatch : PatchImpl<PersistPatch>
{
if (!int.TryParse(handler.text, out var rcode))
rcode = -1;
Functions.UIFunctions.AddClusterUploadResult(rcode, (float)__instance.uploadRequest.reqTime);
Functions.UIFunctions.AddClusterUploadResult(rcode, __instance.uploadRequest == null ? 0f : (float)__instance.uploadRequest.reqTime);
}
[HarmonyTranspiler]

View File

@@ -4,7 +4,7 @@
<TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
<Description>DSP MOD - UXAssist</Description>
<Version>1.5.0</Version>
<Version>1.5.2</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<PackageId>UXAssist</PackageId>
@@ -15,7 +15,7 @@
<ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.*" />
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />

View File

@@ -1,6 +1,6 @@
{
"name": "UXAssist",
"version_number": "1.5.0",
"version_number": "1.5.2",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
"dependencies": [

View File

@@ -15,7 +15,7 @@
<ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
</ItemGroup>

View File

@@ -16,7 +16,7 @@
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.62" IncludeAssets="compile" />
</ItemGroup>
<ItemGroup>