Trying to separate out suits into their jacket/pants components. Need help

This has bugged me since the days of Whales - a “suit” is not an article of clothing, and from the description, I have no idea which articles of clothing comprise a “suit”. “Is a dress shirt and tie included?” “Is it a two-piece suit and thus wearable with a waistcoat?” “Why can’t someone just wear suit pants and a dress shirt?”

Instead of whining about this to other people, I eventually decided to take it into my own hands. I’ve separated out suits (and tuxedos for the heck of it) into fancy suit jackets and fancy suit pants, removing any doubt that a shirt is included (it isn’t, and I’ve added dress shirts to professions that had had suits and tuxes) and added a new tier of cheap suit jackets and pants as well. (There is no balance issue with Stylish; only the jackets get the Fancy and Super Fancy tags, so a full outfit will be the same bonus.) The unfinished commits are here.

I still have a few problems, the biggest of which is save compatibility. Though these commits remove and replace “suit” and “tux” from professions.json and item_groups.json, they don’t remove them from armor.json, so anyone with a suit or tux from an old save should keep it. However, that’s a lazy half-step, and ideally I need to replace the combined outfits with their separated halves in old saves. I don’t know how to code in C++, and the three ‘savegame’ files in /src are bewildering. KA101 helpfully pointed me to some examples, but I’m afraid I need a bit more direct instruction in how to do this. Specifically, I need to replace “suit” with “suit_jacket_fancy” and “suit_pants_fancy”, and “tux” with “tux_jacket” and “tux_pants”, in old save games.

Also, there are issues with translations and graphics, only the latter of which I’ve even tried to address in the commits above.

A simple way would be to add disassembly recipes to the original armors to separate them into their respective clothes.

Wouldn’t work. Too much of a hack. Need the suit and tux to automatically transform into both a jacket and pants.

This close to a stable release, yeah, having every suit-wearer (who is likely somewhat Stylish) porting their saves forward required to do the Hokey Pokey and turn their clothes around just isn’t what it’s all about. Sorry, Mdnthrvst & Blaze.

I like the idea, would it land post 0.B?

Doing this is a bit complicated as you have to add more items to the container instead of just changing the item data.

Some places where items are loaded from the saves:

In the inventory of player / npc / monster
Look at [tt]monster::load[/tt], after it has loaded the member [tt]inv[/tt] -> check each entry of [tt]inv[/tt] and transform it.
Look at [tt]inventory::json_load_items[/tt], check the loaded item before it’s added and transform it.
Worn or wielded by player / npc
Look at [tt]player::load[/tt], after it has loaded the members [tt]worn[/tt] and [tt]weapon[/tt] -> check each entry of [tt]worn[/tt] and check [tt]weapon[/tt] and transform it.
On the map
Look in mapbuffer.cpp, look for [tt]if(submap_member_name == “items”)[/tt] (the items are loaded right after this) -> check and transform the item before it’s pushed onto [tt]sm->itm[i][j][/tt].
In cargo parts of vehicles
Look at [tt]vehicle_part::deserialize[/tt] after it has loaded the member [tt]items[/tt] -> check each entry of [tt]items[/tt] and transform it.

Finally do the same in the legacy loading functions. Happy coding (-:

I might have forgotten some place, so the best is probably to keep the definition of the old item around.