mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Get rid of unwraps
This commit is contained in:
@ -878,19 +878,20 @@ impl Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Give EXP to the client
|
// Give EXP to the client
|
||||||
|
let mut stats = ecs.write_storage::<comp::Stats>();
|
||||||
|
if let Some(entity_stats) = stats.get(entity).cloned() {
|
||||||
if let comp::HealthSource::Attack { by } = dying.cause {
|
if let comp::HealthSource::Attack { by } = dying.cause {
|
||||||
ecs.entity_from_uid(by.into()).map(|attacker| {
|
ecs.entity_from_uid(by.into()).map(|attacker| {
|
||||||
let mut stats = ecs.write_storage::<comp::Stats>();
|
if let Some(attacker_stats) = stats.get_mut(attacker) {
|
||||||
let entity_stats = stats.get(entity).unwrap().clone();
|
|
||||||
let attacker_stats = stats.get_mut(attacker).unwrap();
|
|
||||||
|
|
||||||
// TODO: Discuss whether we should give EXP by Player Killing or not.
|
// TODO: Discuss whether we should give EXP by Player Killing or not.
|
||||||
attacker_stats.exp.change_by(
|
attacker_stats.exp.change_by(
|
||||||
entity_stats.health.maximum() as f64 / 10.0
|
entity_stats.health.maximum() as f64 / 10.0
|
||||||
* entity_stats.level.level() as f64,
|
* entity_stats.level.level() as f64,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
entity
|
entity
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user