severedsolo / alarmenhancements Goto Github PK
View Code? Open in Web Editor NEWA mod to enhance the stock Alarm Clock in Kerbal Space Program
License: MIT License
A mod to enhance the stock Alarm Clock in Kerbal Space Program
License: MIT License
Mun encounter with flyby and escape, also Kerbin escape.
Two alarms are created, for each escape.
As soon as the Mun orbit is secure, the Mun escape alarm is automatically deleted, but the Kerbin escape alarm persists.
AFAICT, you've got over 50 unused references. The dependencies needed are (fairly typical for a KSP mod):
You can save time on the build, storage space, and simplify setup for any other developer contributing by eliminating the unused ones.
Harmony is a library that lets the user pre-fix, post-fix, and transpile .net methods. A few prominent KSP mods use it, including KSP Community Fixes, Kerbalism, and Luna Multiplayer.
With Harmony, you can override the "GetDefaultTItle" method of the alarm classes and get the behavior many users have asked for (allowing them to change the alarm names) plus better performance (don't have to respond to added alarms, which includes edited alarms), plus because you're overriding the default title, the user can actually use your improved default title to make whatever edits they want from the template. For example, I might want to edit my maneuver alarm from "My Vessel Maneuver" to "My Vessel Circularization".
The code is very simple to do this, I might turn this into a PR to contribute, by proof of concept:
using HarmonyLib;
using UnityEngine;
namespace AlarmEnhancements
{
[KSPAddon(KSPAddon.Startup.Instantly, true)]
public class AlarmEnhancements : MonoBehaviour
{
private void Start() {
var harmony = new Harmony("com.marr75.alarmEnhancements");
harmony.PatchAll();
}
}
[HarmonyPatch(typeof(AlarmTypeManeuver))]
class ManeuverAlarmPatch {
[HarmonyPrefix]
static bool GetDefaultTitle(AlarmTypeManeuver __instance, ref string __result) {
__result = $"{__instance.vesselName} Maneuver"; // Overwrite the old result
return false; // don't bother running the old method, it was a simple localization call of the word, "Maneuver", anyway
}
}
}
You'll also catch the alarms created from the map view shortcut with this approach, obviously.
when auto add atmosphere alarm enabled, game lag for every few seconds.
AlarmEnhancements/AlarmEnhancements/AlarmEnhancements.cs
Lines 148 to 153 in 678fb84
using bisection method can improve performance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.