30 lines
801 B
Lua
30 lines
801 B
Lua
-- LUALOCALS < ---------------------------------------------------------
|
|
local nodecore, pairs, type
|
|
= nodecore, pairs, type
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
local function scantbl(t, adjto)
|
|
local u = {}
|
|
for k, v in pairs(t) do
|
|
if v == 0.5 then
|
|
u[k] = adjto
|
|
elseif v == -0.5 then
|
|
u[k] = -adjto
|
|
elseif type(v) == "table" then
|
|
u[k] = scantbl(v, adjto)
|
|
else
|
|
u[k] = v
|
|
end
|
|
end
|
|
return u
|
|
end
|
|
|
|
nodecore.register_on_register_item(function(_, def)
|
|
if def.type ~= "node" then return end
|
|
if def.node_box and def.node_box.fixed then
|
|
def.collision_box = def.collision_box or def.node_box
|
|
def.selection_box = def.selection_box or def.node_box
|
|
def.node_box = scantbl(def.node_box, def.z_fight_win and 129/256 or 127/256)
|
|
end
|
|
end)
|