Tool SMAPI: Stardew Modding API

Discussion in 'Mods' started by ClxS, Mar 6, 2016.

Thread Status:
Not open for further replies.
  1. Entoarox

    Entoarox Oxygen Tank

    The NuGet package handles those references automatically, although, to be fair, it was originally created to make cross-platform mod development easier, so unless code is shared between multiple PC's, you can just add the dependencies directly if it is easier for you.
     
    • littleraskol

      littleraskol Subatomic Cosmonaut

      Thanks for the answer! OK, I'm pretty much just doing this on my own. But I don't really know what you mean by "you can just add the dependencies directly if it is easier for you" because the references are there already. Maybe I am still missing something here. It just doesn't seem like I actually need to take any further step if I'm not developing anywhere by my own PC. Everything is there for me to use. Is that correct?
       
      • Pathoschild

        Pathoschild Tiy's Beard

        Hi @littleraskol. It sounds like it worked, so there's nothing else you need to do. The package is automatically detecting your game path and adding those references for you. :)
         
        • littleraskol

          littleraskol Subatomic Cosmonaut

          OK, as long as this is expected behavior! Thank you.
           
          • littleraskol

            littleraskol Subatomic Cosmonaut

            EDIT: Nevermind, I took out the method passing and called it directly and logging still doesn't happen. So I'm probably doing something wrong!

            So, I am noticing what seems like an odd bug. It happens if I pass a method as a parameter to another method. If I do this, and run the passed method, none of the logging works. For example:

            void foo(Action toDo)
            {

            Monitor.Log("Here we go!");
            toDo();
            }

            void bar()
            {

            Monitor.Log("Here we are!");
            }

            foo(bar);
            In this case, the log will only output "Here we go!" and not "Here we are!"

            Am I doing something wrong? Sorry if this is a known issue.
             
              Last edited: Jan 18, 2017
            • Pathoschild

              Pathoschild Tiy's Beard

            • littleraskol

              littleraskol Subatomic Cosmonaut

              I think I must have edited my post after you saw it, but I put up a notice that I realized I'd made a mistake. Sorry to waste your time! And thanks for checking.
               
                Last edited: Jan 18, 2017
              • Igorious

                Igorious Sandwich Man

                Today I've tried new version of SMAPI and SaveEvents.BeforeSave/.AfterSave events. It seems, they work incorrectly.
                Case:
                • Ship one item.
                • Go to bed.
                • No events will be raised.
                If it helps, there's code that I've used in my mods:
                Code:
                public static class SavingEvents
                {
                    public static event Action BeforeSaving;
                    public static event Action AfterSaving;
                
                    static SavingEvents()
                    {
                        MenuEvents.MenuChanged += OnMenuChanged;
                        MenuEvents.MenuClosed += OnMenuClosed;
                    }
                
                    private static void OnMenuChanged(object sender, EventArgsClickableMenuChanged args)
                    {
                        if (IsSaveGameMenu(args.NewMenu)) BeforeSaving?.Invoke();
                    }
                
                    private static void OnMenuClosed(object sender, EventArgsClickableMenuClosed args)
                    {
                        if (IsSaveGameMenu(args.PriorMenu)) AfterSaving?.Invoke();
                    }
                
                    private static bool IsSaveGameMenu(IClickableMenu menu)
                    {
                        return (menu is SaveGameMenu) || (menu is ShippingMenu);
                    }
                }
                 
                • Pathoschild

                  Pathoschild Tiy's Beard

                  @nirasa1957: I think we'll need a developer with more Linux experience to look into why you can't launch from Steam. In the meantime you can continue launching SMAPI directly; as long as Steam is already running, the overlay and achievements should work fine.

                  @Igorious Thanks! I'll release a patch release later tonight to fix it.
                   
                  • ShneekeyTheLost

                    ShneekeyTheLost Master Astronaut

                    Let me ask you, do you have any custom launch commands? Because it isn't running the correct file.

                    selected launcher: ./StardewModdingAPI.bin.x86_64 STEAM_RUNTIME=0
                    This means the Steam launcher is trying to launch the StardewModdingAPI.bin.x86_64 file instead of the StardewValley file it should be launching.
                     
                    • Pathoschild

                      Pathoschild Tiy's Beard

                      @ShneekeyTheLost That launcher line is correct (it's logged from inside the StardewValley script). You can see a comparison of log outputs in the relevant GitHub issue. More ideas are welcome though, I'm at a loss on this issue. :)
                       
                      • ShneekeyTheLost

                        ShneekeyTheLost Master Astronaut

                        That's an interesting one. Basically, I'm running it through Steam with no problems, and I seem to be on the same distro she is (Mint).

                        About the only thing I can think of is that for some reason instead of installing 1.6, she accidentally re-installed 1.4, where this was happening. Wouldn't be too hard, just being in the wrong folder when you run mono install.exe. The executable doesn't even say which version it is installing, and there's nothing that really says 'you are running SMAPI 1.6' anywhere.
                         
                        • aumolac

                          aumolac Void-Bound Voyager

                          Well, I have one little problem with SMAPI 1.6 on Stardew Valley 1.1. Sometimes, when I slay Dust Sprite in mines, SMAPI crashes due to unknown drop or something like that. On console it says non dictionary item or something like that (I'll post a screenshot soon). Where can I report a bug?
                           
                          • Pathoschild

                            Pathoschild Tiy's Beard

                            Hi @aumolac. You can report SMAPI bugs here, but this doesn't sound like an issue with SMAPI itself. That type of error is usually caused by XNB mods (the ones that tell you to replace *.xnb files) or broken game files; you can fix both by verifying the integrity of the game files in Steam, which will remove any XNB mods and fix any corrupt files. Can you try that and see if the error still happens?
                             
                            • Pathoschild

                              Pathoschild Tiy's Beard

                              SMAPI 1.7 is now available!

                              This release focuses on helping modders:
                              • Added a mod registry, which lets you get info about loaded mods or see if a particular mod is loaded.
                              • Fixed SaveEvents.BeforeSave and .AfterSave not firing on days the player shipped something.
                              • Fixed several world events being fired before a save is loaded (e.g. PlayerEvents.InventoryChanged).
                              • Fixed PlayerEvents.LoadedGame or SaveEvents.AfterLoad being fired before the world finishes initialising.
                              • Various other fixes and improvements listed in the release notes.
                              Feedback, suggestions, and bug reports are welcome here. :)
                               
                                foghorn likes this.
                              • nirasa1957

                                nirasa1957 Subatomic Cosmonaut

                                No, I haven't any custom launch commands. I run StardewModdingAPI.bin.x86_64 directly (if I want to play). Because via Steam game don't running (with SMAPI).
                                 
                                • nirasa1957

                                  nirasa1957 Subatomic Cosmonaut

                                  OK
                                   
                                  • Reduku

                                    Reduku Void-Bound Voyager

                                    Bug report, I think.
                                    Even with no mods running, I cant use my ps4 controller(thru steam) with SMAPI. The controllers control of the mouse is stuck interfacing with the SMAPI console rather than the game window. In the game Window I can rebind most keys to the controller, however I cannot use the mouse via the controller as their isn't a way to rebind that in the game window.
                                     
                                    • Entoarox

                                      Entoarox Oxygen Tank

                                      Controller support in stardew for windows is *heavily* limited, do not expect any controller except ones based on the xbox design to work, as xna just does not like other controllers and CA never got around to making it obey.
                                       
                                      • Pathoschild

                                        Pathoschild Tiy's Beard

                                        @Reduku That's a known issue, but you're the first person to notice that input goes to the SMAPI console. I created an issue for it, but I can't look into it myself since I don't have the Steam version. SMAPI is open-source and contributions are welcome if someone would like to look into it. :)

                                        @Entoarox Steam adds support for other controllers like the PS4 controller, but using SMAPI seems to break that. Natively-supported controllers (like the XBox controller) don't seem to be affected.
                                         
                                        Thread Status:
                                        Not open for further replies.

                                        Share This Page