From 7ac6c6b453af337a20e2af7016e51668a74d628c Mon Sep 17 00:00:00 2001 From: Isse Date: Wed, 22 Mar 2023 10:59:34 +0100 Subject: [PATCH] fix warnings in rtsim --- common/src/cmd.rs | 11 ++++++--- common/src/event.rs | 9 ++++++++ common/src/generation.rs | 2 +- common/src/rtsim.rs | 2 +- common/src/states/basic_summon.rs | 16 ++++++------- common/src/states/behavior.rs | 4 ++-- common/src/states/climb.rs | 11 ++++++--- common/src/states/utils.rs | 33 ++++++++++++++++++--------- common/src/terrain/block.rs | 7 +++--- rtsim/src/ai/mod.rs | 20 ++++++++-------- rtsim/src/data/faction.rs | 2 -- rtsim/src/data/mod.rs | 9 +++----- rtsim/src/data/nature.rs | 2 +- rtsim/src/data/npc.rs | 13 +++-------- rtsim/src/data/site.rs | 1 - rtsim/src/gen/faction.rs | 3 +-- rtsim/src/gen/mod.rs | 3 +-- rtsim/src/gen/site.rs | 2 +- rtsim/src/lib.rs | 3 +-- rtsim/src/rule/npc_ai.rs | 24 +++++++------------ rtsim/src/rule/replenish_resources.rs | 3 --- rtsim/src/rule/simulate_npcs.rs | 4 +++- server/src/cmd.rs | 7 ++---- server/src/sys/agent.rs | 3 +-- 24 files changed, 98 insertions(+), 96 deletions(-) diff --git a/common/src/cmd.rs b/common/src/cmd.rs index 06621bc5d7..fb2b8068dc 100644 --- a/common/src/cmd.rs +++ b/common/src/cmd.rs @@ -747,9 +747,14 @@ impl ServerChatCommand { ServerChatCommand::Lightning => { cmd(vec![], "Lightning strike at current position", Some(Admin)) }, - ServerChatCommand::Scale => { - cmd(vec![Float("factor", 1.0, Required), Boolean("reset_mass", true.to_string(), Optional)], "Scale your character", Some(Admin)) - }, + ServerChatCommand::Scale => cmd( + vec![ + Float("factor", 1.0, Required), + Boolean("reset_mass", true.to_string(), Optional), + ], + "Scale your character", + Some(Admin), + ), } } diff --git a/common/src/event.rs b/common/src/event.rs index 7914d6a21e..629746b934 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -81,38 +81,47 @@ impl NpcBuilder { self.health = health.into(); self } + pub fn with_poise(mut self, poise: comp::Poise) -> Self { self.poise = poise; self } + pub fn with_agent(mut self, agent: impl Into>) -> Self { self.agent = agent.into(); self } + pub fn with_anchor(mut self, anchor: comp::Anchor) -> Self { self.anchor = Some(anchor); self } + pub fn with_rtsim(mut self, rtsim: RtSimEntity) -> Self { self.rtsim_entity = Some(rtsim); self } + pub fn with_projectile(mut self, projectile: impl Into>) -> Self { self.projectile = projectile.into(); self } + pub fn with_scale(mut self, scale: comp::Scale) -> Self { self.scale = scale; self } + pub fn with_inventory(mut self, inventory: comp::Inventory) -> Self { self.inventory = inventory; self } + pub fn with_skill_set(mut self, skill_set: comp::SkillSet) -> Self { self.skill_set = skill_set; self } + pub fn with_loot(mut self, loot: LootSpec) -> Self { self.loot = loot; self diff --git a/common/src/generation.rs b/common/src/generation.rs index 9db9769c91..00ac1f7b29 100644 --- a/common/src/generation.rs +++ b/common/src/generation.rs @@ -7,8 +7,8 @@ use crate::{ }, lottery::LootSpec, npc::{self, NPC_NAMES}, - trade::SiteInformation, rtsim, + trade::SiteInformation, }; use enum_map::EnumMap; use serde::Deserialize; diff --git a/common/src/rtsim.rs b/common/src/rtsim.rs index 5874fd8999..0d32bc48bb 100644 --- a/common/src/rtsim.rs +++ b/common/src/rtsim.rs @@ -3,8 +3,8 @@ // `Agent`). When possible, this should be moved to the `rtsim` // module in `server`. +use serde::{Deserialize, Serialize}; use specs::Component; -use serde::{Serialize, Deserialize}; use vek::*; use crate::comp::dialogue::MoodState; diff --git a/common/src/states/basic_summon.rs b/common/src/states/basic_summon.rs index 2f56ab02de..316985b89f 100644 --- a/common/src/states/basic_summon.rs +++ b/common/src/states/basic_summon.rs @@ -6,7 +6,7 @@ use crate::{ skillset::skills, Behavior, BehaviorCapability, CharacterState, Projectile, StateUpdate, }, - event::{LocalEvent, ServerEvent, NpcBuilder}, + event::{LocalEvent, NpcBuilder, ServerEvent}, outcome::Outcome, skillset_builder::{self, SkillSetBuilder}, states::{ @@ -181,15 +181,15 @@ impl CharacterBehavior for Data { .with_agent( comp::Agent::from_body(&body) .with_behavior(Behavior::from(BehaviorCapability::SPEAK)) - .with_no_flee_if(true) + .with_no_flee_if(true), ) .with_scale( - self - .static_data - .summon_info - .scale - .unwrap_or(comp::Scale(1.0)) - ).with_projectile(projectile) + self.static_data + .summon_info + .scale + .unwrap_or(comp::Scale(1.0)), + ) + .with_projectile(projectile), }); // Send local event used for frontend shenanigans diff --git a/common/src/states/behavior.rs b/common/src/states/behavior.rs index a117ad19a0..d97e1bf92d 100644 --- a/common/src/states/behavior.rs +++ b/common/src/states/behavior.rs @@ -5,8 +5,8 @@ use crate::{ item::{tool::AbilityMap, MaterialStatManifest}, ActiveAbilities, Beam, Body, CharacterState, Combo, ControlAction, Controller, ControllerInputs, Density, Energy, Health, InputAttr, InputKind, Inventory, - InventoryAction, Mass, Melee, Ori, PhysicsState, Pos, SkillSet, Stance, StateUpdate, Stats, - Vel, Scale, + InventoryAction, Mass, Melee, Ori, PhysicsState, Pos, Scale, SkillSet, Stance, StateUpdate, Stats, + Vel, }, link::Is, mounting::Rider, diff --git a/common/src/states/climb.rs b/common/src/states/climb.rs index fa415ce616..6ca51d0337 100644 --- a/common/src/states/climb.rs +++ b/common/src/states/climb.rs @@ -76,7 +76,8 @@ impl CharacterBehavior for Data { // They've climbed atop something, give them a boost output_events.emit_local(LocalEvent::Jump( data.entity, - CLIMB_BOOST_JUMP_FACTOR * impulse / data.mass.0 * data.scale.map_or(1.0, |s| s.0.powf(13.0).powf(0.25)), + CLIMB_BOOST_JUMP_FACTOR * impulse / data.mass.0 + * data.scale.map_or(1.0, |s| s.0.powf(13.0).powf(0.25)), )); }; update.character = CharacterState::Idle(idle::Data::default()); @@ -122,10 +123,14 @@ impl CharacterBehavior for Data { // Apply Vertical Climbing Movement match climb { Climb::Down => { - update.vel.0.z += data.dt.0 * (GRAVITY - self.static_data.movement_speed.powi(2) * data.scale.map_or(1.0, |s| s.0)) + update.vel.0.z += data.dt.0 + * (GRAVITY + - self.static_data.movement_speed.powi(2) * data.scale.map_or(1.0, |s| s.0)) }, Climb::Up => { - update.vel.0.z += data.dt.0 * (GRAVITY + self.static_data.movement_speed.powi(2) * data.scale.map_or(1.0, |s| s.0)) + update.vel.0.z += data.dt.0 + * (GRAVITY + + self.static_data.movement_speed.powi(2) * data.scale.map_or(1.0, |s| s.0)) }, Climb::Hold => update.vel.0.z += data.dt.0 * GRAVITY, } diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index df50cd136b..085832b890 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -388,7 +388,8 @@ fn basic_move(data: &JoinData<'_>, update: &mut StateUpdate, efficiency: f32) { data.body.base_accel() * data.scale.map_or(1.0, |s| s.0.sqrt()) * block.get_traction() - * block.get_friction() / FRIC_GROUND + * block.get_friction() + / FRIC_GROUND } else { data.body.air_accel() } * efficiency; @@ -437,8 +438,11 @@ pub fn handle_forced_movement( // FRIC_GROUND temporarily used to normalize things around expected values data.body.base_accel() * block.get_traction() * block.get_friction() / FRIC_GROUND }) { - update.vel.0 += - Vec2::broadcast(data.dt.0) * accel * data.scale.map_or(1.0, |s| s.0.sqrt()) * Vec2::from(*data.ori) * strength; + update.vel.0 += Vec2::broadcast(data.dt.0) + * accel + * data.scale.map_or(1.0, |s| s.0.sqrt()) + * Vec2::from(*data.ori) + * strength; } }, ForcedMovement::Reverse(strength) => { @@ -447,8 +451,11 @@ pub fn handle_forced_movement( // FRIC_GROUND temporarily used to normalize things around expected values data.body.base_accel() * block.get_traction() * block.get_friction() / FRIC_GROUND }) { - update.vel.0 += - Vec2::broadcast(data.dt.0) * accel * data.scale.map_or(1.0, |s| s.0.sqrt()) * -Vec2::from(*data.ori) * strength; + update.vel.0 += Vec2::broadcast(data.dt.0) + * accel + * data.scale.map_or(1.0, |s| s.0.sqrt()) + * -Vec2::from(*data.ori) + * strength; } }, ForcedMovement::Sideways(strength) => { @@ -470,7 +477,11 @@ pub fn handle_forced_movement( } }; - update.vel.0 += Vec2::broadcast(data.dt.0) * accel * data.scale.map_or(1.0, |s| s.0.sqrt()) * direction * strength; + update.vel.0 += Vec2::broadcast(data.dt.0) + * accel + * data.scale.map_or(1.0, |s| s.0.sqrt()) + * direction + * strength; } }, ForcedMovement::DirectedReverse(strength) => { @@ -532,9 +543,10 @@ pub fn handle_forced_movement( * (1.0 - data.inputs.look_dir.z.abs()); }, ForcedMovement::Hover { move_input } => { - update.vel.0 = Vec3::new(data.vel.0.x, data.vel.0.y, 0.0) + move_input - * data.scale.map_or(1.0, |s| s.0.sqrt()) - * data.inputs.move_dir.try_normalized().unwrap_or_default(); + update.vel.0 = Vec3::new(data.vel.0.x, data.vel.0.y, 0.0) + + move_input + * data.scale.map_or(1.0, |s| s.0.sqrt()) + * data.inputs.move_dir.try_normalized().unwrap_or_default(); }, } } @@ -574,8 +586,7 @@ pub fn handle_orientation( .map_or_else(|| to_horizontal_fast(data.ori), |dir| dir.into()) }; // unit is multiples of 180° - let half_turns_per_tick = data.body.base_ori_rate() - / data.scale.map_or(1.0, |s| s.0.sqrt()) + let half_turns_per_tick = data.body.base_ori_rate() / data.scale.map_or(1.0, |s| s.0.sqrt()) * efficiency * if data.physics.on_ground.is_some() { 1.0 diff --git a/common/src/terrain/block.rs b/common/src/terrain/block.rs index ba8a8379d1..9ca94ee0e6 100644 --- a/common/src/terrain/block.rs +++ b/common/src/terrain/block.rs @@ -3,8 +3,7 @@ use crate::{ comp::{fluid_dynamics::LiquidKind, tool::ToolKind}, consts::FRIC_GROUND, lottery::LootSpec, - make_case_elim, - rtsim, + make_case_elim, rtsim, }; use num_derive::FromPrimitive; use num_traits::FromPrimitive; @@ -196,7 +195,9 @@ impl Block { } } - /// Returns the rtsim resource, if any, that this block corresponds to. If you want the scarcity of a block to change with rtsim's resource depletion tracking, you can do so by editing this function. + /// Returns the rtsim resource, if any, that this block corresponds to. If + /// you want the scarcity of a block to change with rtsim's resource + /// depletion tracking, you can do so by editing this function. #[inline] pub fn get_rtsim_resource(&self) -> Option { match self.get_sprite()? { diff --git a/rtsim/src/ai/mod.rs b/rtsim/src/ai/mod.rs index 2c7e072583..1232935a62 100644 --- a/rtsim/src/ai/mod.rs +++ b/rtsim/src/ai/mod.rs @@ -240,7 +240,7 @@ impl A + Send + Sync + 'stati Action for Now { // TODO: This doesn't compare?! - fn is_same(&self, other: &Self) -> bool { true } + fn is_same(&self, _other: &Self) -> bool { true } fn dyn_is_same(&self, other: &dyn Action) -> bool { self.dyn_is_same_sized(other) } @@ -293,7 +293,7 @@ impl< > Action<()> for Until { // TODO: This doesn't compare?! - fn is_same(&self, other: &Self) -> bool { true } + fn is_same(&self, _other: &Self) -> bool { true } fn dyn_is_same(&self, other: &dyn Action<()>) -> bool { self.dyn_is_same_sized(other) } @@ -345,11 +345,11 @@ pub struct Just(F, PhantomData); impl R + Send + Sync + 'static> Action for Just { - fn is_same(&self, other: &Self) -> bool { true } + fn is_same(&self, _other: &Self) -> bool { true } fn dyn_is_same(&self, other: &dyn Action) -> bool { self.dyn_is_same_sized(other) } - fn backtrace(&self, bt: &mut Vec) {} + fn backtrace(&self, _bt: &mut Vec) {} // TODO: Reset closure? fn reset(&mut self) {} @@ -369,7 +369,7 @@ impl R + Send + Sync + 'stati /// // Make the current NPC say 'Hello, world!' exactly once /// just(|ctx| ctx.controller.say("Hello, world!")) /// ``` -pub fn just(mut f: F) -> Just +pub fn just(f: F) -> Just where F: FnMut(&mut NpcCtx) -> R + Send + Sync + 'static, { @@ -383,15 +383,15 @@ where pub struct Finish; impl Action<()> for Finish { - fn is_same(&self, other: &Self) -> bool { true } + fn is_same(&self, _other: &Self) -> bool { true } fn dyn_is_same(&self, other: &dyn Action<()>) -> bool { self.dyn_is_same_sized(other) } - fn backtrace(&self, bt: &mut Vec) {} + fn backtrace(&self, _bt: &mut Vec) {} fn reset(&mut self) {} - fn tick(&mut self, ctx: &mut NpcCtx) -> ControlFlow<()> { ControlFlow::Break(()) } + fn tick(&mut self, _ctx: &mut NpcCtx) -> ControlFlow<()> { ControlFlow::Break(()) } } /// An action that immediately finishes without doing anything. @@ -443,7 +443,7 @@ pub struct Tree { impl Node + Send + Sync + 'static, R: 'static> Action for Tree { - fn is_same(&self, other: &Self) -> bool { true } + fn is_same(&self, _other: &Self) -> bool { true } fn dyn_is_same(&self, other: &dyn Action) -> bool { self.dyn_is_same_sized(other) } @@ -626,7 +626,7 @@ pub struct Sequence(I, I, Option, PhantomData); impl + Clone + Send + Sync + 'static, A: Action> Action<()> for Sequence { - fn is_same(&self, other: &Self) -> bool { true } + fn is_same(&self, _other: &Self) -> bool { true } fn dyn_is_same(&self, other: &dyn Action<()>) -> bool { self.dyn_is_same_sized(other) } diff --git a/rtsim/src/data/faction.rs b/rtsim/src/data/faction.rs index 921d0cad58..65322e5097 100644 --- a/rtsim/src/data/faction.rs +++ b/rtsim/src/data/faction.rs @@ -1,7 +1,5 @@ use super::Actor; pub use common::rtsim::FactionId; -use common::{store::Id, uid::Uid}; -use hashbrown::HashMap; use serde::{Deserialize, Serialize}; use slotmap::HopSlotMap; use std::ops::{Deref, DerefMut}; diff --git a/rtsim/src/data/mod.rs b/rtsim/src/data/mod.rs index 1e7cbe093e..3f2bcae678 100644 --- a/rtsim/src/data/mod.rs +++ b/rtsim/src/data/mod.rs @@ -12,10 +12,7 @@ pub use self::{ use common::resources::TimeOfDay; use enum_map::{enum_map, EnumArray, EnumMap}; -use serde::{ - de::{self, Error as _}, - ser, Deserialize, Serialize, -}; +use serde::{de, ser, Deserialize, Serialize}; use std::{ cmp::PartialEq, fmt, @@ -81,7 +78,7 @@ fn rugged_ser_enum_map< ) -> Result { ser.collect_map( map.iter() - .filter(|(k, v)| v != &&V::from(DEFAULT)) + .filter(|(_, v)| v != &&V::from(DEFAULT)) .map(|(k, v)| (k, v)), ) } @@ -93,7 +90,7 @@ fn rugged_de_enum_map< D: de::Deserializer<'a>, const DEFAULT: i16, >( - mut de: D, + de: D, ) -> Result, D::Error> { struct Visitor(PhantomData<(K, V)>); diff --git a/rtsim/src/data/nature.rs b/rtsim/src/data/nature.rs index 2325ad6dbc..c94ca5fae9 100644 --- a/rtsim/src/data/nature.rs +++ b/rtsim/src/data/nature.rs @@ -18,7 +18,7 @@ pub struct Nature { impl Nature { pub fn generate(world: &World) -> Self { Self { - chunks: Grid::populate_from(world.sim().get_size().map(|e| e as i32), |pos| Chunk { + chunks: Grid::populate_from(world.sim().get_size().map(|e| e as i32), |_| Chunk { res: EnumMap::<_, f32>::default().map(|_, _| 1.0), }), } diff --git a/rtsim/src/data/npc.rs b/rtsim/src/data/npc.rs index 21ee9b4903..bd676b7dfe 100644 --- a/rtsim/src/data/npc.rs +++ b/rtsim/src/data/npc.rs @@ -1,25 +1,18 @@ -use crate::ai::{Action, NpcCtx}; +use crate::ai::Action; pub use common::rtsim::{NpcId, Profession}; use common::{ comp, grid::Grid, - rtsim::{FactionId, RtSimController, SiteId, VehicleId}, + rtsim::{FactionId, SiteId, VehicleId}, store::Id, - uid::Uid, vol::RectVolSize, }; -use hashbrown::HashMap; use rand::prelude::*; use serde::{Deserialize, Serialize}; use slotmap::HopSlotMap; use std::{ collections::VecDeque, - ops::{Deref, DerefMut, Generator, GeneratorState}, - pin::Pin, - sync::{ - atomic::{AtomicPtr, Ordering}, - Arc, - }, + ops::{Deref, DerefMut}, }; use vek::*; use world::{ diff --git a/rtsim/src/data/site.rs b/rtsim/src/data/site.rs index 40b6d2b89e..57fe387ca6 100644 --- a/rtsim/src/data/site.rs +++ b/rtsim/src/data/site.rs @@ -2,7 +2,6 @@ pub use common::rtsim::SiteId; use common::{ rtsim::{FactionId, NpcId}, store::Id, - uid::Uid, }; use hashbrown::{HashMap, HashSet}; use serde::{Deserialize, Serialize}; diff --git a/rtsim/src/gen/faction.rs b/rtsim/src/gen/faction.rs index b7a4c073dc..9c9a80077e 100644 --- a/rtsim/src/gen/faction.rs +++ b/rtsim/src/gen/faction.rs @@ -1,10 +1,9 @@ use crate::data::Faction; use rand::prelude::*; -use vek::*; use world::{IndexRef, World}; impl Faction { - pub fn generate(world: &World, index: IndexRef, rng: &mut impl Rng) -> Self { + pub fn generate(_world: &World, _index: IndexRef, rng: &mut impl Rng) -> Self { Self { leader: None, good_or_evil: rng.gen(), diff --git a/rtsim/src/gen/mod.rs b/rtsim/src/gen/mod.rs index 7bcb159f8b..a777aa07a3 100644 --- a/rtsim/src/gen/mod.rs +++ b/rtsim/src/gen/mod.rs @@ -3,7 +3,7 @@ pub mod site; use crate::data::{ faction::{Faction, Factions}, - npc::{Npc, Npcs, Profession, Vehicle, VehicleKind}, + npc::{Npc, Npcs, Profession, Vehicle}, site::{Site, Sites}, Data, Nature, }; @@ -15,7 +15,6 @@ use common::{ terrain::TerrainChunkSize, vol::RectVolSize, }; -use hashbrown::HashMap; use rand::prelude::*; use tracing::info; use vek::*; diff --git a/rtsim/src/gen/site.rs b/rtsim/src/gen/site.rs index 03559b0e63..e6ef2b3d1d 100644 --- a/rtsim/src/gen/site.rs +++ b/rtsim/src/gen/site.rs @@ -10,7 +10,7 @@ use world::{ impl Site { pub fn generate( world_site_id: Id, - world: &World, + _world: &World, index: IndexRef, nearby_factions: &[(Vec2, FactionId)], factions: &Factions, diff --git a/rtsim/src/lib.rs b/rtsim/src/lib.rs index 1ae1622b8d..f24a449f4a 100644 --- a/rtsim/src/lib.rs +++ b/rtsim/src/lib.rs @@ -1,5 +1,4 @@ #![feature( - generic_associated_types, never_type, try_blocks, generator_trait, @@ -91,7 +90,7 @@ impl RtState { pub fn bind( &mut self, - mut f: impl FnMut(EventCtx) + Send + Sync + 'static, + f: impl FnMut(EventCtx) + Send + Sync + 'static, ) { let f = AtomicRefCell::new(f); self.event_handlers diff --git a/rtsim/src/rule/npc_ai.rs b/rtsim/src/rule/npc_ai.rs index 936adc2cb4..bb87d3b028 100644 --- a/rtsim/src/rule/npc_ai.rs +++ b/rtsim/src/rule/npc_ai.rs @@ -1,13 +1,13 @@ -use std::{collections::VecDeque, hash::BuildHasherDefault}; +use std::hash::BuildHasherDefault; use crate::{ - ai::{casual, choose, finish, important, just, now, seq, until, urgent, watch, Action, NpcCtx}, + ai::{casual, choose, finish, important, just, now, seq, until, urgent, Action, NpcCtx}, data::{ - npc::{Brain, Controller, Npc, NpcId, PathData, PathingMemory, VehicleKind}, + npc::{Brain, Controller, PathData}, Sites, }, event::OnTick, - EventCtx, RtState, Rule, RuleError, + RtState, Rule, RuleError, }; use common::{ astar::{Astar, PathResult}, @@ -22,11 +22,6 @@ use fxhash::FxHasher64; use itertools::Itertools; use rand::prelude::*; use rayon::iter::{IntoParallelRefMutIterator, ParallelIterator}; -use std::{ - any::{Any, TypeId}, - marker::PhantomData, - ops::ControlFlow, -}; use vek::*; use world::{ civ::{self, Track}, @@ -212,11 +207,9 @@ fn path_towns( } } -const MAX_STEP: f32 = 32.0; - impl Rule for NpcAi { fn start(rtstate: &mut RtState) -> Result { - rtstate.bind::(|mut ctx| { + rtstate.bind::(|ctx| { let mut npc_data = { let mut data = ctx.state.data_mut(); data.npcs @@ -351,8 +344,6 @@ fn goto(wpos: Vec3, speed_factor: f32, goal_dist: f32) -> impl Action { /// Try to walk toward a 2D position on the terrain without caring for /// obstacles. fn goto_2d(wpos2d: Vec2, speed_factor: f32, goal_dist: f32) -> impl Action { - const MIN_DIST: f32 = 2.0; - now(move |ctx| { let wpos = wpos2d.with_z(ctx.world.sim().get_alt_approx(wpos2d.as_()).unwrap_or(0.0)); goto(wpos, speed_factor, goal_dist) @@ -421,7 +412,6 @@ fn travel_to_site(tgt_site: SiteId) -> impl Action { if let Some(current_site) = ctx.npc.current_site && let Some(tracks) = path_towns(current_site, tgt_site, sites, ctx.world) { - let track_count = tracks.path.len(); let mut nodes = tracks.path .into_iter() @@ -625,6 +615,7 @@ fn villager(visiting_site: SiteId) -> impl Action { .debug(move || format!("villager at site {:?}", visiting_site)) } +/* fn follow(npc: NpcId, distance: f32) -> impl Action { const STEP_DIST: f32 = 1.0; now(move |ctx| { @@ -643,6 +634,7 @@ fn follow(npc: NpcId, distance: f32) -> impl Action { .debug(move || format!("Following npc({npc:?})")) .map(|_| {}) } +*/ fn chunk_path( from: Vec2, @@ -794,7 +786,7 @@ fn bird_large() -> impl Action { if let Some(home) = ctx.npc.home { let is_home = ctx.npc.current_site.map_or(false, |site| home == site); if is_home { - if let Some((id, site)) = data + if let Some((_, site)) = data .sites .iter() .filter(|(id, site)| { diff --git a/rtsim/src/rule/replenish_resources.rs b/rtsim/src/rule/replenish_resources.rs index e1838f8883..3aff5256e9 100644 --- a/rtsim/src/rule/replenish_resources.rs +++ b/rtsim/src/rule/replenish_resources.rs @@ -1,8 +1,5 @@ use crate::{event::OnTick, RtState, Rule, RuleError}; -use common::{terrain::TerrainChunkSize, vol::RectVolSize}; use rand::prelude::*; -use tracing::info; -use vek::*; pub struct ReplenishResources; diff --git a/rtsim/src/rule/simulate_npcs.rs b/rtsim/src/rule/simulate_npcs.rs index 0a95edb1eb..12f6794382 100644 --- a/rtsim/src/rule/simulate_npcs.rs +++ b/rtsim/src/rule/simulate_npcs.rs @@ -113,7 +113,9 @@ impl Rule for SimulateNpcs { Npc::new( rng.gen(), rand_wpos(&mut rng), - Body::BirdLarge(comp::body::bird_large::Body::random_with(&mut rng, species)), + Body::BirdLarge(comp::body::bird_large::Body::random_with( + &mut rng, species, + )), ) .with_home(site_id), ); diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 047318a164..5cade6e2a9 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -2003,13 +2003,10 @@ fn handle_kill_npcs( .get(entity) .copied() { - ecs - .write_resource::() + ecs.write_resource::() .hook_rtsim_entity_delete( &ecs.read_resource::>(), - ecs - .read_resource::() - .as_index_ref(), + ecs.read_resource::().as_index_ref(), rtsim_entity, ); } diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 9fbd288978..ec85a61727 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -13,13 +13,12 @@ use common::{ }, event::{EventBus, ServerEvent}, path::TraversalConfig, - rtsim::RtSimEvent, }; use common_base::prof_span; use common_ecs::{Job, Origin, ParMode, Phase, System}; use rand::thread_rng; use rayon::iter::ParallelIterator; -use specs::{saveload::MarkerAllocator, Join, ParJoin, Read, WriteExpect, WriteStorage}; +use specs::{saveload::MarkerAllocator, Join, ParJoin, Read, WriteStorage}; /// This system will allow NPCs to modify their controller #[derive(Default)]