Commit 381ac328 authored by Rahix's avatar Rahix 🦀
Browse files

bottle_angel: Make sure we're only awarding hours once

If the system were to run multiple times after all bottles were
collected, it would add the hours to the player's counter multiple
times.  Ensure this can't happen.
parent 3947622b
......@@ -103,7 +103,7 @@ pub fn collect_bottledrops(
#[legion::system]
#[write_component(components::Player)]
pub fn update_bottle_shift(
#[state] hours_to_award: &usize,
#[state] hours_to_award: &mut usize,
world: &mut legion::world::SubWorld,
#[resource] player: &mut resources::Player,
#[resource] bottle_angel_state: &mut BottleAngelState,
......@@ -116,6 +116,7 @@ pub fn update_bottle_shift(
.get_mut(world, player.0)
.unwrap();
player.collected_hours += *hours_to_award as u32;
*hours_to_award = 0;
game_manager.request_return_to_heaven();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment