From 3b134ae25e12a3c1cb910bfb46c3380a2127c27d Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Tue, 19 Sep 2023 14:16:03 +0800 Subject: [PATCH] minor refactorying --- CheatEnabler/DysonSpherePatch.cs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/CheatEnabler/DysonSpherePatch.cs b/CheatEnabler/DysonSpherePatch.cs index e7759a0..1723872 100644 --- a/CheatEnabler/DysonSpherePatch.cs +++ b/CheatEnabler/DysonSpherePatch.cs @@ -213,6 +213,18 @@ public static class DysonSpherePatch { public DysonSail Sail; public int OrbitId; + + public void FromData(in VectorLF3 delta1, in VectorLF3 delta2, int orbitId) + { + Sail.px = (float)delta1.x; + Sail.py = (float)delta1.y; + Sail.pz = (float)delta1.z; + Sail.vx = (float)delta2.x; + Sail.vy = (float)delta2.y; + Sail.vz = (float)delta2.z; + Sail.gs = 1f; + OrbitId = orbitId; + } } public static void UpdateSailLifeTime() @@ -312,16 +324,7 @@ public static class DysonSpherePatch } } _sailsCacheLen[index] = len + 1; - ref var sailCache = ref cache[len]; - ref var ss = ref sailCache.Sail; - ss.px = (float)delta1.x; - ss.py = (float)delta1.y; - ss.pz = (float)delta1.z; - ss.vx = (float)delta2.x; - ss.vy = (float)delta2.y; - ss.vz = (float)delta2.z; - ss.gs = 1f; - sailCache.OrbitId = orbitId; + cache[len].FromData(delta1, delta2, orbitId); } }