Clippy fixes

This commit is contained in:
Joshua Barretto 2023-04-03 20:12:57 +01:00
parent 2eaf3c7e92
commit c8d0443111
5 changed files with 27 additions and 33 deletions

View File

@ -1,7 +1,7 @@
use std::hash::BuildHasherDefault; use std::hash::BuildHasherDefault;
use crate::{ 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::{ data::{
npc::{Brain, PathData}, npc::{Brain, PathData},
Sites, Sites,

View File

@ -344,7 +344,7 @@ impl<'a> AgentData<'a> {
} }
break 'activity; // Don't fall through to idle wandering break 'activity; // Don't fall through to idle wandering
}, },
Some(NpcActivity::Gather(resources)) => { Some(NpcActivity::Gather(_resources)) => {
// TODO: Implement // TODO: Implement
controller.push_action(ControlAction::Dance); controller.push_action(ControlAction::Dance);
break 'activity; // Don't fall through to idle wandering break 'activity; // Don't fall through to idle wandering

View File

@ -1305,7 +1305,7 @@ fn handle_rtsim_npc(
for (idx, _) in &npcs { for (idx, _) in &npcs {
let _ = write!(&mut info, "{}, ", idx); let _ = write!(&mut info, "{}, ", idx);
} }
let _ = writeln!(&mut info, ""); let _ = writeln!(&mut info);
let _ = writeln!(&mut info, "Matched {} NPCs.", npcs.len()); let _ = writeln!(&mut info, "Matched {} NPCs.", npcs.len());
server.notify_client( server.notify_client(

View File

@ -474,40 +474,34 @@ fn handle_rtsim_actions(bdata: &mut BehaviorData) -> bool {
if let Some(action) = bdata.agent.rtsim_controller.actions.pop_front() { if let Some(action) = bdata.agent.rtsim_controller.actions.pop_front() {
match action { match action {
NpcAction::Greet(actor) => { NpcAction::Greet(actor) => {
if bdata.agent.allowed_to_speak() { if bdata.agent.allowed_to_speak()
if let Some(target) = bdata.read_data.lookup_actor(actor) && let Some(target) = bdata.read_data.lookup_actor(actor)
&& let Some(target_pos) = bdata.read_data.positions.get(target) && let Some(target_pos) = bdata.read_data.positions.get(target)
{ && bdata.agent_data.look_toward(bdata.controller, bdata.read_data, target)
if bdata.agent_data.look_toward( {
&mut bdata.controller, bdata.agent.target = Some(Target::new(
&bdata.read_data, target,
target, false,
) { bdata.read_data.time.0,
bdata.agent.target = Some(Target::new( false,
target, Some(target_pos.0),
false, ));
bdata.read_data.time.0,
false,
Some(target_pos.0),
));
bdata.controller.push_action(ControlAction::Talk); bdata.controller.push_action(ControlAction::Talk);
bdata.controller.push_utterance(UtteranceKind::Greeting); bdata.controller.push_utterance(UtteranceKind::Greeting);
bdata bdata
.agent_data .agent_data
.chat_npc("npc-speech-villager_open", &mut bdata.event_emitter); .chat_npc("npc-speech-villager_open", bdata.event_emitter);
// Start a timer so that they eventually stop interacting // Start a timer so that they eventually stop interacting
bdata bdata
.agent .agent
.timer .timer
.start(bdata.read_data.time.0, TimerAction::Interact); .start(bdata.read_data.time.0, TimerAction::Interact);
}
}
} }
}, },
NpcAction::Say(msg) => { NpcAction::Say(msg) => {
bdata.controller.push_utterance(UtteranceKind::Greeting); 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);
}, },
} }
} }

View File

@ -1141,7 +1141,7 @@ impl Site {
.unwrap(); .unwrap();
canvas.spawn( canvas.spawn(
EntityInfo::at(Vec3::new(wpos2d.x, wpos2d.y, alt).as_()) 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), .with_alignment(Alignment::Tame),
); );
} }