Small cleaning

This commit is contained in:
Jean-Patrick Guerrero 2021-12-21 14:04:09 +01:00
parent edf0867e6c
commit 748cc9a7a1

View File

@ -234,14 +234,14 @@ local function get_isometric_view(fs, pos, X, Y, t, cubes, depth, high)
local width = 8 local width = 8
local base_height = 4 local base_height = 4
local base_depth = depth == -1 local base_depth = depth == -1
local max_depth = -10 local max_depth = -7
local height = base_depth and (base_height - 1) or depth local height = base_depth and (base_height - 1) or depth
local pos1 = vec_new(pos.x - width, pos.y + depth, pos.z - width) local pos1 = vec_new(pos.x - width, pos.y + depth, pos.z - width)
local pos2 = vec_new(pos.x + width, pos.y + height, pos.z + width) local pos2 = vec_new(pos.x + width, pos.y + height, pos.z + width)
local vm = VoxelManip(pos1, pos2) local vm = VoxelManip(pos1, pos2)
local emin, emax = vm:read_from_map(pos1, pos2) local emin, emax = vm:get_emerged_area()
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax} local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
local data = vm:get_data() local data = vm:get_data()
@ -276,8 +276,9 @@ local function get_isometric_view(fs, pos, X, Y, t, cubes, depth, high)
if cubes < maxc and depth > max_depth then if cubes < maxc and depth > max_depth then
-- if there's not enough map to preview, go deeper -- if there's not enough map to preview, go deeper
depth -= 1 depth -= 1
get_isometric_view(fs, pos, X, Y, t, cubes, depth, high) return get_isometric_view(fs, pos, X, Y, t, cubes, depth, high)
else end
local shift = -0.3 - high local shift = -0.3 - high
for i = max_depth, 0 do for i = max_depth, 0 do
@ -295,7 +296,6 @@ local function get_isometric_view(fs, pos, X, Y, t, cubes, depth, high)
shift += (base_depth and 0.45 or 0.95) shift += (base_depth and 0.45 or 0.95)
fs("image", 2.7, Y + shift, 0.3, 0.3, PNG.flag) fs("image", 2.7, Y + shift, 0.3, 0.3, PNG.flag)
end end
end
local function get_waypoint_fs(fs, data, player, yextra, ctn_len) local function get_waypoint_fs(fs, data, player, yextra, ctn_len)
fs(fmt("box[0,%f;4.9,0.6;#bababa25]", yextra + 1.1)) fs(fmt("box[0,%f;4.9,0.6;#bababa25]", yextra + 1.1))
@ -1093,8 +1093,7 @@ local function get_model_fs(fs, data, def, model_alias)
hex = "0" .. hex hex = "0" .. hex
end end
_name = fmt("%s^[multiply:%s", v.name, _name = fmt("%s^[multiply:%s", v.name, fmt("#%s%s", sub(hex, 3), sub(hex, 1, 2)))
fmt("#%s%s", sub(hex, 3), sub(hex, 1, 2)))
else else
_name = fmt("%s^[multiply:%s", v.name, v.color) _name = fmt("%s^[multiply:%s", v.name, v.color)
end end