//well this was a failure. I am very glad we have a public reference to charge //at least the spin calculation wasn't a similarly colossal failure // god f****n dammit now i need this to work so I can calculate the overcharge private float pseudoCalculateCharge(Run.FixedTimeStamp now, LaserTurbineController self) { float num = now - _pseudoSnapshotTime; float num2 = self.minSpin * num; float num3 = _pseudoInitialSpin - self.minSpin; float t = Mathf.Min(Trajectory.CalculateFlightDuration(num3, -self.spinDecayRate) * 0.5f, num); float num4 = Trajectory.CalculatePositionYAtTime(0f, num3, t, -self.spinDecayRate); return(Mathf.Min(_pseudoInitialCharge + num2 + num4, 1f)); }
private void LaserTurbineController_ExpendCharge(On.RoR2.LaserTurbineController.orig_ExpendCharge orig, LaserTurbineController self) { Run.FixedTimeStamp now = _runNow; float spin = pseudoCalculateSpin(now, self); spin += self.spinPerKill; _pseudoInitialSpin += spin; _pseudoInitialCharge = 0f; _pseudoSnapshotTime = now; self.spinPerKill = _stackedSpinPerKill; orig(self); }
private void LaserTurbineController_OnOwnerKilledOtherServer(On.RoR2.LaserTurbineController.orig_OnOwnerKilledOtherServer orig, LaserTurbineController self) { Run.FixedTimeStamp now = _runNow; float spin = pseudoCalculateSpin(now, self); float charge = pseudoCalculateCharge(now, self); spin = Mathf.Min(spin + self.spinPerKill, self.maxSpin); _pseudoInitialSpin = spin; _pseudoInitialCharge = charge; _pseudoSnapshotTime = now; self.spinPerKill = _stackedSpinPerKill; orig(self); }
private void LaserTurbineController_OnStartServer(On.RoR2.LaserTurbineController.orig_OnStartServer orig, LaserTurbineController self) { _pseudoInitialSpin = self.minSpin; _pseudoSnapshotTime = _runNow; orig(self); }
private float pseudoCalculateSpin(Run.FixedTimeStamp now, LaserTurbineController self) { return(Mathf.Max(_pseudoInitialSpin - self.spinDecayRate * (_runNow - _pseudoSnapshotTime), self.minSpin));; }
private void LaserTurbineController_FixedUpdate(On.RoR2.LaserTurbineController.orig_FixedUpdate orig, LaserTurbineController self) { Utils.Log($"{self.charge.ToString("0.00")} | {pseudoCalculateSpin(_runNow, self).ToString("0.00")} ({pseudoCalculateCharge(_runNow, self).ToString("0.00")})"); orig(self); }
// private void LaserTurbineController_Awake(On.RoR2.LaserTurbineController.orig_Awake orig, LaserTurbineController self) { _baseSpinPerKill = self.spinPerKill; orig(self); }