Make sure solids aren't "synced" to be air

This commit is contained in:
IQuant 2024-05-13 17:36:48 +03:00
parent 75887e58d3
commit c98a74dc17

View file

@ -190,10 +190,15 @@ function world.decode(grid_world, header, pixel_runs)
while x < bottom_right_x do while x < bottom_right_x do
if world_ffi.chunk_loaded(chunk_map, x, y) then if world_ffi.chunk_loaded(chunk_map, x, y) then
local ppixel = world_ffi.get_cell(chunk_map, x, y) local ppixel = world_ffi.get_cell(chunk_map, x, y)
local current_material = 0 local current_material = 0
if ppixel[0] ~= nil then if ppixel[0] ~= nil then
local pixel = ppixel[0] local pixel = ppixel[0]
local cell_type = pixel.vtable.get_cell_type(pixel)
if cell_type == C.CELL_TYPE_SOLID then
goto skip_set
end
current_material = world_ffi.get_material_id(pixel.vtable.get_material(pixel)) current_material = world_ffi.get_material_id(pixel.vtable.get_material(pixel))
if new_material ~= current_material then if new_material ~= current_material then
@ -214,6 +219,8 @@ function world.decode(grid_world, header, pixel_runs)
end end
end end
::skip_set::
left = left - 1 left = left - 1
if left <= 0 then if left <= 0 then
current_run_ix = current_run_ix + 1 current_run_ix = current_run_ix + 1