2016-02-26 16:28:05 +01:00
|
|
|
blueprint = {}
|
|
|
|
blueprint.all = {}
|
|
|
|
|
|
|
|
function blueprint.register_blueprint(name, def)
|
|
|
|
table.insert(def.materials, "blueprint:"..name)
|
|
|
|
table.insert(blueprint.all, "blueprint:"..name)
|
|
|
|
|
|
|
|
minetest.register_craftitem(":blueprint:"..name, {
|
|
|
|
description = "Blueprint : " .. def.description,
|
2016-02-27 10:52:46 +01:00
|
|
|
inventory_image = "blueprint_blueprint.png^[colorize:"..def.color..":80",
|
2016-02-26 16:28:05 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = def.out,
|
|
|
|
recipe = def.materials,
|
|
|
|
replacements = {
|
|
|
|
{"blueprint:"..name, "blueprint:"..name}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_craftitem("blueprint:empty", {
|
|
|
|
description = "Empty Blueprint",
|
|
|
|
inventory_image = "blueprint_empty.png",
|
2016-03-06 20:21:40 +01:00
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
itemstack:set_name(blueprint.all[math.random(#blueprint.all)])
|
|
|
|
return itemstack
|
|
|
|
end
|
2016-02-26 16:28:05 +01:00
|
|
|
})
|