Skip to content

Commit

Permalink
Somewhat more readable code
Browse files Browse the repository at this point in the history
  • Loading branch information
Konfuz committed Oct 10, 2020
1 parent 84e7449 commit aa2d114
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,28 @@ function any_color.add_default_palette(nodename, override)
local meta = minetest.registered_nodes[nodename]
if (meta == nil) or (meta.palette ~= nil) then return false end

-- use given override otherwise choose own param
or_param2 = override.paramtype2 == nil
or_palette = override.palette == nil
if meta.paramtype2 == "none" then
if override.paramtype2 == nil then
if or_param2 then
override.paramtype2 = "color"
end
if override.palette == nil then
if or_palette then
override.palette = any_color.config.default_palette_256
end
elseif meta.paramtype2 == "wallmounted" then
if override.paramtype2 == nil then
if or_param2 then
override.paramtype2 = "colorwallmounted"
end
if override.palette == nil then
if or_palette then
override.palette = any_color.config.default_palette_32
end
elseif meta.paramtype2 == "facedir" then
if override.paramtype2 == nil then
if or_param2 then
override.paramtype2 = "colorfacedir"
end
if override.palette == nil then
if or_palette then
override.palette = any_color.config.default_palette_8
end
else
Expand Down

0 comments on commit aa2d114

Please sign in to comment.