Skip to content

Commit

Permalink
Allow toggling brand names of drugs
Browse files Browse the repository at this point in the history
In PR 45308, the names of various pharmaceutical items were changed from
brand names to generic names describing their active ingredients.

In PR 46814, the names of various guns were changed from specific brand
names to generic versions, and many guns were collapsed into the generic
versions. However, variants were added, allowing a toggle to brind back
all those names.

We can follow that same approach for drugs, using variants to allow
toggling between the generic names and brand names.

To do this, simply add a new variant type, a new option, and then change
whether that type is shown based on the value of that option.
Then, add the variants for brand names.

I didn't add back the non-generic names for the antibiotics because
1. Only strong/weak antibiotics had them
2. They didn't seem to be real names
  • Loading branch information
ehughsbaird committed Jan 18, 2024
1 parent f2c8c58 commit c42f152
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 3 deletions.
47 changes: 46 additions & 1 deletion data/json/items/comestibles/med.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,20 @@
"symbol": "!",
"color": "light_red",
"container": "bottle_plastic_pill_prescription",
"variant_type": "drug",
"variants": [
{
"id": "adderall",
"name": { "str_sp": "Adderall" },
"description": "Medical-grade amphetamine salts mixed with dextroamphetamine salts, commonly prescribed to treat hyperactive attention deficits. It suppresses the appetite, and is quite addictive."
}
],
"stim": 24,
"fun": 10,
"addiction_potential": 10,
"addiction_type": "amphetamine",
"flags": [ "NPC_SAFE", "IRREPLACEABLE_CONSUMABLE", "WATER_DISSOLVE", "EDIBLE_FROZEN" ],
"use_action": { "type": "consume_drug", "activation_message": "You take some stimulants." }
"use_action": { "type": "consume_drug", "activation_message": "You take some %s." }
},
{
"id": "adrenaline_injector",
Expand Down Expand Up @@ -568,6 +576,14 @@
"symbol": "!",
"color": "white",
"container": "bottle_plastic_pill_prescription",
"variant_type": "drug",
"variants": [
{
"id": "diazepam",
"name": { "str_sp": "diazepam" },
"description": "A strong benzodiazepine drug used to treat muscle spasms, anxiety, seizures, and panic attacks."
}
],
"stim": -8,
"healthy": -1,
"fun": 8,
Expand Down Expand Up @@ -1079,6 +1095,15 @@
"symbol": "!",
"color": "light_red",
"container": "bottle_plastic_pill_prescription",
"variant_type": "drug",
"variants": [
{
"id": "ambien",
"name": { "str_sp": "Ambien" },
"append": true,
"description": "Its generic name is zolpidem tartarate."
}
],
"stim": -8,
"fun": 5,
"flags": [ "IRREPLACEABLE_CONSUMABLE", "WATER_DISSOLVE", "EDIBLE_FROZEN" ],
Expand Down Expand Up @@ -1193,6 +1218,8 @@
"symbol": "!",
"color": "light_green",
"container": "bottle_plastic_pill_prescription",
"variant_type": "drug",
"variants": [ { "id": "prozac", "name": { "str_sp": "Prozac" }, "append": true, "description": "Its generic name is fluoxetine." } ],
"stim": -5,
"flags": [ "IRREPLACEABLE_CONSUMABLE", "EDIBLE_FROZEN" ],
"addiction_potential": 5,
Expand Down Expand Up @@ -1270,6 +1297,15 @@
"symbol": "!",
"color": "light_red",
"container": "bottle_plastic_pill_prescription",
"variant_type": "drug",
"variants": [
{
"id": "thorazine",
"name": { "str_sp": "Thorazine" },
"append": true,
"description": "Its generic name is chlorpromazine."
}
],
"stim": -30,
"flags": [ "IRREPLACEABLE_CONSUMABLE", "WATER_DISSOLVE", "EDIBLE_FROZEN" ],
"use_action": [ "THORAZINE" ]
Expand Down Expand Up @@ -1545,6 +1581,15 @@
"symbol": "!",
"color": "cyan",
"container": "bottle_plastic_pill_prescription",
"variant_type": "drug",
"variants": [
{
"id": "xanax",
"name": { "str_sp": "Xanax" },
"append": true,
"description": "An anti-anxiety agent with a powerful sedative effect. May cause dissociation and loss of memory. It is dangerously addictive, and withdrawal from regular use should be gradual."
}
],
"stim": -4,
"healthy": -2,
"fun": 20,
Expand Down
2 changes: 2 additions & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9393,6 +9393,8 @@ bool item::has_itype_variant( bool check_option ) const
switch( type->variant_kind ) {
case itype_variant_kind::gun:
return get_option<bool>( "SHOW_GUN_VARIANTS" );
case itype_variant_kind::drug:
return get_option<bool>( "SHOW_DRUG_VARIANTS" );
default:
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/itype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ std::string enum_to_string<itype_variant_kind>( itype_variant_kind data )
return "gun";
case itype_variant_kind::generic:
return "generic";
case itype_variant_kind::drug:
return "drug";
case itype_variant_kind::last:
debugmsg( "Invalid variant type!" );
return "";
Expand Down
1 change: 1 addition & 0 deletions src/itype.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ struct islot_wheel {
enum class itype_variant_kind : int {
gun,
generic,
drug,
last
};

Expand Down
3 changes: 3 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,9 @@ void options_manager::add_options_interface()
add_option_group( "interface", Group( "naming_opts", to_translation( "Naming Options" ),
to_translation( "Options regarding the naming of items." ) ),
[&]( const std::string & page_id ) {
add( "SHOW_DRUG_VARIANTS", page_id, to_translation( "Show drug brand names" ),
to_translation( "If true, show brand names for drugs, instead of generic functional names - 'Adderall', instead of 'prescription stimulant'." ),
false );
add( "SHOW_GUN_VARIANTS", page_id, to_translation( "Show gun brand names" ),
to_translation( "If true, show brand names for guns, instead of generic functional names - 'm4a1' or 'h&k416a5' instead of 'NATO assault rifle'." ),
false );
Expand Down
7 changes: 5 additions & 2 deletions tools/spell_checker/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@ fluidly
flummox
flummoxing
flump
fluoxetine
flusteration
flyable
flyin
Expand Down Expand Up @@ -3053,6 +3054,7 @@ tangrams
tankbot
tannin
tarket
tartarate
tassed
tassin
tastemakers
Expand Down Expand Up @@ -3534,8 +3536,7 @@ zentai
zeriatric
zincite
zischt
zorc
zorcs
zolpidem
zombaby
zombear
zombeaver
Expand All @@ -3549,6 +3550,8 @@ zombull
zombullfrog
zoomorphic
zoonotic
zorc
zorcs
zowlbear
zowlbears
zpzzzzpzz
Expand Down

0 comments on commit c42f152

Please sign in to comment.