Remove things with mixintos

#1

Hi everyone, I just have a question about mixintos : is there a way to REMOVE data from a json ?

For my Better Stockpiles mod, I need to add, modify, and remove categories from stockpile_filters.json. For now, I use a brutal override to replace the entire file. But I understand overrides are not really recommended.

For example, I need to remove the categories “animal_part” and “plant” from the “resources” stockpile.

"stockpile": {
    "resources": {
        ...
        "categories": {
            "wood": {
                ...
            },
            "stone": {
                ...
            },
            "clay": {
                ...
            },
            "ore": {
                ...
            },
            "animal_part": {
                ...
            },
            "plant": {
                ...
            }
        }
    }
}

I can add categories or modify existing ones, but can’t find how to remove. Any ideas ?

1 Like
#2

I’m pretty sure you’re stuck with using an override. It’s not that overrides aren’t recommended, it would be better for you to use a mixinto if possible as you wouldn’t have to update it whenever a new item category is added. Sometimes though, overrides are necessary.

I wonder if there’s a hidden or visible variable that could be used in here. Worth a shot to see. I tried “invisible_to_player” similar to a buff but that didn’t work.

Also, have you tried this:

            "animal_part": {
               "ordinal": 9,
               "display_name": "",
               "icon": "",
               "filter": ""

This technically removes the animal_part but replaces it with a blank box that cannot be selected. The ordinal needs a numeric value otherwise Stonehearth throws an error.

Visually imperfect but gets the job done and might help doing away with an override. I use your mod and would call this an acceptable trade off for easier maintenance on your part.

2 Likes
#3

Thanks @Velerin for this method. The last version of Better Stockpile now use a mixinto for stockpile_filters.json. And yes the “removed” categories are still here, but empty.