Skip to content

Commit

Permalink
module holder flag and inventory enchantment checking fix
Browse files Browse the repository at this point in the history
  • Loading branch information
b0bhat committed Jun 4, 2024
1 parent e047475 commit 2491e5a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions data/json/enchantments.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"name": { "str": "Night Vision Goggles" },
"description": "You are wearing night vision goggles which allow you to see really well in the dark.",
"condition": "ACTIVE",
"has": "WORN",
"values": [ { "value": "NIGHT_VIS", "add": 4 } ]
},
{
Expand All @@ -57,6 +58,7 @@
"name": { "str": "Night Vision Goggles" },
"description": "You are wearing night vision goggles which allow you to see quite well in the dark.",
"condition": "ACTIVE",
"has": "WORN",
"values": [ { "value": "NIGHT_VIS", "add": 2 } ]
},
{
Expand All @@ -65,6 +67,7 @@
"name": { "str": "Night Vision Goggles" },
"description": "You are wearing night vision goggles which allow you to see in the dark.",
"condition": "ACTIVE",
"has": "WORN",
"values": [ { "value": "NIGHT_VIS", "add": -1 } ]
},
{
Expand All @@ -73,6 +76,7 @@
"name": { "str": "Night Vision Goggles" },
"description": "You are wearing night vision goggles which allow you to poorly see in the dark.",
"condition": "ACTIVE",
"has": "WORN",
"values": [ { "value": "NIGHT_VIS", "add": -4 } ]
},
{
Expand Down
5 changes: 5 additions & 0 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,11 @@
"id": "MISSION_ITEM",
"type": "json_flag"
},
{
"id": "MODULE_HOLDER",
"//": "Allows enchantment check to get modules in pockets of this item (modules are items which have an enchantment effect and the HAS:WORN flag.",
"type": "json_flag"
},
{
"id": "MOUNTED_GUN",
"info": "This weapon is <bad>too unwieldy</bad> to fire on its own and <info>must be mounted</info> on a vehicle or furniture (window, table, mound of dirt, etc.) before use.",
Expand Down
8 changes: 4 additions & 4 deletions data/json/items/armor/helmets.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"warmth": 20,
"material_thickness": 9,
"techniques": [ "WBLOCK_1" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "PADDED" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "PADDED", "MODULE_HOLDER" ],
"armor": [
{
"encumbrance_modifiers": [ "NONE" ],
Expand Down Expand Up @@ -363,7 +363,7 @@
"material_thickness": 8,
"environmental_protection": 2,
"techniques": [ "WBLOCK_1" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "SUN_GLASSES", "PADDED" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "SUN_GLASSES", "PADDED", "MODULE_HOLDER" ],
"pocket_data": [
{
"pocket_type": "CONTAINER",
Expand Down Expand Up @@ -397,7 +397,7 @@
"warmth": 20,
"material_thickness": 8,
"techniques": [ "WBLOCK_1" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "PADDED" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "PADDED", "MODULE_HOLDER" ],
"armor": [
{
"encumbrance_modifiers": [ "NONE" ],
Expand Down Expand Up @@ -2844,7 +2844,7 @@
"color": "dark_gray",
"warmth": 15,
"techniques": [ "WBLOCK_1" ],
"flags": [ "WATERPROOF", "PADDED" ],
"flags": [ "WATERPROOF", "PADDED", "MODULE_HOLDER" ],
"armor": [
{
"material": [
Expand Down
3 changes: 2 additions & 1 deletion src/character_attire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,8 @@ bool outfit::is_worn_module( const item &thing ) const
{
return thing.has_flag( flag_CANT_WEAR ) &&
std::any_of( worn.cbegin(), worn.cend(), [&thing]( item const & elem ) {
return elem.contained_where( thing ) != nullptr;
return elem.has_flag( flag_MODULE_HOLDER ) &&
elem.contained_where( thing ) != nullptr;
} );
}

Expand Down
1 change: 1 addition & 0 deletions src/flag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ const flag_id flag_MECH_BAT( "MECH_BAT" );
const flag_id flag_MELTS( "MELTS" );
const flag_id flag_MESSY( "MESSY" );
const flag_id flag_MISSION_ITEM( "MISSION_ITEM" );
const flag_id flag_MODULE_HOLDER( "MODULE_HOLDER" );
const flag_id flag_MOUNTED_GUN( "MOUNTED_GUN" );
const flag_id flag_MOUSE( "MOUSE" );
const flag_id flag_MUNDANE( "MUNDANE" );
Expand Down
1 change: 1 addition & 0 deletions src/flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ extern const flag_id flag_MECH_BAT;
extern const flag_id flag_MELTS;
extern const flag_id flag_MESSY;
extern const flag_id flag_MISSION_ITEM;
extern const flag_id flag_MODULE_HOLDER;
extern const flag_id flag_MOUNTED_GUN;
extern const flag_id flag_MOUSE;
extern const flag_id flag_MUNDANE;
Expand Down

0 comments on commit 2491e5a

Please sign in to comment.