Example #1
0
void trap::on_disarmed( map &m, const tripoint &p ) const
{
    for( auto &i : components ) {
        m.spawn_item( p.x, p.y, i, 1, 1 );
    }
    // TODO: make this a flag, or include it into the components.
    if( id == trap_str_id( "tr_shotgun_1" ) || id == trap_str_id( "tr_shotgun_2" ) ) {
        m.spawn_item( p.x, p.y, "shot_00", 1, 2 );
    }
    if( is_3x3_trap() ) {
        for( int i = -1; i <= 1; i++ ) {
            for( int j = -1; j <= 1; j++ ) {
                m.remove_trap( tripoint( p.x + i, p.y + j, p.z ) );
            }
        }
    } else {
        m.remove_trap( p );
    }
}