mirror of
				https://github.com/GayPizzaSpecifications/voxelotl-engine.git
				synced 2025-11-04 10:59:39 +00:00 
			
		
		
		
	don't damage chunk if a one block change doesn't touch a solid
This commit is contained in:
		@ -36,12 +36,18 @@ public class World {
 | 
				
			|||||||
      for (i, ofs) in zip(internalPos.indices, [ SIMD3<Int>.X, .Y, .Z ]) {
 | 
					      for (i, ofs) in zip(internalPos.indices, [ SIMD3<Int>.X, .Y, .Z ]) {
 | 
				
			||||||
        if internalPos[i] == 0 {
 | 
					        if internalPos[i] == 0 {
 | 
				
			||||||
          let id = chunkID &- ofs
 | 
					          let id = chunkID &- ofs
 | 
				
			||||||
          if self._chunks.keys.contains(id) {
 | 
					          if let other = self._chunks[id],
 | 
				
			||||||
 | 
					            // optim: Damage adjacent chunk only if block is touching a solid
 | 
				
			||||||
 | 
					            case .solid = other.getBlock(internal: (internalPos &- ofs) & Chunk.mask).type
 | 
				
			||||||
 | 
					          {
 | 
				
			||||||
            self._chunkDamage.insert(id)
 | 
					            self._chunkDamage.insert(id)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        } else if internalPos[i] == Chunk.size - 1 {
 | 
					        } else if internalPos[i] == Chunk.size - 1 {
 | 
				
			||||||
          let id = chunkID &+ ofs
 | 
					          let id = chunkID &+ ofs
 | 
				
			||||||
          if self._chunks.keys.contains(id) {
 | 
					          if let other = self._chunks[id],
 | 
				
			||||||
 | 
					            // optim: Damage adjacent chunk only if block is touching a solid
 | 
				
			||||||
 | 
					            case .solid = other.getBlock(internal: (internalPos &+ ofs) & Chunk.mask).type
 | 
				
			||||||
 | 
					          {
 | 
				
			||||||
            self._chunkDamage.insert(id)
 | 
					            self._chunkDamage.insert(id)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user