Skip to content

Commit

Permalink
Allow zones to interact across multiple Z levels (CleverRaven#65613)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
FatigueDev and github-actions[bot] authored May 15, 2023
1 parent 01ecf00 commit d850b5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
9 changes: 6 additions & 3 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<vpart_reference> &vp = here.veh_at( elem ).part_with_tool( itype_welder );

if( vp ) {
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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<tripoint_bub_ms> 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 ) ) {
Expand Down
18 changes: 7 additions & 11 deletions src/clzones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ std::unordered_set<tripoint> zone_manager::get_point_set_loot( const tripoint_ab
{
std::unordered_set<tripoint> 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;
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -926,12 +924,10 @@ std::unordered_set<tripoint_abs_ms> zone_manager::get_near( const zone_type_id &
std::unordered_set<tripoint_abs_ms> 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 );
}
}
}
Expand Down

0 comments on commit d850b5f

Please sign in to comment.