fix clippy warnings

This commit is contained in:
Marcel Märtens 2021-07-11 20:41:52 +02:00
parent fb4f50002e
commit 9b3b21f368
102 changed files with 592 additions and 595 deletions

View File

@ -59,7 +59,7 @@ where
{
use crate::error::Error;
let mut participant = None;
for addr in resolve(&address, prefer_ipv6)
for addr in resolve(address, prefer_ipv6)
.await
.map_err(Error::HostnameLookupFailed)?
{

View File

@ -8,7 +8,7 @@ trait TabComplete {
impl TabComplete for ArgumentSpec {
fn complete(&self, part: &str, client: &Client) -> Vec<String> {
match self {
ArgumentSpec::PlayerName(_) => complete_player(part, &client),
ArgumentSpec::PlayerName(_) => complete_player(part, client),
ArgumentSpec::Float(_, x, _) => {
if part.is_empty() {
vec![format!("{:.1}", x)]
@ -25,7 +25,7 @@ impl TabComplete for ArgumentSpec {
},
ArgumentSpec::Any(_, _) => vec![],
ArgumentSpec::Command(_) => complete_command(part),
ArgumentSpec::Message(_) => complete_player(part, &client),
ArgumentSpec::Message(_) => complete_player(part, client),
ArgumentSpec::SubCommand => complete_command(part),
ArgumentSpec::Enum(_, strings, _) => strings
.iter()
@ -100,27 +100,27 @@ pub fn complete(line: &str, client: &Client) -> Vec<String> {
} else if let Ok(cmd) = cmd.parse::<ChatCommand>() {
if let Some(arg) = cmd.data().args.get(i - 1) {
// Complete ith argument
arg.complete(word, &client)
arg.complete(word, client)
} else {
// Complete past the last argument
match cmd.data().args.last() {
Some(ArgumentSpec::SubCommand) => {
if let Some(index) = nth_word(line, cmd.data().args.len()) {
complete(&line[index..], &client)
complete(&line[index..], client)
} else {
vec![]
}
},
Some(ArgumentSpec::Message(_)) => complete_player(word, &client),
Some(ArgumentSpec::Message(_)) => complete_player(word, client),
_ => vec![], // End of command. Nothing to complete
}
}
} else {
// Completing for unknown chat command
complete_player(word, &client)
complete_player(word, client)
}
} else {
// Not completing a command
complete_player(word, &client)
complete_player(word, client)
}
}

View File

@ -723,7 +723,7 @@ impl Client {
let token_or_username = match &self.server_info.auth_provider {
Some(addr) => {
// Query whether this is a trusted auth server
if auth_trusted(&addr) {
if auth_trusted(addr) {
let (scheme, authority) = match addr.split_once("://") {
Some((s, a)) => (s, a),
None => return Err(Error::AuthServerUrlInvalid(addr.to_string())),

View File

@ -237,7 +237,7 @@ lazy_static! {
for entry in std::fs::read_dir(path)? {
let path = entry?.path();
if path.is_dir(){
list_items(&path, &base, &mut items)?;
list_items(&path, base, &mut items)?;
} else if let Ok(path) = path.strip_prefix(base) {
let path = path.to_string_lossy().trim_end_matches(".ron").replace('/', ".").replace('\\', ".");
items.push(path);
@ -793,6 +793,7 @@ pub enum ArgumentSpec {
}
impl ArgumentSpec {
#[allow(clippy::nonstandard_macro_braces)] //tmp as of false positive !?
pub fn usage_string(&self) -> String {
match self {
ArgumentSpec::PlayerName(req) => {

View File

@ -1,3 +1,4 @@
#![allow(clippy::nonstandard_macro_braces)] //tmp as of false positive !?
use crate::{make_case_elim, make_proj_elim};
use rand::{seq::SliceRandom, thread_rng, Rng};
use serde::{Deserialize, Serialize};

View File

@ -1,3 +1,4 @@
#![allow(clippy::nonstandard_macro_braces)] //tmp as of false positive !?
use crate::uid::Uid;
use core::{cmp::Ordering, time::Duration};
#[cfg(not(target_arch = "wasm32"))]
@ -421,7 +422,7 @@ impl Buffs {
// Intentionally sorted in reverse so that the strongest buffs are earlier in
// the vector
buff_order
.sort_by(|a, b| buffs[&b].partial_cmp(&buffs[&a]).unwrap_or(Ordering::Equal));
.sort_by(|a, b| buffs[b].partial_cmp(&buffs[a]).unwrap_or(Ordering::Equal));
}
}
}

View File

@ -187,8 +187,8 @@ impl<G> GenericChatMsg<G> {
pub fn get_group(&self) -> Option<&G> {
match &self.chat_type {
ChatType::GroupMeta(g) => Some(&g),
ChatType::Group(_, g) => Some(&g),
ChatType::GroupMeta(g) => Some(g),
ChatType::Group(_, g) => Some(g),
_ => None,
}
}
@ -326,7 +326,7 @@ impl SpeechBubble {
{
match &self.message {
SpeechBubbleMessage::Plain(m) => m.to_string(),
SpeechBubbleMessage::Localized(k, i) => i18n_variation(&k, *i),
SpeechBubbleMessage::Localized(k, i) => i18n_variation(k, *i),
}
}
}

View File

@ -416,7 +416,7 @@ impl TryFrom<(&Item, &AbilityMap, &MaterialStatManifest)> for ItemConfig {
.cloned();
let abilities = if let Some(set_key) = item.ability_spec() {
if let Some(set) = ability_map.get_ability_set(set_key) {
set.clone().modified_by_tool(&tool, msm, &item.components)
set.clone().modified_by_tool(tool, msm, &item.components)
} else {
error!(
"Custom ability set: {:?} references non-existent set, falling back to \
@ -426,7 +426,7 @@ impl TryFrom<(&Item, &AbilityMap, &MaterialStatManifest)> for ItemConfig {
tool_default.unwrap_or_default()
}
} else if let Some(set) = tool_default {
set.modified_by_tool(&tool, msm, &item.components)
set.modified_by_tool(tool, msm, &item.components)
} else {
error!(
"No ability set defined for tool: {:?}, falling back to default ability set.",
@ -781,7 +781,7 @@ impl Item {
pub fn slots_mut(&mut self) -> &mut [InvSlot] { &mut self.slots }
pub fn item_config_expect(&self) -> &ItemConfig {
&self
self
.item_config
.as_ref()
.expect("Item was expected to have an ItemConfig")

View File

@ -427,7 +427,7 @@ impl assets::Compound for AbilityMap {
kind.clone(),
// expect cannot fail because CharacterAbility always
// provides a default value in case of failure
set.map_ref(|s| cache.load_expect(&s).cloned()),
set.map_ref(|s| cache.load_expect(s).cloned()),
)
})
.collect(),

View File

@ -71,10 +71,10 @@ pub enum ItemSpec {
impl ItemSpec {
pub fn try_to_item(&self, asset_specifier: &str, rng: &mut impl Rng) -> Option<Item> {
match self {
ItemSpec::Item(specifier) => Some(Item::new_from_asset_expect(&specifier)),
ItemSpec::Item(specifier) => Some(Item::new_from_asset_expect(specifier)),
ItemSpec::Choice(items) => {
choose(&items, asset_specifier, rng)
choose(items, asset_specifier, rng)
.as_ref()
.and_then(|e| match e {
entry @ ItemSpec::Item { .. } => entry.try_to_item(asset_specifier, rng),
@ -471,7 +471,7 @@ impl LoadoutBuilder {
let rng = &mut rand::thread_rng();
match preset {
Preset::HuskSummon => {
self = self.with_asset_expect("common.loadout.dungeon.tier-5.husk", rng)
self = self.with_asset_expect("common.loadout.dungeon.tier-5.husk", rng);
},
}

View File

@ -787,7 +787,7 @@ impl Inventory {
pub fn can_swap(&self, inv_slot_id: InvSlotId, equip_slot: EquipSlot) -> bool {
// Check if loadout slot can hold item
if !self.get(inv_slot_id).map_or(true, |item| {
self.loadout.slot_can_hold(equip_slot, Some(&item.kind()))
self.loadout.slot_can_hold(equip_slot, Some(item.kind()))
}) {
trace!("can_swap = false, equip slot can't hold item");
return false;

View File

@ -970,7 +970,7 @@ impl Skill {
/// note direct prerequisites)
pub fn prerequisite_skills(&self) -> impl Iterator<Item = (Skill, Option<u16>)> {
SKILL_PREREQUISITES
.get(&self)
.get(self)
.into_iter()
.flatten()
.map(|(skill, level)| (*skill, *level))
@ -984,12 +984,12 @@ impl Skill {
/// Returns the maximum level a skill can reach, returns None if the skill
/// doesn't level
pub fn max_level(&self) -> Option<u16> { SKILL_MAX_LEVEL.get(&self).copied().flatten() }
pub fn max_level(&self) -> Option<u16> { SKILL_MAX_LEVEL.get(self).copied().flatten() }
/// Returns the skill group type for a skill from the static skill group
/// definitions.
pub fn skill_group_kind(&self) -> Option<SkillGroupKind> {
SKILL_GROUP_LOOKUP.get(&self).copied()
SKILL_GROUP_LOOKUP.get(self).copied()
}
}

View File

@ -125,7 +125,7 @@ impl assets::Compound for RecipeBook {
) -> Result<(RecipeInput, u32), assets::Error> {
let def = match &spec.0 {
RawRecipeInput::Item(name) => {
RecipeInput::Item(Arc::<ItemDef>::load_cloned(&name)?)
RecipeInput::Item(Arc::<ItemDef>::load_cloned(name)?)
},
RawRecipeInput::Tag(tag) => RecipeInput::Tag(*tag),
};

View File

@ -82,7 +82,7 @@ impl Queue {
where
F: FnOnce() + Send + Sync + 'static,
{
let internal = Arc::clone(&internal);
let internal = Arc::clone(internal);
let name_cloned = name.to_owned();
Self {
id,

View File

@ -37,7 +37,7 @@ impl CharacterBehavior for Data {
let mut update = StateUpdate::from(data);
handle_orientation(data, &mut update, 1.0);
handle_move(&data, &mut update, 0.4);
handle_move(data, &mut update, 0.4);
match self.stage_section {
StageSection::Buildup => {

View File

@ -44,7 +44,7 @@ impl CharacterBehavior for Data {
fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_manipulate_loadout(&data, &mut update, inv_action);
handle_manipulate_loadout(data, &mut update, inv_action);
update
}
}

View File

@ -84,7 +84,7 @@ impl CharacterBehavior for Data {
{
update.character = CharacterState::Idle;
update.ori = update.ori.to_horizontal();
} else if !handle_climb(&data, &mut update) {
} else if !handle_climb(data, &mut update) {
let air_flow = data
.physics
.in_fluid

View File

@ -64,7 +64,7 @@ impl CharacterBehavior for Data {
fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_manipulate_loadout(&data, &mut update, inv_action);
handle_manipulate_loadout(data, &mut update, inv_action);
update
}
}

View File

@ -64,7 +64,7 @@ impl CharacterBehavior for Data {
fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_manipulate_loadout(&data, &mut update, inv_action);
handle_manipulate_loadout(data, &mut update, inv_action);
update
}
}

View File

@ -44,7 +44,7 @@ impl CharacterBehavior for Data {
fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_manipulate_loadout(&data, &mut update, inv_action);
handle_manipulate_loadout(data, &mut update, inv_action);
update
}
}

View File

@ -63,7 +63,7 @@ impl CharacterBehavior for Data {
fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_manipulate_loadout(&data, &mut update, inv_action);
handle_manipulate_loadout(data, &mut update, inv_action);
update
}
}

View File

@ -49,7 +49,7 @@ impl CharacterBehavior for Data {
fn manipulate_loadout(&self, data: &JoinData, inv_action: InventoryAction) -> StateUpdate {
let mut update = StateUpdate::from(data);
handle_manipulate_loadout(&data, &mut update, inv_action);
handle_manipulate_loadout(data, &mut update, inv_action);
update
}
}

View File

@ -687,7 +687,7 @@ fn handle_ability(data: &JoinData, update: &mut StateUpdate, input: InputKind) {
})
.map(|a| {
let tool = unwrap_tool_data(data, equip_slot).map(|t| t.kind);
a.adjusted_by_skills(&data.skill_set, tool)
a.adjusted_by_skills(data.skill_set, tool)
})
.filter(|ability| ability.requirements_paid(data, update))
{
@ -758,7 +758,7 @@ pub fn handle_block_input(data: &JoinData, update: &mut StateUpdate) {
/// attempts to perform their dodge ability
pub fn handle_dodge_input(data: &JoinData, update: &mut StateUpdate) {
if input_is_pressed(data, InputKind::Roll) && data.body.is_humanoid() {
let ability = CharacterAbility::default_roll().adjusted_by_skills(&data.skill_set, None);
let ability = CharacterAbility::default_roll().adjusted_by_skills(data.skill_set, None);
if ability.requirements_paid(data, update) {
update.character = CharacterState::from((
&ability,
@ -790,7 +790,7 @@ pub fn is_strafing(data: &JoinData, update: &StateUpdate) -> bool {
pub fn unwrap_tool_data<'a>(data: &'a JoinData, equip_slot: EquipSlot) -> Option<&'a Tool> {
if let Some(ItemKind::Tool(tool)) = data.inventory.equipped(equip_slot).map(|i| i.kind()) {
Some(&tool)
Some(tool)
} else {
None
}

View File

@ -14,9 +14,9 @@ impl CharacterBehavior for Data {
let mut update = StateUpdate::from(data);
handle_orientation(data, &mut update, 1.0);
handle_move(&data, &mut update, 1.0);
handle_climb(&data, &mut update);
attempt_input(&data, &mut update);
handle_move(data, &mut update, 1.0);
handle_climb(data, &mut update);
attempt_input(data, &mut update);
update
}
@ -70,7 +70,7 @@ impl CharacterBehavior for Data {
},
_ => (),
}
handle_manipulate_loadout(&data, &mut update, inv_action);
handle_manipulate_loadout(data, &mut update, inv_action);
update
}
}

View File

@ -284,7 +284,7 @@ impl<'a, T: ReadVol> Iterator for DefaultVolIterator<'a, T> {
type Item = (Vec3<i32>, &'a T::Vox);
fn next(&mut self) -> Option<(Vec3<i32>, &'a T::Vox)> {
while let Some(pos) = self.pos_iter.next() {
for pos in &mut self.pos_iter {
if let Ok(vox) = self.vol.get(pos) {
return Some((pos, vox));
}

View File

@ -186,7 +186,7 @@ impl<'a, V: RectRasterableVol + ReadVol> CachedVolGrid2d<'a, V> {
.get(&ck)
.ok_or(VolGrid2dError::NoSuchChunk)?;
// Store most recently looked up chunk in the cache
self.cache = Some((ck, Arc::clone(&chunk)));
self.cache = Some((ck, Arc::clone(chunk)));
chunk
};
let co = VolGrid2d::<V>::chunk_offs(pos);

View File

@ -57,7 +57,7 @@ impl Plugin {
.map_err(PluginError::Io)?;
let data = toml::de::from_slice::<PluginData>(
&files
files
.get(Path::new("plugin.toml"))
.ok_or(PluginError::NoConfig)?,
)

View File

@ -216,7 +216,7 @@ impl State {
let num_cpu = num_cpus::get() as u64;
let slow_limit = (num_cpu / 2 + num_cpu / 4).max(1);
tracing::trace!(?slow_limit, "Slow Thread limit");
ecs.insert(SlowJobPool::new(slow_limit, Arc::clone(&thread_pool)));
ecs.insert(SlowJobPool::new(slow_limit, Arc::clone(thread_pool)));
// TODO: only register on the server
ecs.insert(EventBus::<ServerEvent>::default());

View File

@ -275,24 +275,24 @@ impl<'a> System<'a> for Sys {
let mut join_struct = JoinStruct {
entity,
uid: &uid,
uid,
char_state,
pos: &mut pos,
vel: &mut vel,
ori: &mut ori,
mass: &mass,
mass,
density: &mut density,
energy,
inventory,
controller: &mut controller,
health,
body: &body,
physics: &physics,
body,
physics,
melee_attack: read_data.melee_attacks.get(entity),
beam: read_data.beams.get(entity),
stat: &stat,
skill_set: &skill_set,
combo: &combo,
stat,
skill_set,
combo,
alignment: read_data.alignments.get(entity),
terrain: &read_data.terrain,
};

View File

@ -255,25 +255,25 @@ impl ProtocolMetricCache {
let finished = RemoveReason::Finished.to_str();
let dropped = RemoveReason::Dropped.to_str();
CacheLine {
smsg_it: m.smsg_it.with_label_values(&[&cid, &s]),
smsg_ib: m.smsg_ib.with_label_values(&[&cid, &s]),
smsg_it: m.smsg_it.with_label_values(&[cid, &s]),
smsg_ib: m.smsg_ib.with_label_values(&[cid, &s]),
smsg_ot: [
m.smsg_ot.with_label_values(&[&cid, &s, &finished]),
m.smsg_ot.with_label_values(&[&cid, &s, &dropped]),
m.smsg_ot.with_label_values(&[cid, &s, finished]),
m.smsg_ot.with_label_values(&[cid, &s, dropped]),
],
smsg_ob: [
m.smsg_ob.with_label_values(&[&cid, &s, &finished]),
m.smsg_ob.with_label_values(&[&cid, &s, &dropped]),
m.smsg_ob.with_label_values(&[cid, &s, finished]),
m.smsg_ob.with_label_values(&[cid, &s, dropped]),
],
rmsg_it: m.rmsg_it.with_label_values(&[&cid, &s]),
rmsg_ib: m.rmsg_ib.with_label_values(&[&cid, &s]),
rmsg_it: m.rmsg_it.with_label_values(&[cid, &s]),
rmsg_ib: m.rmsg_ib.with_label_values(&[cid, &s]),
rmsg_ot: [
m.rmsg_ot.with_label_values(&[&cid, &s, &finished]),
m.rmsg_ot.with_label_values(&[&cid, &s, &dropped]),
m.rmsg_ot.with_label_values(&[cid, &s, finished]),
m.rmsg_ot.with_label_values(&[cid, &s, dropped]),
],
rmsg_ob: [
m.rmsg_ob.with_label_values(&[&cid, &s, &finished]),
m.rmsg_ob.with_label_values(&[&cid, &s, &dropped]),
m.rmsg_ob.with_label_values(&[cid, &s, finished]),
m.rmsg_ob.with_label_values(&[cid, &s, dropped]),
],
}
})
@ -353,24 +353,24 @@ impl Drop for ProtocolMetricCache {
let dropped = RemoveReason::Dropped.to_str();
for (sid, _) in self.cache.drain() {
let s = sid.to_string();
let _ = m.smsg_it.remove_label_values(&[&cid, &s]);
let _ = m.smsg_ib.remove_label_values(&[&cid, &s]);
let _ = m.smsg_ot.remove_label_values(&[&cid, &s, &finished]);
let _ = m.smsg_ot.remove_label_values(&[&cid, &s, &dropped]);
let _ = m.smsg_ob.remove_label_values(&[&cid, &s, &finished]);
let _ = m.smsg_ob.remove_label_values(&[&cid, &s, &dropped]);
let _ = m.rmsg_it.remove_label_values(&[&cid, &s]);
let _ = m.rmsg_ib.remove_label_values(&[&cid, &s]);
let _ = m.rmsg_ot.remove_label_values(&[&cid, &s, &finished]);
let _ = m.rmsg_ot.remove_label_values(&[&cid, &s, &dropped]);
let _ = m.rmsg_ob.remove_label_values(&[&cid, &s, &finished]);
let _ = m.rmsg_ob.remove_label_values(&[&cid, &s, &dropped]);
let _ = m.smsg_it.remove_label_values(&[cid, &s]);
let _ = m.smsg_ib.remove_label_values(&[cid, &s]);
let _ = m.smsg_ot.remove_label_values(&[cid, &s, finished]);
let _ = m.smsg_ot.remove_label_values(&[cid, &s, dropped]);
let _ = m.smsg_ob.remove_label_values(&[cid, &s, finished]);
let _ = m.smsg_ob.remove_label_values(&[cid, &s, dropped]);
let _ = m.rmsg_it.remove_label_values(&[cid, &s]);
let _ = m.rmsg_ib.remove_label_values(&[cid, &s]);
let _ = m.rmsg_ot.remove_label_values(&[cid, &s, finished]);
let _ = m.rmsg_ot.remove_label_values(&[cid, &s, dropped]);
let _ = m.rmsg_ob.remove_label_values(&[cid, &s, finished]);
let _ = m.rmsg_ob.remove_label_values(&[cid, &s, dropped]);
}
let _ = m.ping.remove_label_values(&[&cid]);
let _ = m.sdata_frames_t.remove_label_values(&[&cid]);
let _ = m.sdata_frames_b.remove_label_values(&[&cid]);
let _ = m.rdata_frames_t.remove_label_values(&[&cid]);
let _ = m.rdata_frames_b.remove_label_values(&[&cid]);
let _ = m.ping.remove_label_values(&[cid]);
let _ = m.sdata_frames_t.remove_label_values(&[cid]);
let _ = m.sdata_frames_b.remove_label_values(&[cid]);
let _ = m.rdata_frames_t.remove_label_values(&[cid]);
let _ = m.rdata_frames_b.remove_label_values(&[cid]);
}
}

View File

@ -443,7 +443,7 @@ impl Network {
/// [`ListenAddr`]: crate::api::ListenAddr
#[instrument(name="network", skip(self), fields(p = %self.local_pid))]
pub async fn connected(&self) -> Result<Participant, NetworkError> {
let participant = self.connected_receiver.lock().await.recv().await?;
let participant = self.connected_receiver.lock().await.recv().await.ok_or(NetworkError::NetworkClosed)?;
self.participant_disconnect_sender.lock().await.insert(
participant.remote_pid,
Arc::clone(&participant.a2s_disconnect_s),
@ -1196,14 +1196,6 @@ impl<T> From<crossbeam_channel::SendError<T>> for NetworkError {
fn from(_err: crossbeam_channel::SendError<T>) -> Self { NetworkError::NetworkClosed }
}
impl From<std::option::NoneError> for StreamError {
fn from(_err: std::option::NoneError) -> Self { StreamError::StreamClosed }
}
impl From<std::option::NoneError> for NetworkError {
fn from(_err: std::option::NoneError) -> Self { NetworkError::NetworkClosed }
}
impl<T> From<mpsc::error::SendError<T>> for NetworkError {
fn from(_err: mpsc::error::SendError<T>) -> Self { NetworkError::NetworkClosed }
}

View File

@ -2,7 +2,6 @@
#![cfg_attr(test, deny(rust_2018_idioms))]
#![cfg_attr(test, deny(warnings))]
#![deny(clippy::clone_on_ref_ptr)]
#![feature(try_trait)]
//! Crate to handle high level networking of messages with different
//! requirements and priorities over a number of protocols

View File

@ -229,19 +229,19 @@ impl NetworkMetrics {
for no in 0..5 {
let _ = self
.participants_channel_ids
.remove_label_values(&[&remote_p, &no.to_string()]);
.remove_label_values(&[remote_p, &no.to_string()]);
}
let _ = self
.channels_connected_total
.remove_label_values(&[&remote_p]);
.remove_label_values(&[remote_p]);
let _ = self
.channels_disconnected_total
.remove_label_values(&[&remote_p]);
.remove_label_values(&[remote_p]);
let _ = self
.participants_bandwidth
.remove_label_values(&[&remote_p]);
let _ = self.streams_opened_total.remove_label_values(&[&remote_p]);
let _ = self.streams_closed_total.remove_label_values(&[&remote_p]);
.remove_label_values(&[remote_p]);
let _ = self.streams_opened_total.remove_label_values(&[remote_p]);
let _ = self.streams_closed_total.remove_label_values(&[remote_p]);
}
}

View File

@ -441,7 +441,7 @@ impl BParticipant {
};
let remove_c = |recv_protocols: &mut HashMap<Cid, JoinHandle<()>>, cid: &Cid| {
match recv_protocols.remove(&cid) {
match recv_protocols.remove(cid) {
Some(h) => {
h.abort();
debug!(?cid, "remove protocol");

View File

@ -39,7 +39,7 @@ impl<'a> Write for TuiLog<'a> {
Output::TextBlock(text) => {
// search for newlines
for t in text.split_inclusive('\n') {
span.content.to_mut().push_str(&t);
span.content.to_mut().push_str(t);
if t.ends_with('\n') && span.content.len() != 0 {
spans.push(std::mem::replace(&mut span, Span::raw("")));
lines.push(std::mem::take(&mut spans));

View File

@ -266,7 +266,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
});
if is_equippable {
if let Some(lantern) = lantern_opt {
swap_lantern(&mut state.ecs().write_storage(), entity, &lantern);
swap_lantern(&mut state.ecs().write_storage(), entity, lantern);
}
if let Some(pos) = state.ecs().read_storage::<comp::Pos>().get(entity) {
dropped_items.extend(inventory.equip(slot).into_iter().map(|x| {
@ -557,7 +557,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
let ability_map = &state.ecs().read_resource::<AbilityMap>();
let msm = state.ecs().read_resource::<MaterialStatManifest>();
let item = match slot {
Slot::Inventory(slot) => inventory.take_half(slot, &ability_map, &msm),
Slot::Inventory(slot) => inventory.take_half(slot, ability_map, &msm),
Slot::Equip(_) => None,
};

View File

@ -66,7 +66,7 @@ impl Server {
pos,
explosion,
owner,
} => handle_explosion(&self, pos, explosion, owner),
} => handle_explosion(self, pos, explosion, owner),
ServerEvent::Shoot {
entity,
dir,
@ -87,21 +87,21 @@ impl Server {
ori,
} => handle_beam(self, properties, pos, ori),
ServerEvent::Knockback { entity, impulse } => {
handle_knockback(&self, entity, impulse)
handle_knockback(self, entity, impulse)
},
ServerEvent::Damage { entity, change } => handle_damage(&self, entity, change),
ServerEvent::Damage { entity, change } => handle_damage(self, entity, change),
ServerEvent::PoiseChange {
entity,
change,
kb_dir,
} => handle_poise(&self, entity, change, kb_dir),
} => handle_poise(self, entity, change, kb_dir),
ServerEvent::Delete(entity) => handle_delete(self, entity),
ServerEvent::Destroy { entity, cause } => handle_destroy(self, entity, cause),
ServerEvent::InventoryManip(entity, manip) => handle_inventory(self, entity, manip),
ServerEvent::GroupManip(entity, manip) => handle_group(self, entity, manip),
ServerEvent::Respawn(entity) => handle_respawn(&self, entity),
ServerEvent::Respawn(entity) => handle_respawn(self, entity),
ServerEvent::LandOnGround { entity, vel } => {
handle_land_on_ground(&self, entity, vel)
handle_land_on_ground(self, entity, vel)
},
ServerEvent::EnableLantern(entity) => handle_lantern(self, entity, true),
ServerEvent::DisableLantern(entity) => handle_lantern(self, entity, false),
@ -203,12 +203,12 @@ impl Server {
buff_change,
} => handle_buff(self, entity, buff_change),
ServerEvent::EnergyChange { entity, change } => {
handle_energy_change(&self, entity, change)
handle_energy_change(self, entity, change)
},
ServerEvent::ComboChange { entity, change } => {
handle_combo_change(&self, entity, change)
handle_combo_change(self, entity, change)
},
ServerEvent::RequestSiteInfo { entity, id } => handle_site_info(&self, entity, id),
ServerEvent::RequestSiteInfo { entity, id } => handle_site_info(self, entity, id),
ServerEvent::MineBlock { entity, pos, tool } => {
handle_mine_block(self, entity, pos, tool)
},
@ -216,7 +216,7 @@ impl Server {
entity,
target,
max_range,
} => handle_teleport_to(&self, entity, target, max_range),
} => handle_teleport_to(self, entity, target, max_range),
ServerEvent::CreateSafezone { range, pos } => {
self.state.create_safezone(range, pos).build();
},

View File

@ -295,11 +295,11 @@ impl Server {
},
..WorldOpts::default()
},
&state.thread_pool(),
state.thread_pool(),
);
#[cfg(feature = "worldgen")]
let map = world.get_map_data(index.as_index_ref(), &state.thread_pool());
let map = world.get_map_data(index.as_index_ref(), state.thread_pool());
#[cfg(not(feature = "worldgen"))]
let (world, index) = World::generate(settings.world_seed);
@ -773,7 +773,7 @@ impl Server {
None,
pos,
&slow_jobs,
Arc::clone(&world),
Arc::clone(world),
index.clone(),
*ecs.read_resource::<TimeOfDay>(),
);
@ -785,7 +785,7 @@ impl Server {
let end_of_server_tick = Instant::now();
// 8) Update Metrics
run_now::<sys::metrics::Sys>(&self.state.ecs());
run_now::<sys::metrics::Sys>(self.state.ecs());
{
// Report timing info
@ -861,7 +861,7 @@ impl Server {
)
.send(ServerInit::GameSync {
// Send client their entity
entity_package: TrackedComps::fetch(&self.state.ecs())
entity_package: TrackedComps::fetch(self.state.ecs())
.create_entity_package(entity, None, None, None)
.expect(
"We just created this entity as marked() (using create_entity_synced) so \

View File

@ -142,7 +142,7 @@ impl LoginProvider {
{
// Plugin player join hooks execute for all players, but are only allowed to
// filter non-admins.
match plugin_manager.execute_event(&world, &PlayerJoinEvent {
match plugin_manager.execute_event(world, &PlayerJoinEvent {
player_name: username.clone(),
player_id: *uuid.as_bytes(),
}) {

View File

@ -137,7 +137,7 @@ pub fn load_character_data(
)?;
let char_waypoint = character_data.waypoint.as_ref().and_then(|x| {
match convert_waypoint_from_database_json(&x) {
match convert_waypoint_from_database_json(x) {
Ok(w) => Some(w),
Err(e) => {
warn!(
@ -240,7 +240,7 @@ pub fn load_character_list(player_uuid_: &str, connection: &Connection) -> Chara
characters
.iter()
.map(|character_data| {
let char = convert_character_from_database(&character_data);
let char = convert_character_from_database(character_data);
let db_body;

View File

@ -33,6 +33,7 @@ pub type PersistedComponents = (
// This macro is called at build-time, and produces the necessary migration info
// for the `run_migrations` call below.
mod embedded {
#![allow(clippy::nonstandard_macro_braces)] //tmp as of false positive !?
use refinery::embed_migrations;
embed_migrations!("./src/migrations");
}
@ -210,7 +211,7 @@ pub(crate) fn establish_connection(
set_log_mode(connection, settings.sql_log_mode);
veloren_connection.sql_log_mode = settings.sql_log_mode;
rusqlite::vtab::array::load_module(&connection).expect("Failed to load sqlite array module");
rusqlite::vtab::array::load_module(connection).expect("Failed to load sqlite array module");
connection.set_prepared_statement_cache_capacity(100);

View File

@ -135,7 +135,7 @@ impl Settings {
/// path: Directory that contains the server config directory
pub fn singleplayer(path: &Path) -> Self {
let load = Self::load(&path);
let load = Self::load(path);
Self {
//BUG: theoretically another process can grab the port between here and server
// creation, however the timewindow is quite small

View File

@ -726,7 +726,7 @@ impl StateExt for State {
if let Some(msg) = msg.take() {
lazy_msg = Some(client.prepare(msg));
}
lazy_msg.as_ref().map(|ref msg| client.send_prepared(&msg));
lazy_msg.as_ref().map(|msg| client.send_prepared(msg));
}
}
@ -743,7 +743,7 @@ impl StateExt for State {
if let Some(msg) = msg.take() {
lazy_msg = Some(client.prepare(msg));
}
lazy_msg.as_ref().map(|ref msg| client.send_prepared(&msg));
lazy_msg.as_ref().map(|msg| client.send_prepared(msg));
}
}

View File

@ -666,19 +666,19 @@ impl<'a> AgentData<'a> {
DEFAULT_INTERACTION_TIME
})
{
self.interact(agent, controller, &read_data, event_emitter);
self.interact(agent, controller, read_data, event_emitter);
} else {
agent.action_state.timer = 0.0;
agent.target = None;
controller.actions.push(ControlAction::Stand);
self.idle(agent, controller, &read_data);
self.idle(agent, controller, read_data);
}
} else if thread_rng().gen::<f32>() < 0.1 {
self.choose_target(agent, controller, &read_data, event_emitter);
self.choose_target(agent, controller, read_data, event_emitter);
} else if agent.awareness > AWARENESS_INVESTIGATE_THRESHOLD {
self.handle_elevated_awareness(agent, controller, read_data);
} else {
self.idle(agent, controller, &read_data);
self.idle(agent, controller, read_data);
}
}
@ -725,7 +725,7 @@ impl<'a> AgentData<'a> {
} else {
agent.action_state.timer = 0.0;
agent.target = None;
self.idle(agent, controller, &read_data);
self.idle(agent, controller, read_data);
}
// If not fleeing, attack the hostile entity!
@ -750,7 +750,7 @@ impl<'a> AgentData<'a> {
} else if read_data.time.0 - selected_at > RETARGETING_THRESHOLD_SECONDS
&& matches!(self.alignment, Some(Alignment::Enemy))
{
self.choose_target(agent, controller, &read_data, event_emitter);
self.choose_target(agent, controller, read_data, event_emitter);
} else {
// TODO Add utility for attacking vs leaving target alone
let target_data = TargetData {
@ -758,7 +758,7 @@ impl<'a> AgentData<'a> {
body: read_data.bodies.get(target),
scale: read_data.scales.get(target),
};
self.attack(agent, controller, &target_data, &read_data);
self.attack(agent, controller, &target_data, read_data);
}
}
}
@ -1538,7 +1538,7 @@ impl<'a> AgentData<'a> {
&& e != self.entity
&& !e_health.is_dead
&& !invulnerability_is_in_buffs(read_data.buffs.get(*e))
&& (try_owner_alignment(self.alignment, &read_data).and_then(|a| try_owner_alignment(*e_alignment, &read_data).map(|b| a.hostile_towards(*b))).unwrap_or(false) || (
&& (try_owner_alignment(self.alignment, read_data).and_then(|a| try_owner_alignment(*e_alignment, read_data).map(|b| a.hostile_towards(*b))).unwrap_or(false) || (
if let Some(rtsim_entity) = &self.rtsim_entity {
if agent.behavior.can(BehaviorCapability::SPEAK) {
if rtsim_entity.brain.remembers_fight_with_character(&e_stats.name) {
@ -1800,32 +1800,32 @@ impl<'a> AgentData<'a> {
// depending on the distance from the agent to the target
match tactic {
Tactic::Melee => {
self.handle_melee_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_melee_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Axe => {
self.handle_axe_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_axe_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Hammer => {
self.handle_hammer_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_hammer_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Sword => {
self.handle_sword_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_sword_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Bow => {
self.handle_bow_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_bow_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Staff => {
self.handle_staff_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_staff_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Sceptre => {
self.handle_sceptre_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_sceptre_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::StoneGolem => self.handle_stone_golem_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::CircleCharge {
radius,
@ -1834,8 +1834,8 @@ impl<'a> AgentData<'a> {
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
radius,
circle_time,
),
@ -1843,126 +1843,126 @@ impl<'a> AgentData<'a> {
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::TailSlap => {
self.handle_tail_slap_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_tail_slap_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::QuadLowQuick => self.handle_quadlow_quick_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::QuadLowBasic => self.handle_quadlow_basic_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::QuadMedJump => self.handle_quadmed_jump_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::QuadMedBasic => self.handle_quadmed_basic_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::QuadLowBeam => self.handle_quadlow_beam_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::Theropod => {
self.handle_theropod_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_theropod_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Turret => {
self.handle_turret_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_turret_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::FixedTurret => self.handle_fixed_turret_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::RotatingTurret => self.handle_rotating_turret_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::Tornado => self.handle_tornado_attack(controller),
Tactic::Mindflayer => self.handle_mindflayer_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::BirdLargeFire => self.handle_birdlarge_fire_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
// Mostly identical to BirdLargeFire but tweaked for flamethrower instead of shockwave
Tactic::BirdLargeBreathe => self.handle_birdlarge_breathe_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::BirdLargeBasic => self.handle_birdlarge_basic_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::Minotaur => {
self.handle_minotaur_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_minotaur_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::ClayGolem => self.handle_clay_golem_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::TidalWarrior => self.handle_tidal_warrior_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::RadialTurret => self.handle_radial_turret_attack(
agent,
controller,
&attack_data,
&tgt_data,
&read_data,
tgt_data,
read_data,
),
Tactic::Yeti => {
self.handle_yeti_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_yeti_attack(agent, controller, &attack_data, tgt_data, read_data)
},
Tactic::Harvester => {
self.handle_harvester_attack(agent, controller, &attack_data, &tgt_data, &read_data)
self.handle_harvester_attack(agent, controller, &attack_data, tgt_data, read_data)
},
}
}
@ -3945,7 +3945,7 @@ impl<'a> AgentData<'a> {
) {
// Currently this means that we are in a safezone
if invulnerability_is_in_buffs(read_data.buffs.get(*self.entity)) {
self.idle(agent, controller, &read_data);
self.idle(agent, controller, read_data);
return;
}
@ -3962,7 +3962,7 @@ impl<'a> AgentData<'a> {
self.follow(agent, controller, &read_data.terrain, &sound_pos);
} else {
// TODO: Change this to a search action instead of idle
self.idle(agent, controller, &read_data);
self.idle(agent, controller, read_data);
}
} else if self.flees {
let aggro = agent.psyche.aggro;
@ -3972,10 +3972,10 @@ impl<'a> AgentData<'a> {
if close_enough && (aggro <= 0.5 || (aggro <= 0.7 && loud_sound)) {
self.flee(agent, controller, &read_data.terrain, &sound_pos);
} else {
self.idle(agent, controller, &read_data);
self.idle(agent, controller, read_data);
}
} else {
self.idle(agent, controller, &read_data);
self.idle(agent, controller, read_data);
}
}
}

View File

@ -228,7 +228,7 @@ impl<'a> System<'a> for Sys {
}),
)));
}
lazy_msg.as_ref().map(|ref msg| client.send_prepared(&msg));
lazy_msg.as_ref().map(|msg| client.send_prepared(msg));
}
}
}

View File

@ -80,7 +80,7 @@ impl<'a> System<'a> for Sys {
client.send(ServerGeneral::TerrainChunkUpdate {
key,
chunk: Ok(SerializedTerrainChunk::via_heuristic(
&chunk,
chunk,
presence.lossy_terrain_compression,
)),
})?;

View File

@ -54,15 +54,15 @@ impl LazyTerrainMessage {
key: *chunk_key,
chunk: Ok(match generate_chunk() {
Ok(chunk) => SerializedTerrainChunk::via_heuristic(
&chunk,
chunk,
presence.lossy_terrain_compression,
),
Err(e) => return Err(e),
}),
}));
}
lazy_msg.as_ref().map(|ref msg| {
let _ = client.send_prepared(&msg);
lazy_msg.as_ref().map(|msg| {
let _ = client.send_prepared(msg);
if presence.lossy_terrain_compression {
network_metrics.chunks_served_lossy.inc();
} else {
@ -326,8 +326,8 @@ impl<'a> System<'a> for Sys {
lazy_msg
.prepare_and_send::<!, _>(
&network_metrics,
&client,
&presence,
client,
presence,
&key,
|| Ok(&*chunk),
)

View File

@ -37,8 +37,8 @@ impl<'a> System<'a> for Sys {
{
if let Err(()) = lazy_msg.prepare_and_send(
&network_metrics,
&client,
&presence,
client,
presence,
chunk_key,
|| terrain.get_key(*chunk_key).ok_or(()),
) {
@ -58,7 +58,7 @@ impl<'a> System<'a> for Sys {
CompressedData::compress(&terrain_changes.modified_blocks, 1),
)));
}
lazy_msg.as_ref().map(|ref msg| client.send_prepared(&msg));
lazy_msg.as_ref().map(|msg| client.send_prepared(msg));
}
}
}

View File

@ -362,7 +362,7 @@ pub fn maintain_egui_inner(
ui.label("-");
}
if let Some(body) = body {
ui.label(body_species(&body));
ui.label(body_species(body));
} else {
ui.label("-");
}

View File

@ -181,7 +181,7 @@ impl AudioFrontend {
// Fade the existing channel out. It will be removed when the fade completes.
existing_channel.set_fader(Fader::fade_out(fade_out, music_volume));
let mut next_music_channel = MusicChannel::new(&audio_stream);
let mut next_music_channel = MusicChannel::new(audio_stream);
next_music_channel.set_fader(Fader::fade_in(fade_in, self.get_music_volume()));

View File

@ -72,7 +72,7 @@ impl EventMapper for CombatEventMapper {
let sfx_state = self.event_history.entry(entity).or_default();
let mapped_event = inventory.map_or(SfxEvent::Idle, |inv| {
Self::map_event(character, sfx_state, &inv)
Self::map_event(character, sfx_state, inv)
});
// Check for SFX config entry for this movement

View File

@ -661,7 +661,7 @@ impl<'a> Widget for Bag<'a> {
self.stats.name.to_string(),
self.client.entity(),
true,
&inventory,
inventory,
&state.bg_ids,
)
.set(state.ids.inventory_scroller, ui);
@ -699,7 +699,7 @@ impl<'a> Widget for Bag<'a> {
let expand_btn_top = if self.show.bag_inv { 53.0 } else { 460.0 };
if expand_btn
.top_right_with_margins_on(state.bg_ids.bg_frame, expand_btn_top, 37.0)
.with_tooltip(self.tooltip_manager, &txt, "", &bag_tooltip, TEXT_COLOR)
.with_tooltip(self.tooltip_manager, txt, "", &bag_tooltip, TEXT_COLOR)
.set(state.ids.bag_expand_btn, ui)
.was_clicked()
{
@ -772,7 +772,7 @@ impl<'a> Widget for Bag<'a> {
self.health,
self.skill_set,
*self.body,
&self.msm,
self.msm,
)
.min(999.9);
let indicator_col = cr_color(combat_rating);
@ -825,8 +825,8 @@ impl<'a> Widget for Bag<'a> {
};
btn.with_tooltip(
self.tooltip_manager,
&tooltip_head,
&tooltip_txt,
tooltip_head,
tooltip_txt,
&bag_tooltip,
TEXT_COLOR,
)

View File

@ -99,6 +99,7 @@ pub struct State {
ids: Ids,
}
#[allow(clippy::enum_variant_names)] //think about renaming to ToogleEvent
pub enum Event {
ToggleBag,
ToggleSettings,
@ -172,7 +173,7 @@ impl<'a> Widget for Buttons<'a> {
self.tooltip_manager,
&localized_strings
.get("hud.bag.inventory")
.replace("{playername}", &self.stats.name.to_string().as_str()),
.replace("{playername}", &self.stats.name),
"",
&button_tooltip,
TEXT_COLOR,
@ -190,7 +191,7 @@ impl<'a> Widget for Buttons<'a> {
{
self.create_new_button_with_shadow(
ui,
&bag,
bag,
state.ids.bag,
state.ids.bag_text_bg,
state.ids.bag_text,
@ -228,7 +229,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.settings_press)
.with_tooltip(
self.tooltip_manager,
&localized_strings.get("common.settings"),
localized_strings.get("common.settings"),
"",
&button_tooltip,
TEXT_COLOR,
@ -246,7 +247,7 @@ impl<'a> Widget for Buttons<'a> {
{
self.create_new_button_with_shadow(
ui,
&settings,
settings,
state.ids.settings_button,
state.ids.settings_text_bg,
state.ids.settings_text,
@ -261,7 +262,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.social_press)
.with_tooltip(
self.tooltip_manager,
&localized_strings.get("hud.social"),
localized_strings.get("hud.social"),
"",
&button_tooltip,
TEXT_COLOR,
@ -279,7 +280,7 @@ impl<'a> Widget for Buttons<'a> {
{
self.create_new_button_with_shadow(
ui,
&social,
social,
state.ids.social_button,
state.ids.social_text_bg,
state.ids.social_text,
@ -293,7 +294,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.map_press)
.with_tooltip(
self.tooltip_manager,
&localized_strings.get("hud.map.map_title"),
localized_strings.get("hud.map.map_title"),
"",
&button_tooltip,
TEXT_COLOR,
@ -311,7 +312,7 @@ impl<'a> Widget for Buttons<'a> {
{
self.create_new_button_with_shadow(
ui,
&map,
map,
state.ids.map_button,
state.ids.map_text_bg,
state.ids.map_text,
@ -330,7 +331,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.spellbook_press)
.with_tooltip(
self.tooltip_manager,
&localized_strings.get("hud.diary"),
localized_strings.get("hud.diary"),
"",
&button_tooltip,
TEXT_COLOR,
@ -348,7 +349,7 @@ impl<'a> Widget for Buttons<'a> {
{
self.create_new_button_with_shadow(
ui,
&spell,
spell,
state.ids.spellbook_button,
state.ids.spellbook_text_bg,
state.ids.spellbook_text,
@ -362,14 +363,14 @@ impl<'a> Widget for Buttons<'a> {
.mid_top_with_margin_on(state.ids.spellbook_button, -12.0 + arrow_ani as f64)
.color(Some(QUALITY_LEGENDARY))
.set(state.ids.sp_arrow, ui);
Text::new(&localized_strings.get("hud.sp_arrow_txt"))
Text::new(localized_strings.get("hud.sp_arrow_txt"))
.mid_top_with_margin_on(state.ids.sp_arrow, -18.0)
.graphics_for(state.ids.spellbook_button)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(BLACK)
.set(state.ids.sp_arrow_txt_bg, ui);
Text::new(&localized_strings.get("hud.sp_arrow_txt"))
Text::new(localized_strings.get("hud.sp_arrow_txt"))
.graphics_for(state.ids.spellbook_button)
.bottom_right_with_margins_on(state.ids.sp_arrow_txt_bg, 1.0, 1.0)
.font_id(self.fonts.cyri.conrod_id)
@ -385,7 +386,7 @@ impl<'a> Widget for Buttons<'a> {
.press_image(self.imgs.crafting_icon_press)
.with_tooltip(
self.tooltip_manager,
&localized_strings.get("hud.crafting"),
localized_strings.get("hud.crafting"),
"",
&button_tooltip,
TEXT_COLOR,
@ -403,7 +404,7 @@ impl<'a> Widget for Buttons<'a> {
{
self.create_new_button_with_shadow(
ui,
&crafting,
crafting,
state.ids.crafting_button,
state.ids.crafting_text_bg,
state.ids.crafting_text,

View File

@ -107,7 +107,7 @@ impl<'a> Chat<'a> {
pub fn prepare_tab_completion(mut self, input: String) -> Self {
self.force_completions = if let Some(index) = input.find('\t') {
Some(cmd::complete(&input[..index], &self.client))
Some(cmd::complete(&input[..index], self.client))
} else {
None
};
@ -291,7 +291,7 @@ impl<'a> Widget for Chat<'a> {
if let Some(replacement) = &s.completions.get(s.completions_index.unwrap()) {
let (completed, offset) =
do_tab_completion(cursor, &s.input.message, replacement);
force_cursor = cursor_offset_to_index(offset, &completed, &ui, &self.fonts);
force_cursor = cursor_offset_to_index(offset, &completed, ui, self.fonts);
s.input.message = completed;
}
});
@ -321,8 +321,8 @@ impl<'a> Widget for Chat<'a> {
force_cursor = cursor_offset_to_index(
s.input.message.len(),
&s.input.message,
&ui,
&self.fonts,
ui,
self.fonts,
);
} else {
s.input.message.clear();
@ -350,7 +350,7 @@ impl<'a> Widget for Chat<'a> {
});
}
let (color, icon) = render_chat_mode(&state.input.mode, &self.imgs);
let (color, icon) = render_chat_mode(&state.input.mode, self.imgs);
Image::new(icon)
.w_h(CHAT_ICON_WIDTH, CHAT_ICON_HEIGHT)
.top_left_with_margin_on(state.ids.chat_input_bg, 2.0)
@ -448,7 +448,7 @@ impl<'a> Widget for Chat<'a> {
})
.filter(|m| {
if let Some(chat_tab) = current_chat_tab {
chat_tab.filter.satisfies(&m, &group_members)
chat_tab.filter.satisfies(m, &group_members)
} else {
true
}
@ -468,7 +468,7 @@ impl<'a> Widget for Chat<'a> {
// This would be easier if conrod used the v-metrics from rusttype.
if item.i < messages.len() {
let message = &messages[item.i];
let (color, icon) = render_chat_line(&message.chat_type, &self.imgs);
let (color, icon) = render_chat_line(&message.chat_type, self.imgs);
// For each ChatType needing localization get/set matching pre-formatted
// localized string. This string will be formatted with the data
// provided in ChatType in the client/src/mod.rs
@ -542,7 +542,7 @@ impl<'a> Widget for Chat<'a> {
.hover_image(self.imgs.selection_hover)
.hover_image(self.imgs.selection_press)
.image_color(shading)
.label(&self.localized_strings.get("hud.chat.all"))
.label(self.localized_strings.get("hud.chat.all"))
.label_font_size(self.fonts.cyri.scale(14))
.label_font_id(self.fonts.cyri.conrod_id)
.label_color(TEXT_COLOR.alpha(alpha))
@ -601,7 +601,7 @@ impl<'a> Widget for Chat<'a> {
.set(state.ids.chat_tab_tooltip_bg, ui);
Text::new(
&self
self
.localized_strings
.get("hud.chat.chat_tab_hover_tooltip"),
)
@ -724,7 +724,7 @@ fn cursor_offset_to_index(offset: usize, text: &str, ui: &Ui, fonts: &Fonts) ->
// Width and font must match that of the chat TextEdit
let font = ui.fonts.get(fonts.opensans.conrod_id)?;
let font_size = fonts.opensans.scale(15);
let infos = text::line::infos(&text, &font, font_size).wrap_by_whitespace(CHAT_BOX_INPUT_WIDTH);
let infos = text::line::infos(text, font, font_size).wrap_by_whitespace(CHAT_BOX_INPUT_WIDTH);
cursor::index_before_char(infos, offset)
}

View File

@ -316,7 +316,7 @@ impl<'a> Widget for Crafting<'a> {
}
// Title
Text::new(&self.localized_strings.get("hud.crafting"))
Text::new(self.localized_strings.get("hud.crafting"))
.mid_top_with_margin_on(state.ids.window_frame, 9.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
@ -391,7 +391,7 @@ impl<'a> Widget for Crafting<'a> {
})
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get(crafting_tab.name_key()),
self.localized_strings.get(crafting_tab.name_key()),
"",
&tabs_tooltip,
TEXT_COLOR,
@ -471,7 +471,7 @@ impl<'a> Widget for Crafting<'a> {
}
for (i, (name, recipe, is_craftable)) in ordered_recipes
.into_iter()
.filter(|(_, recipe, _)| self.show.crafting_tab.satisfies(&recipe))
.filter(|(_, recipe, _)| self.show.crafting_tab.satisfies(recipe))
.enumerate()
{
let button = Button::image(if state.selected_recipe.as_ref() == Some(name) {
@ -552,7 +552,7 @@ impl<'a> Widget for Crafting<'a> {
.and_then(|rn| self.client.recipe_book().get(rn.as_str()).map(|r| (rn, r)))
{
// Title
Text::new(&recipe.output.0.name())
Text::new(recipe.output.0.name())
.mid_top_with_margin_on(state.ids.align_ing, -22.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
@ -582,7 +582,7 @@ impl<'a> Widget for Crafting<'a> {
.then_some(self.imgs.button_press)
.unwrap_or(self.imgs.button),
)
.label(&self.localized_strings.get("hud.crafting.craft"))
.label(self.localized_strings.get("hud.crafting.craft"))
.label_y(conrod_core::position::Relative::Scalar(1.0))
.label_color(can_perform.then_some(TEXT_COLOR).unwrap_or(TEXT_GRAY_COLOR))
.label_font_size(self.fonts.cyri.scale(12))
@ -650,7 +650,7 @@ impl<'a> Widget for Crafting<'a> {
for (row, chunk) in CraftingTab::iter()
.filter(|crafting_tab| match crafting_tab {
CraftingTab::All => false,
_ => crafting_tab.satisfies(&recipe),
_ => crafting_tab.satisfies(recipe),
})
.filter(|crafting_tab| crafting_tab != &self.show.crafting_tab)
.collect::<Vec<_>>()
@ -673,7 +673,7 @@ impl<'a> Widget for Crafting<'a> {
};
icon.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get(crafting_tab.name_key()),
self.localized_strings.get(crafting_tab.name_key()),
"",
&tabs_tooltip,
TEXT_COLOR,
@ -684,7 +684,7 @@ impl<'a> Widget for Crafting<'a> {
// Crafting Station Info
if recipe.craft_sprite.is_some() {
Text::new(
&self
self
.localized_strings
.get("hud.crafting.req_crafting_station"),
)
@ -727,7 +727,7 @@ impl<'a> Widget for Crafting<'a> {
Some(SpriteKind::TanningRack) => "hud.crafting.tanning_rack",
_ => "",
};
Text::new(&self.localized_strings.get(station_name))
Text::new(self.localized_strings.get(station_name))
.right_from(state.ids.req_station_img, 10.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
@ -741,7 +741,7 @@ impl<'a> Widget for Crafting<'a> {
.set(state.ids.req_station_txt, ui);
}
// Ingredients Text
let mut ing_txt = Text::new(&self.localized_strings.get("hud.crafting.ingredients"))
let mut ing_txt = Text::new(self.localized_strings.get("hud.crafting.ingredients"))
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(18))
.color(TEXT_COLOR);
@ -864,13 +864,13 @@ impl<'a> Widget for Crafting<'a> {
// Align "Required" Text below last ingredient
if *amount == 0 {
// Catalysts/Tools
Text::new(&self.localized_strings.get("hud.crafting.tool_cata"))
Text::new(self.localized_strings.get("hud.crafting.tool_cata"))
.down_from(state.ids.ingredient_frame[i - 1], 20.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(TEXT_COLOR)
.set(state.ids.req_text[i], ui);
Text::new(&item_def.name())
Text::new(item_def.name())
.right_from(state.ids.ingredient_frame[i], 10.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
@ -934,7 +934,7 @@ impl<'a> Widget for Crafting<'a> {
events.push(Event::SearchRecipe(Some(string)));
}
} else {
Text::new(&self.localized_strings.get("hud.crafting.recipes"))
Text::new(self.localized_strings.get("hud.crafting.recipes"))
.mid_top_with_margin_on(state.ids.align_rec, -22.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))

View File

@ -317,7 +317,7 @@ impl<'a> Widget for Diary<'a> {
// Title
self.create_new_text(
&self.localized_strings.get("hud.diary"),
self.localized_strings.get("hud.diary"),
state.frame,
3.0,
29,
@ -372,7 +372,7 @@ impl<'a> Widget for Diary<'a> {
let tooltip_txt = if !locked {
""
} else {
&self.localized_strings.get("hud.skill.not_unlocked")
self.localized_strings.get("hud.skill.not_unlocked")
};
img.w_h(50.0, 50.0).set(state.weapon_imgs[i.0], ui);
// Lock Image
@ -425,7 +425,7 @@ impl<'a> Widget for Diary<'a> {
.with_tooltip(
self.tooltip_manager,
i.1,
&tooltip_txt,
tooltip_txt,
&diary_tooltip,
TEXT_COLOR,
)
@ -513,7 +513,7 @@ impl<'a> Widget for Diary<'a> {
},
_ => "Unknown",
};
self.create_new_text(&tree_title, state.content_align, 2.0, 34, TEXT_COLOR)
self.create_new_text(tree_title, state.content_align, 2.0, 34, TEXT_COLOR)
.set(state.tree_title_txt, ui);
// Skill Trees
// Alignment Placing
@ -816,8 +816,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_bot_l[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.dodge_title"),
&self.localized_strings.get("hud.skill.dodge"),
self.localized_strings.get("hud.skill.dodge_title"),
self.localized_strings.get("hud.skill.dodge"),
&diary_tooltip,
TEXT_COLOR,
)
@ -858,8 +858,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_bot_r[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.climbing_title"),
&self.localized_strings.get("hud.skill.climbing"),
self.localized_strings.get("hud.skill.climbing_title"),
self.localized_strings.get("hud.skill.climbing"),
&diary_tooltip,
TEXT_COLOR,
)
@ -890,8 +890,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_bot_r[3], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.swim_title"),
&self.localized_strings.get("hud.skill.swim"),
self.localized_strings.get("hud.skill.swim_title"),
self.localized_strings.get("hud.skill.swim"),
&diary_tooltip,
TEXT_COLOR,
)
@ -929,8 +929,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_l[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.sw_trip_str_title"),
&self.localized_strings.get("hud.skill.sw_trip_str"),
self.localized_strings.get("hud.skill.sw_trip_str_title"),
self.localized_strings.get("hud.skill.sw_trip_str"),
&diary_tooltip,
TEXT_COLOR,
)
@ -981,8 +981,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_r[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.sw_dash_title"),
&self.localized_strings.get("hud.skill.sw_dash"),
self.localized_strings.get("hud.skill.sw_dash_title"),
self.localized_strings.get("hud.skill.sw_dash"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1132,10 +1132,10 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_l[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self
self
.localized_strings
.get("hud.skill.axe_double_strike_title"),
&self.localized_strings.get("hud.skill.axe_double_strike"),
self.localized_strings.get("hud.skill.axe_double_strike"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1186,8 +1186,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_r[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.axe_spin_title"),
&self.localized_strings.get("hud.skill.axe_spin"),
self.localized_strings.get("hud.skill.axe_spin_title"),
self.localized_strings.get("hud.skill.axe_spin"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1316,10 +1316,10 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_l[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self
self
.localized_strings
.get("hud.skill.hmr_single_strike_title"),
&self.localized_strings.get("hud.skill.hmr_single_strike"),
self.localized_strings.get("hud.skill.hmr_single_strike"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1370,10 +1370,10 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_r[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self
self
.localized_strings
.get("hud.skill.hmr_charged_melee_title"),
&self.localized_strings.get("hud.skill.hmr_charged_melee"),
self.localized_strings.get("hud.skill.hmr_charged_melee"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1501,8 +1501,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_l[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.bow_charged_title"),
&self.localized_strings.get("hud.skill.bow_charged"),
self.localized_strings.get("hud.skill.bow_charged_title"),
self.localized_strings.get("hud.skill.bow_charged"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1563,8 +1563,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_r[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.bow_repeater_title"),
&self.localized_strings.get("hud.skill.bow_repeater"),
self.localized_strings.get("hud.skill.bow_repeater_title"),
self.localized_strings.get("hud.skill.bow_repeater"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1684,8 +1684,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_l[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.st_fireball_title"),
&self.localized_strings.get("hud.skill.st_fireball"),
self.localized_strings.get("hud.skill.st_fireball_title"),
self.localized_strings.get("hud.skill.st_fireball"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1726,10 +1726,10 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_r[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self
self
.localized_strings
.get("hud.skill.st_flamethrower_title"),
&self.localized_strings.get("hud.skill.st_flamethrower"),
self.localized_strings.get("hud.skill.st_flamethrower"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1848,8 +1848,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_l[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.sc_lifesteal_title"),
&self.localized_strings.get("hud.skill.sc_lifesteal"),
self.localized_strings.get("hud.skill.sc_lifesteal_title"),
self.localized_strings.get("hud.skill.sc_lifesteal"),
&diary_tooltip,
TEXT_COLOR,
)
@ -1900,8 +1900,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_r[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.sc_heal_title"),
&self.localized_strings.get("hud.skill.sc_heal"),
self.localized_strings.get("hud.skill.sc_heal_title"),
self.localized_strings.get("hud.skill.sc_heal"),
&diary_tooltip,
TEXT_COLOR,
)
@ -2010,8 +2010,8 @@ impl<'a> Widget for Diary<'a> {
.mid_top_with_margin_on(state.skills_top_l[0], 3.0)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get("hud.skill.pick_strike_title"),
&self.localized_strings.get("hud.skill.pick_strike"),
self.localized_strings.get("hud.skill.pick_strike_title"),
self.localized_strings.get("hud.skill.pick_strike"),
&diary_tooltip,
TEXT_COLOR,
)
@ -2176,25 +2176,25 @@ impl<'a> Diary<'a> {
if create_skill_button(
id,
conrod_widget_id,
&self.skill_set,
self.skill_set,
skill,
self.fonts,
&get_skill_label(skill, &self.skill_set),
&get_skill_label(skill, self.skill_set),
)
.with_tooltip(
self.tooltip_manager,
&self
self
.localized_strings
.get(&format!("hud.skill.{}_title", skill_key)),
&format_skill_description(
&self
self
.localized_strings
.get(&format!("hud.skill.{}", skill_key)),
skill,
&self.skill_set,
&self.localized_strings,
self.skill_set,
self.localized_strings,
),
&diary_tooltip,
diary_tooltip,
TEXT_COLOR,
)
.set(widget_id, ui)

View File

@ -87,7 +87,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("common.resume"))
.label(self.localized_strings.get("common.resume"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -104,7 +104,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("common.settings"))
.label(self.localized_strings.get("common.settings"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -120,7 +120,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("common.controls"))
.label(self.localized_strings.get("common.controls"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -136,7 +136,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("common.characters"))
.label(self.localized_strings.get("common.characters"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -152,7 +152,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("esc_menu.logout"))
.label(self.localized_strings.get("esc_menu.logout"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))
@ -168,7 +168,7 @@ impl<'a> Widget for EscMenu<'a> {
.w_h(210.0, 50.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("esc_menu.quit_game"))
.label(self.localized_strings.get("esc_menu.quit_game"))
.label_y(conrod_core::position::Relative::Scalar(3.0))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(20))

View File

@ -375,7 +375,7 @@ impl<'a> Widget for Group<'a> {
(stats, skill_set, inventory, health, body)
{
let combat_rating =
combat::combat_rating(inventory, health, skill_set, *body, &self.msm);
combat::combat_rating(inventory, health, skill_set, *body, self.msm);
let char_name = stats.name.to_string();
let health_perc =
health.current() as f64 / health.base_max().max(health.maximum()) as f64;
@ -421,7 +421,7 @@ impl<'a> Widget for Group<'a> {
}
if health.is_dead {
// Death Text
Text::new(&self.localized_strings.get("hud.group.dead"))
Text::new(self.localized_strings.get("hud.group.dead"))
.mid_top_with_margin_on(state.ids.member_panels_bg[i], 1.0)
.font_size(20)
.font_id(self.fonts.cyri.conrod_id)
@ -526,7 +526,7 @@ impl<'a> Widget for Group<'a> {
cur.as_secs_f32() / max.as_secs_f32() * 1000.0
})
}) as u32; // Percentage to determine which frame of the timer overlay is displayed
let buff_img = hud::get_buff_image(buff.kind, &self.imgs);
let buff_img = hud::get_buff_image(buff.kind, self.imgs);
let buff_widget = Image::new(buff_img).w_h(15.0, 15.0);
let buff_widget = if let Some(id) = prev_id {
buff_widget.right_from(id, 1.0)
@ -606,7 +606,7 @@ impl<'a> Widget for Group<'a> {
.color(Some(UI_HIGHLIGHT_0))
.set(state.ids.member_panels_frame[i], ui);
// Panel Text
Text::new(&self.localized_strings.get("hud.group.out_of_range"))
Text::new(self.localized_strings.get("hud.group.out_of_range"))
.mid_top_with_margin_on(state.ids.member_panels_bg[i], 3.0)
.font_size(16)
.font_id(self.fonts.cyri.conrod_id)
@ -625,7 +625,7 @@ impl<'a> Widget for Group<'a> {
.press_image(self.imgs.button)
.label_color(TEXT_COLOR_GREY)
.image_color(TEXT_COLOR_GREY)
.label(&self.localized_strings.get("hud.group.add_friend"))
.label(self.localized_strings.get("hud.group.add_friend"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(10))
.set(state.ids.btn_friend, ui)
@ -636,7 +636,7 @@ impl<'a> Widget for Group<'a> {
.bottom_right_with_margins_on(state.ids.bg, 5.0, 5.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("hud.group.leave"))
.label(self.localized_strings.get("hud.group.leave"))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(10))
@ -654,7 +654,7 @@ impl<'a> Widget for Group<'a> {
.mid_bottom_with_margin_on(state.ids.btn_friend, -27.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("hud.group.assign_leader"))
.label(self.localized_strings.get("hud.group.assign_leader"))
.label_color(if state.selected_member.is_some() {
TEXT_COLOR
} else {
@ -677,7 +677,7 @@ impl<'a> Widget for Group<'a> {
.mid_bottom_with_margin_on(state.ids.btn_leader, -27.0)
.hover_image(self.imgs.button)
.press_image(self.imgs.button)
.label(&self.localized_strings.get("hud.group.link_group"))
.label(self.localized_strings.get("hud.group.link_group"))
.hover_image(self.imgs.button)
.press_image(self.imgs.button)
.label_color(TEXT_COLOR_GREY)
@ -693,7 +693,7 @@ impl<'a> Widget for Group<'a> {
.down_from(state.ids.btn_link, 5.0)
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.label(&self.localized_strings.get("hud.group.kick"))
.label(self.localized_strings.get("hud.group.kick"))
.label_color(if state.selected_member.is_some() {
TEXT_COLOR
} else {
@ -735,7 +735,7 @@ impl<'a> Widget for Group<'a> {
// List member names
for (i, &uid) in group_members.iter().copied().enumerate() {
let selected = state.selected_member.map_or(false, |u| u == uid);
let char_name = uid_to_name_text(uid, &self.client);
let char_name = uid_to_name_text(uid, self.client);
// TODO: Do something special visually if uid == leader
if Button::image(if selected {
self.imgs.selection
@ -784,7 +784,7 @@ impl<'a> Widget for Group<'a> {
// TODO: add group name here too
// Invite text
let name = uid_to_name_text(invite_uid, &self.client);
let name = uid_to_name_text(invite_uid, self.client);
let invite_text = match kind {
InviteKind::Group => self
.localized_strings
@ -816,7 +816,7 @@ impl<'a> Widget for Group<'a> {
.label(&format!(
"[{}] {}",
&accept_key,
&self.localized_strings.get("common.accept")
self.localized_strings.get("common.accept")
))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -841,7 +841,7 @@ impl<'a> Widget for Group<'a> {
.label(&format!(
"[{}] {}",
&decline_key,
&self.localized_strings.get("common.decline")
self.localized_strings.get("common.decline")
))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -72,9 +72,9 @@ enum ImageSpec {
impl ImageSpec {
fn create_graphic(&self) -> Graphic {
match self {
ImageSpec::Png(specifier) => Graphic::Image(graceful_load_img(&specifier), None),
ImageSpec::Png(specifier) => Graphic::Image(graceful_load_img(specifier), None),
ImageSpec::Vox(specifier) => Graphic::Voxel(
graceful_load_segment_no_skin(&specifier),
graceful_load_segment_no_skin(specifier),
Transform {
stretch: false,
..Default::default()
@ -82,7 +82,7 @@ impl ImageSpec {
SampleStrat::None,
),
ImageSpec::VoxTrans(specifier, offset, [rot_x, rot_y, rot_z], zoom) => Graphic::Voxel(
graceful_load_segment_no_skin(&specifier),
graceful_load_segment_no_skin(specifier),
Transform {
ori: Quaternion::rotation_x(rot_x * std::f32::consts::PI / 180.0)
.rotated_y(rot_y * std::f32::consts::PI / 180.0)
@ -140,7 +140,7 @@ impl ItemImgs {
// Load new graphic
let graphic = spec.create_graphic();
// See if we already have an id we can use
match self.map.get(&kind) {
match self.map.get(kind) {
Some(id) => ui.replace_graphic(*id, graphic),
// Otherwise, generate new id and insert it into our Id -> ItemKey map
None => {

View File

@ -158,7 +158,7 @@ impl VoxelMinimap {
&& delta.y < VOXEL_MINIMAP_SIDELENGTH / TerrainChunkSize::RECT_SIZE.y
&& !self.chunk_minimaps.contains_key(&key)
{
if let Some((_, column)) = self.keyed_jobs.spawn(Some(&pool), key, || {
if let Some((_, column)) = self.keyed_jobs.spawn(Some(pool), key, || {
let arc_chunk = Arc::clone(chunk);
move |_| {
let mut layers = Vec::new();

View File

@ -964,7 +964,7 @@ impl Hud {
span!(_guard, "update_layout", "Hud::update_layout");
let mut events = core::mem::take(&mut self.events);
if global_state.settings.interface.map_show_voxel_map {
self.voxel_minimap.maintain(&client, &mut self.ui);
self.voxel_minimap.maintain(client, &mut self.ui);
}
let (ref mut ui_widgets, ref mut item_tooltip_manager, ref mut tooltip_manager) =
&mut self.ui.set_widgets();
@ -1356,13 +1356,13 @@ impl Hud {
.mid_top_with_margin_on(self.ids.player_rank_up, 8.0)
.set(self.ids.player_rank_up_txt_number, ui_widgets);
// Static "New Rank!" text
Text::new(&i18n.get("hud.rank_up"))
Text::new(i18n.get("hud.rank_up"))
.font_size(40)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, fade))
.mid_bottom_with_margin_on(self.ids.player_rank_up, 20.0)
.set(self.ids.player_rank_up_txt_0_bg, ui_widgets);
Text::new(&i18n.get("hud.rank_up"))
Text::new(i18n.get("hud.rank_up"))
.font_size(40)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(1.0, 1.0, 1.0, fade))
@ -1370,14 +1370,14 @@ impl Hud {
.set(self.ids.player_rank_up_txt_0, ui_widgets);
// Variable skilltree text
let skill = match display.skill_tree {
General => &i18n.get("common.weapons.general"),
Weapon(ToolKind::Hammer) => &i18n.get("common.weapons.hammer"),
Weapon(ToolKind::Axe) => &i18n.get("common.weapons.axe"),
Weapon(ToolKind::Sword) => &i18n.get("common.weapons.sword"),
Weapon(ToolKind::Sceptre) => &i18n.get("common.weapons.sceptre"),
Weapon(ToolKind::Bow) => &i18n.get("common.weapons.bow"),
Weapon(ToolKind::Staff) => &i18n.get("common.weapons.staff"),
Weapon(ToolKind::Pick) => &i18n.get("common.tool.mining"),
General => i18n.get("common.weapons.general"),
Weapon(ToolKind::Hammer) => i18n.get("common.weapons.hammer"),
Weapon(ToolKind::Axe) => i18n.get("common.weapons.axe"),
Weapon(ToolKind::Sword) => i18n.get("common.weapons.sword"),
Weapon(ToolKind::Sceptre) => i18n.get("common.weapons.sceptre"),
Weapon(ToolKind::Bow) => i18n.get("common.weapons.bow"),
Weapon(ToolKind::Staff) => i18n.get("common.weapons.staff"),
Weapon(ToolKind::Pick) => i18n.get("common.tool.mining"),
_ => "Unknown",
};
Text::new(skill)
@ -1442,7 +1442,7 @@ impl Hud {
1.0
};
Text::new(&i18n.get("hud.sct.block"))
Text::new(i18n.get("hud.sct.block"))
.font_size(font_size)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, fade))
@ -1451,7 +1451,7 @@ impl Hud {
ui_widgets.win_h * (-0.3) + y - 3.0,
)
.set(player_sct_bg_id, ui_widgets);
Text::new(&i18n.get("hud.sct.block"))
Text::new(i18n.get("hud.sct.block"))
.font_size(font_size)
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.69, 0.82, 0.88, fade))
@ -1494,7 +1494,7 @@ impl Hud {
quality,
distance,
fonts,
&i18n,
i18n,
&global_state.settings.controls,
properties,
pulse,
@ -1554,7 +1554,7 @@ impl Hud {
overitem::TEXT_COLOR,
pos.distance_squared(player_pos),
&self.fonts,
&i18n,
i18n,
&global_state.settings.controls,
overitem_properties,
self.pulse,
@ -1579,7 +1579,7 @@ impl Hud {
overitem::TEXT_COLOR,
pos.distance_squared(player_pos),
&self.fonts,
&i18n,
i18n,
&global_state.settings.controls,
overitem_properties,
self.pulse,
@ -1929,7 +1929,7 @@ impl Hud {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.bottom_left_with_margins_on(ui_widgets.window, 200.0, 120.0)
.label(&i18n.get("hud.tutorial_btn"))
.label(i18n.get("hud.tutorial_btn"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(18))
.label_color(TEXT_COLOR)
@ -1977,8 +1977,8 @@ impl Hud {
Intro::Show => {
if self.show.intro {
self.show.want_grab = false;
let quest_headline = &i18n.get("hud.temp_quest_headline");
let quest_text = &i18n.get("hud.temp_quest_text");
let quest_headline = i18n.get("hud.temp_quest_headline");
let quest_text = i18n.get("hud.temp_quest_text");
Image::new(self.imgs.quest_bg)
.w_h(404.0, 858.0)
.middle_of(ui_widgets.window)
@ -2017,7 +2017,7 @@ impl Hud {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.mid_bottom_with_margin_on(self.ids.q_text_bg, -80.0)
.label(&i18n.get("common.close"))
.label(i18n.get("common.close"))
.label_font_id(self.fonts.cyri.conrod_id)
.label_font_size(self.fonts.cyri.scale(22))
.label_color(TEXT_COLOR)
@ -2041,14 +2041,14 @@ impl Hud {
)
.color(Some(QUALITY_LEGENDARY))
.set(self.ids.tut_arrow, ui_widgets);
Text::new(&i18n.get("hud.tutorial_elements"))
Text::new(i18n.get("hud.tutorial_elements"))
.mid_top_with_margin_on(self.ids.tut_arrow, -50.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(40))
.color(BLACK)
.floating(true)
.set(self.ids.tut_arrow_txt_bg, ui_widgets);
Text::new(&i18n.get("hud.tutorial_elements"))
Text::new(i18n.get("hud.tutorial_elements"))
.bottom_right_with_margins_on(self.ids.tut_arrow_txt_bg, 1.0, 1.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(40))
@ -2372,8 +2372,8 @@ impl Hud {
&self.rot_imgs,
tooltip_manager,
i18n,
&player_stats,
&skill_set,
player_stats,
skill_set,
self.pulse,
)
.set(self.ids.buttons, ui_widgets)
@ -2397,7 +2397,7 @@ impl Hud {
&self.fonts,
i18n,
self.pulse,
&global_state,
global_state,
tooltip_manager,
&msm,
)
@ -2430,7 +2430,7 @@ impl Hud {
&self.world_map,
&self.fonts,
camera.get_orientation(),
&global_state,
global_state,
self.show.location_marker,
&self.voxel_minimap,
)
@ -2450,7 +2450,7 @@ impl Hud {
&self.fonts,
&global_state.i18n,
&global_state.settings,
&prompt_dialog_settings,
prompt_dialog_settings,
&global_state.window.key_layout,
)
.set(self.ids.prompt_dialog, ui_widgets)
@ -2521,10 +2521,10 @@ impl Hud {
&self.item_imgs,
&self.fonts,
&self.rot_imgs,
&health,
&inventory,
&energy,
&skillset,
health,
inventory,
energy,
skillset,
//&character_state,
self.pulse,
//&controller,
@ -2559,12 +2559,12 @@ impl Hud {
&mut self.slot_manager,
self.pulse,
i18n,
&player_stats,
&skill_set,
&health,
&energy,
player_stats,
skill_set,
health,
energy,
&self.show,
&body,
body,
&msm,
)
.set(self.ids.bag, ui_widgets)
@ -2637,11 +2637,11 @@ impl Hud {
&self.rot_imgs,
tooltip_manager,
i18n,
&player_buffs,
player_buffs,
self.pulse,
&global_state,
&health,
&energy,
global_state,
health,
energy,
)
.set(self.ids.buffs, ui_widgets)
{
@ -2663,7 +2663,7 @@ impl Hud {
&self.rot_imgs,
item_tooltip_manager,
&self.item_imgs,
&inventory,
inventory,
&msm,
tooltip_manager,
&mut self.show,
@ -2709,7 +2709,7 @@ impl Hud {
if global_state.settings.interface.toggle_chat {
for event in Chat::new(
&mut self.new_messages,
&client,
client,
global_state,
self.pulse,
&self.imgs,
@ -2778,7 +2778,7 @@ impl Hud {
// Settings
if let Windows::Settings = self.show.open_windows {
for event in SettingsWindow::new(
&global_state,
global_state,
&self.show,
&self.imgs,
&self.fonts,
@ -2872,7 +2872,7 @@ impl Hud {
for event in Diary::new(
&self.show,
client,
&skill_set,
skill_set,
&self.imgs,
&self.item_imgs,
&self.fonts,
@ -2908,7 +2908,7 @@ impl Hud {
&self.fonts,
self.pulse,
i18n,
&global_state,
global_state,
tooltip_manager,
self.show.location_marker,
)

View File

@ -250,7 +250,7 @@ impl<'a> Widget for Overhead<'a> {
cur.as_secs_f32() / max.as_secs_f32() * 1000.0
})
}) as u32; // Percentage to determine which frame of the timer overlay is displayed
let buff_img = get_buff_image(buff.kind, &self.imgs);
let buff_img = get_buff_image(buff.kind, self.imgs);
let buff_widget = Image::new(buff_img).w_h(20.0, 20.0);
// Sort buffs into rows of 5 slots
let x = i % 5;
@ -452,9 +452,9 @@ impl<'a> Widget for Overhead<'a> {
// Speech bubble
if let Some(bubble) = self.bubble {
let dark_mode = self.settings.speech_bubble_dark_mode;
let localizer = |s: &str, i| -> String { self.i18n.get_variation(&s, i).to_string() };
let localizer = |s: &str, i| -> String { self.i18n.get_variation(s, i).to_string() };
let bubble_contents: String = bubble.message(localizer);
let (text_color, shadow_color) = bubble_color(&bubble, dark_mode);
let (text_color, shadow_color) = bubble_color(bubble, dark_mode);
let mut text = Text::new(&bubble_contents)
.color(text_color)
.font_id(self.fonts.cyri.conrod_id)
@ -585,7 +585,7 @@ impl<'a> Widget for Overhead<'a> {
}
text_shadow.set(state.ids.speech_bubble_shadow, ui);
let icon = if self.settings.speech_bubble_icon {
bubble_icon(&bubble, &self.imgs)
bubble_icon(bubble, self.imgs)
} else {
self.imgs.nothing
};

View File

@ -141,7 +141,7 @@ impl<'a> Widget for Chat<'a> {
.set(state.ids.window_r, ui);
// General Title
Text::new(&self.localized_strings.get("hud.settings.general"))
Text::new(self.localized_strings.get("hud.settings.general"))
.top_left_with_margins_on(state.ids.window, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -150,7 +150,7 @@ impl<'a> Widget for Chat<'a> {
// Chat Transp
Text::new(
&self
self
.localized_strings
.get("hud.settings.background_transparency"),
)
@ -178,7 +178,7 @@ impl<'a> Widget for Chat<'a> {
// "Show character names in chat" toggle button
Text::new(
&self
self
.localized_strings
.get("hud.settings.chat_character_name"),
)
@ -211,7 +211,7 @@ impl<'a> Widget for Chat<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.char_name_text, 20.0)
.label(&self.localized_strings.get("hud.settings.reset_chat"))
.label(self.localized_strings.get("hud.settings.reset_chat"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -223,7 +223,7 @@ impl<'a> Widget for Chat<'a> {
}
// Tabs Title
Text::new(&self.localized_strings.get("hud.settings.chat_tabs"))
Text::new(self.localized_strings.get("hud.settings.chat_tabs"))
.top_left_with_margins_on(state.ids.window_r, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -326,7 +326,7 @@ impl<'a> Widget for Chat<'a> {
{
let mut updated_chat_tab = chat_tab.clone();
Text::new(&self.localized_strings.get("hud.settings.label"))
Text::new(self.localized_strings.get("hud.settings.label"))
.top_left_with_margins_on(state.ids.tab_content_align, 5.0, 25.0)
.font_size(self.fonts.cyri.scale(16))
.font_id(self.fonts.cyri.conrod_id)
@ -354,7 +354,7 @@ impl<'a> Widget for Chat<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.w_h(100.0, 30.0)
.label(&self.localized_strings.get("hud.settings.delete"))
.label(self.localized_strings.get("hud.settings.delete"))
.label_font_size(self.fonts.cyri.scale(14))
.label_font_id(self.fonts.cyri.conrod_id)
.label_color(TEXT_COLOR)
@ -409,7 +409,7 @@ impl<'a> Widget for Chat<'a> {
};
//Messages
Text::new(&self.localized_strings.get("hud.settings.messages"))
Text::new(self.localized_strings.get("hud.settings.messages"))
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(16))
.color(TEXT_COLOR)
@ -432,7 +432,7 @@ impl<'a> Widget for Chat<'a> {
updated_chat_tab.filter.message_all = !chat_tab.filter.message_all;
};
Text::new(&self.localized_strings.get("hud.settings.show_all"))
Text::new(self.localized_strings.get("hud.settings.show_all"))
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(16))
.color(TEXT_COLOR)
@ -450,7 +450,7 @@ impl<'a> Widget for Chat<'a> {
}
create_toggle_text(
&self.localized_strings.get("hud.settings.group"),
self.localized_strings.get("hud.settings.group"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_group, 5.0)
@ -474,7 +474,7 @@ impl<'a> Widget for Chat<'a> {
}
create_toggle_text(
&self.localized_strings.get("hud.settings.faction"),
self.localized_strings.get("hud.settings.faction"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_faction, 5.0)
@ -495,7 +495,7 @@ impl<'a> Widget for Chat<'a> {
}
create_toggle_text(
&self.localized_strings.get("hud.settings.world"),
self.localized_strings.get("hud.settings.world"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_world, 5.0)
@ -516,7 +516,7 @@ impl<'a> Widget for Chat<'a> {
}
create_toggle_text(
&self.localized_strings.get("hud.settings.region"),
self.localized_strings.get("hud.settings.region"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_region, 5.0)
@ -537,7 +537,7 @@ impl<'a> Widget for Chat<'a> {
}
create_toggle_text(
&self.localized_strings.get("hud.settings.say"),
self.localized_strings.get("hud.settings.say"),
!chat_tab.filter.message_all,
)
.right_from(state.ids.btn_messages_say, 5.0)
@ -548,7 +548,7 @@ impl<'a> Widget for Chat<'a> {
.set(state.ids.icon_messages_say, ui);
//Activity
Text::new(&self.localized_strings.get("hud.settings.activity"))
Text::new(self.localized_strings.get("hud.settings.activity"))
.top_left_with_margins_on(state.ids.tab_content_align_r, 0.0, 5.0)
.align_middle_y_of(state.ids.text_messages)
.font_size(self.fonts.cyri.scale(16))
@ -599,7 +599,7 @@ impl<'a> Widget for Chat<'a> {
}
//Death
Text::new(&self.localized_strings.get("hud.settings.death"))
Text::new(self.localized_strings.get("hud.settings.death"))
.down_from(state.ids.list_activity, 20.0)
.font_size(self.fonts.cyri.scale(16))
.font_id(self.fonts.cyri.conrod_id)

View File

@ -182,7 +182,7 @@ impl<'a> Widget for Controls<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(prev_id, 20.0)
.label(&self.localized_strings.get("hud.settings.reset_keybinds"))
.label(self.localized_strings.get("hud.settings.reset_keybinds"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -123,7 +123,7 @@ impl<'a> Widget for Gameplay<'a> {
let display_clamp = self.global_state.settings.gameplay.camera_clamp_angle;
// Mouse Pan Sensitivity
Text::new(&self.localized_strings.get("hud.settings.pan_sensitivity"))
Text::new(self.localized_strings.get("hud.settings.pan_sensitivity"))
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -155,7 +155,7 @@ impl<'a> Widget for Gameplay<'a> {
.set(state.ids.mouse_pan_value, ui);
// Mouse Zoom Sensitivity
Text::new(&self.localized_strings.get("hud.settings.zoom_sensitivity"))
Text::new(self.localized_strings.get("hud.settings.zoom_sensitivity"))
.down_from(state.ids.mouse_pan_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -188,7 +188,7 @@ impl<'a> Widget for Gameplay<'a> {
// Camera clamp angle
Text::new(
&self
self
.localized_strings
.get("hud.settings.camera_clamp_angle"),
)
@ -241,7 +241,7 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.invert_scroll_zoom"),
)
@ -271,7 +271,7 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.invert_mouse_y_axis"),
)
@ -301,7 +301,7 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.invert_controller_y_axis"),
)
@ -331,7 +331,7 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.enable_mouse_smoothing"),
)
@ -344,7 +344,7 @@ impl<'a> Widget for Gameplay<'a> {
// Free look behaviour
Text::new(
&self
self
.localized_strings
.get("hud.settings.free_look_behavior"),
)
@ -355,10 +355,10 @@ impl<'a> Widget for Gameplay<'a> {
.set(state.ids.free_look_behavior_text, ui);
let mode_label_list = [
&self
self
.localized_strings
.get("hud.settings.press_behavior.toggle"),
&self
self
.localized_strings
.get("hud.settings.press_behavior.hold"),
];
@ -383,7 +383,7 @@ impl<'a> Widget for Gameplay<'a> {
// Auto walk behavior
Text::new(
&self
self
.localized_strings
.get("hud.settings.auto_walk_behavior"),
)
@ -413,7 +413,7 @@ impl<'a> Widget for Gameplay<'a> {
// Camera clamp behavior
Text::new(
&self
self
.localized_strings
.get("hud.settings.camera_clamp_behavior"),
)
@ -443,7 +443,7 @@ impl<'a> Widget for Gameplay<'a> {
// Player physics behavior
Text::new(
&self
self
.localized_strings
.get("hud.settings.player_physics_behavior"),
)
@ -499,7 +499,7 @@ impl<'a> Widget for Gameplay<'a> {
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.stop_auto_walk_on_input"),
)
@ -528,7 +528,7 @@ impl<'a> Widget for Gameplay<'a> {
));
}
Text::new(&self.localized_strings.get("hud.settings.auto_camera"))
Text::new(self.localized_strings.get("hud.settings.auto_camera"))
.right_from(state.ids.auto_camera_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -542,7 +542,7 @@ impl<'a> Widget for Gameplay<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.camera_clamp_behavior_list, 12.0)
.label(&self.localized_strings.get("hud.settings.reset_gameplay"))
.label(self.localized_strings.get("hud.settings.reset_gameplay"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -164,7 +164,7 @@ impl<'a> Widget for Interface<'a> {
let crosshair_type = self.global_state.settings.interface.crosshair_type;
let ui_scale = self.global_state.settings.interface.ui_scale;
Text::new(&self.localized_strings.get("hud.settings.general"))
Text::new(self.localized_strings.get("hud.settings.general"))
.top_left_with_margins_on(state.ids.window, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -187,7 +187,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleHelp(show_help));
}
Text::new(&self.localized_strings.get("hud.settings.help_window"))
Text::new(self.localized_strings.get("hud.settings.help_window"))
.right_from(state.ids.button_help, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -213,7 +213,7 @@ impl<'a> Widget for Interface<'a> {
));
}
Text::new(&self.localized_strings.get("hud.settings.loading_tips"))
Text::new(self.localized_strings.get("hud.settings.loading_tips"))
.right_from(state.ids.load_tips_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -236,7 +236,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleDebug(show_debug));
}
Text::new(&self.localized_strings.get("hud.settings.debug_info"))
Text::new(self.localized_strings.get("hud.settings.debug_info"))
.right_from(state.ids.debug_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -260,7 +260,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleHitboxes(show_hitboxes));
}
Text::new(&self.localized_strings.get("hud.settings.show_hitboxes"))
Text::new(self.localized_strings.get("hud.settings.show_hitboxes"))
.right_from(state.ids.hitboxes_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -284,7 +284,7 @@ impl<'a> Widget for Interface<'a> {
events.push(ToggleChat(show_chat));
}
Text::new(&self.localized_strings.get("hud.settings.show_chat"))
Text::new(self.localized_strings.get("hud.settings.show_chat"))
.right_from(state.ids.chat_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -293,7 +293,7 @@ impl<'a> Widget for Interface<'a> {
.set(state.ids.chat_button_label, ui);
// Ui Scale
Text::new(&self.localized_strings.get("hud.settings.ui_scale"))
Text::new(self.localized_strings.get("hud.settings.ui_scale"))
.down_from(state.ids.chat_button, 20.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -539,13 +539,13 @@ impl<'a> Widget for Interface<'a> {
.graphics_for(state.ids.ch_3_bg)
.set(state.ids.crosshair_inner_3, ui);
// Crosshair Transparency Text and Slider
Text::new(&self.localized_strings.get("hud.settings.crosshair"))
Text::new(self.localized_strings.get("hud.settings.crosshair"))
.down_from(state.ids.absolute_scale_button, 20.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.ch_title, ui);
Text::new(&self.localized_strings.get("hud.settings.transparency"))
Text::new(self.localized_strings.get("hud.settings.transparency"))
.right_from(state.ids.ch_3_bg, 20.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -578,7 +578,7 @@ impl<'a> Widget for Interface<'a> {
.set(state.ids.ch_transp_value, ui);
// Hotbar text
Text::new(&self.localized_strings.get("hud.settings.hotbar"))
Text::new(self.localized_strings.get("hud.settings.hotbar"))
.down_from(state.ids.ch_1_bg, 20.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -613,7 +613,7 @@ impl<'a> Widget for Interface<'a> {
ShortcutNumbers::Off => events.push(ToggleShortcutNumbers(ShortcutNumbers::On)),
}
}
Text::new(&self.localized_strings.get("hud.settings.toggle_shortcuts"))
Text::new(self.localized_strings.get("hud.settings.toggle_shortcuts"))
.right_from(state.ids.show_shortcuts_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -641,7 +641,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(BuffPosition(BuffPosition::Bar))
}
Text::new(&self.localized_strings.get("hud.settings.buffs_skillbar"))
Text::new(self.localized_strings.get("hud.settings.buffs_skillbar"))
.right_from(state.ids.buff_pos_bar_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -668,7 +668,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(BuffPosition(BuffPosition::Map))
}
Text::new(&self.localized_strings.get("hud.settings.buffs_mmap"))
Text::new(self.localized_strings.get("hud.settings.buffs_mmap"))
.right_from(state.ids.buff_pos_map_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -690,7 +690,7 @@ impl<'a> Widget for Interface<'a> {
*/
// SCT/ Scrolling Combat Text
Text::new(
&self
self
.localized_strings
.get("hud.settings.scrolling_combat_text"),
)
@ -715,7 +715,7 @@ impl<'a> Widget for Interface<'a> {
events.push(Sct(!self.global_state.settings.interface.sct))
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.scrolling_combat_text"),
)
@ -739,7 +739,7 @@ impl<'a> Widget for Interface<'a> {
.set(state.ids.sct_single_dmg_radio, ui);
Text::new(
&self
self
.localized_strings
.get("hud.settings.single_damage_number"),
)
@ -766,7 +766,7 @@ impl<'a> Widget for Interface<'a> {
!self.global_state.settings.interface.sct_damage_batch,
))
}
Text::new(&self.localized_strings.get("hud.settings.cumulated_damage"))
Text::new(self.localized_strings.get("hud.settings.cumulated_damage"))
.right_from(state.ids.sct_show_batch_radio, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -785,7 +785,7 @@ impl<'a> Widget for Interface<'a> {
.press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked)
.set(state.ids.sct_inc_dmg_radio, ui);
Text::new(&self.localized_strings.get("hud.settings.incoming_damage"))
Text::new(self.localized_strings.get("hud.settings.incoming_damage"))
.right_from(state.ids.sct_inc_dmg_radio, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -810,7 +810,7 @@ impl<'a> Widget for Interface<'a> {
))
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.cumulated_incoming_damage"),
)
@ -823,7 +823,7 @@ impl<'a> Widget for Interface<'a> {
}
// Speech bubble dark mode
Text::new(&self.localized_strings.get("hud.settings.speech_bubble"))
Text::new(self.localized_strings.get("hud.settings.speech_bubble"))
.down_from(
if self.global_state.settings.interface.sct {
state.ids.sct_batch_inc_radio
@ -852,7 +852,7 @@ impl<'a> Widget for Interface<'a> {
events.push(SpeechBubbleDarkMode(speech_bubble_dark_mode));
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.speech_bubble_dark_mode"),
)
@ -876,7 +876,7 @@ impl<'a> Widget for Interface<'a> {
events.push(SpeechBubbleIcon(speech_bubble_icon));
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.speech_bubble_icon"),
)
@ -888,7 +888,7 @@ impl<'a> Widget for Interface<'a> {
// Energybars Numbers
// Hotbar text
Text::new(&self.localized_strings.get("hud.settings.energybar_numbers"))
Text::new(self.localized_strings.get("hud.settings.energybar_numbers"))
.down_from(state.ids.speech_bubble_icon_button, 20.0)
.font_size(self.fonts.cyri.scale(18))
.font_id(self.fonts.cyri.conrod_id)
@ -918,7 +918,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(ToggleBarNumbers(BarNumbers::Off))
}
Text::new(&self.localized_strings.get("hud.settings.none"))
Text::new(self.localized_strings.get("hud.settings.none"))
.right_from(state.ids.show_bar_numbers_none_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -949,7 +949,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(ToggleBarNumbers(BarNumbers::Values))
}
Text::new(&self.localized_strings.get("hud.settings.values"))
Text::new(self.localized_strings.get("hud.settings.values"))
.right_from(state.ids.show_bar_numbers_values_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -980,7 +980,7 @@ impl<'a> Widget for Interface<'a> {
{
events.push(ToggleBarNumbers(BarNumbers::Percent))
}
Text::new(&self.localized_strings.get("hud.settings.percentages"))
Text::new(self.localized_strings.get("hud.settings.percentages"))
.right_from(state.ids.show_bar_numbers_percentage_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -994,7 +994,7 @@ impl<'a> Widget for Interface<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.buff_pos_map_button, 12.0)
.label(&self.localized_strings.get("hud.settings.reset_interface"))
.label(self.localized_strings.get("hud.settings.reset_interface"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -150,7 +150,7 @@ impl<'a> Widget for Language<'a> {
events.push(ToggleEnglishFallback(show_english_fallback));
}
Text::new(&self.localized_strings.get("hud.settings.english_fallback"))
Text::new(self.localized_strings.get("hud.settings.english_fallback"))
.right_from(state.ids.english_fallback_button, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)

View File

@ -106,7 +106,7 @@ impl<'a> Widget for Sound<'a> {
let inactive_master_volume_perc =
self.global_state.settings.audio.inactive_master_volume_perc;
let inactive_val = format!("{:2.0}%", inactive_master_volume_perc * 100.0);
Text::new(&self.localized_strings.get("hud.settings.master_volume"))
Text::new(self.localized_strings.get("hud.settings.master_volume"))
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -137,7 +137,7 @@ impl<'a> Widget for Sound<'a> {
.set(state.ids.master_volume_number, ui);
// Master Volume (inactive window) ----------------------------------
Text::new(
&self
self
.localized_strings
.get("hud.settings.inactive_master_volume_perc"),
)
@ -170,7 +170,7 @@ impl<'a> Widget for Sound<'a> {
.color(TEXT_COLOR)
.set(state.ids.inactive_master_volume_number, ui);
// Music Volume -----------------------------------------------------
Text::new(&self.localized_strings.get("hud.settings.music_volume"))
Text::new(self.localized_strings.get("hud.settings.music_volume"))
.down_from(state.ids.inactive_master_volume_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -196,7 +196,7 @@ impl<'a> Widget for Sound<'a> {
// SFX Volume -------------------------------------------------------
Text::new(
&self
self
.localized_strings
.get("hud.settings.sound_effect_volume"),
)
@ -227,7 +227,7 @@ impl<'a> Widget for Sound<'a> {
// --------------------------------------------
// let device = &self.global_state.audio.device;
//let device_list = &self.global_state.audio.device_list;
//Text::new(&self.localized_strings.get("hud.settings.audio_device"
//Text::new(self.localized_strings.get("hud.settings.audio_device"
// )) .down_from(state.ids.sfx_volume_slider, 10.0)
// .font_size(self.fonts.cyri.scale(14))
// .font_id(self.fonts.cyri.conrod_id)
@ -256,7 +256,7 @@ impl<'a> Widget for Sound<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.sfx_volume_slider, 12.0)
.label(&self.localized_strings.get("hud.settings.reset_sound"))
.label(self.localized_strings.get("hud.settings.reset_sound"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -230,7 +230,7 @@ impl<'a> Widget for Video<'a> {
}
// View Distance
Text::new(&self.localized_strings.get("hud.settings.view_distance"))
Text::new(self.localized_strings.get("hud.settings.view_distance"))
.top_left_with_margins_on(state.ids.window, 10.0, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -267,7 +267,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.vd_value, ui);
// Max FPS
Text::new(&self.localized_strings.get("hud.settings.maximum_fps"))
Text::new(self.localized_strings.get("hud.settings.maximum_fps"))
.down_from(state.ids.vd_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -305,7 +305,7 @@ impl<'a> Widget for Video<'a> {
let render_mode = &self.global_state.settings.graphics.render_mode;
// Present Mode
Text::new(&self.localized_strings.get("hud.settings.present_mode"))
Text::new(self.localized_strings.get("hud.settings.present_mode"))
.down_from(state.ids.vd_slider, 10.0)
.right_from(state.ids.max_fps_value, 30.0)
.font_size(self.fonts.cyri.scale(14))
@ -349,7 +349,7 @@ impl<'a> Widget for Video<'a> {
}
// FOV
Text::new(&self.localized_strings.get("hud.settings.fov"))
Text::new(self.localized_strings.get("hud.settings.fov"))
.down_from(state.ids.max_fps_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -381,7 +381,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.fov_value, ui);
// LoD detail
Text::new(&self.localized_strings.get("hud.settings.lod_detail"))
Text::new(self.localized_strings.get("hud.settings.lod_detail"))
.down_from(state.ids.fov_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -419,7 +419,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.lod_detail_value, ui);
// Gamma
Text::new(&self.localized_strings.get("hud.settings.gamma"))
Text::new(self.localized_strings.get("hud.settings.gamma"))
.down_from(state.ids.lod_detail_slider, 10.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -470,7 +470,7 @@ impl<'a> Widget for Video<'a> {
events.push(GraphicsChange::ChangeExposure(new_val as f32 / 16.0));
}
Text::new(&self.localized_strings.get("hud.settings.exposure"))
Text::new(self.localized_strings.get("hud.settings.exposure"))
.up_from(state.ids.exposure_slider, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -507,7 +507,7 @@ impl<'a> Widget for Video<'a> {
{
events.push(GraphicsChange::ChangeAmbiance(new_val as f32));
}
Text::new(&self.localized_strings.get("hud.settings.ambiance"))
Text::new(self.localized_strings.get("hud.settings.ambiance"))
.up_from(state.ids.ambiance_slider, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -544,7 +544,7 @@ impl<'a> Widget for Video<'a> {
events.push(GraphicsChange::AdjustSpriteRenderDistance(new_val));
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.sprites_view_distance"),
)
@ -584,7 +584,7 @@ impl<'a> Widget for Video<'a> {
events.push(GraphicsChange::AdjustFigureLoDRenderDistance(new_val));
}
Text::new(
&self
self
.localized_strings
.get("hud.settings.figures_view_distance"),
)
@ -608,7 +608,7 @@ impl<'a> Widget for Video<'a> {
.set(state.ids.figure_dist_value, ui);
// AaMode
Text::new(&self.localized_strings.get("hud.settings.antialiasing_mode"))
Text::new(self.localized_strings.get("hud.settings.antialiasing_mode"))
.down_from(state.ids.gamma_slider, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -650,7 +650,7 @@ impl<'a> Widget for Video<'a> {
}
// Upscaling factor
Text::new(&self.localized_strings.get("hud.settings.upscale_factor"))
Text::new(self.localized_strings.get("hud.settings.upscale_factor"))
.down_from(state.ids.aa_mode_list, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -693,7 +693,7 @@ impl<'a> Widget for Video<'a> {
// CloudMode
Text::new(
&self
self
.localized_strings
.get("hud.settings.cloud_rendering_mode"),
)
@ -712,20 +712,20 @@ impl<'a> Widget for Video<'a> {
CloudMode::Ultra,
];
let mode_label_list = [
&self.localized_strings.get("common.none"),
&self
self.localized_strings.get("common.none"),
self
.localized_strings
.get("hud.settings.cloud_rendering_mode.minimal"),
&self
self
.localized_strings
.get("hud.settings.cloud_rendering_mode.low"),
&self
self
.localized_strings
.get("hud.settings.cloud_rendering_mode.medium"),
&self
self
.localized_strings
.get("hud.settings.cloud_rendering_mode.high"),
&self
self
.localized_strings
.get("hud.settings.cloud_rendering_mode.ultra"),
];
@ -749,7 +749,7 @@ impl<'a> Widget for Video<'a> {
// FluidMode
Text::new(
&self
self
.localized_strings
.get("hud.settings.fluid_rendering_mode"),
)
@ -761,10 +761,10 @@ impl<'a> Widget for Video<'a> {
let mode_list = [FluidMode::Cheap, FluidMode::Shiny];
let mode_label_list = [
&self
self
.localized_strings
.get("hud.settings.fluid_rendering_mode.cheap"),
&self
self
.localized_strings
.get("hud.settings.fluid_rendering_mode.shiny"),
];
@ -788,7 +788,7 @@ impl<'a> Widget for Video<'a> {
// LightingMode
Text::new(
&self
self
.localized_strings
.get("hud.settings.lighting_rendering_mode"),
)
@ -804,13 +804,13 @@ impl<'a> Widget for Video<'a> {
LightingMode::Lambertian,
];
let mode_label_list = [
&self
self
.localized_strings
.get("hud.settings.lighting_rendering_mode.ashikhmin"),
&self
self
.localized_strings
.get("hud.settings.lighting_rendering_mode.blinnphong"),
&self
self
.localized_strings
.get("hud.settings.lighting_rendering_mode.lambertian"),
];
@ -834,7 +834,7 @@ impl<'a> Widget for Video<'a> {
// ShadowMode
Text::new(
&self
self
.localized_strings
.get("hud.settings.shadow_rendering_mode"),
)
@ -851,13 +851,13 @@ impl<'a> Widget for Video<'a> {
ShadowMode::Map(shadow_map_mode.unwrap_or_default()),
];
let mode_label_list = [
&self
self
.localized_strings
.get("hud.settings.shadow_rendering_mode.none"),
&self
self
.localized_strings
.get("hud.settings.shadow_rendering_mode.cheap"),
&self
self
.localized_strings
.get("hud.settings.shadow_rendering_mode.map"),
];
@ -882,7 +882,7 @@ impl<'a> Widget for Video<'a> {
if let Some(shadow_map_mode) = shadow_map_mode {
// Display the shadow map mode if selected.
Text::new(
&self
self
.localized_strings
.get("hud.settings.shadow_rendering_mode.map.resolution"),
)
@ -925,7 +925,7 @@ impl<'a> Widget for Video<'a> {
}
// GPU Profiler
Text::new(&self.localized_strings.get("hud.settings.gpu_profiler"))
Text::new(self.localized_strings.get("hud.settings.gpu_profiler"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.shadow_mode_list, 8.0)
@ -951,7 +951,7 @@ impl<'a> Widget for Video<'a> {
}
// Particles
Text::new(&self.localized_strings.get("hud.settings.particles"))
Text::new(self.localized_strings.get("hud.settings.particles"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.gpu_profiler_label, 8.0)
@ -975,7 +975,7 @@ impl<'a> Widget for Video<'a> {
// Lossy terrain compression
Text::new(
&self
self
.localized_strings
.get("hud.settings.lossy_terrain_compression"),
)
@ -1021,7 +1021,7 @@ impl<'a> Widget for Video<'a> {
.dedup()
.collect();
Text::new(&self.localized_strings.get("hud.settings.resolution"))
Text::new(self.localized_strings.get("hud.settings.resolution"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.particles_label, 8.0)
@ -1080,7 +1080,7 @@ impl<'a> Widget for Video<'a> {
.dedup()
.collect();
Text::new(&self.localized_strings.get("hud.settings.bit_depth"))
Text::new(self.localized_strings.get("hud.settings.bit_depth"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.particles_label, 8.0)
@ -1134,7 +1134,7 @@ impl<'a> Widget for Video<'a> {
.dedup()
.collect();
Text::new(&self.localized_strings.get("hud.settings.refresh_rate"))
Text::new(self.localized_strings.get("hud.settings.refresh_rate"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.particles_label, 8.0)
@ -1174,7 +1174,7 @@ impl<'a> Widget for Video<'a> {
}
// Fullscreen
Text::new(&self.localized_strings.get("hud.settings.fullscreen"))
Text::new(self.localized_strings.get("hud.settings.fullscreen"))
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
.down_from(state.ids.resolution, 8.0)
@ -1200,7 +1200,7 @@ impl<'a> Widget for Video<'a> {
}
// Fullscreen Mode
Text::new(&self.localized_strings.get("hud.settings.fullscreen_mode"))
Text::new(self.localized_strings.get("hud.settings.fullscreen_mode"))
.down_from(state.ids.fullscreen_label, 8.0)
.font_size(self.fonts.cyri.scale(14))
.font_id(self.fonts.cyri.conrod_id)
@ -1242,7 +1242,7 @@ impl<'a> Widget for Video<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.down_from(state.ids.fullscreen_mode_list, 12.0)
.label(&self.localized_strings.get("hud.settings.save_window_size"))
.label(self.localized_strings.get("hud.settings.save_window_size"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -1266,7 +1266,7 @@ impl<'a> Widget for Video<'a> {
.press_image(self.imgs.button_press)
.down_from(state.ids.fullscreen_mode_list, 12.0)
.right_from(state.ids.save_window_size_button, 12.0)
.label(&self.localized_strings.get("hud.settings.reset_graphics"))
.label(self.localized_strings.get("hud.settings.reset_graphics"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)

View File

@ -258,7 +258,7 @@ impl<'a> Widget for Skillbar<'a> {
.controls
.get_binding(GameInput::Respawn)
{
Text::new(&localized_strings.get("hud.you_died"))
Text::new(localized_strings.get("hud.you_died"))
.middle_of(ui.window)
.font_size(self.fonts.cyri.scale(50))
.font_id(self.fonts.cyri.conrod_id)
@ -274,7 +274,7 @@ impl<'a> Widget for Skillbar<'a> {
.font_id(self.fonts.cyri.conrod_id)
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.death_message_2_bg, ui);
Text::new(&localized_strings.get("hud.you_died"))
Text::new(localized_strings.get("hud.you_died"))
.bottom_left_with_margins_on(state.ids.death_message_1_bg, 2.0, 2.0)
.font_size(self.fonts.cyri.scale(50))
.font_id(self.fonts.cyri.conrod_id)

View File

@ -164,7 +164,7 @@ impl<'a> Widget for Social<'a> {
Rectangle::fill_with([212.0, 42.0], color::TRANSPARENT)
.top_left_with_margins_on(state.ids.frame, 2.0, 44.0)
.set(state.ids.title_align, ui);
Text::new(&self.localized_strings.get("hud.social"))
Text::new(self.localized_strings.get("hud.social"))
.middle_of(state.ids.title_align)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
@ -189,7 +189,7 @@ impl<'a> Widget for Social<'a> {
.set(state.ids.scrollbar, ui);
// Online Text
Text::new(&self.localized_strings.get("hud.social.online"))
Text::new(self.localized_strings.get("hud.social.online"))
.bottom_left_with_margins_on(state.ids.frame, 18.0, 10.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))

View File

@ -116,13 +116,13 @@ impl<'a> Trade<'a> {
}
fn title(&mut self, state: &mut ConrodState<'_, State>, ui: &mut UiCell<'_>) {
Text::new(&self.localized_strings.get("hud.trade.trade_window"))
Text::new(self.localized_strings.get("hud.trade.trade_window"))
.mid_top_with_margin_on(state.ids.bg_frame, 9.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
.color(Color::Rgba(0.0, 0.0, 0.0, 1.0))
.set(state.ids.trade_title_bg, ui);
Text::new(&self.localized_strings.get("hud.trade.trade_window"))
Text::new(self.localized_strings.get("hud.trade.trade_window"))
.top_left_with_margins_on(state.ids.trade_title_bg, 2.0, 2.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
@ -142,7 +142,7 @@ impl<'a> Trade<'a> {
TradePhase::Complete => self.localized_strings.get("hud.trade.phase3_description"),
};
Text::new(&phase_text)
Text::new(phase_text)
.mid_top_with_margin_on(state.ids.bg, 70.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(20))
@ -314,7 +314,7 @@ impl<'a> Trade<'a> {
name,
entity,
false,
&inventory,
inventory,
&state.bg_ids,
)
.set(state.ids.inventory_scroller, ui);
@ -462,7 +462,7 @@ impl<'a> Trade<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.bottom_left_with_margins_on(state.ids.bg, 80.0, 60.0)
.label(&self.localized_strings.get("hud.trade.accept"))
.label(self.localized_strings.get("hud.trade.accept"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -478,7 +478,7 @@ impl<'a> Trade<'a> {
.hover_image(self.imgs.button_hover)
.press_image(self.imgs.button_press)
.right_from(state.ids.accept_button, 20.0)
.label(&self.localized_strings.get("hud.trade.decline"))
.label(self.localized_strings.get("hud.trade.decline"))
.label_font_size(self.fonts.cyri.scale(14))
.label_color(TEXT_COLOR)
.label_font_id(self.fonts.cyri.conrod_id)
@ -558,16 +558,16 @@ impl<'a> Widget for Trade<'a> {
self.background(&mut state, ui);
self.title(&mut state, ui);
self.phase_indicator(&mut state, ui, &trade);
self.phase_indicator(&mut state, ui, trade);
event = self
.item_pane(&mut state, ui, &trade, &prices, false)
.item_pane(&mut state, ui, trade, prices, false)
.or(event);
event = self
.item_pane(&mut state, ui, &trade, &prices, true)
.item_pane(&mut state, ui, trade, prices, true)
.or(event);
event = self
.accept_decline_buttons(&mut state, ui, &trade)
.accept_decline_buttons(&mut state, ui, trade)
.or(event);
event = self.close_button(&mut state, ui).or(event);

View File

@ -56,11 +56,11 @@ pub fn price_desc(
pub fn kind_text<'a>(kind: &ItemKind, i18n: &'a Localization) -> Cow<'a, str> {
match kind {
ItemKind::Armor(armor) => Cow::Borrowed(armor_kind(&armor, &i18n)),
ItemKind::Armor(armor) => Cow::Borrowed(armor_kind(armor, i18n)),
ItemKind::Tool(tool) => Cow::Owned(format!(
"{} ({})",
tool_kind(&tool, i18n),
tool_hands(&tool, i18n)
tool_kind(tool, i18n),
tool_hands(tool, i18n)
)),
ItemKind::ModularComponent(_mc) => Cow::Borrowed(i18n.get("common.bag.shoulders")),
ItemKind::Glider(_glider) => Cow::Borrowed(i18n.get("common.kind.glider")),

View File

@ -50,7 +50,7 @@ fn main() {
let panic_info_payload = panic_info.payload();
let payload_string = panic_info_payload.downcast_ref::<String>();
let reason = match payload_string {
Some(s) => &s,
Some(s) => s,
None => {
let payload_str = panic_info_payload.downcast_ref::<&str>();
match payload_str {

View File

@ -1158,7 +1158,7 @@ impl Controls {
TextInput::new(
name_input,
i18n.get("character_window.character_name"),
&name,
name,
Message::Name,
)
.size(25)
@ -1568,7 +1568,7 @@ impl CharSelectionUi {
let (mut messages, _) = self.ui.maintain(
self.controls
.view(&global_state.settings, &client, &self.error, &i18n),
.view(&global_state.settings, client, &self.error, &i18n),
global_state.window.renderer_mut(),
None,
&mut global_state.clipboard,

View File

@ -16,6 +16,7 @@ use tokio::runtime;
use tracing::{trace, warn};
#[derive(Debug)]
#[allow(clippy::enum_variant_names)] //TODO: evaluate ClientError ends with Enum name
pub enum Error {
ClientError {
error: ClientError,

View File

@ -289,7 +289,7 @@ impl Controls {
} => screen.view(
&self.fonts,
&self.imgs,
&connection_state,
connection_state,
self.time,
&self.i18n.read(),
button_style,
@ -486,7 +486,7 @@ impl MainMenuUi {
)
.unwrap();
let fonts = Fonts::load(&i18n.fonts(), &mut ui).expect("Impossible to load fonts");
let fonts = Fonts::load(i18n.fonts(), &mut ui).expect("Impossible to load fonts");
let bg_img_spec = BG_IMGS.choose(&mut thread_rng()).unwrap();
@ -508,7 +508,7 @@ impl MainMenuUi {
let font = load_font(&i18n.fonts().get("cyri").unwrap().asset_key);
self.ui.clear_fonts(font);
self.controls.fonts =
Fonts::load(&i18n.fonts(), &mut self.ui).expect("Impossible to load fonts!");
Fonts::load(i18n.fonts(), &mut self.ui).expect("Impossible to load fonts!");
let language_metadatas = crate::i18n::list_localizations();
self.controls.selected_language_index = language_metadatas
.iter()

View File

@ -120,7 +120,7 @@ pub fn create_col_lights(
&texture_info,
&view_info,
&sampler_info,
bytemuck::cast_slice(&col_lights),
bytemuck::cast_slice(col_lights),
)
}

View File

@ -85,7 +85,7 @@ pub(in super::super) fn create_verts_buffer(
) -> SpriteVerts {
// TODO: type Buffer by wgpu::BufferUsage
SpriteVerts(Buffer::new(
&device,
device,
wgpu::BufferUsage::STORAGE,
mesh.vertices(),
))

View File

@ -1099,7 +1099,7 @@ impl Renderer {
sampler_info: &wgpu::SamplerDescriptor,
data: &[u8],
) -> Texture {
let tex = Texture::new_raw(&self.device, &texture_info, &view_info, &sampler_info);
let tex = Texture::new_raw(&self.device, texture_info, view_info, sampler_info);
let size = texture_info.size;
let block_size = texture_info.format.describe().block_size;

View File

@ -484,7 +484,7 @@ impl<'frame> Drop for Drawer<'frame> {
},
);
render_pass.set_pipeline(&blit.pipeline);
render_pass.set_bind_group(0, &screenshot.bind_group(), &[]);
render_pass.set_bind_group(0, screenshot.bind_group(), &[]);
render_pass.draw(0..3, 0..1);
drop(render_pass);
// Issues a command to copy from the texture to a buffer and then sends the
@ -518,7 +518,7 @@ impl<'pass> ShadowPassDrawer<'pass> {
.scope("direcred_figure_shadows", self.borrow.device);
render_pass.set_pipeline(&self.shadow_renderer.figure_directed_pipeline.pipeline);
set_quad_index_buffer::<terrain::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<terrain::Vertex>(&mut render_pass, self.borrow);
FigureShadowDrawer { render_pass }
}
@ -529,7 +529,7 @@ impl<'pass> ShadowPassDrawer<'pass> {
.scope("direcred_terrain_shadows", self.borrow.device);
render_pass.set_pipeline(&self.shadow_renderer.terrain_directed_pipeline.pipeline);
set_quad_index_buffer::<terrain::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<terrain::Vertex>(&mut render_pass, self.borrow);
TerrainShadowDrawer { render_pass }
}
@ -583,7 +583,7 @@ impl<'pass> FirstPassDrawer<'pass> {
let mut render_pass = self.render_pass.scope("skybox", self.borrow.device);
render_pass.set_pipeline(&self.pipelines.skybox.pipeline);
set_quad_index_buffer::<skybox::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<skybox::Vertex>(&mut render_pass, self.borrow);
render_pass.set_vertex_buffer(0, model.buf().slice(..));
render_pass.draw(0..model.len() as u32, 0..1);
}
@ -592,7 +592,7 @@ impl<'pass> FirstPassDrawer<'pass> {
let mut render_pass = self.render_pass.scope("debug", self.borrow.device);
render_pass.set_pipeline(&self.pipelines.debug.pipeline);
set_quad_index_buffer::<debug::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<debug::Vertex>(&mut render_pass, self.borrow);
DebugDrawer {
render_pass,
@ -604,7 +604,7 @@ impl<'pass> FirstPassDrawer<'pass> {
let mut render_pass = self.render_pass.scope("lod_terrain", self.borrow.device);
render_pass.set_pipeline(&self.pipelines.lod_terrain.pipeline);
set_quad_index_buffer::<lod_terrain::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<lod_terrain::Vertex>(&mut render_pass, self.borrow);
render_pass.set_vertex_buffer(0, model.buf().slice(..));
render_pass.draw_indexed(0..model.len() as u32 / 4 * 6, 0, 0..1);
}
@ -614,7 +614,7 @@ impl<'pass> FirstPassDrawer<'pass> {
render_pass.set_pipeline(&self.pipelines.figure.pipeline);
// Note: figures use the same vertex type as the terrain
set_quad_index_buffer::<terrain::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<terrain::Vertex>(&mut render_pass, self.borrow);
FigureDrawer { render_pass }
}
@ -623,7 +623,7 @@ impl<'pass> FirstPassDrawer<'pass> {
let mut render_pass = self.render_pass.scope("terrain", self.borrow.device);
render_pass.set_pipeline(&self.pipelines.terrain.pipeline);
set_quad_index_buffer::<terrain::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<terrain::Vertex>(&mut render_pass, self.borrow);
TerrainDrawer {
render_pass,
@ -635,7 +635,7 @@ impl<'pass> FirstPassDrawer<'pass> {
let mut render_pass = self.render_pass.scope("particles", self.borrow.device);
render_pass.set_pipeline(&self.pipelines.particle.pipeline);
set_quad_index_buffer::<particle::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<particle::Vertex>(&mut render_pass, self.borrow);
ParticleDrawer { render_pass }
}
@ -648,7 +648,7 @@ impl<'pass> FirstPassDrawer<'pass> {
let mut render_pass = self.render_pass.scope("sprites", self.borrow.device);
render_pass.set_pipeline(&self.pipelines.sprite.pipeline);
set_quad_index_buffer::<sprite::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<sprite::Vertex>(&mut render_pass, self.borrow);
render_pass.set_bind_group(0, &globals.bind_group, &[]);
render_pass.set_bind_group(2, &col_lights.bind_group, &[]);
@ -662,7 +662,7 @@ impl<'pass> FirstPassDrawer<'pass> {
let mut render_pass = self.render_pass.scope("fluid", self.borrow.device);
render_pass.set_pipeline(&self.pipelines.fluid.pipeline);
set_quad_index_buffer::<fluid::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<fluid::Vertex>(&mut render_pass, self.borrow);
FluidDrawer { render_pass }
}
@ -857,7 +857,7 @@ impl<'pass> ThirdPassDrawer<'pass> {
let mut render_pass = self.render_pass.scope("ui", self.borrow.device);
render_pass.set_pipeline(&ui.pipeline);
set_quad_index_buffer::<ui::Vertex>(&mut render_pass, &self.borrow);
set_quad_index_buffer::<ui::Vertex>(&mut render_pass, self.borrow);
Some(UiDrawer { render_pass })
}

View File

@ -733,7 +733,7 @@ pub(super) fn initial_create_pipelines(
sc_desc: &sc_desc,
};
let pipelines = create_ingame_and_shadow_pipelines(needs, &pool, progress.create_tasks());
let pipelines = create_ingame_and_shadow_pipelines(needs, pool, progress.create_tasks());
pipeline_send.send(pipelines).expect("Channel disconnected");
});
@ -798,11 +798,11 @@ pub(super) fn recreate_pipelines(
};
// Create interface pipelines
let interface = create_interface_pipelines(needs, &pool, interface_tasks);
let interface = create_interface_pipelines(needs, pool, interface_tasks);
// Create the rest of the pipelines
let IngameAndShadowPipelines { ingame, shadow } =
create_ingame_and_shadow_pipelines(needs, &pool, ingame_and_shadow_tasks);
create_ingame_and_shadow_pipelines(needs, pool, ingame_and_shadow_tasks);
// Send them
result_send
@ -843,7 +843,7 @@ impl Progress {
/// total reflects the amount of tasks that will need to be completed
pub fn create_task(&self) -> Task {
self.total.fetch_add(1, Ordering::Relaxed);
Task { progress: &self }
Task { progress: self }
}
/// Helper method for creating tasks to do in bulk

View File

@ -43,7 +43,7 @@ impl ShadowMap {
{
let (point_depth, directed_depth) = shadow_views;
let layout = shadow::ShadowLayout::new(&device);
let layout = shadow::ShadowLayout::new(device);
Self::Enabled(ShadowMapRenderer {
directed_depth,
@ -56,7 +56,7 @@ impl ShadowMap {
layout,
})
} else {
let (dummy_point, dummy_directed) = Self::create_dummy_shadow_tex(&device, &queue);
let (dummy_point, dummy_directed) = Self::create_dummy_shadow_tex(device, queue);
Self::Disabled {
dummy_point,
dummy_directed,

View File

@ -470,7 +470,7 @@ impl Camera {
// This is horribly frame time dependent, but so is most of the game
let delta = self.last_time.replace(time).map_or(0.0, |t| time - t);
if (self.dist - self.tgt_dist).abs() > 0.01 {
self.dist = f32::lerp(
self.dist = vek::Lerp::lerp(
self.dist,
self.tgt_dist,
0.65 * (delta as f32) / self.interp_time(),
@ -478,7 +478,7 @@ impl Camera {
}
if (self.fov - self.tgt_fov).abs() > 0.01 {
self.fov = f32::lerp(
self.fov = vek::Lerp::lerp(
self.fov,
self.tgt_fov,
0.65 * (delta as f32) / self.interp_time(),

View File

@ -41,7 +41,7 @@ fn graceful_load_vox(mesh_name: &str) -> AssetHandle<DotVoxAsset> {
graceful_load_vox_fullspec(&full_specifier)
}
fn graceful_load_vox_fullspec(full_specifier: &str) -> AssetHandle<DotVoxAsset> {
match DotVoxAsset::load(&full_specifier) {
match DotVoxAsset::load(full_specifier) {
Ok(dot_vox) => dot_vox,
Err(_) => {
error!(?full_specifier, "Could not load vox file for figure");
@ -880,11 +880,11 @@ impl HumMainWeaponSpec {
use ModularComponentSpec::*;
let damagespec = match modular_components.0.get(&*damage) {
Some(Damage(spec)) => spec,
_ => return not_found(&damage),
_ => return not_found(damage),
};
let heldspec = match modular_components.0.get(&*held) {
Some(Held(spec)) => spec,
_ => return not_found(&held),
_ => return not_found(held),
};
let damage_asset = graceful_load_vox(&damagespec.0).read();
let held_asset = graceful_load_vox(&heldspec.0).read();
@ -4494,7 +4494,7 @@ make_vox_spec!(
impl ObjectCentralSpec {
fn mesh_bone0(&self, obj: &object::Body) -> BoneMeshes {
let spec = match self.0.get(&obj) {
let spec = match self.0.get(obj) {
Some(spec) => spec,
None => {
error!("No specification exists for {:?}", obj);
@ -4507,7 +4507,7 @@ impl ObjectCentralSpec {
}
fn mesh_bone1(&self, obj: &object::Body) -> BoneMeshes {
let spec = match self.0.get(&obj) {
let spec = match self.0.get(obj) {
Some(spec) => spec,
None => {
error!("No specification exists for {:?}", obj);
@ -4525,7 +4525,7 @@ fn mesh_ship_bone<K: fmt::Debug + Eq + Hash, V, F: Fn(&V) -> &ShipCentralSubSpec
obj: &K,
f: F,
) -> BoneMeshes {
let spec = match map.get(&obj) {
let spec = match map.get(obj) {
Some(spec) => spec,
None => {
error!("No specification exists for {:?}", obj);

View File

@ -148,52 +148,52 @@ impl FigureMgrStates {
match body {
Body::Humanoid(_) => self
.character_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::QuadrupedSmall(_) => self
.quadruped_small_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::QuadrupedMedium(_) => self
.quadruped_medium_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::QuadrupedLow(_) => self
.quadruped_low_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::BirdMedium(_) => self
.bird_medium_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::FishMedium(_) => self
.fish_medium_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::Theropod(_) => self
.theropod_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::Dragon(_) => self.dragon_states.get_mut(&entity).map(DerefMut::deref_mut),
Body::Dragon(_) => self.dragon_states.get_mut(entity).map(DerefMut::deref_mut),
Body::BirdLarge(_) => self
.bird_large_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::FishSmall(_) => self
.fish_small_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::BipedLarge(_) => self
.biped_large_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::BipedSmall(_) => self
.biped_small_states
.get_mut(&entity)
.get_mut(entity)
.map(DerefMut::deref_mut),
Body::Golem(_) => self.golem_states.get_mut(&entity).map(DerefMut::deref_mut),
Body::Object(_) => self.object_states.get_mut(&entity).map(DerefMut::deref_mut),
Body::Ship(_) => self.ship_states.get_mut(&entity).map(DerefMut::deref_mut),
Body::Golem(_) => self.golem_states.get_mut(entity).map(DerefMut::deref_mut),
Body::Object(_) => self.object_states.get_mut(entity).map(DerefMut::deref_mut),
Body::Ship(_) => self.ship_states.get_mut(entity).map(DerefMut::deref_mut),
}
}
@ -203,23 +203,23 @@ impl FigureMgrStates {
Q: Hash + Eq,
{
match body {
Body::Humanoid(_) => self.character_states.remove(&entity).map(|e| e.meta),
Body::QuadrupedSmall(_) => self.quadruped_small_states.remove(&entity).map(|e| e.meta),
Body::Humanoid(_) => self.character_states.remove(entity).map(|e| e.meta),
Body::QuadrupedSmall(_) => self.quadruped_small_states.remove(entity).map(|e| e.meta),
Body::QuadrupedMedium(_) => {
self.quadruped_medium_states.remove(&entity).map(|e| e.meta)
self.quadruped_medium_states.remove(entity).map(|e| e.meta)
},
Body::QuadrupedLow(_) => self.quadruped_low_states.remove(&entity).map(|e| e.meta),
Body::BirdMedium(_) => self.bird_medium_states.remove(&entity).map(|e| e.meta),
Body::FishMedium(_) => self.fish_medium_states.remove(&entity).map(|e| e.meta),
Body::Theropod(_) => self.theropod_states.remove(&entity).map(|e| e.meta),
Body::Dragon(_) => self.dragon_states.remove(&entity).map(|e| e.meta),
Body::BirdLarge(_) => self.bird_large_states.remove(&entity).map(|e| e.meta),
Body::FishSmall(_) => self.fish_small_states.remove(&entity).map(|e| e.meta),
Body::BipedLarge(_) => self.biped_large_states.remove(&entity).map(|e| e.meta),
Body::BipedSmall(_) => self.biped_small_states.remove(&entity).map(|e| e.meta),
Body::Golem(_) => self.golem_states.remove(&entity).map(|e| e.meta),
Body::Object(_) => self.object_states.remove(&entity).map(|e| e.meta),
Body::Ship(_) => self.ship_states.remove(&entity).map(|e| e.meta),
Body::QuadrupedLow(_) => self.quadruped_low_states.remove(entity).map(|e| e.meta),
Body::BirdMedium(_) => self.bird_medium_states.remove(entity).map(|e| e.meta),
Body::FishMedium(_) => self.fish_medium_states.remove(entity).map(|e| e.meta),
Body::Theropod(_) => self.theropod_states.remove(entity).map(|e| e.meta),
Body::Dragon(_) => self.dragon_states.remove(entity).map(|e| e.meta),
Body::BirdLarge(_) => self.bird_large_states.remove(entity).map(|e| e.meta),
Body::FishSmall(_) => self.fish_small_states.remove(entity).map(|e| e.meta),
Body::BipedLarge(_) => self.biped_large_states.remove(entity).map(|e| e.meta),
Body::BipedSmall(_) => self.biped_small_states.remove(entity).map(|e| e.meta),
Body::Golem(_) => self.golem_states.remove(entity).map(|e| e.meta),
Body::Object(_) => self.object_states.remove(entity).map(|e| e.meta),
Body::Ship(_) => self.ship_states.remove(entity).map(|e| e.meta),
}
}
@ -4998,7 +4998,7 @@ impl FigureMgr {
if let Some((bound, model_entry)) = match body {
Body::Humanoid(body) => character_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5014,7 +5014,7 @@ impl FigureMgr {
}),
Body::QuadrupedSmall(body) => quadruped_small_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5030,7 +5030,7 @@ impl FigureMgr {
}),
Body::QuadrupedMedium(body) => quadruped_medium_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5046,7 +5046,7 @@ impl FigureMgr {
}),
Body::QuadrupedLow(body) => quadruped_low_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5062,7 +5062,7 @@ impl FigureMgr {
}),
Body::BirdMedium(body) => bird_medium_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5078,7 +5078,7 @@ impl FigureMgr {
}),
Body::FishMedium(body) => fish_medium_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5094,7 +5094,7 @@ impl FigureMgr {
}),
Body::Theropod(body) => theropod_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5110,7 +5110,7 @@ impl FigureMgr {
}),
Body::Dragon(body) => dragon_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5126,7 +5126,7 @@ impl FigureMgr {
}),
Body::BirdLarge(body) => bird_large_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5142,7 +5142,7 @@ impl FigureMgr {
}),
Body::FishSmall(body) => fish_small_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5158,7 +5158,7 @@ impl FigureMgr {
}),
Body::BipedLarge(body) => biped_large_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5174,7 +5174,7 @@ impl FigureMgr {
}),
Body::BipedSmall(body) => biped_small_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5190,7 +5190,7 @@ impl FigureMgr {
}),
Body::Golem(body) => golem_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5206,7 +5206,7 @@ impl FigureMgr {
}),
Body::Object(body) => object_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),
@ -5222,7 +5222,7 @@ impl FigureMgr {
}),
Body::Ship(body) => ship_states
.get(&entity)
.filter(|state| filter_state(&*state))
.filter(|state| filter_state(*state))
.map(move |state| {
(
state.bound(),

View File

@ -62,7 +62,7 @@ impl Lod {
pub fn render<'a>(&'a self, drawer: &mut FirstPassDrawer<'a>) {
if let Some((_, model)) = self.model.as_ref() {
drawer.draw_lod_terrain(&model);
drawer.draw_lod_terrain(model);
}
}
}

View File

@ -390,9 +390,9 @@ impl Scene {
audio: &mut AudioFrontend,
) {
span!(_guard, "handle_outcome", "Scene::handle_outcome");
self.particle_mgr.handle_outcome(&outcome, &scene_data);
self.particle_mgr.handle_outcome(outcome, scene_data);
self.sfx_mgr
.handle_outcome(&outcome, audio, scene_data.client);
.handle_outcome(outcome, audio, scene_data.client);
match outcome {
Outcome::Explosion {
@ -540,7 +540,7 @@ impl Scene {
// Maintain the particles.
self.particle_mgr
.maintain(renderer, &scene_data, &self.terrain, lights);
.maintain(renderer, scene_data, &self.terrain, lights);
// Update light constants
lights.extend(
@ -576,7 +576,7 @@ impl Scene {
);
lights.sort_by_key(|light| light.get_pos().distance_squared(player_pos) as i32);
lights.truncate(MAX_LIGHT_COUNT);
renderer.update_consts(&mut self.data.lights, &lights);
renderer.update_consts(&mut self.data.lights, lights);
// Update event lights
let dt = ecs.fetch::<DeltaTime>().0;
@ -664,7 +664,7 @@ impl Scene {
// Maintain the terrain.
let (_visible_bounds, visible_light_volume, visible_psr_bounds) = self.terrain.maintain(
renderer,
&scene_data,
scene_data,
focus_pos,
self.loaded_distance,
&self.camera,

View File

@ -370,7 +370,7 @@ impl Scene {
figure_drawer.draw(
lod,
self.figure_state.bound(),
&self.col_lights.texture(model),
self.col_lights.texture(model),
);
}
}
@ -378,7 +378,7 @@ impl Scene {
if let Some((model, state)) = &self.backdrop {
if let Some(lod) = model.lod_model(0) {
figure_drawer.draw(lod, state.bound(), &self.col_lights.texture(model));
figure_drawer.draw(lod, state.bound(), self.col_lights.texture(model));
}
}
drop(figure_drawer);

View File

@ -1024,7 +1024,7 @@ impl PlayState for SessionState {
&self.client.borrow(),
global_state,
&debug_info,
&self.scene.camera(),
self.scene.camera(),
global_state.clock.get_stable_dt(),
HudInfo {
is_aiming,

View File

@ -18,13 +18,13 @@ impl Event {
impl<'a> conrod_winit::WinitWindow for WindowRef<'a> {
fn get_inner_size(&self) -> Option<(u32, u32)> {
Some(
winit::window::Window::inner_size(&self.0)
winit::window::Window::inner_size(self.0)
.to_logical::<u32>(self.hidpi_factor())
.into(),
)
}
fn hidpi_factor(&self) -> f64 { winit::window::Window::scale_factor(&self.0) }
fn hidpi_factor(&self) -> f64 { winit::window::Window::scale_factor(self.0) }
}
convert_event!(event, &WindowRef(window)).map(Self)
}

View File

@ -425,7 +425,7 @@ fn draw_graphic(
border_color,
)),
Graphic::Voxel(ref segment, trans, sample_strat) => Some((
renderer::draw_vox(&segment, dims, trans, sample_strat),
renderer::draw_vox(segment, dims, trans, sample_strat),
None,
)),
Graphic::Blank => None,
@ -487,7 +487,7 @@ fn upload_image(renderer: &mut Renderer, aabr: Aabr<u16>, tex: &Texture, image:
size,
// NOTE: Rgba texture, so each pixel is 4 bytes, ergo this cannot fail.
// We make the cast parameters explicit for clarity.
bytemuck::cast_slice::<u8, [u8; 4]>(&image),
bytemuck::cast_slice::<u8, [u8; 4]>(image),
);
}

View File

@ -351,9 +351,9 @@ impl<'a> ItemTooltip<'a> {
image_frame,
image: None,
image_dims: None,
client: &client,
imgs: &imgs,
item_imgs: &item_imgs,
client,
imgs,
item_imgs,
pulse,
localized_strings,
}
@ -667,7 +667,7 @@ impl<'a> Widget for ItemTooltip<'a> {
util::comparison(combat_rating, equipped_combat_rating);
if (equipped_combat_rating - combat_rating).abs() > f32::EPSILON {
widget::Text::new(&diff_main_stat.0)
widget::Text::new(diff_main_stat.0)
.right_from(state.ids.main_stat_text, H_PAD)
.graphics_for(id)
.parent(id)
@ -863,7 +863,7 @@ impl<'a> Widget for ItemTooltip<'a> {
let stealth_diff =
util::comparison(&armor.stealth(), &equipped_armor.stealth());
if diff.protection() != Protection::Normal(0.0) {
widget::Text::new(&protection_diff.0)
widget::Text::new(protection_diff.0)
.right_from(state.ids.main_stat_text, H_PAD)
.graphics_for(id)
.parent(id)
@ -945,7 +945,7 @@ impl<'a> Widget for ItemTooltip<'a> {
widget::Text::new(&util::modular_component_desc(
mc,
item.components(),
&self.msm,
self.msm,
item.description(),
))
.x_align_to(state.ids.item_frame, conrod_core::position::Align::Start)
@ -1080,7 +1080,7 @@ impl<'a> Widget for ItemTooltip<'a> {
let price_h: f64 = if let Some((buy, sell, _)) = util::price_desc(
self.prices,
item.item_definition_id(),
&self.localized_strings,
self.localized_strings,
) {
//Get localized tooltip strings (gotten here because these should only show if
// in a trade- aka if buy/sell prices are present)

View File

@ -605,7 +605,7 @@ where
if state.cached_images.as_ref().map(|c| &c.0) != image_key.as_ref() {
state.update(|state| {
state.cached_images = image_key.map(|key| {
let image_ids = K::image_ids(&key, &image_source);
let image_ids = K::image_ids(&key, image_source);
(key, image_ids)
});
});

View File

@ -707,7 +707,7 @@ impl Window {
// Handle screenshots and toggling fullscreen
if self.take_screenshot {
self.take_screenshot = false;
self.take_screenshot(&settings);
self.take_screenshot(settings);
}
if self.toggle_fullscreen {
self.toggle_fullscreen = false;

View File

@ -82,7 +82,7 @@ impl<'a> CanvasInfo<'a> {
wpos: Vec2::broadcast(0),
column_grid: &zcache_grid,
column_grid_border: 0,
chunks: &sim,
chunks: sim,
index,
chunk: &sim_chunk,
})

View File

@ -194,7 +194,7 @@ impl Civs {
WorldSite::settlement(Settlement::generate(wpos, Some(ctx.sim), &mut rng))
},
SiteKind::Dungeon => WorldSite::dungeon(site2::Site::generate_dungeon(
&Land::from_sim(&ctx.sim),
&Land::from_sim(ctx.sim),
&mut rng,
wpos,
)),
@ -202,12 +202,12 @@ impl Civs {
WorldSite::castle(Castle::generate(wpos, Some(ctx.sim), &mut rng))
},
SiteKind::Refactor => WorldSite::refactor(site2::Site::generate_city(
&Land::from_sim(&ctx.sim),
&Land::from_sim(ctx.sim),
&mut rng,
wpos,
)),
SiteKind::Tree => {
WorldSite::tree(Tree::generate(wpos, &Land::from_sim(&ctx.sim), &mut rng))
WorldSite::tree(Tree::generate(wpos, &Land::from_sim(ctx.sim), &mut rng))
},
});
sim_site.site_tmp = Some(site);
@ -845,7 +845,7 @@ fn find_site_loc(
});
for offset in Spiral2d::new().take((size * 2 + 1).pow(2) as usize) {
if loc_suitable_for_site(&ctx.sim, test_loc + offset) {
if loc_suitable_for_site(ctx.sim, test_loc + offset) {
return Some(test_loc);
}
}

View File

@ -51,7 +51,7 @@ pub struct IndexRef<'a> {
impl<'a> Deref for IndexRef<'a> {
type Target = Index;
fn deref(&self) -> &Self::Target { &self.index }
fn deref(&self) -> &Self::Target { self.index }
}
impl Index {

View File

@ -337,7 +337,7 @@ impl World {
let lpos = Vec3::new(x, y, z);
let wpos = Vec3::from(chunk_wpos2d) + lpos;
if let Some(block) = sampler.get_with_z_cache(wpos, Some(&z_cache)) {
if let Some(block) = sampler.get_with_z_cache(wpos, Some(z_cache)) {
let _ = chunk.set(lpos, block);
}
});

View File

@ -2620,12 +2620,12 @@ pub fn do_erosion(
let max_uplift = uplift
.into_par_iter()
.cloned()
.max_by(|a, b| a.partial_cmp(&b).unwrap())
.max_by(|a, b| a.partial_cmp(b).unwrap())
.unwrap();
let max_g = g
.into_par_iter()
.cloned()
.max_by(|a, b| a.partial_cmp(&b).unwrap())
.max_by(|a, b| a.partial_cmp(b).unwrap())
.unwrap();
debug!("Max uplift: {:?}", max_uplift);
debug!("Max g: {:?}", max_g);

Some files were not shown because too many files have changed in this diff Show More