Esempio n. 1
0
        /// <summary>The event called after the first game update, once all mods are loaded.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // instantiate awesome tool effects
            _manager = new EffectsManager(Config, ModRegistry);

            // add Generic Mod Config Menu integration
            new GenericModConfigMenuIntegrationForAwesomeTools(
                getConfig: () => Config,
                reset: () =>
            {
                Config = new ToolConfig();
                Helper.WriteConfig(Config);
            },
                saveAndApply: () =>
            {
                Helper.WriteConfig(Config);
            },
                modRegistry: ModRegistry,
                monitor: Monitor,
                manifest: ModManifest
                ).Register();
        }
Esempio n. 2
0
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            // get mod registry
            ModRegistry = Helper.ModRegistry;

            // get and verify configs.json
            Config = Helper.ReadConfig <ToolConfig>();
            VerifyModConfig();

            // get reflection interface
            Reflection = Helper.Reflection;

            // hook events
            Helper.Events.GameLoop.GameLaunched += OnGameLaunched;
            Helper.Events.Input.ButtonReleased  += OnButtonReleased;

            // create and patch Harmony instance
            var harmony = HarmonyInstance.Create("thelion.AwesomeTools");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            // add commands for debugging (or cheating)
            Helper.ConsoleCommands.Add("player_settoolsupgrade", "Set the upgrade level of all upgradeable tools in the player's inventory." + GetCommandUsage(), SetToolsUpgrade);
        }
Esempio n. 3
0
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The overal mod settings.</param>
 /// <param name="modRegistry">Metadata about loaded mods.</param>
 public EffectsManager(ToolConfig config, IModRegistry modRegistry)
 {
     _axe        = new AxeEffect(config.AxeConfig, modRegistry);
     _pickaxe    = new PickaxeEffect(config.PickaxeConfig, modRegistry);
     _multiplier = config.StaminaCostMultiplier;
 }