mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Clippy fixes
This commit is contained in:
parent
2eaf3c7e92
commit
c8d0443111
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -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),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user