timeout visuals, various small fixes and two new items

This commit is contained in:
Monty Marz 2020-08-04 09:22:59 +02:00
parent 543d971a19
commit 28a8f847cc
20 changed files with 140 additions and 70 deletions

View File

@ -5,7 +5,7 @@ Item(
( (
kind: Back("Short0"), kind: Back("Short0"),
stats: ( stats: (
protection: Normal(0.0), protection: Normal(0.2),
), ),
) )
), ),

View File

@ -0,0 +1,12 @@
Item(
name: "Green Blanket",
description: "Keeps your shoulders warm.",
kind: Armor(
(
kind: Back("Short1"),
stats: (
protection: Normal(0.1),
),
)
),
)

View File

@ -0,0 +1,12 @@
Item(
name: "Gem of lesser Protection",
description: "Surrounded by a discrete magical glow.",
kind: Armor(
(
kind: Neck("Neck1"),
stats: (
protection: Normal(0.5),
),
)
),
)

View File

@ -1,6 +1,6 @@
Item( Item(
name: "Uneven Bow", name: "Uneven Bow",
description: "Someone carved his initials into it.", description: "Someone carved their initials into it.",
kind: Tool( kind: Tool(
( (
kind: Bow("ShortBow0"), kind: Bow("ShortBow0"),

View File

@ -230,6 +230,8 @@
(0.6, "common.items.armor.ring.ring_0"), (0.6, "common.items.armor.ring.ring_0"),
// capes // capes
(0.6, "common.items.armor.back.short_0"), (0.6, "common.items.armor.back.short_0"),
(0.7, "common.items.armor.back.short_1"),
// necks // necks
(0.6, "common.items.armor.neck.neck_0"), (0.6, "common.items.armor.neck.neck_0"),
(0.4, "common.items.armor.neck.neck_1"),
] ]

BIN
assets/voxygen/element/icons/neck-0.png (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/element/icons/neck-1.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -336,6 +336,7 @@ magically infused items?"#,
"hud.group.add_friend": "Add to Friends", "hud.group.add_friend": "Add to Friends",
"hud.group.link_group": "Link Groups", "hud.group.link_group": "Link Groups",
"hud.group.in_menu": "In Menu", "hud.group.in_menu": "In Menu",
"hud.group.members": "Group Members",
"hud.spell": "Spells", "hud.spell": "Spells",
@ -471,6 +472,7 @@ Protection
"Veloren is still in Pre-Alpha. We do our best to improve it every day!", "Veloren is still in Pre-Alpha. We do our best to improve it every day!",
"If you want to join the Dev-Team or just have a chat with us join our Discord-Server.", "If you want to join the Dev-Team or just have a chat with us join our Discord-Server.",
"You can toggle showing your amount of health on the healthbar in the settings.", "You can toggle showing your amount of health on the healthbar in the settings.",
"In order to see your stats click the 'Stats' button in your inventory.",
], ],
"npc.speech.villager_under_attack": [ "npc.speech.villager_under_attack": [
"Help, I'm under attack!", "Help, I'm under attack!",

View File

@ -1016,6 +1016,10 @@
Armor(Back("Short0")): VoxTrans( Armor(Back("Short0")): VoxTrans(
"voxel.armor.back.short-0", "voxel.armor.back.short-0",
(0.0, 0.0, 0.0), (-90.0, 180.0, 0.0), 1.0, (0.0, 0.0, 0.0), (-90.0, 180.0, 0.0), 1.0,
),
Armor(Back("Short1")): VoxTrans(
"voxel.armor.back.short-1",
(0.0, -2.0, 0.0), (-90.0, 180.0, 0.0), 1.0,
), ),
Armor(Back("Admin")): VoxTrans( Armor(Back("Admin")): VoxTrans(
"voxel.armor.back.admin", "voxel.armor.back.admin",
@ -1033,6 +1037,9 @@
Armor(Neck("Neck0")): Png( Armor(Neck("Neck0")): Png(
"element.icons.neck-0", "element.icons.neck-0",
), ),
Armor(Neck("Neck1")): Png(
"element.icons.neck-1",
),
// Tabards // Tabards
Armor(Tabard("Admin")): Png( Armor(Tabard("Admin")): Png(
"element.icons.tabard_admin", "element.icons.tabard_admin",

BIN
assets/voxygen/voxel/armor/back/short-1.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -16,5 +16,9 @@
vox_spec: ("armor.back.dung_purp-0", (-5.0, -1.0, -14.0)), vox_spec: ("armor.back.dung_purp-0", (-5.0, -1.0, -14.0)),
color: None color: None
), ),
"Short1": (
vox_spec: ("armor.back.short-1", (-5.0, -1.0, -11.0)),
color: None
),
}, },
)) ))

View File

@ -145,6 +145,7 @@ impl GroupManager {
// Add someone to a group // Add someone to a group
// Also used to create new groups // Also used to create new groups
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn add_group_member( pub fn add_group_member(
&mut self, &mut self,
leader: specs::Entity, leader: specs::Entity,
@ -241,6 +242,7 @@ impl GroupManager {
}); });
} }
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn new_pet( pub fn new_pet(
&mut self, &mut self,
pet: specs::Entity, pet: specs::Entity,
@ -319,6 +321,7 @@ impl GroupManager {
// Remove someone from a group if they are in one // Remove someone from a group if they are in one
// Don't need to check if they are in a group before calling this // Don't need to check if they are in a group before calling this
// Also removes pets (ie call this if the pet no longer exists) // Also removes pets (ie call this if the pet no longer exists)
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
fn remove_from_group( fn remove_from_group(
&mut self, &mut self,
member: specs::Entity, member: specs::Entity,

View File

@ -54,7 +54,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
if client.invited_to_group.is_some() { if client.invited_to_group.is_some() {
already_has_invite = true; already_has_invite = true;
} else { } else {
client.notify(ServerMsg::GroupInvite((*inviter_uid).into())); client.notify(ServerMsg::GroupInvite((*inviter_uid)));
client.invited_to_group = Some(entity); client.invited_to_group = Some(entity);
} }
// Would be cool to do this in agent system (e.g. add an invited // Would be cool to do this in agent system (e.g. add an invited
@ -71,10 +71,8 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
.ecs() .ecs()
.write_storage() .write_storage()
.insert(invitee, comp::Agent::default()); .insert(invitee, comp::Agent::default());
} else { } else if let Some(client) = clients.get_mut(entity) {
if let Some(client) = clients.get_mut(entity) { client.notify(ChatType::Meta.server_msg("Invite rejected".to_owned()));
client.notify(ChatType::Meta.server_msg("Invite rejected".to_owned()));
}
} }
if already_has_invite { if already_has_invite {

View File

@ -261,7 +261,7 @@ impl StateExt for State {
| comp::ChatType::Kill | comp::ChatType::Kill
| comp::ChatType::Meta | comp::ChatType::Meta
| comp::ChatType::World(_) => { | comp::ChatType::World(_) => {
self.notify_registered_clients(ServerMsg::ChatMsg(resolved_msg.clone())) self.notify_registered_clients(ServerMsg::ChatMsg(resolved_msg))
}, },
comp::ChatType::Tell(u, t) => { comp::ChatType::Tell(u, t) => {
for (client, uid) in ( for (client, uid) in (

View File

@ -585,7 +585,7 @@ impl<'a> Widget for Bag<'a> {
"{}\n\n{}\n\n{}\n\n{}%", "{}\n\n{}\n\n{}\n\n{}%",
self.stats.endurance, self.stats.fitness, self.stats.willpower, damage_reduction self.stats.endurance, self.stats.fitness, self.stats.willpower, damage_reduction
)) ))
.top_right_with_margins_on(state.ids.stats_alignment, 120.0, 150.0) .top_right_with_margins_on(state.ids.stats_alignment, 120.0, 130.0)
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(16)) .font_size(self.fonts.cyri.scale(16))
.color(TEXT_COLOR) .color(TEXT_COLOR)

View File

@ -1,15 +1,11 @@
use super::{ use super::{
img_ids::{Imgs, ImgsRot}, img_ids::Imgs, Show, BLACK, GROUP_COLOR, HP_COLOR, KILL_COLOR, LOW_HP_COLOR, MANA_COLOR,
Show, BLACK, GROUP_COLOR, HP_COLOR, KILL_COLOR, LOW_HP_COLOR, MANA_COLOR, TEXT_COLOR, TEXT_COLOR, TEXT_COLOR_GREY, UI_HIGHLIGHT_0, UI_MAIN,
TEXT_COLOR_GREY, UI_HIGHLIGHT_0,
}; };
use crate::{ use crate::{
i18n::VoxygenLocalization, i18n::VoxygenLocalization, settings::Settings, ui::fonts::ConrodVoxygenFonts,
settings::Settings, window::GameInput, GlobalState,
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
window::GameInput,
GlobalState,
}; };
use client::{self, Client}; use client::{self, Client};
use common::{ use common::{
@ -51,6 +47,8 @@ widget_ids! {
member_stam[], member_stam[],
dead_txt[], dead_txt[],
health_txt[], health_txt[],
timeout_bg,
timeout,
} }
} }
@ -60,7 +58,6 @@ pub struct State {
selected_member: Option<Uid>, selected_member: Option<Uid>,
} }
const TOOLTIP_UPSHIFT: f64 = 40.0;
#[derive(WidgetCommon)] #[derive(WidgetCommon)]
pub struct Group<'a> { pub struct Group<'a> {
show: &'a mut Show, show: &'a mut Show,
@ -69,8 +66,6 @@ pub struct Group<'a> {
imgs: &'a Imgs, imgs: &'a Imgs,
fonts: &'a ConrodVoxygenFonts, fonts: &'a ConrodVoxygenFonts,
localized_strings: &'a std::sync::Arc<VoxygenLocalization>, localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
tooltip_manager: &'a mut TooltipManager,
rot_imgs: &'a ImgsRot,
pulse: f32, pulse: f32,
global_state: &'a GlobalState, global_state: &'a GlobalState,
@ -79,6 +74,7 @@ pub struct Group<'a> {
} }
impl<'a> Group<'a> { impl<'a> Group<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn new( pub fn new(
show: &'a mut Show, show: &'a mut Show,
client: &'a Client, client: &'a Client,
@ -86,8 +82,6 @@ impl<'a> Group<'a> {
imgs: &'a Imgs, imgs: &'a Imgs,
fonts: &'a ConrodVoxygenFonts, fonts: &'a ConrodVoxygenFonts,
localized_strings: &'a std::sync::Arc<VoxygenLocalization>, localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
tooltip_manager: &'a mut TooltipManager,
rot_imgs: &'a ImgsRot,
pulse: f32, pulse: f32,
global_state: &'a GlobalState, global_state: &'a GlobalState,
) -> Self { ) -> Self {
@ -96,8 +90,6 @@ impl<'a> Group<'a> {
client, client,
settings, settings,
imgs, imgs,
rot_imgs,
tooltip_manager,
fonts, fonts,
localized_strings, localized_strings,
pulse, pulse,
@ -127,37 +119,17 @@ impl<'a> Widget for Group<'a> {
} }
} }
#[allow(clippy::unused_unit)] // TODO: Pending review in #587 #[allow(clippy::blocks_in_if_conditions)] // TODO: Pending review in #587
fn style(&self) -> Self::Style { () } fn style(&self) -> Self::Style { () }
//TODO: Disband groups when there's only one member in them //TODO: Disband groups when there's only one member in them
//TODO: Always send health, energy, level and position of group members to the //TODO: Always send health, energy, level and position of group members to the
// client // client
#[allow(clippy::unused_unit)] // TODO: Pending review in #587
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event { fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
let widget::UpdateArgs { state, ui, .. } = args; let widget::UpdateArgs { state, ui, .. } = args;
let mut events = Vec::new(); let mut events = Vec::new();
let localized_strings = self.localized_strings;
let button_tooltip = Tooltip::new({
// Edge images [t, b, r, l]
// Corner images [tr, tl, br, bl]
let edge = &self.rot_imgs.tt_side;
let corner = &self.rot_imgs.tt_corner;
ImageFrame::new(
[edge.cw180, edge.none, edge.cw270, edge.cw90],
[corner.none, corner.cw270, corner.cw90, corner.cw180],
Color::Rgba(0.08, 0.07, 0.04, 1.0),
5.0,
)
})
.title_font_size(self.fonts.cyri.scale(15))
.parent(ui.window)
.desc_font_size(self.fonts.cyri.scale(12))
.title_text_color(TEXT_COLOR)
.font_id(self.fonts.cyri.conrod_id)
.desc_text_color(TEXT_COLOR);
// Don't show pets // Don't show pets
let group_members = self let group_members = self
@ -217,6 +189,20 @@ impl<'a> Widget for Group<'a> {
.w_h(49.0, 26.0) .w_h(49.0, 26.0)
.bottom_left_with_margins_on(ui.window, 190.0, 10.0) .bottom_left_with_margins_on(ui.window, 190.0, 10.0)
.set(state.ids.group_button, ui); .set(state.ids.group_button, ui);
// Show timeout bar
let max_time = 90.0;
let time = 50.0;
let progress_perc = time / max_time;
Image::new(self.imgs.progress_frame)
.w_h(100.0, 10.0)
.middle_of(state.ids.bg)
.color(Some(UI_MAIN))
.set(state.ids.timeout_bg, ui);
Image::new(self.imgs.progress)
.w_h(98.0 * progress_perc, 8.0)
.top_left_with_margins_on(state.ids.timeout_bg, 1.0, 1.0)
.color(Some(UI_HIGHLIGHT_0))
.set(state.ids.timeout, ui);
} }
// Buttons // Buttons
if let Some((group_name, leader)) = self.client.group_info().filter(|_| in_group) { if let Some((group_name, leader)) = self.client.group_info().filter(|_| in_group) {
@ -230,13 +216,6 @@ impl<'a> Widget for Group<'a> {
.bottom_left_with_margins_on(ui.window, 190.0, 10.0) .bottom_left_with_margins_on(ui.window, 190.0, 10.0)
.hover_image(self.imgs.group_icon_hover) .hover_image(self.imgs.group_icon_hover)
.press_image(self.imgs.group_icon_press) .press_image(self.imgs.group_icon_press)
.with_tooltip(
self.tooltip_manager,
&localized_strings.get("hud.group"),
"",
&button_tooltip,
)
.bottom_offset(TOOLTIP_UPSHIFT)
.set(state.ids.group_button, ui) .set(state.ids.group_button, ui)
.was_clicked() .was_clicked()
{ {
@ -319,7 +298,7 @@ impl<'a> Widget for Group<'a> {
// change panel positions when debug info is shown // change panel positions when debug info is shown
let offset = if self.global_state.settings.gameplay.toggle_debug { let offset = if self.global_state.settings.gameplay.toggle_debug {
210.0 240.0
} else { } else {
110.0 110.0
}; };

View File

@ -1933,8 +1933,9 @@ impl Hud {
&self.imgs, &self.imgs,
&self.fonts, &self.fonts,
&self.voxygen_i18n, &self.voxygen_i18n,
//&stats,
info.selected_entity, info.selected_entity,
&self.rot_imgs,
tooltip_manager,
) )
.set(self.ids.social_window, ui_widgets) .set(self.ids.social_window, ui_widgets)
{ {
@ -1959,8 +1960,6 @@ impl Hud {
&self.imgs, &self.imgs,
&self.fonts, &self.fonts,
&self.voxygen_i18n, &self.voxygen_i18n,
tooltip_manager,
&self.rot_imgs,
self.pulse, self.pulse,
&global_state, &global_state,
) )

View File

@ -148,12 +148,15 @@ impl<'a> Widget for Overhead<'a> {
const MANA_BAR_Y: f64 = MANA_BAR_HEIGHT / 2.0; const MANA_BAR_Y: f64 = MANA_BAR_HEIGHT / 2.0;
let hp_percentage = let hp_percentage =
self.stats.health.current() as f64 / self.stats.health.maximum() as f64 * 100.0; self.stats.health.current() as f64 / self.stats.health.maximum() as f64 * 100.0;
let name_y = if hp_percentage == 100.0 { let level_comp = self.stats.level.level() as i64 - self.own_level as i64;
MANA_BAR_Y + 10.0 let name_y = if hp_percentage.abs() > 99.9 {
MANA_BAR_Y + 20.0
} else if level_comp > 9 {
MANA_BAR_Y + 38.0
} else { } else {
MANA_BAR_Y + 32.0 MANA_BAR_Y + 32.0
}; };
let font_size = if hp_percentage == 100.0 { 24 } else { 20 }; let font_size = if hp_percentage.abs() > 99.9 { 24 } else { 20 };
// Name // Name
Text::new(&self.name) Text::new(&self.name)
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)

View File

@ -1,6 +1,12 @@
use super::{img_ids::Imgs, Show, TEXT_COLOR, TEXT_COLOR_3, UI_HIGHLIGHT_0, UI_MAIN}; use super::{
img_ids::{Imgs, ImgsRot},
Show, TEXT_COLOR, TEXT_COLOR_3, UI_HIGHLIGHT_0, UI_MAIN,
};
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts}; use crate::{
i18n::VoxygenLocalization,
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
};
use client::{self, Client}; use client::{self, Client};
use common::sync::Uid; use common::sync::Uid;
use conrod_core::{ use conrod_core::{
@ -63,30 +69,34 @@ pub struct Social<'a> {
imgs: &'a Imgs, imgs: &'a Imgs,
fonts: &'a ConrodVoxygenFonts, fonts: &'a ConrodVoxygenFonts,
localized_strings: &'a std::sync::Arc<VoxygenLocalization>, localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
//stats: &'a Stats,
selected_entity: Option<(specs::Entity, Instant)>, selected_entity: Option<(specs::Entity, Instant)>,
rot_imgs: &'a ImgsRot,
tooltip_manager: &'a mut TooltipManager,
#[conrod(common_builder)] #[conrod(common_builder)]
common: widget::CommonBuilder, common: widget::CommonBuilder,
} }
impl<'a> Social<'a> { impl<'a> Social<'a> {
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
pub fn new( pub fn new(
show: &'a Show, show: &'a Show,
client: &'a Client, client: &'a Client,
imgs: &'a Imgs, imgs: &'a Imgs,
fonts: &'a ConrodVoxygenFonts, fonts: &'a ConrodVoxygenFonts,
localized_strings: &'a std::sync::Arc<VoxygenLocalization>, localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
//stats: &'a Stats,
selected_entity: Option<(specs::Entity, Instant)>, selected_entity: Option<(specs::Entity, Instant)>,
rot_imgs: &'a ImgsRot,
tooltip_manager: &'a mut TooltipManager,
) -> Self { ) -> Self {
Self { Self {
show, show,
client, client,
imgs, imgs,
rot_imgs,
fonts, fonts,
localized_strings, localized_strings,
//stats, tooltip_manager,
selected_entity, selected_entity,
common: widget::CommonBuilder::default(), common: widget::CommonBuilder::default(),
} }
@ -118,6 +128,24 @@ impl<'a> Widget for Social<'a> {
let widget::UpdateArgs { state, ui, .. } = args; let widget::UpdateArgs { state, ui, .. } = args;
let mut events = Vec::new(); let mut events = Vec::new();
let button_tooltip = Tooltip::new({
// Edge images [t, b, r, l]
// Corner images [tr, tl, br, bl]
let edge = &self.rot_imgs.tt_side;
let corner = &self.rot_imgs.tt_corner;
ImageFrame::new(
[edge.cw180, edge.none, edge.cw270, edge.cw90],
[corner.none, corner.cw270, corner.cw90, corner.cw180],
Color::Rgba(0.08, 0.07, 0.04, 1.0),
5.0,
)
})
.title_font_size(self.fonts.cyri.scale(15))
.parent(ui.window)
.desc_font_size(self.fonts.cyri.scale(12))
.title_text_color(TEXT_COLOR)
.font_id(self.fonts.cyri.conrod_id)
.desc_text_color(TEXT_COLOR);
// Window frame and BG // Window frame and BG
let pos = if self.show.group || self.show.group_menu { let pos = if self.show.group || self.show.group_menu {
@ -472,7 +500,20 @@ impl<'a> Widget for Social<'a> {
self.selected_entity self.selected_entity
.and_then(|s| self.client.state().read_component_copied(s.0)) .and_then(|s| self.client.state().read_component_copied(s.0))
}); });
// TODO: Prevent inviting players with the same group uid
// TODO: Show current amount of group members as a tooltip for the invite button
// if the player is the group leader TODO: Grey out the invite
// button if the group has 6/6 members
let current_members = 4;
let tooltip_txt = if selected_ingame.is_some() {
format!(
"{}/6 {}",
&current_members,
&self.localized_strings.get("hud.group.members")
)
} else {
(&self.localized_strings.get("hud.group.members")).to_string()
};
if Button::image(self.imgs.button) if Button::image(self.imgs.button)
.w_h(106.0, 26.0) .w_h(106.0, 26.0)
.bottom_right_with_margins_on(state.ids.frame, 9.0, 7.0) .bottom_right_with_margins_on(state.ids.frame, 9.0, 7.0)
@ -500,6 +541,7 @@ impl<'a> Widget for Social<'a> {
}) })
.label_font_size(self.fonts.cyri.scale(15)) .label_font_size(self.fonts.cyri.scale(15))
.label_font_id(self.fonts.cyri.conrod_id) .label_font_id(self.fonts.cyri.conrod_id)
.with_tooltip(self.tooltip_manager, &tooltip_txt, "", &button_tooltip)
.set(state.ids.invite_button, ui) .set(state.ids.invite_button, ui)
.was_clicked() .was_clicked()
{ {

View File

@ -1071,6 +1071,7 @@ impl PlayState for SessionState {
/// Max distance an entity can be "targeted" /// Max distance an entity can be "targeted"
const MAX_TARGET_RANGE: f32 = 30.0; const MAX_TARGET_RANGE: f32 = 30.0;
/// Calculate what the cursor is pointing at within the 3d scene /// Calculate what the cursor is pointing at within the 3d scene
#[allow(clippy::type_complexity)]
fn under_cursor( fn under_cursor(
client: &Client, client: &Client,
cam_pos: Vec3<f32>, cam_pos: Vec3<f32>,