diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b2d1541f..8ee38ebac5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Campfire resting heal - Initial support for game plugins, both server-side and client-side - Reflective LoD water +- Map indicators for group members ### Changed diff --git a/assets/voxygen/element/buttons/checkbox/active.png b/assets/voxygen/element/buttons/checkbox/active.png new file mode 100644 index 0000000000..8ffc8fb84a --- /dev/null +++ b/assets/voxygen/element/buttons/checkbox/active.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a653ec0b91e759e83089da275b83aa92bf8b69e10b86c4882a5ce215df5fe99a +size 329 diff --git a/assets/voxygen/element/buttons/checkbox/active.vox b/assets/voxygen/element/buttons/checkbox/active.vox deleted file mode 100644 index 5e22293121..0000000000 --- a/assets/voxygen/element/buttons/checkbox/active.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f27b8583cdef06cde3475ecbb00f8ee537e61d3417fa8fe1163373a4494ae2e6 -size 3904 diff --git a/assets/voxygen/element/buttons/checkbox/hover.png b/assets/voxygen/element/buttons/checkbox/hover.png new file mode 100644 index 0000000000..3d51cad548 --- /dev/null +++ b/assets/voxygen/element/buttons/checkbox/hover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7255f696f7c74267744a482f703a74617318aac18444ba3fd8adcd1e0736ad1 +size 343 diff --git a/assets/voxygen/element/buttons/checkbox/hover.vox b/assets/voxygen/element/buttons/checkbox/hover.vox deleted file mode 100644 index 4ba53d84f3..0000000000 --- a/assets/voxygen/element/buttons/checkbox/hover.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:18c85d73e5b4ee8c0b34db08d35f441c666347e9b6b52b959163f2b0c3d5d588 -size 3904 diff --git a/assets/voxygen/element/buttons/checkbox/inactive.png b/assets/voxygen/element/buttons/checkbox/inactive.png new file mode 100644 index 0000000000..493ab24c48 --- /dev/null +++ b/assets/voxygen/element/buttons/checkbox/inactive.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01eab5bdd0b31eab4afe6c497100cf5928a4ce8fadfa0c01d5846413f6c1c9e1 +size 221 diff --git a/assets/voxygen/element/buttons/checkbox/inactive.vox b/assets/voxygen/element/buttons/checkbox/inactive.vox deleted file mode 100644 index 8d431de516..0000000000 --- a/assets/voxygen/element/buttons/checkbox/inactive.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9cfe4fa322ab76f1fd41e8606b3362e6108c3772e9be6952cd96c4567f3aa859 -size 3736 diff --git a/assets/voxygen/element/buttons/checkbox/inactive_hover.png b/assets/voxygen/element/buttons/checkbox/inactive_hover.png new file mode 100644 index 0000000000..d5bcaa86a2 --- /dev/null +++ b/assets/voxygen/element/buttons/checkbox/inactive_hover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a816fbb1dce640222c032479b0a371a04a8b7e8d078547d60a8cd274d38161fd +size 237 diff --git a/assets/voxygen/element/buttons/checkbox/inactive_hover.vox b/assets/voxygen/element/buttons/checkbox/inactive_hover.vox deleted file mode 100644 index 10f0064933..0000000000 --- a/assets/voxygen/element/buttons/checkbox/inactive_hover.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b4b15722bc6e49cfb702ed5334814618ea5f5df1d5ecaff17b374b08552bf0d5 -size 3736 diff --git a/assets/voxygen/element/buttons/checkbox/press.png b/assets/voxygen/element/buttons/checkbox/press.png new file mode 100644 index 0000000000..e3996de776 --- /dev/null +++ b/assets/voxygen/element/buttons/checkbox/press.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:076e48919bd0b5ab6d83e62af9ff38c5d719d15b579fbb30c9ab147af7fb2137 +size 317 diff --git a/assets/voxygen/element/buttons/checkbox/press.vox b/assets/voxygen/element/buttons/checkbox/press.vox deleted file mode 100644 index b446f15066..0000000000 --- a/assets/voxygen/element/buttons/checkbox/press.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1aada7e3447940c95cca2009393d8aeebd7d3d59893d09d6632e4549c66aa4ae -size 3656 diff --git a/assets/voxygen/element/buttons/radio/active.png b/assets/voxygen/element/buttons/radio/active.png new file mode 100644 index 0000000000..8041b6a4f9 --- /dev/null +++ b/assets/voxygen/element/buttons/radio/active.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c656740a0cf8de6b16d969da0b37b27b1160e115c6627dfa163dae29a76569d +size 393 diff --git a/assets/voxygen/element/buttons/radio/active.vox b/assets/voxygen/element/buttons/radio/active.vox deleted file mode 100644 index c2d3b63b8d..0000000000 --- a/assets/voxygen/element/buttons/radio/active.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:05a2c3b6fe9e2405d948206368c4791723a53dd59fe64a02e77fb13a5d1ff36c -size 3640 diff --git a/assets/voxygen/element/buttons/radio/hover.png b/assets/voxygen/element/buttons/radio/hover.png new file mode 100644 index 0000000000..80bb7aac95 --- /dev/null +++ b/assets/voxygen/element/buttons/radio/hover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75e54e3e29a23090b6da52b4a8ea446fbd9b84133fb8c007f239586b522802f4 +size 400 diff --git a/assets/voxygen/element/buttons/radio/hover.vox b/assets/voxygen/element/buttons/radio/hover.vox deleted file mode 100644 index 7bcd817f44..0000000000 --- a/assets/voxygen/element/buttons/radio/hover.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1a46ddd671767683b7d35b9bc1c23cb921eda7945f9da6bf4267f28399010c51 -size 3640 diff --git a/assets/voxygen/element/buttons/radio/inactive.png b/assets/voxygen/element/buttons/radio/inactive.png new file mode 100644 index 0000000000..0982b15561 --- /dev/null +++ b/assets/voxygen/element/buttons/radio/inactive.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54b5ad0e52470feae00c19dc15f31689cdcb779743dfe8603796e8ac936995bc +size 379 diff --git a/assets/voxygen/element/buttons/radio/inactive.vox b/assets/voxygen/element/buttons/radio/inactive.vox deleted file mode 100644 index 8ca8477a95..0000000000 --- a/assets/voxygen/element/buttons/radio/inactive.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f6376d4b0e530cdb5b2aafa29f42d01a3506b72b41f6a9caf39bd1dbb0d88594 -size 3080 diff --git a/assets/voxygen/element/buttons/radio/inactive_hover.png b/assets/voxygen/element/buttons/radio/inactive_hover.png new file mode 100644 index 0000000000..a99723042a --- /dev/null +++ b/assets/voxygen/element/buttons/radio/inactive_hover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:960dc42fa354edf095eb5d7cc7ed221d3d9ef8038f6b678d65d2796cdc9c9753 +size 365 diff --git a/assets/voxygen/element/buttons/radio/inactive_hover.vox b/assets/voxygen/element/buttons/radio/inactive_hover.vox deleted file mode 100644 index 953ef3758c..0000000000 --- a/assets/voxygen/element/buttons/radio/inactive_hover.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d36e7a02ada433903460efe8ebbfec9791c5e7cd62a4eb254c1fa59cf8c1fdd1 -size 3080 diff --git a/assets/voxygen/element/buttons/radio/press.png b/assets/voxygen/element/buttons/radio/press.png new file mode 100644 index 0000000000..e23a548ae3 --- /dev/null +++ b/assets/voxygen/element/buttons/radio/press.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9fa277ecb2729d6b7e5d355fe353a75ace6edd873346116aa47d8c3443dcc1fb +size 379 diff --git a/assets/voxygen/element/buttons/radio/press.vox b/assets/voxygen/element/buttons/radio/press.vox deleted file mode 100644 index 4d90fa443e..0000000000 --- a/assets/voxygen/element/buttons/radio/press.vox +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c945ee9af2801899e114c6cea27d9213a3fc0bd62e8e6788be0ae5654899b9c3 -size 2840 diff --git a/assets/voxygen/element/icons/de_buffs/buff_campfire_heal_0.png b/assets/voxygen/element/icons/de_buffs/buff_campfire_heal_0.png index b0bb533e77..8dc6f9b259 100644 --- a/assets/voxygen/element/icons/de_buffs/buff_campfire_heal_0.png +++ b/assets/voxygen/element/icons/de_buffs/buff_campfire_heal_0.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:06ddc169c14d6677bc9b31235802273477266c6d56c564201bea29219eace2b2 -size 303 +oid sha256:ff33d0955f01a5153f0fbab0aef19d7a9b584ec6c2d33581a983fe2024ae61f3 +size 1525 diff --git a/common/sys/src/agent.rs b/common/sys/src/agent.rs index 806162c5e3..92744e70bb 100644 --- a/common/sys/src/agent.rs +++ b/common/sys/src/agent.rs @@ -1474,7 +1474,7 @@ impl<'a> System<'a> for Sys { for (_invite, /*alignment,*/ agent, controller) in (&invites, /*&alignments,*/ &mut agents, &mut controllers).join() { - let accept = false; // set back to "matches!(alignment, Alignment::Npc)" when we got better NPC recruitment mechanics + let accept = true; // set back to "matches!(alignment, Alignment::Npc)" when we got better NPC recruitment mechanics if accept { // Clear agent comp *agent = Agent::default(); diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index f2059988f3..e6e143c7b8 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -26,18 +26,6 @@ image_ids! { flower: "voxygen.element.icons.item_flower", grass: "voxygen.element.icons.item_grass", - // Checkboxes and Radio buttons - check: "voxygen.element.buttons.radio.inactive", - check_mo: "voxygen.element.buttons.radio.inactive_hover", - check_press: "voxygen.element.buttons.radio.press", - check_checked: "voxygen.element.buttons.radio.active", - check_checked_mo: "voxygen.element.buttons.radio.hover", - checkbox: "voxygen.element.buttons.checkbox.inactive", - checkbox_mo: "voxygen.element.buttons.checkbox.inactive_hover", - checkbox_press: "voxygen.element.buttons.checkbox.press", - checkbox_checked: "voxygen.element.buttons.checkbox.active", - checkbox_checked_mo: "voxygen.element.buttons.checkbox.hover", - // Charwindow xp_charwindow: "voxygen.element.frames.xp_charwindow", divider: "voxygen.element.frames.divider_charwindow", @@ -53,6 +41,19 @@ image_ids! { ////////////////////////////////////////////////////////////////////////////////////////////////////// + + // Checkboxes and Radio buttons + check: "voxygen.element.buttons.radio.inactive", + check_mo: "voxygen.element.buttons.radio.inactive_hover", + check_press: "voxygen.element.buttons.radio.press", + check_checked: "voxygen.element.buttons.radio.active", + check_checked_mo: "voxygen.element.buttons.radio.hover", + checkbox: "voxygen.element.buttons.checkbox.inactive", + checkbox_mo: "voxygen.element.buttons.checkbox.inactive_hover", + checkbox_press: "voxygen.element.buttons.checkbox.press", + checkbox_checked: "voxygen.element.buttons.checkbox.active", + checkbox_checked_mo: "voxygen.element.buttons.checkbox.hover", + // Selection Frame selection: "voxygen.element.frames.selection", selection_hover: "voxygen.element.frames.selection_hover", @@ -180,7 +181,6 @@ image_ids! { indicator_mmap: "voxygen.element.buttons.indicator_mmap", indicator_map_overlay: "voxygen.element.buttons.indicator_mmap_small", indicator_group: "voxygen.element.map.group_indicator", - indicator_group_hover: "voxygen.element.map.group_indicator_hover", indicator_group_up: "voxygen.element.map.group_indicator_arrow_up", indicator_group_down: "voxygen.element.map.group_indicator_arrow_down", diff --git a/voxygen/src/hud/map.rs b/voxygen/src/hud/map.rs index 4c75ed690e..d22d920408 100644 --- a/voxygen/src/hud/map.rs +++ b/voxygen/src/hud/map.rs @@ -9,9 +9,8 @@ use crate::{ GlobalState, }; use client::{self, Client}; -use common::{ - comp, comp::group::Role, msg::world_msg::SiteKind, terrain::TerrainChunkSize, vol::RectVolSize, -}; +use common::{comp, comp::group::Role, terrain::TerrainChunkSize, vol::RectVolSize}; +use common_net::msg::world_msg::SiteKind; use conrod_core::{ color, position, widget::{self, Button, Image, Rectangle, Text}, @@ -657,23 +656,27 @@ impl<'a> Widget for Map<'a> { Role::Pet => None, }) .collect::>(); - let group_size = group_members.len(); + let group_size = group_members.len(); //let in_group = !group_members.is_empty(); let uid_allocator = client_state .ecs() - .read_resource::(); + .read_resource::(); if state.ids.member_indicators.len() < group_size { state.update(|s| { s.ids .member_indicators .resize(group_size, &mut ui.widget_id_generator()) }) - }; + }; for (i, &uid) in group_members.iter().copied().enumerate() { let entity = uid_allocator.retrieve_entity_internal(uid.into()); let member_pos = entity.and_then(|entity| member_pos.get(entity)); - let stats = entity.and_then(|entity| stats.get(entity)); - let name= if let Some(stats) = stats {stats.name.to_string()} else {"".to_string()}; + let stats = entity.and_then(|entity| stats.get(entity)); + let name = if let Some(stats) = stats { + stats.name.to_string() + } else { + "".to_string() + }; if let Some(member_pos) = member_pos { // Site pos in world coordinates relative to the player @@ -695,33 +698,27 @@ impl<'a> Widget for Map<'a> { continue; } let factor = 1.2; - let z_comparison = (member_pos.0.z - player_pos.z) as i32; - - Button::image(match z_comparison { + let z_comparison = (member_pos.0.z - player_pos.z) as i32; + + Button::image(match z_comparison { 10..=i32::MAX => self.imgs.indicator_group_up, i32::MIN..=-10 => self.imgs.indicator_group_down, _ => self.imgs.indicator_group, }) - .x_y_position_relative_to( - state.ids.grid, - position::Relative::Scalar(rpos.x as f64), - position::Relative::Scalar(rpos.y as f64), - ) - .w_h(20.0 * factor, 20.0 * factor) - .floating(true) - .with_tooltip( - self.tooltip_manager, - &name, - "", - &site_tooltip, - TEXT_COLOR, - ) - .set(state.ids.member_indicators[i], ui); + .x_y_position_relative_to( + state.ids.grid, + position::Relative::Scalar(rpos.x as f64), + position::Relative::Scalar(rpos.y as f64), + ) + .w_h(20.0 * factor, 20.0 * factor) + .floating(true) + .with_tooltip(self.tooltip_manager, &name, "", &site_tooltip, TEXT_COLOR) + .set(state.ids.member_indicators[i], ui); } } // Cursor pos relative to playerpos and widget size // Cursor stops moving on an axis as soon as it's position exceeds the maximum - // // size of the widget + // // size of the widget // Offset from map center due to dragging let rcpos = drag.map(|e| e as f32); diff --git a/voxygen/src/hud/minimap.rs b/voxygen/src/hud/minimap.rs index 23ba6bc8dd..e5de2b90ed 100644 --- a/voxygen/src/hud/minimap.rs +++ b/voxygen/src/hud/minimap.rs @@ -5,7 +5,8 @@ use super::{ }; use crate::ui::{fonts::Fonts, img_ids}; use client::{self, Client}; -use common::{comp, comp::group::Role, msg::world_msg::SiteKind, terrain::TerrainChunkSize, vol::RectVolSize}; +use common::{comp, comp::group::Role, terrain::TerrainChunkSize, vol::RectVolSize}; +use common_net::msg::world_msg::SiteKind; use conrod_core::{ color, position, widget::{self, Button, Image, Rectangle, Text}, @@ -296,70 +297,70 @@ impl<'a> Widget for MiniMap<'a> { } // Group member indicators - let client_state = self.client.state(); - let member_pos = client_state.ecs().read_storage::(); - let group_members = self - .client - .group_members() - .iter() - .filter_map(|(u, r)| match r { - Role::Member => Some(u), - Role::Pet => None, - }) - .collect::>(); - let group_size = group_members.len(); - //let in_group = !group_members.is_empty(); - let uid_allocator = client_state - .ecs() - .read_resource::(); - if state.ids.member_indicators.len() < group_size { - state.update(|s| { - s.ids - .member_indicators - .resize(group_size, &mut ui.widget_id_generator()) - }) - }; - for (i, &uid) in group_members.iter().copied().enumerate() { - let entity = uid_allocator.retrieve_entity_internal(uid.into()); - let member_pos = entity.and_then(|entity| member_pos.get(entity)); - - if let Some(member_pos) = member_pos { - // Site pos in world coordinates relative to the player - let rwpos = member_pos.0.xy().map(|e| e as f32) - player_pos; - // Convert to chunk coordinates - let rcpos = rwpos.map2(TerrainChunkSize::RECT_SIZE, |e, sz| e / sz as f32); - // Convert to fractional coordinates relative to the worldsize - let rfpos = rcpos / max_zoom as f32; - // Convert to unrotated pixel coordinates from the player location on the map - // (the center) - // Accounting for zooming - let rpixpos = rfpos.map2(map_size, |e, sz| e * sz as f32 * zoom as f32); - let rpos = Vec2::unit_x().rotated_z(self.ori.x) * rpixpos.x - + Vec2::unit_y().rotated_z(self.ori.x) * rpixpos.y; - - if rpos - .map2(map_size, |e, sz| e.abs() > sz as f32 / 2.0) - .reduce_or() - { - continue; - } - let factor = 1.2; - let z_comparison = (member_pos.0.z - player_pos.z) as i32; - Button::image(match z_comparison { - 10..=i32::MAX => self.imgs.indicator_group_up, - i32::MIN..=-10 => self.imgs.indicator_group_down, - _ => self.imgs.indicator_group, + let client_state = self.client.state(); + let member_pos = client_state.ecs().read_storage::(); + let group_members = self + .client + .group_members() + .iter() + .filter_map(|(u, r)| match r { + Role::Member => Some(u), + Role::Pet => None, }) + .collect::>(); + let group_size = group_members.len(); + //let in_group = !group_members.is_empty(); + let uid_allocator = client_state + .ecs() + .read_resource::(); + if state.ids.member_indicators.len() < group_size { + state.update(|s| { + s.ids + .member_indicators + .resize(group_size, &mut ui.widget_id_generator()) + }) + }; + for (i, &uid) in group_members.iter().copied().enumerate() { + let entity = uid_allocator.retrieve_entity_internal(uid.into()); + let member_pos = entity.and_then(|entity| member_pos.get(entity)); + + if let Some(member_pos) = member_pos { + // Site pos in world coordinates relative to the player + let rwpos = member_pos.0.xy().map(|e| e as f32) - player_pos; + // Convert to chunk coordinates + let rcpos = rwpos.map2(TerrainChunkSize::RECT_SIZE, |e, sz| e / sz as f32); + // Convert to fractional coordinates relative to the worldsize + let rfpos = rcpos / max_zoom as f32; + // Convert to unrotated pixel coordinates from the player location on the map + // (the center) + // Accounting for zooming + let rpixpos = rfpos.map2(map_size, |e, sz| e * sz as f32 * zoom as f32); + let rpos = Vec2::unit_x().rotated_z(self.ori.x) * rpixpos.x + + Vec2::unit_y().rotated_z(self.ori.x) * rpixpos.y; + + if rpos + .map2(map_size, |e, sz| e.abs() > sz as f32 / 2.0) + .reduce_or() + { + continue; + } + let factor = 1.2; + let z_comparison = (member_pos.0.z - player_pos.z) as i32; + Button::image(match z_comparison { + 10..=i32::MAX => self.imgs.indicator_group_up, + i32::MIN..=-10 => self.imgs.indicator_group_down, + _ => self.imgs.indicator_group, + }) .x_y_position_relative_to( state.ids.grid, position::Relative::Scalar(rpos.x as f64), position::Relative::Scalar(rpos.y as f64), ) - .w_h(16.0 * factor, 16.0 * factor) - .image_color(Color::Rgba(1.0, 1.0, 1.0, 1.0)) + .w_h(16.0 * factor, 16.0 * factor) + .image_color(Color::Rgba(1.0, 1.0, 1.0, 1.0)) .set(state.ids.member_indicators[i], ui); + } } - } // Indicator let ind_scale = 0.4; diff --git a/voxygen/src/hud/skillbar.rs b/voxygen/src/hud/skillbar.rs index 3102f09dfe..60a5697764 100644 --- a/voxygen/src/hud/skillbar.rs +++ b/voxygen/src/hud/skillbar.rs @@ -607,7 +607,7 @@ impl<'a> Widget for Skillbar<'a> { .fabricate(hotbar::Slot::Four, [40.0; 2]) .filled_slot(self.imgs.inv_slot) .right_from(state.ids.slot3, 0.0); - if let Some((title, desc)) = tooltip_text(hotbar::Slot::Three) { + if let Some((title, desc)) = tooltip_text(hotbar::Slot::Four) { slot.with_tooltip(self.tooltip_manager, title, desc, &item_tooltip, TEXT_COLOR) .set(state.ids.slot4, ui); } else { @@ -618,7 +618,7 @@ impl<'a> Widget for Skillbar<'a> { .fabricate(hotbar::Slot::Five, [40.0; 2]) .filled_slot(self.imgs.inv_slot) .right_from(state.ids.slot4, 0.0); - if let Some((title, desc)) = tooltip_text(hotbar::Slot::Three) { + if let Some((title, desc)) = tooltip_text(hotbar::Slot::Five) { slot.with_tooltip(self.tooltip_manager, title, desc, &item_tooltip, TEXT_COLOR) .set(state.ids.slot5, ui); } else {