fix: remove_floor clears only stand_on_floor, not stand_in_floor
Clearing stand_in_floor when removing a floor tile made the dug position impassable. An entity falling into the dug slot found (false || false) && true = false and kept falling. Now only stand_on_floor is cleared — the space reverts to air (passable), and only the tile above loses its platform.
This commit is contained in:
@@ -316,7 +316,11 @@ impl TileMap {
|
||||
let idx = ChunkData::pos_to_index(lx, ly, z);
|
||||
let word = idx / 32;
|
||||
let clear_mask = !(1u32 << (idx % 32));
|
||||
chunk.stand_in_floor[word] &= clear_mask;
|
||||
// Only clear stand_on_floor. Removing a floor tile means the space becomes
|
||||
// air — stand_in_floor should stay true so entities can pass through.
|
||||
// Only stand_on_floor needs clearing: the tile above can no longer stand on
|
||||
// a tile that doesn't exist. Clearing stand_in_floor made dug positions
|
||||
// impassable, causing entities to fall through multiple levels.
|
||||
chunk.stand_on_floor[word] &= clear_mask;
|
||||
chunk.tile_ids[idx] = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user