Mention about ID choices

–I’m using the wrong computer, and as such don’t have the game’s files to directly reference, but I definitely remember some (seemingly) pretty weird ID choices for various things in the game.
–For example: I don’t remember exactly what it was (other than weird), but from my point of view, aluminum can should be aluminum_can or can_aluminum. If you care to specifically mention it being opened or a container, do something like opened_aluminum_can. Same way for tin cans.
–I tend to make all my ID pretty obvious. All essences work like this: essence_noob, essence_bacon, essence_plutonium. Well, maybe there was an ‘of’ in the middle of each, but something simple like that. The ID for the floating brick is floating_brick. There is also tickle_monster.
–Sometimes it makes perfect sense, since the ID for brick is brick. Other times, I don’t really get it. I don’t expect this to ever change, since at this point it is fairly deeply ingrained and would take a lot of work for such a small thing. I don’t really find it annoying, but simple weird.
–I always tend to standardize IDs in a way, similar to how I do essences. They always have a pattern. Any and all dragons I make will be something like red_dragon, green_dragon, blue_dragon, or the other way around.

It’s really easy for one person to do things like this in a consistent way, you just do it the way that’s comfortable to you. Once you have multiple people involved, you have to put effort into describing what consistent means to you, and you have to expand effort insuring everyone follows the rules. This particular issue has never been important enough to expend that kind of effort on.

I agree with Kevin, beyond actual coding all this has little to no effect, and absolutely none for the average player. Making them all consistent would be pretty neat, but isn’t worth the effort. One thing I’d really like is a good way to check item id’s, perhaps a functionality that could be added to Chezzo’s item browser?

you can already do this via the Debug function menu by clicking “wish for an item”, then entering “/” and searching the ingame item name.

I’m aware of that, but it would be nice if i could check things without starting up the game.

I see. Outside of the game; I personally keep referring to data/json/item_groups.json

since it has a vast list of item ids. It is also pretty easy to guess what the item is via it’s id name.

–I noticed that Debug menu function while I was using it to test out my mod, and it is incredibly useful. Way better than searching through the files to find the IDs.
–In retrospect (I’m mention a thought I had even before I made this thread), it does actually make lots of sense for aluminum and tin cans to be in containers.json. After all, they are containers.
–The ID for the aluminum can is “can_drink”. Since Kevin has graced us with his prossence perhaps he could explain as to why exactly that is the ID. Of course, it may have been far too long ago to remember.

Because originally it was the only one, later the others were added, but since most of them would be aluminum, that one was unchanged, and migrating the I’d is more trouble than it’s worth.

1 Like

–Ah, yes, I get it now. I imagine there is probably lots of similar cases for IDs in the game. I wish there was some sort of convenient “turn all this into this” button to use on all the files, but the time it would take to alter the IDs for everything would be very unconventional for how little impact it would be. It is one of those things you wish could/would change but it doesn’t really matter much in the end.

We have one, but based on the way savegames work, you have to leave the transition data in place for a very long time.

I don’t understand what you are talking about. Transition data?

As you know, all items have ID codes. Those ID codes are what is saved in a save file, rather than the name of the item we see. If you change the ID code of an item then when the save file is loaded it looks for an item that doesn’t exist and anytime you go near where that item was it will throw an error. However, you can set up transition code that converts the item with the old ID code to the new ID code (apparently). That way it will convert all the items with the old ID to the new one, so you don’t throw errors with that save.

However, since the game only loads data near where you are, if you try to transition something common, like a drink can, you would have to walk near every single existing drink can in the game for them all to transition, otherwise it will still throw errors when you walk near one that hasn’t once the transition code has been removed.

All that said, could someone give a quick example of what that transition code would be?

1 Like

see data/json/items/migration.json (https://github.com/CleverRaven/Cataclysm-DDA/blob/master/data/json/items/migration.json) for all the item migrations, but they’re generally of the form
{
“id”: “arrowhead”,
“type”: “MIGRATION”,
“replace”: “steel_chunk”
},

the actual c++ code to migrate items looks like it is in item_factory.cpp in the load_migration and migrate_id functions.

Neato. Thanks for that.