Open randyk97 opened 4 days ago
You should use copy-from and delete the blacklisted variants from the variants array.
When I use copy-from, the copied item loses all its variants anyway, so you have to redefine all of them in the new item.
For example, in the guns.json for the Classic Zombies mod, a new item is created called "m1911a1", and since the variants array is empty in that new item despite being copied from "m1911", the "m1911" variant has to be redefined (a problem if the original m1911 variant gets changed).
When I use copy-from, the copied item loses all its variants anyway, so you have to redefine all of them in the new item.
You don't make a new item. The ID of your item should remain the same.
I did do it with the ID the same; it does not make a difference: the overwritten item will inherit all properties except the variants array which remains empty. You can overwrite any item in game that has variants like this and see that even if you do not add anything new to the overwritten code, that item will lose all its variants.
https://github.com/CleverRaven/Cataclysm-DDA/blob/daebd7d7ab2ab99a3c8edfe1d43e69cfd2dd3836/src/item_factory.cpp#L4238
Yeh variants explicitly aren't copy_frommed, the false
here would need to be was_loaded
Is your feature request related to a problem? Please describe.
Currently, putting an ID like: "knife_large_var_knife_chef", into an item blacklist results in an error, and since strings are expected, a format like: { "item": "knife_large", "variant": "knife_chef" } throws an error as well. With the increasingly larger amount of items being converted to variations, it makes sense that you should be able to blacklist them like before.
Solution you would like.
Ideally, the ID with the var extension should get recognized by the game, in a similar manner to how it is recognized by a graphics pack JSON, or at the least you should be able to use: { "item": "knife_large", "variant": "knife_chef" }, which is the same format used to select a specific variation for professions.
Describe alternatives you have considered.
No response
Additional context
No response