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 2 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
5 changes: 4 additions & 1 deletion data/json/field_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,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 @@ -550,6 +550,7 @@
"sym": "8",
"dangerous": true,
"translucency": 1,
"concentration": 1,
"effects": [
{
"effect_id": "poison",
Expand All @@ -568,6 +569,7 @@
"color": "light_green",
"transparent": false,
"translucency": 10,
"concentration": 2,
"effects": [
{
"effect_id": "poison",
Expand All @@ -585,6 +587,7 @@
"name": "thick toxic gas",
"color": "green",
"translucency": 0,
"concentration": 4,
"effects": [
{
"effect_id": "poison",
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,
fallback_intensity_level.concentration);
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
4 changes: 3 additions & 1 deletion src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4183,7 +4183,9 @@ 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 );
}
Expand Down
Loading