mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-05 11:02:21 +08:00
refactoring UXAssist and CheatEnabler
This commit is contained in:
29
CheatEnabler/Functions/PlanetFunctions.cs
Normal file
29
CheatEnabler/Functions/PlanetFunctions.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
var colliderData = physics.GetColliderData(colliderId);
|
||||
var vector = colliderData.pos.normalized * (height + 0.4f);
|
||||
physics.colChunks[colliderId >> 20].colliderPool[colliderId & 0xFFFFF].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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user