mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
worth_choosing refactor
This commit is contained in:
parent
d5bde47a03
commit
fc9c3c3be9
@ -1440,33 +1440,17 @@ 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)
|
|
||||||
.and_then(|pos| read_data.healths.get(entity).map(|h| (pos, h)))
|
|
||||||
.and_then(|(pos, health)| {
|
|
||||||
read_data
|
|
||||||
.stats
|
|
||||||
.get(entity)
|
|
||||||
.map(|stats| (pos, health, stats))
|
|
||||||
})
|
|
||||||
.and_then(|(pos, health, stats)| {
|
|
||||||
read_data
|
|
||||||
.inventories
|
|
||||||
.get(entity)
|
|
||||||
.map(|inventory| (pos, health, stats, inventory))
|
|
||||||
})
|
|
||||||
.map(|(pos, health, stats, inventory)| {
|
|
||||||
(
|
|
||||||
entity,
|
entity,
|
||||||
pos,
|
pos,
|
||||||
health,
|
read_data.healths.get(entity)?,
|
||||||
stats,
|
read_data.stats.get(entity)?,
|
||||||
inventory,
|
read_data.inventories.get(entity)?,
|
||||||
read_data.alignments.get(entity),
|
read_data.alignments.get(entity),
|
||||||
read_data.char_states.get(entity),
|
read_data.char_states.get(entity),
|
||||||
read_data.bodies.get(entity),
|
read_data.bodies.get(entity),
|
||||||
)
|
))
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user