mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
refactor: use restrict_mut
This commit is contained in:
committed by
Pfauenauge90
parent
8afe5fd1dd
commit
65d0a1c4f4
@ -277,13 +277,24 @@ impl<'a> System<'a> for Sys {
|
||||
) {
|
||||
let mut server_emitter = server_bus.emitter();
|
||||
let mut local_emitter = local_bus.emitter();
|
||||
for (entity, uid, controller, mut character, stats, energy, body, vel, physics, mount) in (
|
||||
for (
|
||||
entity,
|
||||
uid,
|
||||
controller,
|
||||
mut character,
|
||||
stats,
|
||||
mut energy,
|
||||
body,
|
||||
vel,
|
||||
physics,
|
||||
mount,
|
||||
) in (
|
||||
&entities,
|
||||
&uids,
|
||||
&mut controllers,
|
||||
&mut character_states,
|
||||
&stats,
|
||||
&mut energies,
|
||||
&mut energies.restrict_mut(),
|
||||
&bodies,
|
||||
&velocities,
|
||||
&physics_states,
|
||||
@ -585,6 +596,7 @@ impl<'a> System<'a> for Sys {
|
||||
// Try to charge
|
||||
if inputs.charge.is_pressed() && !inputs.charge.is_held_down() {
|
||||
if energy
|
||||
.get_mut_unchecked()
|
||||
.try_change_by(-CHARGE_COST, EnergySource::CastSpell)
|
||||
.is_ok()
|
||||
{
|
||||
|
Reference in New Issue
Block a user