diff --git a/data/json/clothing_mods.json b/data/json/clothing_mods.json index d78847593c03..fe6a71e99ee7 100644 --- a/data/json/clothing_mods.json +++ b/data/json/clothing_mods.json @@ -113,8 +113,8 @@ "implement_prompt": "Add pockets", "destroy_prompt": "Remove pockets", "mod_value": [ - { "type": "encumbrance", "value": 2, "proportion": [ "coverage" ] }, - { "type": "storage", "value": 3, "round_up": true, "proportion": [ "thickness", "coverage" ] } + { "type": "encumbrance", "value": 1, "round_up": true, "proportion": [ "volume", "coverage" ] }, + { "type": "storage", "value": 1, "round_up": true, "proportion": [ "volume" ] } ] } ] diff --git a/doc/src/content/docs/en/mod/json/reference/json_info.md b/doc/src/content/docs/en/mod/json/reference/json_info.md index 2b8924a97cb6..abba7550cf65 100644 --- a/doc/src/content/docs/en/mod/json/reference/json_info.md +++ b/doc/src/content/docs/en/mod/json/reference/json_info.md @@ -3433,8 +3433,9 @@ The following actions are available as defined in trapfunc.cpp: "value": 1, // value of effect. "round_up": false // (optional) round up value of effect. defaults to false. "proportion": [ // (optional) value of effect propotions to clothing's parameter. - "thickness", // "thickness" and "coverage" is available. - "coverage" + "thickness", // Add value for every layer of "material_thickness" the item has. + "volume", // Add value for every liter of baseline volume the item has. + "coverage" // Reduce value by percentage of average coverage the item has. ] } ] diff --git a/src/clothing_mod.cpp b/src/clothing_mod.cpp index fc2c85b91ff8..0557b899ad31 100644 --- a/src/clothing_mod.cpp +++ b/src/clothing_mod.cpp @@ -83,6 +83,8 @@ void clothing_mod::load( const JsonObject &jo, const std::string & ) const std::string &str = entry.get_string(); if( str == "thickness" ) { mv.thickness_propotion = true; + } else if( str == "volume" ) { + mv.volume_propotion = true; } else if( str == "coverage" ) { mv.coverage_propotion = true; } else { @@ -97,6 +99,7 @@ float clothing_mod::get_mod_val( const clothing_mod_type &type, const item &it ) { const int thickness = it.get_thickness(); const int coverage = it.get_avg_coverage(); + const int vol = it.base_volume() / 1_liter; float result = 0.0f; for( const mod_value &mv : mod_values ) { if( mv.type == type ) { @@ -104,6 +107,9 @@ float clothing_mod::get_mod_val( const clothing_mod_type &type, const item &it ) if( mv.thickness_propotion ) { tmp *= thickness; } + if( mv.volume_propotion ) { + tmp *= vol; + } if( mv.coverage_propotion ) { tmp *= coverage / 100.0f; } diff --git a/src/clothing_mod.h b/src/clothing_mod.h index 87ff6ee1f3a2..da9b430cff59 100644 --- a/src/clothing_mod.h +++ b/src/clothing_mod.h @@ -36,6 +36,7 @@ struct mod_value { float value = 0.0f; bool round_up = false; bool thickness_propotion = false; + bool volume_propotion = false; bool coverage_propotion = false; };