RELEASED Farm Expansion 3.2 (Rewritten from the ground up)

Discussion in 'Mods' started by Advize, Mar 19, 2016.

  1. Advize

    Advize Scruffy Nerf-Herder

    Advize's Farm Expansion
    Description:
    This mod adds an additional location that functions as a farm expansion. The farm expansion functions just like your farm, with the ability to support crops, animals, buildings, and machines (with some exceptions). The farm expansion can be accessed from the west end of your farm, an entrance will be dynamically patched in depending on which farm type you chose when you started your game. For those with heavily modified farm maps, a config option allows for an alternate entrance to be added to the "backwoods" location just north of the farm. This mod does not modify any vanilla game files or save files, so it should be compatible with virtually all other mods (and can be safely disabled/re-enabled at any time).

    Note: 3.0 does not yet support all buildings. So far, wells, mills, sheds, coops (all sizes), and barns (all sizes) can be built.


    New in 3.0:
    • Mod has been rewritten from the ground up for SDV 1.2.33 and SMAPI 1.15+
    • Adds support for Linux/Mac
    • No longer depends on the Serializer Replacement Utility.
    • Farm Expansion data is saved in the mod folder, not your save files.
    (You can safely uninstall without worrying that your save file will be corrupted).

    Requirements:
    StardewValley 1.2.33

    Stardew Modding API (SMAPI) 2.1+: download here


    Installation:
    1. Download mod and extract contents into your SMAPI mods folder.

    Directory structure should look as follows:
    Stardew Valley\Mods\FarmExpansion\
    --> FarmExpansion.dll
    --> FarmExpansion.pdb
    --> Manifest.json
    --> \assets\FarmExpansion.tbin
    --> \assets\TreeTransplantFarmIcon.png
    --> \assets\WorldMap.png​

    Uninstalling:
    1. Remove the FarmExpansion folder from your mods directory.

    Note: If you want to save your progress on the expansion for a future re-install, make a backup of Mods\FarmExpansion\pslocationdata

    Download:

    Version 3.2: Download Link

    Source Code:
    Source


    Future Plans:
    Hoping to add support for more buildings. The only reason it doesn't support the rest currently is because I haven't had time to test them.

    Version History:
    v1.0: Initial Release.
    v1.01: Corrected tons of mismatched tile issues on the Farm Extension.
    v1.02: Storm version fixed to no longer recreate warp points in a location thanks to Seberoth on the modding irc channel.
    v1.1: Major release. A path has been added to the south western side of your farm. Rain now waters crops. Trees/Grass grow properly. Tilled soil without crops disappears over time. Debris generation corrected. Storm API support dropped.
    v1.2: You can now plant trees on the farm extension. Updated to use SMAPI 0.39.2.
    v1.3: Warp points adjusted slightly so you can enter the farm extension with your horse again (oops). Massive rewrite on the dynamic tile modifying code to further increase compatibility with other mods.
    v2.0: The farm expansion finally supports buildings and animals! Robin and Marnie's menus now allow you to choose which farm to construct/demolish buildings or add animals to. Graphical improvements have been made to the default animal shop menu as CA really dropped the ball on this one. Robin now constructs all buildings in a single day, allows you to construct as many as you'd like in a single day, and also will continue to sell you goods provided she isn't currently upgrading your house. Upgrading the Farm House still takes 3 days. Config file added which allows for enabling/disabling crows on the expansion, and also allows you to modify the expansion slightly to add a cottage on the north eastern hill (cottage interior will be added at a later date).
    v2.01: Resource clumps (giant rocks and stumps on the farm) are now correctly loaded from the save file.
    v2.05: Now compatible with Tego's Stardew Expansion. Machines placed inside buildings on the expansion now correctly process materials. Grass/weeds/rocks/logs correctly generate on the expansion. Other miscellaneous code improvements.
    v3.0: Rewritten from the ground up for SDV 1.2.33 and SMAPI 1.15+. No longer has other dependencies. No longer touches save files.Supports all 5 farm types.
    v3.0.1: Improves compatibility with other mods that add farm blueprints
    v3.0.2: Robin no longer overstays her welcome after upgrading an existing building.
    v3.0.3: Bug fixes. Fixes infinite loop upon naming hatched pets, and bee hives now produce the correct honey type.
    v3.0.4: Artifact spots on the expansion now correctly drop items.
    v3.1: Adds farm expansion location to world map. Improves compatibility with other mods.
    v3.2: Adds new config option for patching alternate entrance to the expansion from the backwoods. Adds full support for the TreeTransplant mod. Unpacks assets for easy editing.
     
      Last edited: Dec 7, 2017
    • Pinkishu

      Pinkishu Subatomic Cosmonaut

      You can tell tIDE to make all layers visible btw ;3 Makes for nicer pictures haha
       
        ThatNorthernMonkey likes this.
      • ThatNorthernMonkey

        ThatNorthernMonkey Aquatic Astronaut

        Good stuff! Want to buy more iridium sprinklers...
         
        • Superior_s

          Superior_s Sandwich Man

          Does this function like KingJoey's farm expansion in that you are able to go to Robin and build barns and such on the expansion?
           
          • Advize

            Advize Scruffy Nerf-Herder

            Sadly, it doesn't (yet) as it is an entirely separate map. I have a lot of things left to do before investigating the feasibility of this.
             
            • Superior_s

              Superior_s Sandwich Man

              Thanks for clearing that up. Also suggestion/nitpick maybe you should make an extra map that is a cave, doesn't have to be a large cave just one that bridges the areas. Also if that is done I'd move the entrance to the expansion farther to the right and make it a cave entrance. Sorry for the long reply.
               
              • Advize

                Advize Scruffy Nerf-Herder

                No need to apologize, suggestions are welcome. I wanted to avoid making any modifications to the game files to avoid conflicts with other mods, this meant not adding a cave entrance (which I wanted to do) to the map. I'll improve this mod over time as modding capabilities increase.
                 
                • Superior_s

                  Superior_s Sandwich Man

                  I was suggesting the cave entrance or opening to be on the expansion map. Is the expansions map already in game?
                   
                  • Advize

                    Advize Scruffy Nerf-Herder

                    Oh, I thought you meant on the normal Farm map side of things. No, I can definitely add a cave bridging the 2 and add a cave entrance to the top of the expansion. This wouldn't conflict with any other mods.

                    On a side note, my code allows other modders to add custom locations without there being any problems (unless they code theirs poorly). I'm probably going to release a tutorial on adding new locations soon, and explain how to avoid causing conflicts with other mods.
                     
                      Superior_s likes this.
                    • Superior_s

                      Superior_s Sandwich Man

                      Alright I wasn't sure if I was confused with what was going or you misunderstood. lol That's cool that you will add the cave and change the layout. As is it would've bugged me to no end entering were you do and exiting were you do.

                      Looking forward to your tutorial. And thanks for contributions to the community.
                       
                      • keyten

                        keyten Scruffy Nerf-Herder

                        Really nice work!
                        Are objects like trees saved in this farm map? Does the game really loads them?
                         
                        • Advize

                          Advize Scruffy Nerf-Herder

                          As best as I can tell, yes. Would test further but currently working on porting it to SMAPI.
                           
                            Superior_s and keyten like this.
                          • cantorsdust

                            cantorsdust Subatomic Cosmonaut

                            Extremely impressive! I'm really looking forward to seeing what people can do once adding locations is straightforward in APIs. And thank you so much for sharing your source--you've pointed the way for others.
                             
                              keyten likes this.
                            • keyten

                              keyten Scruffy Nerf-Herder

                              I was thinking the same thing about custom Npcs when I made mode with them. But I haven't seen anyone who made them yet.
                               
                              • Advize

                                Advize Scruffy Nerf-Herder

                                Honestly keyten, I've been digging around through the code for hours on end, and I promise you that adding new NPCs is probably just around the corner. I can already load new NPC sprites and place them into a location. The hardest part would be sorting out all of their dialogue and events and such, much of which is already being tackled by other modders.
                                 
                                  viovasvi likes this.
                                • keyten

                                  keyten Scruffy Nerf-Herder

                                  What do you mean around the corner? Just edit your save file to add them. Like I did in http://community.playstarbound.com/threads/custom-lemons-characters-as-npcs-no-api-required.110385/
                                  The game loads custom Npcs from Xnb files perfectly.
                                  You don't even need any Api. Custom dialogues, portraits and sprites also work. Why use Api when the game already does all the work?
                                   
                                  • Advize

                                    Advize Scruffy Nerf-Herder

                                  • keyten

                                    keyten Scruffy Nerf-Herder

                                    Oh, sorry then.
                                    May I ask why
                                    Code:
                                    warps = (workingMap.Cast<GameLocationAccessor>()._GetWarps()).Cast<Warp>().ToList();
                                    doesn't work?
                                     
                                    • Advize

                                      Advize Scruffy Nerf-Herder

                                      It compiled just fine, but it failed at runtime. I was trying to cast one object type to another one from another namespace, it just doesn't work. Seberoth reached out to me with a solution, however.

                                      Code:
                                      workingMap.Cast<GameLocationAccessor>()._GetWarps().Insert(0, CreateWarp(4, 22, "FarmExtension", 41, 0, false));
                                      You can do this as many times as necessary. I'll be implementing this in the next Storm build sometime soon.

                                      Edit: Just looked at seberoth's code again and there's far more to it than that. The code has been cleaned up immensely overall. I'll get a working build up tomorrow with updated source code.
                                       
                                        Last edited: Mar 20, 2016
                                        keyten likes this.
                                      • Preacher

                                        Preacher Subatomic Cosmonaut

                                        Good thread, I hope there will be more in the future.

                                        Off-Topic question: Is there any ingame way or at least in the future a modded way to automatically seed fields or anything close to that?
                                        Sometimes I feel kinda f*cked doing all that shit by myself.. by hand.
                                         

                                        Share This Page