Skip to content

Commit

Permalink
Render overlays for ablative pockets, so NVG works again
Browse files Browse the repository at this point in the history
Return overlays for "worn" ablative pockets. This allow tiles to render
NVG again, an enable other use cases like chainmain + brigantine.
  • Loading branch information
andrewhr committed Jan 11, 2025
1 parent 5f3e1f5 commit 44c6f13
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/character_attire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1818,19 +1818,28 @@ bool outfit::can_pickVolume( const item &it, const bool ignore_pkt_settings,
return false;
}

static void add_overlay_id_or_override( const item &item,
std::vector<std::pair<std::string, std::string>> &overlay_ids )
{
if( item.has_var( "sprite_override" ) ) {
overlay_ids.emplace_back( "worn_" + item.get_var( "sprite_override" ),
item.get_var( "sprite_override_variant", "" ) );
} else {
const std::string variant = item.has_itype_variant() ? item.itype_variant().id : "";
overlay_ids.emplace_back( "worn_" + item.typeId().str(), variant );
}
}

void outfit::get_overlay_ids( std::vector<std::pair<std::string, std::string>> &overlay_ids ) const
{
// TODO: worry about correct order of clothing overlays
for( const item &worn_item : worn ) {
if( worn_item.has_flag( json_flag_HIDDEN ) ) {
continue;
}
if( worn_item.has_var( "sprite_override" ) ) {
overlay_ids.emplace_back( "worn_" + worn_item.get_var( "sprite_override" ),
worn_item.get_var( "sprite_override_variant", "" ) );
} else {
const std::string variant = worn_item.has_itype_variant() ? worn_item.itype_variant().id : "";
overlay_ids.emplace_back( "worn_" + worn_item.typeId().str(), variant );
add_overlay_id_or_override( worn_item, overlay_ids );
for( const item *ablative : worn_item.all_ablative_armor() ) {
add_overlay_id_or_override( *ablative, overlay_ids );
}
}
}
Expand Down

0 comments on commit 44c6f13

Please sign in to comment.