diff --git a/rtsim/src/rule/npc_ai.rs b/rtsim/src/rule/npc_ai.rs index 8cab657361..7424fd847a 100644 --- a/rtsim/src/rule/npc_ai.rs +++ b/rtsim/src/rule/npc_ai.rs @@ -1,7 +1,7 @@ use std::hash::BuildHasherDefault; use crate::{ - ai::{casual, choose, finish, important, just, now, seq, until, urgent, Action, NpcCtx}, + ai::{casual, choose, finish, important, just, now, seq, until, Action, NpcCtx}, data::{ npc::{Brain, PathData}, Sites, diff --git a/server/agent/src/action_nodes.rs b/server/agent/src/action_nodes.rs index a3498cd2e4..4a5e1ee192 100644 --- a/server/agent/src/action_nodes.rs +++ b/server/agent/src/action_nodes.rs @@ -344,7 +344,7 @@ impl<'a> AgentData<'a> { } break 'activity; // Don't fall through to idle wandering }, - Some(NpcActivity::Gather(resources)) => { + Some(NpcActivity::Gather(_resources)) => { // TODO: Implement controller.push_action(ControlAction::Dance); break 'activity; // Don't fall through to idle wandering diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 246dd56875..1ea826763d 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -1305,7 +1305,7 @@ fn handle_rtsim_npc( for (idx, _) in &npcs { let _ = write!(&mut info, "{}, ", idx); } - let _ = writeln!(&mut info, ""); + let _ = writeln!(&mut info); let _ = writeln!(&mut info, "Matched {} NPCs.", npcs.len()); server.notify_client( diff --git a/server/src/sys/agent/behavior_tree.rs b/server/src/sys/agent/behavior_tree.rs index e258bb2e00..6f9a914fd5 100644 --- a/server/src/sys/agent/behavior_tree.rs +++ b/server/src/sys/agent/behavior_tree.rs @@ -474,40 +474,34 @@ fn handle_rtsim_actions(bdata: &mut BehaviorData) -> bool { if let Some(action) = bdata.agent.rtsim_controller.actions.pop_front() { match action { NpcAction::Greet(actor) => { - if bdata.agent.allowed_to_speak() { - if let Some(target) = bdata.read_data.lookup_actor(actor) - && let Some(target_pos) = bdata.read_data.positions.get(target) - { - if bdata.agent_data.look_toward( - &mut bdata.controller, - &bdata.read_data, - target, - ) { - bdata.agent.target = Some(Target::new( - target, - false, - bdata.read_data.time.0, - false, - Some(target_pos.0), - )); + if bdata.agent.allowed_to_speak() + && let Some(target) = bdata.read_data.lookup_actor(actor) + && let Some(target_pos) = bdata.read_data.positions.get(target) + && bdata.agent_data.look_toward(bdata.controller, bdata.read_data, target) + { + bdata.agent.target = Some(Target::new( + target, + false, + bdata.read_data.time.0, + false, + Some(target_pos.0), + )); - bdata.controller.push_action(ControlAction::Talk); - bdata.controller.push_utterance(UtteranceKind::Greeting); - bdata - .agent_data - .chat_npc("npc-speech-villager_open", &mut bdata.event_emitter); - // Start a timer so that they eventually stop interacting - bdata - .agent - .timer - .start(bdata.read_data.time.0, TimerAction::Interact); - } - } + bdata.controller.push_action(ControlAction::Talk); + bdata.controller.push_utterance(UtteranceKind::Greeting); + bdata + .agent_data + .chat_npc("npc-speech-villager_open", bdata.event_emitter); + // Start a timer so that they eventually stop interacting + bdata + .agent + .timer + .start(bdata.read_data.time.0, TimerAction::Interact); } }, NpcAction::Say(msg) => { bdata.controller.push_utterance(UtteranceKind::Greeting); - bdata.agent_data.chat_npc(msg, &mut bdata.event_emitter); + bdata.agent_data.chat_npc(msg, bdata.event_emitter); }, } } diff --git a/world/src/site2/mod.rs b/world/src/site2/mod.rs index 2c0b9f3d2a..223566da22 100644 --- a/world/src/site2/mod.rs +++ b/world/src/site2/mod.rs @@ -1141,7 +1141,7 @@ impl Site { .unwrap(); canvas.spawn( EntityInfo::at(Vec3::new(wpos2d.x, wpos2d.y, alt).as_()) - .with_asset_expect(&spec, dynamic_rng) + .with_asset_expect(spec, dynamic_rng) .with_alignment(Alignment::Tame), ); }