summaryrefslogtreecommitdiff
path: root/src/sim/sim_manager
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2026-09-01 19:08:17 -0700
committerKai Stevenson <kai@kaistevenson.com>2026-09-01 19:08:17 -0700
commit7eedb19a5f28150a28b8cf1ec5fb08139d6b5590 (patch)
tree7a2b43902bda122e7c025d0abbda22a4de936860 /src/sim/sim_manager
parent2335bd23e3b4e09177ff02e236612b78c1730b9c (diff)
lint
Diffstat (limited to 'src/sim/sim_manager')
-rw-r--r--src/sim/sim_manager/mod.rs5
-rw-r--r--src/sim/sim_manager/utils.rs8
2 files changed, 6 insertions, 7 deletions
diff --git a/src/sim/sim_manager/mod.rs b/src/sim/sim_manager/mod.rs
index ca68831..bbfd05e 100644
--- a/src/sim/sim_manager/mod.rs
+++ b/src/sim/sim_manager/mod.rs
@@ -174,13 +174,12 @@ impl SimManager {
}
}
- if input_manager.pressed(Input::Action2) {
- if let Some(entity_id) = written_entities_scope
+ if input_manager.pressed(Input::Action2)
+ && let Some(entity_id) = written_entities_scope
.get_entity_id_at_position(input_manager.world_mouse_pos.round().as_ivec2())
{
self.atomize_entity(entity_id);
}
- }
// TEST ATOMIZATION
diff --git a/src/sim/sim_manager/utils.rs b/src/sim/sim_manager/utils.rs
index 45960bf..5bb7573 100644
--- a/src/sim/sim_manager/utils.rs
+++ b/src/sim/sim_manager/utils.rs
@@ -159,7 +159,7 @@ pub fn read_back_entities_from_world(
let ec = entity.data.cells.as_mut().unwrap();
// first check if the entity has been partitioned
let components = compute_components(&ec.cells, ec.size.x, ec.size.y);
- if components.len() == 0 {
+ if components.is_empty() {
sim.destroy_entity(entity_id);
} else if components.len() == 1 {
// the entity's cells were changed, but not partitioned
@@ -193,9 +193,9 @@ pub fn read_back_entities_from_world(
.get(entity.data.rb_h.unwrap())
// correctness -- not correct! because we don't have pos without rb
.unwrap();
- let old_pose = old_rb.position().clone();
- let old_linvel = old_rb.linvel().clone();
- let old_angvel = old_rb.angvel().clone();
+ let old_pose = *old_rb.position();
+ let old_linvel = old_rb.linvel();
+ let old_angvel = old_rb.angvel();
sim.destroy_entity(entity_id);