mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
prob bad idea but turn liquid into blob, differentiate liquid from sand
This commit is contained in:
parent
0fc362695f
commit
ab306c6d4a
4 changed files with 14 additions and 8 deletions
|
@ -66,7 +66,7 @@ impl State {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
pub const SIZE: usize = 64;
|
||||
pub const SIZE: usize = 24;
|
||||
pub struct Blob {
|
||||
pub pos: Pos,
|
||||
pub pixels: FxHashMap<(isize, isize), Pixel>,
|
||||
|
@ -184,7 +184,7 @@ impl Blob {
|
|||
}
|
||||
|
||||
map[k][(x, y)] = match map[k][(x, y)] {
|
||||
CellType::Unknown => {
|
||||
CellType::Unknown | CellType::Liquid => {
|
||||
map[k].modified = true;
|
||||
CellType::Blob
|
||||
}
|
||||
|
@ -300,9 +300,13 @@ impl Blob {
|
|||
CellType::Other => false,
|
||||
CellType::Solid => true,
|
||||
CellType::Liquid => true,
|
||||
CellType::Sand => true,
|
||||
CellType::Physics => true,
|
||||
}
|
||||
{
|
||||
if matches!(chunk[n], CellType::Liquid) {
|
||||
self.pixels.insert(n, p);
|
||||
}
|
||||
p.pos.x = c.0 as f32 + 0.5;
|
||||
p.pos.y = c.1 as f32 + 0.5;
|
||||
if p.stop.is_none() {
|
||||
|
|
|
@ -13,6 +13,7 @@ pub enum CellType {
|
|||
Unknown,
|
||||
Solid,
|
||||
Liquid,
|
||||
Sand,
|
||||
Blob,
|
||||
Remove,
|
||||
Ignore,
|
||||
|
|
|
@ -117,7 +117,7 @@ impl ParticleWorldState {
|
|||
}
|
||||
pub fn get_cell_material_id(&self, cell: &ntypes::Cell) -> u16 {
|
||||
let offset = unsafe {
|
||||
(cell.material_ptr as *const ntypes::CellData).offset_from(self.material_list.as_ptr())
|
||||
(cell.material as *const ntypes::CellData).offset_from(self.material_list.as_ptr())
|
||||
};
|
||||
offset as u16
|
||||
}
|
||||
|
@ -132,15 +132,17 @@ impl ParticleWorldState {
|
|||
.zip(chunk.iter_mut())
|
||||
{
|
||||
*pixel = if let Some(cell) = self.get_cell_raw(shift_x + i, shift_y + j, pixel_array) {
|
||||
match cell.material_ptr.cell_type {
|
||||
match cell.material.cell_type {
|
||||
ntypes::CellType::Liquid => {
|
||||
if std::ptr::eq(cell.material_ptr, self.blob_ptr) {
|
||||
if std::ptr::eq(cell.material, self.blob_ptr) {
|
||||
modified = true;
|
||||
CellType::Remove
|
||||
} else {
|
||||
let cell: &ntypes::LiquidCell = unsafe { cell.get_liquid() };
|
||||
if cell.is_static {
|
||||
CellType::Solid
|
||||
} else if cell.cell.material.liquid_sand {
|
||||
CellType::Sand
|
||||
} else {
|
||||
CellType::Liquid
|
||||
}
|
||||
|
@ -247,7 +249,6 @@ impl ParticleWorldState {
|
|||
) {
|
||||
let full = ntypes::FullCell::from(*cell);
|
||||
noita_api::print!("{full:?}");
|
||||
noita_api::print!("{:?}", cell.material_ptr);
|
||||
} else {
|
||||
noita_api::print!("mat nil");
|
||||
}
|
||||
|
|
|
@ -692,7 +692,7 @@ pub struct Cell {
|
|||
unknown1: [isize; 2],
|
||||
pub is_burning: bool,
|
||||
unknown2: [u8; 3],
|
||||
pub material_ptr: &'static CellData,
|
||||
pub material: &'static CellData,
|
||||
}
|
||||
unsafe impl Sync for Cell {}
|
||||
unsafe impl Send for Cell {}
|
||||
|
@ -706,7 +706,7 @@ pub enum FullCell {
|
|||
}
|
||||
impl From<Cell> for FullCell {
|
||||
fn from(value: Cell) -> Self {
|
||||
if value.material_ptr.cell_type == CellType::Liquid {
|
||||
if value.material.cell_type == CellType::Liquid {
|
||||
FullCell::LiquidCell(*unsafe { value.get_liquid() })
|
||||
} else {
|
||||
FullCell::Cell(value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue