Technical suggestion about entity tags (material_tags)


#1

Right now, we have this (code snippet from my archipelago mod) in our entities json:

   "entity_data": {
      "something...":"something...",
      "stonehearth:catalog": {
         "something...":"something...",
         "material_tags": "food raw_food fruit coconut vegetarian stockpile_raw_food"
      }
   }

The material_tags key value is a single string with all the tags you want and need in there.
This causes us modders a problem. To edit one tag, we need to overwrite the whole string.

For example, in the cook mod (and brewery mod), some items have their tags overwritten so it can adds the “drink_container” tag into it.
Changing the berries tags from:
"food_container raw_food fruit berry vegetarian stockpile_raw_food"
to:
“food_container raw_food fruit berry vegetarian stockpile_raw_food drink_container”

Nice, but now if another mod also tries to add a tag to that same item, say for example the tag “bad”, it will try to add this new tag in this manner:
“food_container raw_food fruit berry vegetarian stockpile_raw_food bad”

See? After his overwrite, the “drink_container” added by the cook mod is not there anymore. In the end, it is a case of priority, whoever changes it last gets the correct strings.

This was just an example case, I bet this is a huge problem for the better_stockpile_mod too, in that the modder is heavy dependent of these, changing the tags of some items would help organize it a lot, but cause incompatibilities with other mods tags changes.

Also, in these examples, we are talking about just adding extra tags, but what if we need to remove? (and then some other mod changing it ends up adding it back with his overwrite)

This requires a good amount of communication between modders, working together to be compatible with each other, which is not always possible or easy.


What I propose is to change the value from a string to an array of values. Example:

"material_tags" : [
    "food_container",
    "raw_food"
    "fruit",
    "berry"
    "vegetarian",
    "stockpile_raw_food"
]

With this new model, we can add new tags simple using a mixinto json with the new values. (Or remove/update with the “mixintype” key)
So, now 2 or more mods can now add tags to the same item without erasing the changes of the other, without even knowing that the other mod is also changing those.


Requests from modders to devs for 1.0 and 1.1
Requests from modders to devs for 1.0 and 1.1
Recipe with ingredient X OR ingredient Y
Stream tonight with Max & Angelo: QoL improvements and engineering questions
#2

@BrunoSupremo I like this idea. We cheated a little in the original implementation. We’ll add a task to investigate moving to the correct representation of material tags.


#3

bit of thread necro because i was searching for how tags worked -exactly- but: seeing as tags are still in the format of for instance
“material_tags”: “wood armor light_armor stockpile_equipment”

is changeing the tags still planned? (i ask because im working on a wall-mounted shield holder, as a decorative feature that would hold 1, visually shown model of a shield on its hook (think heavilly modified imput bin)
and normal shields dont have a “shield” tag so unless i overwrite all shields to also have a shield word, i could not get it to work for the defaul stuff without massive overwrites. which is…not really my style ;’)


#4

I’ve only seen this now but I support this suggestion.

I’ve recently ran into a couple of issues while trying to change some resources because of that and it would definitely be a positive change for modding :slight_smile: