From 029ae39f8bdb604524198caa48e4dededa74ba18 Mon Sep 17 00:00:00 2001 From: Valiant Date: Sat, 21 Dec 2024 16:44:13 +0400 Subject: [PATCH 1/3] Replaced checking for clear path with 'gas-spreadable' line --- src/game.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/game.cpp b/src/game.cpp index babfd49446c8e..834768b140208 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1711,7 +1711,14 @@ units::temperature_delta get_heat_radiation( const tripoint_bub_ms &location ) continue; } if( player_character.pos_bub() == location ) { - if( !here.clear_path( dest, location, -1, 1, 100 ) ) { + bool gas_can_spread = true; + for( const tripoint_bub_ms &p : line_to( player_character.pos_bub(), dest ) ) { + if( !here.has_flag( ter_furn_flag::TFLAG_PERMEABLE, p ) && here.impassable( p ) ) { + gas_can_spread = false; + break; + } + } + if( !gas_can_spread ) { continue; } } else if( !here.sees( location, dest, -1 ) ) { From 7e2ecbca2017d78afe5c3f65e43b4cb37f60fed3 Mon Sep 17 00:00:00 2001 From: Valiant Date: Sat, 21 Dec 2024 16:45:16 +0400 Subject: [PATCH 2/3] Added `PERMEABLE` flag to lots of terrain types --- .../terrain-fences-gates.json | 75 ++++++++++++------- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/data/json/furniture_and_terrain/terrain-fences-gates.json b/data/json/furniture_and_terrain/terrain-fences-gates.json index c91d5d3a8f12e..ebf7919e98c47 100644 --- a/data/json/furniture_and_terrain/terrain-fences-gates.json +++ b/data/json/furniture_and_terrain/terrain-fences-gates.json @@ -31,7 +31,7 @@ "move_cost": 2, "connect_groups": "WALL", "connects_to": "WALL", - "flags": [ "TRANSPARENT", "FLAMMABLE", "FLAT", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "FLAMMABLE", "FLAT", "BURROWABLE", "PERMEABLE" ], "bash": { "str_min": 6, "str_max": 150, @@ -152,7 +152,7 @@ "symbol": ".", "color": "cyan", "move_cost": 2, - "flags": [ "TRANSPARENT", "FLAT", "ROAD", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "FLAT", "ROAD", "BURROWABLE", "PERMEABLE" ], "connect_groups": "CHAINFENCE", "connects_to": "CHAINFENCE", "close": "t_chaingate_c", @@ -267,7 +267,7 @@ "symbol": ".", "color": "cyan", "move_cost": 2, - "flags": [ "TRANSPARENT", "FLAT", "ROAD" ], + "flags": [ "TRANSPARENT", "FLAT", "ROAD", "PERMEABLE" ], "connect_groups": "WALL", "connects_to": "WALL", "close": "t_retractable_gate_c", @@ -294,7 +294,7 @@ "move_cost": 3, "coverage": 60, "rotates_to": "INDOORFLOOR", - "flags": [ "TRANSPARENT", "FLAMMABLE_ASH", "DOOR", "MOUNTABLE", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "FLAMMABLE_ASH", "DOOR", "MOUNTABLE", "BURROWABLE", "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", "open": "t_fencegate_o", @@ -331,7 +331,7 @@ "symbol": ".", "color": "brown", "move_cost": 2, - "flags": [ "TRANSPARENT", "FLAMMABLE_ASH", "FLAT", "ROAD", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "FLAMMABLE_ASH", "FLAT", "ROAD", "BURROWABLE", "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", "close": "t_fencegate_c", @@ -480,7 +480,7 @@ "color": "brown", "looks_like": "t_chaingate_o", "move_cost": 2, - "flags": [ "TRANSPARENT", "FLAT", "ROAD", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "FLAT", "ROAD", "BURROWABLE", "PERMEABLE" ], "connect_groups": "CHAINFENCE", "connects_to": "CHAINFENCE", "close": "t_chickenwire_gate_c", @@ -524,7 +524,8 @@ "MOUNTABLE", "SHORT", "AUTO_WALL_SYMBOL", - "BURROWABLE" + "BURROWABLE", + "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", @@ -589,7 +590,7 @@ "color": "brown", "looks_like": "t_fence_post", "move_cost": 2, - "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "SHORT" ], + "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "SHORT", "PERMEABLE" ], "bash": { "str_min": 4, "str_max": 20, @@ -651,7 +652,7 @@ "message": "You finish cutting the metal.", "byproducts": [ { "item": "pipe", "count": 6 } ] }, - "flags": [ "TRANSPARENT", "THIN_OBSTACLE" ], + "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "PERMEABLE" ], "oxytorch": { "result": "t_dirt", "duration": "1 seconds", "byproducts": [ { "item": "pipe", "count": [ 1, 4 ] } ] }, "bash": { "str_min": 8, @@ -728,7 +729,7 @@ "color": "brown", "looks_like": "t_fence_post", "move_cost": 2, - "flags": [ "TRANSPARENT", "THIN_OBSTACLE" ], + "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "PERMEABLE" ], "deconstruct": { "ter_set": "t_dirt", "items": [ { "item": "2x4", "count": 2 } ] }, "bash": { "str_min": 8, @@ -766,7 +767,7 @@ "symbol": "$", "color": "blue", "move_cost": 4, - "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "SHORT", "EASY_DECONSTRUCT", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "SHORT", "EASY_DECONSTRUCT", "BURROWABLE", "PERMEABLE" ], "deconstruct": { "ter_set": "t_fence_post", "items": [ { "item": "lc_wire", "count": 2 } ] }, "boltcut": { "result": "t_fence_post", @@ -797,7 +798,7 @@ "sound": "Snick, snick, gachunk!", "byproducts": [ { "item": "wire_barbed", "count": 2 } ] }, - "flags": [ "TRANSPARENT", "SHARP", "THIN_OBSTACLE", "SHORT", "EASY_DECONSTRUCT", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "SHARP", "THIN_OBSTACLE", "SHORT", "EASY_DECONSTRUCT", "BURROWABLE", "PERMEABLE" ], "deconstruct": { "ter_set": "t_fence_post", "items": [ { "item": "wire_barbed", "count": 2 } ] }, "bash": { "str_min": 8, @@ -816,7 +817,7 @@ "symbol": "$", "color": "brown", "move_cost": 3, - "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "EASY_DECONSTRUCT", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "EASY_DECONSTRUCT", "BURROWABLE", "PERMEABLE" ], "deconstruct": { "ter_set": "t_fence_post", "items": [ { "item": "rope_6", "count": 2 } ] }, "bash": { "str_min": 8, @@ -874,7 +875,7 @@ "move_cost": 0, "coverage": 60, "rotates_to": "INDOORFLOOR", - "flags": [ "TRANSPARENT", "FLAMMABLE_ASH", "DOOR", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "FLAMMABLE_ASH", "DOOR", "BURROWABLE", "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", "open": "t_splitrail_fencegate_o", @@ -912,7 +913,7 @@ "color": "brown", "looks_like": "t_fencegate_o", "move_cost": 2, - "flags": [ "TRANSPARENT", "FLAMMABLE_ASH", "FLAT", "ROAD", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "FLAMMABLE_ASH", "FLAT", "ROAD", "BURROWABLE", "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", "close": "t_splitrail_fencegate_c", @@ -988,7 +989,7 @@ "move_cost": 0, "coverage": 60, "rotates_to": "INDOORFLOOR", - "flags": [ "TRANSPARENT", "DOOR", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "DOOR", "BURROWABLE", "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", "open": "t_gate_metal_o", @@ -1028,7 +1029,7 @@ "looks_like": "t_fencegate_o", "move_cost": 2, "coverage": 60, - "flags": [ "TRANSPARENT", "BURROWABLE", "FLAT", "ROAD" ], + "flags": [ "TRANSPARENT", "BURROWABLE", "FLAT", "ROAD", "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", "close": "t_gate_metal_c", @@ -1092,7 +1093,7 @@ "move_cost": 0, "coverage": 60, "rotates_to": "INDOORFLOOR", - "flags": [ "FLAMMABLE_ASH", "DOOR", "BURROWABLE" ], + "flags": [ "FLAMMABLE_ASH", "DOOR", "BURROWABLE", "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", "open": "t_privacy_fencegate_o", @@ -1130,7 +1131,7 @@ "color": "brown", "looks_like": "t_fencegate_o", "move_cost": 2, - "flags": [ "FLAMMABLE_ASH", "FLAT", "ROAD", "BURROWABLE", "TRANSPARENT" ], + "flags": [ "FLAMMABLE_ASH", "FLAT", "ROAD", "BURROWABLE", "TRANSPARENT", "PERMEABLE" ], "connect_groups": "WOODFENCE", "connects_to": "WOODFENCE", "close": "t_privacy_fencegate_c", @@ -1167,7 +1168,17 @@ "symbol": "#", "color": "yellow", "move_cost": 3, - "flags": [ "FLAMMABLE_ASH", "TRANSPARENT", "NOITEM", "THIN_OBSTACLE", "MOUNTABLE", "SHORT", "AUTO_WALL_SYMBOL", "BURROWABLE" ], + "flags": [ + "FLAMMABLE_ASH", + "TRANSPARENT", + "NOITEM", + "THIN_OBSTACLE", + "MOUNTABLE", + "SHORT", + "AUTO_WALL_SYMBOL", + "BURROWABLE", + "PERMEABLE" + ], "connect_groups": "RAILING", "connects_to": "RAILING", "bash": { @@ -1192,7 +1203,7 @@ "symbol": "#", "color": "cyan", "move_cost": 3, - "flags": [ "TRANSPARENT", "NOITEM", "THIN_OBSTACLE", "MOUNTABLE", "SHORT", "AUTO_WALL_SYMBOL", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "NOITEM", "THIN_OBSTACLE", "MOUNTABLE", "SHORT", "AUTO_WALL_SYMBOL", "BURROWABLE", "PERMEABLE" ], "connect_groups": "RAILING", "connects_to": "RAILING", "deconstruct": { "ter_set": "t_rock_floor", "items": [ { "item": "glass_sheet", "count": 2 }, { "item": "pipe", "count": 4 } ] }, @@ -1217,7 +1228,7 @@ "symbol": "#", "color": "dark_gray", "move_cost": 3, - "flags": [ "TRANSPARENT", "NOITEM", "THIN_OBSTACLE", "MOUNTABLE", "SHORT", "AUTO_WALL_SYMBOL", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "NOITEM", "THIN_OBSTACLE", "MOUNTABLE", "SHORT", "AUTO_WALL_SYMBOL", "BURROWABLE", "PERMEABLE" ], "connect_groups": "RAILING", "connects_to": "RAILING", "deconstruct": { "ter_set": "t_rock_floor", "items": [ { "item": "sheet_metal", "count": 2 }, { "item": "pipe", "count": 4 } ] }, @@ -1243,7 +1254,17 @@ "color": "cyan", "looks_like": "t_ponywall", "move_cost": 3, - "flags": [ "TRANSPARENT", "NOITEM", "THIN_OBSTACLE", "MOUNTABLE", "SHORT", "AUTO_WALL_SYMBOL", "MINEABLE", "BURROWABLE" ], + "flags": [ + "TRANSPARENT", + "NOITEM", + "THIN_OBSTACLE", + "MOUNTABLE", + "SHORT", + "AUTO_WALL_SYMBOL", + "MINEABLE", + "BURROWABLE", + "PERMEABLE" + ], "connect_groups": "RAILING", "connects_to": "RAILING", "bash": { @@ -1268,7 +1289,7 @@ "color": "light_gray", "looks_like": "t_guardrail_bg_dp", "move_cost": 3, - "flags": [ "TRANSPARENT", "NOITEM", "REDUCE_SCENT", "MOUNTABLE", "SHORT", "THIN_OBSTACLE", "ROAD", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "NOITEM", "REDUCE_SCENT", "MOUNTABLE", "SHORT", "THIN_OBSTACLE", "ROAD", "BURROWABLE", "PERMEABLE" ], "bash": { "str_min": 8, "str_max": 150, @@ -1286,7 +1307,7 @@ "symbol": "#", "color": "light_gray", "move_cost": 3, - "flags": [ "TRANSPARENT", "NOITEM", "REDUCE_SCENT", "MOUNTABLE", "SHORT", "THIN_OBSTACLE", "ROAD", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "NOITEM", "REDUCE_SCENT", "MOUNTABLE", "SHORT", "THIN_OBSTACLE", "ROAD", "BURROWABLE", "PERMEABLE" ], "bash": { "str_min": 8, "str_max": 150, @@ -1304,7 +1325,7 @@ "symbol": "#", "color": "light_gray", "move_cost": 3, - "flags": [ "TRANSPARENT", "NOITEM", "REDUCE_SCENT", "MOUNTABLE", "SHORT", "THIN_OBSTACLE", "ROAD", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "NOITEM", "REDUCE_SCENT", "MOUNTABLE", "SHORT", "THIN_OBSTACLE", "ROAD", "BURROWABLE", "PERMEABLE" ], "looks_like": "t_guardrail_bg_dp", "bash": { "str_min": 8, @@ -1325,7 +1346,7 @@ "looks_like": "t_metal_railing", "move_cost": 0, "examine_action": "chainfence", - "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "MOUNTABLE", "CLIMBABLE", "AUTO_WALL_SYMBOL", "BURROWABLE" ], + "flags": [ "TRANSPARENT", "THIN_OBSTACLE", "MOUNTABLE", "CLIMBABLE", "AUTO_WALL_SYMBOL", "BURROWABLE", "PERMEABLE" ], "connect_groups": "RAILING", "connects_to": "RAILING", "deconstruct": { "ter_set": "t_dirt", "items": [ { "item": "sheet_metal", "count": 4 }, { "item": "pipe", "count": 2 } ] }, From 147e7aad4049bfc1eb8c9140551c768de1cd9afc Mon Sep 17 00:00:00 2001 From: Valiant Date: Sat, 21 Dec 2024 17:08:17 +0400 Subject: [PATCH 3/3] Corrected variable name --- src/game.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 834768b140208..1055e1867b919 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1711,14 +1711,14 @@ units::temperature_delta get_heat_radiation( const tripoint_bub_ms &location ) continue; } if( player_character.pos_bub() == location ) { - bool gas_can_spread = true; + bool heat_can_spread = true; for( const tripoint_bub_ms &p : line_to( player_character.pos_bub(), dest ) ) { if( !here.has_flag( ter_furn_flag::TFLAG_PERMEABLE, p ) && here.impassable( p ) ) { - gas_can_spread = false; + heat_can_spread = false; break; } } - if( !gas_can_spread ) { + if( !heat_can_spread ) { continue; } } else if( !here.sees( location, dest, -1 ) ) {