Colored vents
99
colorizer.js
@ -8,7 +8,10 @@ const child_process = require('child_process')
|
||||
const args = process.argv.slice(2)
|
||||
|
||||
if (args.length == 0) {
|
||||
console.error('No texture(s) names specified.')
|
||||
console.error('No texture(s) names specified. Valid arguments are: <texture> [mask over]')
|
||||
process.exit(2)
|
||||
} else if (args.length > 2) {
|
||||
console.error('Too many textures specified! Valid arguments are: <texture> [mask over]')
|
||||
process.exit(2)
|
||||
}
|
||||
|
||||
@ -33,23 +36,10 @@ const colors = [
|
||||
process.stderr.setMaxListeners(40)
|
||||
process.stdout.setMaxListeners(40)
|
||||
|
||||
for (const texture of args) {
|
||||
if (!fs.existsSync(`${root_main}${texture}.png`)) {
|
||||
process.stderr.write(`${texture}.png does not exist\n`)
|
||||
continue
|
||||
}
|
||||
|
||||
const splitted = texture.split('/')
|
||||
const last = splitted.pop()
|
||||
const combined = splitted.join('/')
|
||||
|
||||
const basedir = `${root_main}${combined}`
|
||||
|
||||
for (const color of colors) {
|
||||
(async function() {
|
||||
async function size(path) {
|
||||
const identify = child_process.spawn('magick', [
|
||||
'identify',
|
||||
`${root_main}${texture}.png`,
|
||||
path,
|
||||
])
|
||||
|
||||
identify.stderr.pipe(process.stderr)
|
||||
@ -66,6 +56,26 @@ for (const texture of args) {
|
||||
const width = parseInt(size[1])
|
||||
const height = parseInt(size[2])
|
||||
|
||||
return [width, height]
|
||||
}
|
||||
|
||||
(async function() {
|
||||
if (args.length == 1) {
|
||||
const texture = args[1]
|
||||
|
||||
if (!fs.existsSync(`${root_main}${texture}.png`)) {
|
||||
process.stderr.write(`${texture}.png does not exist\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const splitted = texture.split('/')
|
||||
const last = splitted.pop()
|
||||
const combined = splitted.join('/')
|
||||
|
||||
const basedir = `${root_main}${combined}`
|
||||
const [width, height] = await size(`${root_main}${texture}.png`)
|
||||
|
||||
for (const color of colors) {
|
||||
const name = color[0]
|
||||
const rgb = color[1]
|
||||
const magick = child_process.spawn('magick', [
|
||||
@ -75,11 +85,62 @@ for (const texture of args) {
|
||||
`xc:rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`,
|
||||
'-compose', 'Multiply',
|
||||
'-composite',
|
||||
//'-layers', 'merge',
|
||||
`${basedir}/${last.replace(/_colorless/, '').replace(/_white/, '')}_${name}.png`])
|
||||
|
||||
magick.stdout.pipe(process.stdout)
|
||||
magick.stderr.pipe(process.stderr)
|
||||
})()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const textureColor = args[0]
|
||||
const textureOverlay = args[1]
|
||||
|
||||
if (!fs.existsSync(`${root_main}${textureColor}.png`)) {
|
||||
process.stderr.write(`${textureColor}.png does not exist\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(`${root_main}${textureOverlay}.png`)) {
|
||||
process.stderr.write(`${textureOverlay}.png does not exist\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const splitted = textureColor.split('/')
|
||||
const last = splitted.pop()
|
||||
const combined = splitted.join('/')
|
||||
|
||||
const basedir = `${root_main}${combined}`
|
||||
|
||||
const [widthOverlay, heightOverlay] = await size(`${root_main}${textureOverlay}.png`)
|
||||
const [width, height] = await size(`${root_main}${textureColor}.png`)
|
||||
|
||||
if (widthOverlay != width || heightOverlay != height) {
|
||||
process.stderr.write(`${textureColor}.png has size of ${width}x${height}, overlay has size of ${widthOverlay}x${heightOverlay}!\n`)
|
||||
process.exit(3)
|
||||
}
|
||||
|
||||
for (const color of colors) {
|
||||
const name = color[0]
|
||||
const rgb = color[1]
|
||||
const magick = child_process.spawn('magick', [
|
||||
'convert',
|
||||
|
||||
'(',
|
||||
`${root_main}${textureColor}.png`,
|
||||
'-size', `${width}x${height}`,
|
||||
`xc:rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`,
|
||||
'-compose', 'Multiply',
|
||||
'-composite',
|
||||
')',
|
||||
|
||||
`${root_main}${textureOverlay}.png`,
|
||||
|
||||
'-compose', 'Over',
|
||||
'-composite',
|
||||
|
||||
`${basedir}/${last.replace(/_colorless/, '').replace(/_white/, '')}_${name}.png`])
|
||||
|
||||
magick.stdout.pipe(process.stdout)
|
||||
magick.stderr.pipe(process.stderr)
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
@ -149,6 +149,8 @@ object DataGen {
|
||||
|
||||
decoratives(MRegistry.TRITANIUM_BLOCK)
|
||||
decoratives(MRegistry.FLOOR_TILES)
|
||||
decoratives(MRegistry.VENT)
|
||||
decoratives(MRegistry.VENT_ALTERNATIVE)
|
||||
|
||||
for (glass in MBlocks.INDUSTRIAL_GLASS_LIST) {
|
||||
decorativeCubeAll(glass)
|
||||
|
@ -123,20 +123,22 @@ object MBlocks {
|
||||
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
|
||||
.sound(SoundType.BASALT)
|
||||
.requiresCorrectToolForDrops()
|
||||
.explosionResistance(80f)
|
||||
.strength(4f)
|
||||
.explosionResistance(20f)
|
||||
.strength(1.5f)
|
||||
) }
|
||||
|
||||
val VENT_ALTERNATIVE: Block by registry.register(MNames.VENT_ALTERNATIVE) { Block(
|
||||
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
|
||||
.sound(SoundType.BASALT)
|
||||
.requiresCorrectToolForDrops()
|
||||
.explosionResistance(80f)
|
||||
.strength(4f)
|
||||
.explosionResistance(20f)
|
||||
.strength(1.5f)
|
||||
) }
|
||||
|
||||
init {
|
||||
MRegistry.FLOOR_TILES.registerBlocks(registry)
|
||||
MRegistry.VENT.registerBlocks(registry)
|
||||
MRegistry.VENT_ALTERNATIVE.registerBlocks(registry)
|
||||
}
|
||||
|
||||
val CARGO_CRATE: Block by registry.register(MNames.CARGO_CRATE) { CargoCrateBlock(null) }
|
||||
|
@ -308,6 +308,8 @@ object MItems {
|
||||
|
||||
init {
|
||||
MRegistry.FLOOR_TILES.registerItems(registry)
|
||||
MRegistry.VENT.registerItems(registry)
|
||||
MRegistry.VENT_ALTERNATIVE.registerItems(registry)
|
||||
}
|
||||
|
||||
val INDUSTRIAL_GLASS: Item by registry.register(MRegistry.INDUSTRIAL_GLASS.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS, DEFAULT_PROPERTIES_DECORATIVE) }
|
||||
|
@ -271,6 +271,22 @@ object MRegistry {
|
||||
.strength(4f)
|
||||
}
|
||||
|
||||
val VENT = ColoredDecorativeBlock(MNames.VENT) {
|
||||
BlockBehaviour.Properties.of(Material.METAL, it.materialColor)
|
||||
.sound(SoundType.BASALT)
|
||||
.requiresCorrectToolForDrops()
|
||||
.explosionResistance(20f)
|
||||
.strength(1.5f)
|
||||
}
|
||||
|
||||
val VENT_ALTERNATIVE = ColoredDecorativeBlock(MNames.VENT_ALTERNATIVE) {
|
||||
BlockBehaviour.Properties.of(Material.METAL, it.materialColor)
|
||||
.sound(SoundType.BASALT)
|
||||
.requiresCorrectToolForDrops()
|
||||
.explosionResistance(20f)
|
||||
.strength(1.5f)
|
||||
}
|
||||
|
||||
val FLOOR_TILES = ColoredDecorativeBlock(MNames.FLOOR_TILES) {
|
||||
BlockBehaviour.Properties.of(Material.STONE, it.materialColor)
|
||||
.sound(SoundType.STONE)
|
||||
|
After Width: | Height: | Size: 499 B |
After Width: | Height: | Size: 591 B |
After Width: | Height: | Size: 580 B |
After Width: | Height: | Size: 601 B |
After Width: | Height: | Size: 573 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 592 B |
After Width: | Height: | Size: 611 B |
After Width: | Height: | Size: 615 B |
After Width: | Height: | Size: 621 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 606 B |
After Width: | Height: | Size: 584 B |
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 468 B |
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 581 B |
After Width: | Height: | Size: 645 B |
After Width: | Height: | Size: 635 B |
After Width: | Height: | Size: 654 B |
After Width: | Height: | Size: 631 B |
After Width: | Height: | Size: 628 B |
After Width: | Height: | Size: 671 B |
After Width: | Height: | Size: 651 B |
After Width: | Height: | Size: 658 B |
After Width: | Height: | Size: 664 B |
After Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
After Width: | Height: | Size: 671 B |
After Width: | Height: | Size: 660 B |
After Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 520 B |
After Width: | Height: | Size: 671 B |