StardewModders / mod-ideas

Submit ideas for mods to create, or find your next mod project!
92 stars 5 forks source link

choose unique farm cave per farm #1101

Open lazydaysies opened 1 year ago

lazydaysies commented 1 year ago

Hi! With all these unique farm cave mods, I would like to see if there is a way that we can choose a different farm cave per farm, instead of the current way that one farm cave mod affects all farms. Instead of disabling/enabling the current farm cave mod to another when switching through different saves, if there is a way we can have different ones to choose from in a menu style, like at the new farm save creation, that would be so much simpler.

(I know there is a way to have different mod folders, different SMAPI shortcuts, etc, but the less manual fiddling will make it so much easier.)

Thank you!

Warilized commented 9 months ago

Well, it can be done via Content Patcher. Just use 'FarmType' Token as dynamic token.

{
    "Format": "1.26",
    "ConfigSchema": {

    //Config

    ////Enable Mod
        "Enable Mod": {
            "AllowValues": "true, false",
            "Default": "true",
            "Description": "Enables the mod.",
            "Section": "Behavior",
        },

    ////Cave Style
        "Standard Farm Cave": {
            "AllowValues": "Default, Cave 1, Cave 2, Cave 3",
            "Default": "Default",
            "Description": "Standard Farm Cave Style.",
            "Section": "Style",
        },      
        "Forest Farm Cave": {
            "AllowValues": "Default, Cave 1, Cave 2, Cave 3",
            "Default": "Cave 1",
            "Description": "Forest Farm Cave Style",
            "Section": "Style",
        },
        "Hill-Top Farm Cave": {
            "AllowValues": "Default, Cave 1, Cave 2, Cave 3",
            "Default": "Cave 2",
            "Description": "Hill-Top Farm Cave Style",
            "Section": "Style",
        },
        ////etc...
    },
    "DynamicTokens": [
        {
            "Name": "Current Farm Cave", //The Logic is that this token will choose what cave to load depending on ConfigSchema.
            "Value": {{Standard Farm Cave}},
            "When": {
                "FarmType": "Standard"
            }
        },
        {
            "Name": "Current Farm Cave",
            "Value": {{Beach Farm Cave}},
            "When": {
                "FarmType": "Beach"
            }
        },
        {
            "Name": "Current Farm Cave",
            "Value": {{Four-Corners Farm Cave}},
            "When": {
                "FarmType": "FourCorners"
            }
        },
        {
            "Name": "Current Farm Cave",
            "Value": {{Forest Farm Cave}},
            "When": {
                "FarmType": "Forest"
            }
        },
        {
            "Name": "Current Farm Cave",
            "Value": {{Hill-Top Farm Cave}},
            "When": {
                "FarmType": "Hilltop"
            }
        },
        {
            "Name": "Current Farm Cave",
            "Value": {{Riverside Farm Cave}},
            "When": {
                "FarmType": "Riverland"
            }
        },
        {
            "Name": "Current Farm Cave",
            "Value": {{Wilderness Farm Cave}},
            "When": {
                "FarmType": "Wilderness"
            }
        },
        {
            "Name": "Default Farm Cave",
            "Value": "false",

        },
        {
            "Name": "Default Farm Cave", //This will be used as a load condition when a cave you choose is the default vanilla.
            "Value": "true",
            "When": {
                "Current Farm Cave": "Default"
            }
        },

    ],
    "Changes": [

        //Cave
        {
            "LogName": "Patch Cave on the Farm",
        "Action": "Load",
            "Target": "Maps/FarmCave", ///***This is the map name if I recall correctly, might be different.
            "FromFile": "assets/{{Current Farm Cave}}.tbin",
            "When": {
                "Enable Mod": true,
                "Default Farm Cave": false,
            }
        },
    ]
}

Though of course you needed the caves as the assets.

The code above just served as an example, I have not tested it yet, but it is based from my unreleased map mod (it's working properly by the way)