Skip to content

Commit

Permalink
Use acetylene torch to open all locked safes (#42376)
Browse files Browse the repository at this point in the history
* Use acetylene torch to open all  locked safes

* add chance to start a fire
  • Loading branch information
kevingranade authored Jul 26, 2020
2 parents 97b975a + 1928a06 commit 7a41b21
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
11 changes: 9 additions & 2 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,11 +2416,11 @@ void activity_handlers::oxytorch_finish( player_activity *act, player *p )
map &here = get_map();
const tripoint &pos = act->placement;
const ter_id ter = here.ter( pos );

const furn_id furn = here.furn( pos );
// fast players might still have some charges left to be consumed
act->targets.front()->ammo_consume( act->values[0], p->pos() );

if( here.furn( pos ) == f_rack ) {
if( furn == f_rack ) {
here.furn_set( pos, f_null );
here.spawn_item( p->pos(), itype_steel_chunk, rng( 2, 6 ) );
} else if( ter == t_chainfence || ter == t_chaingate_c || ter == t_chaingate_l ) {
Expand Down Expand Up @@ -2460,6 +2460,13 @@ void activity_handlers::oxytorch_finish( player_activity *act, player *p )
} else if( ter == t_window_bars ) {
here.ter_set( pos, t_window_empty );
here.spawn_item( p->pos(), itype_pipe, rng( 1, 2 ) );
} else if( furn == f_safe_l || furn == f_gunsafe_ml || furn == f_gunsafe_mj ||
furn == f_gun_safe_el ) {
here.furn_set( pos, f_safe_o );
// 50% of starting a fire.
if( here.flammable_items_at( pos ) && rng( 1, 100 ) < 50 ) {
here.add_field( pos, fd_fire, 1, 10_minutes );
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5081,7 +5081,11 @@ int iuse::oxytorch( player *p, item *it, bool, const tripoint & )
t_door_metal_pickable
};
const std::set<furn_id> allowed_furn_id {
f_rack
f_rack,
f_safe_l,
f_gunsafe_ml,
f_gunsafe_mj,
f_gun_safe_el
};

map &here = get_map();
Expand Down Expand Up @@ -5125,7 +5129,8 @@ int iuse::oxytorch( player *p, item *it, bool, const tripoint & )
ter == t_window_bars || ter == t_reb_cage ) {
turns = to_turns<int>( 10_seconds );
} else if( ter == t_door_metal_locked || ter == t_door_metal_c || ter == t_door_bar_c ||
ter == t_door_bar_locked || ter == t_door_metal_pickable ) {
ter == t_door_bar_locked || ter == t_door_metal_pickable || furn == f_safe_l ||
furn == f_gunsafe_ml || furn == f_gunsafe_mj || furn == f_gun_safe_el ) {
turns = to_turns<int>( 15_seconds );
} else {
return 0;
Expand Down
4 changes: 3 additions & 1 deletion src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ furn_id f_null,
f_washer, f_dryer,
f_vending_c, f_vending_o, f_dumpster, f_dive_block,
f_crate_c, f_crate_o, f_coffin_c, f_coffin_o,
f_gunsafe_ml,
f_gunsafe_ml, f_gunsafe_mj, f_gun_safe_el,
f_large_canvas_wall, f_canvas_wall, f_canvas_door, f_canvas_door_o, f_groundsheet,
f_fema_groundsheet, f_large_groundsheet,
f_large_canvas_door, f_large_canvas_door_o, f_center_groundsheet, f_skin_wall, f_skin_door,
Expand Down Expand Up @@ -1096,6 +1096,8 @@ void set_furn_ids()
f_camp_chair = furn_id( "f_camp_chair" );
f_sign = furn_id( "f_sign" );
f_gunsafe_ml = furn_id( "f_gunsafe_ml" );
f_gunsafe_mj = furn_id( "f_gunsafe_mj" );
f_gun_safe_el = furn_id( "f_gun_safe_el" );
}

size_t ter_t::count()
Expand Down
2 changes: 1 addition & 1 deletion src/mapdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ extern furn_id f_null,
f_tourist_table,
f_camp_chair,
f_sign,
f_gunsafe_ml;
f_gunsafe_ml, f_gunsafe_mj, f_gun_safe_el;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// These are on their way OUT and only used in certain switch statements until they are rewritten.
Expand Down

0 comments on commit 7a41b21

Please sign in to comment.