From 0e96c60c17d82370262a3cf78a3cccea3917f601 Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Wed, 24 Apr 2019 23:03:46 -0400 Subject: [PATCH 01/10] Added deployable smoking rack --- data/json/furniture.json | 45 ++++++++++++++++++++ data/json/items/tool/deployable.json | 15 +++++++ data/json/recipes/recipe_others.json | 25 +++++++++++ src/iexamine.cpp | 62 ++++++++++++++++++++++------ src/mapdata.cpp | 4 +- src/mapdata.h | 2 +- 6 files changed, 138 insertions(+), 15 deletions(-) diff --git a/data/json/furniture.json b/data/json/furniture.json index 62b6effd9d4d4..5d79b1cfa90da 100644 --- a/data/json/furniture.json +++ b/data/json/furniture.json @@ -3207,6 +3207,51 @@ "items": [ { "item": "rock", "count": 8 }, { "item": "stick", "count": [ 8, 12 ] } ] } }, + { + "type": "furniture", + "id": "f_metal_smoking_rack", + "name": "metal smoking rack", + "description": "A special rack designed to smoke food for better preservation and taste.", + "symbol": "=", + "bgcolor": "grey", + "move_cost_mod": 2, + "required_str": -1, + "deployed_item": "metal_smoking_rack", + "flags": [ "TRANSPARENT", "SEALED", "ALLOW_FIELD_EFFECT", "CONTAINER", "NOITEM", "EASY_DECONSTRUCT", "MINEABLE" ], + "crafting_pseudo_item": "char_smoker", + "examine_action": "smoker_options", + "deconstruct": { "items": [ { "item": "metal_smoking_rack", "count": 1 } ] }, + "bash": { + "str_min": 18, + "str_max": 50, + "sound": "metal screeching!", + "sound_fail": "clang!", + "items": [ { "item": "scrap", "count": 4 }, { "item": "pipe", "count": [ 3, 5 ] } ] + } + }, + { + "type": "furniture", + "id": "f_metal_smoking_rack_active", + "name": "active metal smoking rack", + "description": "A special rack designed to smoke food for better preservation and taste.", + "symbol": "=", + "bgcolor": "grey", + "move_cost_mod": 2, + "required_str": -1, + "deployed_item": "metal_smoking_rack", + "flags": [ "TRANSPARENT", "SEALED", "ALLOW_FIELD_EFFECT", "CONTAINER", "NOITEM", "EASY_DECONSTRUCT", "MINEABLE" ], + "crafting_pseudo_item": "char_smoker", + "examine_action": "smoker_options", + "deconstruct": { "items": [ { "item": "metal_smoking_rack", "count": 1 } ] }, + "bash": { + "str_min": 18, + "str_max": 50, + "sound": "metal screeching!", + "sound_fail": "clang!", + "items": [ { "item": "scrap", "count": 4 }, { "item": "pipe", "count": [ 3, 5 ] } ] + } + }, + { "type": "furniture", "id": "f_forge_rock", diff --git a/data/json/items/tool/deployable.json b/data/json/items/tool/deployable.json index 38c26e0cdcbbe..afdf554014e04 100644 --- a/data/json/items/tool/deployable.json +++ b/data/json/items/tool/deployable.json @@ -46,6 +46,21 @@ "color": "light_gray", "use_action": { "type": "deploy_furn", "furn_type": "f_metal_butcher_rack" } }, + { + "id": "metal_smoking_rack", + "type": "TOOL", + "name": "metal smoking rack", + "description": "A metal rack designed to smoke food for better preservation and taste. It is folded for easy transportation and can be deployed as a furniture.", + "weight": 5000, + "volume": 160, + "price": 5000, + "to_hit": -4, + "bashing": 7, + "material": [ "steel" ], + "symbol": "=", + "color": "grey", + "use_action": { "type": "deploy_furn", "furn_type": "f_metal_smoking_rack" } + }, { "id": "tourist_table", "type": "TOOL", diff --git a/data/json/recipes/recipe_others.json b/data/json/recipes/recipe_others.json index 4d5939d1c24bf..7d09f211c3fd5 100644 --- a/data/json/recipes/recipe_others.json +++ b/data/json/recipes/recipe_others.json @@ -4240,6 +4240,31 @@ [ [ "spike", 2 ] ] ] }, + { + "type": "recipe", + "result": "metal_smoking_rack", + "category": "CC_OTHER", + "subcategory": "CSC_OTHER_TOOLS", + "skill_used": "fabrication", + "difficulty": 4, + "time": 8000, + "autolearn": true, + "book_learn": [ [ "textbook_fabrication", 2 ], [ "textbook_mechanics", 3 ] ], + "qualities": [ + { "id": "ANVIL", "level": 1 }, + { "id": "HAMMER", "level": 3 }, + { "id": "SAW_M", "level": 1 }, + { "id": "DRILL", "level": 1 }, + { "id": "SCREW", "level": 1 } + ], + "components": [ + [ [ "scrap", 6 ] ], + [ [ "pipe", 15 ], [ "cu_pipe", 15 ], [ "frame", 2 ] ], + [ [ "nail", 12 ] ], + [ [ "wire", 6 ], [ "rope_6", 6 ], [ "rope_makeshift_6", 6 ] ], + [ [ "spike", 4 ] ] + ] + }, { "type": "recipe", "result": "tourist_table", diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 7dbd078c00277..209afdde8fe04 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -4164,6 +4164,9 @@ void smoker_activate( player &p, const tripoint &examp ) furn_id next_smoker_type = f_null; if( cur_smoker_type == f_smoking_rack ) { next_smoker_type = f_smoking_rack_active; + } + else if( cur_smoker_type == f_metal_smoking_rack ){ + next_smoker_type = f_metal_smoking_rack_active; } else { debugmsg( "Examined furniture has action smoker_activate, but is of type %s", g->m.furn( examp ).id().c_str() ); @@ -4261,7 +4264,9 @@ void smoker_finalize( player &, const tripoint &examp, const time_point &start_t furn_id next_smoker_type = f_null; if( cur_smoker_type == f_smoking_rack_active ) { next_smoker_type = f_smoking_rack; - } else { + } else if( cur_smoker_type == f_metal_smoking_rack_active ){ + next_smoker_type = f_metal_smoking_rack; + } else { debugmsg( "Furniture executed action smoker_finalize, but is of type %s", g->m.furn( examp ).id().c_str() ); return; @@ -4302,7 +4307,7 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re { std::vector comps; - if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) ) { + if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) or g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) { p.add_msg_if_player( _( "You can't place more food while it's smoking." ) ); return; } @@ -4412,23 +4417,34 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re void iexamine::on_smoke_out( const tripoint &examp, const time_point &start_time ) { - if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) ) { + if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) or g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) { smoker_finalize( g->u, examp, start_time ); } } void iexamine::smoker_options( player &p, const tripoint &examp ) { - bool active = g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ); - auto items_here = g->m.i_at( examp ); - - if( items_here.empty() && active ) { + bool active = (g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" )or g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true : false; + bool portable = (g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack" ) or g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true: false; + auto items_here = g->m.i_at( examp ); + + if(portable && items_here.empty() && active) { + debugmsg( "f_metal_smoking_rack_active was empty!" ); + g->m.furn_set( examp, f_metal_smoking_rack ); + return; + } + else if( items_here.empty() && active ) { debugmsg( "f_smoking_rack_active was empty!" ); g->m.furn_set( examp, f_smoking_rack ); return; } - - if( items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { + if(portable && items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { + debugmsg( "f_metal_smoking_rack_active was empty, and had fake_smoke_plume!" ); + g->m.furn_set( examp, f_metal_smoking_rack ); + items_here.erase( items_here.begin() ); + return; + } + else if( items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { debugmsg( "f_smoking_rack_active was empty, and had fake_smoke_plume!" ); g->m.furn_set( examp, f_smoking_rack ); items_here.erase( items_here.begin() ); @@ -4497,7 +4513,13 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) _( "You need %d charges of charcoal for %s %s of food. Minimal amount of charcoal is %d charges." ), sm_rack::CHARCOAL_PER_LITER, format_volume( 1000_ml ), volume_units_long(), sm_rack::MIN_CHARCOAL ) ); - } else { + if(portable) { + smenu.addentry_desc(8, !active, 'd', + active ? _( "You cannot disassemble this smoking rack while it is active!" ) : + _( "Disassemble the smoking rack" ), _("")); + } + + } else { smenu.addentry_desc( 7, true, 'x', _( "Quench burning charcoal" ), _( "Quenching will stop smoking process, but also destroy all used charcoal." ) ); @@ -4579,7 +4601,11 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) i--; } } - if( active && rem_f_opt ) { + if( portable && active && rem_f_opt) { + g->m.furn_set( examp, f_metal_smoking_rack ); + add_msg( m_info, _( "You stop the smoking process." ) ); + } + else if( active && rem_f_opt ) { g->m.furn_set( examp, f_smoking_rack ); add_msg( m_info, _( "You stop the smoking process." ) ); } @@ -4589,9 +4615,19 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) add_msg( m_info, _( "Never mind." ) ); break; case 7: - g->m.furn_set( examp, f_smoking_rack ); + if(portable) { + g->m.furn_set( examp, f_metal_smoking_rack ); add_msg( m_info, _( "You stop the smoking process." ) ); - break; + } + else { + g->m.furn_set( examp, f_smoking_rack ); + add_msg( m_info, _( "You stop the smoking process." ) ); + } + break; + case 8: + g->m.furn_set( examp, f_metal_smoking_rack ); + deployed_furniture( p, examp ); + break; } } diff --git a/src/mapdata.cpp b/src/mapdata.cpp index 4e61fe9e40712..a6ed49362184a 100644 --- a/src/mapdata.cpp +++ b/src/mapdata.cpp @@ -915,7 +915,7 @@ furn_id f_null, f_floor_canvas, f_tatami, f_kiln_empty, f_kiln_full, f_kiln_metal_empty, f_kiln_metal_full, - f_smoking_rack, f_smoking_rack_active, + f_smoking_rack, f_smoking_rack_active, f_metal_smoking_rack, f_metal_smoking_rack_active, f_robotic_arm, f_vending_reinforced, f_brazier, f_autodoc_couch; @@ -1020,6 +1020,8 @@ void set_furn_ids() f_kiln_metal_full = furn_id( "f_kiln_metal_full" ); f_smoking_rack = furn_id( "f_smoking_rack" ); f_smoking_rack_active = furn_id( "f_smoking_rack_active" ); + f_metal_smoking_rack = furn_id( "f_metal_smoking_rack" ); + f_metal_smoking_rack_active = furn_id( "f_metal_smoking_rack_active" ); f_robotic_arm = furn_id( "f_robotic_arm" ); f_brazier = furn_id( "f_brazier" ); f_autodoc_couch = furn_id( "f_autodoc_couch" ); diff --git a/src/mapdata.h b/src/mapdata.h index f351c14265270..eb9631e540714 100644 --- a/src/mapdata.h +++ b/src/mapdata.h @@ -520,7 +520,7 @@ extern furn_id f_null, f_flower_marloss, f_tatami, f_kiln_empty, f_kiln_full, f_kiln_metal_empty, f_kiln_metal_full, - f_smoking_rack, f_smoking_rack_active, + f_smoking_rack, f_smoking_rack_active, f_metal_smoking_rack, f_metal_smoking_rack_active, f_robotic_arm, f_vending_reinforced, f_brazier, f_autodoc_couch; From fac1de641940e00de034fd54580302a5da6f480a Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Thu, 25 Apr 2019 01:20:00 -0400 Subject: [PATCH 02/10] Format changes --- src/iexamine.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 209afdde8fe04..78745471eac4a 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -4165,7 +4165,7 @@ void smoker_activate( player &p, const tripoint &examp ) if( cur_smoker_type == f_smoking_rack ) { next_smoker_type = f_smoking_rack_active; } - else if( cur_smoker_type == f_metal_smoking_rack ){ + else if( cur_smoker_type == f_metal_smoking_rack ) { next_smoker_type = f_metal_smoking_rack_active; } else { debugmsg( "Examined furniture has action smoker_activate, but is of type %s", @@ -4264,7 +4264,7 @@ void smoker_finalize( player &, const tripoint &examp, const time_point &start_t furn_id next_smoker_type = f_null; if( cur_smoker_type == f_smoking_rack_active ) { next_smoker_type = f_smoking_rack; - } else if( cur_smoker_type == f_metal_smoking_rack_active ){ + } else if( cur_smoker_type == f_metal_smoking_rack_active ) { next_smoker_type = f_metal_smoking_rack; } else { debugmsg( "Furniture executed action smoker_finalize, but is of type %s", @@ -4307,7 +4307,7 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re { std::vector comps; - if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) or g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) { + if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) { p.add_msg_if_player( _( "You can't place more food while it's smoking." ) ); return; } @@ -4417,18 +4417,18 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re void iexamine::on_smoke_out( const tripoint &examp, const time_point &start_time ) { - if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) or g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) { + if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) { smoker_finalize( g->u, examp, start_time ); } } void iexamine::smoker_options( player &p, const tripoint &examp ) { - bool active = (g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" )or g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true : false; - bool portable = (g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack" ) or g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true: false; + bool active = (g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true : false; + const bool portable = (g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true: false; auto items_here = g->m.i_at( examp ); - if(portable && items_here.empty() && active) { + if( portable && items_here.empty() && active ) { debugmsg( "f_metal_smoking_rack_active was empty!" ); g->m.furn_set( examp, f_metal_smoking_rack ); return; @@ -4438,7 +4438,7 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) g->m.furn_set( examp, f_smoking_rack ); return; } - if(portable && items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { + if( portable && items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { debugmsg( "f_metal_smoking_rack_active was empty, and had fake_smoke_plume!" ); g->m.furn_set( examp, f_metal_smoking_rack ); items_here.erase( items_here.begin() ); @@ -4513,7 +4513,7 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) _( "You need %d charges of charcoal for %s %s of food. Minimal amount of charcoal is %d charges." ), sm_rack::CHARCOAL_PER_LITER, format_volume( 1000_ml ), volume_units_long(), sm_rack::MIN_CHARCOAL ) ); - if(portable) { + if( portable ) { smenu.addentry_desc(8, !active, 'd', active ? _( "You cannot disassemble this smoking rack while it is active!" ) : _( "Disassemble the smoking rack" ), _("")); @@ -4601,7 +4601,7 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) i--; } } - if( portable && active && rem_f_opt) { + if( portable && active && rem_f_opt ) { g->m.furn_set( examp, f_metal_smoking_rack ); add_msg( m_info, _( "You stop the smoking process." ) ); } @@ -4615,11 +4615,10 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) add_msg( m_info, _( "Never mind." ) ); break; case 7: - if(portable) { + if( portable ) { g->m.furn_set( examp, f_metal_smoking_rack ); add_msg( m_info, _( "You stop the smoking process." ) ); - } - else { + } else { g->m.furn_set( examp, f_smoking_rack ); add_msg( m_info, _( "You stop the smoking process." ) ); } From 9aec17d47b1e400652a1792584f708feb3bd22c9 Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Thu, 25 Apr 2019 01:24:05 -0400 Subject: [PATCH 03/10] Longer recipe times --- data/json/recipes/recipe_others.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/json/recipes/recipe_others.json b/data/json/recipes/recipe_others.json index 7d09f211c3fd5..f7f6ee9d8ef13 100644 --- a/data/json/recipes/recipe_others.json +++ b/data/json/recipes/recipe_others.json @@ -4221,7 +4221,7 @@ "subcategory": "CSC_OTHER_TOOLS", "skill_used": "fabrication", "difficulty": 4, - "time": 8000, + "time": 30000, "autolearn": true, "book_learn": [ [ "textbook_fabrication", 2 ], [ "textbook_mechanics", 3 ] ], "qualities": [ @@ -4247,7 +4247,7 @@ "subcategory": "CSC_OTHER_TOOLS", "skill_used": "fabrication", "difficulty": 4, - "time": 8000, + "time": 30000, "autolearn": true, "book_learn": [ [ "textbook_fabrication", 2 ], [ "textbook_mechanics", 3 ] ], "qualities": [ From b093a87e28dc3d1af181a7608f7004db72fdad6e Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Thu, 25 Apr 2019 03:02:05 -0400 Subject: [PATCH 04/10] Linted json again. --- data/json/furniture.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/json/furniture.json b/data/json/furniture.json index 5d79b1cfa90da..e98508a9f3971 100644 --- a/data/json/furniture.json +++ b/data/json/furniture.json @@ -3216,7 +3216,7 @@ "bgcolor": "grey", "move_cost_mod": 2, "required_str": -1, - "deployed_item": "metal_smoking_rack", + "deployed_item": "metal_smoking_rack", "flags": [ "TRANSPARENT", "SEALED", "ALLOW_FIELD_EFFECT", "CONTAINER", "NOITEM", "EASY_DECONSTRUCT", "MINEABLE" ], "crafting_pseudo_item": "char_smoker", "examine_action": "smoker_options", @@ -3238,7 +3238,7 @@ "bgcolor": "grey", "move_cost_mod": 2, "required_str": -1, - "deployed_item": "metal_smoking_rack", + "deployed_item": "metal_smoking_rack", "flags": [ "TRANSPARENT", "SEALED", "ALLOW_FIELD_EFFECT", "CONTAINER", "NOITEM", "EASY_DECONSTRUCT", "MINEABLE" ], "crafting_pseudo_item": "char_smoker", "examine_action": "smoker_options", From 11d6a8d89a81a022c4ed1081a26f4afccae8318a Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Thu, 25 Apr 2019 03:19:22 -0400 Subject: [PATCH 05/10] astyle formatting --- src/iexamine.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 9d5598916a1ac..501a8b812813d 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -4332,7 +4332,7 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re { std::vector comps; - if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) { + if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ) ) { p.add_msg_if_player( _( "You can't place more food while it's smoking." ) ); return; } @@ -4442,15 +4442,15 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re void iexamine::on_smoke_out( const tripoint &examp, const time_point &start_time ) { - if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) { + if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ) ) { smoker_finalize( g->u, examp, start_time ); } } void iexamine::smoker_options( player &p, const tripoint &examp ) { - bool active = (g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true : false; - const bool portable = (g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true: false; + const bool active = g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ); + const bool portable = g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ); auto items_here = g->m.i_at( examp ); if( portable && items_here.empty() && active ) { @@ -4539,12 +4539,11 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) sm_rack::CHARCOAL_PER_LITER, format_volume( 1000_ml ), volume_units_long(), sm_rack::MIN_CHARCOAL ) ); if( portable ) { - smenu.addentry_desc(8, !active, 'd', + smenu.addentry_desc( 8, !active, 'd', active ? _( "You cannot disassemble this smoking rack while it is active!" ) : - _( "Disassemble the smoking rack" ), _("")); + _( "Disassemble the smoking rack" ), _("") ); } - - } else { + } else { smenu.addentry_desc( 7, true, 'x', _( "Quench burning charcoal" ), _( "Quenching will stop smoking process, but also destroy all used charcoal." ) ); From 7d64b064b1eb61600f22e4d0747814c3db414b07 Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Thu, 25 Apr 2019 03:29:30 -0400 Subject: [PATCH 06/10] Linting again? --- data/json/furniture.json | 1 - 1 file changed, 1 deletion(-) diff --git a/data/json/furniture.json b/data/json/furniture.json index e98508a9f3971..79c6785cf8f20 100644 --- a/data/json/furniture.json +++ b/data/json/furniture.json @@ -3251,7 +3251,6 @@ "items": [ { "item": "scrap", "count": 4 }, { "item": "pipe", "count": [ 3, 5 ] } ] } }, - { "type": "furniture", "id": "f_forge_rock", From f56ddaafa4f66d35edd158a3354947605bcfd1a6 Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Thu, 25 Apr 2019 03:57:24 -0400 Subject: [PATCH 07/10] Fixed a color typo --- data/json/furniture.json | 4 ++-- data/json/items/tool/deployable.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/json/furniture.json b/data/json/furniture.json index 79c6785cf8f20..cec1f2a0ff503 100644 --- a/data/json/furniture.json +++ b/data/json/furniture.json @@ -3213,7 +3213,7 @@ "name": "metal smoking rack", "description": "A special rack designed to smoke food for better preservation and taste.", "symbol": "=", - "bgcolor": "grey", + "bgcolor": "light_gray", "move_cost_mod": 2, "required_str": -1, "deployed_item": "metal_smoking_rack", @@ -3235,7 +3235,7 @@ "name": "active metal smoking rack", "description": "A special rack designed to smoke food for better preservation and taste.", "symbol": "=", - "bgcolor": "grey", + "bgcolor": "light_gray", "move_cost_mod": 2, "required_str": -1, "deployed_item": "metal_smoking_rack", diff --git a/data/json/items/tool/deployable.json b/data/json/items/tool/deployable.json index afdf554014e04..ecfa409f14621 100644 --- a/data/json/items/tool/deployable.json +++ b/data/json/items/tool/deployable.json @@ -58,7 +58,7 @@ "bashing": 7, "material": [ "steel" ], "symbol": "=", - "color": "grey", + "color": "light_gray", "use_action": { "type": "deploy_furn", "furn_type": "f_metal_smoking_rack" } }, { From f93fd0813273a2b22b96ae0816235939691232eb Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Fri, 26 Apr 2019 00:39:54 -0400 Subject: [PATCH 08/10] AStyle formatting --- src/iexamine.cpp | 78 ++++++++++++++++++++++++------------------------ src/mapdata.cpp | 2 +- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 501a8b812813d..3e4290ab87c60 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -4189,8 +4189,7 @@ void smoker_activate( player &p, const tripoint &examp ) furn_id next_smoker_type = f_null; if( cur_smoker_type == f_smoking_rack ) { next_smoker_type = f_smoking_rack_active; - } - else if( cur_smoker_type == f_metal_smoking_rack ) { + } else if( cur_smoker_type == f_metal_smoking_rack ) { next_smoker_type = f_metal_smoking_rack_active; } else { debugmsg( "Examined furniture has action smoker_activate, but is of type %s", @@ -4291,7 +4290,7 @@ void smoker_finalize( player &, const tripoint &examp, const time_point &start_t next_smoker_type = f_smoking_rack; } else if( cur_smoker_type == f_metal_smoking_rack_active ) { next_smoker_type = f_metal_smoking_rack; - } else { + } else { debugmsg( "Furniture executed action smoker_finalize, but is of type %s", g->m.furn( examp ).id().c_str() ); return; @@ -4332,7 +4331,8 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re { std::vector comps; - if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ) ) { + if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || + g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ) ) { p.add_msg_if_player( _( "You can't place more food while it's smoking." ) ); return; } @@ -4442,34 +4442,35 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re void iexamine::on_smoke_out( const tripoint &examp, const time_point &start_time ) { - if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ) ) { + if( g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || + g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ) ) { smoker_finalize( g->u, examp, start_time ); } } void iexamine::smoker_options( player &p, const tripoint &examp ) { - const bool active = g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ); - const bool portable = g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ); - auto items_here = g->m.i_at( examp ); - - if( portable && items_here.empty() && active ) { - debugmsg( "f_metal_smoking_rack_active was empty!" ); + const bool active = g->m.furn( examp ) == furn_str_id( "f_smoking_rack_active" ) || + g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ); + const bool portable = g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack" ) || + g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ); + auto items_here = g->m.i_at( examp ); + + if( portable && items_here.empty() && active ) { + debugmsg( "f_metal_smoking_rack_active was empty!" ); g->m.furn_set( examp, f_metal_smoking_rack ); - return; - } - else if( items_here.empty() && active ) { + return; + } else if( items_here.empty() && active ) { debugmsg( "f_smoking_rack_active was empty!" ); g->m.furn_set( examp, f_smoking_rack ); return; } - if( portable && items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { - debugmsg( "f_metal_smoking_rack_active was empty, and had fake_smoke_plume!" ); + if( portable && items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { + debugmsg( "f_metal_smoking_rack_active was empty, and had fake_smoke_plume!" ); g->m.furn_set( examp, f_metal_smoking_rack ); items_here.erase( items_here.begin() ); return; - } - else if( items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { + } else if( items_here.size() == 1 && items_here.begin()->typeId() == "fake_smoke_plume" ) { debugmsg( "f_smoking_rack_active was empty, and had fake_smoke_plume!" ); g->m.furn_set( examp, f_smoking_rack ); items_here.erase( items_here.begin() ); @@ -4538,12 +4539,12 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) _( "You need %d charges of charcoal for %s %s of food. Minimal amount of charcoal is %d charges." ), sm_rack::CHARCOAL_PER_LITER, format_volume( 1000_ml ), volume_units_long(), sm_rack::MIN_CHARCOAL ) ); - if( portable ) { - smenu.addentry_desc( 8, !active, 'd', - active ? _( "You cannot disassemble this smoking rack while it is active!" ) : - _( "Disassemble the smoking rack" ), _("") ); - } - } else { + if( portable ) { + smenu.addentry_desc( 8, !active, 'd', + active ? _( "You cannot disassemble this smoking rack while it is active!" ) : + _( "Disassemble the smoking rack" ), _( "" ) ); + } + } else { smenu.addentry_desc( 7, true, 'x', _( "Quench burning charcoal" ), _( "Quenching will stop smoking process, but also destroy all used charcoal." ) ); @@ -4625,11 +4626,10 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) i--; } } - if( portable && active && rem_f_opt ) { - g->m.furn_set( examp, f_metal_smoking_rack ); + if( portable && active && rem_f_opt ) { + g->m.furn_set( examp, f_metal_smoking_rack ); add_msg( m_info, _( "You stop the smoking process." ) ); - } - else if( active && rem_f_opt ) { + } else if( active && rem_f_opt ) { g->m.furn_set( examp, f_smoking_rack ); add_msg( m_info, _( "You stop the smoking process." ) ); } @@ -4639,18 +4639,18 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) add_msg( m_info, _( "Never mind." ) ); break; case 7: - if( portable ) { - g->m.furn_set( examp, f_metal_smoking_rack ); - add_msg( m_info, _( "You stop the smoking process." ) ); - } else { - g->m.furn_set( examp, f_smoking_rack ); - add_msg( m_info, _( "You stop the smoking process." ) ); + if( portable ) { + g->m.furn_set( examp, f_metal_smoking_rack ); + add_msg( m_info, _( "You stop the smoking process." ) ); + } else { + g->m.furn_set( examp, f_smoking_rack ); + add_msg( m_info, _( "You stop the smoking process." ) ); } - break; - case 8: - g->m.furn_set( examp, f_metal_smoking_rack ); - deployed_furniture( p, examp ); - break; + break; + case 8: + g->m.furn_set( examp, f_metal_smoking_rack ); + deployed_furniture( p, examp ); + break; } } diff --git a/src/mapdata.cpp b/src/mapdata.cpp index b150f250e1e84..6d219ef398935 100644 --- a/src/mapdata.cpp +++ b/src/mapdata.cpp @@ -1027,7 +1027,7 @@ void set_furn_ids() f_kiln_metal_full = furn_id( "f_kiln_metal_full" ); f_smoking_rack = furn_id( "f_smoking_rack" ); f_smoking_rack_active = furn_id( "f_smoking_rack_active" ); - f_metal_smoking_rack = furn_id( "f_metal_smoking_rack" ); + f_metal_smoking_rack = furn_id( "f_metal_smoking_rack" ); f_metal_smoking_rack_active = furn_id( "f_metal_smoking_rack_active" ); f_robotic_arm = furn_id( "f_robotic_arm" ); f_brazier = furn_id( "f_brazier" ); From 65b2b424eab7b82a48415f58f4cfa0ba2fb87d85 Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Fri, 26 Apr 2019 21:06:52 -0400 Subject: [PATCH 09/10] Volume changes --- data/json/items/tool/deployable.json | 2 +- src/iexamine.cpp | 46 ++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/data/json/items/tool/deployable.json b/data/json/items/tool/deployable.json index ecfa409f14621..68f4edbe92ca3 100644 --- a/data/json/items/tool/deployable.json +++ b/data/json/items/tool/deployable.json @@ -52,7 +52,7 @@ "name": "metal smoking rack", "description": "A metal rack designed to smoke food for better preservation and taste. It is folded for easy transportation and can be deployed as a furniture.", "weight": 5000, - "volume": 160, + "volume": 100, "price": 5000, "to_hit": -4, "bashing": 7, diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 3e4290ab87c60..76d1b6fdbaf79 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -4174,6 +4174,7 @@ namespace sm_rack const int MIN_CHARCOAL = 100; const int CHARCOAL_PER_LITER = 25; const units::volume MAX_FOOD_VOLUME = units::from_liter( 20 ); +const units::volume MAX_FOOD_VOLUME_PORTABLE = units::from_liter( 15 ); } static int get_charcoal_charges( units::volume food ) @@ -4187,6 +4188,8 @@ void smoker_activate( player &p, const tripoint &examp ) { furn_id cur_smoker_type = g->m.furn( examp ); furn_id next_smoker_type = f_null; + const bool portable = g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack" ) || + g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" ); if( cur_smoker_type == f_smoking_rack ) { next_smoker_type = f_smoking_rack_active; } else if( cur_smoker_type == f_metal_smoking_rack ) { @@ -4238,7 +4241,12 @@ void smoker_activate( player &p, const tripoint &examp ) add_msg( _( "There is no charcoal in the rack." ) ); return; } - if( food_volume > sm_rack::MAX_FOOD_VOLUME ) { + if( portable && food_volume > sm_rack::MAX_FOOD_VOLUME_PORTABLE ) { + add_msg( _( "This rack is overloaded with food, and it blocks the flow of smoke. Remove some and try again." ) ); + add_msg( _( "You think that you can load about %s %s in it." ), + format_volume( sm_rack::MAX_FOOD_VOLUME_PORTABLE ), volume_units_long() ); + return; + } else if( food_volume > sm_rack::MAX_FOOD_VOLUME ) { add_msg( _( "This rack is overloaded with food, and it blocks the flow of smoke. Remove some and try again." ) ); add_msg( _( "You think that you can load about %s %s in it." ), format_volume( sm_rack::MAX_FOOD_VOLUME ), volume_units_long() ); @@ -4500,7 +4508,9 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) const bool empty = f_volume == 0_ml; const bool full = f_volume >= sm_rack::MAX_FOOD_VOLUME; + const bool full_portable = f_volume >= sm_rack::MAX_FOOD_VOLUME_PORTABLE; const auto remaining_capacity = sm_rack::MAX_FOOD_VOLUME - f_volume; + const auto remaining_capacity_portable = sm_rack::MAX_FOOD_VOLUME_PORTABLE - f_volume; const auto has_coal_in_inventory = p.charges_of( "charcoal" ) > 0; const auto coal_charges = count_charges_in_list( item::find_type( "charcoal" ), items_here ); const auto need_charges = get_charcoal_charges( f_volume ); @@ -4521,12 +4531,24 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) need_charges - coal_charges ) : _( "Light up and smoke food" ), _( "Light up the smoking rack and start smoking. Smoking will take about 6 hours." ) ); + if( portable ) { + smenu.addentry_desc( 2, !full_portable, 'f', + full_portable ? _( "Insert food for smoking... smoking rack is full" ) : + string_format( _( "Insert food for smoking... remaining capacity is %s %s" ), + format_volume( remaining_capacity_portable ), volume_units_abbr() ), + _( "Fill the smoking rack with raw meat, fish or sausages for smoking or fruit or vegetable or smoked meat for drying." ) ); - smenu.addentry_desc( 2, !full, 'f', - full ? _( "Insert food for smoking... smoking rack is full" ) : - string_format( _( "Insert food for smoking... remaining capacity is %s %s" ), - format_volume( remaining_capacity ), volume_units_abbr() ), - _( "Fill the smoking rack with raw meat, fish or sausages for smoking or fruit or vegetable or smoked meat for drying." ) ); + smenu.addentry_desc( 8, !active, 'd', + active ? _( "You cannot disassemble this smoking rack while it is active!" ) : + _( "Disassemble the smoking rack" ), _( "" ) ); + + } else { + smenu.addentry_desc( 2, !full, 'f', + full ? _( "Insert food for smoking... smoking rack is full" ) : + string_format( _( "Insert food for smoking... remaining capacity is %s %s" ), + format_volume( remaining_capacity ), volume_units_abbr() ), + _( "Fill the smoking rack with raw meat, fish or sausages for smoking or fruit or vegetable or smoked meat for drying." ) ); + } if( f_check ) { smenu.addentry( 4, f_check, 'e', _( "Remove food from smoking rack" ) ); @@ -4539,11 +4561,7 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) _( "You need %d charges of charcoal for %s %s of food. Minimal amount of charcoal is %d charges." ), sm_rack::CHARCOAL_PER_LITER, format_volume( 1000_ml ), volume_units_long(), sm_rack::MIN_CHARCOAL ) ); - if( portable ) { - smenu.addentry_desc( 8, !active, 'd', - active ? _( "You cannot disassemble this smoking rack while it is active!" ) : - _( "Disassemble the smoking rack" ), _( "" ) ); - } + } else { smenu.addentry_desc( 7, true, 'x', _( "Quench burning charcoal" ), @@ -4604,7 +4622,11 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) } break; case 2: // load food - smoker_load_food( p, examp, remaining_capacity ); + if( portable ) { + smoker_load_food( p, examp, remaining_capacity_portable ); + } else { + smoker_load_food( p, examp, remaining_capacity ); + } break; case 3: // load charcoal reload_furniture( p, examp ); From 1054ae621069a3d7a6796e37c121a9b060115828 Mon Sep 17 00:00:00 2001 From: Scischm <49844315+Scischm@users.noreply.github.com> Date: Thu, 2 May 2019 22:45:59 -0400 Subject: [PATCH 10/10] Fixed smoking time of zero and corrected a typo --- src/iexamine.cpp | 7 ++++--- src/item.cpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 8d0c9ae936db9..ce68c5382bbcf 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -4955,7 +4955,7 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) format_volume( remaining_capacity_portable ), volume_units_abbr() ), _( "Fill the smoking rack with raw meat, fish or sausages for smoking or fruit or vegetable or smoked meat for drying." ) ); - smenu.addentry_desc( 8, !active, 'd', + smenu.addentry_desc( 8, !active, 'z', active ? _( "You cannot disassemble this smoking rack while it is active!" ) : _( "Disassemble the smoking rack" ), _( "" ) ); @@ -5005,9 +5005,10 @@ void iexamine::smoker_options( player &p, const tripoint &examp ) "It will finish smoking in about %d hours.", hours_left ), hours_left ) << "\n \n "; } else if( minutes_left > 30 ) { - pop << _( "It will finish smoking in less than an hour." ); + pop << _( "It will finish smoking in less than an hour." ) << "\n "; } else { - pop << string_format( _( "It should take about %d minutes to finish smoking." ), minutes_left ); + pop << string_format( _( "It should take about %d minutes to finish smoking." ), + minutes_left ) << "\n "; } } } else { diff --git a/src/item.cpp b/src/item.cpp index 2ee704c46d15d..fec6bd4e2b06b 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -7275,7 +7275,8 @@ bool item::process_fake_mill( player * /*carrier*/, const tripoint &pos ) bool item::process_fake_smoke( player * /*carrier*/, const tripoint &pos ) { - if( g->m.furn( pos ) != furn_str_id( "f_smoking_rack_active" ) ) { + if( g->m.furn( pos ) != furn_str_id( "f_smoking_rack_active" ) && + g->m.furn( pos ) != furn_str_id( "f_metal_smoking_rack_active" ) ) { item_counter = 0; return true; //destroy fake smoke }