Inventory now highlights salvageable items when in salvage mode.

This commit is contained in:
Sam 2021-10-07 21:02:48 -04:00
parent b924ae9f54
commit dc24801ca1
3 changed files with 13 additions and 0 deletions

View File

@ -87,6 +87,7 @@ pub struct InventoryScroller<'a> {
is_us: bool,
inventory: &'a Inventory,
bg_ids: &'a BackgroundIds,
show_salvage: bool,
}
impl<'a> InventoryScroller<'a> {
@ -109,6 +110,7 @@ impl<'a> InventoryScroller<'a> {
is_us: bool,
inventory: &'a Inventory,
bg_ids: &'a BackgroundIds,
show_salvage: bool,
) -> Self {
InventoryScroller {
client,
@ -129,6 +131,7 @@ impl<'a> InventoryScroller<'a> {
is_us,
inventory,
bg_ids,
show_salvage,
}
}
@ -358,6 +361,10 @@ impl<'a> InventoryScroller<'a> {
slot_widget = slot_widget.with_background_color(Color::Rgba(1.0, 1.0, 1.0, 1.0));
}
if self.show_salvage && item.as_ref().map_or(false, |item| item.is_salvageable()) {
slot_widget = slot_widget.with_background_color(Color::Rgba(1.0, 1.0, 1.0, 1.0));
}
if let Some(item) = item {
let quality_col_img = match item.quality() {
Quality::Low => self.imgs.inv_slot_grey,
@ -727,6 +734,7 @@ impl<'a> Widget for Bag<'a> {
true,
inventory,
&state.bg_ids,
self.show.salvage,
)
.set(state.ids.inventory_scroller, ui);

View File

@ -657,6 +657,7 @@ pub struct Show {
prompt_dialog: Option<PromptDialogSettings>,
location_marker: Option<Vec2<f32>>,
map_marker: bool,
salvage: bool,
}
impl Show {
fn bag(&mut self, open: bool) {
@ -1036,6 +1037,7 @@ impl Hud {
prompt_dialog: None,
location_marker: None,
map_marker: false,
salvage: false,
},
to_focus: None,
//never_show: false,
@ -1077,6 +1079,8 @@ impl Hud {
camera: &Camera,
interactable: Option<Interactable>,
) -> Vec<Event> {
self.show.salvage =
self.show.crafting && matches!(self.show.crafting_tab, CraftingTab::Dismantle);
span!(_guard, "update_layout", "Hud::update_layout");
let mut events = core::mem::take(&mut self.events);
if global_state.settings.interface.map_show_voxel_map {

View File

@ -326,6 +326,7 @@ impl<'a> Trade<'a> {
false,
inventory,
&state.bg_ids,
false,
)
.set(state.ids.inventory_scroller, ui);
}