From 12f1703537248c4e6cabc3e0a34364b0d5f2999f Mon Sep 17 00:00:00 2001 From: ezhh Date: Mon, 29 Jan 2018 01:40:09 +0000 Subject: [PATCH] Add fireflies mod --- mods/fireflies/README.txt | 22 +++ mods/fireflies/depends.txt | 2 + mods/fireflies/init.lua | 172 ++++++++++++++++++ mods/fireflies/license.txt | 58 ++++++ mods/fireflies/textures/fireflies_bottle.png | Bin 0 -> 172 bytes .../textures/fireflies_bottle_animated.png | Bin 0 -> 205 bytes mods/fireflies/textures/fireflies_bugnet.png | Bin 0 -> 192 bytes mods/fireflies/textures/fireflies_firefly.png | Bin 0 -> 113 bytes .../textures/fireflies_firefly_animated.png | Bin 0 -> 121 bytes 9 files changed, 254 insertions(+) create mode 100644 mods/fireflies/README.txt create mode 100644 mods/fireflies/depends.txt create mode 100644 mods/fireflies/init.lua create mode 100644 mods/fireflies/license.txt create mode 100644 mods/fireflies/textures/fireflies_bottle.png create mode 100644 mods/fireflies/textures/fireflies_bottle_animated.png create mode 100644 mods/fireflies/textures/fireflies_bugnet.png create mode 100644 mods/fireflies/textures/fireflies_firefly.png create mode 100644 mods/fireflies/textures/fireflies_firefly_animated.png diff --git a/mods/fireflies/README.txt b/mods/fireflies/README.txt new file mode 100644 index 00000000..7382578d --- /dev/null +++ b/mods/fireflies/README.txt @@ -0,0 +1,22 @@ +Minetest Game mod: fireflies +============================ +Adds fireflies to the world on mapgen, which can then be caught in a net and placed in +bottles to provide light. + +Authors of source code +---------------------- +Shara RedCat (MIT) + +Authors of media (textures) +--------------------------- +Shara RedCat (CC BY-SA 3.0): + fireflies_firefly.png + fireflies_firefly_animated.png + fireflies_bugnet.png + fireflies_bottle.png + fireflies_bottle_animated.png + +fireflies_bugnet.png is modified from a texture by tenplus1 (CC0) + +fireflies_bottle.png and fireflies_bottle_animated.png are +modified from a texture by Vanessa Ezekowitz (CC BY-SA 3.0) \ No newline at end of file diff --git a/mods/fireflies/depends.txt b/mods/fireflies/depends.txt new file mode 100644 index 00000000..e0585b46 --- /dev/null +++ b/mods/fireflies/depends.txt @@ -0,0 +1,2 @@ +default +vessels \ No newline at end of file diff --git a/mods/fireflies/init.lua b/mods/fireflies/init.lua new file mode 100644 index 00000000..8294baff --- /dev/null +++ b/mods/fireflies/init.lua @@ -0,0 +1,172 @@ +-- firefly +minetest.register_node("fireflies:firefly", { + description = "Firefly", + drawtype = "plantlike", + tiles = {{ + name = "fireflies_firefly_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + }}, + inventory_image = "fireflies_firefly.png", + wield_image = "fireflies_firefly.png", + waving = 1, + paramtype = "light", + sunlight_propagates = true, + buildable_to = true, + walkable = false, + groups = {catchable = 1}, + selection_box = { + type = "fixed", + fixed = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1}, + }, + light_source = 6, + floodable = true, + on_flood = function(pos, oldnode, newnode) + minetest.add_item(pos, "fireflies:firefly 1") + end +}) + + +-- bug net +minetest.register_tool("fireflies:bug_net", { + description = "Bug Net", + inventory_image = "fireflies_bugnet.png", + on_use = function(itemstack, player, pointed_thing) + if not pointed_thing or pointed_thing.type ~= "node" or + minetest.is_protected(pointed_thing.under, player:get_player_name()) then + return + end + local node_name = minetest.get_node(pointed_thing.under).name + local inv = player:get_inventory() + if minetest.get_item_group(node_name, "catchable") == 1 then + minetest.set_node(pointed_thing.under, {name = "air"}) + local stack = ItemStack(node_name.." 1") + local leftover = inv:add_item("main", stack) + if leftover:get_count() > 0 then + minetest.add_item(pointed_thing.under, node_name.." 1") + end + end + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(256) + return itemstack + end + end +}) + +minetest.register_craft( { + output = "fireflies:bug_net", + recipe = { + {"farming:string", "farming:string", ""}, + {"farming:string", "farming:string", ""}, + {"default:stick", "", ""} + } +}) + + +-- firefly in a bottle +minetest.register_node("fireflies:firefly_bottle", { + description = "Firefly in a Bottle", + inventory_image = "fireflies_bottle.png", + wield_image = "fireflies_bottle.png", + tiles = {{ + name = "fireflies_bottle_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + }}, + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + light_source = 9, + walkable = false, + groups = {dig_immediate = 3, attached_node = 1}, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + sounds = default.node_sound_glass_defaults(), + on_rightclick = function(pos, node, player, itemstack, pointed_thing) + local lower_pos = {x = pos.x, y = pos.y + 1, z = pos.z} + if minetest.is_protected(pos, player:get_player_name()) or + minetest.get_node(lower_pos).name ~= "air" then + return + end + + local upper_pos = {x = pos.x, y = pos.y + 2, z = pos.z} + local firefly_pos + + if not minetest.is_protected(upper_pos, player:get_player_name()) and + minetest.get_node(upper_pos).name == "air" then + firefly_pos = upper_pos + elseif not minetest.is_protected(lower_pos, player:get_player_name()) then + firefly_pos = lower_pos + end + + if firefly_pos then + minetest.set_node(pos, {name = "vessels:glass_bottle"}) + minetest.set_node(firefly_pos, {name = "fireflies:firefly"}) + end + end +}) + +minetest.register_craft( { + output = "fireflies:firefly_bottle", + recipe = { + {"", "", ""}, + {"", "fireflies:firefly", ""}, + {"", "vessels:glass_bottle", ""} + } +}) + + +-- register fireflies as decorations +minetest.register_decoration({ + deco_type = "simple", + place_on = { + "default:dirt_with_grass", + "default:dirt_with_coniferous_litter", + "default:dirt_with_rainforest_litter", + "default:dirt" + }, + place_offset_y = 2, + sidelen = 80, + fill_ratio = 0.002, + biomes = { + "deciduous_forest", + "coniferous_forest", + "rainforest", + "rainforest_swamp" + }, + y_min = -1, + y_max = 31000, + decoration = "fireflies:firefly", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = { + "default:dirt_with_grass", + "default:dirt_with_coniferous_litter", + "default:dirt_with_rainforest_litter", + "default:dirt" + }, + place_offset_y = 3, + sidelen = 80, + fill_ratio = 0.002, + biomes = { + "deciduous_forest", + "coniferous_forest", + "rainforest", + "rainforest_swamp" + }, + y_min = -1, + y_max = 31000, + decoration = "fireflies:firefly", +}) diff --git a/mods/fireflies/license.txt b/mods/fireflies/license.txt new file mode 100644 index 00000000..eebdad63 --- /dev/null +++ b/mods/fireflies/license.txt @@ -0,0 +1,58 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (c) 2018 Shara RedCat + +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. + +For more details: +https://opensource.org/licenses/MIT + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2018 Shara RedCat + +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/ \ No newline at end of file diff --git a/mods/fireflies/textures/fireflies_bottle.png b/mods/fireflies/textures/fireflies_bottle.png new file mode 100644 index 0000000000000000000000000000000000000000..ecca0363096bddd994397af8de7a04d786f096e9 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv4DbnY1=1I;JlL}5?7kycZryr% z?97d=ThFZCdSYf{ZbxqH|Nm*Rr~8_KiWp0R{DK)Ap4~_Tax6Vv978y+Co2dQ_%vKN z)7Zo)5O&06MF^8}&q1DrGbJQ=6nMlm79Zf&;7Bvra6p33XGNE!kZU6gL#!?9`)lr> RHGqaNc)I$ztaD0e0sta1JbC~C literal 0 HcmV?d00001 diff --git a/mods/fireflies/textures/fireflies_bottle_animated.png b/mods/fireflies/textures/fireflies_bottle_animated.png new file mode 100644 index 0000000000000000000000000000000000000000..96062b3c15c1cea67f971d7112eb158f84797d20 GIT binary patch literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^0zjO=!VDyz{eM3hNT~$)gt!9fEql(MzkGk+kt?@u zJw0~j#@4N8R&PCV>H5Q&jkz7UvH$<4U7z%5E>Im~NswPKgTu2MX+Tc6r;B5V#`$Cg zp#r^z3uhdC83n?gD6I%#67D(3vrtk}f=7X88n1v`BXfYjnS_K!Lm7!cQDc>@Oq^1? z*-vSFkV|>z*m8cF<1@L49|inE-+B5zC|dnxV3=m5J)!f@?Kq$n44$rjF6*2UngC*! BOsW6? literal 0 HcmV?d00001 diff --git a/mods/fireflies/textures/fireflies_bugnet.png b/mods/fireflies/textures/fireflies_bugnet.png new file mode 100644 index 0000000000000000000000000000000000000000..8ec3d33bae24643cd67bb0fc5b388c055ef831c9 GIT binary patch literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ1=5F4-Q&m*5zIlez7I)Rojc)I$ztaD0e0sw<|LUjND literal 0 HcmV?d00001 diff --git a/mods/fireflies/textures/fireflies_firefly.png b/mods/fireflies/textures/fireflies_firefly.png new file mode 100644 index 0000000000000000000000000000000000000000..c0866894ca0be53a3715199b484589beaa1a70f4 GIT binary patch literal 113 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-u0Z<#D~A8y`tG0QJa~8A zb0D9wB*-tA!Qt7BG$2RV)5S4_<9f0Jn}H<*=P~9Z8mtWJJd7-wW%D-yr5QY3{an^L HB{Ts50`?tG literal 0 HcmV?d00001 diff --git a/mods/fireflies/textures/fireflies_firefly_animated.png b/mods/fireflies/textures/fireflies_firefly_animated.png new file mode 100644 index 0000000000000000000000000000000000000000..e6932e37c69eb1f2ec57ccdeceb2a8f80fba8d0f GIT binary patch literal 121 zcmeAS@N?(olHy`uVBq!ia0vp^0zllr#0(_se=}|bQak}ZA+A9B|0{<7-}>&KccM2A0Q+Y?BVGSm=Ckg`;2sgRmKgq<`D` QLZC7RPgg&ebxsLQ0FcHbBLDyZ literal 0 HcmV?d00001 -- 2.25.1