Skip to content

Commit b599d84

Browse files
committed
Fix overwriting
1 parent e9f6c5d commit b599d84

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

places/test_plugin_place.rbxl

1.13 KB
Binary file not shown.

src/TerrainConverter.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function TerrainConverter:_getOverwriteMaterials()
8787
materials[item.enum] = true
8888
end
8989

90-
-- don't remove air, it shouldn't matter
90+
-- don't remove air, it shouldn't matter, keeps things converting nicely
9191
-- materials[Enum.Material.Air] = nil
9292
else
9393
materials[Enum.Material.Air] = true
@@ -108,8 +108,7 @@ function TerrainConverter:_fillBlock(blockCFrame, blockSize, desiredMaterial)
108108
warn("[TerrainConverter] - Doing nothing -- OverwriteWater and OverwriteTerrain are both disabled")
109109
return
110110
end
111-
if (self.OverwriteTerrain.Value and self.OverwriteWater.Value)
112-
or (desiredMaterial == Enum.Material.Air and self.OverwriteWater.Value) then
111+
if (self.OverwriteTerrain.Value and self.OverwriteWater.Value) then
113112
workspace.Terrain:FillBlock(blockCFrame, blockSize, desiredMaterial)
114113
return
115114
end
@@ -180,7 +179,7 @@ function TerrainConverter:_fillBlock(blockCFrame, blockSize, desiredMaterial)
180179
occupancyVoxels[x][y][z] = 1
181180
end
182181
else
183-
if brushOccupancy > cellOccupancy then
182+
if brushOccupancy > cellOccupancy and overwriteMaterials[cellMaterial] then
184183
occupancyVoxels[x][y][z] = brushOccupancy
185184
end
186185
if brushOccupancy >= 0.1 and overwriteMaterials[cellMaterial] then
@@ -200,8 +199,7 @@ function TerrainConverter:_fillBall(center, radius, desiredMaterial)
200199
return
201200
end
202201

203-
if (self.OverwriteTerrain.Value and self.OverwriteWater.Value)
204-
or (desiredMaterial == Enum.Material.Air and self.OverwriteWater.Value) then
202+
if (self.OverwriteTerrain.Value and self.OverwriteWater.Value) then
205203
workspace.Terrain:FillBall(center, radius, desiredMaterial)
206204
return
207205
end
@@ -241,7 +239,7 @@ function TerrainConverter:_fillBall(center, radius, desiredMaterial)
241239
occupancyVoxels[x][y][z] = 1
242240
end
243241
else
244-
if brushOccupancy > cellOccupancy then
242+
if brushOccupancy > cellOccupancy and overwriteMaterials[cellMaterial] then
245243
occupancyVoxels[x][y][z] = brushOccupancy
246244
end
247245
if brushOccupancy >= 0.5 and overwriteMaterials[cellMaterial] then

0 commit comments

Comments
 (0)