summaryrefslogtreecommitdiff
path: root/src/sim/entity
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2026-08-23 11:25:20 -0700
committerKai Stevenson <kai@kaistevenson.com>2026-08-23 11:25:20 -0700
commit5f137b41ebeadfca3907221713f85f2c9fe431bf (patch)
tree80e271c7ad5fd074f27b33dcdcdafafc391d2d13 /src/sim/entity
parent80824a8b69b70e6e40577e4f0236c28c4ad5c15b (diff)
entityID newtype
Diffstat (limited to 'src/sim/entity')
-rw-r--r--src/sim/entity/mod.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/sim/entity/mod.rs b/src/sim/entity/mod.rs
index 0d8ae71..044d07c 100644
--- a/src/sim/entity/mod.rs
+++ b/src/sim/entity/mod.rs
@@ -89,20 +89,23 @@ impl EntityDef {
}
}
+#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
+pub struct EntityId(pub u32);
+
pub struct EntityData {
- pub id: u32,
+ pub id: EntityId,
pub rb_h: Option<RigidBodyHandle>,
pub collider_h: Option<ColliderHandle>,
pub cells: Option<EntityCells>,
}
pub struct EntityUpdateResult {
- pub deferred_destructions: Vec<u32>,
+ pub deferred_destructions: Vec<EntityId>,
}
pub struct EntityUpdateCtx<'a> {
pub entity_data: &'a mut EntityData,
- deferred_destructions: Vec<u32>,
+ deferred_destructions: Vec<EntityId>,
}
impl<'a> EntityUpdateCtx<'a> {
@@ -112,7 +115,7 @@ impl<'a> EntityUpdateCtx<'a> {
deferred_destructions: Vec::new(),
}
}
- pub fn deferred_destroy(&mut self, entity_id: u32) {
+ pub fn deferred_destroy(&mut self, entity_id: EntityId) {
self.deferred_destructions.push(entity_id);
}
pub fn to_result(self) -> EntityUpdateResult {
@@ -177,7 +180,7 @@ impl Entity {
}
pub fn new(
- id: u32,
+ id: EntityId,
rb_h: Option<RigidBodyHandle>,
collider_h: Option<ColliderHandle>,
cells: Option<EntityCells>,