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:
@ -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)
|
- Nightly linux Aarch64 builds are now produced (distribution via airshipper will follow soon)
|
||||||
- Worldgen wildlife density modifier in features.ron
|
- Worldgen wildlife density modifier in features.ron
|
||||||
- Rivers now make ambient sounds (again)
|
- Rivers now make ambient sounds (again)
|
||||||
|
- Added a setting to see own speech bubbles
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
"hud.settings.incoming_damage": "Incoming Damage",
|
"hud.settings.incoming_damage": "Incoming Damage",
|
||||||
"hud.settings.cumulated_incoming_damage": "Cumulated Incoming Damage",
|
"hud.settings.cumulated_incoming_damage": "Cumulated Incoming Damage",
|
||||||
"hud.settings.speech_bubble": "Speech Bubble",
|
"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_dark_mode": "Speech Bubble Dark Mode",
|
||||||
"hud.settings.speech_bubble_icon": "Speech Bubble Icon",
|
"hud.settings.speech_bubble_icon": "Speech Bubble Icon",
|
||||||
"hud.settings.energybar_numbers": "Energybar Numbers",
|
"hud.settings.energybar_numbers": "Energybar Numbers",
|
||||||
@ -38,7 +39,7 @@
|
|||||||
"hud.settings.percentages": "Percentages",
|
"hud.settings.percentages": "Percentages",
|
||||||
"hud.settings.chat": "Chat",
|
"hud.settings.chat": "Chat",
|
||||||
"hud.settings.background_opacity": "Background Opacity",
|
"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.loading_tips": "Loading Screen Tips",
|
||||||
"hud.settings.reset_interface": "Reset to Defaults",
|
"hud.settings.reset_interface": "Reset to Defaults",
|
||||||
|
|
||||||
|
@ -1797,8 +1797,7 @@ impl Hud {
|
|||||||
.join()
|
.join()
|
||||||
.filter(|t| {
|
.filter(|t| {
|
||||||
let health = t.5;
|
let health = t.5;
|
||||||
let entity = t.0;
|
!health.map_or(false, |h| h.is_dead)
|
||||||
entity != me && !health.map_or(false, |h| h.is_dead)
|
|
||||||
})
|
})
|
||||||
.filter_map(
|
.filter_map(
|
||||||
|(
|
|(
|
||||||
@ -1821,6 +1820,7 @@ impl Hud {
|
|||||||
// Use interpolated position if available
|
// Use interpolated position if available
|
||||||
let pos = interpolated.map_or(pos.0, |i| i.pos);
|
let pos = interpolated.map_or(pos.0, |i| i.pos);
|
||||||
let in_group = client.group_members().contains_key(uid);
|
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
|
// TODO: once the site2 rework lands and merchants have dedicated stalls or
|
||||||
// buildings, they no longer need to be emphasized via the higher overhead
|
// buildings, they no longer need to be emphasized via the higher overhead
|
||||||
// text radius relative to other NPCs
|
// text radius relative to other NPCs
|
||||||
@ -1835,7 +1835,8 @@ impl Hud {
|
|||||||
|| info.selected_entity.map_or(false, |s| s.0 == entity)
|
|| info.selected_entity.map_or(false, |s| s.0 == entity)
|
||||||
|| health.map_or(true, overhead::should_show_healthbar)
|
|| health.map_or(true, overhead::should_show_healthbar)
|
||||||
|| in_group
|
|| in_group
|
||||||
|| is_merchant)
|
|| is_merchant
|
||||||
|
|| !is_me)
|
||||||
&& dist_sqr
|
&& dist_sqr
|
||||||
< (if in_group {
|
< (if in_group {
|
||||||
NAMETAG_GROUP_RANGE
|
NAMETAG_GROUP_RANGE
|
||||||
@ -1866,7 +1867,10 @@ impl Hud {
|
|||||||
0.0
|
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)
|
speech_bubbles.get(uid)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -590,11 +590,11 @@ impl<'a> Widget for Overhead<'a> {
|
|||||||
self.imgs.nothing
|
self.imgs.nothing
|
||||||
};
|
};
|
||||||
Image::new(icon)
|
Image::new(icon)
|
||||||
.w_h(16.0, 16.0)
|
.w_h(16.0, 16.0)
|
||||||
.top_left_with_margin_on(state.ids.speech_bubble_text, -16.0)
|
.top_left_with_margin_on(state.ids.speech_bubble_text, -16.0)
|
||||||
// TODO: Figure out whether this should be parented.
|
// TODO: Figure out whether this should be parented.
|
||||||
// .parent(id)
|
// .parent(id)
|
||||||
.set(state.ids.speech_bubble_icon, ui);
|
.set(state.ids.speech_bubble_icon, ui);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,8 @@ widget_ids! {
|
|||||||
sct_batch_inc_radio,
|
sct_batch_inc_radio,
|
||||||
//
|
//
|
||||||
speech_bubble_text,
|
speech_bubble_text,
|
||||||
|
speech_bubble_self_text,
|
||||||
|
speech_bubble_self_button,
|
||||||
speech_bubble_dark_mode_text,
|
speech_bubble_dark_mode_text,
|
||||||
speech_bubble_dark_mode_button,
|
speech_bubble_dark_mode_button,
|
||||||
speech_bubble_icon_text,
|
speech_bubble_icon_text,
|
||||||
@ -846,7 +848,7 @@ impl<'a> Widget for Interface<'a> {
|
|||||||
.set(state.ids.sct_batch_inc_text, ui);
|
.set(state.ids.sct_batch_inc_text, ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Speech bubble dark mode
|
// Speech bubbles
|
||||||
Text::new(self.localized_strings.get("hud.settings.speech_bubble"))
|
Text::new(self.localized_strings.get("hud.settings.speech_bubble"))
|
||||||
.down_from(
|
.down_from(
|
||||||
if self.global_state.settings.interface.sct {
|
if self.global_state.settings.interface.sct {
|
||||||
@ -862,12 +864,38 @@ impl<'a> Widget for Interface<'a> {
|
|||||||
.font_id(self.fonts.cyri.conrod_id)
|
.font_id(self.fonts.cyri.conrod_id)
|
||||||
.color(TEXT_COLOR)
|
.color(TEXT_COLOR)
|
||||||
.set(state.ids.speech_bubble_text, ui);
|
.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(
|
let speech_bubble_dark_mode = ToggleButton::new(
|
||||||
self.global_state.settings.interface.speech_bubble_dark_mode,
|
self.global_state.settings.interface.speech_bubble_dark_mode,
|
||||||
self.imgs.checkbox,
|
self.imgs.checkbox,
|
||||||
self.imgs.checkbox_checked,
|
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)
|
.w_h(18.0, 18.0)
|
||||||
.hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
|
.hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo)
|
||||||
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
|
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
|
||||||
|
@ -93,6 +93,7 @@ pub enum Interface {
|
|||||||
Sct(bool),
|
Sct(bool),
|
||||||
SctPlayerBatch(bool),
|
SctPlayerBatch(bool),
|
||||||
SctDamageBatch(bool),
|
SctDamageBatch(bool),
|
||||||
|
SpeechBubbleSelf(bool),
|
||||||
SpeechBubbleDarkMode(bool),
|
SpeechBubbleDarkMode(bool),
|
||||||
SpeechBubbleIcon(bool),
|
SpeechBubbleIcon(bool),
|
||||||
ToggleHelp(bool),
|
ToggleHelp(bool),
|
||||||
@ -436,6 +437,9 @@ impl SettingsChange {
|
|||||||
Interface::SctDamageBatch(sct_damage_batch) => {
|
Interface::SctDamageBatch(sct_damage_batch) => {
|
||||||
settings.interface.sct_damage_batch = sct_damage_batch;
|
settings.interface.sct_damage_batch = sct_damage_batch;
|
||||||
},
|
},
|
||||||
|
Interface::SpeechBubbleSelf(sbdm) => {
|
||||||
|
settings.interface.speech_bubble_self = sbdm;
|
||||||
|
},
|
||||||
Interface::SpeechBubbleDarkMode(sbdm) => {
|
Interface::SpeechBubbleDarkMode(sbdm) => {
|
||||||
settings.interface.speech_bubble_dark_mode = sbdm;
|
settings.interface.speech_bubble_dark_mode = sbdm;
|
||||||
},
|
},
|
||||||
|
@ -16,6 +16,7 @@ pub struct InterfaceSettings {
|
|||||||
pub sct: bool,
|
pub sct: bool,
|
||||||
pub sct_player_batch: bool,
|
pub sct_player_batch: bool,
|
||||||
pub sct_damage_batch: bool,
|
pub sct_damage_batch: bool,
|
||||||
|
pub speech_bubble_self: bool,
|
||||||
pub speech_bubble_dark_mode: bool,
|
pub speech_bubble_dark_mode: bool,
|
||||||
pub speech_bubble_icon: bool,
|
pub speech_bubble_icon: bool,
|
||||||
pub crosshair_opacity: f32,
|
pub crosshair_opacity: f32,
|
||||||
@ -54,6 +55,7 @@ impl Default for InterfaceSettings {
|
|||||||
sct: true,
|
sct: true,
|
||||||
sct_player_batch: false,
|
sct_player_batch: false,
|
||||||
sct_damage_batch: false,
|
sct_damage_batch: false,
|
||||||
|
speech_bubble_self: true,
|
||||||
speech_bubble_dark_mode: false,
|
speech_bubble_dark_mode: false,
|
||||||
speech_bubble_icon: true,
|
speech_bubble_icon: true,
|
||||||
crosshair_opacity: 0.6,
|
crosshair_opacity: 0.6,
|
||||||
|
Reference in New Issue
Block a user