diff --git a/data/mods/Aftershock/flags.json b/data/mods/Aftershock/flags.json index 7b1ccab3fe020..f108096478a3d 100644 --- a/data/mods/Aftershock/flags.json +++ b/data/mods/Aftershock/flags.json @@ -27,10 +27,5 @@ "id": "TEEP_IMMUNE", "type": "monster_flag", "//": "Immune to telepathic damage" - }, - { - "id": "ELECTROKINETIC_CHARGEABLE", - "type": "json_flag", - "info": "This item can be recharged by an electrokinetic" } ] diff --git a/data/mods/Aftershock/items/electrokinetic_charging_overrides.json b/data/mods/Aftershock/items/electrokinetic_charging_overrides.json deleted file mode 100644 index 373a5eea5b70f..0000000000000 --- a/data/mods/Aftershock/items/electrokinetic_charging_overrides.json +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "type": "TOOL", - "id": "heavy_flashlight", - "copy-from": "heavy_flashlight", - "name": { "str": "heavy-duty flashlight (off)", "str_pl": "heavy-duty flashlights (off)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL", - "id": "heavy_flashlight_on", - "copy-from": "heavy_flashlight_on", - "name": { "str": "heavy-duty flashlight (on)", "str_pl": "heavy-duty flashlights (on)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL", - "id": "flashlight", - "copy-from": "flashlight", - "name": { "str": "flashlight (off)", "str_pl": "flashlights (off)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL", - "id": "flashlight_on", - "copy-from": "flashlight_on", - "name": { "str": "flashlight (on)", "str_pl": "flashlights (on)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "wearable_light", - "copy-from": "wearable_light", - "name": { "str": "headlamp" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "wearable_light_on", - "copy-from": "wearable_light_on", - "name": { "str": "headlamp (on)", "str_pl": "headlamps (on)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "wearable_big_light", - "copy-from": "wearable_big_light", - "name": { "str": "heavy-duty headlamp" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "wearable_big_light_on", - "copy-from": "wearable_big_light_on", - "name": { "str": "heavy-duty headlamp (on)", "str_pl": "heavy-duty headlamps (on)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - } -] diff --git a/data/mods/Aftershock/spells/psionics/electrokinesis_concentration_eocs.json b/data/mods/Aftershock/spells/psionics/electrokinesis_concentration_eocs.json index 061b1f8733601..0541cc2d742b2 100644 --- a/data/mods/Aftershock/spells/psionics/electrokinesis_concentration_eocs.json +++ b/data/mods/Aftershock/spells/psionics/electrokinesis_concentration_eocs.json @@ -227,14 +227,10 @@ } ] }, + { "math": [ "u_afs_electrokin_personal_battery_count", "=", "0" ] }, { "u_run_inv_eocs": "all", - "search_data": [ - { "flags": [ "RECHARGE" ] }, - { "flags": [ "ELECTRONIC" ] }, - { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] }, - { "flags": [ "USE_UPS" ] } - ], + "search_data": [ { "uses_energy": true } ], "true_eocs": [ { "id": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_COUNTER", @@ -254,12 +250,7 @@ "effect": [ { "u_run_inv_eocs": "all", - "search_data": [ - { "flags": [ "RECHARGE" ] }, - { "flags": [ "ELECTRONIC" ] }, - { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] }, - { "flags": [ "USE_UPS" ] } - ], + "search_data": [ { "uses_energy": true } ], "true_eocs": [ { "id": "EOC_AFS_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_VALUE_ADDED", diff --git a/data/mods/MindOverMatter/items/electrokinetic_charging_overrrides.json b/data/mods/MindOverMatter/items/electrokinetic_charging_overrrides.json deleted file mode 100644 index b2f15d10458fb..0000000000000 --- a/data/mods/MindOverMatter/items/electrokinetic_charging_overrrides.json +++ /dev/null @@ -1,65 +0,0 @@ -[ - { - "type": "TOOL", - "id": "heavy_flashlight", - "copy-from": "heavy_flashlight", - "name": { "str": "heavy-duty flashlight (off)", "str_pl": "heavy-duty flashlights (off)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL", - "id": "heavy_flashlight_on", - "copy-from": "heavy_flashlight_on", - "name": { "str": "heavy-duty flashlight (on)", "str_pl": "heavy-duty flashlights (on)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL", - "id": "flashlight", - "copy-from": "flashlight", - "name": { "str": "flashlight (off)", "str_pl": "flashlights (off)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL", - "id": "flashlight_on", - "copy-from": "flashlight_on", - "name": { "str": "flashlight (on)", "str_pl": "flashlights (on)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "wearable_light", - "copy-from": "wearable_light", - "name": { "str": "headlamp" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "wearable_light_on", - "copy-from": "wearable_light_on", - "name": { "str": "headlamp (on)", "str_pl": "headlamps (on)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "wearable_big_light", - "copy-from": "wearable_big_light", - "name": { "str": "heavy-duty headlamp" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "wearable_big_light_on", - "copy-from": "wearable_big_light_on", - "name": { "str": "heavy-duty headlamp (on)", "str_pl": "heavy-duty headlamps (on)" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - }, - { - "type": "TOOL_ARMOR", - "id": "internal_battery_compartment", - "copy-from": "internal_battery_compartment", - "name": { "str": "internal battery compartment" }, - "extend": { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] } - } -] diff --git a/data/mods/MindOverMatter/json_flags.json b/data/mods/MindOverMatter/json_flags.json index 750043831a2c0..00aaa4849be5a 100644 --- a/data/mods/MindOverMatter/json_flags.json +++ b/data/mods/MindOverMatter/json_flags.json @@ -24,11 +24,6 @@ "type": "json_flag", "info": "You are protected against telepathic attack. Sometimes." }, - { - "id": "ELECTROKINETIC_CHARGEABLE", - "type": "json_flag", - "info": "This item can be recharged by an electrokinetic" - }, { "id": "MATRIX_CRYSTAL_BIOKINESIS", "type": "json_flag", diff --git a/data/mods/MindOverMatter/monsters/monster_eoc_spells.json b/data/mods/MindOverMatter/monsters/monster_eoc_spells.json index 88b5f2db5af06..6638bd1e4e5c8 100644 --- a/data/mods/MindOverMatter/monsters/monster_eoc_spells.json +++ b/data/mods/MindOverMatter/monsters/monster_eoc_spells.json @@ -289,12 +289,7 @@ "condition": { "not": { "u_has_effect": "effect_electrokin_personal_battery" } }, "effect": { "u_run_inv_eocs": "random", - "search_data": [ - { "flags": [ "RECHARGE" ] }, - { "flags": [ "ELECTRONIC" ] }, - { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] }, - { "flags": [ "USE_UPS" ] } - ], + "search_data": [ { "uses_energy": true } ], "true_eocs": [ { "id": "EOC_ELECTRONKINETIC_MONSTER_POWER_DRAINING_INV_RESULT", diff --git a/data/mods/MindOverMatter/powers/electrokinesis_concentration_eocs.json b/data/mods/MindOverMatter/powers/electrokinesis_concentration_eocs.json index 73aad91ff0bc5..19f6eaa131110 100644 --- a/data/mods/MindOverMatter/powers/electrokinesis_concentration_eocs.json +++ b/data/mods/MindOverMatter/powers/electrokinesis_concentration_eocs.json @@ -329,12 +329,7 @@ { "math": [ "u_electrokin_personal_battery_count", "=", "0" ] }, { "u_run_inv_eocs": "all", - "search_data": [ - { "flags": [ "RECHARGE" ] }, - { "flags": [ "ELECTRONIC" ] }, - { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] }, - { "flags": [ "USE_UPS" ] } - ], + "search_data": [ { "uses_energy": true } ], "true_eocs": [ { "id": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_COUNTER", @@ -354,12 +349,7 @@ "effect": [ { "u_run_inv_eocs": "all", - "search_data": [ - { "flags": [ "RECHARGE" ] }, - { "flags": [ "ELECTRONIC" ] }, - { "flags": [ "ELECTROKINETIC_CHARGEABLE" ] }, - { "flags": [ "USE_UPS" ] } - ], + "search_data": [ { "uses_energy": true } ], "true_eocs": [ { "id": "EOC_ELECTROKIN_PERSONAL_BATTERY_INV_SCANNER_VALUE_ADDED", diff --git a/data/mods/Xedra_Evolved/flags.json b/data/mods/Xedra_Evolved/flags.json index a114930a93646..659f5a6fa3369 100644 --- a/data/mods/Xedra_Evolved/flags.json +++ b/data/mods/Xedra_Evolved/flags.json @@ -24,11 +24,6 @@ "type": "json_flag", "info": "This gear will transform you into animal form, and may have some side effects." }, - { - "id": "ELECTROKINETIC_CHARGEABLE", - "type": "json_flag", - "info": "This item can be recharged by an electrokinetic" - }, { "id": "HEDGE_ENCHANTED", "type": "json_flag", diff --git a/data/mods/Xedra_Evolved/items/inventor/armor.json b/data/mods/Xedra_Evolved/items/inventor/armor.json index d1cf353a17f0b..e1d8495a5090d 100644 --- a/data/mods/Xedra_Evolved/items/inventor/armor.json +++ b/data/mods/Xedra_Evolved/items/inventor/armor.json @@ -52,17 +52,7 @@ } ], "techniques": [ "WBLOCK_1" ], - "flags": [ - "MORPHIC", - "WATERPROOF", - "STURDY", - "PADDED", - "TRADER_AVOID", - "PSYSHIELD_PARTIAL", - "MUNDANE", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" - ] + "flags": [ "MORPHIC", "WATERPROOF", "STURDY", "PADDED", "TRADER_AVOID", "PSYSHIELD_PARTIAL", "MUNDANE", "INVENTOR_CRAFTED" ] }, { "id": "helmet_inventor_on", @@ -175,7 +165,7 @@ "symbol": "[", "looks_like": "legguard_hard", "color": "light_red", - "flags": [ "MORPHIC", "STURDY", "OUTER", "BELTED", "MUNDANE", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ], + "flags": [ "MORPHIC", "STURDY", "OUTER", "BELTED", "MUNDANE", "INVENTOR_CRAFTED" ], "ammo": "battery", "use_action": { "target": "inventor_leg_weight_on", @@ -237,7 +227,7 @@ "symbol": "[", "looks_like": "legguard_hard", "color": "light_red", - "flags": [ "MORPHIC", "STURDY", "OUTER", "SOFT", "MUNDANE", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ], + "flags": [ "MORPHIC", "STURDY", "OUTER", "SOFT", "MUNDANE", "INVENTOR_CRAFTED" ], "ammo": "battery", "charges_per_use": 150, "use_action": { "type": "cast_spell", "spell_id": "jump_boots_leap", "no_fail": true, "level": 0 }, @@ -349,17 +339,7 @@ } ], "techniques": [ "WBLOCK_1" ], - "flags": [ - "MORPHIC", - "WATERPROOF", - "STURDY", - "SOFT", - "TRADER_AVOID", - "BELTED", - "MUNDANE", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" - ] + "flags": [ "MORPHIC", "WATERPROOF", "STURDY", "SOFT", "TRADER_AVOID", "BELTED", "MUNDANE", "INVENTOR_CRAFTED" ] }, { "id": "aura_force_on", @@ -411,8 +391,7 @@ "CALORIES_INTAKE", "ELECTRONIC", "MUNDANE", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" + "INVENTOR_CRAFTED" ], "pocket_data": [ { @@ -560,7 +539,7 @@ "weight": "300 g", "longest_side": "25 cm", "ammo": [ "battery" ], - "flags": [ "MORPHIC", "ONLY_ONE", "TRADER_AVOID", "MUNDANE", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ], + "flags": [ "MORPHIC", "ONLY_ONE", "TRADER_AVOID", "MUNDANE", "INVENTOR_CRAFTED" ], "use_action": [ { "target": "inventor_electric_fist_act", @@ -623,7 +602,7 @@ "color": "dark_gray", "material_thickness": 0.4, "environmental_protection": 4, - "flags": [ "MORPHIC", "MUNDANE", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ], + "flags": [ "MORPHIC", "MUNDANE", "INVENTOR_CRAFTED" ], "relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ACTIVE", "values": [ { "value": "REGEN_STAMINA", "multiply": 0.6 } ] } ] }, diff --git a/data/mods/Xedra_Evolved/items/inventor/gun.json b/data/mods/Xedra_Evolved/items/inventor/gun.json index f41a73572378b..20e258315b8e6 100644 --- a/data/mods/Xedra_Evolved/items/inventor/gun.json +++ b/data/mods/Xedra_Evolved/items/inventor/gun.json @@ -45,8 +45,7 @@ "NEEDS_NO_LUBE", "TRADER_AVOID", "OVERHEATS", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" + "INVENTOR_CRAFTED" ], "pocket_data": [ { @@ -108,8 +107,7 @@ "NEEDS_NO_LUBE", "TRADER_AVOID", "OVERHEATS", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" + "INVENTOR_CRAFTED" ], "pocket_data": [ { @@ -171,8 +169,7 @@ "NEEDS_NO_LUBE", "TRADER_AVOID", "OVERHEATS", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" + "INVENTOR_CRAFTED" ], "pocket_data": [ { @@ -259,16 +256,7 @@ "armor": [ { "encumbrance": [ 10, 12 ], "coverage": 70, "covers": [ "torso" ], "specifically_covers": [ "torso_hanging_back" ] } ], - "flags": [ - "TRADER_AVOID", - "PADDED", - "BELTED", - "OVERSIZE", - "WATER_FRIENDLY", - "MUNDANE", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" - ] + "flags": [ "TRADER_AVOID", "PADDED", "BELTED", "OVERSIZE", "WATER_FRIENDLY", "MUNDANE", "INVENTOR_CRAFTED" ] }, { "id": "bio_warhead", @@ -306,7 +294,7 @@ "color": "blue", "charges_per_use": 30, "ammo": [ "battery" ], - "flags": [ "TRADER_AVOID", "MUNDANE", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ], + "flags": [ "TRADER_AVOID", "MUNDANE", "INVENTOR_CRAFTED" ], "use_action": { "type": "cast_spell", "spell_id": "ion_shot_1", "no_fail": true, "level": 0, "need_wielding": true }, "pocket_data": [ { @@ -383,16 +371,7 @@ "dispersion": 15, "durability": 8, "loudness": 15, - "flags": [ - "NEVER_JAMS", - "NO_SALVAGE", - "NO_REPAIR", - "NON_FOULING", - "NEEDS_NO_LUBE", - "TRADER_AVOID", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" - ], + "flags": [ "NEVER_JAMS", "NO_SALVAGE", "NO_REPAIR", "NON_FOULING", "NEEDS_NO_LUBE", "TRADER_AVOID", "INVENTOR_CRAFTED" ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", @@ -425,7 +404,7 @@ "range": 1, "ammo": "battery", "ranged_damage": { "damage_type": "bullet", "amount": 1 }, - "extend": { "flags": [ "NO_TURRET", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ] }, + "extend": { "flags": [ "NO_TURRET", "INVENTOR_CRAFTED" ] }, "modes": [ ], "dispersion": 150, "durability": 9, @@ -717,8 +696,7 @@ "NEEDS_NO_LUBE", "TRADER_AVOID", "ELECTRONIC", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" + "INVENTOR_CRAFTED" ], "pocket_data": [ { @@ -745,7 +723,7 @@ "color": "blue", "charges_per_use": 50, "ammo": [ "battery" ], - "flags": [ "TRADER_AVOID", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ], + "flags": [ "TRADER_AVOID", "INVENTOR_CRAFTED" ], "use_action": { "type": "cast_spell", "spell_id": "heat_expl_gun", "no_fail": true, "level": 0, "need_wielding": true }, "pocket_data": [ { diff --git a/data/mods/Xedra_Evolved/items/inventor/melee.json b/data/mods/Xedra_Evolved/items/inventor/melee.json index 254441c818ddc..38a856bf61356 100644 --- a/data/mods/Xedra_Evolved/items/inventor/melee.json +++ b/data/mods/Xedra_Evolved/items/inventor/melee.json @@ -54,8 +54,7 @@ "TRADER_AVOID", "NONCONDUCTIVE", "MUNDANE", - "INVENTOR_CRAFTED", - "ELECTROKINETIC_CHARGEABLE" + "INVENTOR_CRAFTED" ], "pocket_data": [ { @@ -148,7 +147,7 @@ "need_charges_msg": "The \"Neon Angle\" battery is dead." }, "techniques": [ "WBLOCK_1", "BRUTAL", "SWEEP", "PLASMA_AXE_WIDE" ], - "flags": [ "DURABLE_MELEE", "NONCONDUCTIVE", "SHEATH_AXE", "MUNDANE", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ], + "flags": [ "DURABLE_MELEE", "NONCONDUCTIVE", "SHEATH_AXE", "MUNDANE", "INVENTOR_CRAFTED" ], "weapon_category": [ "HOOKING_WEAPONRY", "GREAT_AXES" ], "pocket_data": [ { diff --git a/data/mods/Xedra_Evolved/items/inventor/misc.json b/data/mods/Xedra_Evolved/items/inventor/misc.json index 3e67190f2e903..1d3b95c69ec3b 100644 --- a/data/mods/Xedra_Evolved/items/inventor/misc.json +++ b/data/mods/Xedra_Evolved/items/inventor/misc.json @@ -56,7 +56,7 @@ "weight": "2000 g", "volume": "2500 ml", "material": [ "steel", "plastic" ], - "extend": { "flags": [ "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ] }, + "extend": { "flags": [ "INVENTOR_CRAFTED" ] }, "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", @@ -84,7 +84,7 @@ "material": [ "aluminum", "plastic" ], "symbol": ";", "color": "green", - "flags": [ "WATER_BREAK", "ELECTRONIC", "ALLOWS_REMOTE_USE", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ], + "flags": [ "WATER_BREAK", "ELECTRONIC", "ALLOWS_REMOTE_USE", "INVENTOR_CRAFTED" ], "ammo": [ "battery" ], "charges_per_use": 20, "qualities": [ [ "COOK", 2 ], [ "BOIL", 2 ] ], @@ -151,6 +151,6 @@ } ], "use_action": [ { "type": "cast_spell", "spell_id": "inventor_portal_closer_spell", "no_fail": true, "level": 0 } ], - "flags": [ "ELECTRONIC", "INVENTOR_CRAFTED", "ELECTROKINETIC_CHARGEABLE" ] + "flags": [ "ELECTRONIC", "INVENTOR_CRAFTED" ] } ] diff --git a/doc/EFFECT_ON_CONDITION.md b/doc/EFFECT_ON_CONDITION.md index e27cb2dfc8536..9e0a534ad5ae9 100644 --- a/doc/EFFECT_ON_CONDITION.md +++ b/doc/EFFECT_ON_CONDITION.md @@ -4470,6 +4470,7 @@ search_data is an array, that allow to filter specific items from the list. At t | "flags" | string, [variable object](#variable-object) or array of strings or variable objects | filter the list of items by flags they have | | "excluded_flags" | string, [variable object](#variable-object) or array of strings or variable objects | excludes items from the list by flags they have | | "material" | string, [variable object](#variable-object) or array of strings or variable objects | filter the list of items by their material | +| "uses_energy" | boolean | filter the list of items by whether or not they use energy. `true` would pick only items that use energy, `false` would pick all items that do not use energy | | "worn_only" | boolean | return only items you you wear (clothes) | | "wielded_only" | boolean | return only item you hold in your hands right now. if you hold nothing, and picking object is not manual, it return string `none` | | "held_only" | boolean | return both items you wear and item you hold in your hands | @@ -4504,6 +4505,7 @@ Examples: { "worn_only": true }, { "wielded_only": true }, { "held_only": true }, + { "uses_energy": true }, { "condition": { "math": [ "rand(1)" ] } }, // since 0 for conditions is evaluated as "false", this would randomly discard ~half of items from picked { "condition": { "math": [ "n_calories() >= 200" ] } }, // can check beta talker for it's specific properties via math { "condition": { "and": [ { "math": [ "n_calories() >= 200" ] }, { "math": [ "n_calories() <= 500" ] } ] } }, // and even as range! diff --git a/src/npctalk.cpp b/src/npctalk.cpp index 7ca501a26282e..10e33dfd576fc 100644 --- a/src/npctalk.cpp +++ b/src/npctalk.cpp @@ -185,6 +185,7 @@ struct item_search_data { std::vector material; std::vector flags; std::vector excluded_flags; + std::optional uses_energy; bool worn_only; bool wielded_only; bool held_only; @@ -249,11 +250,13 @@ struct item_search_data { excluded_flags.emplace_back( get_str_or_var( jo.get_member( "excluded_flags" ), "excluded_flags", false, "" ) ); } - if( jo.has_member( "condition" ) ) { read_condition( jo, "condition", condition, false ); has_condition = true; } + if( jo.has_member( "uses_energy" ) ) { + uses_energy.emplace( jo.get_member( "uses_energy" ) ); + } worn_only = jo.get_bool( "worn_only", false ); wielded_only = jo.get_bool( "wielded_only", false ); @@ -366,6 +369,10 @@ struct item_search_data { } } + if( uses_energy.has_value() && loc->uses_energy() != uses_energy.value() ) { + return false; + } + if( worn_only && !guy->is_worn( *loc ) ) { return false; }