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
9e09249d
Commit
9e09249d
authored
Mar 29, 2021
by
Simon Goller
Committed by
Rahix
Apr 02, 2021
Browse files
Format code
parent
0f20277f
Changes
5
Hide whitespace changes
Inline
Side-by-side
macro-impl/src/lib.rs
View file @
9e09249d
...
...
@@ -33,7 +33,6 @@ pub fn angel_system(args: TokenStream, input: TokenStream) -> TokenStream {
.into
()
}
#[proc_macro_attribute]
pub
fn
wasm_bindgen_anyhow
(
_args
:
TokenStream
,
input
:
TokenStream
)
->
TokenStream
{
let
f
=
syn
::
parse_macro_input!
(
input
as
syn
::
ItemFn
);
...
...
src/error.rs
View file @
9e09249d
...
...
@@ -30,8 +30,10 @@ impl<T> AnyhowWebExt<T> for Result<T, web_sys::Element> {
}
}
pub
fn
handle_system_result
<
F
>
(
mut
f
:
F
)
where
F
:
FnMut
()
->
anyhow
::
Result
<
()
>
{
pub
fn
handle_system_result
<
F
>
(
mut
f
:
F
)
where
F
:
FnMut
()
->
anyhow
::
Result
<
()
>
,
{
if
let
Err
(
_
)
=
f
()
{
panic!
();
}
...
...
src/gamestate.rs
View file @
9e09249d
...
...
@@ -194,7 +194,7 @@ impl StateMachineHandle {
self
.do_transition
(
t
)
}
pub
fn
do_cheat
(
&
self
,
cheat
:
crate
::
cheats
::
CheatCommand
)
->
anyhow
::
Result
<
()
>
{
pub
fn
do_cheat
(
&
self
,
cheat
:
crate
::
cheats
::
CheatCommand
)
->
anyhow
::
Result
<
()
>
{
self
.do_event
(
Event
::
Cheat
(
cheat
))
}
...
...
src/states/ingame.rs
View file @
9e09249d
...
...
@@ -124,8 +124,7 @@ impl gamestate::State for InGameState {
.resources
.get
::
<
resources
::
Player
>
()
.context
(
"Resource 'Player' not found"
)
?
.0
;
.0
;
let
(
player_movable
,
player
)
=
<
(
&
mut
components
::
Movable
,
&
mut
components
::
Player
)
>
::
query
()
.get_mut
(
&
mut
self
.world
,
player_id
)
...
...
@@ -199,8 +198,7 @@ impl gamestate::State for InGameState {
.resources
.get
::
<
resources
::
Player
>
()
.context
(
"Could not find resource 'Player'"
)
?
.0
;
.0
;
let
player
:
&
components
::
Player
=
<&
components
::
Player
>
::
query
()
.get
(
&
self
.world
,
player_ent
)
.context
(
"Could not find Player"
)
?
;
...
...
@@ -208,7 +206,9 @@ impl gamestate::State for InGameState {
player
.shifts_completed
+=
1
;
Ok
(
gamestate
::
Transition
::
replace
(
states
::
HeavenState
::
new
(
Some
(
player
))
?
))
Ok
(
gamestate
::
Transition
::
replace
(
states
::
HeavenState
::
new
(
Some
(
player
),
)
?
))
}
else
if
game_manager
.wants_game_over
()
{
Ok
(
gamestate
::
Transition
::
replace
(
states
::
GameOverState
::
new
()
?
))
}
else
{
...
...
src/states/level_loading.rs
View file @
9e09249d
...
...
@@ -68,9 +68,12 @@ impl gamestate::State for LevelLoadingState {
sprites
::
Sprite
::
load_and_register_all
(
&
mut
rendering
)
.await
;
handle
.do_transition
(
gamestate
::
Transition
::
replace
(
states
::
InGameState
::
new
(
level
,
rendering
,
player
.clone
(),
assigned_shift
)
.unwrap
(),
))
.unwrap
();
// ignore-unwrap - Inside a closure
handle
.do_transition
(
gamestate
::
Transition
::
replace
(
states
::
InGameState
::
new
(
level
,
rendering
,
player
.clone
(),
assigned_shift
)
.unwrap
(),
))
.unwrap
();
// ignore-unwrap - Inside a closure
});
Ok
(
gamestate
::
Transition
::
Loop
)
}
...
...
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