コード例 #1
0
ファイル: Main.cs プロジェクト: tpf89/StardewMods
        public override void Entry(IModHelper helper)
        {
            // init
            modPath = helper.DirectoryPath;
            Config  = helper.ReadConfig <MorePetsConfig>();

            // load textures
            EntoFramework.GetContentRegistry().RegisterTexture("paths_objects_MorePetsTilesheet", Path.Combine(modPath, "box.png"));
            this.LoadPetSkins(out CatTextures, out DogTextures);
            Monitor.Log($"Found [{CatTextures.Length}] Cat and [{DogTextures.Length}] Dog skins", LogLevel.Info);

            // hook events
            GameEvents.UpdateTick                 += GameEvents_UpdateTick;
            TimeEvents.AfterDayStarted            += TimeEvents_AfterDayStarted;
            ControlEvents.ControllerButtonPressed += ControlEvents_ControllerButtonPressed;
            ControlEvents.MouseChanged            += ControlEvents_MouseChanged;
            //LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged;
            helper.ConsoleCommands.Add("kill_pets", "Kills all the pets you adopted using MorePets, you monster", this.CommandFired_KillPets);

            // add console commands
            if (Config.DebugMode)
            {
                // DEV COMMANDS, kept in should they be needed in the future
                helper.ConsoleCommands
                .Add("spawn_pet", "Spawns either a `dog` or a `cat` depending on the given name | spawn_pet <type> <skin>", this.CommandFired_SpawnPet)
                .Add("test_adoption", "Triggers the adoption dialogue", this.CommandFired_TestAdoption);
            }

            // check version
            Version version = new Version(this.ModManifest.Version.MajorVersion, this.ModManifest.Version.MinorVersion, this.ModManifest.Version.PatchVersion);

            VersionChecker.AddCheck("MorePets", version, "https://raw.githubusercontent.com/Entoarox/StardewMods/master/VersionChecker/MorePets.json");
        }
コード例 #2
0
 public override void Entry(IModHelper helper)
 {
     VersionChecker.AddCheck("FasterPaths", Version, "https://raw.githubusercontent.com/Entoarox/Stardew-SMAPI-mods/master/Projects/VersionChecker/FasterPaths.json");
     cfg = Helper.ReadConfig <ConfigFP>();
     GameEvents.UpdateTick += UpdateTick;
     helper.ConsoleCommands.Add("fp_info", "Gives info about the path you are currently standing on", this.CommandInfo);
     Modifiers = new FarmerModifier[10] {
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.woodFloorBoost, RunSpeedModifier = cfg.woodFloorBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.stoneFloorBoost, RunSpeedModifier = cfg.stoneFloorBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.weatheredFloorBoost, RunSpeedModifier = cfg.weatheredFloorBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.crystalFloorBoost, RunSpeedModifier = cfg.crystalFloorBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.strawFloorBoost, RunSpeedModifier = cfg.strawFloorBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.gravelPathBoost, RunSpeedModifier = cfg.gravelPathBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.woodPathBoost, RunSpeedModifier = cfg.woodPathBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.crystalPathBoost, RunSpeedModifier = cfg.crystalPathBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.cobblePathBoost, RunSpeedModifier = cfg.cobblePathBoost
         },
         new FarmerModifier()
         {
             WalkSpeedModifier = cfg.steppingStoneBoost, RunSpeedModifier = cfg.steppingStoneBoost
         }
     };
     PlayerHelper = EntoFramework.GetPlayerHelper();
     PlayerHelper.AddModifier(new FarmerModifier()
     {
         WalkSpeedModifier = cfg.walkSpeedBoost, RunSpeedModifier = cfg.runSpeedBoost
     });
 }
コード例 #3
0
ファイル: Mod.cs プロジェクト: tpf89/StardewMods
 public override void Entry(IModHelper helper)
 {
     VersionChecker.AddCheck("FurnitureAnywhere", typeof(FurnitureAnywhereMod).Assembly.GetName().Version, "https://raw.githubusercontent.com/Entoarox/StardewMods/master/VersionChecker/FurnitureAnywhere.json");
     MoreEvents.ActiveItemChanged          += MoreEvents_ActiveItemChanged;
     LocationEvents.CurrentLocationChanged += TriggerItemChangedEvent;
     MenuEvents.MenuChanged += TriggerItemChangedEvent;
     MenuEvents.MenuClosed  += TriggerItemChangedEvent;
     SaveEvents.BeforeSave  += SaveEvents_BeforeSave;
     SaveEvents.AfterSave   += SaveEvents_AfterSave_AfterLoad;
     SaveEvents.AfterLoad   += SaveEvents_AfterSave_AfterLoad;
     EntoFramework.GetTypeRegistry().RegisterType <AnywhereFurniture>();
 }
コード例 #4
0
ファイル: Mod.cs プロジェクト: tpf89/StardewMods
        /*********
        ** Public methods
        *********/
        /// <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)
        {
            VersionChecker.AddCheck("XnbLoader", this.GetType().Assembly.GetName().Version, "https://raw.githubusercontent.com/Entoarox/StardewMods/master/VersionChecker/XnbLoader.json");

            // prepare directory structure
            string contentPath = Path.Combine(this.Helper.DirectoryPath, this.ContentFolderName);

            foreach (string path in this.PathsToCreate)
            {
                Directory.CreateDirectory(Path.Combine(contentPath, path));
            }

            // load files
            this.Monitor.Log("Parsing `ModContent` for files to redirect the content manager to...", LogLevel.Info);
            int overrides = this.LoadOverrides(contentPath, contentPath);

            this.Monitor.Log($"Parsing complete, found and redirected {overrides} files", LogLevel.Info);
        }
コード例 #5
0
        public override void Entry(IModHelper helper)
        {
            ModPath   = helper.DirectoryPath;
            Logger    = Monitor;
            Localizer = helper.Translation;
            VersionChecker.AddCheck("AdvancedLocationLoader", GetType().Assembly.GetName().Version, "https://raw.githubusercontent.com/Entoarox/StardewMods/master/VersionChecker/AdvancedLocationLoader.json");

            GameEvents.UpdateTick                 += FirstUpdateTick;
            MoreEvents.ActionTriggered            += Events.MoreEvents_ActionTriggered;
            MoreEvents.WorldReady                 += Events.MoreEvents_WorldReady;
            LocationEvents.CurrentLocationChanged += Events.LocationEvents_CurrentLocationChanged;

            ITypeRegistry registry = EntoFramework.GetTypeRegistry();

            registry.RegisterType <Locations.Greenhouse>();
            registry.RegisterType <Locations.Sewer>();
            registry.RegisterType <Locations.Desert>();
            registry.RegisterType <Locations.DecoratableLocation>();
        }