1 minetest.register_node("nyancat:nyancat", {
2 description = "Nyan Cat",
3 tiles = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png",
4 "nyancat_side.png", "nyancat_back.png", "nyancat_front.png"},
5 paramtype2 = "facedir",
7 is_ground_content = false,
8 legacy_facedir_simple = true,
9 sounds = default.node_sound_defaults(),
12 minetest.register_node("nyancat:nyancat_rainbow", {
13 description = "Nyan Cat Rainbow",
15 "nyancat_rainbow.png^[transformR90",
16 "nyancat_rainbow.png^[transformR90",
19 paramtype2 = "facedir",
20 groups = {cracky = 2},
21 is_ground_content = false,
22 sounds = default.node_sound_defaults(),
25 minetest.register_craft({
27 recipe = "nyancat:nyancat",
31 minetest.register_craft({
33 recipe = "nyancat:nyancat_rainbow",
39 function nyancat.place(pos, facedir, length)
43 local tailvec = minetest.facedir_to_dir(facedir)
44 local p = {x = pos.x, y = pos.y, z = pos.z}
45 minetest.set_node(p, {name = "nyancat:nyancat", param2 = facedir})
49 minetest.set_node(p, {name = "nyancat:nyancat_rainbow", param2 = facedir})
53 function nyancat.generate(minp, maxp, seed)
54 local height_min = -31000
55 local height_max = -32
56 if maxp.y < height_min or minp.y > height_max then
59 local y_min = math.max(minp.y, height_min)
60 local y_max = math.min(maxp.y, height_max)
61 local volume = (maxp.x - minp.x + 1) * (y_max - y_min + 1) * (maxp.z - minp.z + 1)
62 local pr = PseudoRandom(seed + 9324342)
63 local max_num_nyancats = math.floor(volume / (16 * 16 * 16))
64 for i = 1, max_num_nyancats do
65 if pr:next(0, 1000) == 0 then
66 local x0 = pr:next(minp.x, maxp.x)
67 local y0 = pr:next(minp.y, maxp.y)
68 local z0 = pr:next(minp.z, maxp.z)
69 local p0 = {x = x0, y = y0, z = z0}
70 nyancat.place(p0, pr:next(0, 3), pr:next(3, 15))
75 minetest.register_on_generated(function(minp, maxp, seed)
76 nyancat.generate(minp, maxp, seed)
80 minetest.register_alias("default:nyancat", "nyancat:nyancat")
81 minetest.register_alias("default:nyancat_rainbow", "nyancat:nyancat_rainbow")
82 minetest.register_alias("nyancat", "nyancat:nyancat")
83 minetest.register_alias("nyancat_rainbow", "nyancat:nyancat_rainbow")
84 default.make_nyancat = nyancat.place
85 default.generate_nyancats = nyancat.generate