Skip to content
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

Better Gas masks - Model concentration better, and make gas mask cartiges last longer #68570

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 44 additions & 22 deletions data/json/field_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@
"color": "white",
"dangerous": true,
"translucency": 0.1,
"concentration:": 1,
"convection_temperature_mod": -10,
"effects": [
{
Expand All @@ -355,6 +356,7 @@
"color": "white",
"convection_temperature_mod": -20,
"translucency": 0.4,
"concentration:": 2,
"effects": [
{
"effect_id": "poison",
Expand All @@ -373,6 +375,7 @@
"color": "white",
"convection_temperature_mod": -30,
"translucency": 0.7,
"concentration:": 4,
"effects": [
{
"effect_id": "poison",
Expand Down Expand Up @@ -407,7 +410,7 @@
"display_items": false,
"display_field": true,
"looks_like": "fd_fog",
"gas_absorption_factor": 15,
"gas_absorption_factor": 1,
"has_fume": true,
"percent_spread": 90,
"dirty_transparency_cache": true,
Expand Down Expand Up @@ -452,6 +455,7 @@
"sym": "8",
"dangerous": true,
"translucency": 1,
"concentration:": 1,
"effects": [
{
"effect_id": "smoke_eyes",
Expand All @@ -478,6 +482,7 @@
"color": "light_gray",
"transparent": false,
"translucency": 10,
"concentration:": 2,
"effects": [
{
"effect_id": "smoke_eyes",
Expand All @@ -504,6 +509,7 @@
"name": "thick smoke",
"color": "dark_gray",
"translucency": 0,
"concentration:": 4,
"effects": [
{
"effect_id": "smoke_eyes",
Expand Down Expand Up @@ -550,6 +556,7 @@
"sym": "8",
"dangerous": true,
"translucency": 1,
"concentration": 1,
"effects": [
{
"effect_id": "poison",
Expand All @@ -568,6 +575,7 @@
"color": "light_green",
"transparent": false,
"translucency": 10,
"concentration": 2,
"effects": [
{
"effect_id": "poison",
Expand All @@ -585,6 +593,7 @@
"name": "thick toxic gas",
"color": "green",
"translucency": 0,
"concentration": 4,
"effects": [
{
"effect_id": "poison",
Expand Down Expand Up @@ -612,7 +621,7 @@
}
],
"decay_amount_factor": 5,
"gas_absorption_factor": 15,
"gas_absorption_factor": 5,
"percent_spread": 30,
"outdoor_age_speedup": "3 minutes",
"dirty_transparency_cache": true,
Expand All @@ -635,6 +644,7 @@
"sym": "8",
"dangerous": true,
"translucency": 1,
"concentration:": 1,
"effects": [
{
"effect_id": "tpollen",
Expand All @@ -653,6 +663,7 @@
"color": "light_green",
"transparent": false,
"translucency": 10,
"concentration:": 2,
"effects": [
{
"effect_id": "tpollen",
Expand Down Expand Up @@ -686,15 +697,16 @@
"type": "field_type",
"legacy_enum_id": 14,
"intensity_levels": [
{ "name": "hazy cloud", "sym": "8", "dangerous": true, "translucency": 1 },
{ "name": "hazy cloud", "sym": "8", "dangerous": true, "translucency": 1, "concentration": 1 },
{
"name": "tear gas",
"color": "light_green",
"transparent": false,
"translucency": 10,
"concentration:": 2,
"scent_neutralization": 1
},
{ "name": "thick tear gas", "color": "green", "translucency": 0, "scent_neutralization": 5 }
{ "name": "thick tear gas", "color": "green", "translucency": 0, "concentration:": 4, "scent_neutralization": 5 }
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
],
"decay_amount_factor": 5,
"gas_absorption_factor": 15,
Expand All @@ -715,12 +727,13 @@
"type": "field_type",
"legacy_enum_id": 15,
"intensity_levels": [
{ "name": "hazy cloud", "sym": "8", "dangerous": true, "translucency": 10, "extra_radiation_max": 1 },
{ "name": "radioactive gas", "color": "light_green", "extra_radiation_max": 2 },
{ "name": "hazy cloud", "sym": "8", "dangerous": true, "translucency": 10, "concentration:": 1, "extra_radiation_max": 1 },
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
{ "name": "radioactive gas", "color": "light_green", "extra_radiation_max": 2, "concentration:": 2 },
{
"name": "thick radioactive gas",
"color": "green",
"transparent": false,
"concentration:": 4,
"extra_radiation_max": 3,
"radiation_hurt_damage_min": 1,
"radiation_hurt_damage_max": 3,
Expand All @@ -743,7 +756,7 @@
"id": "fd_gas_vent",
"type": "field_type",
"legacy_enum_id": 16,
"intensity_levels": [ { "name": "gas vent" }, { "//": "repeat last entry" }, { "//": "repeat last entry" } ],
"intensity_levels": [ { "name": "gas vent", "concentration:": 4 }, { "//": "repeat last entry" }, { "//": "repeat last entry" } ],
"description_affix": "under",
"wandering_field": "fd_toxic_gas",
"gas_absorption_factor": 15,
Expand All @@ -758,12 +771,13 @@
"id": "fd_tindalos_rift",
"type": "field_type",
"intensity_levels": [
{ "name": "angular ripple", "color": "light_gray", "sym": "*", "light_emitted": 160 },
{ "name": "angular rift", "color": "dark_gray" },
{ "name": "angular ripple", "color": "light_gray", "sym": "*", "light_emitted": 160, "concentration": 1 },
{ "name": "angular rift", "color": "dark_gray", "concentration": 1 },
{
"name": "fractal fissure",
"color": "magenta",
"transparent": false,
"concentration": 1,
"monster_spawn_chance": 15,
"monster_spawn_count": 1,
"monster_spawn_radius": 1,
Expand Down Expand Up @@ -1240,6 +1254,7 @@
"sym": ".",
"dangerous": true,
"translucency": 5,
"concentration": 1,
"effects": [
{
"effect_id": "relax_gas",
Expand All @@ -1255,6 +1270,7 @@
{
"name": "sedative gas",
"color": "pink",
"concentration": 2,
"effects": [
{
"effect_id": "relax_gas",
Expand All @@ -1269,6 +1285,7 @@
{
"name": "relaxation gas",
"color": "cyan",
"concentration": 4,
"effects": [
{
"effect_id": "relax_gas",
Expand Down Expand Up @@ -1299,7 +1316,7 @@
"id": "fd_swamp_gas",
"type": "field_type",
"intensity_levels": [
{ "name": "swamp gas", "sym": ".", "dangerous": true, "translucency": 5 },
{ "name": "swamp gas", "sym": ".", "dangerous": true, "translucency": 5, "concentration": 1 },
{ "//": "repeat last entry" },
{ "//": "repeat last entry" }
],
Expand All @@ -1321,7 +1338,7 @@
"id": "fd_fog",
"type": "field_type",
"intensity_levels": [
{ "name": "mist", "sym": "~", "dangerous": false, "transparent": false, "translucency": 5 },
{ "name": "mist", "sym": "~", "dangerous": false, "transparent": false, "translucency": 5, "concentration": 0.5 },
{ "name": "fog", "translucency": 3 },
{ "name": "dense fog", "translucency": 1 }
],
Expand All @@ -1343,9 +1360,9 @@
"type": "field_type",
"legacy_enum_id": 40,
"intensity_levels": [
{ "name": "hazy cloud", "sym": ".", "dangerous": true },
{ "name": "fungal haze", "color": "cyan" },
{ "name": "thick fungal haze", "transparent": false }
{ "name": "hazy cloud", "sym": ".", "dangerous": true, "concentration": 1 },
{ "name": "fungal haze", "color": "cyan", "concentration": 2 },
{ "name": "thick fungal haze", "transparent": false, "concentration": 4 }
],
"decay_amount_factor": 5,
"gas_absorption_factor": 15,
Expand Down Expand Up @@ -1513,6 +1530,7 @@
"name": "foul-smelling air",
"sym": "8",
"dangerous": true,
"concentration": 1,
"effects": [
{
"effect_id": "migo_atmosphere",
Expand All @@ -1527,6 +1545,7 @@
{
"name": "foul-smelling air",
"translucency": 1,
"concentration": 2,
"effects": [
{
"effect_id": "migo_atmosphere",
Expand All @@ -1539,6 +1558,7 @@
},
{
"name": "foul-smelling air",
"concentration": 4,
"effects": [
{
"effect_id": "migo_atmosphere",
Expand Down Expand Up @@ -1566,9 +1586,9 @@
"type": "field_type",
"legacy_enum_id": 49,
"intensity_levels": [
{ "name": "fungicidal mist", "sym": "8", "dangerous": true },
{ "name": "fungicidal haze", "color": "light_gray" },
{ "name": "thick fungicidal haze", "color": "dark_gray", "transparent": false }
{ "name": "fungicidal mist", "sym": "8", "dangerous": true, "concentration": 1 },
{ "name": "fungicidal haze", "color": "light_gray", "concentration": 2 },
{ "name": "thick fungicidal haze", "color": "dark_gray", "transparent": false, "concentration": 4 }
],
"decay_amount_factor": 5,
"gas_absorption_factor": 15,
Expand All @@ -1588,9 +1608,9 @@
"id": "fd_insecticidal_gas",
"type": "field_type",
"intensity_levels": [
{ "name": "insecticidal mist", "sym": "8", "dangerous": true },
{ "name": "insecticidal haze", "color": "light_gray" },
{ "name": "thick insecticidal haze", "color": "dark_gray", "transparent": false }
{ "name": "insecticidal mist", "sym": "8", "dangerous": true, "concentration": 1 },
{ "name": "insecticidal haze", "color": "light_gray", "concentration": 2 },
{ "name": "thick insecticidal haze", "color": "dark_gray", "transparent": false, "concentration": 4 }
],
"decay_amount_factor": 5,
"gas_absorption_factor": 15,
Expand All @@ -1610,7 +1630,7 @@
"id": "fd_smoke_vent",
"type": "field_type",
"legacy_enum_id": 50,
"intensity_levels": [ { "name": "smoke vent", "dangerous": true }, { "//": "repeat last entry" }, { "//": "repeat last entry" } ],
"intensity_levels": [ { "name": "smoke vent", "dangerous": true, "concentration": 4 }, { "//": "repeat last entry" }, { "//": "repeat last entry" } ],
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
"description_affix": "under",
"wandering_field": "fd_smoke",
"gas_absorption_factor": 15,
Expand Down Expand Up @@ -1675,7 +1695,7 @@
{
"id": "fd_clairvoyant",
"type": "field_type",
"intensity_levels": [ { "name": "clairvoyance", "sym": "8", "dangerous": false } ],
"intensity_levels": [ { "name": "clairvoyance", "sym": "8", "dangerous": false, "concentration": 1 } ],
"decay_amount_factor": 5,
"gas_absorption_factor": 12,
"dirty_transparency_cache": true,
Expand Down Expand Up @@ -1733,6 +1753,7 @@
"dangerous": true,
"light_emitted": 10,
"translucency": 5,
"concentration": 1,
"effects": [
{
"effect_id": "glowing_gas_cover",
Expand Down Expand Up @@ -1770,6 +1791,7 @@
"dangerous": true,
"light_emitted": 10,
"translucency": 5,
"concentration": 1,
"effects": [
{
"effect_id": "glowing_gas",
Expand Down
2 changes: 2 additions & 0 deletions src/field_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ void field_type::load( const JsonObject &jo, const std::string_view )
fallback_intensity_level.local_light_override );
optional( jao, was_loaded, "translucency", intensity_level.translucency,
fallback_intensity_level.translucency );
optional(jao, was_loaded, "concentration", intensity_level.concentration,
1);
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
optional( jao, was_loaded, "convection_temperature_mod", intensity_level.convection_temperature_mod,
fallback_intensity_level.convection_temperature_mod );
if( jao.has_array( "effects" ) ) {
Expand Down
1 change: 1 addition & 0 deletions src/field_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ struct field_intensity_level {
float light_emitted = 0.0f;
float local_light_override = -1.0f;
float translucency = 0.0f;
int concentration = 0.0f;
int convection_temperature_mod = 0;
int scent_neutralization = 0;
std::vector<field_effect> field_effects;
Expand Down
15 changes: 12 additions & 3 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4183,22 +4183,31 @@ std::optional<int> iuse::gasmask( Character *p, item *it, const tripoint &pos )
const field &gasfield = get_map().field_at( pos );
for( const auto &dfield : gasfield ) {
const field_entry &entry = dfield.second;
const int gas_abs_factor = entry.get_field_type()->gas_absorption_factor;
int gas_abs_factor = entry.get_field_type()->gas_absorption_factor;
const field_intensity_level& int_level = entry.get_intensity_level();
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
gas_abs_factor = gas_abs_factor * int_level.concentration;
if( gas_abs_factor > 0 ) {
it->set_var( "gas_absorbed", it->get_var( "gas_absorbed", 0 ) + gas_abs_factor );
}
}
if( it->get_var( "gas_absorbed", 0 ) >= 100 ) {
if( it->get_var( "gas_absorbed", 0 ) >= 240 ) {
it->ammo_consume( 1, pos, p );
it->set_var( "gas_absorbed", 0 );
if (it->ammo_remaining() < 10) {
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
p->add_msg_player_or_npc(
m_bad,
_("Your %s is getting hard to breathe in!"),
_("<npcname>'s gas mask is getting hard to breathe in!")
, it->tname());
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
}
}
if( it->ammo_remaining() == 0 ) {
p->add_msg_player_or_npc(
m_bad,
_( "Your %s requires new filters!" ),
_( "<npcname> needs new gas mask filters!" )
, it->tname() );
}
}
MorvarchPrincess marked this conversation as resolved.
Show resolved Hide resolved
}

if( it->ammo_remaining() == 0 ) {
Expand Down