Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Engel Simulator 2020
Engel Simulator 2020
Commits
3f22c558
Commit
3f22c558
authored
Dec 26, 2020
by
Rahix
🦀
Browse files
bottle_angel: Return to heaven when shift is over
parent
ca343ed9
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/angel_shifts/bottle_angel.rs
View file @
3f22c558
...
...
@@ -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
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment