mirror of
https://github.com/minetest/minetest.git
synced 2025-03-06 20:48:40 +01:00
Simplify minetest.strip_param2_color
This commit is contained in:
parent
3397950a0e
commit
57ca92e0eb
1 changed files with 11 additions and 12 deletions
|
@ -166,20 +166,19 @@ function core.is_colored_paramtype(ptype)
|
|||
end
|
||||
|
||||
function core.strip_param2_color(param2, paramtype2)
|
||||
if not core.is_colored_paramtype(paramtype2) then
|
||||
if paramtype2 == "color" then
|
||||
return param2
|
||||
elseif paramtype2 == "colorfacedir" then
|
||||
return math.floor(param2 / 32) * 32
|
||||
elseif paramtype2 == "color4dir" then
|
||||
return math.floor(param2 / 4) * 4
|
||||
elseif paramtype2 == "colorwallmounted" then
|
||||
return math.floor(param2 / 8) * 8
|
||||
elseif paramtype2 == "colordegrotate" then
|
||||
return math.floor(param2 / 32) * 32
|
||||
else
|
||||
return nil
|
||||
end
|
||||
if paramtype2 == "colorfacedir" then
|
||||
param2 = math.floor(param2 / 32) * 32
|
||||
elseif paramtype2 == "color4dir" then
|
||||
param2 = math.floor(param2 / 4) * 4
|
||||
elseif paramtype2 == "colorwallmounted" then
|
||||
param2 = math.floor(param2 / 8) * 8
|
||||
elseif paramtype2 == "colordegrotate" then
|
||||
param2 = math.floor(param2 / 32) * 32
|
||||
end
|
||||
-- paramtype2 == "color" requires no modification.
|
||||
return param2
|
||||
end
|
||||
|
||||
-- Content ID caching
|
||||
|
|
Loading…
Add table
Reference in a new issue