Skip to content
Snippets Groups Projects

fix: upper layers not working (probably)

Open codecraft requested to merge codecraft/ledtree:main into main
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
+ 10
8
-- NUR DURCH 4 TEILBARE ZAHLEN > 20 VERWENDEN!!!
local leds = {
64,
56,
48,
40,
36,
32,
28,
24,
20,
16,
12,
8,
4
}
for i = 1, #leds do
if leds[i] % 4 ~= 0 then
error("[ledtree] led count per layer must be divisible by 4. Error location: 'leds' table, item "..i..": "..leds[i])
end
if leds[i] < 20 then
error("[ledtree] led count per layer must be greater than or qual to 20. Error location: 'leds' table, item "..i..": "..leds[i])
end
end
local height_increment = 3
@@ -38,7 +40,7 @@ local function place_layer(center, breite)
breite = breite * 2 + 1
local needles = {}
local leds = {}
local max_offset = math.floor(breite / 2)
local max_offset = (breite - 1) / 2
for y = math.ceil(-height_increment / 2), math.floor(height_increment / 2) do
for x = -max_offset, max_offset do
for z = -max_offset, max_offset do
@@ -63,7 +65,7 @@ local function place_leds(led_index, leds)
end
local function place_tree(pos)
local led_index = 0
local led_index = 300 - 200
for index = 1, #leds do
local l = leds[index]
local layer_center = vector.new(pos.x, pos.y + index * height_increment - height_increment / 2, pos.z)
Loading