update core mods
Before Width: | Height: | Size: 188 B |
|
@ -0,0 +1,15 @@
|
|||
Minetest 0.4 mod: dye
|
||||
======================
|
||||
|
||||
See init.lua for documentation.
|
||||
|
||||
License of source code and media files:
|
||||
---------------------------------------
|
||||
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
default
|
||||
flowers
|
||||
lazurite
|
|
@ -1,163 +1,134 @@
|
|||
--Colors mod for RTMMP
|
||||
-- minetest/dye/init.lua
|
||||
|
||||
-- To make recipes that will work with any dye ever made by anybody, define
|
||||
-- them based on groups.
|
||||
-- You can select any group of groups, based on your need for amount of colors.
|
||||
-- basecolor: 9, excolor: 17, unicolor: 89
|
||||
--
|
||||
-- Example of one shapeless recipe using a color group:
|
||||
-- Note: As this uses basecolor_*, you'd need 9 of these.
|
||||
-- minetest.register_craft({
|
||||
-- type = "shapeless",
|
||||
-- output = '<mod>:item_yellow',
|
||||
-- recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
|
||||
-- })
|
||||
|
||||
-- Dye table for public funcs
|
||||
dye = {}
|
||||
-- Other mods can use these for looping through available colors
|
||||
local dye = {}
|
||||
dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"}
|
||||
dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"}
|
||||
|
||||
dye.add_dye_recipe = function(new, first, second)
|
||||
minetest.register_craft({
|
||||
output = new,
|
||||
recipe = {
|
||||
{first, "dye:" .. second},
|
||||
}
|
||||
})
|
||||
-- Base color groups:
|
||||
-- - basecolor_white
|
||||
-- - basecolor_grey
|
||||
-- - basecolor_black
|
||||
-- - basecolor_red
|
||||
-- - basecolor_yellow
|
||||
-- - basecolor_green
|
||||
-- - basecolor_cyan
|
||||
-- - basecolor_blue
|
||||
-- - basecolor_magenta
|
||||
|
||||
minetest.register_craft({
|
||||
output = new,
|
||||
recipe = {
|
||||
{"dye:".. second, "dye:" .. first},
|
||||
}
|
||||
})
|
||||
-- Extended color groups (* = equal to a base color):
|
||||
-- * excolor_white
|
||||
-- - excolor_lightgrey
|
||||
-- * excolor_grey
|
||||
-- - excolor_darkgrey
|
||||
-- * excolor_black
|
||||
-- * excolor_red
|
||||
-- - excolor_orange
|
||||
-- * excolor_yellow
|
||||
-- - excolor_lime
|
||||
-- * excolor_green
|
||||
-- - excolor_aqua
|
||||
-- * excolor_cyan
|
||||
-- - excolor_sky_blue
|
||||
-- * excolor_blue
|
||||
-- - excolor_violet
|
||||
-- * excolor_magenta
|
||||
-- - excolor_red_violet
|
||||
|
||||
minetest.register_craft({
|
||||
output = new,
|
||||
recipe = {
|
||||
{first},
|
||||
{"dye:".. second},
|
||||
}
|
||||
})
|
||||
-- The whole unifieddyes palette as groups:
|
||||
-- - unicolor_<excolor>
|
||||
-- For the following, no white/grey/black is allowed:
|
||||
-- - unicolor_medium_<excolor>
|
||||
-- - unicolor_dark_<excolor>
|
||||
-- - unicolor_light_<excolor>
|
||||
-- - unicolor_<excolor>_s50
|
||||
-- - unicolor_medium_<excolor>_s50
|
||||
-- - unicolor_dark_<excolor>_s50
|
||||
|
||||
minetest.register_craft({
|
||||
output = new,
|
||||
recipe = {
|
||||
{"dye:".. second},
|
||||
{first},
|
||||
}
|
||||
})
|
||||
-- Local stuff
|
||||
local dyelocal = {}
|
||||
|
||||
minetest.register_craft({
|
||||
output = new,
|
||||
recipe = {
|
||||
{"dye:".. second,""},
|
||||
{"",first},
|
||||
}
|
||||
})
|
||||
-- This collection of colors is partly a historic thing, partly something else.
|
||||
dyelocal.dyes = {
|
||||
{"white", "White dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}},
|
||||
{"grey", "Grey dye", {dye=1, basecolor_grey=1, excolor_grey=1, unicolor_grey=1}},
|
||||
{"dark_grey", "Dark grey dye", {dye=1, basecolor_grey=1, excolor_darkgrey=1, unicolor_darkgrey=1}},
|
||||
{"black", "Black dye", {dye=1, basecolor_black=1, excolor_black=1, unicolor_black=1}},
|
||||
{"violet", "Violet dye", {dye=1, basecolor_magenta=1, excolor_violet=1, unicolor_violet=1}},
|
||||
{"blue", "Blue dye", {dye=1, basecolor_blue=1, excolor_blue=1, unicolor_blue=1}},
|
||||
{"cyan", "Cyan dye", {dye=1, basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}},
|
||||
{"dark_green", "Dark green dye",{dye=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}},
|
||||
{"green", "Green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_green=1}},
|
||||
{"yellow", "Yellow dye", {dye=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}},
|
||||
{"brown", "Brown dye", {dye=1, basecolor_yellow=1, excolor_orange=1, unicolor_dark_orange=1}},
|
||||
{"orange", "Orange dye", {dye=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}},
|
||||
{"red", "Red dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_red=1}},
|
||||
{"magenta", "Magenta dye", {dye=1, basecolor_magenta=1, excolor_red_violet=1,unicolor_red_violet=1}},
|
||||
{"pink", "Pink dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_light_red=1}},
|
||||
}
|
||||
|
||||
minetest.register_craft({
|
||||
output = new,
|
||||
recipe = {
|
||||
{first,""},
|
||||
{"","dye:".. second},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = new,
|
||||
recipe = {
|
||||
{"","dye:".. second},
|
||||
{first,""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = new,
|
||||
recipe = {
|
||||
{"",first},
|
||||
{"dye:".. second,""},
|
||||
}
|
||||
-- Define items
|
||||
for _, row in ipairs(dyelocal.dyes) do
|
||||
local name = row[1]
|
||||
local description = row[2]
|
||||
local groups = row[3]
|
||||
local item_name = "dye:"..name
|
||||
local item_image = "dye_"..name..".png"
|
||||
minetest.register_craftitem(item_name, {
|
||||
inventory_image = item_image,
|
||||
description = description,
|
||||
groups = groups
|
||||
})
|
||||
end
|
||||
|
||||
--Public colors for mods:
|
||||
DYE_COLORS = {
|
||||
'white',
|
||||
'light_gray',
|
||||
'gray',
|
||||
'black',
|
||||
'red',
|
||||
'orange',
|
||||
'yellow',
|
||||
'lime',
|
||||
'green',
|
||||
'light_blue',
|
||||
'cyan',
|
||||
'blue',
|
||||
'purple',
|
||||
'magenta',
|
||||
'pink',
|
||||
'brown',
|
||||
-- Mix recipes
|
||||
-- Just mix everything to everything somehow sanely
|
||||
|
||||
dyelocal.mixbases = {"magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white"}
|
||||
|
||||
dyelocal.mixes = {
|
||||
-- magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white
|
||||
white = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet", "grey", "grey", "white", "white"},
|
||||
grey = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "pink", "dark_grey","grey", "grey"},
|
||||
dark_grey={"brown","brown", "brown", "brown", "brown","dark_green","dark_green","blue","blue","violet","black", "black"},
|
||||
black = {"black", "black", "black", "black", "black", "black", "black", "black", "black", "black", "black"},
|
||||
violet= {"magenta","magenta","red", "brown", "red", "cyan", "brown", "blue", "violet","violet"},
|
||||
blue = {"violet", "magenta","brown","brown","dark_green","cyan","cyan", "cyan", "blue"},
|
||||
cyan = {"blue","brown","dark_green","dark_grey","green","cyan","dark_green","cyan"},
|
||||
dark_green={"brown","brown","brown", "brown", "green", "green", "dark_green"},
|
||||
green = {"brown", "yellow","yellow","dark_green","green","green"},
|
||||
yellow= {"red", "orange", "yellow","orange", "yellow"},
|
||||
brown = {"brown", "brown","orange", "brown"},
|
||||
orange= {"red", "orange","orange"},
|
||||
red = {"magenta","red"},
|
||||
magenta={"magenta"},
|
||||
}
|
||||
|
||||
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
|
||||
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',
|
||||
groups = {dye = 1},
|
||||
stack_max = 128,
|
||||
for one,results in pairs(dyelocal.mixes) do
|
||||
for i,result in ipairs(results) do
|
||||
local another = dyelocal.mixbases[i]
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'dye:'..result..' 2',
|
||||
recipe = {'dye:'..one, 'dye:'..another},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_alias('dye:blue', 'lazurite:lazurite')
|
||||
|
||||
--Dye recipes
|
||||
local addSMrecipe = function(new, first, second)
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = 'dye:' .. new ..' 2',
|
||||
recipe = {
|
||||
'dye:' .. first,
|
||||
'dye:' .. second,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
--second
|
||||
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')
|
||||
|
||||
--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',
|
||||
type = 'cooking',
|
||||
output = 'dye:green',
|
||||
recipe = 'default:cactus',
|
||||
cooktime = 5,
|
||||
})
|
||||
-- Hide dyelocal
|
||||
dyelocal = nil
|
||||
|
||||
-- EOF
|
||||
|
|
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 559 B After Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 370 B |
After Width: | Height: | Size: 367 B |
After Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 561 B |
Before Width: | Height: | Size: 572 B |
Before Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 374 B |
Before Width: | Height: | Size: 585 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 523 B |
Before Width: | Height: | Size: 568 B After Width: | Height: | Size: 381 B |
After Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 389 B |