commit bbde77bab20c1de3b87e624bb0b5ca008af404d2 Author: Thomas--S Date: Fri Mar 31 20:48:08 2017 +0200 Initial Commit diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..9b5650f --- /dev/null +++ b/README.txt @@ -0,0 +1,21 @@ +Minetest mod: moognu +========================== +See license.txt for license information. + +Originally published as "nyancat" mod. + +Authors of source code +---------------------- +Originally by celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) +Modified by Thomas-S (LGPL 2.1) + +Authors of media files +---------------------- +VanessaE (CC BY-SA 3.0): + moognu_rainbow.png + +The contributors of http://archive.org/details/M00GNU and tenplus1 (CC BY-SA 3.0): + moognu_back.png + moognu_front.png + moognu_side.png \ No newline at end of file diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..4186f60 --- /dev/null +++ b/init.lua @@ -0,0 +1,87 @@ +minetest.register_node("moognu:moognu", { + description = "MooGNU", + tiles = {"moognu_side.png", "moognu_side.png", "moognu_side.png", + "moognu_side.png", "moognu_back.png", "moognu_front.png"}, + paramtype = "light", + light_source = default.LIGHT_MAX, + paramtype2 = "facedir", + groups = {cracky = 2}, + is_ground_content = false, + legacy_facedir_simple = true, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("moognu:moognu_rainbow", { + description = "MooGNU Rainbow", + tiles = { + "moognu_rainbow.png^[transformR90", + "moognu_rainbow.png^[transformR90", + "moognu_rainbow.png" + }, + paramtype = "light", + light_source = default.LIGHT_MAX, + paramtype2 = "facedir", + groups = {cracky = 2}, + is_ground_content = false, + sounds = default.node_sound_defaults(), +}) + +minetest.register_craft({ + type = "fuel", + recipe = "moognu:moognu", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "moognu:moognu_rainbow", + burntime = 1, +}) + +moognu = {} + +function moognu.place(pos, facedir, length) + if facedir > 3 then + facedir = 0 + end + local tailvec = minetest.facedir_to_dir(facedir) + local p = {x = pos.x, y = pos.y, z = pos.z} + minetest.set_node(p, {name = "moognu:moognu", param2 = facedir}) + for i = 1, length do + p.x = p.x + tailvec.x + p.z = p.z + tailvec.z + minetest.set_node(p, {name = "moognu:moognu_rainbow", param2 = facedir}) + end +end + +function moognu.generate(minp, maxp, seed) + local height_min = -31000 + local height_max = -32 + if maxp.y < height_min or minp.y > height_max then + return + end + local y_min = math.max(minp.y, height_min) + local y_max = math.min(maxp.y, height_max) + local volume = (maxp.x - minp.x + 1) * (y_max - y_min + 1) * (maxp.z - minp.z + 1) + local pr = PseudoRandom(seed + 9324342) + local max_num_moognus = math.floor(volume / (16 * 16 * 16)) + for i = 1, max_num_moognus do + if pr:next(0, 1000) == 0 then + local x0 = pr:next(minp.x, maxp.x) + local y0 = pr:next(minp.y, maxp.y) + local z0 = pr:next(minp.z, maxp.z) + local p0 = {x = x0, y = y0, z = z0} + moognu.place(p0, pr:next(0, 3), pr:next(3, 15)) + end + end +end + +minetest.register_on_generated(function(minp, maxp, seed) + moognu.generate(minp, maxp, seed) +end) + +-- Legacy +minetest.register_alias("default:nyancat", "moognu:moognu") +minetest.register_alias("nyancat:nyancat", "moognu:moognu") +minetest.register_alias("default:nyancat_rainbow", "moognu:moognu_rainbow") +minetest.register_alias("nyancat:nyancat_rainbow", "moognu:moognu_rainbow") \ No newline at end of file diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..802d0a0 --- /dev/null +++ b/license.txt @@ -0,0 +1,53 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2017 celeron55, Perttu Ahola +Copyright (C) 2012-2017 Various Minetest developers and contributors +Copyright (C) 2017 Thomas-S + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2017 VanessaE +Copyright (C) 2012-2017 The contributors of http://archive.org/details/M00GNU +Copyright (C) 2012-2017 tenplus1 + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/textures/moognu_back.png b/textures/moognu_back.png new file mode 100644 index 0000000..826f4f2 Binary files /dev/null and b/textures/moognu_back.png differ diff --git a/textures/moognu_front.png b/textures/moognu_front.png new file mode 100644 index 0000000..03e59bf Binary files /dev/null and b/textures/moognu_front.png differ diff --git a/textures/moognu_rainbow.png b/textures/moognu_rainbow.png new file mode 100644 index 0000000..685a22c Binary files /dev/null and b/textures/moognu_rainbow.png differ diff --git a/textures/moognu_side.png b/textures/moognu_side.png new file mode 100644 index 0000000..fee7b6f Binary files /dev/null and b/textures/moognu_side.png differ