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
8e0c2210
Commit
8e0c2210
authored
Feb 24, 2021
by
Rahix
🦀
Browse files
Remove redundant clone() calls
parent
a7a3172f
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/colliders.rs
View file @
8e0c2210
...
...
@@ -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 @
8e0c2210
...
...
@@ -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/states/ingame.rs
View file @
8e0c2210
...
...
@@ -111,7 +111,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 +175,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 @
8e0c2210
...
...
@@ -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 @
8e0c2210
...
...
@@ -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