From bbde77bab20c1de3b87e624bb0b5ca008af404d2 Mon Sep 17 00:00:00 2001 From: Thomas--S Date: Fri, 31 Mar 2017 20:48:08 +0200 Subject: [PATCH] Initial Commit --- README.txt | 21 +++++++++ depends.txt | 1 + init.lua | 87 ++++++++++++++++++++++++++++++++++++ license.txt | 53 ++++++++++++++++++++++ textures/moognu_back.png | Bin 0 -> 153 bytes textures/moognu_front.png | Bin 0 -> 260 bytes textures/moognu_rainbow.png | Bin 0 -> 137 bytes textures/moognu_side.png | Bin 0 -> 157 bytes 8 files changed, 162 insertions(+) create mode 100644 README.txt create mode 100644 depends.txt create mode 100644 init.lua create mode 100644 license.txt create mode 100644 textures/moognu_back.png create mode 100644 textures/moognu_front.png create mode 100644 textures/moognu_rainbow.png create mode 100644 textures/moognu_side.png 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 0000000000000000000000000000000000000000..826f4f21a4fbf05d6fa14311fa1d72942a08880d GIT binary patch literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|37#&FAsXkCORfo<1U^kx;G47a zZ|6~$ss2GCPz%T%o!+k?#{oILk>=#*ccY-NKdqVJZlcnE(T9mKbLh*2~7Yh Czd9rU literal 0 HcmV?d00001 diff --git a/textures/moognu_front.png b/textures/moognu_front.png new file mode 100644 index 0000000000000000000000000000000000000000..03e59bf1f8395e31d483cf868de1c0310daa40eb GIT binary patch literal 260 zcmV+f0sH=mP)#bkH@K;NP~|j+Pnh5ifej+ZBeaEssx*1Y%X=;F zx1nn*`t2;2oA26cQ{RVqC8E=zF5*z_sG_lNG#jT7r;wvRd}2Aa z`ovJSHFxt{gW6IYpK5@){5*+(7sGP)R<6F$Ft2(=m5BJ?@BIJ@&S|H;As^2G0000< KMNUMnLSTZt3via52EXJ@K=n-5(_lDTBYwnunUs zeBAoK