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

Portable smoking rack #29915

Merged
merged 19 commits into from
May 8, 2019
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
45 changes: 45 additions & 0 deletions data/json/furniture.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 15 additions & 0 deletions data/json/items/tool/deployable.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
27 changes: 26 additions & 1 deletion data/json/recipes/recipe_others.json
Original file line number Diff line number Diff line change
Expand Up @@ -4222,7 +4222,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": [
Expand All @@ -4241,6 +4241,31 @@
[ [ "spike", 2 ] ]
]
},
{
"type": "recipe",
"result": "metal_smoking_rack",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_TOOLS",
"skill_used": "fabrication",
"difficulty": 4,
"time": 30000,
"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",
Expand Down
61 changes: 48 additions & 13 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4189,6 +4189,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() );
Expand Down Expand Up @@ -4286,7 +4289,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;
Expand Down Expand Up @@ -4327,7 +4332,7 @@ void smoker_load_food( player &p, const tripoint &examp, const units::volume &re
{
std::vector<item_comp> 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" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) {
Scischm marked this conversation as resolved.
Show resolved Hide resolved
p.add_msg_if_player( _( "You can't place more food while it's smoking." ) );
return;
}
Expand Down Expand Up @@ -4437,23 +4442,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" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) {
Scischm marked this conversation as resolved.
Show resolved Hide resolved
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" ) || g->m.furn( examp ) == furn_str_id( "f_metal_smoking_rack_active" )) ? true : false;
Scischm marked this conversation as resolved.
Show resolved Hide resolved
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;
Scischm marked this conversation as resolved.
Show resolved Hide resolved
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() );
Expand Down Expand Up @@ -4522,7 +4538,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',
Scischm marked this conversation as resolved.
Show resolved Hide resolved
active ? _( "You cannot disassemble this smoking rack while it is active!" ) :
_( "Disassemble the smoking rack" ), _(""));
Scischm marked this conversation as resolved.
Show resolved Hide resolved
}

Scischm marked this conversation as resolved.
Show resolved Hide resolved
} else {
smenu.addentry_desc( 7, true, 'x',
_( "Quench burning charcoal" ),
_( "Quenching will stop smoking process, but also destroy all used charcoal." ) );
Expand Down Expand Up @@ -4604,7 +4626,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." ) );
}
Expand All @@ -4614,9 +4640,18 @@ 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;
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,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;
Expand Down Expand Up @@ -1027,6 +1027,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" );
Expand Down
2 changes: 1 addition & 1 deletion src/mapdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,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;
Expand Down