mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
timeout visuals, various small fixes and two new items
This commit is contained in:
parent
543d971a19
commit
28a8f847cc
@ -5,7 +5,7 @@ Item(
|
||||
(
|
||||
kind: Back("Short0"),
|
||||
stats: (
|
||||
protection: Normal(0.0),
|
||||
protection: Normal(0.2),
|
||||
),
|
||||
)
|
||||
),
|
||||
|
12
assets/common/items/armor/back/short_1.ron
Normal file
12
assets/common/items/armor/back/short_1.ron
Normal file
@ -0,0 +1,12 @@
|
||||
Item(
|
||||
name: "Green Blanket",
|
||||
description: "Keeps your shoulders warm.",
|
||||
kind: Armor(
|
||||
(
|
||||
kind: Back("Short1"),
|
||||
stats: (
|
||||
protection: Normal(0.1),
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
12
assets/common/items/armor/neck/neck_1.ron
Normal file
12
assets/common/items/armor/neck/neck_1.ron
Normal 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),
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
@ -1,6 +1,6 @@
|
||||
Item(
|
||||
name: "Uneven Bow",
|
||||
description: "Someone carved his initials into it.",
|
||||
description: "Someone carved their initials into it.",
|
||||
kind: Tool(
|
||||
(
|
||||
kind: Bow("ShortBow0"),
|
||||
|
@ -230,6 +230,8 @@
|
||||
(0.6, "common.items.armor.ring.ring_0"),
|
||||
// capes
|
||||
(0.6, "common.items.armor.back.short_0"),
|
||||
(0.7, "common.items.armor.back.short_1"),
|
||||
// necks
|
||||
(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)
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
BIN
assets/voxygen/element/icons/neck-1.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -336,6 +336,7 @@ magically infused items?"#,
|
||||
"hud.group.add_friend": "Add to Friends",
|
||||
"hud.group.link_group": "Link Groups",
|
||||
"hud.group.in_menu": "In Menu",
|
||||
"hud.group.members": "Group Members",
|
||||
|
||||
"hud.spell": "Spells",
|
||||
|
||||
@ -470,7 +471,8 @@ Protection
|
||||
"Press 'L-Shift' to open your Glider and conquer the skies.",
|
||||
"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.",
|
||||
"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": [
|
||||
"Help, I'm under attack!",
|
||||
|
@ -1016,6 +1016,10 @@
|
||||
Armor(Back("Short0")): VoxTrans(
|
||||
"voxel.armor.back.short-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(
|
||||
"voxel.armor.back.admin",
|
||||
@ -1033,6 +1037,9 @@
|
||||
Armor(Neck("Neck0")): Png(
|
||||
"element.icons.neck-0",
|
||||
),
|
||||
Armor(Neck("Neck1")): Png(
|
||||
"element.icons.neck-1",
|
||||
),
|
||||
// Tabards
|
||||
Armor(Tabard("Admin")): Png(
|
||||
"element.icons.tabard_admin",
|
||||
|
BIN
assets/voxygen/voxel/armor/back/short-1.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/armor/back/short-1.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -15,6 +15,10 @@
|
||||
"DungPurp0": (
|
||||
vox_spec: ("armor.back.dung_purp-0", (-5.0, -1.0, -14.0)),
|
||||
color: None
|
||||
),
|
||||
),
|
||||
"Short1": (
|
||||
vox_spec: ("armor.back.short-1", (-5.0, -1.0, -11.0)),
|
||||
color: None
|
||||
),
|
||||
},
|
||||
))
|
||||
|
@ -145,6 +145,7 @@ impl GroupManager {
|
||||
|
||||
// Add someone to a group
|
||||
// Also used to create new groups
|
||||
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
|
||||
pub fn add_group_member(
|
||||
&mut self,
|
||||
leader: specs::Entity,
|
||||
@ -241,6 +242,7 @@ impl GroupManager {
|
||||
});
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
|
||||
pub fn new_pet(
|
||||
&mut self,
|
||||
pet: specs::Entity,
|
||||
@ -319,6 +321,7 @@ impl GroupManager {
|
||||
// Remove someone from a group if they are in one
|
||||
// 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)
|
||||
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
|
||||
fn remove_from_group(
|
||||
&mut self,
|
||||
member: specs::Entity,
|
||||
|
@ -54,7 +54,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
||||
if client.invited_to_group.is_some() {
|
||||
already_has_invite = true;
|
||||
} else {
|
||||
client.notify(ServerMsg::GroupInvite((*inviter_uid).into()));
|
||||
client.notify(ServerMsg::GroupInvite((*inviter_uid)));
|
||||
client.invited_to_group = Some(entity);
|
||||
}
|
||||
// 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()
|
||||
.write_storage()
|
||||
.insert(invitee, comp::Agent::default());
|
||||
} else {
|
||||
if let Some(client) = clients.get_mut(entity) {
|
||||
client.notify(ChatType::Meta.server_msg("Invite rejected".to_owned()));
|
||||
}
|
||||
} else if let Some(client) = clients.get_mut(entity) {
|
||||
client.notify(ChatType::Meta.server_msg("Invite rejected".to_owned()));
|
||||
}
|
||||
|
||||
if already_has_invite {
|
||||
|
@ -261,7 +261,7 @@ impl StateExt for State {
|
||||
| comp::ChatType::Kill
|
||||
| comp::ChatType::Meta
|
||||
| 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) => {
|
||||
for (client, uid) in (
|
||||
|
@ -585,7 +585,7 @@ impl<'a> Widget for Bag<'a> {
|
||||
"{}\n\n{}\n\n{}\n\n{}%",
|
||||
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_size(self.fonts.cyri.scale(16))
|
||||
.color(TEXT_COLOR)
|
||||
|
@ -1,15 +1,11 @@
|
||||
use super::{
|
||||
img_ids::{Imgs, ImgsRot},
|
||||
Show, BLACK, GROUP_COLOR, HP_COLOR, KILL_COLOR, LOW_HP_COLOR, MANA_COLOR, TEXT_COLOR,
|
||||
TEXT_COLOR_GREY, UI_HIGHLIGHT_0,
|
||||
img_ids::Imgs, Show, BLACK, GROUP_COLOR, HP_COLOR, KILL_COLOR, LOW_HP_COLOR, MANA_COLOR,
|
||||
TEXT_COLOR, TEXT_COLOR_GREY, UI_HIGHLIGHT_0, UI_MAIN,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
i18n::VoxygenLocalization,
|
||||
settings::Settings,
|
||||
ui::{fonts::ConrodVoxygenFonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
window::GameInput,
|
||||
GlobalState,
|
||||
i18n::VoxygenLocalization, settings::Settings, ui::fonts::ConrodVoxygenFonts,
|
||||
window::GameInput, GlobalState,
|
||||
};
|
||||
use client::{self, Client};
|
||||
use common::{
|
||||
@ -51,6 +47,8 @@ widget_ids! {
|
||||
member_stam[],
|
||||
dead_txt[],
|
||||
health_txt[],
|
||||
timeout_bg,
|
||||
timeout,
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +58,6 @@ pub struct State {
|
||||
selected_member: Option<Uid>,
|
||||
}
|
||||
|
||||
const TOOLTIP_UPSHIFT: f64 = 40.0;
|
||||
#[derive(WidgetCommon)]
|
||||
pub struct Group<'a> {
|
||||
show: &'a mut Show,
|
||||
@ -69,8 +66,6 @@ pub struct Group<'a> {
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
pulse: f32,
|
||||
global_state: &'a GlobalState,
|
||||
|
||||
@ -79,6 +74,7 @@ pub struct Group<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Group<'a> {
|
||||
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
|
||||
pub fn new(
|
||||
show: &'a mut Show,
|
||||
client: &'a Client,
|
||||
@ -86,8 +82,6 @@ impl<'a> Group<'a> {
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
pulse: f32,
|
||||
global_state: &'a GlobalState,
|
||||
) -> Self {
|
||||
@ -96,8 +90,6 @@ impl<'a> Group<'a> {
|
||||
client,
|
||||
settings,
|
||||
imgs,
|
||||
rot_imgs,
|
||||
tooltip_manager,
|
||||
fonts,
|
||||
localized_strings,
|
||||
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 { () }
|
||||
|
||||
//TODO: Disband groups when there's only one member in them
|
||||
//TODO: Always send health, energy, level and position of group members to the
|
||||
// client
|
||||
|
||||
#[allow(clippy::unused_unit)] // TODO: Pending review in #587
|
||||
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
|
||||
let widget::UpdateArgs { state, ui, .. } = args;
|
||||
|
||||
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
|
||||
let group_members = self
|
||||
@ -217,6 +189,20 @@ impl<'a> Widget for Group<'a> {
|
||||
.w_h(49.0, 26.0)
|
||||
.bottom_left_with_margins_on(ui.window, 190.0, 10.0)
|
||||
.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
|
||||
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)
|
||||
.hover_image(self.imgs.group_icon_hover)
|
||||
.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)
|
||||
.was_clicked()
|
||||
{
|
||||
@ -319,7 +298,7 @@ impl<'a> Widget for Group<'a> {
|
||||
|
||||
// change panel positions when debug info is shown
|
||||
let offset = if self.global_state.settings.gameplay.toggle_debug {
|
||||
210.0
|
||||
240.0
|
||||
} else {
|
||||
110.0
|
||||
};
|
||||
|
@ -1933,8 +1933,9 @@ impl Hud {
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
//&stats,
|
||||
info.selected_entity,
|
||||
&self.rot_imgs,
|
||||
tooltip_manager,
|
||||
)
|
||||
.set(self.ids.social_window, ui_widgets)
|
||||
{
|
||||
@ -1959,8 +1960,6 @@ impl Hud {
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
tooltip_manager,
|
||||
&self.rot_imgs,
|
||||
self.pulse,
|
||||
&global_state,
|
||||
)
|
||||
|
@ -148,12 +148,15 @@ impl<'a> Widget for Overhead<'a> {
|
||||
const MANA_BAR_Y: f64 = MANA_BAR_HEIGHT / 2.0;
|
||||
let hp_percentage =
|
||||
self.stats.health.current() as f64 / self.stats.health.maximum() as f64 * 100.0;
|
||||
let name_y = if hp_percentage == 100.0 {
|
||||
MANA_BAR_Y + 10.0
|
||||
let level_comp = self.stats.level.level() as i64 - self.own_level as i64;
|
||||
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 {
|
||||
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
|
||||
Text::new(&self.name)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
|
@ -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 common::sync::Uid;
|
||||
use conrod_core::{
|
||||
@ -63,30 +69,34 @@ pub struct Social<'a> {
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
//stats: &'a Stats,
|
||||
selected_entity: Option<(specs::Entity, Instant)>,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
}
|
||||
|
||||
impl<'a> Social<'a> {
|
||||
#[allow(clippy::too_many_arguments)] // TODO: Pending review in #587
|
||||
pub fn new(
|
||||
show: &'a Show,
|
||||
client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
//stats: &'a Stats,
|
||||
selected_entity: Option<(specs::Entity, Instant)>,
|
||||
rot_imgs: &'a ImgsRot,
|
||||
tooltip_manager: &'a mut TooltipManager,
|
||||
) -> Self {
|
||||
Self {
|
||||
show,
|
||||
client,
|
||||
imgs,
|
||||
rot_imgs,
|
||||
fonts,
|
||||
localized_strings,
|
||||
//stats,
|
||||
tooltip_manager,
|
||||
selected_entity,
|
||||
common: widget::CommonBuilder::default(),
|
||||
}
|
||||
@ -118,6 +128,24 @@ impl<'a> Widget for Social<'a> {
|
||||
let widget::UpdateArgs { state, ui, .. } = args;
|
||||
|
||||
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
|
||||
let pos = if self.show.group || self.show.group_menu {
|
||||
@ -472,7 +500,20 @@ impl<'a> Widget for Social<'a> {
|
||||
self.selected_entity
|
||||
.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 {}",
|
||||
¤t_members,
|
||||
&self.localized_strings.get("hud.group.members")
|
||||
)
|
||||
} else {
|
||||
(&self.localized_strings.get("hud.group.members")).to_string()
|
||||
};
|
||||
if Button::image(self.imgs.button)
|
||||
.w_h(106.0, 26.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_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(self.tooltip_manager, &tooltip_txt, "", &button_tooltip)
|
||||
.set(state.ids.invite_button, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
|
@ -1071,6 +1071,7 @@ impl PlayState for SessionState {
|
||||
/// Max distance an entity can be "targeted"
|
||||
const MAX_TARGET_RANGE: f32 = 30.0;
|
||||
/// Calculate what the cursor is pointing at within the 3d scene
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn under_cursor(
|
||||
client: &Client,
|
||||
cam_pos: Vec3<f32>,
|
||||
|
Loading…
Reference in New Issue
Block a user