Skip to content

Commit

Permalink
corrected color selection from painted blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sokomine committed Aug 8, 2017
1 parent 5acf71f commit 890a201
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1075,26 +1075,26 @@ colormachine.get_color_from_blockname = function( mod_name, block_name, palette_
-- palette_index seems to carry the multiplier in it
local p2 = tonumber(palette_index);
if( data.paramtype2=="colorfacedir" ) then
p2 = (p2/32) - (p2%32);
p2 = (p2 - (p2%32))/32;
elseif( data.paramtype2 == "colorwallmounted" ) then
p2 = (p2/ 8) - (p2% 8);
p2 = (p2 - (p2% 8))/ 8;
end
-- determine the (unifieddyes) name of the color the block has
for i,c in ipairs( palette ) do
if( c[5] == p2 ) then
if( c[3]==-1 ) then
for i,c_data in ipairs( palette ) do
if( c_data[5] == p2 ) then
if( c_data[3]==-1 ) then
-- compose the name
found_name = colormachine.colors[c[1] ];
local prefix = colormachine.prefixes[ (c[2]/2) - c[2]%2 ];
found_name = colormachine.colors[c_data[1] ];
local prefix = colormachine.prefixes[ math.floor( (c_data[2] - 1 )/2)+1 ];
local postfix = "";
if( c[2]%2==1 ) then
if( c_data[2]%2==0 ) then
postfix = "_s50";
end
if( found_name and prefix and postfix ) then
found_name = prefix..found_name..postfix;
end
else
found_name = colormachine.grey_names[c[3]];
found_name = colormachine.grey_names[c_data[3]];
end
end
end
Expand Down

0 comments on commit 890a201

Please sign in to comment.