-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconf.lua
42 lines (40 loc) · 1.63 KB
/
conf.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-- HACK func = int is deprecated and only kept for compatibility
local int = function(value) if value % 1 ~= 0 then return "Integer instead of float expected" end end
local pos_int = { type = "number", range = { 1 }, int = true, func = int }
local component = { type = "number", range = { 0, 255 }, int = true, func = int }
local color = { type = "table", children = {r = component, g = component, b = component} }
local node_colors = { type = "table", children = {fill = color, edge = color} }
local conf_spec = {
type = "table",
children = {
colors = {
type = "table",
children = {
cell = node_colors,
border = node_colors
}
},
max_steps = pos_int,
request_duration = pos_int,
arena_defaults = {
type = "table",
children = {
name = { type = "string" },
dimension = { type = "table", children = { x = pos_int, y = pos_int, z = pos_int } },
search_origin = { type = "table", children = { x = {type="number"}, y = {type="number"}, z = {type="number"} } },
steps = pos_int,
threshold = { type = "number", range = {0, 1} }
}
},
creative = { type = "boolean" },
speedup = { type = "boolean" },
mapcache = { type = "boolean" },
place_inside_player = { type = "boolean" }
}
}
conf = modlib.conf.import("cellestial", conf_spec)
for _, colors in pairs(conf.colors) do
for prop, color in pairs(colors) do
colors[prop] = ("#%02X%02X%02X"):format(color.r, color.g, color.b)
end
end