Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Luanti LED Tree
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tuxilio
Luanti LED Tree
Commits
29022013
Verified
Commit
29022013
authored
3 months ago
by
codecraft
Committed by
Tuxilio
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
rework placment logic
parent
605ad852
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tree.lua
+18
-8
18 additions, 8 deletions
tree.lua
with
18 additions
and
8 deletions
tree.lua
+
18
−
8
View file @
29022013
-- NUR DURCH 4 TEILBARE ZAHLEN > 20 VERWENDEN!!!
local
leds
=
{
32
,
28
,
16
,
8
,
4
,
64
,
56
,
48
,
36
,
20
,
}
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
local
function
breite
(
n
)
...
...
@@ -28,13 +38,13 @@ local function place_layer(center, breite)
breite
=
breite
*
2
+
1
local
needles
=
{}
local
leds
=
{}
local
max_offset
=
math.
ceil
(
breite
/
2
)
for
y
=
-
height_increment
/
2
,
height_increment
/
2
do
local
max_offset
=
math.
floor
(
breite
/
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
local
pos
=
vector
.
new
({
x
=
center
.
x
+
x
,
y
=
center
.
y
+
y
,
z
=
center
.
z
+
z
})
table.insert
(
needles
,
pos
)
if
is_led
(
center
,
breite
,
pos
)
then
if
y
==
0
and
is_led
(
center
,
breite
,
pos
)
then
table.insert
(
leds
,
pos
)
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment