Show HUD for campfires

This commit is contained in:
ubruntu 2022-01-23 19:25:11 +00:00 committed by Joshua Barretto
parent 9b85a01df6
commit ca2a81c20f
3 changed files with 44 additions and 0 deletions

View File

@ -19,6 +19,7 @@
"hud.crafting.spinning_wheel": "Spinning Wheel",
"hud.crafting.tanning_rack": "Tanning Rack",
"hud.crafting.salvaging_station": "Salvaging Bench",
"hud.crafting.campfire": "Campfire",
// Tabs
"hud.crafting.tabs.all": "All",
"hud.crafting.tabs.armor": "Armor",

View File

@ -54,6 +54,7 @@ Whenever you feel ready, try to get even better equipment from the many challeng
"hud.talk": "Talk",
"hud.trade": "Trade",
"hud.mount": "Mount",
"hud.sit": "Sit",
},

View File

@ -1797,6 +1797,48 @@ impl Hud {
.position_ingame(over_pos)
.set(overitem_id, ui_widgets);
}
} else if let Some(Interactable::Entity(e)) = interactable {
// show hud for campfire
if client
.state()
.ecs()
.read_storage::<comp::Body>()
.get(e)
.map_or(false, |b| b.is_campfire())
{
let overitem_id = overitem_walker.next(
&mut self.ids.overitems,
&mut ui_widgets.widget_id_generator(),
);
let overitem_properties = overitem::OveritemProperties {
active: true,
pickup_failed_pulse: None,
};
let pos = client
.state()
.ecs()
.read_storage::<comp::Pos>()
.get(e)
.map_or(Vec3::zero(), |e| e.0);
let over_pos = pos + Vec3::unit_z() * 1.5;
overitem::Overitem::new(
i18n.get("hud.crafting.campfire").into(),
overitem::TEXT_COLOR,
pos.distance_squared(player_pos),
&self.fonts,
i18n,
&global_state.settings.controls,
overitem_properties,
self.pulse,
&global_state.window.key_layout,
vec![(GameInput::Interact, i18n.get("hud.sit").to_string())],
)
.x_y(0.0, 100.0)
.position_ingame(over_pos)
.set(overitem_id, ui_widgets);
}
}
let speech_bubbles = &self.speech_bubbles;