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

Loot sorting: stop moving crafts in progress #79279

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2021,6 +2021,20 @@ void activity_on_turn_move_loot( player_activity &act, Character &you )
map &here = get_map();
const tripoint_abs_ms abspos = you.pos_abs();
zone_manager &mgr = zone_manager::get_manager();

std::vector<const item *> crafting_items;

for( const npc &guy : g->all_npcs() ) {
if( !guy.activity.targets.empty() ) {
for( const item_location &target : guy.activity.targets ) {
crafting_items.push_back( target.get_item() );
}
}
}
for( const item_location &target : get_player_character().activity.targets ) {
crafting_items.push_back( target.get_item() );
}

if( here.check_vehicle_zones( here.get_abs_sub().z() ) ) {
mgr.cache_vzones();
}
Expand Down Expand Up @@ -2155,6 +2169,16 @@ void activity_on_turn_move_loot( player_activity &act, Character &you )
break;
}

// don't steal disassembly in progress
if( it->has_var( "activity_var" ) ) {
continue;
}

// don't steal crafts in progress
if( std::find( crafting_items.begin(), crafting_items.end(), it ) != crafting_items.end() ) {
continue;
}

// skip items that allready sorted
if( zone_type_id != zone_type_LOOT_CUSTOM && mgr.has( zone_type_id, src, _fac_id( you ) ) ) {
continue;
Expand Down Expand Up @@ -2328,6 +2352,16 @@ void activity_on_turn_move_loot( player_activity &act, Character &you )
continue;
}

// don't steal disassembly in progress
if( thisitem.has_var( "activity_var" ) ) {
continue;
}
// don't steal crafts in progress
if( std::find( crafting_items.begin(), crafting_items.end(), it->first ) != crafting_items.end() ) {
continue;
}


// Only if it's from a vehicle do we use the vehicle source location information.
const std::optional<vpart_reference> vpr_src = it->second ? vpr : std::nullopt;
const zone_type_id id = mgr.get_near_zone_type_for_item( thisitem, abspos,
Expand Down
Loading