mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-03-23 00:53:30 +08:00
UXAssist: - PlanetFunctions: fix infinite loop in constructStats cleanup (i++ -> i--) - PlanetFunctions: skip entityPool slot 0 (sentinel) in DismantleAll foreach - PlanetFunctions: fix belt buffer walk infinite loop when buffer[j]==250, add cargoPool bounds check - FactoryPatch: fix UnfixProto guard condition (< 3 -> < PowerPoleIds.Length) - FactoryPatch: fix Array.Resize(index*2) -> (index+1)*2 to handle index==0 - LogisticsPatch: fix UpdateStorageMax early-exit to check both local and remote - LogisticsPatch: fix storage max scan to use Math.Max instead of last-write - LogisticsPatch: add divide-by-zero guard in station storage ratio calculation - LogisticsPatch: fix station entry right-click delegates using per-instance dictionary instead of shared static array to prevent unsubscribe mismatch - LogisticsPatch: add null checks for GameObject.Find results in InitGUI - GamePatch: log exception in previously empty catch block - GameLogic: invoke event handlers individually with try/catch so one failing subscriber does not abort subsequent ones - DysonSpherePatch/LogisticsPatch/PersistPatch/PlayerPatch: replace matcher.Labels = null with matcher.Labels = [] (5 sites) - UIConfigWindow: remove duplicate I18N.Add for 'Outgoing integration count' - UIConfigWindow: remove two orphaned y += 36f spacing increments CheatEnabler: - GamePatch: add null check for GameMain.gameScenario in AbnormalDisabler.OnEnable - FactoryPatch: add null check for GameMain.mainPlayer in TakeTailItemsPatch and GetItemCountPatch - FactoryPatch: add null check for GameMain.mainPlayer in ConstructionSystem_GameTick_Prefix - FactoryPatch: fix _portalFrom.Remove(beltId) -> Remove(v) (wrong key) - FactoryPatch: add null guard for GameMain.data before iterating factories in WindTurbinesPowerGlobalCoverage - DysonSphereFunctions: fix shell pool rebuild loop writing all shells to slot 1 (id=1); now uses j+1 per iteration - DysonSphereFunctions: replace GameMain.gameScenario.NotifyOnPlanDysonShell() with null-conditional call (?.) at 4 sites - DysonSpherePatch: fix SkipAbsorbPatch/QuickAbsorbPatch sharing _instantAbsorb: OnDisable now recalculates the flag instead of unconditionally clearing it - PlayerFunctions: add null check for GameMain.galaxy in TeleportToOuterSpace - UIConfigWindow: add null guard in UpdateButtons before accessing button fields - PlanetFunctions: add colliderId bounds check in BuryAllVeins
36 lines
1.5 KiB
C#
36 lines
1.5 KiB
C#
using Random = UnityEngine.Random;
|
|
|
|
namespace CheatEnabler.Functions;
|
|
|
|
public static class PlanetFunctions
|
|
{
|
|
public static void BuryAllVeins(bool bury)
|
|
{
|
|
var planet = GameMain.localPlanet;
|
|
var factory = planet?.factory;
|
|
if (factory == null) return;
|
|
var physics = planet.physics;
|
|
var height = bury ? planet.realRadius - 50f : planet.realRadius + 0.07f;
|
|
var array = factory.veinPool;
|
|
var num = factory.veinCursor;
|
|
for (var m = 1; m < num; m++)
|
|
{
|
|
var pos = array[m].pos;
|
|
var colliderId = array[m].colliderId;
|
|
if (colliderId <= 0) continue;
|
|
var chunkIdx = colliderId >> 20;
|
|
var poolIdx = colliderId & 0xFFFFF;
|
|
if (chunkIdx >= physics.colChunks.Length) continue;
|
|
var chunk = physics.colChunks[chunkIdx];
|
|
if (chunk == null || poolIdx >= chunk.colliderPool.Length) continue;
|
|
var colliderData = physics.GetColliderData(colliderId);
|
|
var vector = colliderData.pos.normalized * (height + 0.4f);
|
|
chunk.colliderPool[poolIdx].pos = vector;
|
|
array[m].pos = pos.normalized * height;
|
|
var quaternion = Maths.SphericalRotation(array[m].pos, Random.value * 360f);
|
|
physics.SetPlanetPhysicsColliderDirty();
|
|
GameMain.gpuiManager.AlterModel(array[m].modelIndex, array[m].modelId, m, array[m].pos, quaternion, false);
|
|
}
|
|
GameMain.gpuiManager.SyncAllGPUBuffer();
|
|
}
|
|
} |