diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d239649 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,28 @@ + +License for Code +---------------- + +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +License for Textures +--------------------------------------- + +All textures are licensed under CC-BY-SA 4.0 diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..b46ffce --- /dev/null +++ b/init.lua @@ -0,0 +1,41 @@ +local function get_moth_formspec() + return "size[10,10]".. + "field[1,1;8,1;target;Recipent: ;name]".. + "textarea[1,3;8,5;message;Message: ;Help me!]".. + "button_exit[1,8;5,1;send;Fly Away...]" +end +minetest.register_node("moth:moth", { + description = "Moth", + inventory_image = "moth_img.png", + wield_image = "moth_img.png", + paramtype = "light", + sunlight_propagates = true, + drawtype = "plantlike", + walkable = false, + tiles = {{ + name = "moth.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 1} + }}, + groups = {oddly_breakable_by_hand=3}, + on_use = function(itemstack, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "moth_send", get_moth_formspec()) + end +}) +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname == "moth_send" then + if fields.send then + local inv = player:get_inventory() + inv:remove_item("main", "moth:moth") + local rec = minetest.get_player_by_name(fields.target) + if rec then + local pos = rec:get_pos() + pos.y = pos.y + 1 + minetest.set_node(pos, {name = "moth:moth"}) + minetest.show_formspec(rec:get_player_name(), "moth_show", "size[10,10]".."label[0.5,0.5;A moth whispers to you...]".."label[0.5,1;(From "..minetest.formspec_escape(player:get_player_name())..")".."]".."textarea[0.5,2.5;7.5,7;;" ..minetest.formspec_escape(fields.message) .. ";]") + end + end + end +end) +if minetest.get_modpath("flowers") then + minetest.override_item("flowers:dandelion_white", {on_use = function(itemstack, player, pointed_thing) minetest.set_node(player:get_pos(), {name = "moth:moth"}) end}) +end \ No newline at end of file diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..b20649b --- /dev/null +++ b/mod.conf @@ -0,0 +1,3 @@ +name = moth +description = Adds moths which can send messages (from Lord of the Rings) +optional_depends = flowers \ No newline at end of file diff --git a/screenshot_1.png b/screenshot_1.png new file mode 100644 index 0000000..20ae097 Binary files /dev/null and b/screenshot_1.png differ diff --git a/screenshot_2.png b/screenshot_2.png new file mode 100644 index 0000000..354d5f8 Binary files /dev/null and b/screenshot_2.png differ