RELEASED Crop Transplant Mod[v1.0.1]

Discussion in 'Mods' started by Digus, Jul 21, 2018.

  1. Digus

    Digus Spaceman Spiff

    Crop Transplant Mod
    Download link on nexus:
    https://www.nexusmods.com/stardewvalley/mods/2594

    Current version: 1.0.1
    • Adds a way to transplant your crops.
    • Adds a letter from Evelyn to explain about it.
    • Adds a config option to receive the pot earlier.
    • Fix to compatibility issue with Stack Everything.
    • Fix to bugs when you held more than one pot.
    • Adds a config option to the energy cost of lifting crops.
    Objective:
    To provide ways to change your crops location.

    Disclaimer:
    This mod only work with Stardew Valley 1.3.X

    Compatibility:
    This mod might conflict with other mods using harmony. No problems reported so far.

    Installation:
    How does it work:
    • You will receive a letter from Evelyn explaining the basic rules of crop transplant.
    • The letter is just for flavor though, once you install the mod it should already be working.
    • To transplant a crop, hold a garden pot and get close to it. Click with the mouse cursor over the crop and it will be placed inside the pot.
    • Fertilizer go with the crop. That also means you can't change the fertilizer using transplanting.
    • You can place the pot anywhere you normally would. But if you click on a empty hoed tile, the crop will be transplanted there.
    • You can also lift a pot directly from the ground, but you need to select an empty toolbar spot. The hand icon will show over the pot indicating you can lift it.
    • Lifting any crop from the ground will spent 4 energy points. This number decrees as you level up the farming skill.
    • If you are holding a crop in the pot and change the active item in the tool bar, the crop will be destroyed.

    Config options:
    Run the game at least one with the mod installed to create the config.json file. You can edit this file to change the configuration.
    • "GetGradenPotEarlier": (false|true) If true, Evelyn will send you a Garden Pot once you reach 2 hearts level of friendship with her. You will not learn the recipe though, for that you should get the greenhouse as normal.
    • "TransplantEnergyCost": (4.0|any_number) The cost of energy for lifting a crop from the ground. The energy cost decrease as you level up at a 1/20 rate of the base cost. So 10 level farm will cost 50% less energy than the base cost.
    Internationalization:
    This mod is compatible with SMAPI support to i18n files. It has an official translation for pt-BR, but you can translating for your language following this instructions: https://stardewvalleywiki.com/Modding:SMAPI_APIs#Translation

    Uninstall:
    • Delete the mod from the installation folder.
    Special Thanks:
    • Everyone on the modding discord channel that are always super helpful

    [​IMG]

    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]


    Source:
    https://github.com/Digus/StardewValleyMods/tree/master/CropTransplantMod
     
      Last edited: Aug 4, 2018
    • Zosa

      Zosa Cosmic Narwhal

      woah~! would this also encompass saplings/trees?
       
      • Digus

        Digus Spaceman Spiff

        Zosa likes this.
      • Zosa

        Zosa Cosmic Narwhal

        that mod isn't very useful to me but thankyou for linking it and for letting me know about your mod as well<3 maybe someone will make something like your crop transplanters for trees that won't have to be removed to play the game
         
        • Digus

          Digus Spaceman Spiff

          The Gardening Pot has a hoeDirt object that is where I save the crop data for transplanting. So it does not apply to trees.
          And since there is already a mod to transplant trees, I never fought of doing it for them. It also would look really weird to hold a full grown tree over your head. hehehe.
          But I didn't undestand you problem with the tree transplant mod. Have to be removed to play the game?
           
          • Zosa

            Zosa Cosmic Narwhal

            there is a bug that screws up your ability to do community stuff while the mod is in the game so you have to put it in, use it and take it out every time you want to transplant trees unless you wait until all of the community stuff is completed before using it


            (for sure though holding a tree over your head would be just brilliant xD )
             
            • Digus

              Digus Spaceman Spiff

              That sucks, I hope the modder fix it at some point.

              Putting it that way, lol
              You made me remember when AVGN made that episode about bible games, in one of the games, Noah would lift a cow over this head to take it to the ark. Pretty impressive.
               
                Last edited: Jul 23, 2018
              • Zosa

                Zosa Cosmic Narwhal

                to be fair cows were smaller even just a hundred years ago :rofl:
                 
                • Digus

                  Digus Spaceman Spiff

                  [​IMG]
                  Come one, that is impressive.
                   
                  • Zosa

                    Zosa Cosmic Narwhal

                    ok, yeah :rofl: that is a whole nursery-rhyme's worth of livestock there
                     
                    • Moragaine

                      Moragaine Existential Complex

                      This looks really interesting. For that one tile you missed with fertilizer.. or you decide to put in different size sprinklers in the middle of a season.. or get your first(good) sprinkler in the middle of a season..
                       
                      • Digus

                        Digus Spaceman Spiff

                        I'm transplanting fertilizers also, since it make sense that you are translating the whole soil. So the way it is implemented now it would not work. But it make sense. I can change it to "no fertilize" never overwrite a soil with fertilize.
                        But that is the idea, to help with mistakes, changes of mind and efficient use of space.

                        I'm also thinking about flowers, you could grow them all packed with sprinklers and create a garden with them some other place, with a better disposition.
                        But I still have to make you be able to get fully grown crops, otherwise you will harvest them.
                         
                        • Moragaine

                          Moragaine Existential Complex

                          Yes, lol! But being able to move flowers after they've blossumed would be awesome!
                           
                          • Digus

                            Digus Spaceman Spiff

                            Status:
                            Successfully added sound and shake animation for the crop when getting it and walking with it.
                            I tried to add an grab animation but it proved to be more difficult to make the farmer lift the pot with the crop drawn inside, so this idea is scraped for now.
                            I can also grab fully grown crops and flowers.
                            You can also drop the pot on the grown with the crop inside. But there is no way to grab it again. You have to use the pickaxes and that destroy the crop. Maybe I will remove this behavior if I don't think of some action to grab it again. I don't want people to accidentally drop their pots on the wrong place and need to destroy their crops. But I also don't know how to make the player lift the pot again. I can try to make you get crops from other pots like you do in the ground. So you could use another pot to "rescue" your crop.
                            Another thing I want to do is change the cursor to show the transplant behavior. Now they would the same cursor it would for placing the pot on the ground.
                             
                              HopeWasHere likes this.
                            • Digus

                              Digus Spaceman Spiff

                              Status:
                              Finished everything I wanted to implement or came up as I coded.
                              For now we have:
                              * You can get any crop from the ground, from seeds to ready to harvest.
                              * You can place them back on hoed soil. (but not other pots)
                              * Fertilizers go with the crop. ( You can't change the original fertilizer or add it changing tiles. I don't know if I will do that because you could run with fast grow and change to quality fertilizer when ready to harvest, I think it would be cheap)
                              * Crops shake and make sound when being changed and when walking with them.
                              * Tiles are properly shown in green when you can interact with them, red when you can't.
                              * If you change the pot to another item while holding a crop it will be destroyed and an animation show that it happened. Be careful.
                              * You can place the pot on the ground and get it back up, though.
                              * You need to use an empty tool bar slot to get it back. It shows a hand cursor when hovering over a placed pot, to indicate you can grab it.
                              * Had to do some code magic so it all could save properly. I had to use a custom item to hold the crop, so I have to make sure it is not there when saving.
                              * Lifting a crop cost energy (4 points, decrees with farm level.). Both from the ground or lifting a pot that has something planted on it.
                              * You can change locations carrying the pot, so you can technically place fully grown crops outside the farm, don't know if they will die though.
                              I think that is all.

                              Still have to:
                              * Write the letter from Evelyn, say she forgot to tell you can transplant crops using the pot.
                              * Write another version where she sends you one pot earlier, but she won't teach you the recipe. This will be a config option. This is just so you can transplant crops from the begin, without have to wait to complete the greenhouse, if you want.
                              * Make crops that are still seed not shake. (remembered that now)
                              * Organize the whole code. It is a mess now. It was lots of try and error with this one.
                              * Prepare images and animated gif for the release of the mod.
                               
                                HopeWasHere likes this.
                              • Digus

                                Digus Spaceman Spiff

                                Status:
                                Wanted to release the mod today, but there was not enough time.
                                The seeds shaking was not a bug on my part. I had already coded them not to shake. The problem was that there is 2 images for seeds for each crop, and the way the game decides which one to use is based on their tile position when draw.
                                You can guess what happened. When walking with the seeds in the pot, the seed kept flicking between the two images.
                                Luckily it was not that hard to fix. But now the seeds has to keep its original ground sprite when holden on the pot, but when you put it down again, it might change to reflect it's new position sprite. It's an minor weird behavior that can't be fixed.

                                I wrote the letters from Evelyn, both versions.
                                The normal will be to receive the letter once you know the Garden Pot recipe. Usually the day after the event or as soon as you install the mod, if you already saw that.
                                But if you change the config, you will receive one sample of the Garden Pot through the mail, but not the recipe, once you reach 2 hearts with Evelyn. She will only tell you about how you can transplant crops with it.

                                I also created the mod logo for the main image. But that was it.
                                I still have to organize my code and take some prints and make some gifts.
                                I will also translate the letter to pt-BR, but that shouldn't take any time.

                                I should probably have done more test, or gotten someone to beta test the mod. I have a feeling that there will be some surprise bugs. I patched a lot of stuff, and there are still part of the game code that I simply can't predict.
                                I wanted to release it before version 1.3 come out of beta, but that won't be possible anymore.
                                 
                                  HopeWasHere likes this.
                                • Digus

                                  Digus Spaceman Spiff

                                  Last edited: Aug 1, 2018
                                  Allayna likes this.
                                • Digus

                                  Digus Spaceman Spiff

                                  Released a new version last night fixing compatibility issues with Stack Everything.
                                  Now the mod will work fine with it, but you have to use a single Pot at a time to get the crops, the mod won't let you get crops if you are holding a stack of pots.
                                  Also fixed some weird behavior in case you have more than one pot in the inventory.
                                  Also added a config option to change the energy cost of lifting crops. the default is still 4, but you can set to 0 or any number.
                                  Farming skill decreases the cost in 5% per level. So at level 10 the cost is 50% of the base value.

                                  I still have to organize the first post here. Add all the images and put the source link.
                                   
                                    Last edited: Aug 2, 2018
                                    Allayna likes this.
                                  • Digus

                                    Digus Spaceman Spiff

                                    Status:
                                    I have been working on the tree transplant add-on every chance I got, but it was a busy weekend.
                                    Tree transplant it already working. It is animated, for all tree stages, with sound and correct tool tips.
                                    Since trees are not stored the same way as crops, now I have to check both places to see if there is something in the pot. This caused some bugs with the pot and I'm trying to test everything.
                                    I still have to implement things for fruit tree, as they are different internally.
                                    You can't place the pot in the ground when you have a tree in it. And it will be destroyed the same way as crops if you change items. I thought of making it drop wood and stuff but I won't do it. It would make chopping trees down much fast and that is not the point of this implementation.
                                    As of now, I'm not checking for valid spots, so you can place the tree on places you normally wouldn't, but I will try to fix that.
                                    I will place lots of config options also, so if you want, you'll be able to place trees where you normally wouldn't.
                                    There is a lot of details to this implementation, it's much more complex than crops, but development is going well.

                                    Just remember. Holding fully grown tree will not be a default option, but it's looking really cool. :) Specially when it shakes when you move and leaves fall.
                                    There is a weird behavior that I won't be able to fix though. Leaves fall until the bottom of the tree sprite. But when lifted , it drops until the bottom of the character feet. The problem is that when your are moving vertically, the character feet change position, and the is no way to specify a position for the leaf to fall when it is created, it only check the current position of the character. So if you run south, leaf will follow you until you stop at the bottom of the screen, even the one that started to drop on the northest part. When running north you will barely see the leaves since you will be catching them really soon.
                                    [​IMG]
                                    There is also some bugs when you touch the top of the screen, the base of the tree is draw over the top part, I don't know if I can fix it, it seems to be a problem with the engine, as it happens with other items also. (try to hold a item and run behind the house, the item is drawn over the roof)
                                     
                                      Last edited: Aug 13, 2018
                                      Xuomi and HopeWasHere like this.
                                    • Digus

                                      Digus Spaceman Spiff

                                      Status:
                                      This is taking longer than I wanted.
                                      I'm not having long periods of free times to work in the feature. Also, there have being some problems with my other mods that I need to support people with.
                                      But the worst problem is that these validations are quite boring to code. Fruit Trees and regular trees have different validations for placement, although the result is almost the same. The original code is not easy to read. So I spent some time understanding some stuff but have to stop, then when I get back I have to remember everything again. I'm also trying to code without much redundancy, and in a way people can disable some stuff.

                                      I also discovered tonight that regular trees have a "secret stage". Although the wiki say trees have 5 stages, regular tree have 6, the forth stage repeat itself. Internally, fruit tree growthStage go from 0 to 4. Zero being the sapling and 4 being the full grown tree. regular trees go from 0 to 5, zero being the seed and 5 the full grown tree. But there are only 5 images for all stages. So stage 3 and 4 use the same image. That caused a bug with the implementation of different energy cost per stage. It will also be annoying for people to understand when they want to change the config. Even when I explain on the mod description some people don't read it.

                                      I also implemented that if a regular tree(also fruit tree) is planted over stone, it put the same soil tile under it as when a fruit tree is planted in the greenhouse tiles. It' just some flavor for when the tree is not grown, as the trunk covers the whole soil afterward. I will also extend that to wood soil.
                                       
                                        HopeWasHere likes this.

                                      Share This Page