-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add gun variants, allowing to specify multiple guns with the same stat block #46814
Conversation
173a5df
to
3cb672f
Compare
[ "sig552", -1 ], | ||
[ "surv_carbine_223", -1 ] | ||
], | ||
[ [ "nato_assault_rifle", -1 ], [ "ar15", -1 ], [ "m249", -1 ], [ "m16a4", -1 ], [ "surv_carbine_223", -1 ] ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m16a4
should be converted to nato_assault_rifle
too, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not have auto, it has burst. I converted the m16a3 to it because it has the same fire modes, but the m16a4 does not.
While it's not very different now, hopefully in the future it will matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could some of the other differences be accounted for as gunmods (e.g., a folding stock)? (Admittedly, they're likely not to be quite the same statistically - not coming built-in from the manufacturer.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears gunmods can change firing modes, so that is a route that we could go down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've elected to just copy-from all non-differentiating information from the nato_assault_rifle
, see the latest commit.
3cb672f
to
9c00bec
Compare
Whats the difference between this change, and just using more copy-from for theese guns? |
I can add a 'generic gun names' option, and it explicitly indicates that minor differences in stat blocks do not matter (because they cannot be specified). |
a93b14c
to
ce4fe96
Compare
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.
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.
Allow specifying variatns in item groups, mapgen (Item_group::add_item_entry), and in vehicles.
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.
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.
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.
ce4fe96
to
47c67bf
Compare
"name": { "str": "Vector SMG 30-round magazine" }, | ||
"description": "A 30-round polymer and steel box magazine for use with the KRISS Vector.", | ||
"name": { "str": "Glock SMG 30-round magazine" }, | ||
"description": "A 30-round polymer and steel box magazine for use with the Glock submachine gun.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glock doesn't make submachine guns(18C is a machine pistol), KRISS is a different company whose Vector can use their magazines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Vector is an SMG taking Glock magazines (and it's own special one). I think it's more clear to call it a Glock SMG and call it's magazine a Glock SMG magazine, than to be accurate.
That is, unless there is some sort of change that could come in the future that will change it from accepting only it's own magazines (that go into no other guns), and Glock magazines, or Glock decides to release an SMG of its own that does not accept Vector magazines.
Do you think it would be possible or desirable to make variants specify integral/included gun mods? For example: To my uderstanding H&k416 is basically an m4 with an improved piston that makes it more reliable. And this could be simulated by having the spawned gun always come with a reliability gun mod. |
…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.
…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.
…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.
…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.
…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.
…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.
…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.
…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.
…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.
…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.
…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.
…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.
Coming to this pretty late, but is there any way of referencing a specific variant by ID, be it in crafting or migration? |
In migration, yes, crafting, no.
They can also change ascii art, but nothing else at this time. I don't have intent to add more parameters, but that doesn't mean they can't be added.
Probably not. |
…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.
…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.
…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.
…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.
…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.
…t block (CleverRaven#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.
…t block (CleverRaven#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.
…t block (CleverRaven#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.
* Updated gun spawns in a mapgen variant to use gun variants in the DDA, since CleverRaven/Cataclysm-DDA#46814 changed item IDs. * Updated recipe for survivor's auxiliary .45 pistol in the DDA version, since now the M45 and Mk. 23 are variants instead of distinct guns. * Removed obsolete references to the `burst` property from both versions. They've been obsolete a while but only 0.F experimental DDA is reporting them as an error.
…same stat block (CleverRaven#46814)" This reverts commit 39b313a.
Summary
SUMMARY: Infrastructure "Add gun variants"
Purpose of change
To say we have a lot of guns is an understatement. In particular, we have a lot of very similar guns with fully defined, yet very similar, statblocks. Because the only information that distinguishes these variants is not important, we can ditch these full statblocks, and switch them these variants to be simply cosmetic. Additionally, add a simple toggle to distinguish between generic names and brand names, because the huge variety of guns in our game can be a little overwhelming - think of it as a generic guns-lite.
Describe the solution
Add a vector of potential gun variants to
islot_gun
. These variants consist of anstd::string
id, a name and description, an ascii art id, and an integer weight.If the generic gun names option is turned off, the description, art, and name of the gun will be replaced with those specified in the variant.
I couldn't quite figure out what I needed to do to satisfy the archive stuff, so I added more permissive overloads that do what I want.
Plumb specifying variants through all our item spawning.
All guns will randomly start out with a variant (if they can have one), selected based on the weight of the various variants.
The criteria I am using for not collapsing guns into a variant are:
I have done so for the NATO assault rifles as an example in this PR.
I don't know where to start with the weighting for the variants, so everything without a variant will be an m4a1, which I figure will be the most common.
See commits for more detail.
Describe alternatives you've considered
Making variants more generic. This may happen in the future, but I'd like to stay limited in scope at the moment.
Making different decisions in naming/description/which guns I collapsed into variants.
Testing
Before applying, spawn every .223 gun, and save the world.
After applying, see that when the generic gun names option is turned on, all NATO assault rifles stack and have a generic name. When turned off, they have variant names, and do not stack.
Go to military bases, spawn in helicopters, check out the soldiers map extra, etc to examine other spawning options and see that variants are spawned.
Use the debug menu (search for the generic name) to see that when spawned without an explicit variant, they assume one based on the weight of their variants.