Commit 3f22c558 authored by Rahix's avatar Rahix 🦀
Browse files

bottle_angel: Return to heaven when shift is over

parent ca343ed9
......@@ -43,7 +43,9 @@ impl super::AngelShiftImpl for BottleAngelShift {
entities::create_drop_points(world, level);
resources.insert(BottleAngelState::new(4));
schedule_builder.add_thread_local(collect_bottledrops_system());
schedule_builder
.add_thread_local(collect_bottledrops_system())
.add_thread_local(update_bottle_shift_system(self.hours));
}
}
......@@ -94,3 +96,23 @@ pub fn collect_bottledrops(
}
}
}
#[legion::system]
#[write_component(components::Player)]
pub fn update_bottle_shift(
#[state] hours_to_award: &usize,
world: &mut legion::world::SubWorld,
#[resource] player: &mut resources::Player,
#[resource] bottle_angel_state: &mut BottleAngelState,
#[resource] game_manager: &mut resources::GameManager,
) {
use legion::IntoQuery;
if bottle_angel_state.collected_drops >= bottle_angel_state.drops_in_map {
let player = <&mut components::Player>::query()
.get_mut(world, player.0)
.unwrap();
player.collected_hours += *hours_to_award as u32;
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