Exemple #1
0
 public void OnModUnload()
 {
     CLIU.Echo("unloaded!");
     RConsole.unregisterCommand("sailsOpen");
     RConsole.unregisterCommand("sailsClose");
     RConsole.unregisterCommand("sailsDecay");
     harmony.UnpatchAll(harmonyID);
     Destroy(gameObject);
 }
Exemple #2
0
 private void SaveSettings()
 {
     try
     {
         string contents = JsonUtility.ToJson(modSettings);
         File.WriteAllText(settingsPath, contents);
     }
     catch
     {
         CLIU.Echo("Settings were unable to be saved to file " + settingsPath);
     }
 }
Exemple #3
0
    public void SailsDecay()
    {
        ModSettings settings = new ModSettings();
        float       num;

        if (!CLIU.InterpretFloatFromLastCommand(out num, 1f, 5f, settings.decayRateExponent))
        {
            return;
        }
        RaftFixedUpdatePatch.rate  = num;
        settings.decayRateExponent = num;
        SaveSettings();
        CLIU.Echo("sailsDecay rate is now set to " + CLIU.Blue(num.ToString()));
    }
Exemple #4
0
 public void Start()
 {
     CLIU.CONSOLE_PREFIX = CLIU.Cyan("[") + "MoreSailsMoreSpeed" + CLIU.Cyan("] ");
     harmony             = HarmonyInstance.Create(harmonyID);
     harmony.PatchAll(Assembly.GetExecutingAssembly());
     settingsPath = Directory.GetCurrentDirectory() + "\\mods\\MoreSailsMoreSpeed.json";
     modSettings  = LoadSettings();
     RaftFixedUpdatePatch.rate = modSettings.decayRateExponent;
     //RConsole.registerCommand(typeof(MoreSailsMoreSpeedMod), "Lower all sails", "sailsOpen", SailsOpen);
     //RConsole.registerCommand(typeof(MoreSailsMoreSpeedMod), "Raise all sails", "sailsClose", SailsClose);
     //RConsole.registerCommand(typeof(MoreSailsMoreSpeedMod), "The exponent x for i/i^x (default: 1.9; constrained to 1 <= x <= 5)", "sailsDecay", SailsDecay);
     RConsole.registerCommand("sailsOpen", "Lower all sails", "sailsOpen", SailsOpen);
     RConsole.registerCommand("sailsClose", "Raise all sails", "sailsClose", SailsClose);
     RConsole.registerCommand("sailsDecay", "The exponent x for i/i^x (default: 1.9; constrained to 1 <= x <= 5)", "sailsDecay", SailsDecay);
     CLIU.Echo("loaded!");
 }