mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'voxal/self_chat_bubbles' into 'master'
Allow players to see own speech bubbles. Closes #1291 See merge request veloren/veloren!3081
This commit is contained in:
commit
e12390b08b
@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Nightly linux Aarch64 builds are now produced (distribution via airshipper will follow soon)
|
||||
- Worldgen wildlife density modifier in features.ron
|
||||
- Rivers now make ambient sounds (again)
|
||||
- Added a setting to see own speech bubbles
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
"hud.settings.incoming_damage": "Incoming Damage",
|
||||
"hud.settings.cumulated_incoming_damage": "Cumulated Incoming Damage",
|
||||
"hud.settings.speech_bubble": "Speech Bubble",
|
||||
"hud.settings.speech_bubble_self": "Show Own Speech Bubbles",
|
||||
"hud.settings.speech_bubble_dark_mode": "Speech Bubble Dark Mode",
|
||||
"hud.settings.speech_bubble_icon": "Speech Bubble Icon",
|
||||
"hud.settings.energybar_numbers": "Energybar Numbers",
|
||||
@ -38,7 +39,7 @@
|
||||
"hud.settings.percentages": "Percentages",
|
||||
"hud.settings.chat": "Chat",
|
||||
"hud.settings.background_opacity": "Background Opacity",
|
||||
"hud.settings.chat_character_name": "Character Names in chat",
|
||||
"hud.settings.chat_character_name": "Character Names in Chat",
|
||||
"hud.settings.loading_tips": "Loading Screen Tips",
|
||||
"hud.settings.reset_interface": "Reset to Defaults",
|
||||
|
||||
|
@ -1797,8 +1797,7 @@ impl Hud {
|
||||
.join()
|
||||
.filter(|t| {
|
||||
let health = t.5;
|
||||
let entity = t.0;
|
||||
entity != me && !health.map_or(false, |h| h.is_dead)
|
||||
!health.map_or(false, |h| h.is_dead)
|
||||
})
|
||||
.filter_map(
|
||||
|(
|
||||
@ -1821,6 +1820,7 @@ impl Hud {
|
||||
// Use interpolated position if available
|
||||
let pos = interpolated.map_or(pos.0, |i| i.pos);
|
||||
let in_group = client.group_members().contains_key(uid);
|
||||
let is_me = entity == me;
|
||||
// TODO: once the site2 rework lands and merchants have dedicated stalls or
|
||||
// buildings, they no longer need to be emphasized via the higher overhead
|
||||
// text radius relative to other NPCs
|
||||
@ -1835,7 +1835,8 @@ impl Hud {
|
||||
|| info.selected_entity.map_or(false, |s| s.0 == entity)
|
||||
|| health.map_or(true, overhead::should_show_healthbar)
|
||||
|| in_group
|
||||
|| is_merchant)
|
||||
|| is_merchant
|
||||
|| !is_me)
|
||||
&& dist_sqr
|
||||
< (if in_group {
|
||||
NAMETAG_GROUP_RANGE
|
||||
@ -1866,7 +1867,10 @@ impl Hud {
|
||||
0.0
|
||||
},
|
||||
});
|
||||
let bubble = if dist_sqr < SPEECH_BUBBLE_RANGE.powi(2) {
|
||||
// Only render bubble if nearby or if its me and setting is on
|
||||
let bubble = if (dist_sqr < SPEECH_BUBBLE_RANGE.powi(2) && !is_me)
|
||||
|| (is_me && global_state.settings.interface.speech_bubble_self)
|
||||
{
|
||||
speech_bubbles.get(uid)
|
||||
} else {
|
||||
None
|
||||
|
@ -590,11 +590,11 @@ impl<'a> Widget for Overhead<'a> {
|
||||
self.imgs.nothing
|
||||
};
|
||||
Image::new(icon)
|
||||
.w_h(16.0, 16.0)
|
||||
.top_left_with_margin_on(state.ids.speech_bubble_text, -16.0)
|
||||
// TODO: Figure out whether this should be parented.
|
||||
// .parent(id)
|
||||
.set(state.ids.speech_bubble_icon, ui);
|
||||
.w_h(16.0, 16.0)
|
||||
.top_left_with_margin_on(state.ids.speech_bubble_text, -16.0)
|
||||
// TODO: Figure out whether this should be parented.
|
||||
// .parent(id)
|
||||
.set(state.ids.speech_bubble_icon, ui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,8 @@ widget_ids! {
|
||||
sct_batch_inc_radio,
|
||||
//
|
||||
speech_bubble_text,
|
||||
speech_bubble_self_text,
|
||||
speech_bubble_self_button,
|
||||
speech_bubble_dark_mode_text,
|
||||
speech_bubble_dark_mode_button,
|
||||
speech_bubble_icon_text,
|
||||
@ -846,7 +848,7 @@ impl<'a> Widget for Interface<'a> {
|
||||
.set(state.ids.sct_batch_inc_text, ui);
|
||||
}
|
||||
|
||||
// Speech bubble dark mode
|
||||
// Speech bubbles
|
||||
Text::new(self.localized_strings.get("hud.settings.speech_bubble"))
|
||||
.down_from(
|
||||
if self.global_state.settings.interface.sct {
|
||||
@ -862,12 +864,38 @@ impl<'a> Widget for Interface<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.speech_bubble_text, ui);
|
||||
|
||||
// Show own speech bubbles
|
||||
let speech_bubble_self = ToggleButton::new(
|
||||
self.global_state.settings.interface.speech_bubble_self,
|
||||
self.imgs.checkbox,
|
||||
self.imgs.checkbox_checked,
|
||||
)
|
||||
.down_from(state.ids.speech_bubble_text, 10.0)
|
||||
.w_h(18.0, 18.0)
|
||||
.hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
|
||||
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
|
||||
.set(state.ids.speech_bubble_self_button, ui);
|
||||
if self.global_state.settings.interface.speech_bubble_self != speech_bubble_self {
|
||||
events.push(SpeechBubbleSelf(speech_bubble_self));
|
||||
}
|
||||
Text::new(
|
||||
self.localized_strings
|
||||
.get("hud.settings.speech_bubble_self"),
|
||||
)
|
||||
.right_from(state.ids.speech_bubble_self_button, 10.0)
|
||||
.font_size(self.fonts.cyri.scale(15))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.speech_bubble_self_text, ui);
|
||||
|
||||
// Speech bubble dark mode
|
||||
let speech_bubble_dark_mode = ToggleButton::new(
|
||||
self.global_state.settings.interface.speech_bubble_dark_mode,
|
||||
self.imgs.checkbox,
|
||||
self.imgs.checkbox_checked,
|
||||
)
|
||||
.down_from(state.ids.speech_bubble_text, 10.0)
|
||||
.down_from(state.ids.speech_bubble_self_button, 10.0)
|
||||
.w_h(18.0, 18.0)
|
||||
.hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
|
||||
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
|
||||
|
@ -93,6 +93,7 @@ pub enum Interface {
|
||||
Sct(bool),
|
||||
SctPlayerBatch(bool),
|
||||
SctDamageBatch(bool),
|
||||
SpeechBubbleSelf(bool),
|
||||
SpeechBubbleDarkMode(bool),
|
||||
SpeechBubbleIcon(bool),
|
||||
ToggleHelp(bool),
|
||||
@ -436,6 +437,9 @@ impl SettingsChange {
|
||||
Interface::SctDamageBatch(sct_damage_batch) => {
|
||||
settings.interface.sct_damage_batch = sct_damage_batch;
|
||||
},
|
||||
Interface::SpeechBubbleSelf(sbdm) => {
|
||||
settings.interface.speech_bubble_self = sbdm;
|
||||
},
|
||||
Interface::SpeechBubbleDarkMode(sbdm) => {
|
||||
settings.interface.speech_bubble_dark_mode = sbdm;
|
||||
},
|
||||
|
@ -16,6 +16,7 @@ pub struct InterfaceSettings {
|
||||
pub sct: bool,
|
||||
pub sct_player_batch: bool,
|
||||
pub sct_damage_batch: bool,
|
||||
pub speech_bubble_self: bool,
|
||||
pub speech_bubble_dark_mode: bool,
|
||||
pub speech_bubble_icon: bool,
|
||||
pub crosshair_opacity: f32,
|
||||
@ -54,6 +55,7 @@ impl Default for InterfaceSettings {
|
||||
sct: true,
|
||||
sct_player_batch: false,
|
||||
sct_damage_batch: false,
|
||||
speech_bubble_self: true,
|
||||
speech_bubble_dark_mode: false,
|
||||
speech_bubble_icon: true,
|
||||
crosshair_opacity: 0.6,
|
||||
|
Loading…
Reference in New Issue
Block a user