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
9932f1da
Commit
9932f1da
authored
Feb 24, 2021
by
Rahix
🦀
Browse files
Merge branch 'fix-lints' into 'master'
Fix some more lints See merge request
!54
parents
a7a3172f
27b555ee
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/colliders.rs
View file @
9932f1da
...
...
@@ -105,7 +105,7 @@ impl CollisionWorld {
pub
fn
interferences_with_point
(
&
self
,
point
:
&
nalgebra
::
Point2
<
f32
>
)
->
Vec
<
legion
::
Entity
>
{
self
.world
.interferences_with_point
(
point
,
&
pipeline
::
CollisionGroups
::
new
())
.map
(|(
_
,
collision_object
)|
collision_object
.data
()
.clone
()
)
.map
(|(
_
,
collision_object
)|
*
collision_object
.data
())
.collect
()
}
}
...
...
src/components/node.rs
View file @
9932f1da
...
...
@@ -95,7 +95,7 @@ pub fn draw_nodes(
if
let
Some
(
ping_time
)
=
node
.ping_time
{
let
radius
=
(
time
-
ping_time
)
*
180.0
+
18.0
;
let
alpha
=
(
1.0
-
(
time
-
ping_time
)
*
2.0
)
.max
(
0.0
)
.powi
(
2
);
let
mut
ring_color
=
node_color
.clone
()
;
let
mut
ring_color
=
node_color
;
ring_color
.alpha
=
alpha
;
rendering
.begin_path
();
...
...
src/components/obstacle.rs
View file @
9932f1da
...
...
@@ -22,7 +22,7 @@ impl ObstacleBarrier {
ObstacleBarrier
{
w
:
200.0
,
h
:
20.0
,
orientation
:
orientation
,
orientation
,
}
}
...
...
src/gamestate.rs
View file @
9932f1da
...
...
@@ -71,13 +71,10 @@ pub enum Event<'a> {
Cheat
(
crate
::
cheats
::
CheatCommand
),
}
pub
type
HandlerClosure
=
closure
::
Closure
<
dyn
FnMut
(
wasm_bindgen
::
JsValue
)
>
;
struct
EventHandlers
{
pub
mouse_handlers
:
std
::
collections
::
HashMap
<
String
,
closure
::
Closure
<
dyn
FnMut
(
wasm_bindgen
::
JsValue
)
>>
,
pub
key_handlers
:
Option
<
(
closure
::
Closure
<
dyn
FnMut
(
wasm_bindgen
::
JsValue
)
>
,
closure
::
Closure
<
dyn
FnMut
(
wasm_bindgen
::
JsValue
)
>
,
)
>
,
pub
mouse_handlers
:
std
::
collections
::
HashMap
<
String
,
HandlerClosure
>
,
pub
key_handlers
:
Option
<
(
HandlerClosure
,
HandlerClosure
)
>
,
}
impl
EventHandlers
{
...
...
@@ -147,7 +144,7 @@ impl EventHandlers {
}
pub
fn
deregister_all
(
&
mut
self
)
{
if
let
Some
(
_
)
=
self
.key_handlers
{
if
self
.key_handlers
.is_some
()
{
let
body
=
utils
::
document
()
.body
()
.unwrap
();
body
.set_onkeydown
(
None
);
body
.set_onkeyup
(
None
);
...
...
src/states/ingame.rs
View file @
9932f1da
...
...
@@ -39,11 +39,10 @@ impl InGameState {
resources
.insert
(
resources
::
Camera
::
new
(
1920.0
,
1080.0
));
resources
.insert
(
colliders
::
CollisionWorld
::
new
());
let
obstacles
=
entities
::
create_stationary_obstacles
(
&
mut
world
,
&
level
,
&
player
);
entities
::
create_stationary_obstacles
(
&
mut
world
,
&
level
,
&
player
);
let
player
=
entities
::
create_player
(
&
mut
world
,
&
level
,
player
);
resources
.insert
(
resources
::
Player
(
player
));
resources
.insert
(
obstacles
);
resources
.insert
(
resources
::
GameManager
::
new
());
level
.apply_colliders
(
&
mut
world
);
...
...
@@ -111,7 +110,7 @@ impl gamestate::State for InGameState {
fn
event
(
&
mut
self
,
event
:
gamestate
::
Event
)
->
gamestate
::
Transition
{
use
legion
::
IntoQuery
;
let
player_id
=
self
.resources.get
::
<
resources
::
Player
>
()
.unwrap
()
.0
.clone
()
;
let
player_id
=
self
.resources.get
::
<
resources
::
Player
>
()
.unwrap
()
.0
;
let
(
player_movable
,
player
)
=
<
(
&
mut
components
::
Movable
,
&
mut
components
::
Player
)
>
::
query
()
.get_mut
(
&
mut
self
.world
,
player_id
)
...
...
@@ -175,7 +174,7 @@ impl gamestate::State for InGameState {
let
game_manager
=
self
.resources.get
::
<
resources
::
GameManager
>
()
.unwrap
();
if
game_manager
.wants_return_to_heaven
()
{
let
player_ent
=
self
.resources.get
::
<
resources
::
Player
>
()
.unwrap
()
.0
.clone
()
;
let
player_ent
=
self
.resources.get
::
<
resources
::
Player
>
()
.unwrap
()
.0
;
let
player
:
&
components
::
Player
=
<&
components
::
Player
>
::
query
()
.get
(
&
self
.world
,
player_ent
)
.unwrap
();
...
...
src/systems/moving.rs
View file @
9932f1da
...
...
@@ -23,7 +23,7 @@ pub fn move_movable(
#[resource]
clock
:
&
resources
::
Clock
,
#[resource]
collision_world
:
&
colliders
::
CollisionWorld
,
)
{
let
mut
actual_velocity
=
movable
.velocity
.clone
()
;
let
mut
actual_velocity
=
movable
.velocity
;
if
actual_velocity
==
nalgebra
::
Vector2
::
new
(
0.0
,
0.0
)
{
return
;
...
...
@@ -38,7 +38,7 @@ pub fn move_movable(
.contacts_with
(
collider
.handle
.unwrap
(),
false
)
.unwrap
()
.filter_map
(|
pair
|
pair
.3
.deepest_contact
())
.map
(|
contact
|
contact
.contact.normal
.clone
()
)
.map
(|
contact
|
contact
.contact.normal
)
.collect
();
for
normal
in
normals
.iter
()
{
...
...
src/utils.rs
View file @
9932f1da
...
...
@@ -28,7 +28,7 @@ fn contain(
)
->
(
nalgebra
::
Vector2
<
f64
>
,
nalgebra
::
Vector2
<
f64
>
)
{
let
client_ratio
=
child
.x
/
child
.y
;
let
parent_ratio
=
parent
.x
/
parent
.y
;
let
mut
child_resized
=
parent
.clone
()
;
let
mut
child_resized
=
parent
;
if
client_ratio
>
parent_ratio
{
child_resized
.y
=
child_resized
.x
/
client_ratio
;
...
...
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