dye code compacted

master
Nemo 08 2012-03-19 21:39:29 +04:00
parent e8e5dacb45
commit e3de00dbf7
1 changed files with 71 additions and 224 deletions

View File

@ -1,245 +1,92 @@
--Colors mod for RTMMP
--Public colors for mods:
DYE_COLORS = {
"white",
"light_gray",
"gray",
"black",
"red",
"orange",
"yellow",
"lime",
"green",
"light_blue",
"cyan",
"blue",
"purple",
"magenta",
"pink",
"brown",
'white',
'light_gray',
'gray',
'black',
'red',
'orange',
'yellow',
'lime',
'green',
'light_blue',
'cyan',
'blue',
'purple',
'magenta',
'pink',
'brown',
}
DYE_CRAFTS = {
['white'] = {'flowers:flower_dandelion_white'},
['black'] = {'default:scorched_stuff'},
['red'] = {'flowers:flower_rose'},
['orange'] = {'flowers:flower_tulip'},
['yellow'] = {'flowers:flower_dandelion_yellow'},
['purple'] = {'flowers:flower_viola'},
['brown 2'] = {'default:clay_brick'},
}
-- Somefunc
local cute_descr = function(str) -- ^^ nya!~~~
return(str:gsub('_',' '):gsub('^%l', string.upper))
end
-- Dyes
minetest.register_craftitem("dye:white", {
description = "White dye",
inventory_image = "dye_white.png",
})
minetest.register_craftitem("dye:light_gray", {
description = "Light gray dye",
inventory_image = "dye_light_gray.png",
})
minetest.register_craftitem("dye:gray", {
description = "Gray dye",
inventory_image = "dye_gray.png",
})
minetest.register_craftitem("dye:black", {
description = "Black dye",
inventory_image = "dye_black.png",
})
minetest.register_craftitem("dye:red", {
description = "Red dye",
inventory_image = "dye_red.png",
})
minetest.register_craftitem("dye:orange", {
description = "Orange dye",
inventory_image = "dye_orange.png",
})
minetest.register_craftitem("dye:yellow", {
description = "Yellow dye",
inventory_image = "dye_yellow.png",
})
minetest.register_craftitem("dye:lime", {
description = "Lime dye",
inventory_image = "dye_lime.png",
})
minetest.register_craftitem("dye:green", {
description = "Green dye",
inventory_image = "dye_green.png",
})
minetest.register_craftitem("dye:light_blue", {
description = "Light blue dye",
inventory_image = "dye_light_blue.png",
})
minetest.register_craftitem("dye:cyan", {
description = "Cyan dye",
inventory_image = "dye_cyan.png",
})
minetest.register_alias("dye:blue", "lazurite:lazurite")
--[[minetest.register_craftitem("dye:blue", {
description = "Blue dye",
inventory_image = "dye_blue.png",
})]]
minetest.register_craftitem("dye:purple", {
description = "Purple dye",
inventory_image = "dye_purple.png",
})
minetest.register_craftitem("dye:magenta", {
description = "Magenta dye",
inventory_image = "dye_magenta.png",
})
minetest.register_craftitem("dye:pink", {
description = "Pink dye",
inventory_image = "dye_pink.png",
})
minetest.register_craftitem("dye:brown", {
description = "Brown dye",
inventory_image = "dye_brown.png",
})
for _, color in pairs(DYE_COLORS) do
if color ~= 'blue' then
minetest.register_craftitem('dye:' .. color, {
description = cute_descr(color) .. ' dye',
inventory_image = 'dye_' .. color .. '.png',
})
end
end
minetest.register_alias('dye:blue', 'lazurite:lazurite')
--Dye recipes
local addSMrecipe = function(new, first, second)
minetest.register_craft({
output = "dye:" .. new .." 2",
recipe = {
{"dye:".. first, "dye:" .. second},
}
})
minetest.register_craft({
output = "dye:" .. new .." 2",
recipe = {
{"dye:".. second, "dye:" .. first},
}
})
minetest.register_craft({
output = "dye:" .. new .." 2",
recipe = {
{"dye:".. first},
{"dye:".. second},
}
})
minetest.register_craft({
output = "dye:" .. new .." 2",
recipe = {
{"dye:".. second},
{"dye:".. first},
}
})
minetest.register_craft({
output = "dye:" .. new .." 2",
recipe = {
{"dye:".. second,""},
{"","dye:".. first},
}
})
minetest.register_craft({
output = "dye:" .. new .." 2",
recipe = {
{"dye:".. first,""},
{"","dye:".. second},
}
})
minetest.register_craft({
output = "dye:" .. new .." 2",
recipe = {
{"","dye:".. second},
{"dye:".. first,""},
}
})
minetest.register_craft({
output = "dye:" .. new .." 2",
recipe = {
{"","dye:".. first},
{"dye:".. second,""},
}
})
local addSMrecipe = function(new, first, second)
minetest.register_craft({
type = 'shapeless',
output = 'dye:' .. new ..'',
recipe = {
'dye:' .. first,
'dye:' .. second,
},
})
end
--second
addSMrecipe("orange","red","yellow")
minetest.register_craft({
output = "dye:orange 1",
recipe = {
{"flowers:flower_tulip"},
}
})
addSMrecipe("cyan","green","blue")
addSMrecipe("purple","red","blue")
minetest.register_craft({
output = "dye:purple 1",
recipe = {
{"flowers:flower_viola"},
}
})
addSMrecipe("gray","black","white")
addSMrecipe("light_blue","white","blue")
addSMrecipe("pink","red","white")
addSMrecipe("lime","green","white")
addSMrecipe('orange','red','yellow')
addSMrecipe('cyan','green','blue')
addSMrecipe('purple','red','blue')
addSMrecipe('gray','black','white')
addSMrecipe('light_blue','white','blue')
addSMrecipe('pink','red','white')
addSMrecipe('lime','green','white')
--third
addSMrecipe("magenta","purple","pink")
addSMrecipe("light_gray","gray","white")
addSMrecipe('magenta','purple','pink')
addSMrecipe('light_gray','gray','white')
--first
for reslt, ourrecipe in pairs(DYE_CRAFTS) do
minetest.register_craft({
type = 'shapeless',
output = 'dye:' .. reslt,
recipe = ourrecipe,
})
end
--nonstandart craft
minetest.register_craft({
type = "shapeless",
output = "dye:red 1",
recipe = {
"flowers:flower_rose",
}
})
minetest.register_craft({
type = "shapeless",
output = "dye:white 1",
recipe = {
"flowers:flower_dandelion_white",
}
})
minetest.register_craft({
type = "shapeless",
output = "dye:yellow 1",
recipe = {
"flowers:flower_dandelion_yellow",
}
})
minetest.register_craft({
type = "shapeless",
type = "cooking",
output = "dye:green",
recipe = "default:cactus",
type = 'shapeless',
type = 'cooking',
output = 'dye:green',
recipe = 'default:cactus',
cooktime = 5,
})
minetest.register_craft({
type = "shapeless",
output = "dye:brown 2", -- because bric is big
recipe = {
"default:clay_brick",
}
})
minetest.register_craft({
type = "shapeless",
output = "dye:black 1",
recipe = {
"default:scorched_stuff",
}
})