Merge branch 'agent_worth_choosing_refactor' into 'master'

worth_choosing refactor

See merge request veloren/veloren!3237
This commit is contained in:
Marcel
2022-02-27 19:21:22 +00:00

View File

@ -1440,34 +1440,18 @@ impl<'a> AgentData<'a> {
let mut aggro_on = false; let mut aggro_on = false;
let worth_choosing = |entity| { let worth_choosing = |entity| {
read_data read_data.positions.get(entity).and_then(|pos| {
.positions Some((
.get(entity) entity,
.and_then(|pos| read_data.healths.get(entity).map(|h| (pos, h))) pos,
.and_then(|(pos, health)| { read_data.healths.get(entity)?,
read_data read_data.stats.get(entity)?,
.stats read_data.inventories.get(entity)?,
.get(entity) read_data.alignments.get(entity),
.map(|stats| (pos, health, stats)) read_data.char_states.get(entity),
}) read_data.bodies.get(entity),
.and_then(|(pos, health, stats)| { ))
read_data })
.inventories
.get(entity)
.map(|inventory| (pos, health, stats, inventory))
})
.map(|(pos, health, stats, inventory)| {
(
entity,
pos,
health,
stats,
inventory,
read_data.alignments.get(entity),
read_data.char_states.get(entity),
read_data.bodies.get(entity),
)
})
}; };
let max_search_dist = agent.psyche.search_dist(); let max_search_dist = agent.psyche.search_dist();