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

Unsorted Strip Zones don't work for a 1x1 #56478

Closed
bombasticSlacks opened this issue Mar 30, 2022 · 3 comments · Fixed by #56483
Closed

Unsorted Strip Zones don't work for a 1x1 #56478

bombasticSlacks opened this issue Mar 30, 2022 · 3 comments · Fixed by #56483

Comments

@bombasticSlacks
Copy link
Contributor

Describe the bug

Unsorted Strip Zones don't work for a 1x1 with corpses in them and the player standing off to the side.

Steps to reproduce

kill a zombie
put a 1x1 unsorted zone under them
put a 1x1 strip zone under them
stand off to the side (standing on top doesn't replicate this)
hit sort

nothing will happen

Expected behavior

Really weird oddity, seems to not happen with personal zones and seems to happen only if off to the side. My guess is it's fast exiting because of some logic but I haven't looked closely.

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19042.1586 (20H2)
  • Game Version: 0.F-7173-gc36c86c941-dirty [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    No Fungal Growth [no_fungal_growth],
    Bionic Professions [package_bionic_professions]
    ]

Additional context

My dirty version is irrelevant, this was reported on the discord by @TheMurderUnicorn I'm just chronicling it to fix later.

@dseguin
Copy link
Member

dseguin commented Mar 30, 2022

Turns out it doesn't work because the check is expecting the distance between the player and the zone to be 0:

// if this item isn't going anywhere and its not sealed
// check if it is in a unload zone or a strip corpse zone
// then we should unload it and see what is inside
if( mgr.has_near( zone_type_zone_unload_all, abspos, 0 ) ||
( mgr.has_near( zone_type_zone_strip, abspos, 0 ) && it->first->is_corpse() ) ) {

There are 2 ways to fix this:


  1. Increase the range to 1, which works if the player is standing beside the zone:
diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp
index 8121b27393..0cef8c2fe1 100644
--- a/src/activity_item_handling.cpp
+++ b/src/activity_item_handling.cpp
@@ -2172,8 +2172,8 @@ void activity_on_turn_move_loot( player_activity &act, Character &you )
             // if this item isn't going anywhere and its not sealed
             // check if it is in a unload zone or a strip corpse zone
             // then we should unload it and see what is inside
-            if( mgr.has_near( zone_type_zone_unload_all, abspos, 0 ) ||
-                ( mgr.has_near( zone_type_zone_strip, abspos, 0 ) && it->first->is_corpse() ) ) {
+            if( mgr.has_near( zone_type_zone_unload_all, abspos, 1 ) ||
+                ( mgr.has_near( zone_type_zone_strip, abspos, 1 ) && it->first->is_corpse() ) ) {
                 if( dest_set.empty() && !it->first->is_container_empty() && !it->first->any_pockets_sealed() ) {
                     for( item *contained : it->first->all_items_top( item_pocket::pocket_type::CONTAINER ) ) {
                         // no liquids don't want to spill stuff

  1. Make the player move directly onto the zone if the zone is zone_strip:
diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp
index 8121b27393..7a841bfc0c 100644
--- a/src/activity_item_handling.cpp
+++ b/src/activity_item_handling.cpp
@@ -2056,7 +2056,8 @@ void activity_on_turn_move_loot( player_activity &act, Character &you )
             // adjacent to the loot source tile
             if( !is_adjacent_or_closer ) {
                 std::vector<tripoint> route;
-                bool adjacent = false;
+                // strip corpses zones require the player to actually be in the zone
+                bool adjacent = mgr.has( zone_type_zone_strip, src );
 
                 // get either direct route or route to nearest adjacent tile if
                 // source tile is impassable

Just putting the solutions out for you to decide, since I don't know which is better :P

@bombasticSlacks
Copy link
Contributor Author

you make it look easy LOL

@bombasticSlacks
Copy link
Contributor Author

I'd vote 1,

you wanna PR it for the cred, I can if you're too lazy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants