summaryrefslogtreecommitdiff
path: root/src/sim/cell
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2026-08-23 02:48:43 -0700
committerKai Stevenson <kai@kaistevenson.com>2026-08-23 02:48:43 -0700
commit80824a8b69b70e6e40577e4f0236c28c4ad5c15b (patch)
treebf3b72331c4ed9195bbe72d25d5e82c076d3220a /src/sim/cell
parentd6664b9b5a9a3aab500b547e4d7448a8bc4ad416 (diff)
explosions affect rigidbodies, use "world" for rapier
Diffstat (limited to 'src/sim/cell')
-rw-r--r--src/sim/cell/cell.rs87
-rw-r--r--src/sim/cell/mod.rs1
2 files changed, 0 insertions, 88 deletions
diff --git a/src/sim/cell/cell.rs b/src/sim/cell/cell.rs
deleted file mode 100644
index 5a9fc1f..0000000
--- a/src/sim/cell/cell.rs
+++ /dev/null
@@ -1,87 +0,0 @@
-use crate::{config::SETTLED_THRESOHLD, content::materials::MaterialId};
-
-#[derive(Clone, Copy)]
-pub struct Cell {
- pub material: MaterialId,
- pub flags: u8,
- pub data: u16,
-}
-
-impl Cell {
- // only update the cell if this matches the parity of the seqno
- const FLAG_PARITY: u8 = 0b0000_0001;
- // is this cell owned by an entity?
- const FLAG_ENTITY_INTEGRATED: u8 = 0b0000_0010;
- // how close is the cell to settling?
- const MASK_SETTLED: u8 = 0b0001_1100;
-
- #[inline]
- pub fn parity(self) -> u8 {
- self.flags & Self::FLAG_PARITY
- }
- #[inline]
- pub fn flip_parity(&mut self) {
- self.flags ^= Self::FLAG_PARITY;
- }
- #[inline]
- pub fn match_parity(&mut self, seqno: u64) {
- let parity = !seqno.is_multiple_of(2);
- if parity {
- self.flags |= Self::FLAG_PARITY;
- } else {
- self.flags &= !Self::FLAG_PARITY
- }
- }
-
- #[inline]
- pub fn entity_integrated(self) -> bool {
- (self.flags & Self::FLAG_ENTITY_INTEGRATED) == Self::FLAG_ENTITY_INTEGRATED
- }
- #[inline]
- pub fn set_entity_integrated(&mut self, entity_integrated: bool) {
- if entity_integrated {
- self.flags |= Self::FLAG_ENTITY_INTEGRATED
- } else {
- self.flags &= !Self::FLAG_ENTITY_INTEGRATED
- }
- }
-
- #[inline]
- pub fn settled(self) -> u8 {
- (self.flags & Self::MASK_SETTLED) >> 2
- }
- #[inline]
- fn set_settled(&mut self, settled: u8) {
- debug_assert!(settled <= 7);
- self.flags = (settled << 2) | (self.flags & !Self::MASK_SETTLED);
- }
- #[inline]
- pub fn reset_settled(&mut self) {
- self.flags &= !Self::MASK_SETTLED;
- }
-
- #[inline]
- pub fn increment_settled(&mut self) {
- let s = self.settled();
- if s < SETTLED_THRESOHLD {
- self.set_settled(s + 1);
- }
- }
-}
-
-impl Cell {
- pub fn void() -> Cell {
- Cell {
- material: MaterialId::Void,
- flags: 0,
- data: 0,
- }
- }
- pub fn from_material(material: MaterialId) -> Cell {
- Cell {
- material,
- flags: 0,
- data: 0,
- }
- }
-}
diff --git a/src/sim/cell/mod.rs b/src/sim/cell/mod.rs
deleted file mode 100644
index 48433da..0000000
--- a/src/sim/cell/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub mod cell;