mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Removed patrol origin from humanoid NPCs
This commit is contained in:
parent
84eb7b0653
commit
2aa6ced357
@ -467,7 +467,9 @@ fn villager(visiting_site: SiteId) -> impl Action {
|
||||
format!("travel to visiting site")
|
||||
}
|
||||
}))
|
||||
} else if DayPeriod::from(ctx.time_of_day.0).is_dark() {
|
||||
} else if DayPeriod::from(ctx.time_of_day.0).is_dark()
|
||||
&& !matches!(ctx.npc.profession, Some(Profession::Guard))
|
||||
{
|
||||
important(
|
||||
now(move |ctx| {
|
||||
if let Some(house_wpos) = ctx
|
||||
|
@ -260,19 +260,6 @@ impl<'a> System<'a> for Sys {
|
||||
if let Some(agent) = agent {
|
||||
agent.rtsim_controller.travel_to = npc.goto.map(|(wpos, _)| wpos);
|
||||
agent.rtsim_controller.speed_factor = npc.goto.map_or(1.0, |(_, sf)| sf);
|
||||
// TODO:
|
||||
// agent.rtsim_controller.heading_to =
|
||||
// npc.pathing.intersite_path.as_ref().
|
||||
// and_then(|(path, _)| {
|
||||
// Some(
|
||||
// index
|
||||
// .sites
|
||||
//
|
||||
// .get(data.sites.get(path.end)?.world_site?)
|
||||
// .name()
|
||||
// .to_string(),
|
||||
// )
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -513,15 +513,19 @@ impl NpcData {
|
||||
};
|
||||
|
||||
let agent = has_agency.then(|| {
|
||||
comp::Agent::from_body(&body)
|
||||
.with_behavior(
|
||||
Behavior::default()
|
||||
.maybe_with_capabilities(can_speak.then_some(BehaviorCapability::SPEAK))
|
||||
.maybe_with_capabilities(trade_for_site.map(|_| BehaviorCapability::TRADE))
|
||||
.with_trade_site(trade_for_site),
|
||||
)
|
||||
.with_patrol_origin(pos)
|
||||
.with_no_flee_if(matches!(agent_mark, Some(agent::Mark::Guard)) || no_flee)
|
||||
let mut agent = comp::Agent::from_body(&body).with_behavior(
|
||||
Behavior::default()
|
||||
.maybe_with_capabilities(can_speak.then_some(BehaviorCapability::SPEAK))
|
||||
.maybe_with_capabilities(trade_for_site.map(|_| BehaviorCapability::TRADE))
|
||||
.with_trade_site(trade_for_site),
|
||||
);
|
||||
|
||||
// Non-humanoids get a patrol origin to stop them moving too far
|
||||
if !matches!(body, comp::Body::Humanoid(_)) {
|
||||
agent = agent.with_patrol_origin(pos);
|
||||
}
|
||||
|
||||
agent.with_no_flee_if(matches!(agent_mark, Some(agent::Mark::Guard)) || no_flee)
|
||||
});
|
||||
|
||||
let agent = if matches!(alignment, comp::Alignment::Enemy)
|
||||
|
Loading…
Reference in New Issue
Block a user