-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gun variants, allowing to specify multiple guns with the same sta…
…t block (#46814) * Add gun variant support This allows genericizing our massive variety of very similar guns into one statblock, without removing the flavor. If a gun or magazine is specified to spawn without a variant, it will pick from the variants available to it, based on their assigned weight. Gun variants can specify an alternate name, description and ascii art for a gun, and variants can be toggled through an option. Add support for migrations to express variants. Add explicit extraction for magazines to handle variants. ASCII art for a variant will fall back to that of the base gun automatically if not specified or invalid. Maybe the naming could better express these are for both guns and magazines, but I think it is fine as is. item::gun_variant makes the assumption you check it has a variant first, so make sure to do that. Move the ammo at the end of gun names option to be next to the gun variant option. item::is_magazine doesn't tell us if type->magazine is safe to use, so !!type->magazine must be used instead of that before accessing type->magazine. * Add hacks to Archive::io to load/save gun variants I couldn't figure out how to specify the lambdas correctly, so I give up, this works. Problem is as follows: In item, I have ``` const gun_variant_data *_gun_variant; ... struct gun_variant_data { std::string id; // other info that doesn't matter } ``` I want to save this as `_gun_variant->id;`, and on load, load the string that was saved and call `item::set_gun_variant(loaded_string);`. This, and many variations of it don't work. ``` // In item:: scope const auto load = [this](const std::string &variant) { set_gun_variant( variant ); }; const auto save = [](const gun_variant_data *gv) { return gv->id; }; ``` Someone who know what's they're doing here may want to fix my laziness. * Add spawning support for gun variants Allow specifying variatns in item groups, mapgen (Item_group::add_item_entry), and in vehicles. * Add documentation for gun variants * Genericize NATO assault rifles Information lost: acr - 250ml barrel volume, folding stock m38dmr - 125 dispersion Move everything using an old rifle into the new generic rifles. The m38dmr is debatable, but I figure it's fine to be generic. Only m4a1s will spawn from unspecified variants at the moment, someone else can figure out what the proper chances should be. * Genericize other 5.56 assault rifles These ones are unique enough to not be simple variants of the NATO assault rifle, but they also don't need a full enumeration of stats. Move the brand-specific information to be a variant, genericize name and descriptions, and make all non-unique stats identical to those of the NATO assault rifle. I'm not sure of a good name for the sig generic version, but I want it to be distinct from the AUTO only or BURST only NATO rifles. * Genericize .45 ACP firearms There may be some consideration needed on collapsing the stat blocks for the pistols/smgs into a single one with copy-from, but this is simply the highest level genericization changes.
- Loading branch information
1 parent
693feb2
commit 9b6e68c
Showing
50 changed files
with
781 additions
and
538 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.