summaryrefslogtreecommitdiff
path: root/src/sim/sim_manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/sim_manager')
-rw-r--r--src/sim/sim_manager/utils.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sim/sim_manager/utils.rs b/src/sim/sim_manager/utils.rs
index 75ef71d..d744ec0 100644
--- a/src/sim/sim_manager/utils.rs
+++ b/src/sim/sim_manager/utils.rs
@@ -117,7 +117,7 @@ pub fn read_back_entities_from_world(
for (lx, ly, x, y) in cells_written {
// update the entity
// TODO optimize
- let new_local_cell = sim.cell_manager.get_cell_from_game_position(x, y).unwrap();
+ let mut new_local_cell = sim.cell_manager.get_cell_from_game_position(x, y).unwrap();
if !new_local_cell.entity_integrated() {
// this means that the entity changed in some way, so we should recompute its shape
// TODO wait N frames to debounce this
@@ -127,6 +127,7 @@ pub fn read_back_entities_from_world(
let entity_cells = entity.data.cells.as_mut().unwrap();
// we do this unconditionally because it's cheaper than checking if it actually needs to be updated
// and because we don't have a good way to track changes to cell state
+ new_local_cell.set_entity_integrated(true);
entity_cells
.set_cell_at_local_position(IVec2::new(lx as i32, ly as i32), new_local_cell);
}