adding block-colors module

This commit is contained in:
walterhiggins 2015-05-24 12:18:00 +01:00
parent 4a2ea3c26a
commit 734e058e9a
3 changed files with 29 additions and 19 deletions

View File

@ -0,0 +1,19 @@
var colors = {
white: 0,
orange: 1,
magenta: 2,
lightblue: 3,
yellow: 4,
lime: 5,
pink: 6,
gray: 7,
lightgray: 8,
cyan: 9,
purple: 10,
blue: 11,
brown: 12,
green: 13,
red: 14,
black: 15
};
module.exports = colors;

View File

@ -128,10 +128,15 @@ function applyFacing( block, metadata ){
function applyColors( block, metadata ){
switch( block.typeId){
case blocks.wool.white:
case 35:
case blocks.stained_clay.white:
case 159:
case blocks.stained_glass.white:
case 95:
case blocks.stained_glass_pane.white:
case 160:
case blocks.carpet.white:
case 171:
property(block).set('color',metadata);
}
}

View File

@ -20,6 +20,8 @@ approximations).
The blocks module is globally exported by the Drone module.
***/
var colors = require('./block-colors');
var blocks = {
air: 0,
stone: 1,
@ -291,23 +293,6 @@ var blocks = {
// Add all available colors to colorized block collections
var colors = {
orange: ':1',
magenta: ':2',
lightblue: ':3',
yellow: ':4',
lime: ':5',
pink: ':6',
gray: ':7',
lightgray: ':8',
cyan: ':9',
purple: ':10',
blue: ':11',
brown: ':12',
green: ':13',
red: ':14',
black: ':15'
};
var colorized_blocks = [
'wool',
'stained_clay',
@ -321,7 +306,7 @@ for (var i = 0, len = colorized_blocks.length; i < len; i++) {
data_value = blocks[block].white;
for (var color in colors) {
blocks[block][color] = data_value + colors[color];
blocks[block][color] = data_value + ':' + colors[color];
}
};
@ -338,6 +323,7 @@ blocks.rainbow = [
blocks.stained_glass.lime,
blocks.stained_glass.lightblue,
blocks.stained_glass.blue,
blocks.stained_glass.purple];
blocks.stained_glass.purple
];
module.exports = blocks;