From d850b5fc4bda625ef6c50df7a546bbb7394b9dd5 Mon Sep 17 00:00:00 2001 From: FatigueDev <85469004+FatigueDev@users.noreply.github.com> Date: Tue, 16 May 2023 02:13:07 +1000 Subject: [PATCH] Allow zones to interact across multiple Z levels (#65613) * Allow zones to see across Z levels, allow actors to use those zones * Update src/activity_item_handling.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update src/activity_item_handling.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update src/activity_item_handling.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/activity_item_handling.cpp | 9 ++++++--- src/clzones.cpp | 18 +++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 0f304c42e8f4d..02dd78667cf21 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -970,7 +970,8 @@ static bool are_requirements_nearby( } // use nearby welding rig without needing to drag it or position yourself on the right side of the vehicle. if( !found_welder ) { - for( const tripoint_bub_ms &elem : here.points_in_radius( src_loc, PICKUP_RANGE - 1 ) ) { + for( const tripoint_bub_ms &elem : here.points_in_radius( src_loc, PICKUP_RANGE - 1, + PICKUP_RANGE - 1 ) ) { const std::optional &vp = here.veh_at( elem ).part_with_tool( itype_welder ); if( vp ) { @@ -2698,7 +2699,8 @@ static requirement_check_result generic_multi_activity_check_requirement( loot_zone_spots.emplace_back( elem ); combined_spots.emplace_back( elem ); } - for( const tripoint_bub_ms &elem : here.points_in_radius( src_loc, PICKUP_RANGE - 1 ) ) { + for( const tripoint_bub_ms &elem : here.points_in_radius( src_loc, PICKUP_RANGE - 1, + PICKUP_RANGE - 1 ) ) { combined_spots.push_back( elem ); } add_basecamp_storage_to_loot_zone_list( mgr, src_loc, you, loot_zone_spots, combined_spots ); @@ -2808,7 +2810,8 @@ static requirement_check_result generic_multi_activity_check_requirement( local_src_set.push_back( here.bub_from_abs( elem ) ); } std::vector candidates; - for( const tripoint_bub_ms &point_elem : here.points_in_radius( src_loc, PICKUP_RANGE - 1 ) ) { + for( const tripoint_bub_ms &point_elem : here.points_in_radius( src_loc, PICKUP_RANGE - 1, + PICKUP_RANGE - 1 ) ) { // we don't want to place the components where they could interfere with our ( or someone else's ) construction spots if( !you.sees( point_elem ) || ( std::find( local_src_set.begin(), local_src_set.end(), point_elem ) != local_src_set.end() ) || !here.can_put_items_ter_furn( point_elem ) ) { diff --git a/src/clzones.cpp b/src/clzones.cpp index ac3197776387c..bc671f3020030 100644 --- a/src/clzones.cpp +++ b/src/clzones.cpp @@ -785,7 +785,7 @@ std::unordered_set zone_manager::get_point_set_loot( const tripoint_ab { std::unordered_set res; map &here = get_map(); - for( const tripoint &elem : here.points_in_radius( here.getlocal( where ), radius ) ) { + for( const tripoint &elem : here.points_in_radius( here.getlocal( where ), radius, radius ) ) { const zone_data *zone = get_zone_at( here.getglobal( elem ), true, fac ); if( zone == nullptr ) { continue; @@ -823,10 +823,8 @@ bool zone_manager::has_near( const zone_type_id &type, const tripoint_abs_ms &wh { const auto &point_set = get_point_set( type, fac ); for( const tripoint_abs_ms &point : point_set ) { - if( point.z() == where.z() ) { - if( square_dist( point, where ) <= range ) { - return true; - } + if( square_dist( point, where ) <= range ) { + return true; } } @@ -926,12 +924,10 @@ std::unordered_set zone_manager::get_near( const zone_type_id & std::unordered_set near_point_set; for( const tripoint_abs_ms &point : point_set ) { - if( point.z() == where.z() ) { - if( square_dist( point, where ) <= range ) { - if( ( type != zone_type_LOOT_CUSTOM && type != zone_type_LOOT_ITEM_GROUP ) || - ( it != nullptr && custom_loot_has( point, it, type, fac ) ) ) { - near_point_set.insert( point ); - } + if( square_dist( point, where ) <= range ) { + if( ( type != zone_type_LOOT_CUSTOM && type != zone_type_LOOT_ITEM_GROUP ) || + ( it != nullptr && custom_loot_has( point, it, type, fac ) ) ) { + near_point_set.insert( point ); } } }