diff --git a/.gitmodules b/.gitmodules index 7070c6d5..d02268c5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -44,12 +44,6 @@ [submodule "mods/pkarcs"] path = mods/pkarcs url = https://git.tchncs.de/Illuna-Minetest/pkarcs -[submodule "mods/farming"] - path = mods/farming - url = https://git.tchncs.de/Illuna-Minetest/farming -[submodule "mods/boats"] - path = mods/boats - url = https://git.tchncs.de/Illuna-Minetest/boats [submodule "mods/columnia"] path = mods/columnia url = https://git.tchncs.de/Illuna-Minetest/columnia diff --git a/.luacheckrc b/.luacheckrc index f087d303..52b25132 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -5,7 +5,7 @@ read_globals = { "DIR_DELIM", "minetest", "core", "dump", - "vector", "nodeupdate", + "vector", "VoxelManip", "VoxelArea", "PseudoRandom", "ItemStack", } diff --git a/.travis.yml b/.travis.yml index 805fe08c..5253938a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,12 @@ language: generic - -branches: - only: - - master - -sudo: required - +sudo: false +addons: + apt: + packages: + - luarocks before_install: - - sudo apt-get update - - sudo apt-get install -y luarocks - - sudo luarocks install luacheck - -script: luacheck --no-color ./mods + - luarocks install --local luacheck +script: +- $HOME/.luarocks/bin/luacheck --no-color ./mods +notifications: + email: false diff --git a/game_api.txt b/game_api.txt index 2f0715f8..38718c36 100644 --- a/game_api.txt +++ b/game_api.txt @@ -19,16 +19,21 @@ Bucket API The bucket API allows registering new types of buckets for non-default liquids. - bucket.register_liquid( "default:lava_source", -- name of the source node "default:lava_flowing", -- name of the flowing node "bucket:bucket_lava", -- name of the new bucket item (or nil if liquid is not takeable) "bucket_lava.png", -- texture of the new bucket item (ignored if itemname == nil) "Lava Bucket", -- text description of the bucket item - {lava_bucket = 1} -- groups of the bucket item, OPTIONAL + {lava_bucket = 1}, -- groups of the bucket item, OPTIONAL + false -- force-renew, OPTIONAL. Force the liquid source to renew if it has + -- a source neighbour, even if defined as 'liquid_renewable = false'. + -- Needed to avoid creating holes in sloping rivers. ) +The filled bucket item is returned to the player that uses an empty bucket pointing to the given liquid source. +When punching with an empty bucket pointing to an entity or a non-liquid node, the on_punch of the entity or node will be triggered. + Beds API -------- @@ -65,7 +70,17 @@ Beds API Creative API ------------ -A global string called `creative.formspec_add` was added which allows mods to add additional formspec elements onto the default creative inventory formspec to be drawn after each update. +Use `creative.register_tab(name, title, items)` to add a tab with filtered items. +For example, + + creative.register_tab("tools", "Tools", minetest.registered_tools) + +is used to show all tools. Name is used in the sfinv page name, title is the +human readable title. + +The contents of `creative.formspec_add` is appended to every creative inventory +page. Mods can use it to add additional formspec elements onto the default +creative inventory formspec to be drawn after each update. Doors API --------- @@ -183,6 +198,9 @@ The farming API allows you to easily register plants and hoes. `farming.register_plant(name, Plant definition)` * Register a new growing plant, see [#Plant definition] +`farming.registered_plants[name] = definition` + * Table of registered plants, indexed by plant name + ### Hoe Definition @@ -219,6 +237,14 @@ New node def property: * Called when fire attempts to remove a burning node. * `pos` Position of the burning node. + `on_ignite(pos, igniter)` + + * Called when Flint and steel (or a mod defined ignitor) is used on a node. + Defining it may prevent the default action (spawning flames) from triggering. + * `pos` Position of the ignited node. + * `igniter` Player that used the tool, when available. + + Give Initial Stuff API ---------------------- @@ -290,9 +316,9 @@ TNT API * `position` The center of explosion. * `definition` The TNT definion as passed to `tnt.register` -`tnt.burn(position)` +`tnt.burn(position, [nodename])` -^ Ignite TNT at position +^ Ignite TNT at position, nodename isn't required unless already known. To make dropping items from node inventories easier, you can use the @@ -375,6 +401,100 @@ set a players home position and teleport a player to home position. * return value: false if player cannot be sent home, otherwise true +Sfinv API +--------- + +### sfinv Methods + +* sfinv.set_player_inventory_formspec(player, context) - builds page formspec + and calls set_inventory_formspec(). + If context is nil, it is either found or created. +* sfinv.get_formspec(player, context) - builds current page's formspec +* sfinv.get_nav_fs(player, context, nav, current_idx) - see above +* sfinv.get_homepage_name(player) - get the page name of the first page to show to a player +* sfinv.make_formspec(player, context, content, show_inv, size) - adds a theme to a formspec + * show_inv, defaults to false. Whether to show the player's main inventory + * size, defaults to `size[8,8.6]` if not specified +* sfinv.register_page(name, def) - register a page, see section below +* sfinv.override_page(name, def) - overrides fields of an page registered with register_page. + * Note: Page must already be defined, (opt)depend on the mod defining it. + +### sfinv Members + +* pages - table of pages[pagename] = def +* pages_unordered - array table of pages in order of addition (used to build navigation tabs). +* contexts - contexts[playername] = player_context +* enabled - set to false to disable. Good for inventory rehaul mods like unified inventory + +### Context + +A table with these keys: + +* page - current page name +* nav - a list of page names +* nav_titles - a list of page titles +* nav_idx - current nav index (in nav and nav_titles) +* any thing you want to store + * sfinv will clear the stored data on log out / log in + +### sfinv.register_page + +sfinv.register_page(name, def) + +def is a table containing: + +* `title` - human readable page name (required) +* `get(self, player, context)` - returns a formspec string. See formspec variables. (required) +* `is_in_nav(self, player, context)` - return true to show in the navigation (the tab header, by default) +* `on_player_receive_fields(self, player, context, fields)` - on formspec submit. +* `on_enter(self, player, context)` - called when the player changes pages, usually using the tabs. +* `on_leave(self, player, context)` - when leaving this page to go to another, called before other's on_enter + +### get formspec + +Use sfinv.make_formspec to apply a layout: + + return sfinv.make_formspec(player, context, [[ + list[current_player;craft;1.75,0.5;3,3;] + list[current_player;craftpreview;5.75,1.5;1,1;] + image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270] + listring[current_player;main] + listring[current_player;craft] + image[0,4.25;1,1;gui_hb_bg.png] + image[1,4.25;1,1;gui_hb_bg.png] + image[2,4.25;1,1;gui_hb_bg.png] + image[3,4.25;1,1;gui_hb_bg.png] + image[4,4.25;1,1;gui_hb_bg.png] + image[5,4.25;1,1;gui_hb_bg.png] + image[6,4.25;1,1;gui_hb_bg.png] + image[7,4.25;1,1;gui_hb_bg.png] + ]], true) + +See above (methods section) for more options. + +### Customising themes + +Simply override this function to change the navigation: + + function sfinv.get_nav_fs(player, context, nav, current_idx) + return "navformspec" + end + +And override this function to change the layout: + + function sfinv.make_formspec(player, context, content, show_inv, size) + local tmp = { + size or "size[8,8.6]", + theme_main, + sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx), + content + } + if show_inv then + tmp[4] = theme_inv + end + return table.concat(tmp, "") + end + Stairs API ---------- @@ -421,7 +541,7 @@ Creates panes that automatically connect to each other ### Pane definition { - textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"}, -- More tiles aren't supported + textures = {"texture for sides", (unused), "texture for top and bottom"}, -- More tiles aren't supported groups = {group = rating}, -- Uses the known node groups, see [Known damage and digging time defining groups] sounds = SoundSpec, -- See [#Default sounds] recipe = {{"","","","","","","","",""}}, -- Recipe field only @@ -458,6 +578,7 @@ Sounds inside the default table can be used within the sounds field of node defi * `default.node_sound_wood_defaults()` * `default.node_sound_leaves_defaults()` * `default.node_sound_glass_defaults()` + * `default.node_sound_metal_defaults()` Default constants ----------------- @@ -633,3 +754,83 @@ Trees * `default.grow_new_snowy_pine_tree(pos)` * Grows a new design snowy pine tree at pos + +Carts +----- + + carts.register_rail( + "mycarts:myrail", -- Rail name + nodedef, -- standard nodedef + railparams -- rail parameter struct (optional) + ) + + railparams = { + on_step(obj, dtime), -- Event handler called when + -- cart is on rail + acceleration, -- integer acceleration factor (negative + -- values to brake) + } + + The event handler is called after all default calculations + are made, so the custom on_step handler can override things + like speed, acceleration, player attachment. The handler will + likely be called many times per second, so the function needs + to make sure that the event is handled properly. + +Key API +------- + +The key API allows mods to add key functionality to nodes that have +ownership or specific permissions. Using the API will make it so +that a node owner can use skeleton keys on their nodes to create keys +for that node in that location, and give that key to other players, +allowing them some sort of access that they otherwise would not have +due to node protection. + +To make your new nodes work with the key API, you need to register +two callback functions in each nodedef: + + +`on_key_use(pos, player)` + * Is called when a player right-clicks (uses) a normal key on your + * node. + * `pos` - position of the node + * `player` - PlayerRef + * return value: none, ignored + +The `on_key_use` callback should validate that the player is wielding +a key item with the right key meta secret. If needed the code should +deny access to the node functionality. + +If formspecs are used, the formspec callbacks should duplicate these +checks in the metadata callback functions. + + +`on_skeleton_key_use(pos, player, newsecret)` + + * Is called when a player right-clicks (uses) a skeleton key on your + * node. + * `pos` - position of the node + * `player` - PlayerRef + * `newsecret` - a secret value(string) + * return values: + * `secret` - `nil` or the secret value that unlocks the door + * `name` - a string description of the node ("a locked chest") + * `owner` - name of the node owner + +The `on_skeleton_key_use` function should validate that the player has +the right permissions to make a new key for the item. The newsecret +value is useful if the node has no secret value. The function should +store this secret value somewhere so that in the future it may compare +key secrets and match them to allow access. If a node already has a +secret value, the function should return that secret value instead +of the newsecret value. The secret value stored for the node should +not be overwritten, as this would invalidate existing keys. + +Aside from the secret value, the function should retun a descriptive +name for the node and the owner name. The return values are all +encoded in the key that will be given to the player in replacement +for the wielded skeleton key. + +if `nil` is returned, it is assumed that the wielder did not have +permissions to create a key for this node, and no key is created. diff --git a/minetest.conf.example b/minetest.conf.example index f5e4e85d..3f20eb77 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -24,6 +24,9 @@ # 'permanent flame' nodes will remain with either setting. #enable_fire = true +# Enable flame sound. +#flame_sound = true + # Whether the stuff in initial_stuff should be given to new players #give_initial_stuff = false #initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel,default:torch 99,default:cobble 99 diff --git a/mods/beds/README.txt b/mods/beds/README.txt index 9710c459..cda6ebd9 100644 --- a/mods/beds/README.txt +++ b/mods/beds/README.txt @@ -1,30 +1,26 @@ Minetest Game mod: beds ======================= -by BlockMen (c) 2014-2015 +See license.txt for license information. -Version: 1.1.1 +Authors of source code +---------------------- +Originally by BlockMen (MIT) +Various Minetest developers and contributors (MIT) -About -~~~~~ -This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing -in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other -players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced -if more than 50% of the players are lying in bed and use this option. +Authors of media (textures) +--------------------------- +BlockMen (CC BY-SA 3.0) -Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point -is set to the beds location and you will respawn there after death. -You can disable the respawn at beds by setting "enable_bed_respawn = false" in minetest.conf -You can also disable the night skip feature by setting "enable_bed_night_skip = false" in minetest.conf or by using -the /set command ingame. +This mod adds a bed to Minetest which allows to skip the night. +To sleep, rightclick the bed. If playing in singleplayer mode the night gets skipped +immediately. If playing multiplayer you get shown how many other players are in bed too, +if all players are sleeping the night gets skipped. The night skip can be forced if more +than 50% of the players are lying in bed and use this option. - -License of source code, textures: WTFPL ---------------------------------------- -(c) Copyright BlockMen (2014-2015) - - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Another feature is a controlled respawning. If you have slept in bed (not just lying in +it) your respawn point is set to the beds location and you will respawn there after +death. +You can disable the respawn at beds by setting "enable_bed_respawn = false" in +minetest.conf. +You can disable the night skip feature by setting "enable_bed_night_skip = false" in +minetest.conf or by using the /set command in-game. diff --git a/mods/beds/api.lua b/mods/beds/api.lua index 3624ea45..3b2bb0d5 100644 --- a/mods/beds/api.lua +++ b/mods/beds/api.lua @@ -16,7 +16,7 @@ local function destruct_bed(pos, n) if reverse then reverse = not reverse minetest.remove_node(other) - nodeupdate(other) + minetest.check_for_falling(other) else reverse = not reverse end @@ -33,7 +33,7 @@ function beds.register_bed(name, def) paramtype2 = "facedir", is_ground_content = false, stack_max = 1, - groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1}, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1}, sounds = default.node_sound_wood_defaults(), node_box = { type = "fixed", @@ -137,7 +137,7 @@ function beds.register_bed(name, def) paramtype2 = "facedir", is_ground_content = false, pointable = false, - groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2}, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2}, sounds = default.node_sound_wood_defaults(), drop = name .. "_bottom", node_box = { diff --git a/mods/beds/beds.lua b/mods/beds/beds.lua index 5f31f136..bb2fd5d3 100644 --- a/mods/beds/beds.lua +++ b/mods/beds/beds.lua @@ -66,7 +66,7 @@ beds.register_bed("beds:bed", { }, top = { "beds_bed_top_top.png^[transformR90", - "default_wood.png", + "default_wood.png", "beds_bed_side_top_r.png", "beds_bed_side_top_r.png^[transformfx", "beds_bed_side_top.png", @@ -88,3 +88,17 @@ beds.register_bed("beds:bed", { minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom") minetest.register_alias("beds:bed_top_red", "beds:bed_top") + +-- Fuel + +minetest.register_craft({ + type = "fuel", + recipe = "beds:fancy_bed_bottom", + burntime = 13, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "beds:bed_bottom", + burntime = 12, +}) diff --git a/mods/beds/functions.lua b/mods/beds/functions.lua index b1c2c977..896844e5 100644 --- a/mods/beds/functions.lua +++ b/mods/beds/functions.lua @@ -174,7 +174,7 @@ end -- Callbacks -- Only register respawn callback if respawn enabled -if enable_respawn then +if enable_respawn then -- respawn player at bed if enabled and valid position is found minetest.register_on_respawnplayer(function(player) local name = player:get_player_name() diff --git a/mods/beds/license.txt b/mods/beds/license.txt new file mode 100644 index 00000000..0494b36b --- /dev/null +++ b/mods/beds/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2014-2016 Various Minetest developers and contributors + +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) 2014-2016 BlockMen + +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/mods/boats b/mods/boats deleted file mode 160000 index a7534e93..00000000 --- a/mods/boats +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a7534e938834c1a0322e49df796f613ca1f55880 diff --git a/mods/bones/README.txt b/mods/bones/README.txt index cf99bc8b..91bcd109 100644 --- a/mods/bones/README.txt +++ b/mods/bones/README.txt @@ -1,17 +1,12 @@ Minetest Game mod: bones ======================== +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2012 PilzAdam - -WTFPL - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files +Authors of source code ---------------------- -All textures: paramat +Originally by PilzAdam (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +All textures: paramat (CC BY-SA 3.0) diff --git a/mods/bones/init.lua b/mods/bones/init.lua index 20ae55e0..26ca0486 100644 --- a/mods/bones/init.lua +++ b/mods/bones/init.lua @@ -180,14 +180,14 @@ minetest.register_on_dieplayer(function(player) local pos = vector.round(player:getpos()) local player_name = player:get_player_name() - -- check if it's possible to place bones, if not go 1 higher + -- check if it's possible to place bones, if not find space near player if bones_mode == "bones" and not may_replace(pos, player) then - pos.y = pos.y + 1 - end - - -- still cannot place bones? change mode to 'drop' - if bones_mode == "bones" and not may_replace(pos, player) then - bones_mode = "drop" + local air = minetest.find_node_near(pos, 1, {"air"}) + if air and not minetest.is_protected(air, player_name) then + pos = air + else + bones_mode = "drop" + end end if bones_mode == "drop" then diff --git a/mods/bones/license.txt b/mods/bones/license.txt new file mode 100644 index 00000000..fe525841 --- /dev/null +++ b/mods/bones/license.txt @@ -0,0 +1,58 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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) 2016 paramat + +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. + diff --git a/mods/bucket/README.txt b/mods/bucket/README.txt index a6674b43..45e0ec54 100644 --- a/mods/bucket/README.txt +++ b/mods/bucket/README.txt @@ -1,26 +1,13 @@ Minetest Game mod: bucket ========================= +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2011-2012 Kahrl -Copyright (C) 2011-2012 celeron55, Perttu Ahola - -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 of the License, or -(at your option) any later version. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ -Everything not listed in here: -Copyright (C) 2010-2012 celeron55, Perttu Ahola - +Authors of source code +---------------------- +Kahrl (LGPL 2.1) +celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) +Authors of media (textures) +--------------------------- +ElementW (CC BY-SA 3.0) diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua index a7cb0f27..5076dece 100644 --- a/mods/bucket/init.lua +++ b/mods/bucket/init.lua @@ -36,12 +36,17 @@ end -- inventory_image = texture of the new bucket item (ignored if itemname == nil) -- name = text description of the bucket item -- groups = (optional) groups of the bucket item, for example {water_bucket = 1} +-- force_renew = (optional) bool. Force the liquid source to renew if it has a +-- source neighbour, even if defined as 'liquid_renewable = false'. +-- Needed to avoid creating holes in sloping rivers. -- This function can be called from any mod (that depends on bucket). -function bucket.register_liquid(source, flowing, itemname, inventory_image, name, groups) +function bucket.register_liquid(source, flowing, itemname, inventory_image, name, + groups, force_renew) bucket.liquids[source] = { source = source, flowing = flowing, itemname = itemname, + force_renew = force_renew, } bucket.liquids[flowing] = bucket.liquids[source] @@ -110,8 +115,11 @@ minetest.register_craftitem("bucket:bucket_empty", { stack_max = 99, liquids_pointable = true, on_use = function(itemstack, user, pointed_thing) - -- Must be pointing to node - if pointed_thing.type ~= "node" then + if pointed_thing.type == "object" then + pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil) + return user:get_wielded_item() + elseif pointed_thing.type ~= "node" then + -- do nothing if it's neither object nor node return end -- Check if pointing to a liquid source @@ -149,9 +157,24 @@ minetest.register_craftitem("bucket:bucket_empty", { end - minetest.add_node(pointed_thing.under, {name="air"}) + -- force_renew requires a source neighbour + local source_neighbor = false + if liquiddef.force_renew then + source_neighbor = + minetest.find_node_near(pointed_thing.under, 1, liquiddef.source) + end + if not (source_neighbor and liquiddef.force_renew) then + minetest.add_node(pointed_thing.under, {name = "air"}) + end return ItemStack(giving_back) + else + -- non-liquid nodes will have their on_punch triggered + local node_def = minetest.registered_nodes[node.name] + if node_def then + node_def.on_punch(pointed_thing.under, node, user, pointed_thing) + end + return user:get_wielded_item() end end, }) @@ -171,7 +194,8 @@ bucket.register_liquid( "bucket:bucket_river_water", "bucket_river_water.png", "River Water Bucket", - {water_bucket = 1} + {water_bucket = 1}, + true ) bucket.register_liquid( diff --git a/mods/bucket/license.txt b/mods/bucket/license.txt new file mode 100644 index 00000000..a5156ae6 --- /dev/null +++ b/mods/bucket/license.txt @@ -0,0 +1,51 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 Kahrl +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2011-2016 Various Minetest developers and contributors + +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) 2015-2016 ElementW + +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/mods/carts/README.txt b/mods/carts/README.txt new file mode 100644 index 00000000..31ce6449 --- /dev/null +++ b/mods/carts/README.txt @@ -0,0 +1,22 @@ +Carts (formerly boost_cart) +========================== + +Carts, based almost entirely on the mod boost_cart [1], which +itself is based on (and fully compatible with) the carts mod [2]. + +The model was originally designed by stujones11 [3] (CC-0). + +Cart textures are based on original work from PixelBOX (WTFPL). + + +[1] https://github.com/SmallJoker/boost_cart/ +[2] https://github.com/PilzAdam/carts/ +[3] https://github.com/stujones11/railcart/ + + +Features +---------- +- A fast cart for your railway or roller coaster (up to 7 m/s!) +- Boost and brake rails +- Rail junction switching with the 'right-left' walking keys +- Handbrake with the 'back' key diff --git a/mods/carts/cart_entity.lua b/mods/carts/cart_entity.lua new file mode 100644 index 00000000..e8707fb4 --- /dev/null +++ b/mods/carts/cart_entity.lua @@ -0,0 +1,392 @@ +local cart_entity = { + physical = false, -- otherwise going uphill breaks + collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + visual = "mesh", + mesh = "carts_cart.b3d", + visual_size = {x=1, y=1}, + textures = {"carts_cart.png"}, + + driver = nil, + punched = false, -- used to re-send velocity and position + velocity = {x=0, y=0, z=0}, -- only used on punch + old_dir = {x=1, y=0, z=0}, -- random value to start the cart on punch + old_pos = nil, + old_switch = 0, + railtype = nil, + attached_items = {} +} + +function cart_entity:on_rightclick(clicker) + if not clicker or not clicker:is_player() then + return + end + local player_name = clicker:get_player_name() + if self.driver and player_name == self.driver then + self.driver = nil + carts:manage_attachment(clicker, nil) + elseif not self.driver then + self.driver = player_name + carts:manage_attachment(clicker, self.object) + end +end + +function cart_entity:on_activate(staticdata, dtime_s) + self.object:set_armor_groups({immortal=1}) + if string.sub(staticdata, 1, string.len("return")) ~= "return" then + return + end + local data = minetest.deserialize(staticdata) + if not data or type(data) ~= "table" then + return + end + self.railtype = data.railtype + if data.old_dir then + self.old_dir = data.old_dir + end + if data.old_vel then + self.old_vel = data.old_vel + end +end + +function cart_entity:get_staticdata() + return minetest.serialize({ + railtype = self.railtype, + old_dir = self.old_dir, + old_vel = self.old_vel + }) +end + +function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction) + local pos = self.object:getpos() + if not self.railtype then + local node = minetest.get_node(pos).name + self.railtype = minetest.get_item_group(node, "connect_to_raillike") + end + -- Punched by non-player + if not puncher or not puncher:is_player() then + local cart_dir = carts:get_rail_direction(pos, self.old_dir, nil, nil, self.railtype) + if vector.equals(cart_dir, {x=0, y=0, z=0}) then + return + end + self.velocity = vector.multiply(cart_dir, 2) + self.punched = true + return + end + -- Player digs cart by sneak-punch + if puncher:get_player_control().sneak then + if self.sound_handle then + minetest.sound_stop(self.sound_handle) + end + -- Detach driver and items + if self.driver then + if self.old_pos then + self.object:setpos(self.old_pos) + end + local player = minetest.get_player_by_name(self.driver) + carts:manage_attachment(player, nil) + end + for _,obj_ in ipairs(self.attached_items) do + if obj_ then + obj_:set_detach() + end + end + -- Pick up cart + local inv = puncher:get_inventory() + if not minetest.setting_getbool("creative_mode") + or not inv:contains_item("main", "carts:cart") then + local leftover = inv:add_item("main", "carts:cart") + -- If no room in inventory add a replacement cart to the world + if not leftover:is_empty() then + minetest.add_item(self.object:getpos(), leftover) + end + end + self.object:remove() + return + end + -- Player punches cart to alter velocity + local vel = self.object:getvelocity() + if puncher:get_player_name() == self.driver then + if math.abs(vel.x + vel.z) > carts.punch_speed_max then + return + end + end + + local punch_dir = carts:velocity_to_dir(puncher:get_look_dir()) + punch_dir.y = 0 + local cart_dir = carts:get_rail_direction(pos, punch_dir, nil, nil, self.railtype) + if vector.equals(cart_dir, {x=0, y=0, z=0}) then + return + end + + local punch_interval = 1 + if tool_capabilities and tool_capabilities.full_punch_interval then + punch_interval = tool_capabilities.full_punch_interval + end + time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval) + local f = 2 * (time_from_last_punch / punch_interval) + + self.velocity = vector.multiply(cart_dir, f) + self.old_dir = cart_dir + self.punched = true +end + +local function rail_on_step_event(handler, obj, dtime) + if handler then + handler(obj, dtime) + end +end + +-- sound refresh interval = 1.0sec +local function rail_sound(self, dtime) + if not self.sound_ttl then + self.sound_ttl = 1.0 + return + elseif self.sound_ttl > 0 then + self.sound_ttl = self.sound_ttl - dtime + return + end + self.sound_ttl = 1.0 + if self.sound_handle then + local handle = self.sound_handle + self.sound_handle = nil + minetest.after(0.2, minetest.sound_stop, handle) + end + local vel = self.object:getvelocity() + local speed = vector.length(vel) + if speed > 0 then + self.sound_handle = minetest.sound_play( + "carts_cart_moving", { + object = self.object, + gain = (speed / carts.speed_max) / 2, + loop = true, + }) + end +end + +local function get_railparams(pos) + local node = minetest.get_node(pos) + return carts.railparams[node.name] or {} +end + +local function rail_on_step(self, dtime) + local vel = self.object:getvelocity() + if self.punched then + vel = vector.add(vel, self.velocity) + self.object:setvelocity(vel) + self.old_dir.y = 0 + elseif vector.equals(vel, {x=0, y=0, z=0}) then + return + end + + local pos = self.object:getpos() + local update = {} + + -- stop cart if velocity vector flips + if self.old_vel and self.old_vel.y == 0 and + (self.old_vel.x * vel.x < 0 or self.old_vel.z * vel.z < 0) then + self.old_vel = {x = 0, y = 0, z = 0} + self.old_pos = pos + self.object:setvelocity(vector.new()) + self.object:setacceleration(vector.new()) + rail_on_step_event(get_railparams(pos).on_step, self, dtime) + return + end + self.old_vel = vector.new(vel) + + if self.old_pos and not self.punched then + local flo_pos = vector.round(pos) + local flo_old = vector.round(self.old_pos) + if vector.equals(flo_pos, flo_old) then + -- Do not check one node multiple times + return + end + end + + local ctrl, player + + -- Get player controls + if self.driver then + player = minetest.get_player_by_name(self.driver) + if player then + ctrl = player:get_player_control() + end + end + + if self.old_pos then + -- Detection for "skipping" nodes + local found_path = carts:pathfinder( + pos, self.old_pos, self.old_dir, ctrl, self.old_switch, self.railtype + ) + + if not found_path then + -- No rail found: reset back to the expected position + pos = vector.new(self.old_pos) + update.pos = true + end + end + + local cart_dir = carts:velocity_to_dir(vel) + local railparams + + -- dir: New moving direction of the cart + -- switch_keys: Currently pressed L/R key, used to ignore the key on the next rail node + local dir, switch_keys = carts:get_rail_direction( + pos, cart_dir, ctrl, self.old_switch, self.railtype + ) + + local new_acc = {x=0, y=0, z=0} + if vector.equals(dir, {x=0, y=0, z=0}) then + vel = {x = 0, y = 0, z = 0} + pos = vector.round(pos) + update.pos = true + update.vel = true + else + -- Direction change detected + if not vector.equals(dir, self.old_dir) then + vel = vector.multiply(dir, math.abs(vel.x + vel.z)) + update.vel = true + if dir.y ~= self.old_dir.y then + pos = vector.round(pos) + update.pos = true + end + end + -- Center on the rail + if dir.z ~= 0 and math.floor(pos.x + 0.5) ~= pos.x then + pos.x = math.floor(pos.x + 0.5) + update.pos = true + end + if dir.x ~= 0 and math.floor(pos.z + 0.5) ~= pos.z then + pos.z = math.floor(pos.z + 0.5) + update.pos = true + end + + -- Slow down or speed up.. + local acc = dir.y * -4.0 + + -- Get rail for corrected position + railparams = get_railparams(pos) + + -- no need to check for railparams == nil since we always make it exist. + local speed_mod = railparams.acceleration + if speed_mod and speed_mod ~= 0 then + -- Try to make it similar to the original carts mod + acc = acc + speed_mod + else + -- Handbrake or coast + if ctrl and ctrl.down then + acc = acc - 3 + else + acc = acc - 0.4 + end + end + + new_acc = vector.multiply(dir, acc) + end + + -- Limits + local max_vel = carts.speed_max + for _, v in pairs({"x","y","z"}) do + if math.abs(vel[v]) > max_vel then + vel[v] = carts:get_sign(vel[v]) * max_vel + new_acc[v] = 0 + update.vel = true + end + end + + self.object:setacceleration(new_acc) + self.old_pos = vector.new(pos) + if not vector.equals(dir, {x=0, y=0, z=0}) then + self.old_dir = vector.new(dir) + end + self.old_switch = switch_keys + + if self.punched then + -- Collect dropped items + for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do + if not obj_:is_player() and + obj_:get_luaentity() and + not obj_:get_luaentity().physical_state and + obj_:get_luaentity().name == "__builtin:item" then + + obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0}) + self.attached_items[#self.attached_items + 1] = obj_ + end + end + self.punched = false + update.vel = true + end + + railparams = railparams or get_railparams(pos) + + if not (update.vel or update.pos) then + rail_on_step_event(railparams.on_step, self, dtime) + return + end + + local yaw = 0 + if self.old_dir.x < 0 then + yaw = 0.5 + elseif self.old_dir.x > 0 then + yaw = 1.5 + elseif self.old_dir.z < 0 then + yaw = 1 + end + self.object:setyaw(yaw * math.pi) + + local anim = {x=0, y=0} + if dir.y == -1 then + anim = {x=1, y=1} + elseif dir.y == 1 then + anim = {x=2, y=2} + end + self.object:set_animation(anim, 1, 0) + + self.object:setvelocity(vel) + if update.pos then + self.object:setpos(pos) + end + + -- call event handler + rail_on_step_event(railparams.on_step, self, dtime) +end + +function cart_entity:on_step(dtime) + rail_on_step(self, dtime) + rail_sound(self, dtime) +end + +minetest.register_entity("carts:cart", cart_entity) + +minetest.register_craftitem("carts:cart", { + description = "Cart (Sneak+Click to pick up)", + inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"), + wield_image = "carts_cart_side.png", + on_place = function(itemstack, placer, pointed_thing) + if not pointed_thing.type == "node" then + return + end + if carts:is_rail(pointed_thing.under) then + minetest.add_entity(pointed_thing.under, "carts:cart") + elseif carts:is_rail(pointed_thing.above) then + minetest.add_entity(pointed_thing.above, "carts:cart") + else + return + end + + minetest.sound_play({name = "default_place_node_metal", gain = 0.5}, + {pos = pointed_thing.above}) + + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, +}) + +minetest.register_craft({ + output = "carts:cart", + recipe = { + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + }, +}) diff --git a/mods/carts/depends.txt b/mods/carts/depends.txt new file mode 100644 index 00000000..4ad96d51 --- /dev/null +++ b/mods/carts/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/carts/functions.lua b/mods/carts/functions.lua new file mode 100644 index 00000000..285645cb --- /dev/null +++ b/mods/carts/functions.lua @@ -0,0 +1,221 @@ +function carts:get_sign(z) + if z == 0 then + return 0 + else + return z / math.abs(z) + end +end + +function carts:manage_attachment(player, obj) + if not player then + return + end + local status = obj ~= nil + local player_name = player:get_player_name() + if default.player_attached[player_name] == status then + return + end + default.player_attached[player_name] = status + + if status then + player:set_attach(obj, "", {x=0, y=6, z=0}, {x=0, y=0, z=0}) + player:set_eye_offset({x=0, y=-4, z=0},{x=0, y=-4, z=0}) + else + player:set_detach() + player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0}) + end +end + +function carts:velocity_to_dir(v) + if math.abs(v.x) > math.abs(v.z) then + return {x=carts:get_sign(v.x), y=carts:get_sign(v.y), z=0} + else + return {x=0, y=carts:get_sign(v.y), z=carts:get_sign(v.z)} + end +end + +function carts:is_rail(pos, railtype) + local node = minetest.get_node(pos).name + if node == "ignore" then + local vm = minetest.get_voxel_manip() + local emin, emax = vm:read_from_map(pos, pos) + local area = VoxelArea:new{ + MinEdge = emin, + MaxEdge = emax, + } + local data = vm:get_data() + local vi = area:indexp(pos) + node = minetest.get_name_from_content_id(data[vi]) + end + if minetest.get_item_group(node, "rail") == 0 then + return false + end + if not railtype then + return true + end + return minetest.get_item_group(node, "connect_to_raillike") == railtype +end + +function carts:check_front_up_down(pos, dir_, check_up, railtype) + local dir = vector.new(dir_) + local cur + + -- Front + dir.y = 0 + cur = vector.add(pos, dir) + if carts:is_rail(cur, railtype) then + return dir + end + -- Up + if check_up then + dir.y = 1 + cur = vector.add(pos, dir) + if carts:is_rail(cur, railtype) then + return dir + end + end + -- Down + dir.y = -1 + cur = vector.add(pos, dir) + if carts:is_rail(cur, railtype) then + return dir + end + return nil +end + +function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) + local pos = vector.round(pos_) + local cur + local left_check, right_check = true, true + + -- Check left and right + local left = {x=0, y=0, z=0} + local right = {x=0, y=0, z=0} + if dir.z ~= 0 and dir.x == 0 then + left.x = -dir.z + right.x = dir.z + elseif dir.x ~= 0 and dir.z == 0 then + left.z = dir.x + right.z = -dir.x + end + + if ctrl then + if old_switch == 1 then + left_check = false + elseif old_switch == 2 then + right_check = false + end + if ctrl.left and left_check then + cur = carts:check_front_up_down(pos, left, false, railtype) + if cur then + return cur, 1 + end + left_check = false + end + if ctrl.right and right_check then + cur = carts:check_front_up_down(pos, right, false, railtype) + if cur then + return cur, 2 + end + right_check = true + end + end + + -- Normal + cur = carts:check_front_up_down(pos, dir, true, railtype) + if cur then + return cur + end + + -- Left, if not already checked + if left_check then + cur = carts:check_front_up_down(pos, left, false, railtype) + if cur then + return cur + end + end + + -- Right, if not already checked + if right_check then + cur = carts:check_front_up_down(pos, right, false, railtype) + if cur then + return cur + end + end + + -- Backwards + if not old_switch then + cur = carts:check_front_up_down(pos, { + x = -dir.x, + y = dir.y, + z = -dir.z + }, true, railtype) + if cur then + return cur + end + end + + return {x=0, y=0, z=0} +end + +function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype) + local pos = vector.round(pos_) + local pf_pos = vector.round(old_pos) + local pf_dir = vector.new(old_dir) + + for i = 1, 3 do + if vector.equals(pf_pos, pos) then + -- Success! Cart moved on correctly + return true + end + + pf_dir, pf_switch = carts:get_rail_direction(pf_pos, pf_dir, ctrl, pf_switch, railtype) + if vector.equals(pf_dir, {x=0, y=0, z=0}) then + -- No way forwards + return false + end + + pf_pos = vector.add(pf_pos, pf_dir) + end + -- Cart not found + return false +end + +function carts:register_rail(name, def, railparams) + local def_default = { + drawtype = "raillike", + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + sounds = default.node_sound_metal_defaults() + } + for k, v in pairs(def_default) do + def[k] = v + end + if not def.inventory_image then + def.wield_image = def.tiles[1] + def.inventory_image = def.tiles[1] + end + + if railparams then + carts.railparams[name] = table.copy(railparams) + end + + minetest.register_node(name, def) +end + +function carts:get_rail_groups(additional_groups) + -- Get the default rail groups and add more when a table is given + local groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1} + if type(additional_groups) == "table" then + for k, v in pairs(additional_groups) do + groups[k] = v + end + end + return groups +end diff --git a/mods/carts/init.lua b/mods/carts/init.lua new file mode 100644 index 00000000..53b33cc2 --- /dev/null +++ b/mods/carts/init.lua @@ -0,0 +1,20 @@ + +carts = {} +carts.modpath = minetest.get_modpath("carts") +carts.railparams = {} + +-- Maximal speed of the cart in m/s (min = -1) +carts.speed_max = 7 +-- Set to -1 to disable punching the cart from inside (min = -1) +carts.punch_speed_max = 5 + + +dofile(carts.modpath.."/functions.lua") +dofile(carts.modpath.."/rails.lua") + +-- Support for non-default games +if not default.player_attached then + default.player_attached = {} +end + +dofile(carts.modpath.."/cart_entity.lua") diff --git a/mods/carts/license.txt b/mods/carts/license.txt new file mode 100644 index 00000000..6c5beb47 --- /dev/null +++ b/mods/carts/license.txt @@ -0,0 +1,54 @@ + +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 SmallJoker +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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 +----------------- + +CC-0, see: https://creativecommons.org/share-your-work/public-domain/cc0/, except +if other license is mentioned. + + +Authors +--------- +Originally from PixelBOX (Gambit): + carts_cart_side.png + carts_cart_top.png + carts_cart_front.png* + carts_cart.png* + +sofar + stujones11: + carts_cart.b3d and carts_cart.blend + +hexafraction, modified by sofar + carts_rail_*.png + +http://www.freesound.org/people/YleArkisto/sounds/253159/ - YleArkisto - CC-BY-3.0 + carts_cart_moving.*.ogg diff --git a/mods/carts/models/carts_cart.b3d b/mods/carts/models/carts_cart.b3d new file mode 100644 index 00000000..4e7eba36 Binary files /dev/null and b/mods/carts/models/carts_cart.b3d differ diff --git a/mods/carts/models/carts_cart.blend b/mods/carts/models/carts_cart.blend new file mode 100644 index 00000000..7d2515eb Binary files /dev/null and b/mods/carts/models/carts_cart.blend differ diff --git a/mods/carts/rails.lua b/mods/carts/rails.lua new file mode 100644 index 00000000..5da4ac4d --- /dev/null +++ b/mods/carts/rails.lua @@ -0,0 +1,59 @@ +carts:register_rail("carts:rail", { + description = "Rail", + tiles = { + "carts_rail_straight.png", "carts_rail_curved.png", + "carts_rail_t_junction.png", "carts_rail_crossing.png" + }, + inventory_image = "carts_rail_straight.png", + wield_image = "carts_rail_straight.png", + groups = carts:get_rail_groups(), +}, {}) + +minetest.register_craft({ + output = "carts:rail 16", + recipe = { + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "group:stick", "default:steel_ingot"}, + {"default:steel_ingot", "", "default:steel_ingot"}, + } +}) + +minetest.register_alias("default:rail", "carts:rail") + + +carts:register_rail("carts:powerrail", { + description = "Powered rail", + tiles = { + "carts_rail_straight_pwr.png", "carts_rail_curved_pwr.png", + "carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png" + }, + groups = carts:get_rail_groups(), +}, {acceleration = 5}) + +minetest.register_craft({ + output = "carts:powerrail 8", + recipe = { + {"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"}, + {"default:steel_ingot", "group:stick", "default:steel_ingot"}, + {"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"}, + } +}) + + +carts:register_rail("carts:brakerail", { + description = "Brake rail", + tiles = { + "carts_rail_straight_brk.png", "carts_rail_curved_brk.png", + "carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png" + }, + groups = carts:get_rail_groups(), +}, {acceleration = -3}) + +minetest.register_craft({ + output = "carts:brakerail 8", + recipe = { + {"default:steel_ingot", "default:coal_lump", "default:steel_ingot"}, + {"default:steel_ingot", "group:stick", "default:steel_ingot"}, + {"default:steel_ingot", "default:coal_lump", "default:steel_ingot"}, + } +}) diff --git a/mods/carts/sounds/carts_cart_moving.1.ogg b/mods/carts/sounds/carts_cart_moving.1.ogg new file mode 100644 index 00000000..869e765b Binary files /dev/null and b/mods/carts/sounds/carts_cart_moving.1.ogg differ diff --git a/mods/carts/sounds/carts_cart_moving.2.ogg b/mods/carts/sounds/carts_cart_moving.2.ogg new file mode 100644 index 00000000..b4cc5084 Binary files /dev/null and b/mods/carts/sounds/carts_cart_moving.2.ogg differ diff --git a/mods/carts/sounds/carts_cart_moving.3.ogg b/mods/carts/sounds/carts_cart_moving.3.ogg new file mode 100644 index 00000000..e19a782d Binary files /dev/null and b/mods/carts/sounds/carts_cart_moving.3.ogg differ diff --git a/mods/carts/textures/carts_cart.png b/mods/carts/textures/carts_cart.png new file mode 100644 index 00000000..965347c0 Binary files /dev/null and b/mods/carts/textures/carts_cart.png differ diff --git a/mods/carts/textures/carts_cart_front.png b/mods/carts/textures/carts_cart_front.png new file mode 100644 index 00000000..b85696f9 Binary files /dev/null and b/mods/carts/textures/carts_cart_front.png differ diff --git a/mods/carts/textures/carts_cart_side.png b/mods/carts/textures/carts_cart_side.png new file mode 100644 index 00000000..4362d6b1 Binary files /dev/null and b/mods/carts/textures/carts_cart_side.png differ diff --git a/mods/carts/textures/carts_cart_top.png b/mods/carts/textures/carts_cart_top.png new file mode 100644 index 00000000..5f775ff1 Binary files /dev/null and b/mods/carts/textures/carts_cart_top.png differ diff --git a/mods/carts/textures/carts_rail_crossing.png b/mods/carts/textures/carts_rail_crossing.png new file mode 100644 index 00000000..e10f3b1f Binary files /dev/null and b/mods/carts/textures/carts_rail_crossing.png differ diff --git a/mods/carts/textures/carts_rail_crossing_brk.png b/mods/carts/textures/carts_rail_crossing_brk.png new file mode 100644 index 00000000..0bf455ef Binary files /dev/null and b/mods/carts/textures/carts_rail_crossing_brk.png differ diff --git a/mods/carts/textures/carts_rail_crossing_pwr.png b/mods/carts/textures/carts_rail_crossing_pwr.png new file mode 100644 index 00000000..d763d508 Binary files /dev/null and b/mods/carts/textures/carts_rail_crossing_pwr.png differ diff --git a/mods/carts/textures/carts_rail_curved.png b/mods/carts/textures/carts_rail_curved.png new file mode 100644 index 00000000..b320f0da Binary files /dev/null and b/mods/carts/textures/carts_rail_curved.png differ diff --git a/mods/carts/textures/carts_rail_curved_brk.png b/mods/carts/textures/carts_rail_curved_brk.png new file mode 100644 index 00000000..ca407236 Binary files /dev/null and b/mods/carts/textures/carts_rail_curved_brk.png differ diff --git a/mods/carts/textures/carts_rail_curved_pwr.png b/mods/carts/textures/carts_rail_curved_pwr.png new file mode 100644 index 00000000..781bbd0a Binary files /dev/null and b/mods/carts/textures/carts_rail_curved_pwr.png differ diff --git a/mods/carts/textures/carts_rail_straight.png b/mods/carts/textures/carts_rail_straight.png new file mode 100644 index 00000000..30dcafe8 Binary files /dev/null and b/mods/carts/textures/carts_rail_straight.png differ diff --git a/mods/carts/textures/carts_rail_straight_brk.png b/mods/carts/textures/carts_rail_straight_brk.png new file mode 100644 index 00000000..0c690529 Binary files /dev/null and b/mods/carts/textures/carts_rail_straight_brk.png differ diff --git a/mods/carts/textures/carts_rail_straight_pwr.png b/mods/carts/textures/carts_rail_straight_pwr.png new file mode 100644 index 00000000..e067ff1d Binary files /dev/null and b/mods/carts/textures/carts_rail_straight_pwr.png differ diff --git a/mods/carts/textures/carts_rail_t_junction.png b/mods/carts/textures/carts_rail_t_junction.png new file mode 100644 index 00000000..8b1b9462 Binary files /dev/null and b/mods/carts/textures/carts_rail_t_junction.png differ diff --git a/mods/carts/textures/carts_rail_t_junction_brk.png b/mods/carts/textures/carts_rail_t_junction_brk.png new file mode 100644 index 00000000..6b4f6faa Binary files /dev/null and b/mods/carts/textures/carts_rail_t_junction_brk.png differ diff --git a/mods/carts/textures/carts_rail_t_junction_pwr.png b/mods/carts/textures/carts_rail_t_junction_pwr.png new file mode 100644 index 00000000..dd0eede2 Binary files /dev/null and b/mods/carts/textures/carts_rail_t_junction_pwr.png differ diff --git a/mods/creative/README.txt b/mods/creative/README.txt index fa735524..82357f30 100644 --- a/mods/creative/README.txt +++ b/mods/creative/README.txt @@ -1,23 +1,12 @@ Minetest Game mod: creative =========================== +See license.txt for license information. -Implements creative mode. - -Switch on by using the "creative_mode" setting. - -Registered items that -- have a description, and -- do not have the group not_in_creative_inventory -are added to the creative inventory. - -License of source code and media files: ---------------------------------------- -Copyright (C) 2012 Perttu Ahola (celeron55) -Copyright (C) 2016 Jean-Patrick G. (kilbith) - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Jean-Patrick G. (kilbith) (MIT) +Author of media (textures) +-------------------------- +Jean-Patrick G. (kilbith) (CC BY-SA 3.0) diff --git a/mods/creative/depends.txt b/mods/creative/depends.txt index 4ad96d51..975e6525 100644 --- a/mods/creative/depends.txt +++ b/mods/creative/depends.txt @@ -1 +1,2 @@ default +sfinv diff --git a/mods/creative/init.lua b/mods/creative/init.lua index 24cd673b..868b802b 100644 --- a/mods/creative/init.lua +++ b/mods/creative/init.lua @@ -1,228 +1,12 @@ --- minetest/creative/init.lua +dofile(minetest.get_modpath("creative") .. "/inventory.lua") -creative = {} -local player_inventory = {} -local creative_mode = minetest.setting_getbool("creative_mode") - --- Create detached creative inventory after loading all mods -creative.init_creative_inventory = function(owner) - local owner_name = owner:get_player_name() - player_inventory[owner_name] = { - size = 0, - filter = "", - start_i = 1, - tab_id = 2, - } - - minetest.create_detached_inventory("creative_" .. owner_name, { - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - if creative_mode and not to_list == "main" then - return count - else - return 0 - end - end, - allow_put = function(inv, listname, index, stack, player) - return 0 - end, - allow_take = function(inv, listname, index, stack, player) - if creative_mode then - return -1 - else - return 0 - end - end, - on_move = function(inv, from_list, from_index, to_list, to_index, count, player) - end, - on_put = function(inv, listname, index, stack, player) - end, - on_take = function(inv, listname, index, stack, player) - local player_name, stack_name = player:get_player_name(), stack:get_name() - --print(player_name .. " takes item from creative inventory; listname = " .. listname .. ", index = " .. index .. ", stack = " .. dump(stack:to_table())) - if stack then - minetest.log("action", player_name .. " takes " .. stack_name .. " from creative inventory") - --print("Stack name: " .. stack_name .. ", Stack count: " .. stack:get_count()) - end - end, - }) - - creative.update_creative_inventory(owner_name) - --print("creative inventory size: " .. player_inventory[player_name].size) -end - -local function tab_category(tab_id) - local id_category = { - nil, -- Reserved for crafting tab. - minetest.registered_items, - minetest.registered_nodes, - minetest.registered_tools, - minetest.registered_craftitems - } - - -- If index out of range, show default ("All") page. - return id_category[tab_id] or id_category[2] -end - -function creative.update_creative_inventory(player_name) - local creative_list = {} - local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) - local inv = player_inventory[player_name] - - for name, def in pairs(tab_category(inv.tab_id)) do - if not (def.groups.not_in_creative_inventory == 1) and - def.description and def.description ~= "" and - (def.name:find(inv.filter, 1, true) or - def.description:lower():find(inv.filter, 1, true)) then - creative_list[#creative_list+1] = name - end - end - - table.sort(creative_list) - player_inv:set_size("main", #creative_list) - player_inv:set_list("main", creative_list) - inv.size = #creative_list -end - --- Create the trash field -local trash = minetest.create_detached_inventory("creative_trash", { - -- Allow the stack to be placed and remove it in on_put() - -- This allows the creative inventory to restore the stack - allow_put = function(inv, listname, index, stack, player) - if creative_mode then - return stack:get_count() - else - return 0 - end - end, - on_put = function(inv, listname) - inv:set_list(listname, {}) - end, -}) -trash:set_size("main", 1) - -creative.formspec_add = "" - -creative.set_creative_formspec = function(player, start_i) - local player_name = player:get_player_name() - local inv = player_inventory[player_name] - local pagenum = math.floor(start_i / (3*8) + 1) - local pagemax = math.ceil(inv.size / (3*8)) - - player:set_inventory_formspec([[ - size[8,8.6] - image[4.06,3.4;0.8,0.8;creative_trash_icon.png] - list[current_player;main;0,4.7;8,1;] - list[current_player;main;0,5.85;8,3;8] - list[detached:creative_trash;main;4,3.3;1,1;] - listring[] - tablecolumns[color;text;color;text] - tableoptions[background=#00000000;highlight=#00000000;border=false] - button[5.4,3.2;0.8,0.9;creative_prev;<] - button[7.25,3.2;0.8,0.9;creative_next;>] - button[2.1,3.4;0.8,0.5;creative_search;?] - button[2.75,3.4;0.8,0.5;creative_clear;X] - tooltip[creative_search;Search] - tooltip[creative_clear;Reset] - listring[current_player;main] - ]] .. - "field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" .. - "field_close_on_enter[creative_filter;false]" .. - "listring[detached:creative_" .. player_name .. ";main]" .. - "tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;" .. tostring(inv.tab_id) .. ";true;false]" .. - "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" .. - "table[6.05,3.35;1.15,0.5;pagenum;#FFFF00," .. tostring(pagenum) .. ",#FFFFFF,/ " .. tostring(pagemax) .. "]" .. - default.get_hotbar_bg(0,4.7) .. - default.gui_bg .. default.gui_bg_img .. default.gui_slots - .. creative.formspec_add - ) -end - -creative.set_crafting_formspec = function(player) - player:set_inventory_formspec([[ - size[8,8.6] - list[current_player;craft;2,0.75;3,3;] - list[current_player;craftpreview;6,1.75;1,1;] - list[current_player;main;0,4.7;8,1;] - list[current_player;main;0,5.85;8,3;8] - list[detached:creative_trash;main;0,2.75;1,1;] - image[0.06,2.85;0.8,0.8;creative_trash_icon.png] - image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270] - tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;1;true;false] - listring[current_player;main] - listring[current_player;craft] - ]] .. - default.get_hotbar_bg(0,4.7) .. - default.gui_bg .. default.gui_bg_img .. default.gui_slots - ) -end - -minetest.register_on_joinplayer(function(player) - -- If in creative mode, modify player's inventory forms - if not creative_mode then - return - end - creative.init_creative_inventory(player) - creative.set_creative_formspec(player, 0) -end) - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname ~= "" or not creative_mode then - return - end - - local player_name = player:get_player_name() - local inv = player_inventory[player_name] - - if fields.quit then - if inv.tab_id == 1 then - creative.set_crafting_formspec(player) - end - elseif fields.creative_tabs then - local tab = tonumber(fields.creative_tabs) - inv.tab_id = tab - player_inventory[player_name].start_i = 1 - - if tab == 1 then - creative.set_crafting_formspec(player) - else - creative.update_creative_inventory(player_name) - creative.set_creative_formspec(player, 0) - end - elseif fields.creative_clear then - player_inventory[player_name].start_i = 1 - inv.filter = "" - creative.update_creative_inventory(player_name) - creative.set_creative_formspec(player, 0) - elseif fields.creative_search or - fields.key_enter_field == "creative_filter" then - player_inventory[player_name].start_i = 1 - inv.filter = fields.creative_filter:lower() - creative.update_creative_inventory(player_name) - creative.set_creative_formspec(player, 0) - else - local start_i = player_inventory[player_name].start_i or 0 - - if fields.creative_prev then - start_i = start_i - 3*8 - if start_i < 0 then - start_i = inv.size - (inv.size % (3*8)) - if inv.size == start_i then - start_i = math.max(0, inv.size - (3*8)) - end - end - elseif fields.creative_next then - start_i = start_i + 3*8 - if start_i >= inv.size then - start_i = 0 - end - end - - player_inventory[player_name].start_i = start_i - creative.set_creative_formspec(player, start_i) - end -end) - -if creative_mode then +if minetest.setting_getbool("creative_mode") then + -- Dig time is modified according to difference (leveldiff) between tool + -- 'maxlevel' and node 'level'. Digtime is divided by the larger of + -- leveldiff and 1. + -- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been + -- increased such that nodes of differing levels have an insignificant + -- effect on digtime. local digtime = 42 local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256} diff --git a/mods/creative/inventory.lua b/mods/creative/inventory.lua new file mode 100644 index 00000000..be24b3a2 --- /dev/null +++ b/mods/creative/inventory.lua @@ -0,0 +1,180 @@ +creative = {} +local player_inventory = {} + +function creative.init_creative_inventory(player) + local player_name = player:get_player_name() + player_inventory[player_name] = { + size = 0, + filter = "", + start_i = 0 + } + + minetest.create_detached_inventory("creative_" .. player_name, { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2) + if not to_list == "main" then + return count + else + return 0 + end + end, + allow_put = function(inv, listname, index, stack, player2) + return 0 + end, + allow_take = function(inv, listname, index, stack, player2) + return -1 + end, + on_move = function(inv, from_list, from_index, to_list, to_index, count, player2) + end, + on_put = function(inv, listname, index, stack, player2) + end, + on_take = function(inv, listname, index, stack, player2) + if stack and stack:get_count() > 0 then + minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory") + end + end, + }, player_name) + + creative.update_creative_inventory(player_name, minetest.registered_items) +end + +function creative.update_creative_inventory(player_name, tab_content) + local creative_list = {} + local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) + local inv = player_inventory[player_name] + if not inv then + creative.init_creative_inventory(minetest.get_player_by_name(player_name)) + end + + for name, def in pairs(tab_content) do + if not (def.groups.not_in_creative_inventory == 1) and + def.description and def.description ~= "" and + (def.name:find(inv.filter, 1, true) or + def.description:lower():find(inv.filter, 1, true)) then + creative_list[#creative_list+1] = name + end + end + + table.sort(creative_list) + player_inv:set_size("main", #creative_list) + player_inv:set_list("main", creative_list) + inv.size = #creative_list +end + +-- Create the trash field +local trash = minetest.create_detached_inventory("creative_trash", { + -- Allow the stack to be placed and remove it in on_put() + -- This allows the creative inventory to restore the stack + allow_put = function(inv, listname, index, stack, player) + return stack:get_count() + end, + on_put = function(inv, listname) + inv:set_list(listname, {}) + end, +}) +trash:set_size("main", 1) + +creative.formspec_add = "" + +function creative.register_tab(name, title, items) + sfinv.register_page("creative:" .. name, { + title = title, + is_in_nav = function(self, player, context) + return minetest.setting_getbool("creative_mode") + end, + get = function(self, player, context) + local player_name = player:get_player_name() + creative.update_creative_inventory(player_name, items) + local inv = player_inventory[player_name] + local start_i = inv.start_i or 0 + local pagenum = math.floor(start_i / (3*8) + 1) + local pagemax = math.ceil(inv.size / (3*8)) + return sfinv.make_formspec(player, context, + "label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" .. + [[ + image[4.06,3.4;0.8,0.8;creative_trash_icon.png] + listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] + list[current_player;main;0,4.7;8,1;] + list[current_player;main;0,5.85;8,3;8] + list[detached:creative_trash;main;4,3.3;1,1;] + listring[] + button[5.4,3.2;0.8,0.9;creative_prev;<] + button[7.25,3.2;0.8,0.9;creative_next;>] + button[2.1,3.4;0.8,0.5;creative_search;?] + button[2.75,3.4;0.8,0.5;creative_clear;X] + tooltip[creative_search;Search] + tooltip[creative_clear;Reset] + listring[current_player;main] + field_close_on_enter[creative_filter;false] + ]] .. + "field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" .. + "listring[detached:creative_" .. player_name .. ";main]" .. + "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" .. + default.get_hotbar_bg(0,4.7) .. + default.gui_bg .. default.gui_bg_img .. default.gui_slots + .. creative.formspec_add, false) + end, + on_enter = function(self, player, context) + local player_name = player:get_player_name() + local inv = player_inventory[player_name] + if inv then + inv.start_i = 0 + end + end, + on_player_receive_fields = function(self, player, context, fields) + local player_name = player:get_player_name() + local inv = player_inventory[player_name] + assert(inv) + + if fields.creative_clear then + inv.start_i = 0 + inv.filter = "" + creative.update_creative_inventory(player_name, items) + sfinv.set_player_inventory_formspec(player, context) + elseif fields.creative_search or + fields.key_enter_field == "creative_filter" then + inv.start_i = 0 + inv.filter = fields.creative_filter:lower() + creative.update_creative_inventory(player_name, items) + sfinv.set_player_inventory_formspec(player, context) + elseif not fields.quit then + local start_i = inv.start_i or 0 + + if fields.creative_prev then + start_i = start_i - 3*8 + if start_i < 0 then + start_i = inv.size - (inv.size % (3*8)) + if inv.size == start_i then + start_i = math.max(0, inv.size - (3*8)) + end + end + elseif fields.creative_next then + start_i = start_i + 3*8 + if start_i >= inv.size then + start_i = 0 + end + end + + inv.start_i = start_i + sfinv.set_player_inventory_formspec(player, context) + end + end + }) +end + +minetest.register_on_joinplayer(function(player) + creative.init_creative_inventory(player) +end) + +creative.register_tab("all", "All", minetest.registered_items) +creative.register_tab("nodes", "Nodes", minetest.registered_nodes) +creative.register_tab("tools", "Tools", minetest.registered_tools) +creative.register_tab("craftitems", "Items", minetest.registered_craftitems) + +local old_homepage_name = sfinv.get_homepage_name +function sfinv.get_homepage_name(player) + if minetest.setting_getbool("creative_mode") then + return "creative:all" + else + return old_homepage_name(player) + end +end diff --git a/mods/creative/license.txt b/mods/creative/license.txt new file mode 100644 index 00000000..4ad1d5ff --- /dev/null +++ b/mods/creative/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) + +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) 2016 Jean-Patrick G. (kilbith) + +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/mods/default/README.txt b/mods/default/README.txt index 85c5a4ef..d261b6b5 100644 --- a/mods/default/README.txt +++ b/mods/default/README.txt @@ -1,28 +1,18 @@ Minetest Game mod: default ========================== +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2011-2012 celeron55, Perttu Ahola +Authors of source code +---------------------- +Originally by celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) -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. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ +Authors of media (textures, models and sounds) +---------------------------------------------- Everything not listed in here: -Copyright (C) 2010-2012 celeron55, Perttu Ahola +celeron55, Perttu Ahola (CC BY-SA 3.0) -Cisoun's WTFPL texture pack: +Cisoun's texture pack (CC BY-SA 3.0): default_jungletree.png default_lava.png default_leaves.png @@ -32,59 +22,57 @@ Cisoun's WTFPL texture pack: default_tree_top.png default_water.png -Cisoun's conifers mod (WTFPL): +Cisoun's conifers mod (CC BY-SA 3.0): default_pine_needles.png -Originating from G4JC's Almost MC Texture Pack: +Originating from G4JC's Almost MC Texture Pack (CC BY-SA 3.0): default_torch.png default_torch_on_ceiling.png default_torch_on_floor.png -VanessaE's animated torches (WTFPL): +VanessaE's animated torches (CC BY-SA 3.0): default_torch_animated.png default_torch_on_ceiling_animated.png default_torch_on_floor_animated.png default_torch_on_floor.png -RealBadAngel's animated water (WTFPL): +RealBadAngel's animated water (CC BY-SA 3.0): default_water_source_animated.png default_water_flowing_animated.png -VanessaE (WTFPL): +VanessaE (CC BY-SA 3.0): default_desert_sand.png default_desert_stone.png default_sand.png default_mese_crystal.png default_mese_crystal_fragment.png -Calinou (CC BY-SA): +Calinou (CC BY-SA 3.0): default_brick.png default_papyrus.png default_mineral_copper.png default_glass_detail.png -MirceaKitsune (WTFPL): +MirceaKitsune (CC BY-SA 3.0): character.x Jordach (CC BY-SA 3.0): character.png -PilzAdam (WTFPL): +PilzAdam (CC BY-SA 3.0): default_jungleleaves.png default_junglesapling.png default_obsidian_glass.png default_obsidian_shard.png default_mineral_gold.png - default_snowball.png -jojoa1997 (WTFPL): +jojoa1997 (CC BY-SA 3.0): default_obsidian.png -InfinityProject (WTFPL): +InfinityProject (CC BY-SA 3.0): default_mineral_diamond.png Splizard (CC BY-SA 3.0): - default_snow.png default_pine_sapling.png Zeg9 (CC BY-SA 3.0): @@ -100,10 +88,13 @@ paramat (CC BY-SA 3.0): default_pinetree_top.png default_pinewood.png default_acacia_leaves.png + default_acacia_leaves_simple.png default_acacia_sapling.png default_acacia_tree.png default_acacia_tree_top.png default_acacia_wood.png + default_acacia_bush_stem.png + default_bush_stem.png default_junglewood.png default_jungletree_top.png default_sandstone_brick.png @@ -122,8 +113,8 @@ paramat (CC BY-SA 3.0): default_dry_grass_*.png default_grass.png default_grass_side.png - default_snow_side.png default_mese_block.png + default_silver_sand.png brunob.santos (CC BY-SA 4.0): default_desert_cobble.png @@ -149,6 +140,9 @@ BlockMen (CC BY-SA 3.0): bubble.png gui_*.png +Wuzzy (CC BY-SA 3.0): + default_bookshelf_slot.png (based on default_book.png) + sofar (CC BY-SA 3.0): default_book_written.png, based on default_book.png default_aspen_sapling @@ -156,18 +150,17 @@ sofar (CC BY-SA 3.0): default_aspen_tree default_aspen_tree_top, derived from default_pine_tree_top (by paramat) default_aspen_wood, derived from default_pine_wood (by paramat) - -sofar (WTFPL): default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel Neuromancer (CC BY-SA 2.0): default_cobble.png, based on texture by Brane praefect default_mossycobble.png, based on texture by Brane praefect + Neuromancer (CC BY-SA 3.0): default_dirt.png default_furnace_*.png -Gambit (WTFPL): +Gambit (CC BY-SA 3.0): default_bronze_ingot.png default_copper_ingot.png default_copper_lump.png @@ -181,19 +174,37 @@ Gambit (WTFPL): default_ladder_steel.png default_sign_wall_wood.png default_flint.png + default_snow.png + default_snow_side.png + default_snowball.png + default_key.png + default_key_skeleton.png -asl97 (WTFPL): +asl97 (CC BY-SA 3.0): default_ice.png KevDoy (CC BY-SA 3.0) heart.png +Pithydon (CC BY-SA 3.0) + default_coral_brown.png + default_coral_orange.png + default_coral_skeleton.png + +Ferk (CC0 1.0) + default_item_smoke.png + default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart + Glass breaking sounds (CC BY 3.0): 1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ 2: http://www.freesound.org/people/Tomlija/sounds/97669/ 3: http://www.freesound.org/people/lsprice/sounds/88808/ -Mito551 (sounds) (CC BY-SA): +sonictechtonic (CC BY 3.0): +https://www.freesound.org/people/sonictechtonic/sounds/241872/ + player_damage.ogg + +Mito551 (sounds) (CC BY-SA 3.0): default_dig_choppy.ogg default_dig_cracky.ogg default_dig_crumbly.1.ogg @@ -227,3 +238,27 @@ Mito551 (sounds) (CC BY-SA): default_dirt_footstep.1.ogg default_dirt_footstep.2.ogg default_glass_footstep.ogg + +Metal sounds: + default_dig_metal.ogg - yadronoff - CC-BY-3.0 + - https://www.freesound.org/people/yadronoff/sounds/320397/ + default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0 + - http://opengameart.org/users/qubodup + default_metal_footstep.*.ogg - Ottomaani138 - CC0 + - https://www.freesound.org/people/Ottomaani138/sounds/232692/ + default_place_node_metal.*.ogg - Ogrebane - CC0 + - http://opengameart.org/content/wood-and-metal-sound-effects-volume-2 + +Tool breaking sounds added by sofar: CC-BY-3.0 + default_tool_breaks.* - http://www.freesound.org/people/HerbertBoland/sounds/33206/ + +AGFX (CC BY 3.0) +https://www.freesound.org/people/AGFX/packs/1253/ + default_water_footstep.1.ogg + default_water_footstep.2.ogg + default_water_footstep.3.ogg +(default_water_footstep.4.ogg is silent) + +blukotek (CC0 1.0) +https://www.freesound.org/people/blukotek/sounds/251660/ + default_dig_snappy.ogg diff --git a/mods/default/aliases.lua b/mods/default/aliases.lua index 1a877ecf..c871a800 100644 --- a/mods/default/aliases.lua +++ b/mods/default/aliases.lua @@ -23,7 +23,7 @@ minetest.register_alias("papyrus", "default:papyrus") minetest.register_alias("bookshelf", "default:bookshelf") minetest.register_alias("glass", "default:glass") minetest.register_alias("wooden_fence", "default:fence_wood") -minetest.register_alias("rail", "default:rail") +minetest.register_alias("rail", "carts:rail") minetest.register_alias("ladder", "default:ladder_wood") minetest.register_alias("default:ladder_wood", "default:ladder") minetest.register_alias("wood", "default:wood") diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index 1151f47b..483245c2 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -35,6 +35,20 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = 'default:wood', + recipe = { + {'default:bush_stem'}, + } +}) + +minetest.register_craft({ + output = 'default:acacia_wood', + recipe = { + {'default:acacia_bush_stem'}, + } +}) + minetest.register_craft({ output = 'default:stick 4', recipe = { @@ -339,11 +353,9 @@ minetest.register_craft({ }) minetest.register_craft({ - output = 'default:rail 24', + output = 'default:skeleton_key', recipe = { - {'default:steel_ingot', '', 'default:steel_ingot'}, - {'default:steel_ingot', 'group:stick', 'default:steel_ingot'}, - {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:gold_ingot'}, } }) @@ -776,16 +788,185 @@ minetest.register_craft({ recipe = "default:clay_lump", }) +minetest.register_craft({ + type = 'cooking', + output = 'default:gold_ingot', + recipe = 'default:skeleton_key', + cooktime = 5, +}) + +minetest.register_craft({ + type = 'cooking', + output = 'default:gold_ingot', + recipe = 'default:key', + cooktime = 5, +}) + -- -- Fuels -- +-- Support use of group:tree minetest.register_craft({ type = "fuel", recipe = "group:tree", burntime = 30, }) +-- Burn time for all woods are in order of wood density, +-- which is also the order of wood colour darkness: +-- aspen, pine, apple, acacia, jungle + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_tree", + burntime = 22, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_tree", + burntime = 26, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:tree", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_tree", + burntime = 34, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:jungletree", + burntime = 38, +}) + + +-- Support use of group:wood +minetest.register_craft({ + type = "fuel", + recipe = "group:wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_wood", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_wood", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglewood", + burntime = 9, +}) + + +-- Support use of group:sapling +minetest.register_craft({ + type = "fuel", + recipe = "group:sapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_sapling", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_sapling", + burntime = 9, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_sapling", + burntime = 11, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglesapling", + burntime = 12, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_aspen_wood", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_pine_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_acacia_wood", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_junglewood", + burntime = 9, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:bush_stem", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_bush_stem", + burntime = 8, +}) + minetest.register_craft({ type = "fuel", recipe = "default:junglegrass", @@ -816,46 +997,10 @@ minetest.register_craft({ burntime = 30, }) -minetest.register_craft({ - type = "fuel", - recipe = "default:fence_wood", - burntime = 15, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "default:fence_acacia_wood", - burntime = 15, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "default:fence_junglewood", - burntime = 15, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "default:fence_pine_wood", - burntime = 15, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "default:fence_aspen_wood", - burntime = 15, -}) - minetest.register_craft({ type = "fuel", recipe = "default:ladder_wood", - burntime = 5, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "group:wood", - burntime = 7, + burntime = 2, }) minetest.register_craft({ @@ -888,12 +1033,6 @@ minetest.register_craft({ burntime = 30, }) -minetest.register_craft({ - type = "fuel", - recipe = "group:sapling", - burntime = 10, -}) - minetest.register_craft({ type = "fuel", recipe = "default:apple", @@ -923,3 +1062,58 @@ minetest.register_craft({ recipe = "default:dry_grass_1", burntime = 2, }) + +minetest.register_craft({ + type = "fuel", + recipe = "default:paper", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:book", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:book_written", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:dry_shrub", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "group:stick", + burntime = 1, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:pick_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:shovel_wood", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:axe_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sword_wood", + burntime = 5, +}) diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua index d821af06..0c51c713 100644 --- a/mods/default/craftitems.lua +++ b/mods/default/craftitems.lua @@ -3,12 +3,13 @@ minetest.register_craftitem("default:stick", { description = "Stick", inventory_image = "default_stick.png", - groups = {stick = 1}, + groups = {stick = 1, flammable = 2}, }) minetest.register_craftitem("default:paper", { description = "Paper", inventory_image = "default_paper.png", + groups = {flammable = 3}, }) local lpp = 14 -- Lines per book's page @@ -105,7 +106,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) elseif fields.book_next or fields.book_prev then local data = minetest.deserialize(stack:get_metadata()) - if not data.page then return end + if not data or not data.page then + return + end if fields.book_next then data.page = data.page + 1 @@ -130,14 +133,14 @@ end) minetest.register_craftitem("default:book", { description = "Book", inventory_image = "default_book.png", - groups = {book = 1}, + groups = {book = 1, flammable = 3}, on_use = book_on_use, }) minetest.register_craftitem("default:book_written", { description = "Book With Text", inventory_image = "default_book_written.png", - groups = {book = 1, not_in_creative_inventory = 1}, + groups = {book = 1, not_in_creative_inventory = 1, flammable = 3}, stack_max = 1, on_use = book_on_use, }) @@ -174,7 +177,7 @@ end) minetest.register_craftitem("default:coal_lump", { description = "Coal Lump", inventory_image = "default_coal_lump.png", - groups = {coal = 1} + groups = {coal = 1, flammable = 1} }) minetest.register_craftitem("default:iron_lump", { diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 9ca83db2..e8b20781 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -88,13 +88,36 @@ end function default.node_sound_glass_defaults(table) table = table or {} table.footstep = table.footstep or - {name = "default_glass_footstep", gain = 0.5} + {name = "default_glass_footstep", gain = 0.25} + table.dig = table.dig or + {name = "default_glass_footstep", gain = 0.45} table.dug = table.dug or {name = "default_break_glass", gain = 1.0} default.node_sound_defaults(table) return table end +function default.node_sound_metal_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_metal_footstep", gain = 0.5} + table.dig = table.dig or + {name = "default_dig_metal", gain = 0.5} + table.dug = table.dug or + {name = "default_dug_metal", gain = 0.5} + table.place = table.place or + {name = "default_place_node_metal", gain = 0.5} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_water_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_water_footstep", gain = 0.2} + default.node_sound_defaults(table) + return table +end -- -- Lavacooling @@ -122,7 +145,7 @@ end minetest.register_abm({ label = "Lava cooling", nodenames = {"default:lava_source", "default:lava_flowing"}, - neighbors = {"group:water"}, + neighbors = {"group:cools_lava", "group:water"}, interval = 1, chance = 1, catch_up = false, @@ -333,7 +356,7 @@ minetest.register_abm({ end -- Remove node minetest.remove_node(pos) - nodeupdate(pos) + minetest.check_for_falling(pos) end }) @@ -346,47 +369,36 @@ minetest.register_abm({ label = "Grass spread", nodenames = {"default:dirt"}, neighbors = { - "default:dirt_with_grass", - "default:dirt_with_dry_grass", - "default:dirt_with_snow", + "air", "group:grass", "group:dry_grass", "default:snow", }, interval = 6, - chance = 67, + chance = 50, catch_up = false, action = function(pos, node) - -- Most likely case, half the time it's too dark for this. + -- Check for darkness: night, shadow or under a light-blocking node + -- Returns if ignore above local above = {x = pos.x, y = pos.y + 1, z = pos.z} if (minetest.get_node_light(above) or 0) < 13 then return end - -- Look for likely neighbors. - local p2 = minetest.find_node_near(pos, 1, {"default:dirt_with_grass", - "default:dirt_with_dry_grass", "default:dirt_with_snow"}) + -- Look for spreading dirt-type neighbours + local p2 = minetest.find_node_near(pos, 1, "group:spreading_dirt_type") if p2 then - -- But the node needs to be under air in this case. - local n2 = minetest.get_node(above) - if n2 and n2.name == "air" then - local n3 = minetest.get_node(p2) - minetest.set_node(pos, {name = n3.name}) - return - end - end - - -- Anything on top? - local n2 = minetest.get_node(above) - if not n2 then + local n3 = minetest.get_node(p2) + minetest.set_node(pos, {name = n3.name}) return end - local name = n2.name - -- Snow check is cheapest, so comes first. + -- Else, any seeding nodes on top? + local name = minetest.get_node(above).name + -- Snow check is cheapest, so comes first if name == "default:snow" then minetest.set_node(pos, {name = "default:dirt_with_snow"}) - -- Most likely case first. + -- Most likely case first elseif minetest.get_item_group(name, "grass") ~= 0 then minetest.set_node(pos, {name = "default:dirt_with_grass"}) elseif minetest.get_item_group(name, "dry_grass") ~= 0 then @@ -402,11 +414,7 @@ minetest.register_abm({ minetest.register_abm({ label = "Grass covered", - nodenames = { - "default:dirt_with_grass", - "default:dirt_with_dry_grass", - "default:dirt_with_snow", - }, + nodenames = {"group:spreading_dirt_type"}, interval = 8, chance = 50, catch_up = false, @@ -429,7 +437,7 @@ minetest.register_abm({ minetest.register_abm({ label = "Moss growth", - nodenames = {"default:stone", "default:cobble", "default:stonebrick", "stairs:slab_cobble", "stairs:stair_cobble"}, + nodenames = {"default:stone", "default:cobble", "default:stonebrick", "stairs:slab_cobble", "stairs:stair_cobble", "stairs:slab_cobble", "walls:cobble"}, neighbors = {"group:water"}, interval = 16, chance = 200, @@ -445,6 +453,8 @@ minetest.register_abm({ minetest.set_node(pos, {name = "stairs:slab_mossycobble", param2 = node.param2}) elseif node.name == "stairs:stair_cobble" then minetest.set_node(pos, {name = "stairs:stair_mossycobble", param2 = node.param2}) + elseif node.name == "walls:cobble" then + minetest.set_node(pos, {name = "walls:mossycobble", param2 = node.param2}) end end }) @@ -488,3 +498,19 @@ function default.intersects_protection(minp, maxp, player_name, interval) return false end + + +-- +-- Coral death near air +-- + +minetest.register_abm({ + nodenames = {"default:coral_brown", "default:coral_orange"}, + neighbors = {"air"}, + interval = 17, + chance = 5, + catch_up = false, + action = function(pos, node) + minetest.set_node(pos, {name = "default:coral_skeleton"}) + end, +}) diff --git a/mods/default/furnace.lua b/mods/default/furnace.lua index b5bca889..fed7cf2e 100644 --- a/mods/default/furnace.lua +++ b/mods/default/furnace.lua @@ -4,7 +4,7 @@ -- local function active_formspec(fuel_percent, item_percent) - local formspec = + local formspec = "size[8,8.5]".. default.gui_bg.. default.gui_bg_img.. @@ -22,6 +22,8 @@ local function active_formspec(fuel_percent, item_percent) "listring[current_player;main]".. "listring[current_name;src]".. "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_player;main]".. default.get_hotbar_bg(0, 4.25) return formspec end @@ -42,6 +44,8 @@ local inactive_formspec = "listring[current_player;main]".. "listring[current_name;src]".. "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_player;main]".. default.get_hotbar_bg(0, 4.25) -- @@ -109,62 +113,70 @@ local function furnace_node_timer(pos, elapsed) local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 local inv = meta:get_inventory() - local srclist = inv:get_list("src") - local fuellist = inv:get_list("fuel") + local srclist, fuellist - -- - -- Cooking - -- + local cookable, cooked - -- Check if we have cookable content - local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - local cookable = true + local update = true + while update do + update = false - if cooked.time == 0 then - cookable = false - end + srclist = inv:get_list("src") + fuellist = inv:get_list("fuel") - -- Check if we have enough fuel to burn - if fuel_time < fuel_totaltime then - -- The furnace is currently active and has enough fuel - fuel_time = fuel_time + 1 + -- + -- Cooking + -- - -- If there is a cookable item then check if it is ready yet - if cookable then - src_time = src_time + 1 - if src_time >= cooked.time then - -- Place result in dst list if possible - if inv:room_for_item("dst", cooked.item) then - inv:add_item("dst", cooked.item) - inv:set_stack("src", 1, aftercooked.items[1]) - src_time = 0 + -- Check if we have cookable content + local aftercooked + cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + cookable = cooked.time ~= 0 + + -- Check if we have enough fuel to burn + if fuel_time < fuel_totaltime then + -- The furnace is currently active and has enough fuel + fuel_time = fuel_time + elapsed + -- If there is a cookable item then check if it is ready yet + if cookable then + src_time = src_time + elapsed + if src_time >= cooked.time then + -- Place result in dst list if possible + if inv:room_for_item("dst", cooked.item) then + inv:add_item("dst", cooked.item) + inv:set_stack("src", 1, aftercooked.items[1]) + src_time = src_time - cooked.time + update = true + end end end - end - else - -- Furnace ran out of fuel - if cookable then - -- We need to get new fuel - local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) - - if fuel.time == 0 then - -- No valid fuel in fuel list - fuel_totaltime = 0 - fuel_time = 0 - src_time = 0 - else - -- Take fuel from fuel list - inv:set_stack("fuel", 1, afterfuel.items[1]) - - fuel_totaltime = fuel.time - fuel_time = 0 - end else - -- We don't need to get new fuel since there is no cookable item - fuel_totaltime = 0 + -- Furnace ran out of fuel + if cookable then + -- We need to get new fuel + local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + + if fuel.time == 0 then + -- No valid fuel in fuel list + fuel_totaltime = 0 + src_time = 0 + else + -- Take fuel from fuel list + inv:set_stack("fuel", 1, afterfuel.items[1]) + update = true + + fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) + src_time = src_time + elapsed + end + else + -- We don't need to get new fuel since there is no cookable item + fuel_totaltime = 0 + src_time = 0 + end fuel_time = 0 - src_time = 0 end + + elapsed = 0 end -- @@ -175,7 +187,11 @@ local function furnace_node_timer(pos, elapsed) local item_percent = 0 if cookable then item_percent = math.floor(src_time / cooked.time * 100) - item_state = item_percent .. "%" + if item_percent > 100 then + item_state = "100% (output full)" + else + item_state = item_percent .. "%" + end else if srclist[1]:is_empty() then item_state = "Empty" @@ -188,7 +204,7 @@ local function furnace_node_timer(pos, elapsed) local active = "inactive " local result = false - if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then + if fuel_totaltime ~= 0 then active = "active " local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) fuel_state = fuel_percent .. "%" @@ -202,8 +218,7 @@ local function furnace_node_timer(pos, elapsed) end swap_node(pos, "default:furnace") -- stop timer on the inactive furnace - local timer = minetest.get_node_timer(pos) - timer:stop() + minetest.get_node_timer(pos):stop() end local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" @@ -251,13 +266,11 @@ minetest.register_node("default:furnace", { end, on_metadata_inventory_move = function(pos) - local timer = minetest.get_node_timer(pos) - timer:start(1.0) + minetest.get_node_timer(pos):start(1.0) end, on_metadata_inventory_put = function(pos) -- start timer function, it will sort out whether furnace can burn or not. - local timer = minetest.get_node_timer(pos) - timer:start(1.0) + minetest.get_node_timer(pos):start(1.0) end, on_blast = function(pos) local drops = {} diff --git a/mods/default/init.lua b/mods/default/init.lua index 0f1e2c68..4e73c7bc 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -41,7 +41,9 @@ dofile(default_path.."/functions.lua") dofile(default_path.."/trees.lua") dofile(default_path.."/nodes.lua") dofile(default_path.."/furnace.lua") +dofile(default_path.."/torch.lua") dofile(default_path.."/tools.lua") +dofile(default_path.."/item_entity.lua") dofile(default_path.."/craftitems.lua") dofile(default_path.."/crafting.lua") dofile(default_path.."/mapgen.lua") diff --git a/mods/default/item_entity.lua b/mods/default/item_entity.lua new file mode 100644 index 00000000..c34e60e9 --- /dev/null +++ b/mods/default/item_entity.lua @@ -0,0 +1,74 @@ +-- mods/default/item_entity.lua + +local builtin_item = minetest.registered_entities["__builtin:item"] + +local item = { + set_item = function(self, itemstring) + builtin_item.set_item(self, itemstring) + + local stack = ItemStack(itemstring) + local itemdef = minetest.registered_items[stack:get_name()] + if itemdef and itemdef.groups.flammable ~= 0 then + self.flammable = itemdef.groups.flammable + end + end, + + burn_up = function(self) + -- disappear in a smoke puff + self.object:remove() + local p = self.object:getpos() + minetest.sound_play("default_item_smoke", { + pos = p, + max_hear_distance = 8, + }) + minetest.add_particlespawner({ + amount = 3, + time = 0.1, + minpos = {x = p.x - 0.1, y = p.y + 0.1, z = p.z - 0.1 }, + maxpos = {x = p.x + 0.1, y = p.y + 0.2, z = p.z + 0.1 }, + minvel = {x = 0, y = 2.5, z = 0}, + maxvel = {x = 0, y = 2.5, z = 0}, + minacc = {x = -0.15, y = -0.02, z = -0.15}, + maxacc = {x = 0.15, y = -0.01, z = 0.15}, + minexptime = 4, + maxexptime = 6, + minsize = 5, + maxsize = 5, + collisiondetection = true, + texture = "default_item_smoke.png" + }) + end, + + on_step = function(self, dtime) + builtin_item.on_step(self, dtime) + + if self.flammable then + -- flammable, check for igniters + self.ignite_timer = (self.ignite_timer or 0) + dtime + if self.ignite_timer > 10 then + self.ignite_timer = 0 + + local node = minetest.get_node_or_nil(self.object:getpos()) + if not node then + return + end + + -- Immediately burn up flammable items in lava + if minetest.get_item_group(node.name, "lava") > 0 then + self:burn_up() + else + -- otherwise there'll be a chance based on its igniter value + local burn_chance = self.flammable + * minetest.get_item_group(node.name, "igniter") + if burn_chance > 0 and math.random(0, burn_chance) ~= 0 then + self:burn_up() + end + end + end + end + end, +} + +-- set defined item as new __builtin:item, with the old one as fallback table +setmetatable(item, builtin_item) +minetest.register_entity(":__builtin:item", item) diff --git a/mods/default/legacy.lua b/mods/default/legacy.lua index 76fcc8ed..a8c8ad56 100644 --- a/mods/default/legacy.lua +++ b/mods/default/legacy.lua @@ -1,6 +1,6 @@ -- mods/default/legacy.lua --- Horrible crap to support old code registering falling nodes +-- Horrible stuff to support old code registering falling nodes -- Don't use this and never do what this does, it's completely wrong! -- (More specifically, the client and the C++ code doesn't get the group) function default.register_falling_node(nodename, texture) diff --git a/mods/default/license.txt b/mods/default/license.txt new file mode 100644 index 00000000..e9267366 --- /dev/null +++ b/mods/default/license.txt @@ -0,0 +1,174 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2011-2016 Various Minetest developers and contributors + +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, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2010-2016: + celeron55, Perttu Ahola + Cisoun + G4JC + VanessaE + RealBadAngel + Calinou + MirceaKitsune + Jordach + PilzAdam + jojoa1997 + InfinityProject + Splizard + Zeg9 + paramat + BlockMen + sofar + Neuromancer + Gambit + asl97 + KevDoy + Mito551 + +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/ + +----------------------- + +Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +Copyright (C) 2014-2016 brunob.santos + +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/4.0/ + +----------------------- + +Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0) +Copyright (C) 2014-2016 Neuromancer + + +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/2.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2009 cmusounddesign +Copyright (C) 2010 Tomlija +Copyright (C) 2010 lsprice +Copyright (C) 2014 sonictechtonic +Copyright (C) 2015 yadronoff +Copyright (C) 2007 HerbertBoland +Copyright (C) 2006 AGFX + +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. + +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/3.0/ diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua index 52aa294c..d786a841 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -43,6 +43,7 @@ minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstonebr -- function default.register_ores() + minetest.clear_registered_ores() -- Blob ores -- These first to avoid other ores in blobs @@ -109,6 +110,8 @@ function default.register_ores() octaves = 1, persist = 0.0 }, + biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest", + "deciduous_forest", "savanna", "rainforest"} }) -- Gravel @@ -379,10 +382,10 @@ end function default.register_biomes() minetest.clear_registered_biomes() - -- Permanent ice + -- Icesheet minetest.register_biome({ - name = "glacier", + name = "icesheet", node_dust = "default:snowblock", node_top = "default:snowblock", depth_top = 1, @@ -398,36 +401,36 @@ function default.register_biomes() y_min = -8, y_max = 31000, heat_point = 0, - humidity_point = 50, + humidity_point = 73, }) minetest.register_biome({ - name = "glacier_ocean", + name = "icesheet_ocean", node_dust = "default:snowblock", node_top = "default:sand", depth_top = 1, node_filler = "default:sand", depth_filler = 3, --node_stone = "", - --node_water_top = "", - --depth_water_top = , + node_water_top = "default:ice", + depth_water_top = 10, --node_water = "", --node_river_water = "", y_min = -112, y_max = -9, heat_point = 0, - humidity_point = 50, + humidity_point = 73, }) - -- Cold + -- Tundra minetest.register_biome({ name = "tundra", - --node_dust = "", - node_top = "default:dirt_with_snow", - depth_top = 1, - node_filler = "default:dirt", - depth_filler = 1, + node_dust = "default:snowblock", + --node_top = , + --depth_top = , + --node_filler = , + --depth_filler = , --node_stone = "", --node_water_top = "", --depth_water_top = , @@ -437,8 +440,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = 2, y_max = 31000, - heat_point = 15, - humidity_point = 35, + heat_point = 0, + humidity_point = 40, }) minetest.register_biome({ @@ -457,8 +460,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = -3, y_max = 1, - heat_point = 15, - humidity_point = 35, + heat_point = 0, + humidity_point = 40, }) minetest.register_biome({ @@ -477,10 +480,11 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = -4, - heat_point = 15, - humidity_point = 35, + heat_point = 0, + humidity_point = 40, }) + -- Taiga minetest.register_biome({ name = "taiga", @@ -498,8 +502,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = 2, y_max = 31000, - heat_point = 15, - humidity_point = 65, + heat_point = 25, + humidity_point = 70, }) minetest.register_biome({ @@ -518,16 +522,16 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = 1, - heat_point = 15, - humidity_point = 65, + heat_point = 25, + humidity_point = 70, }) - -- Temperate + -- Snowy grassland minetest.register_biome({ - name = "stone_grassland", - --node_dust = "", - node_top = "default:dirt_with_grass", + name = "snowy_grassland", + node_dust = "default:snow", + node_top = "default:dirt_with_snow", depth_top = 1, node_filler = "default:dirt", depth_filler = 1, @@ -538,34 +542,14 @@ function default.register_biomes() --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = 6, - y_max = 31000, - heat_point = 40, - humidity_point = 35, - }) - - minetest.register_biome({ - name = "stone_grassland_dunes", - --node_dust = "", - node_top = "default:sand", - depth_top = 1, - node_filler = "default:sand", - depth_filler = 2, - --node_stone = "", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - node_riverbed = "default:sand", - depth_riverbed = 2, y_min = 5, - y_max = 5, - heat_point = 40, + y_max = 31000, + heat_point = 20, humidity_point = 35, }) minetest.register_biome({ - name = "stone_grassland_ocean", + name = "snowy_grassland_ocean", --node_dust = "", node_top = "default:sand", depth_top = 1, @@ -580,10 +564,73 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 40, + heat_point = 20, humidity_point = 35, }) + -- Grassland + + minetest.register_biome({ + name = "grassland", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 6, + y_max = 31000, + heat_point = 50, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "grassland_dunes", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 2, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 5, + heat_point = 50, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "grassland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 50, + humidity_point = 35, + }) + + -- Coniferous forest minetest.register_biome({ name = "coniferous_forest", @@ -601,8 +648,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = 6, y_max = 31000, - heat_point = 40, - humidity_point = 65, + heat_point = 45, + humidity_point = 70, }) minetest.register_biome({ @@ -621,8 +668,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = 5, y_max = 5, - heat_point = 40, - humidity_point = 65, + heat_point = 45, + humidity_point = 70, }) minetest.register_biome({ @@ -641,71 +688,11 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 40, - humidity_point = 65, - }) - - - minetest.register_biome({ - name = "sandstone_grassland", - --node_dust = "", - node_top = "default:dirt_with_grass", - depth_top = 1, - node_filler = "default:dirt", - depth_filler = 1, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - node_riverbed = "default:sand", - depth_riverbed = 2, - y_min = 6, - y_max = 31000, - heat_point = 60, - humidity_point = 35, - }) - - minetest.register_biome({ - name = "sandstone_grassland_dunes", - --node_dust = "", - node_top = "default:sand", - depth_top = 1, - node_filler = "default:sand", - depth_filler = 2, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - node_riverbed = "default:sand", - depth_riverbed = 2, - y_min = 5, - y_max = 5, - heat_point = 60, - humidity_point = 35, - }) - - minetest.register_biome({ - name = "sandstone_grassland_ocean", - --node_dust = "", - node_top = "default:sand", - depth_top = 1, - node_filler = "default:sand", - depth_filler = 3, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - node_riverbed = "default:sand", - depth_riverbed = 2, - y_min = -112, - y_max = 4, - heat_point = 60, - humidity_point = 35, + heat_point = 45, + humidity_point = 70, }) + -- Deciduous forest minetest.register_biome({ name = "deciduous_forest", @@ -724,11 +711,11 @@ function default.register_biomes() y_min = 1, y_max = 31000, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) minetest.register_biome({ - name = "deciduous_forest_swamp", + name = "deciduous_forest_shore", --node_dust = "", node_top = "default:dirt", depth_top = 1, @@ -741,10 +728,10 @@ function default.register_biomes() --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = -3, + y_min = -1, y_max = 0, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) minetest.register_biome({ @@ -762,12 +749,12 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = -112, - y_max = -4, + y_max = -2, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) - -- Hot + -- Desert minetest.register_biome({ name = "desert", @@ -785,8 +772,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = 5, y_max = 31000, - heat_point = 85, - humidity_point = 20, + heat_point = 92, + humidity_point = 16, }) minetest.register_biome({ @@ -805,10 +792,95 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 85, - humidity_point = 20, + heat_point = 92, + humidity_point = 16, }) + -- Sandstone desert + + minetest.register_biome({ + name = "sandstone_desert", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 0, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 31000, + heat_point = 60, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "sandstone_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 60, + humidity_point = 0, + }) + + -- Cold desert + + minetest.register_biome({ + name = "cold_desert", + --node_dust = "", + node_top = "default:silver_sand", + depth_top = 1, + node_filler = "default:silver_sand", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 31000, + heat_point = 40, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "cold_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 40, + humidity_point = 0, + }) + + -- Savanna minetest.register_biome({ name = "savanna", @@ -826,12 +898,12 @@ function default.register_biomes() depth_riverbed = 2, y_min = 1, y_max = 31000, - heat_point = 85, - humidity_point = 50, + heat_point = 89, + humidity_point = 42, }) minetest.register_biome({ - name = "savanna_swamp", + name = "savanna_shore", --node_dust = "", node_top = "default:dirt", depth_top = 1, @@ -844,10 +916,10 @@ function default.register_biomes() --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = -3, + y_min = -1, y_max = 0, - heat_point = 85, - humidity_point = 50, + heat_point = 89, + humidity_point = 42, }) minetest.register_biome({ @@ -865,11 +937,12 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = -112, - y_max = -4, - heat_point = 85, - humidity_point = 50, + y_max = -2, + heat_point = 89, + humidity_point = 42, }) + -- Rainforest minetest.register_biome({ name = "rainforest", @@ -887,8 +960,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = 1, y_max = 31000, - heat_point = 85, - humidity_point = 80, + heat_point = 86, + humidity_point = 65, }) minetest.register_biome({ @@ -905,10 +978,10 @@ function default.register_biomes() --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = -3, + y_min = -1, y_max = 0, - heat_point = 85, - humidity_point = 80, + heat_point = 86, + humidity_point = 65, }) minetest.register_biome({ @@ -926,9 +999,9 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = -112, - y_max = -4, - heat_point = 85, - humidity_point = 80, + y_max = -2, + heat_point = 86, + humidity_point = 65, }) -- Underground @@ -1047,7 +1120,8 @@ function default.register_mgv6_decorations() }) end --- All mapgens except mgv6 and singlenode + +-- All mapgens except mgv6 local function register_grass_decoration(offset, scale, length) minetest.register_decoration({ @@ -1062,13 +1136,11 @@ local function register_grass_decoration(offset, scale, length) octaves = 3, persist = 0.6 }, - biomes = {"stone_grassland", "sandstone_grassland", - "deciduous_forest", "coniferous_forest", - "stone_grassland_dunes", "sandstone_grassland_dunes", - "coniferous_forest_dunes"}, + biomes = {"grassland", "grassland_dunes", "deciduous_forest", + "coniferous_forest", "coniferous_forest_dunes"}, y_min = 1, y_max = 31000, - decoration = "default:grass_"..length, + decoration = "default:grass_" .. length, }) end @@ -1088,10 +1160,11 @@ local function register_dry_grass_decoration(offset, scale, length) biomes = {"savanna"}, y_min = 1, y_max = 31000, - decoration = "default:dry_grass_"..length, + decoration = "default:dry_grass_" .. length, }) end + function default.register_decorations() minetest.clear_registered_decorations() @@ -1112,7 +1185,7 @@ function default.register_decorations() biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/apple_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts", flags = "place_center_x, place_center_z", }) @@ -1157,9 +1230,9 @@ function default.register_decorations() sidelen = 80, fill_ratio = 0.1, biomes = {"rainforest", "rainforest_swamp"}, - y_min = 0, + y_min = -1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/jungle_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) @@ -1207,7 +1280,7 @@ function default.register_decorations() biomes = {"taiga", "coniferous_forest"}, y_min = 2, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/pine_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts", flags = "place_center_x, place_center_z", }) @@ -1261,7 +1334,7 @@ function default.register_decorations() biomes = {"savanna"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/acacia_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) @@ -1313,7 +1386,7 @@ function default.register_decorations() biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/aspen_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/aspen_tree.mts", flags = "place_center_x, place_center_z", }) @@ -1349,6 +1422,7 @@ function default.register_decorations() flags = "place_center_x", rotation = "random", }) + -- Large cactus minetest.register_decoration({ @@ -1366,7 +1440,7 @@ function default.register_decorations() biomes = {"desert"}, y_min = 5, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/large_cactus.mts", + schematic = minetest.get_modpath("default") .. "/schematics/large_cactus.mts", flags = "place_center_x", rotation = "random", }) @@ -1407,10 +1481,52 @@ function default.register_decorations() octaves = 3, persist = 0.7 }, - biomes = {"savanna_swamp"}, + biomes = {"savanna_shore"}, y_min = 0, y_max = 0, - schematic = minetest.get_modpath("default").."/schematics/papyrus.mts", + schematic = minetest.get_modpath("default") .. "/schematics/papyrus.mts", + }) + + -- Bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 137, + octaves = 3, + persist = 0.7, + }, + biomes = {"snowy_grassland", "grassland", "deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/bush.mts", + flags = "place_center_x, place_center_z", + }) + + -- Acacia bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 90155, + octaves = 3, + persist = 0.7, + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_bush.mts", + flags = "place_center_x, place_center_z", }) -- Grasses @@ -1446,7 +1562,8 @@ function default.register_decorations() minetest.register_decoration({ deco_type = "simple", - place_on = {"default:desert_sand", "default:dirt_with_snow"}, + place_on = {"default:desert_sand", + "default:sand", "default:silver_sand"}, sidelen = 16, noise_params = { offset = 0, @@ -1456,11 +1573,36 @@ function default.register_decorations() octaves = 3, persist = 0.6 }, - biomes = {"desert", "tundra"}, + biomes = {"desert", "sandstone_desert", "cold_desert"}, y_min = 2, y_max = 31000, decoration = "default:dry_shrub", }) + + -- Coral reef + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:sand"}, + noise_params = { + offset = -0.1, + scale = 0.1, + spread = {x = 200, y = 200, z = 200}, + seed = 7013, + octaves = 3, + persist = 1, + }, + biomes = { + "desert_ocean", + "savanna_ocean", + "rainforest_ocean", + }, + y_min = -8, + y_max = -2, + schematic = minetest.get_modpath("default") .. "/schematics/corals.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) end diff --git a/mods/default/models/character.b3d b/mods/default/models/character.b3d index 7558e6f8..9ab45436 100644 Binary files a/mods/default/models/character.b3d and b/mods/default/models/character.b3d differ diff --git a/mods/default/models/character.blend b/mods/default/models/character.blend index 7324325a..fca9f659 100644 Binary files a/mods/default/models/character.blend and b/mods/default/models/character.blend differ diff --git a/mods/default/models/torch_ceiling.obj b/mods/default/models/torch_ceiling.obj new file mode 100644 index 00000000..ea51f3ce --- /dev/null +++ b/mods/default/models/torch_ceiling.obj @@ -0,0 +1,58 @@ +# Blender v2.77 (sub 0) OBJ File: 'torch_ceiling.blend' +# www.blender.org +mtllib torch_ceiling.mtl +o Cube_Cube.001 +v -0.062469 -0.047331 0.068152 +v -0.062469 -0.559515 -0.164388 +v -0.062469 0.004344 -0.045667 +v -0.062469 -0.507839 -0.278206 +v 0.062531 -0.047331 0.068152 +v 0.062531 -0.559515 -0.164388 +v 0.062531 0.004344 -0.045667 +v 0.062531 -0.507839 -0.278206 +v 0.353584 0.040000 0.363553 +v 0.353584 -0.397500 0.363553 +v -0.353522 0.040000 -0.343553 +v -0.353522 -0.397500 -0.343553 +v 0.353584 0.040000 -0.343553 +v -0.353522 0.040000 0.363553 +v 0.353584 -0.397500 -0.343553 +v -0.353522 -0.397500 0.363553 +vt 0.5625 0.5000 +vt 0.5625 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.5000 +vt 0.4375 0.0000 +vt 0.5625 0.0000 +vt 0.5625 0.1250 +vt 0.4375 0.1250 +vt 0.5625 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.0000 +vt 0.5625 0.6250 +vt 0.5625 0.0000 +vt 1.0000 0.5625 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.5625 +vt 0.0000 0.5625 +vt 1.0000 0.5625 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vn 0.0000 0.9105 0.4134 +vn -0.0000 -0.4134 0.9105 +vn -1.0000 0.0000 0.0000 +vn 0.7071 0.0000 -0.7071 +vn 0.7071 0.0000 0.7071 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/9/2 4/6/2 8/5/2 7/10/2 +f 1/11/3 3/9/3 4/6/3 2/12/3 +f 5/13/2 1/11/2 2/12/2 6/14/2 +f 7/10/3 8/5/3 6/14/3 5/13/3 +usemtl Material.002 +f 9/15/4 10/16/4 12/17/4 11/18/4 +f 13/19/5 14/20/5 16/21/5 15/22/5 diff --git a/mods/default/models/torch_floor.obj b/mods/default/models/torch_floor.obj new file mode 100644 index 00000000..e2487efe --- /dev/null +++ b/mods/default/models/torch_floor.obj @@ -0,0 +1,50 @@ +# Blender v2.76 (sub 11) OBJ File: 'torch_floor.blend' +# www.blender.org +mtllib torch_floor.mtl +o Cube_Cube.001 +v 0.062500 0.062500 -0.062500 +v 0.062500 -0.500000 -0.062500 +v 0.062500 0.062500 0.062500 +v 0.062500 -0.500000 0.062500 +v -0.062500 0.062500 -0.062500 +v -0.062500 -0.500000 -0.062500 +v -0.062500 0.062500 0.062500 +v -0.062500 -0.500000 0.062500 +v -0.353553 -0.500000 0.353553 +v -0.353553 0.500000 0.353553 +v 0.353553 -0.500000 -0.353553 +v 0.353553 0.500000 -0.353553 +v -0.353553 -0.500000 -0.353553 +v 0.353553 -0.500000 0.353553 +v -0.353553 0.500000 -0.353553 +v 0.353553 0.500000 0.353553 +vt 0.562500 0.500000 +vt 0.562500 0.625000 +vt 0.437500 0.625000 +vt 0.437500 0.500000 +vt 0.437500 0.000000 +vt 0.562500 0.000000 +vt 0.562500 0.125000 +vt 0.437500 0.125000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 1.000000 0.000000 0.000000 +vn -0.707100 0.000000 -0.707100 +vn -0.707100 -0.000000 0.707100 +g Cube_Cube.001_Cube_Cube.001_Material.001 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/2/2 4/6/2 8/5/2 7/3/2 +f 1/3/3 3/2/3 4/6/3 2/5/3 +f 5/2/2 1/3/2 2/5/2 6/6/2 +f 7/3/3 8/5/3 6/6/3 5/2/3 +g Cube_Cube.001_Cube_Cube.001_Material.002 +usemtl Material.002 +f 9/9/4 10/10/4 12/11/4 11/12/4 +f 13/12/5 14/9/5 16/10/5 15/11/5 diff --git a/mods/default/models/torch_wall.obj b/mods/default/models/torch_wall.obj new file mode 100644 index 00000000..57baa9e6 --- /dev/null +++ b/mods/default/models/torch_wall.obj @@ -0,0 +1,64 @@ +# Blender v2.76 (sub 11) OBJ File: 'torch_wall.blend' +# www.blender.org +mtllib torch_wall.mtl +o Cube_Cube.001 +v 0.062469 -0.195248 0.023570 +v 0.062469 -0.476498 -0.463570 +v 0.062469 -0.303502 0.086070 +v 0.062469 -0.584752 -0.401070 +v -0.062531 -0.195248 0.023570 +v -0.062531 -0.476498 -0.463570 +v -0.062531 -0.303502 0.086070 +v -0.062531 -0.584752 -0.401070 +v -0.353584 -0.613553 0.022500 +v -0.353584 -0.613553 0.460000 +v 0.353522 0.093553 0.022500 +v 0.353522 0.093553 0.460000 +v -0.353584 0.093553 0.022500 +v 0.353522 -0.613553 0.022500 +v -0.353584 0.093553 0.460000 +v 0.353522 -0.613553 0.460000 +v 0.353553 0.056811 -0.121957 +v 0.353553 -0.224439 -0.609096 +v -0.353553 -0.555561 0.231596 +v -0.353553 -0.836811 -0.255543 +v -0.353553 0.056811 -0.121957 +v -0.353553 -0.224439 -0.609096 +v 0.353553 -0.555561 0.231596 +v 0.353553 -0.836811 -0.255543 +vt 0.562500 0.500000 +vt 0.562500 0.625000 +vt 0.437500 0.625000 +vt 0.437500 0.500000 +vt 0.437500 0.000000 +vt 0.562500 0.000000 +vt 0.562500 0.125000 +vt 0.437500 0.125000 +vt 0.000000 0.562500 +vt 0.000000 -0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.562500 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn -0.000000 0.500000 0.866000 +vn -0.000000 0.866000 -0.500000 +vn 1.000000 0.000000 0.000000 +vn -0.707100 0.612400 -0.353600 +vn -0.707100 -0.612400 0.353600 +vn -0.707100 0.707100 -0.000000 +vn -0.707100 -0.707100 -0.000000 +g Cube_Cube.001_Cube_Cube.001_Material.001 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/2/2 4/6/2 8/5/2 7/3/2 +f 1/3/3 3/2/3 4/6/3 2/5/3 +f 5/2/2 1/3/2 2/5/2 6/6/2 +f 7/3/3 8/5/3 6/6/3 5/2/3 +f 17/9/4 18/10/4 20/11/4 19/12/4 +f 21/9/5 22/10/5 24/11/5 23/12/5 +g Cube_Cube.001_Cube_Cube.001_Material.002 +usemtl Material.002 +f 9/12/6 10/13/6 12/14/6 11/9/6 +f 13/9/7 14/12/7 16/13/7 15/14/7 diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 5b60c74e..600355e1 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -47,6 +47,7 @@ default:dirt_with_snow default:sand default:desert_sand +default:silver_sand default:gravel @@ -110,8 +111,8 @@ default:mese default:stone_with_diamond default:diamondblock -Plantlife (non-cubic) ---------------------- +Plantlife +--------- default:cactus default:papyrus @@ -130,6 +131,18 @@ default:dry_grass_3 default:dry_grass_4 default:dry_grass_5 +default:bush_stem +default:bush_leaves +default:acacia_bush_stem +default:acacia_bush_leaves + +Corals +------ + +default:coral_brown +default:coral_orange +default:coral_skeleton + Liquids ------- (1. Source 2. Flowing) @@ -146,8 +159,6 @@ default:lava_flowing Tools / "Advanced" crafting / Non-"natural" ------------------------------------------- -default:torch - default:chest default:chest_locked @@ -168,8 +179,6 @@ default:fence_aspen_wood default:glass default:obsidian_glass -default:rail - default:brick default:meselamp @@ -347,7 +356,7 @@ minetest.register_node("default:dirt_with_grass", { tiles = {"default_grass.png", "default_dirt.png", {name = "default_dirt.png^default_grass_side.png", tileable_vertical = false}}, - groups = {crumbly = 3, soil = 1}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, drop = 'default:dirt', sounds = default.node_sound_dirt_defaults({ footstep = {name = "default_grass_footstep", gain = 0.25}, @@ -372,7 +381,7 @@ minetest.register_node("default:dirt_with_dry_grass", { "default_dirt.png", {name = "default_dirt.png^default_dry_grass_side.png", tileable_vertical = false}}, - groups = {crumbly = 3, soil = 1}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, drop = 'default:dirt', sounds = default.node_sound_dirt_defaults({ footstep = {name = "default_grass_footstep", gain = 0.4}, @@ -384,7 +393,7 @@ minetest.register_node("default:dirt_with_snow", { tiles = {"default_snow.png", "default_dirt.png", {name = "default_dirt.png^default_snow_side.png", tileable_vertical = false}}, - groups = {crumbly = 3, soil = 1}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, drop = 'default:dirt', light_source = 1, sounds = default.node_sound_dirt_defaults({ @@ -406,6 +415,13 @@ minetest.register_node("default:desert_sand", { sounds = default.node_sound_sand_defaults(), }) +minetest.register_node("default:silver_sand", { + description = "Silver Sand", + tiles = {"default_silver_sand.png"}, + groups = {crumbly = 3, falling_node = 1, sand = 1}, + sounds = default.node_sound_sand_defaults(), +}) + minetest.register_node("default:gravel", { description = "Gravel", @@ -438,7 +454,6 @@ minetest.register_node("default:snow", { paramtype = "light", buildable_to = true, floodable = true, - walkable = false, drawtype = "nodebox", light_source = 2, node_box = { @@ -465,13 +480,20 @@ minetest.register_node("default:snow", { minetest.register_node("default:snowblock", { description = "Snow Block", tiles = {"default_snow.png"}, - groups = {crumbly = 3, puts_out_fire = 1}, light_source = 2, + groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1}, sounds = default.node_sound_dirt_defaults({ footstep = {name = "default_snow_footstep", gain = 0.15}, dug = {name = "default_snow_footstep", gain = 0.2}, dig = {name = "default_snow_footstep", gain = 0.2} }), + + on_construct = function(pos) + pos.y = pos.y - 1 + if minetest.get_node(pos).name == "default:dirt_with_grass" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + end + end, }) minetest.register_node("default:ice", { @@ -479,7 +501,7 @@ minetest.register_node("default:ice", { tiles = {"default_ice.png"}, is_ground_content = false, paramtype = "light", - groups = {cracky = 3, puts_out_fire = 1}, + groups = {cracky = 3, puts_out_fire = 1, cools_lava = 1}, sounds = default.node_sound_glass_defaults(), }) @@ -521,7 +543,7 @@ minetest.register_node("default:sapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1, sapling = 1}, @@ -549,7 +571,6 @@ minetest.register_node("default:leaves", { description = "Leaves", drawtype = "allfaces_optional", waving = 1, - visual_scale = 1.3, tiles = {"default_leaves.png"}, special_tiles = {"default_leaves_simple.png"}, paramtype = "light", @@ -587,7 +608,7 @@ minetest.register_node("default:apple", { is_ground_content = false, selection_box = { type = "fixed", - fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} + fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16} }, groups = {fleshy = 3, dig_immediate = 3, flammable = 2, leafdecay = 3, leafdecay_drop = 1}, @@ -628,7 +649,6 @@ minetest.register_node("default:jungleleaves", { description = "Jungle Leaves", drawtype = "allfaces_optional", waving = 1, - visual_scale = 1.3, tiles = {"default_jungleleaves.png"}, special_tiles = {"default_jungleleaves_simple.png"}, paramtype = "light", @@ -659,7 +679,7 @@ minetest.register_node("default:junglesapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1, sapling = 1}, @@ -709,7 +729,6 @@ minetest.register_node("default:pine_wood", { minetest.register_node("default:pine_needles",{ description = "Pine Needles", drawtype = "allfaces_optional", - visual_scale = 1.3, tiles = {"default_pine_needles.png"}, waving = 1, paramtype = "light", @@ -740,7 +759,7 @@ minetest.register_node("default:pine_sapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 3, attached_node = 1, sapling = 1}, @@ -790,8 +809,8 @@ minetest.register_node("default:acacia_wood", { minetest.register_node("default:acacia_leaves", { description = "Acacia Leaves", drawtype = "allfaces_optional", - visual_scale = 1.3, tiles = {"default_acacia_leaves.png"}, + special_tiles = {"default_acacia_leaves_simple.png"}, waving = 1, paramtype = "light", is_ground_content = false, @@ -821,7 +840,7 @@ minetest.register_node("default:acacia_sapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1, sapling = 1}, @@ -870,7 +889,6 @@ minetest.register_node("default:aspen_wood", { minetest.register_node("default:aspen_leaves", { description = "Aspen Leaves", drawtype = "allfaces_optional", - visual_scale = 1.3, tiles = {"default_aspen_leaves.png"}, waving = 1, paramtype = "light", @@ -901,7 +919,7 @@ minetest.register_node("default:aspen_sapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 3, attached_node = 1, sapling = 1}, @@ -959,7 +977,7 @@ minetest.register_node("default:steelblock", { tiles = {"default_steel_block.png"}, is_ground_content = false, groups = {cracky = 1, level = 2}, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), }) @@ -976,7 +994,7 @@ minetest.register_node("default:copperblock", { tiles = {"default_copper_block.png"}, is_ground_content = false, groups = {cracky = 1, level = 2}, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), }) minetest.register_node("default:bronzeblock", { @@ -984,7 +1002,7 @@ minetest.register_node("default:bronzeblock", { tiles = {"default_bronze_block.png"}, is_ground_content = false, groups = {cracky = 1, level = 2}, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), }) @@ -1019,7 +1037,7 @@ minetest.register_node("default:goldblock", { tiles = {"default_gold_block.png"}, is_ground_content = false, groups = {cracky = 1}, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), }) @@ -1048,7 +1066,7 @@ minetest.register_node("default:cactus", { tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"}, paramtype2 = "facedir", - groups = {snappy = 1, choppy = 3}, + groups = {choppy = 3}, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node, }) @@ -1064,7 +1082,7 @@ minetest.register_node("default:papyrus", { walkable = false, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, }, groups = {snappy = 3, flammable = 2}, sounds = default.node_sound_leaves_defaults(), @@ -1090,7 +1108,7 @@ minetest.register_node("default:dry_shrub", { sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16}, }, }) @@ -1106,11 +1124,11 @@ minetest.register_node("default:junglegrass", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1}, + groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16}, }, }) @@ -1127,11 +1145,11 @@ minetest.register_node("default:grass_1", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1}, + groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16}, }, on_place = function(itemstack, placer, pointed_thing) @@ -1157,11 +1175,11 @@ for i = 2, 5 do buildable_to = true, drop = "default:grass_1", groups = {snappy = 3, flora = 1, attached_node = 1, - not_in_creative_inventory = 1, grass = 1}, + not_in_creative_inventory = 1, grass = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16}, }, }) end @@ -1183,7 +1201,7 @@ minetest.register_node("default:dry_grass_1", { sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16}, }, on_place = function(itemstack, placer, pointed_thing) @@ -1213,11 +1231,95 @@ for i = 2, 5 do sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16}, }, }) end + +minetest.register_node("default:bush_stem", { + description = "Bush Stem", + drawtype = "plantlike", + visual_scale = 1.18, + tiles = {"default_bush_stem.png"}, + inventory_image = "default_bush_stem.png", + wield_image = "default_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.54, 7 / 16}, + }, +}) + +minetest.register_node("default:bush_leaves", { + description = "Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_leaves_simple.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("default:acacia_bush_stem", { + description = "Acacia Bush Stem", + drawtype = "plantlike", + visual_scale = 1.18, + tiles = {"default_acacia_bush_stem.png"}, + inventory_image = "default_acacia_bush_stem.png", + wield_image = "default_acacia_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.54, 7 / 16}, + }, +}) + +minetest.register_node("default:acacia_bush_leaves", { + description = "Acacia Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_acacia_leaves_simple.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + sounds = default.node_sound_leaves_defaults(), +}) + + +-- +-- Corals +-- + +minetest.register_node("default:coral_brown", { + description = "Brown Coral", + tiles = {"default_coral_brown.png"}, + groups = {cracky = 3}, + drop = "default:coral_skeleton", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coral_orange", { + description = "Orange Coral", + tiles = {"default_coral_orange.png"}, + groups = {cracky = 3}, + drop = "default:coral_skeleton", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coral_skeleton", { + description = "Coral Skeleton", + tiles = {"default_coral_skeleton.png"}, + groups = {cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + + -- -- Liquids -- @@ -1263,7 +1365,8 @@ minetest.register_node("default:water_source", { liquid_alternative_source = "default:water_source", liquid_viscosity = 1, post_effect_color = {a = 103, r = 30, g = 60, b = 90}, - groups = {water = 3, liquid = 3, puts_out_fire = 1}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), }) minetest.register_node("default:water_flowing", { @@ -1308,7 +1411,8 @@ minetest.register_node("default:water_flowing", { liquid_viscosity = 1, post_effect_color = {a = 103, r = 30, g = 60, b = 90}, groups = {water = 3, liquid = 3, puts_out_fire = 1, - not_in_creative_inventory = 1}, + not_in_creative_inventory = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), }) @@ -1354,7 +1458,8 @@ minetest.register_node("default:river_water_source", { liquid_renewable = false, liquid_range = 2, post_effect_color = {a = 103, r = 30, g = 76, b = 90}, - groups = {water = 3, liquid = 3, puts_out_fire = 1}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), }) minetest.register_node("default:river_water_flowing", { @@ -1401,7 +1506,8 @@ minetest.register_node("default:river_water_flowing", { liquid_range = 2, post_effect_color = {a = 103, r = 30, g = 76, b = 90}, groups = {water = 3, liquid = 3, puts_out_fire = 1, - not_in_creative_inventory = 1}, + not_in_creative_inventory = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), }) @@ -1502,58 +1608,6 @@ minetest.register_node("default:lava_flowing", { -- Tools / "Advanced" crafting / Non-"natural" -- -minetest.register_node("default:torch", { - description = "Torch", - drawtype = "torchlike", - tiles = { - { - name = "default_torch_on_floor_animated.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 3.0 - }, - }, - { - name="default_torch_on_ceiling_animated.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 3.0 - }, - }, - { - name="default_torch_animated.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 3.0 - }, - }, - }, - inventory_image = "default_torch_on_floor.png", - wield_image = "default_torch_on_floor.png", - paramtype = "light", - paramtype2 = "wallmounted", - sunlight_propagates = true, - is_ground_content = false, - walkable = false, - light_source = default.LIGHT_MAX - 1, - selection_box = { - type = "wallmounted", - wall_top = {-0.1, 0.5 - 0.6, -0.1, 0.1, 0.5, 0.1}, - wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5 + 0.6, 0.1}, - wall_side = {-0.5, -0.3, -0.1, -0.5 + 0.3, 0.3, 0.1}, - }, - groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1}, - legacy_wallmounted = true, - sounds = default.node_sound_defaults(), -}) - - local chest_formspec = "size[8,9]" .. default.gui_bg .. @@ -1583,16 +1637,30 @@ local function get_locked_chest_formspec(pos) end local function has_locked_chest_privilege(meta, player) - local name = "" if player then if minetest.check_player_privs(player, "protection_bypass") then return true end - name = player:get_player_name() - end - if name ~= meta:get_string("owner") then + else return false end + + -- is player wielding the right key? + local item = player:get_wielded_item() + if item:get_name() == "default:key" then + local key_meta = minetest.parse_json(item:get_metadata()) + local secret = meta:get_string("key_lock_secret") + if secret ~= key_meta.secret then + return false + end + + return true + end + + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true end @@ -1712,6 +1780,41 @@ minetest.register_node("default:chest_locked", { return itemstack end, on_blast = function() end, + on_key_use = function(pos, player) + local secret = minetest.get_meta(pos):get_string("key_lock_secret") + local itemstack = player:get_wielded_item() + local key_meta = minetest.parse_json(itemstack:get_metadata()) + + if secret ~= key_meta.secret then + return + end + + minetest.show_formspec( + player:get_player_name(), + "default:chest_locked", + get_locked_chest_formspec(pos) + ) + end, + on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local name = player:get_player_name() + + -- verify placer is owner of lockable chest + if owner ~= name then + minetest.record_protection_violation(pos, name) + minetest.chat_send_player(name, "You do not own this chest.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked chest", owner + end, }) @@ -1727,6 +1830,25 @@ local bookshelf_formspec = "listring[current_player;main]" .. default.get_hotbar_bg(0,2.85) +local function get_bookshelf_formspec(inv) + local formspec = bookshelf_formspec + local invlist = inv and inv:get_list("books") + -- Inventory slots overlay + local bx, by = 0, 0.3 + for i = 1, 16 do + if i == 9 then + bx = 0 + by = by + 1 + end + if not invlist or invlist[i]:is_empty() then + formspec = formspec .. + "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]" + end + bx = bx + 1 + end + return formspec +end + minetest.register_node("default:bookshelf", { description = "Bookshelf", tiles = {"default_wood.png", "default_wood.png", "default_wood.png", @@ -1738,7 +1860,7 @@ minetest.register_node("default:bookshelf", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", bookshelf_formspec) + meta:set_string("formspec", get_bookshelf_formspec(nil)) local inv = meta:get_inventory() inv:set_size("books", 8 * 2) end, @@ -1755,14 +1877,20 @@ minetest.register_node("default:bookshelf", { on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) minetest.log("action", player:get_player_name() .. " moves stuff in bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " moves stuff to bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " takes stuff from bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) end, on_blast = function(pos) local drops = {} @@ -1823,7 +1951,7 @@ register_sign("wood", "Wooden", { }) register_sign("steel", "Steel", { - sounds = default.node_sound_defaults(), + sounds = default.node_sound_metal_defaults(), groups = {cracky = 2, attached_node = 1} }) @@ -1869,7 +1997,7 @@ minetest.register_node("default:ladder_steel", { --wall_side = = }, groups = {cracky = 2}, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), }) default.register_fence("default:fence_wood", { @@ -1945,27 +2073,6 @@ minetest.register_node("default:obsidian_glass", { }) -minetest.register_node("default:rail", { - description = "Rail", - drawtype = "raillike", - tiles = {"default_rail.png", "default_rail_curved.png", - "default_rail_t_junction.png", "default_rail_crossing.png"}, - inventory_image = "default_rail.png", - wield_image = "default_rail.png", - paramtype = "light", - sunlight_propagates = true, - walkable = false, - is_ground_content = false, - selection_box = { - type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, - }, - groups = {dig_immediate = 2, attached_node = 1, - connect_to_raillike = minetest.raillike_group("rail")}, -}) - - minetest.register_node("default:brick", { description = "Brick Block", paramtype2 = "facedir", diff --git a/mods/default/player.lua b/mods/default/player.lua index e4fb2adf..fd7341f4 100644 --- a/mods/default/player.lua +++ b/mods/default/player.lua @@ -25,7 +25,6 @@ default.player_register_model("character.b3d", { walk = { x=168, y=187, }, mine = { x=189, y=198, }, walk_mine = { x=200, y=219, }, - -- Extra animations (not currently used by the game). sit = { x= 81, y=160, }, }, }) @@ -95,7 +94,7 @@ minetest.register_on_joinplayer(function(player) default.player_attached[player:get_player_name()] = false default.player_set_model(player, "character.b3d") player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) - + -- set GUI if not minetest.setting_getbool("creative_mode") then player:set_inventory_formspec(default.gui_survival_form) diff --git a/mods/default/schematics/acacia_bush.mts b/mods/default/schematics/acacia_bush.mts new file mode 100644 index 00000000..df955861 Binary files /dev/null and b/mods/default/schematics/acacia_bush.mts differ diff --git a/mods/default/schematics/bush.mts b/mods/default/schematics/bush.mts new file mode 100644 index 00000000..d08cf5f5 Binary files /dev/null and b/mods/default/schematics/bush.mts differ diff --git a/mods/default/schematics/corals.mts b/mods/default/schematics/corals.mts new file mode 100644 index 00000000..e1bd7ded Binary files /dev/null and b/mods/default/schematics/corals.mts differ diff --git a/mods/default/schematics/papyrus.mts b/mods/default/schematics/papyrus.mts index a3b67776..1333a7c4 100644 Binary files a/mods/default/schematics/papyrus.mts and b/mods/default/schematics/papyrus.mts differ diff --git a/mods/default/sounds/default_dig_metal.ogg b/mods/default/sounds/default_dig_metal.ogg new file mode 100644 index 00000000..0b585097 Binary files /dev/null and b/mods/default/sounds/default_dig_metal.ogg differ diff --git a/mods/default/sounds/default_dig_snappy.ogg b/mods/default/sounds/default_dig_snappy.ogg new file mode 100644 index 00000000..3686fcdd Binary files /dev/null and b/mods/default/sounds/default_dig_snappy.ogg differ diff --git a/mods/default/sounds/default_dug_metal.1.ogg b/mods/default/sounds/default_dug_metal.1.ogg new file mode 100644 index 00000000..5d6cb5b1 Binary files /dev/null and b/mods/default/sounds/default_dug_metal.1.ogg differ diff --git a/mods/default/sounds/default_dug_metal.2.ogg b/mods/default/sounds/default_dug_metal.2.ogg new file mode 100644 index 00000000..63567fc0 Binary files /dev/null and b/mods/default/sounds/default_dug_metal.2.ogg differ diff --git a/mods/default/sounds/default_item_smoke.ogg b/mods/default/sounds/default_item_smoke.ogg new file mode 100644 index 00000000..038a46e4 Binary files /dev/null and b/mods/default/sounds/default_item_smoke.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.1.ogg b/mods/default/sounds/default_metal_footstep.1.ogg new file mode 100644 index 00000000..841286bd Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.1.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.2.ogg b/mods/default/sounds/default_metal_footstep.2.ogg new file mode 100644 index 00000000..aa61ed33 Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.2.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.3.ogg b/mods/default/sounds/default_metal_footstep.3.ogg new file mode 100644 index 00000000..4cc1ca47 Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.3.ogg differ diff --git a/mods/default/sounds/default_place_node_metal.1.ogg b/mods/default/sounds/default_place_node_metal.1.ogg new file mode 100644 index 00000000..5da085ea Binary files /dev/null and b/mods/default/sounds/default_place_node_metal.1.ogg differ diff --git a/mods/default/sounds/default_place_node_metal.2.ogg b/mods/default/sounds/default_place_node_metal.2.ogg new file mode 100644 index 00000000..5ee67fcf Binary files /dev/null and b/mods/default/sounds/default_place_node_metal.2.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.1.ogg b/mods/default/sounds/default_tool_breaks.1.ogg new file mode 100644 index 00000000..2a571ae2 Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.1.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.2.ogg b/mods/default/sounds/default_tool_breaks.2.ogg new file mode 100644 index 00000000..17893520 Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.2.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.3.ogg b/mods/default/sounds/default_tool_breaks.3.ogg new file mode 100644 index 00000000..a99c4b7e Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.3.ogg differ diff --git a/mods/default/sounds/default_water_footstep.1.ogg b/mods/default/sounds/default_water_footstep.1.ogg new file mode 100644 index 00000000..63b9744c Binary files /dev/null and b/mods/default/sounds/default_water_footstep.1.ogg differ diff --git a/mods/default/sounds/default_water_footstep.2.ogg b/mods/default/sounds/default_water_footstep.2.ogg new file mode 100644 index 00000000..8d79c1f4 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.2.ogg differ diff --git a/mods/default/sounds/default_water_footstep.3.ogg b/mods/default/sounds/default_water_footstep.3.ogg new file mode 100644 index 00000000..f8891506 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.3.ogg differ diff --git a/mods/default/sounds/default_water_footstep.4.ogg b/mods/default/sounds/default_water_footstep.4.ogg new file mode 100644 index 00000000..6f1eab82 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.4.ogg differ diff --git a/mods/default/sounds/player_damage.ogg b/mods/default/sounds/player_damage.ogg new file mode 100644 index 00000000..78880871 Binary files /dev/null and b/mods/default/sounds/player_damage.ogg differ diff --git a/mods/default/textures/default_acacia_bush_stem.png b/mods/default/textures/default_acacia_bush_stem.png new file mode 100644 index 00000000..29039152 Binary files /dev/null and b/mods/default/textures/default_acacia_bush_stem.png differ diff --git a/mods/default/textures/default_acacia_leaves_simple.png b/mods/default/textures/default_acacia_leaves_simple.png new file mode 100644 index 00000000..3c7015bb Binary files /dev/null and b/mods/default/textures/default_acacia_leaves_simple.png differ diff --git a/mods/default/textures/default_acacia_tree.png b/mods/default/textures/default_acacia_tree.png index 169823d4..58bb3c40 100644 Binary files a/mods/default/textures/default_acacia_tree.png and b/mods/default/textures/default_acacia_tree.png differ diff --git a/mods/default/textures/default_acacia_tree_top.png b/mods/default/textures/default_acacia_tree_top.png index 2cf5ef0b..a8a0ce05 100644 Binary files a/mods/default/textures/default_acacia_tree_top.png and b/mods/default/textures/default_acacia_tree_top.png differ diff --git a/mods/default/textures/default_aspen_tree.png b/mods/default/textures/default_aspen_tree.png index 933b9cad..cfb05fca 100644 Binary files a/mods/default/textures/default_aspen_tree.png and b/mods/default/textures/default_aspen_tree.png differ diff --git a/mods/default/textures/default_aspen_wood.png b/mods/default/textures/default_aspen_wood.png index d16fdc97..2b584b31 100644 Binary files a/mods/default/textures/default_aspen_wood.png and b/mods/default/textures/default_aspen_wood.png differ diff --git a/mods/default/textures/default_bookshelf_slot.png b/mods/default/textures/default_bookshelf_slot.png new file mode 100644 index 00000000..31c4eb5e Binary files /dev/null and b/mods/default/textures/default_bookshelf_slot.png differ diff --git a/mods/default/textures/default_bush_stem.png b/mods/default/textures/default_bush_stem.png new file mode 100644 index 00000000..18b615f7 Binary files /dev/null and b/mods/default/textures/default_bush_stem.png differ diff --git a/mods/default/textures/default_coral_brown.png b/mods/default/textures/default_coral_brown.png new file mode 100644 index 00000000..8a775fe0 Binary files /dev/null and b/mods/default/textures/default_coral_brown.png differ diff --git a/mods/default/textures/default_coral_orange.png b/mods/default/textures/default_coral_orange.png new file mode 100644 index 00000000..cefac627 Binary files /dev/null and b/mods/default/textures/default_coral_orange.png differ diff --git a/mods/default/textures/default_coral_skeleton.png b/mods/default/textures/default_coral_skeleton.png new file mode 100644 index 00000000..fa48f151 Binary files /dev/null and b/mods/default/textures/default_coral_skeleton.png differ diff --git a/mods/default/textures/default_desert_stone_block.png b/mods/default/textures/default_desert_stone_block.png index ef7ba5bc..9eb8e924 100644 Binary files a/mods/default/textures/default_desert_stone_block.png and b/mods/default/textures/default_desert_stone_block.png differ diff --git a/mods/default/textures/default_desert_stone_brick.png b/mods/default/textures/default_desert_stone_brick.png index 941523ec..a603d18f 100644 Binary files a/mods/default/textures/default_desert_stone_brick.png and b/mods/default/textures/default_desert_stone_brick.png differ diff --git a/mods/default/textures/default_fence_aspen_wood.png b/mods/default/textures/default_fence_aspen_wood.png index 7fb624dc..0a6558e0 100644 Binary files a/mods/default/textures/default_fence_aspen_wood.png and b/mods/default/textures/default_fence_aspen_wood.png differ diff --git a/mods/default/textures/default_gravel.png b/mods/default/textures/default_gravel.png index 25a78b64..8852d384 100644 Binary files a/mods/default/textures/default_gravel.png and b/mods/default/textures/default_gravel.png differ diff --git a/mods/default/textures/default_ice.png b/mods/default/textures/default_ice.png index be8eadd9..2874e1e3 100644 Binary files a/mods/default/textures/default_ice.png and b/mods/default/textures/default_ice.png differ diff --git a/mods/default/textures/default_item_smoke.png b/mods/default/textures/default_item_smoke.png new file mode 100644 index 00000000..d62fb3b0 Binary files /dev/null and b/mods/default/textures/default_item_smoke.png differ diff --git a/mods/default/textures/default_jungleleaves.png b/mods/default/textures/default_jungleleaves.png index 870b4bb2..5afcc36d 100644 Binary files a/mods/default/textures/default_jungleleaves.png and b/mods/default/textures/default_jungleleaves.png differ diff --git a/mods/default/textures/default_jungleleaves_simple.png b/mods/default/textures/default_jungleleaves_simple.png index 689195f7..7165100c 100644 Binary files a/mods/default/textures/default_jungleleaves_simple.png and b/mods/default/textures/default_jungleleaves_simple.png differ diff --git a/mods/default/textures/default_jungletree.png b/mods/default/textures/default_jungletree.png index bf0403e9..2cf77a68 100644 Binary files a/mods/default/textures/default_jungletree.png and b/mods/default/textures/default_jungletree.png differ diff --git a/mods/default/textures/default_jungletree_top.png b/mods/default/textures/default_jungletree_top.png index 4844682b..439f0786 100644 Binary files a/mods/default/textures/default_jungletree_top.png and b/mods/default/textures/default_jungletree_top.png differ diff --git a/mods/default/textures/default_key.png b/mods/default/textures/default_key.png new file mode 100644 index 00000000..d59bfb6b Binary files /dev/null and b/mods/default/textures/default_key.png differ diff --git a/mods/default/textures/default_key_skeleton.png b/mods/default/textures/default_key_skeleton.png new file mode 100644 index 00000000..eafcc195 Binary files /dev/null and b/mods/default/textures/default_key_skeleton.png differ diff --git a/mods/default/textures/default_lava.png b/mods/default/textures/default_lava.png index b0d429eb..e8958de5 100644 Binary files a/mods/default/textures/default_lava.png and b/mods/default/textures/default_lava.png differ diff --git a/mods/default/textures/default_leaves.png b/mods/default/textures/default_leaves.png index e39535c6..ba09fe1d 100644 Binary files a/mods/default/textures/default_leaves.png and b/mods/default/textures/default_leaves.png differ diff --git a/mods/default/textures/default_leaves_simple.png b/mods/default/textures/default_leaves_simple.png index e492a32e..eb60f9f5 100644 Binary files a/mods/default/textures/default_leaves_simple.png and b/mods/default/textures/default_leaves_simple.png differ diff --git a/mods/default/textures/default_meselamp.png b/mods/default/textures/default_meselamp.png index b227a254..0c3a1a12 100644 Binary files a/mods/default/textures/default_meselamp.png and b/mods/default/textures/default_meselamp.png differ diff --git a/mods/default/textures/default_obsidian_block.png b/mods/default/textures/default_obsidian_block.png index 262cd37e..7e1d4d3f 100644 Binary files a/mods/default/textures/default_obsidian_block.png and b/mods/default/textures/default_obsidian_block.png differ diff --git a/mods/default/textures/default_pine_needles.png b/mods/default/textures/default_pine_needles.png index 1a32f632..ad7373b0 100644 Binary files a/mods/default/textures/default_pine_needles.png and b/mods/default/textures/default_pine_needles.png differ diff --git a/mods/default/textures/default_rail.png b/mods/default/textures/default_rail.png deleted file mode 100644 index 26fed02e..00000000 Binary files a/mods/default/textures/default_rail.png and /dev/null differ diff --git a/mods/default/textures/default_rail_crossing.png b/mods/default/textures/default_rail_crossing.png deleted file mode 100644 index ba66e015..00000000 Binary files a/mods/default/textures/default_rail_crossing.png and /dev/null differ diff --git a/mods/default/textures/default_rail_curved.png b/mods/default/textures/default_rail_curved.png deleted file mode 100644 index 9084ac24..00000000 Binary files a/mods/default/textures/default_rail_curved.png and /dev/null differ diff --git a/mods/default/textures/default_rail_t_junction.png b/mods/default/textures/default_rail_t_junction.png deleted file mode 100644 index 486c416a..00000000 Binary files a/mods/default/textures/default_rail_t_junction.png and /dev/null differ diff --git a/mods/default/textures/default_sandstone_block.png b/mods/default/textures/default_sandstone_block.png index b97c8780..2e06491e 100644 Binary files a/mods/default/textures/default_sandstone_block.png and b/mods/default/textures/default_sandstone_block.png differ diff --git a/mods/default/textures/default_silver_sand.png b/mods/default/textures/default_silver_sand.png new file mode 100644 index 00000000..c4a8f730 Binary files /dev/null and b/mods/default/textures/default_silver_sand.png differ diff --git a/mods/default/textures/default_snow.png b/mods/default/textures/default_snow.png index 2a2439fb..4ac35938 100644 Binary files a/mods/default/textures/default_snow.png and b/mods/default/textures/default_snow.png differ diff --git a/mods/default/textures/default_snow_side.png b/mods/default/textures/default_snow_side.png index f13ec940..f95b3af8 100644 Binary files a/mods/default/textures/default_snow_side.png and b/mods/default/textures/default_snow_side.png differ diff --git a/mods/default/textures/default_snowball.png b/mods/default/textures/default_snowball.png index ecdba9a3..e952b79c 100644 Binary files a/mods/default/textures/default_snowball.png and b/mods/default/textures/default_snowball.png differ diff --git a/mods/default/textures/default_stone_brick.png b/mods/default/textures/default_stone_brick.png index 4312b5cb..4dbb49db 100644 Binary files a/mods/default/textures/default_stone_brick.png and b/mods/default/textures/default_stone_brick.png differ diff --git a/mods/default/tools.lua b/mods/default/tools.lua index 26e3040a..58b87fc5 100644 --- a/mods/default/tools.lua +++ b/mods/default/tools.lua @@ -32,7 +32,10 @@ minetest.register_tool("default:pick_wood", { }, damage_groups = {fleshy=2}, }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_stone", { description = "Stone Pickaxe", inventory_image = "default_tool_stonepick.png", @@ -44,7 +47,9 @@ minetest.register_tool("default:pick_stone", { }, damage_groups = {fleshy=3}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_steel", { description = "Steel Pickaxe", inventory_image = "default_tool_steelpick.png", @@ -56,7 +61,9 @@ minetest.register_tool("default:pick_steel", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_bronze", { description = "Bronze Pickaxe", inventory_image = "default_tool_bronzepick.png", @@ -68,7 +75,9 @@ minetest.register_tool("default:pick_bronze", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_mese", { description = "Mese Pickaxe", inventory_image = "default_tool_mesepick.png", @@ -80,7 +89,9 @@ minetest.register_tool("default:pick_mese", { }, damage_groups = {fleshy=5}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_diamond", { description = "Diamond Pickaxe", inventory_image = "default_tool_diamondpick.png", @@ -92,6 +103,7 @@ minetest.register_tool("default:pick_diamond", { }, damage_groups = {fleshy=5}, }, + sound = {breaks = "default_tool_breaks"}, }) -- @@ -110,7 +122,10 @@ minetest.register_tool("default:shovel_wood", { }, damage_groups = {fleshy=2}, }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_stone", { description = "Stone Shovel", inventory_image = "default_tool_stoneshovel.png", @@ -123,7 +138,9 @@ minetest.register_tool("default:shovel_stone", { }, damage_groups = {fleshy=2}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_steel", { description = "Steel Shovel", inventory_image = "default_tool_steelshovel.png", @@ -136,7 +153,9 @@ minetest.register_tool("default:shovel_steel", { }, damage_groups = {fleshy=3}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_bronze", { description = "Bronze Shovel", inventory_image = "default_tool_bronzeshovel.png", @@ -149,7 +168,9 @@ minetest.register_tool("default:shovel_bronze", { }, damage_groups = {fleshy=3}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_mese", { description = "Mese Shovel", inventory_image = "default_tool_meseshovel.png", @@ -162,7 +183,9 @@ minetest.register_tool("default:shovel_mese", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_diamond", { description = "Diamond Shovel", inventory_image = "default_tool_diamondshovel.png", @@ -175,6 +198,7 @@ minetest.register_tool("default:shovel_diamond", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) -- @@ -192,7 +216,10 @@ minetest.register_tool("default:axe_wood", { }, damage_groups = {fleshy=2}, }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_stone", { description = "Stone Axe", inventory_image = "default_tool_stoneaxe.png", @@ -204,7 +231,9 @@ minetest.register_tool("default:axe_stone", { }, damage_groups = {fleshy=3}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_steel", { description = "Steel Axe", inventory_image = "default_tool_steelaxe.png", @@ -216,7 +245,9 @@ minetest.register_tool("default:axe_steel", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_bronze", { description = "Bronze Axe", inventory_image = "default_tool_bronzeaxe.png", @@ -228,7 +259,9 @@ minetest.register_tool("default:axe_bronze", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_mese", { description = "Mese Axe", inventory_image = "default_tool_meseaxe.png", @@ -240,7 +273,9 @@ minetest.register_tool("default:axe_mese", { }, damage_groups = {fleshy=6}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_diamond", { description = "Diamond Axe", inventory_image = "default_tool_diamondaxe.png", @@ -252,6 +287,7 @@ minetest.register_tool("default:axe_diamond", { }, damage_groups = {fleshy=7}, }, + sound = {breaks = "default_tool_breaks"}, }) -- @@ -268,8 +304,11 @@ minetest.register_tool("default:sword_wood", { snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1}, }, damage_groups = {fleshy=2}, - } + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_stone", { description = "Stone Sword", inventory_image = "default_tool_stonesword.png", @@ -280,8 +319,10 @@ minetest.register_tool("default:sword_stone", { snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1}, }, damage_groups = {fleshy=4}, - } + }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_steel", { description = "Steel Sword", inventory_image = "default_tool_steelsword.png", @@ -292,8 +333,10 @@ minetest.register_tool("default:sword_steel", { snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2}, }, damage_groups = {fleshy=6}, - } + }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_bronze", { description = "Bronze Sword", inventory_image = "default_tool_bronzesword.png", @@ -304,8 +347,10 @@ minetest.register_tool("default:sword_bronze", { snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=40, maxlevel=2}, }, damage_groups = {fleshy=6}, - } + }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_mese", { description = "Mese Sword", inventory_image = "default_tool_mesesword.png", @@ -316,8 +361,10 @@ minetest.register_tool("default:sword_mese", { snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3}, }, damage_groups = {fleshy=7}, - } + }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_diamond", { description = "Diamond Sword", inventory_image = "default_tool_diamondsword.png", @@ -328,5 +375,78 @@ minetest.register_tool("default:sword_diamond", { snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3}, }, damage_groups = {fleshy=8}, - } + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:skeleton_key", { + description = "Skeleton Key", + inventory_image = "default_key_skeleton.png", + groups = {key = 1}, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local pos = pointed_thing.under + local node = minetest.get_node(pos) + + if not node then + return itemstack + end + + local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use + if on_skeleton_key_use then + -- make a new key secret in case the node callback needs it + local random = math.random + local newsecret = string.format( + "%04x%04x%04x%04x", + random(2^16) - 1, random(2^16) - 1, + random(2^16) - 1, random(2^16) - 1) + + local secret, _, _ = on_skeleton_key_use(pos, placer, newsecret) + + if secret then + -- finish and return the new key + itemstack:take_item() + itemstack:add_item("default:key") + itemstack:set_metadata(minetest.write_json({ + secret = secret + })) + return itemstack + end + end + return nil + end +}) + +minetest.register_tool("default:key", { + description = "Key", + inventory_image = "default_key.png", + groups = {key = 1, not_in_creative_inventory = 1}, + stack_max = 1, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local pos = pointed_thing.under + local node = minetest.get_node(pos) + + if not node or node.name == "ignore" then + return itemstack + end + + local ndef = minetest.registered_nodes[node.name] + if not ndef then + return itemstack + end + + local on_key_use = ndef.on_key_use + if on_key_use then + on_key_use(pos, placer) + end + + return nil + end }) diff --git a/mods/default/torch.lua b/mods/default/torch.lua new file mode 100644 index 00000000..e94c5bd6 --- /dev/null +++ b/mods/default/torch.lua @@ -0,0 +1,147 @@ + +--[[ + +Torch mod - formerly mod "Torches" +====================== + +(c) Copyright BlockMen (2013-2015) +(C) Copyright sofar (2016) + +This mod changes the default torch drawtype from "torchlike" to "mesh", +giving the torch a three dimensional appearance. The mesh contains the +proper pixel mapping to make the animation appear as a particle above +the torch, while in fact the animation is just the texture of the mesh. + + +License: +~~~~~~~~ +(c) Copyright BlockMen (2013-2015) + +Textures and Meshes/Models: +CC-BY 3.0 BlockMen +Note that the models were entirely done from scratch by sofar. + +Code: +Licensed under the GNU LGPL version 2.1 or higher. +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; + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt + +--]] + +minetest.register_node("default:torch", { + description = "Torch", + drawtype = "mesh", + mesh = "torch_floor.obj", + inventory_image = "default_torch_on_floor.png", + wield_image = "default_torch_on_floor.png", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + liquids_pointable = false, + light_source = 13, + groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_bottom = {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local def = minetest.registered_nodes[node.name] + if def and def.on_rightclick and + ((not placer) or (placer and not placer:get_player_control().sneak)) then + return def.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + + local above = pointed_thing.above + local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above)) + local fakestack = itemstack + if wdir == 0 then + fakestack:set_name("default:torch_ceiling") + elseif wdir == 1 then + fakestack:set_name("default:torch") + else + fakestack:set_name("default:torch_wall") + end + + itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir) + itemstack:set_name("default:torch") + + return itemstack + end +}) + +minetest.register_node("default:torch_wall", { + drawtype = "mesh", + mesh = "torch_wall.obj", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = 13, + groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:torch_ceiling", { + drawtype = "mesh", + mesh = "torch_ceiling.obj", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = 13, + groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_lbm({ + name = "default:3dtorch", + nodenames = {"default:torch", "torches:floor", "torches:wall"}, + action = function(pos, node) + if node.param2 == 0 then + minetest.set_node(pos, {name = "default:torch_ceiling", + param2 = node.param2}) + elseif node.param2 == 1 then + minetest.set_node(pos, {name = "default:torch", + param2 = node.param2}) + else + minetest.set_node(pos, {name = "default:torch_wall", + param2 = node.param2}) + end + end +}) + diff --git a/mods/default/trees.lua b/mods/default/trees.lua index 5cd7e156..0b95742c 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -435,12 +435,17 @@ function default.sapling_on_place(itemstack, placer, pointed_thing, sapling_name, minp_relative, maxp_relative, interval) -- Position of sapling local pos = pointed_thing.under - local node = minetest.get_node(pos) - local pdef = minetest.registered_nodes[node.name] + local node = minetest.get_node_or_nil(pos) + local pdef = node and minetest.registered_nodes[node.name] + + if pdef and pdef.on_rightclick and not placer:get_player_control().sneak then + return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing) + end + if not pdef or not pdef.buildable_to then pos = pointed_thing.above - node = minetest.get_node(pos) - pdef = minetest.registered_nodes[node.name] + node = minetest.get_node_or_nil(pos) + pdef = node and minetest.registered_nodes[node.name] if not pdef or not pdef.buildable_to then return itemstack end diff --git a/mods/doors/README.txt b/mods/doors/README.txt index 6c036782..9ad7093d 100644 --- a/mods/doors/README.txt +++ b/mods/doors/README.txt @@ -1,62 +1,62 @@ Minetest Game mod: doors ======================== -version: 2.0 +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2012 PilzAdam -modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor) -Steel trapdoor added by sofar. -Copyright (C) 2016 sofar@foo-projects.org -Re-implemented most of the door algorithms, added meshes, UV wrapped texture +Authors of source code +---------------------- +Originally by PilzAdam (MIT) + +Modified by BlockMen (MIT): Added sounds, glass doors (glass, obsidian glass) and trapdoor. + +Modified by sofar (sofar@foo-projects.org) (MIT): +Added Steel trapdoor. +Re-implemented most of the door algorithms, added meshes, UV wrapped texture. Added doors API to facilitate coding mods accessing and operating doors. -Added Fence Gate model, code, and sounds +Added Fence Gate model, code, and sounds. -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Various Minetest developers and contributors (MIT) -License of textures --------------------------------------- -following Textures created by Fernando Zapata (CC BY-SA 3.0): + +Authors of media (textures) +--------------------------- +Following textures created by Fernando Zapata (CC BY-SA 3.0): door_wood.png door_wood_a.png door_wood_a_r.png door_wood_b.png door_wood_b_r.png -following Textures created by BlockMen (WTFPL): +Following textures created by BlockMen (CC BY-SA 3.0): door_trapdoor.png door_obsidian_glass_side.png -following textures created by celeron55 (CC BY-SA 3.0): +Following textures created by celeron55 (CC BY-SA 3.0): door_glass_a.png door_glass_b.png -following Textures created by PenguinDad (CC BY-SA 4.0): +Following textures created by PenguinDad (CC BY-SA 4.0): door_glass.png door_obsidian_glass.png -following textures created by sofar (CC-BY-SA-3.0) +Following textures created by sofar (CC-BY-SA-3.0): doors_trapdoor_steel.png doors_trapdoor_steel_side.png door_trapdoor_side.png - -Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen: WTFPL +Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen (CC BY-SA 3.0): door_obsidian_glass.png -Glass door textures by red-001 based on textures by celeron55: CC BY-SA 3.0 +Glass door textures by red-001 based on textures by celeron55 (CC BY-SA 3.0): door_glass.png -All other textures (created by PilzAdam): WTFPL + +All other textures (created by PilzAdam) (CC BY-SA 3.0): Door textures were converted to the new texture map by sofar, paramat and red-001, under the same license as the originals. -Models: --------------------------------------- + +Authors of media (models) +------------------------- Door 3d models by sofar (CC-BY-SA-3.0) - door_a.obj - door_b.obj @@ -64,17 +64,18 @@ Fence gate models by sofar (CC-BY-SA-3.0) - fencegate_open.obj - fencegate_closed.obj -License of sounds --------------------------------------- + +Authors of media (sounds) +------------------------- Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen door_open.ogg Closing-Sound created by bennstir (CC BY 3.0) door_close.ogg fencegate_open.ogg: - http://www.freesound.org/people/mhtaylor67/sounds/126041/ - CC0 + http://www.freesound.org/people/mhtaylor67/sounds/126041/ - (CC0 1.0) fencegate_close.ogg: - http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - CC-BY-3.0 - http://www.freesound.org/people/rivernile7/sounds/249573/ - CC-BY-3.0 + http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - (CC-BY-3.0) + http://www.freesound.org/people/rivernile7/sounds/249573/ - (CC-BY-3.0) Steel door sounds open & close (CC-BY-3.0) by HazMatt - http://www.freesound.org/people/HazMattt/sounds/187283/ doors_steel_door_open.ogg diff --git a/mods/doors/init.lua b/mods/doors/init.lua index dd54722f..9924ae10 100644 --- a/mods/doors/init.lua +++ b/mods/doors/init.lua @@ -1,11 +1,3 @@ ---[[ - -Copyright (C) 2012 PilzAdam - modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor) -Copyright (C) 2015 - Auke Kok - ---]] - -- our API object doors = {} @@ -148,8 +140,17 @@ function _doors.door_toggle(pos, node, clicker) end if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then + -- is player wielding the right key? + local item = clicker:get_wielded_item() local owner = meta:get_string("doors_owner") - if owner ~= "" then + if item:get_name() == "default:key" then + local key_meta = minetest.parse_json(item:get_metadata()) + local secret = meta:get_string("key_lock_secret") + if secret ~= key_meta.secret then + return false + end + + elseif owner ~= "" then if clicker:get_player_name() ~= owner then return false end @@ -372,13 +373,37 @@ function doors.register(name, def) end def.after_dig_node = function(pos, node, meta, digger) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) - nodeupdate({x = pos.x, y = pos.y + 1, z = pos.z}) + minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z}) end - def.on_rotate = screwdriver and screwdriver.rotate_simple or false + def.on_rotate = false if def.protected then def.can_dig = can_dig_door def.on_blast = function() end + def.on_key_use = function(pos, player) + local door = doors.get(pos) + door:toggle(player) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("doors_owner") + local pname = player:get_player_name() + + -- verify placer is owner of lockable door + if owner ~= pname then + minetest.record_protection_violation(pos, pname) + minetest.chat_send_player(pname, "You do not own this locked door.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked door", owner + end else def.on_blast = function(pos, intensity) minetest.remove_node(pos) @@ -430,7 +455,7 @@ doors.register("door_steel", { inventory_image = "doors_item_steel.png", protected = true, groups = {cracky = 1, level = 2}, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), sound_open = "doors_steel_door_open", sound_close = "doors_steel_door_close", recipe = { @@ -499,9 +524,18 @@ end function _doors.trapdoor_toggle(pos, node, clicker) node = node or minetest.get_node(pos) if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then + -- is player wielding the right key? + local item = clicker:get_wielded_item() local meta = minetest.get_meta(pos) local owner = meta:get_string("doors_owner") - if owner ~= "" then + if item:get_name() == "default:key" then + local key_meta = minetest.parse_json(item:get_metadata()) + local secret = meta:get_string("key_lock_secret") + if secret ~= key_meta.secret then + return false + end + + elseif owner ~= "" then if clicker:get_player_name() ~= owner then return false end @@ -527,7 +561,7 @@ function doors.register_trapdoor(name, def) if not name:find(":") then name = "doors:" .. name end - + local name_closed = name local name_opened = name.."_open" @@ -554,6 +588,30 @@ function doors.register_trapdoor(name, def) end def.on_blast = function() end + def.on_key_use = function(pos, player) + local door = doors.get(pos) + door:toggle(player) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("doors_owner") + local pname = player:get_player_name() + + -- verify placer is owner of lockable door + if owner ~= pname then + minetest.record_protection_violation(pos, pname) + minetest.chat_send_player(pname, "You do not own this trapdoor.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked trapdoor", owner + end else def.on_blast = function(pos, intensity) minetest.remove_node(pos) @@ -629,7 +687,7 @@ doors.register_trapdoor("doors:trapdoor_steel", { tile_front = "doors_trapdoor_steel.png", tile_side = "doors_trapdoor_steel_side.png", protected = true, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), sound_open = "doors_steel_door_open", sound_close = "doors_steel_door_close", groups = {cracky = 1, level = 2, door = 1}, @@ -704,7 +762,7 @@ function doors.register_fencegate(name, def) fence_open.collision_box = { type = "fixed", fixed = {{-1/2, -1/2, -1/4, -3/8, 1/2, 1/4}, - {-5/8, -3/8, -1/2, -3/8, 3/8, 0}}, + {-1/2, -3/8, -1/2, -3/8, 3/8, 0}}, } minetest.register_node(":" .. name .. "_closed", fence_closed) @@ -753,3 +811,48 @@ doors.register_fencegate("doors:gate_aspen_wood", { material = "default:aspen_wood", groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3} }) + + +----fuels---- + +minetest.register_craft({ + type = "fuel", + recipe = "doors:trapdoor", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:door_wood", + burntime = 14, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_wood_closed", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_acacia_wood_closed", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_junglewood_closed", + burntime = 9, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_pine_wood_closed", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_aspen_wood_closed", + burntime = 5, +}) diff --git a/mods/doors/license.txt b/mods/doors/license.txt new file mode 100644 index 00000000..8ce73c49 --- /dev/null +++ b/mods/doors/license.txt @@ -0,0 +1,164 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2015-2016 sofar (sofar@foo-projects.org) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2011-2016 Fernando Zapata +Copyright (C) 2014-2016 celeron55 +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2015-2016 sofar +Copyright (C) 2016 red-001 +Copyright (C) 2016 paramat + +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/ + +----------------------- + +Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +Copyright (C) 2014-2016 PenguinDad + +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/4.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2014 CGEffex +Copyright (C) 2014 bennstir +Copyright (C) 2016 BarkersPinhead +Copyright (C) 2016 rivernile7 +Copyright (C) 2016 HazMatt + +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. + +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/3.0/ + +----------------------- + +CC0 1.0 Universal (CC0 1.0) Public Domain Dedication +mhtaylor67 +SkeetMasterFunk69 + +No Copyright + +The person who associated a work with this deed has dedicated the work to the public +domain by waiving all of his or her rights to the work worldwide under copyright law, +including all related and neighboring rights, to the extent allowed by law. + +You can copy, modify, distribute and perform the work, even for commercial purposes, all +without asking permission. See Other Information below. + +Other Information + +In no way are the patent or trademark rights of any person affected by CC0, nor are the +rights that other persons may have in the work or in how the work is used, such as +publicity or privacy rights. +Unless expressly stated otherwise, the person who associated a work with this deed makes +no warranties about the work, and disclaims liability for all uses of the work, to the +fullest extent permitted by applicable law. +When using or citing the work, you should not imply endorsement by the author or the +affirmer. + +For more details: +https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/mods/dye/README.txt b/mods/dye/README.txt index b1035419..a2fbdd24 100644 --- a/mods/dye/README.txt +++ b/mods/dye/README.txt @@ -1,15 +1,13 @@ Minetest Game mod: dye ====================== - +See license.txt for license information. See init.lua for documentation. -License of source code and media files: ---------------------------------------- -Copyright (C) 2012 Perttu Ahola (celeron55) - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) +Authors of media (textures) +--------------------------- +Perttu Ahola (celeron55) (CC BY-SA 3.0) diff --git a/mods/dye/license.txt b/mods/dye/license.txt new file mode 100644 index 00000000..bf9d3501 --- /dev/null +++ b/mods/dye/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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) 2012-2016 Perttu Ahola (celeron55) + +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/mods/farming b/mods/farming deleted file mode 160000 index cac6a518..00000000 --- a/mods/farming +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cac6a518ca8652744d5aeb1bae5652b5d1895429 diff --git a/mods/fire/README.txt b/mods/fire/README.txt index 14022f03..099da1c2 100644 --- a/mods/fire/README.txt +++ b/mods/fire/README.txt @@ -1,36 +1,35 @@ Minetest Game mod: fire ======================= +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2012 Perttu Ahola (celeron55) +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) -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. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) +Authors of media (textures and sounds) -------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ Everything not listed in here: -Copyright (C) 2012 Perttu Ahola (celeron55) +Copyright (C) 2012 Perttu Ahola (celeron55) (CC BY-SA 3.0) -fire_small.ogg sampled from: - http://www.freesound.org/people/dobroide/sounds/4211/ +Muadtralk (CC BY-SA 3.0) + fire_basic_flame_animated.png -fire_large.ogg sampled from: - http://www.freesound.org/people/Dynamicell/sounds/17548/ +Gambit (CC BY-SA 3.0) + fire_flint_steel.png -fire_basic_flame_animated.png: - Muadtralk +dobroide (CC BY 3.0) +http://www.freesound.org/people/dobroide/sounds/4211/ + fire_small.ogg -fire_flint_steel.png - Gambit (WTFPL) +Dynamicell (CC BY 3.0) +http://www.freesound.org/people/Dynamicell/sounds/17548/ + fire_large.ogg + fire_fire.*.ogg +fire_small.ogg and fire_large.ogg are unused but kept temporarily to not break +other mods that may use them. + +Benboncan (CC BY 3.0) +https://www.freesound.org/people/Benboncan/sounds/66457/ + fire_flint_and_steel.ogg diff --git a/mods/fire/init.lua b/mods/fire/init.lua index 6543ceef..bee487a5 100644 --- a/mods/fire/init.lua +++ b/mods/fire/init.lua @@ -1,11 +1,13 @@ --- minetest/fire/init.lua - -- Global namespace for functions fire = {} --- Register flame nodes +-- +-- Items +-- + +-- Flame nodes minetest.register_node("fire:basic_flame", { drawtype = "firelike", @@ -34,22 +36,17 @@ minetest.register_node("fire:basic_flame", { minetest.remove_node(pos) return end - -- restart timer + -- Restart timer return true end, drop = "", on_construct = function(pos) minetest.get_node_timer(pos):start(math.random(30, 60)) - minetest.after(0, fire.update_sounds_around, pos) end, - on_destruct = function(pos) - minetest.after(0, fire.update_sounds_around, pos) + on_blast = function() -- Unaffected by explosions end, - - on_blast = function() - end, -- unaffected by explosions }) minetest.register_node("fire:permanent_flame", { @@ -76,7 +73,7 @@ minetest.register_node("fire:permanent_flame", { groups = {igniter = 2, dig_immediate = 3}, drop = "", - on_blast = function() + on_blast = function() -- Unaffected by explosions end, }) @@ -86,46 +83,40 @@ minetest.register_node("fire:permanent_flame", { minetest.register_tool("fire:flint_and_steel", { description = "Flint and Steel", inventory_image = "fire_flint_steel.png", + sound = {breaks = "default_tool_breaks"}, + on_use = function(itemstack, user, pointed_thing) - itemstack:add_wear(1000) local pt = pointed_thing + minetest.sound_play( + "fire_flint_and_steel", + {pos = pt.above, gain = 0.5, max_hear_distance = 8} + ) if pt.type == "node" then local node_under = minetest.get_node(pt.under).name - local is_coalblock = node_under == "default:coalblock" - local is_tnt = node_under == "tnt:tnt" - local is_gunpowder = node_under == "tnt:gunpowder" - if minetest.get_item_group(node_under, "flammable") >= 1 or - is_coalblock or is_tnt or is_gunpowder then - local flame_pos = pt.above - if is_coalblock then - flame_pos = {x = pt.under.x, y = pt.under.y + 1, z = pt.under.z} - elseif is_tnt or is_gunpowder then - flame_pos = pt.under - end - if minetest.get_node(flame_pos).name == "air" or - is_tnt or is_gunpowder then - local player_name = user:get_player_name() - if not minetest.is_protected(flame_pos, player_name) then - if is_coalblock then - minetest.set_node(flame_pos, - {name = "fire:permanent_flame"}) - elseif is_tnt then - minetest.set_node(flame_pos, - {name = "tnt:tnt_burning"}) - elseif is_gunpowder then - minetest.set_node(flame_pos, - {name = "tnt:gunpowder_burning"}) - else - minetest.set_node(flame_pos, - {name = "fire:basic_flame"}) - end - else - minetest.chat_send_player(player_name, "This area is protected") - end - end + local nodedef = minetest.registered_nodes[node_under] + if not nodedef then + return + end + local player_name = user:get_player_name() + if minetest.is_protected(pt.under, player_name) then + minetest.chat_send_player(player_name, "This area is protected") + return + end + if nodedef.on_ignite then + nodedef.on_ignite(pt.under, user) + elseif minetest.get_item_group(node_under, "flammable") >= 1 + and minetest.get_node(pt.above).name == "air" then + minetest.set_node(pt.above, {name = "fire:basic_flame"}) end end if not minetest.setting_getbool("creative_mode") then + -- Wear tool + local wdef = itemstack:get_definition() + itemstack:add_wear(1000) + -- Tool break sound + if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then + minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5}) + end return itemstack end end @@ -149,75 +140,142 @@ minetest.override_item("default:coalblock", { minetest.remove_node(pos) end end, + on_ignite = function(pos, igniter) + local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z} + if minetest.get_node(flame_pos).name == "air" then + minetest.set_node(flame_pos, {name = "fire:permanent_flame"}) + end + end, }) --- Get sound area of position +-- +-- Sound +-- -fire.D = 6 -- size of sound areas +local flame_sound = minetest.setting_getbool("flame_sound") +if flame_sound == nil then + -- Enable if no setting present + flame_sound = true +end -function fire.get_area_p0p1(pos) - local p0 = { - x = math.floor(pos.x / fire.D) * fire.D, - y = math.floor(pos.y / fire.D) * fire.D, - z = math.floor(pos.z / fire.D) * fire.D, - } - local p1 = { - x = p0.x + fire.D - 1, - y = p0.y + fire.D - 1, - z = p0.z + fire.D - 1 - } - return p0, p1 +if flame_sound then + + local handles = {} + local timer = 0 + + -- Parameters + + local radius = 8 -- Flame node search radius around player + local cycle = 3 -- Cycle time for sound updates + + -- Update sound for player + + function fire.update_player_sound(player) + local player_name = player:get_player_name() + -- Search for flame nodes in radius around player + local ppos = player:getpos() + local areamin = vector.subtract(ppos, radius) + local areamax = vector.add(ppos, radius) + local fpos, num = minetest.find_nodes_in_area( + areamin, + areamax, + {"fire:basic_flame", "fire:permanent_flame"} + ) + -- Total number of flames in radius + local flames = (num["fire:basic_flame"] or 0) + + (num["fire:permanent_flame"] or 0) + -- Stop previous sound + if handles[player_name] then + minetest.sound_stop(handles[player_name]) + handles[player_name] = nil + end + -- If flames + if flames > 0 then + -- Find centre of flame positions + local fposmid = fpos[1] + -- If more than 1 flame + if #fpos > 1 then + local fposmin = areamax + local fposmax = areamin + for i = 1, #fpos do + local fposi = fpos[i] + if fposi.x > fposmax.x then + fposmax.x = fposi.x + end + if fposi.y > fposmax.y then + fposmax.y = fposi.y + end + if fposi.z > fposmax.z then + fposmax.z = fposi.z + end + if fposi.x < fposmin.x then + fposmin.x = fposi.x + end + if fposi.y < fposmin.y then + fposmin.y = fposi.y + end + if fposi.z < fposmin.z then + fposmin.z = fposi.z + end + end + fposmid = vector.divide(vector.add(fposmin, fposmax), 2) + end + -- Play sound + local handle = minetest.sound_play( + "fire_fire", + { + pos = fposmid, + to_player = player_name, + gain = math.min(0.06 * (1 + flames * 0.125), 0.18), + max_hear_distance = 32, + loop = true, -- In case of lag + } + ) + -- Store sound handle for this player + if handle then + handles[player_name] = handle + end + end + end + + -- Cycle for updating players sounds + + minetest.register_globalstep(function(dtime) + timer = timer + dtime + if timer < cycle then + return + end + + timer = 0 + local players = minetest.get_connected_players() + for n = 1, #players do + fire.update_player_sound(players[n]) + end + end) + + -- Stop sound and clear handle on player leave + + minetest.register_on_leaveplayer(function(player) + local player_name = player:get_player_name() + if handles[player_name] then + minetest.sound_stop(handles[player_name]) + handles[player_name] = nil + end + end) end --- Fire sounds table --- key: position hash of low corner of area --- value: {handle=sound handle, name=sound name} -fire.sounds = {} - - --- Update fire sounds in sound area of position +-- Deprecated function kept temporarily to avoid crashes if mod fire nodes call it function fire.update_sounds_around(pos) - local p0, p1 = fire.get_area_p0p1(pos) - local cp = {x = (p0.x + p1.x) / 2, y = (p0.y + p1.y) / 2, z = (p0.z + p1.z) / 2} - local flames_p = minetest.find_nodes_in_area(p0, p1, {"fire:basic_flame"}) - --print("number of flames at "..minetest.pos_to_string(p0).."/" - -- ..minetest.pos_to_string(p1)..": "..#flames_p) - local should_have_sound = (#flames_p > 0) - local wanted_sound = nil - if #flames_p >= 9 then - wanted_sound = {name = "fire_large", gain = 0.7} - elseif #flames_p > 0 then - wanted_sound = {name = "fire_small", gain = 0.9} - end - local p0_hash = minetest.hash_node_position(p0) - local sound = fire.sounds[p0_hash] - if not sound then - if should_have_sound then - fire.sounds[p0_hash] = { - handle = minetest.sound_play(wanted_sound, - {pos = cp, max_hear_distance = 16, loop = true}), - name = wanted_sound.name, - } - end - else - if not wanted_sound then - minetest.sound_stop(sound.handle) - fire.sounds[p0_hash] = nil - elseif sound.name ~= wanted_sound.name then - minetest.sound_stop(sound.handle) - fire.sounds[p0_hash] = { - handle = minetest.sound_play(wanted_sound, - {pos = cp, max_hear_distance = 16, loop = true}), - name = wanted_sound.name, - } - end - end end +-- +-- ABMs +-- + -- Extinguish all flames quickly with water, snow, ice minetest.register_abm({ @@ -230,7 +288,7 @@ minetest.register_abm({ action = function(pos, node, active_object_count, active_object_count_wider) minetest.remove_node(pos) minetest.sound_play("fire_extinguish_flame", - {pos = pos, max_hear_distance = 16, gain = 0.25}) + {pos = pos, max_hear_distance = 16, gain = 0.15}) end, }) @@ -246,7 +304,7 @@ end if not fire_enabled then - -- Remove basic flames only + -- Remove basic flames only if fire disabled minetest.register_abm({ label = "Remove disabled fire", @@ -280,7 +338,7 @@ else -- Fire enabled end, }) - -- Remove flammable nodes + -- Remove flammable nodes around basic flame minetest.register_abm({ label = "Remove flammable nodes", @@ -292,49 +350,16 @@ else -- Fire enabled action = function(pos, node, active_object_count, active_object_count_wider) local p = minetest.find_node_near(pos, 1, {"group:flammable"}) if p then - -- remove flammable nodes around flame local flammable_node = minetest.get_node(p) local def = minetest.registered_nodes[flammable_node.name] if def.on_burn then def.on_burn(p) else minetest.remove_node(p) - nodeupdate(p) + minetest.check_for_falling(p) end end end, }) end - - --- Rarely ignite things from far - ---[[ Currently disabled to reduce the chance of uncontrollable spreading - fires that disrupt servers. Also for less lua processing load. - -minetest.register_abm({ - nodenames = {"group:igniter"}, - neighbors = {"air"}, - interval = 5, - chance = 10, - action = function(pos, node, active_object_count, active_object_count_wider) - local reg = minetest.registered_nodes[node.name] - if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then - return - end - local d = reg.groups.igniter - local p = minetest.find_node_near(pos, d, {"group:flammable"}) - if p then - -- If there is water or stuff like that around flame, don't ignite - if fire.flame_should_extinguish(p) then - return - end - local p2 = fire.find_pos_for_flame_around(p) - if p2 then - minetest.set_node(p2, {name = "fire:basic_flame"}) - end - end - end, -}) ---]] diff --git a/mods/fire/license.txt b/mods/fire/license.txt new file mode 100644 index 00000000..43f9cd7f --- /dev/null +++ b/mods/fire/license.txt @@ -0,0 +1,84 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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 and sounds) +--------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Muadtralk +Copyright (C) 2013-2016 Gambit + +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/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2005 dobroide +Copyright (C) 2006 Dynamicell +Copyright (C) 2009 Benboncan + +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. + +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/3.0/ diff --git a/mods/fire/sounds/fire_fire.1.ogg b/mods/fire/sounds/fire_fire.1.ogg new file mode 100644 index 00000000..cbfee4c6 Binary files /dev/null and b/mods/fire/sounds/fire_fire.1.ogg differ diff --git a/mods/fire/sounds/fire_fire.2.ogg b/mods/fire/sounds/fire_fire.2.ogg new file mode 100644 index 00000000..e8d0eb13 Binary files /dev/null and b/mods/fire/sounds/fire_fire.2.ogg differ diff --git a/mods/fire/sounds/fire_fire.3.ogg b/mods/fire/sounds/fire_fire.3.ogg new file mode 100644 index 00000000..5cad3d9b Binary files /dev/null and b/mods/fire/sounds/fire_fire.3.ogg differ diff --git a/mods/fire/sounds/fire_flint_and_steel.ogg b/mods/fire/sounds/fire_flint_and_steel.ogg new file mode 100644 index 00000000..6996e16f Binary files /dev/null and b/mods/fire/sounds/fire_flint_and_steel.ogg differ diff --git a/mods/flowers/README.txt b/mods/flowers/README.txt index ebd4a21f..2a5e4de3 100644 --- a/mods/flowers/README.txt +++ b/mods/flowers/README.txt @@ -1,23 +1,26 @@ Minetest Game mod: flowers ========================== +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2012-2013 Ironzorg, VanessaE +Authors of source code +---------------------- +Originally by Ironzorg (MIT) and VanessaE (MIT) +Various Minetest developers and contributors (MIT) -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Authors of media (textures) +--------------------------- +RHRhino (CC BY-SA 3.0): + flowers_dandelion_white.png + flowers_dandelion_yellow.png + flowers_geranium.png + flowers_rose.png + flowers_tulip.png + flowers_viola.png -License of media (textures and sounds) --------------------------------------- -WTFPL +Gambit (CC BY-SA 3.0): + flowers_mushroom_brown.png + flowers_mushroom_red.png + flowers_waterlily.png -Gambit (WTFPL): - flowers_mushroom_*.png - flowers_waterlily.png - -DanDuncombe (WTFPL): - flowers_spores_*.png +yyt16384 (CC BY-SA 3.0): + flowers_waterlily_bottom.png, derived from Gambit's texture diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index c60d0897..cf363167 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -57,12 +57,42 @@ local function add_simple_flower(name, desc, box, f_groups) end flowers.datas = { - {"rose", "Rose", {-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_red = 1}}, - {"tulip", "Orange Tulip", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_orange = 1}}, - {"dandelion_yellow", "Yellow Dandelion", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_yellow = 1}}, - {"geranium", "Blue Geranium", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_blue = 1}}, - {"viola", "Viola", {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5}, {color_violet = 1}}, - {"dandelion_white", "White dandelion", {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5}, {color_white = 1}} + { + "rose", + "Rose", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 5 / 16, 2 / 16}, + {color_red = 1, flammable = 1} + }, + { + "tulip", + "Orange Tulip", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 3 / 16, 2 / 16}, + {color_orange = 1, flammable = 1} + }, + { + "dandelion_yellow", + "Yellow Dandelion", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 4 / 16, 2 / 16}, + {color_yellow = 1, flammable = 1} + }, + { + "geranium", + "Blue Geranium", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 2 / 16, 2 / 16}, + {color_blue = 1, flammable = 1} + }, + { + "viola", + "Viola", + {-5 / 16, -0.5, -5 / 16, 5 / 16, -1 / 16, 5 / 16}, + {color_violet = 1, flammable = 1} + }, + { + "dandelion_white", + "White dandelion", + {-5 / 16, -0.5, -5 / 16, 5 / 16, -2 / 16, 5 / 16}, + {color_white = 1, flammable = 1} + }, } for _,item in pairs(flowers.datas) do @@ -136,12 +166,12 @@ minetest.register_node("flowers:mushroom_red", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, attached_node = 1, mushroom = 1}, + groups = {snappy = 3, attached_node = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), on_use = minetest.item_eat(-5), selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, } }) @@ -155,12 +185,12 @@ minetest.register_node("flowers:mushroom_brown", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, attached_node = 1, mushroom = 1}, + groups = {snappy = 3, attached_node = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), on_use = minetest.item_eat(1), selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3} + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, -2 / 16, 3 / 16}, } }) @@ -229,16 +259,16 @@ minetest.register_node("flowers:waterlily", { buildable_to = true, sunlight_propagates = true, floodable = true, - groups = {snappy = 3, flower = 1}, + groups = {snappy = 3, flower = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), node_placement_prediction = "", node_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.46875, 0.5} + fixed = {-0.5, -0.5, -0.5, 0.5, -15 / 32, 0.5} }, selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5} + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, -15 / 32, 7 / 16} }, on_place = function(itemstack, placer, pointed_thing) diff --git a/mods/flowers/license.txt b/mods/flowers/license.txt new file mode 100644 index 00000000..d3011622 --- /dev/null +++ b/mods/flowers/license.txt @@ -0,0 +1,62 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Ironzorg, VanessaE +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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) 2014-2016 RHRhino +Copyright (C) 2015-2016 Gambit +Copyright (C) 2016 yyt16384 + +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/mods/flowers/mapgen.lua b/mods/flowers/mapgen.lua index d4fad872..f2d853b3 100644 --- a/mods/flowers/mapgen.lua +++ b/mods/flowers/mapgen.lua @@ -94,8 +94,7 @@ local function register_flower(seed, name) octaves = 3, persist = 0.6 }, - biomes = {"stone_grassland", "sandstone_grassland", - "deciduous_forest", "coniferous_forest"}, + biomes = {"grassland", "deciduous_forest", "coniferous_forest"}, y_min = 1, y_max = 31000, decoration = "flowers:"..name, @@ -110,7 +109,7 @@ local function register_mushroom(name) noise_params = { offset = 0, scale = 0.006, - spread = {x = 200, y = 200, z = 200}, + spread = {x = 250, y = 250, z = 250}, seed = 2, octaves = 3, persist = 0.66 @@ -135,10 +134,10 @@ local function register_waterlily() octaves = 3, persist = 0.7 }, - biomes = {"rainforest_swamp", "savanna_swamp", "deciduous_forest_swamp"}, + biomes = {"rainforest_swamp", "savanna_shore", "deciduous_forest_shore"}, y_min = 0, y_max = 0, - schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts", + schematic = minetest.get_modpath("flowers") .. "/schematics/waterlily.mts", rotation = "random", }) end @@ -162,12 +161,9 @@ end -- Detect mapgen to select functions -- --- Mods using singlenode mapgen can call these functions to enable --- the use of minetest.generate_ores or minetest.generate_decorations - local mg_name = minetest.get_mapgen_setting("mg_name") if mg_name == "v6" then flowers.register_mgv6_decorations() ---elseif mg_name ~= "singlenode" then +else -- flowers.register_decorations() end diff --git a/mods/flowers/schematics/waterlily.mts b/mods/flowers/schematics/waterlily.mts index 876310cc..69e1d8e0 100644 Binary files a/mods/flowers/schematics/waterlily.mts and b/mods/flowers/schematics/waterlily.mts differ diff --git a/mods/give_initial_stuff/README.txt b/mods/give_initial_stuff/README.txt new file mode 100644 index 00000000..cbd240fe --- /dev/null +++ b/mods/give_initial_stuff/README.txt @@ -0,0 +1,8 @@ +Minetest Game mod: give_initial_stuff +===================================== +See license.txt for license information. + +Authors of source code +---------------------- +Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) diff --git a/mods/give_initial_stuff/license.txt b/mods/give_initial_stuff/license.txt new file mode 100644 index 00000000..8134c920 --- /dev/null +++ b/mods/give_initial_stuff/license.txt @@ -0,0 +1,25 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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 diff --git a/mods/nyancat/README.txt b/mods/nyancat/README.txt index 2e7de71d..fadc1d23 100644 --- a/mods/nyancat/README.txt +++ b/mods/nyancat/README.txt @@ -1,28 +1,15 @@ Minetest Game mod: nyancat ========================== +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2011-2012 celeron55, Perttu Ahola - -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. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ +Authors of source code +---------------------- +Originally by celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) Authors of media files ------------------------ -Everything not listed in here: -Copyright (C) 2010-2012 celeron55, Perttu Ahola - -VanessaE (WTFPL): +---------------------- +VanessaE (CC BY-SA 3.0): nyancat_front.png nyancat_back.png nyancat_side.png diff --git a/mods/nyancat/init.lua b/mods/nyancat/init.lua index 2e64bc12..2feaa9e5 100644 --- a/mods/nyancat/init.lua +++ b/mods/nyancat/init.lua @@ -2,6 +2,8 @@ minetest.register_node("nyancat:nyancat", { description = "Nyan Cat", tiles = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png", "nyancat_side.png", "nyancat_back.png", "nyancat_front.png"}, + paramtype = "light", + light_source = default.LIGHT_MAX, paramtype2 = "facedir", groups = {cracky = 2}, is_ground_content = false, @@ -16,6 +18,8 @@ minetest.register_node("nyancat:nyancat_rainbow", { "nyancat_rainbow.png^[transformR90", "nyancat_rainbow.png" }, + paramtype = "light", + light_source = default.LIGHT_MAX, paramtype2 = "facedir", groups = {cracky = 2}, is_ground_content = false, diff --git a/mods/nyancat/license.txt b/mods/nyancat/license.txt new file mode 100644 index 00000000..3aa38617 --- /dev/null +++ b/mods/nyancat/license.txt @@ -0,0 +1,50 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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-2016 VanessaE + +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/mods/screwdriver/README.txt b/mods/screwdriver/README.txt new file mode 100644 index 00000000..9d39c58c --- /dev/null +++ b/mods/screwdriver/README.txt @@ -0,0 +1,13 @@ +Minetest Game mod: screwdriver +============================== +See license.txt for license information. + +License of source code +---------------------- +Originally by RealBadAngel, Maciej Kasatkin (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +License of media (textures) +--------------------------- +Created by Gambit (CC BY-SA 3.0): + screwdriver.png diff --git a/mods/screwdriver/license.txt b/mods/screwdriver/license.txt new file mode 100644 index 00000000..d9b721bb --- /dev/null +++ b/mods/screwdriver/license.txt @@ -0,0 +1,50 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2013-2016 RealBadAngel, Maciej Kasatkin +Copyright (C) 2013-2016 Various Minetest developers and contributors + +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) 2013-2016 Gambit + +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/mods/screwdriver/readme.txt b/mods/screwdriver/readme.txt deleted file mode 100644 index bdf109b8..00000000 --- a/mods/screwdriver/readme.txt +++ /dev/null @@ -1,21 +0,0 @@ -Minetest Game mod: screwdriver -============================== - -License of source code: ------------------------ -Copyright (C) 2013 RealBadAngel, Maciej Kasatkin - -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 of the License, or -(at your option) any later version. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Created by Gambit (WTFPL): - screwdriver.png diff --git a/mods/sethome/README.txt b/mods/sethome/README.txt new file mode 100644 index 00000000..6f0a282b --- /dev/null +++ b/mods/sethome/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: sethome +========================== +See license.txt for license information. + +Authors of source code +---------------------- +sfan5 (MIT) diff --git a/mods/sethome/init.lua b/mods/sethome/init.lua index 4246f7a5..e0fc453d 100644 --- a/mods/sethome/init.lua +++ b/mods/sethome/init.lua @@ -41,7 +41,12 @@ sethome.set = function(name, pos) end sethome.get = function(name) - return homepos[name] + local pos = homepos[name] + if pos then + return vector.new(pos) + else + return nil + end end sethome.go = function(name) @@ -53,7 +58,10 @@ sethome.go = function(name) return false end -minetest.register_privilege("home", "Can use /sethome and /home") +minetest.register_privilege("home", { + description = "Can use /sethome and /home", + give_to_singleplayer = false +}) minetest.register_chatcommand("home", { description = "Teleport you to your home point", diff --git a/mods/sethome/license.txt b/mods/sethome/license.txt new file mode 100644 index 00000000..09f03b09 --- /dev/null +++ b/mods/sethome/license.txt @@ -0,0 +1,24 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 sfan5 + +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 diff --git a/mods/sfinv/README.md b/mods/sfinv/README.md new file mode 100644 index 00000000..6ff33923 --- /dev/null +++ b/mods/sfinv/README.md @@ -0,0 +1,21 @@ +Simple Fast Inventory +==================== + +![SFINV Screeny](https://cdn.pbrd.co/images/1yQhd1TI.png) + +A cleaner, simpler, solution to having an advanced inventory in Minetest. + +Written by rubenwardy. +License: MIT + +See game_api.txt for this mod's API + +License of source code and media files: +--------------------------------------- +Copyright (C) 2016 rubenwardy + +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. diff --git a/mods/sfinv/api.lua b/mods/sfinv/api.lua new file mode 100644 index 00000000..2fef3c84 --- /dev/null +++ b/mods/sfinv/api.lua @@ -0,0 +1,161 @@ +sfinv = { + pages = {}, + pages_unordered = {}, + contexts = {}, + enabled = true +} + +function sfinv.register_page(name, def) + assert(name, "Invalid sfinv page. Requires a name") + assert(def, "Invalid sfinv page. Requires a def[inition] table") + assert(def.get, "Invalid sfinv page. Def requires a get function.") + assert(not sfinv.pages[name], "Attempt to register already registered sfinv page " .. dump(name)) + + sfinv.pages[name] = def + def.name = name + table.insert(sfinv.pages_unordered, def) +end + +function sfinv.override_page(name, def) + assert(name, "Invalid sfinv page override. Requires a name") + assert(def, "Invalid sfinv page override. Requires a def[inition] table") + local page = sfinv.pages[name] + assert(page, "Attempt to override sfinv page " .. dump(name) .. " which does not exist.") + for key, value in pairs(def) do + page[key] = value + end +end + +function sfinv.get_nav_fs(player, context, nav, current_idx) + -- Only show tabs if there is more than one page + if #nav > 1 then + return "tabheader[0,0;tabs;" .. table.concat(nav, ",") .. ";" .. current_idx .. ";true;false]" + else + return "" + end +end + +local theme_main = "bgcolor[#080808BB;true]" .. default.gui_bg .. + default.gui_bg_img + +local theme_inv = default.gui_slots .. [[ + list[current_player;main;0,4.7;8,1;] + list[current_player;main;0,5.85;8,3;8] + ]] + +function sfinv.make_formspec(player, context, content, show_inv, size) + local tmp = { + size or "size[8,8.6]", + theme_main, + sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx), + content + } + if show_inv then + tmp[#tmp + 1] = theme_inv + end + return table.concat(tmp, "") +end + +function sfinv.get_homepage_name(player) + return "sfinv:crafting" +end + +function sfinv.get_formspec(player, context) + -- Generate navigation tabs + local nav = {} + local nav_ids = {} + local current_idx = 1 + for i, pdef in pairs(sfinv.pages_unordered) do + if not pdef.is_in_nav or pdef:is_in_nav(player, context) then + nav[#nav + 1] = pdef.title + nav_ids[#nav_ids + 1] = pdef.name + if pdef.name == context.page then + current_idx = i + end + end + end + context.nav = nav_ids + context.nav_titles = nav + context.nav_idx = current_idx + + -- Generate formspec + local page = sfinv.pages[context.page] or sfinv.pages["404"] + if page then + return page:get(player, context) + else + local old_page = context.page + context.page = sfinv.get_homepage_name(player) + assert(sfinv.pages[context.page], "[sfinv] Invalid homepage") + minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) .. " so using switching to homepage") + return sfinv.get_formspec(player, context) + end +end + +function sfinv.set_player_inventory_formspec(player, context) + if not context then + local name = player:get_player_name() + context = sfinv.contexts[name] + if not context then + context = { + page = sfinv.get_homepage_name(player) + } + sfinv.contexts[name] = context + end + end + + local fs = sfinv.get_formspec(player, context) + player:set_inventory_formspec(fs) +end + +minetest.register_on_joinplayer(function(player) + if sfinv.enabled then + minetest.after(0.5, function() + sfinv.set_player_inventory_formspec(player) + end) + end +end) + +minetest.register_on_leaveplayer(function(player) + sfinv.contexts[player:get_player_name()] = nil +end) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "" or not sfinv.enabled then + return false + end + + -- Get Context + local name = player:get_player_name() + local context = sfinv.contexts[name] + if not context then + sfinv.set_player_inventory_formspec(player) + return false + end + + -- Handle Events + if fields.tabs and context.nav then + local tid = tonumber(fields.tabs) + if tid and tid > 0 then + local id = context.nav[tid] + local page = sfinv.pages[id] + if id and page then + local oldpage = sfinv.pages[context.page] + if oldpage and oldpage.on_leave then + oldpage:on_leave(player, context) + end + context.page = id + if page.on_enter then + page:on_enter(player, context) + end + sfinv.set_player_inventory_formspec(player, context) + end + end + return + end + + -- Pass to page + local page = sfinv.pages[context.page] + if page and page.on_player_receive_fields then + return page:on_player_receive_fields(player, context, fields) + end +end) diff --git a/mods/sfinv/depends.txt b/mods/sfinv/depends.txt new file mode 100644 index 00000000..4ad96d51 --- /dev/null +++ b/mods/sfinv/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/sfinv/init.lua b/mods/sfinv/init.lua new file mode 100644 index 00000000..f030222c --- /dev/null +++ b/mods/sfinv/init.lua @@ -0,0 +1,22 @@ +dofile(minetest.get_modpath("sfinv") .. "/api.lua") + +sfinv.register_page("sfinv:crafting", { + title = "Crafting", + get = function(self, player, context) + return sfinv.make_formspec(player, context, [[ + list[current_player;craft;1.75,0.5;3,3;] + list[current_player;craftpreview;5.75,1.5;1,1;] + image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270] + listring[current_player;main] + listring[current_player;craft] + image[0,4.75;1,1;gui_hb_bg.png] + image[1,4.75;1,1;gui_hb_bg.png] + image[2,4.75;1,1;gui_hb_bg.png] + image[3,4.75;1,1;gui_hb_bg.png] + image[4,4.75;1,1;gui_hb_bg.png] + image[5,4.75;1,1;gui_hb_bg.png] + image[6,4.75;1,1;gui_hb_bg.png] + image[7,4.75;1,1;gui_hb_bg.png] + ]], true) + end +}) diff --git a/mods/stairs/README.txt b/mods/stairs/README.txt index 9bd0b213..d32cd71b 100644 --- a/mods/stairs/README.txt +++ b/mods/stairs/README.txt @@ -1,26 +1,16 @@ Minetest Game mod: stairs ========================= +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2011-2012 Kahrl -Copyright (C) 2011-2012 celeron55, Perttu Ahola +Authors of source code +---------------------- +Originally by Kahrl (LGPL 2.1) and +celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) -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 of the License, or -(at your option) any later version. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ -Everything not listed in here: -Copyright (C) 2010-2012 celeron55, Perttu Ahola +Authors of media (models) +------------------------- +Jean-Patrick G. (kilbith) (CC BY-SA 3.0): + stairs_stair.obj diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index 38640778..a4e343cf 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -109,10 +109,29 @@ function stairs.register_stair(subname, recipeitem, groups, images, description, {recipeitem, recipeitem, recipeitem}, }, }) + + -- Fuel + local baseburntime = minetest.get_craft_result({ + method = "fuel", + width = 1, + items = {recipeitem} + }).time + if baseburntime > 0 then + minetest.register_craft({ + type = "fuel", + recipe = 'stairs:stair_' .. subname, + burntime = math.floor(baseburntime * 0.75), + }) + end end end +-- Slab facedir to placement 6d matching table +local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4} +-- Slab facedir when placing initial slab against other surface +local slab_trans_dir_place = {[0] = 0, 20, 12, 16, 4, 8} + -- Register slabs. -- Node will be called stairs:slab_ @@ -132,86 +151,61 @@ function stairs.register_slab(subname, recipeitem, groups, images, description, fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, }, on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then - return itemstack - end + local under = minetest.get_node(pointed_thing.under) + local wield_item = itemstack:get_name() - -- If it's being placed on an another similar one, replace it with - -- a full block - local slabpos = nil - local slabnode = nil - local p0 = pointed_thing.under - local p1 = pointed_thing.above - local n0 = minetest.get_node(p0) - local n1 = minetest.get_node(p1) - local param2 = 0 + if under and wield_item == under.name then + -- place slab using under node orientation + local dir = minetest.dir_to_facedir(vector.subtract( + pointed_thing.above, pointed_thing.under), true) - local n0_is_upside_down = (n0.name == "stairs:slab_" .. subname and - n0.param2 >= 20) + local p2 = under.param2 - if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and - p0.y + 1 == p1.y then - slabpos = p0 - slabnode = n0 - elseif n1.name == "stairs:slab_" .. subname then - slabpos = p1 - slabnode = n1 - end - if slabpos then - -- Remove the slab at slabpos - minetest.remove_node(slabpos) - -- Make a fake stack of a single item and try to place it - local fakestack = ItemStack(recipeitem) - fakestack:set_count(itemstack:get_count()) - - pointed_thing.above = slabpos - local success - fakestack, success = minetest.item_place(fakestack, placer, - pointed_thing) - -- If the item was taken from the fake stack, decrement original - if success then - itemstack:set_count(fakestack:get_count()) - -- Else put old node back - else - minetest.set_node(slabpos, slabnode) - end - return itemstack - end - - -- Upside down slabs - if p0.y - 1 == p1.y then - -- Turn into full block if pointing at a existing slab - if n0_is_upside_down then - -- Remove the slab at the position of the slab - minetest.remove_node(p0) - -- Make a fake stack of a single item and try to place it - local fakestack = ItemStack(recipeitem) - fakestack:set_count(itemstack:get_count()) - - pointed_thing.above = p0 - local success - fakestack, success = minetest.item_place(fakestack, placer, - pointed_thing) - -- If the item was taken from the fake stack, decrement original - if success then - itemstack:set_count(fakestack:get_count()) - -- Else put old node back - else - minetest.set_node(p0, n0) + -- combine two slabs if possible + if slab_trans_dir[math.floor(p2 / 4)] == dir then + if not recipeitem then + return itemstack + end + local player_name = placer:get_player_name() + if minetest.is_protected(pointed_thing.under, player_name) and not + minetest.check_player_privs(placer, "protection_bypass") then + minetest.record_protection_violation(pointed_thing.under, + player_name) + return + end + minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2}) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() end return itemstack end - -- Place upside down slab - param2 = 20 - end + -- Placing a slab on an upside down slab should make it right-side up. + if p2 >= 20 and dir == 8 then + p2 = p2 - 20 + -- same for the opposite case: slab below normal slab + elseif p2 <= 3 and dir == 4 then + p2 = p2 + 20 + end - -- If pointing at the side of a upside down slab - if n0_is_upside_down and p0.y + 1 ~= p1.y then - param2 = 20 - end + -- else attempt to place node with proper param2 + minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + else + -- place slab using look direction of player + local dir = minetest.dir_to_wallmounted(vector.subtract( + pointed_thing.above, pointed_thing.under), true) - return minetest.item_place(itemstack, placer, pointed_thing, param2) + local rot = slab_trans_dir_place[dir] + if rot == 0 or rot == 20 then + rot = rot + minetest.dir_to_facedir(placer:get_look_dir()) + end + + return minetest.item_place(itemstack, placer, pointed_thing, rot) + end end, }) @@ -230,6 +224,20 @@ function stairs.register_slab(subname, recipeitem, groups, images, description, {recipeitem, recipeitem, recipeitem}, }, }) + + -- Fuel + local baseburntime = minetest.get_craft_result({ + method = "fuel", + width = 1, + items = {recipeitem} + }).time + if baseburntime > 0 then + minetest.register_craft({ + type = "fuel", + recipe = 'stairs:slab_' .. subname, + burntime = math.floor(baseburntime * 0.5), + }) + end end end @@ -496,7 +504,7 @@ stairs.register_stair_and_slab( {"default_steel_block.png"}, "Steel Block Stair", "Steel Block Slab", - default.node_sound_stone_defaults() + default.node_sound_metal_defaults() ) stairs.register_stair_and_slab( @@ -506,7 +514,7 @@ stairs.register_stair_and_slab( {"default_copper_block.png"}, "Copper Block Stair", "Copper Block Slab", - default.node_sound_stone_defaults() + default.node_sound_metal_defaults() ) stairs.register_stair_and_slab( @@ -516,7 +524,7 @@ stairs.register_stair_and_slab( {"default_bronze_block.png"}, "Bronze Block Stair", "Bronze Block Slab", - default.node_sound_stone_defaults() + default.node_sound_metal_defaults() ) stairs.register_stair_and_slab( @@ -526,5 +534,5 @@ stairs.register_stair_and_slab( {"default_gold_block.png"}, "Gold Block Stair", "Gold Block Slab", - default.node_sound_stone_defaults() + default.node_sound_metal_defaults() ) diff --git a/mods/stairs/license.txt b/mods/stairs/license.txt new file mode 100644 index 00000000..8f16bbd7 --- /dev/null +++ b/mods/stairs/license.txt @@ -0,0 +1,51 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 Kahrl +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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 (models) +-------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) + +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/mods/tnt/README.txt b/mods/tnt/README.txt index df98f7e2..c1ca88d5 100644 --- a/mods/tnt/README.txt +++ b/mods/tnt/README.txt @@ -1,37 +1,41 @@ Minetest Game mod: tnt ====================== -by PilzAdam and ShadowNinja +See license.txt for license information. -Introduction: +Authors of source code +---------------------- +PilzAdam (MIT) +ShadowNinja (MIT) +sofar (sofar@foo-projects.org) (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +BlockMen (CC BY-SA 3.0): +All textures not mentioned below. + +ShadowNinja (CC BY-SA 3.0): +tnt_smoke.png + +Wuzzy (CC BY-SA 3.0): +All gunpowder textures except tnt_gunpowder_inventory.png. + +sofar (sofar@foo-projects.org) (CC BY-SA 3.0): +tnt_blast.png + +Introduction +------------ This mod adds TNT to Minetest. TNT is a tool to help the player in mining. How to use the mod: -Craft gunpowder by placing coal and gravel in the crafting area. The -gunpowder can be used to craft TNT or as fuze for TNT. To craft TNT -surround gunpowder with 4 wood in a + shape. +Craft gunpowder by placing coal and gravel in the crafting area. +The gunpowder can be used to craft TNT or as fuse for TNT. +To craft TNT surround gunpowder with 4 wood in a + shape. + There are different ways to blow up TNT: 1. Hit it with a torch. - 2. Hit a gunpowder fuze that leads to a TNT block with a torch. - 3. Activate it with mesecons (fastest way) -Be aware of the damage radius of 7 blocks! + 2. Hit a gunpowder fuse that leads to a TNT block with a torch or flint-and-steel. + 3. Activate it with mesecons (fastest way). -License: -WTFPL (see below) - -See also: -http://minetest.net/ - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2004 Sam Hocevar - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. +Be aware of the damage radius of 6 blocks! diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index 1b20d146..ec53b83a 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -94,7 +94,7 @@ local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_p return c_fire else local node_drops = minetest.get_node_drops(def.name, "") - for _, item in ipairs(node_drops) do + for _, item in pairs(node_drops) do add_drop(drops, item) end return c_air @@ -176,7 +176,7 @@ local function entity_physics(pos, radius, drops) }, nil) end end - for _, item in ipairs(entity_drops) do + for _, item in pairs(entity_drops) do add_drop(drops, item) end end @@ -243,8 +243,8 @@ local function add_effects(pos, radius, drops) }) end -function tnt.burn(pos) - local name = minetest.get_node(pos).name +function tnt.burn(pos, nodename) + local name = nodename or minetest.get_node(pos).name local group = minetest.get_item_group(name, "tnt") if group > 0 then minetest.sound_play("tnt_ignite", {pos = pos}) @@ -327,25 +327,26 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast) vm:update_map() vm:update_liquids() - -- call nodeupdate for everything within 1.5x blast radius + -- call check_single_for_falling for everything within 1.5x blast radius + for y = -radius * 1.5, radius * 1.5 do for z = -radius * 1.5, radius * 1.5 do for x = -radius * 1.5, radius * 1.5 do - for y = -radius * 1.5, radius * 1.5 do - local s = vector.add(pos, {x = x, y = y, z = z}) - local r = vector.distance(pos, s) + local rad = {x = x, y = y, z = z} + local s = vector.add(pos, rad) + local r = vector.length(rad) if r / radius < 1.4 then - nodeupdate(s) + minetest.check_single_for_falling(s) end end end end - for _, queued_data in ipairs(on_blast_queue) do + for _, queued_data in pairs(on_blast_queue) do local dist = math.max(1, vector.distance(queued_data.pos, pos)) local intensity = (radius * radius) / (dist * dist) local node_drops = queued_data.on_blast(queued_data.pos, intensity) if node_drops then - for _, item in ipairs(node_drops) do + for _, item in pairs(node_drops) do add_drop(drops, item) end end @@ -398,18 +399,26 @@ minetest.register_node("tnt:gunpowder", { type = "fixed", fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, - groups = {dig_immediate = 2, attached_node = 1, connect_to_raillike = minetest.raillike_group("gunpowder")}, + groups = {dig_immediate = 2, attached_node = 1, flammable = 5, + connect_to_raillike = minetest.raillike_group("gunpowder")}, sounds = default.node_sound_leaves_defaults(), on_punch = function(pos, node, puncher) if puncher:get_wielded_item():get_name() == "default:torch" then if(minetest.check_player_privs(puncher:get_player_name(), {trusted_player=true})) then - tnt.burn(pos) + --tnt.burn(pos) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) end end end, on_blast = function(pos, intensity) - tnt.burn(pos) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, + on_burn = function(pos) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, + on_ignite = function(pos, igniter) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) end, }) @@ -508,7 +517,9 @@ minetest.register_craft({ neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"}, interval = 4, chance = 1, - action = tnt.burn, + action = function(pos, node) + tnt.burn(pos, node.name) + end, }) function tnt.register_tnt(def) @@ -526,32 +537,38 @@ function tnt.register_tnt(def) local tnt_burning = def.tiles.burning or def.name .. "_top_burning_animated.png" if not def.damage_radius then def.damage_radius = def.radius * 2 end - minetest.register_node(":" .. name, { - description = def.description, - tiles = {tnt_top, tnt_bottom, tnt_side}, - is_ground_content = false, - groups = {dig_immediate = 2, mesecon = 2, tnt = 1}, - sounds = default.node_sound_wood_defaults(), - on_punch = function(pos, node, puncher) - if puncher:get_wielded_item():get_name() == "default:torch" then - if(minetest.check_player_privs(puncher:get_player_name(), {trusted_player=true})) then - minetest.set_node(pos, {name = name .. "_burning"}) - end - end - end, - on_blast = function(pos, intensity) - minetest.after(0.1, function() - tnt.boom(pos, def) - end) - end, - --mesecons = {effector = - -- {action_on = - -- function(pos) - -- tnt.boom(pos, def) - -- end - -- } - --}, - }) + if enable_tnt then + minetest.register_node(":" .. name, { + description = def.description, + tiles = {tnt_top, tnt_bottom, tnt_side}, + is_ground_content = false, + groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5}, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + minetest.set_node(pos, {name = name .. "_burning"}) + end + end, + on_blast = function(pos, intensity) + minetest.after(0.1, function() + tnt.boom(pos, def) + end) + end, + mesecons = {effector = + {action_on = + function(pos) + tnt.boom(pos, def) + end + } + }, + on_burn = function(pos) + minetest.set_node(pos, {name = name .. "_burning"}) + end, + on_ignite = function(pos, igniter) + minetest.set_node(pos, {name = name .. "_burning"}) + end, + }) + end minetest.register_node(":" .. name .. "_burning", { tiles = { @@ -578,7 +595,7 @@ function tnt.register_tnt(def) on_construct = function(pos) minetest.sound_play("tnt_ignite", {pos = pos}) minetest.get_node_timer(pos):start(6) - nodeupdate(pos) + minetest.check_for_falling(pos) end, }) end diff --git a/mods/tnt/license.txt b/mods/tnt/license.txt new file mode 100644 index 00000000..210f2bdc --- /dev/null +++ b/mods/tnt/license.txt @@ -0,0 +1,65 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 PilzAdam +Copyright (C) 2014-2016 ShadowNinja +Copyright (C) 2016 sofar (sofar@foo-projects.org) +Copyright (C) 2014-2016 Various Minetest developers and contributors + +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) 2014-2016 BlockMen +Copyright (C) 2014-2016 ShadowNinja +Copyright (C) 2015-2016 Wuzzy +Copyright (C) 2016 sofar (sofar@foo-projects.org) + +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/mods/vessels/README.txt b/mods/vessels/README.txt index c2a802f4..5bb798c8 100644 --- a/mods/vessels/README.txt +++ b/mods/vessels/README.txt @@ -1,50 +1,22 @@ Minetest Game mod: vessels ========================== +See license.txt for license information. -Crafts -------- -Glass bottle (yields 10) +Authors of source code +---------------------- +Originally by Vanessa Ezekowitz (LGPL 2.1) +Modified by Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) - G - G - G - G - - G - +Authors of media (textures) +--------------------------- +All not listed below, Vanessa Ezekowitz (CC BY-SA 3.0) -Drinking Glass (yields 14) +The following textures were modified by Thomas-S (CC BY-SA 3.0): + vessels_drinking_glass.png + vessels_drinking_glass_inv.png + vessels_glass_bottle.png + vessels_steel_bottle.png - G - G - G - G - G G G - -Heavy Steel Bottle (yields 5) - - S - S - S - S - - S - - -License of source code: ------------------------ -Copyright (C) 2012 Vanessa Ezekowitz -Version 2012-09-02 -Modifications by Perttu Ahola - -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. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) --------------------------------------- -WTFPL - -Authors of media files ------------------------ -Unless specifically noted, -Copyright (C) 2012 Vanessa Ezekowitz - -The following textures were modified by Thomas-S (License is CC0): - vessels_drinking_glass.png - vessels_drinking_glass_inv.png (Paramat helped to improve this texture) - vessels_glass_bottle.png - vessels_steel_bottle.png +The following texture was created by Wuzzy (CC BY-SA 3.0): + vessels_shelf_slot.png (based on vessels_glass_bottle.png) diff --git a/mods/vessels/init.lua b/mods/vessels/init.lua index e56cc284..688413f2 100644 --- a/mods/vessels/init.lua +++ b/mods/vessels/init.lua @@ -13,6 +13,25 @@ local vessels_shelf_formspec = "listring[current_player;main]" .. default.get_hotbar_bg(0, 2.85) +local function get_vessels_shelf_formspec(inv) + local formspec = vessels_shelf_formspec + local invlist = inv and inv:get_list("vessels") + -- Inventory slots overlay + local vx, vy = 0, 0.3 + for i = 1, 16 do + if i == 9 then + vx = 0 + vy = vy + 1 + end + if not invlist or invlist[i]:is_empty() then + formspec = formspec .. + "image[" .. vx .. "," .. vy .. ";1,1;vessels_shelf_slot.png]" + end + vx = vx + 1 + end + return formspec +end + minetest.register_node("vessels:shelf", { description = "Vessels Shelf", tiles = {"default_wood.png", "default_wood.png", "default_wood.png", @@ -24,7 +43,7 @@ minetest.register_node("vessels:shelf", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", vessels_shelf_formspec) + meta:set_string("formspec", get_vessels_shelf_formspec(nil)) local inv = meta:get_inventory() inv:set_size("vessels", 8 * 2) end, @@ -41,14 +60,20 @@ minetest.register_node("vessels:shelf", { on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) minetest.log("action", player:get_player_name() .. " moves stuff in vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " moves stuff to vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " takes stuff from vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) end, on_blast = function(pos) local drops = {} @@ -183,3 +208,9 @@ minetest.register_craft( { output = "default:steel_ingot", recipe = "vessels:steel_bottle", }) + +minetest.register_craft({ + type = "fuel", + recipe = "vessels:shelf", + burntime = 30, +}) diff --git a/mods/vessels/license.txt b/mods/vessels/license.txt new file mode 100644 index 00000000..de16a3b0 --- /dev/null +++ b/mods/vessels/license.txt @@ -0,0 +1,52 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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-2016 Vanessa Ezekowitz +Copyright (C) 2016 Thomas-S + +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/mods/vessels/textures/vessels_shelf_slot.png b/mods/vessels/textures/vessels_shelf_slot.png new file mode 100644 index 00000000..ff29082a Binary files /dev/null and b/mods/vessels/textures/vessels_shelf_slot.png differ diff --git a/mods/walls/README.txt b/mods/walls/README.txt new file mode 100644 index 00000000..0389174d --- /dev/null +++ b/mods/walls/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: walls +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Auke Kok (LGPL 2.1) diff --git a/mods/walls/init.lua b/mods/walls/init.lua index 0b51bdb0..bee8e465 100644 --- a/mods/walls/init.lua +++ b/mods/walls/init.lua @@ -1,18 +1,3 @@ - ---[[ - -Walls mod for Minetest - -Copyright (C) 2015 Auke Kok - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. - ---]] - walls = {} walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) diff --git a/mods/walls/license.txt b/mods/walls/license.txt new file mode 100644 index 00000000..ccfaf1cd --- /dev/null +++ b/mods/walls/license.txt @@ -0,0 +1,14 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2015 Auke Kok + +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 diff --git a/mods/wool/README.txt b/mods/wool/README.txt index f57b6dd3..a66677dd 100644 --- a/mods/wool/README.txt +++ b/mods/wool/README.txt @@ -1,28 +1,16 @@ Minetest Game mod: wool ======================= +See license.txt for license information. -Mostly backward-compatible with jordach's 16-color wool mod. - -License of source code: ------------------------ -Copyright (C) 2012 Perttu Ahola (celeron55) - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ -Cisoun: -- wool_black.png wool_brown.png wool_dark_green.png wool_green.png -- wool_magenta.png wool_pink.png wool_violet.png wool_yellow.png wool_blue.png -- wool_cyan.png wool_dark_grey.png wool_grey.png wool_orange.png wool_red.png -- wool_white.png +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) +Authors of media (textures) +--------------------------- +Cisoun (CC BY-SA 3.0): + wool_black.png wool_brown.png wool_dark_green.png wool_green.png + wool_magenta.png wool_pink.png wool_violet.png wool_yellow.png + wool_blue.png wool_cyan.png wool_dark_grey.png wool_grey.png + wool_orange.png wool_red.png wool_white.png diff --git a/mods/wool/license.txt b/mods/wool/license.txt new file mode 100644 index 00000000..93101636 --- /dev/null +++ b/mods/wool/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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) 2012-2016 Cisoun + +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/mods/xpanes/README.txt b/mods/xpanes/README.txt index b89e74a2..bcbc1294 100644 --- a/mods/xpanes/README.txt +++ b/mods/xpanes/README.txt @@ -1,16 +1,21 @@ Minetest Game mod: xpanes ========================= +See license.txt for license information. -License: --------- -Copyright (C) xyz -modified by BlockMen (iron bars) +Authors of source code +---------------------- +Originally by xyz (MIT) +BlockMen (MIT) +sofar (MIT) +Various Minetest developers and contributors (MIT) -Gambit (WTFPL): - xpanes_bar.png +Authors of media (textures) +--------------------------- +xyz (CC BY-SA 3.0): + All textures not mentioned below. -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Gambit (CC BY-SA 3.0): + xpanes_bar.png + +paramat (CC BY-SA 3.0): + xpanes_bar_top.png diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua index 9189912e..77278a5c 100644 --- a/mods/xpanes/init.lua +++ b/mods/xpanes/init.lua @@ -1,156 +1,146 @@ -xpanes = {} -local function rshift(x, by) - return math.floor(x / 2 ^ by) +local function is_pane(pos) + return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0 end -local directions = { - {x = 1, y = 0, z = 0}, - {x = 0, y = 0, z = 1}, - {x = -1, y = 0, z = 0}, - {x = 0, y = 0, z = -1}, -} +local function connects_dir(pos, name, dir) + local aside = vector.add(pos, minetest.facedir_to_dir(dir)) + if is_pane(aside) then + return true + end -local function update_pane(pos, name) - if not minetest.get_node(pos).name:find("^xpanes:"..name) then + local connects_to = minetest.registered_nodes[name].connects_to + if not connects_to then + return false + end + local list = minetest.find_nodes_in_area(aside, aside, connects_to) + + if #list > 0 then + return true + end + + return false +end + +local function swap(pos, node, name, param2) + if node.name == name and node.param2 == param2 then return end - local sum = 0 - for i, dir in pairs(directions) do - local node = minetest.get_node(vector.add(pos, dir)) - local def = minetest.registered_nodes[node.name] - local pane_num = def and def.groups.pane or 0 - if pane_num > 0 or not def or (def.walkable ~= false and - def.drawtype ~= "nodebox") then - sum = sum + 2 ^ (i - 1) + + minetest.set_node(pos, {name = name, param2 = param2}) +end + +local function update_pane(pos) + if not is_pane(pos) then + return + end + local node = minetest.get_node(pos) + local name = node.name + if name:sub(-5) == "_flat" then + name = name:sub(1, -6) + end + + local any = node.param2 + local c = {} + local count = 0 + for dir = 0, 3 do + c[dir] = connects_dir(pos, name, dir) + if c[dir] then + any = dir + count = count + 1 end end - if sum == 0 then - sum = 15 - end - minetest.set_node(pos, {name = "xpanes:"..name.."_"..sum}) -end -local function update_nearby(pos, node) - node = node or minetest.get_node(pos) - local name = node.name - if not name or node.name:sub(1, 7) ~= "xpanes:" then - return - end - local underscore_pos = string.find(name, "_[^_]*$") or 0 - local len = name:len() - local num = tonumber(name:sub(underscore_pos+1, len)) - if not num or num < 1 or num > 15 then - name = name:sub(8) + if count == 0 then + swap(pos, node, name .. "_flat", any) + elseif count == 1 then + swap(pos, node, name .. "_flat", (any + 1) % 4) + elseif count == 2 then + if (c[0] and c[2]) or (c[1] and c[3]) then + swap(pos, node, name .. "_flat", (any + 1) % 4) + else + swap(pos, node, name, 0) + end else - name = name:sub(8, underscore_pos - 1) - end - for i, dir in pairs(directions) do - update_pane(vector.add(pos, dir), name) + swap(pos, node, name, 0) end end -minetest.register_on_placenode(update_nearby) -minetest.register_on_dignode(update_nearby) +minetest.register_on_placenode(function(pos, node) + if minetest.get_item_group(node, "pane") then + update_pane(pos) + end + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) -local half_boxes = { - {0, -0.5, -1/32, 0.5, 0.5, 1/32}, - {-1/32, -0.5, 0, 1/32, 0.5, 0.5}, - {-0.5, -0.5, -1/32, 0, 0.5, 1/32}, - {-1/32, -0.5, -0.5, 1/32, 0.5, 0} -} - -local full_boxes = { - {-0.5, -0.5, -1/32, 0.5, 0.5, 1/32}, - {-1/32, -0.5, -0.5, 1/32, 0.5, 0.5} -} - -local sb_half_boxes = { - {0, -0.5, -0.06, 0.5, 0.5, 0.06}, - {-0.06, -0.5, 0, 0.06, 0.5, 0.5}, - {-0.5, -0.5, -0.06, 0, 0.5, 0.06}, - {-0.06, -0.5, -0.5, 0.06, 0.5, 0} -} - -local sb_full_boxes = { - {-0.5, -0.5, -0.06, 0.5, 0.5, 0.06}, - {-0.06, -0.5, -0.5, 0.06, 0.5, 0.5} -} - -local pane_def_fields = { - drawtype = "airlike", - paramtype = "light", - is_ground_content = false, - sunlight_propagates = true, - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - air_equivalent = true, -} +minetest.register_on_dignode(function(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) +xpanes = {} function xpanes.register_pane(name, def) for i = 1, 15 do - local need = {} - local cnt = 0 - for j = 1, 4 do - if rshift(i, j - 1) % 2 == 1 then - need[j] = true - cnt = cnt + 1 - end - end - local take = {} - local take2 = {} - if need[1] == true and need[3] == true then - need[1] = nil - need[3] = nil - table.insert(take, full_boxes[1]) - table.insert(take2, sb_full_boxes[1]) - end - if need[2] == true and need[4] == true then - need[2] = nil - need[4] = nil - table.insert(take, full_boxes[2]) - table.insert(take2, sb_full_boxes[2]) - end - for k in pairs(need) do - table.insert(take, half_boxes[k]) - table.insert(take2, sb_half_boxes[k]) - end - local texture = def.textures[1] - if cnt == 1 then - texture = def.textures[1].."^"..def.textures[2] - end - minetest.register_node(":xpanes:"..name.."_"..i, { - drawtype = "nodebox", - tiles = {def.textures[3], def.textures[3], texture}, - paramtype = "light", - groups = def.groups, - drop = "xpanes:"..name, - sounds = def.sounds, - node_box = { - type = "fixed", - fixed = take - }, - selection_box = { - type = "fixed", - fixed = take2 - } - }) + minetest.register_alias("xpanes:" .. name .. "_" .. i, "xpanes:" .. name .. "_flat") end - for k, v in pairs(pane_def_fields) do - def[k] = def[k] or v - end + local flatgroups = table.copy(def.groups) + flatgroups.pane = 1 + minetest.register_node(":xpanes:" .. name .. "_flat", { + description = def.description, + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + inventory_image = def.inventory_image, + wield_image = def.wield_image, + paramtype2 = "facedir", + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = flatgroups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + selection_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connect_sides = { "left", "right" }, + }) - def.on_construct = function(pos) - update_pane(pos, name) - end - - minetest.register_node(":xpanes:"..name, def) + local groups = table.copy(def.groups) + groups.pane = 1 + groups.not_in_creative_inventory = 1 + minetest.register_node(":xpanes:" .. name, { + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + description = def.description, + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = groups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "connected", + fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}}, + connect_front = {{-1/32, -1/2, -1/2, 1/32, 1/2, -1/32}}, + connect_left = {{-1/2, -1/2, -1/32, -1/32, 1/2, 1/32}}, + connect_back = {{-1/32, -1/2, 1/32, 1/32, 1/2, 1/2}}, + connect_right = {{1/32, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connects_to = {"group:pane", "group:stone", "group:glass", "group:wood", "group:tree"}, + }) minetest.register_craft({ - output = "xpanes:"..name.." 16", + output = "xpanes:" .. name .. "_flat 16", recipe = def.recipe }) end @@ -161,7 +151,7 @@ xpanes.register_pane("pane", { inventory_image = "default_glass.png", wield_image = "default_glass.png", sounds = default.node_sound_glass_defaults(), - groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3, pane=1}, + groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3}, recipe = { {"default:glass", "default:glass", "default:glass"}, {"default:glass", "default:glass", "default:glass"} @@ -170,14 +160,25 @@ xpanes.register_pane("pane", { xpanes.register_pane("bar", { description = "Iron bar", - textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_space.png"}, + textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_bar_top.png"}, inventory_image = "xpanes_bar.png", wield_image = "xpanes_bar.png", - groups = {cracky=2, pane=1}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=2}, + sounds = default.node_sound_metal_defaults(), recipe = { {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} } }) +minetest.register_lbm({ + name = "xpanes:gen2", + nodenames = {"group:pane"}, + action = function(pos, node) + update_pane(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end + end +}) diff --git a/mods/xpanes/license.txt b/mods/xpanes/license.txt new file mode 100644 index 00000000..dff72274 --- /dev/null +++ b/mods/xpanes/license.txt @@ -0,0 +1,64 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 xyz +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2016 Auke Kok +Copyright (C) 2014-2016 Various Minetest developers and contributors + +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) 2014-2016 xyz +Copyright (C) 2013-2016 Gambit +Copyright (C) 2016 paramat + +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/mods/xpanes/textures/xpanes_bar.png b/mods/xpanes/textures/xpanes_bar.png index 4d17ceb8..3ea62a93 100644 Binary files a/mods/xpanes/textures/xpanes_bar.png and b/mods/xpanes/textures/xpanes_bar.png differ diff --git a/mods/xpanes/textures/xpanes_bar_top.png b/mods/xpanes/textures/xpanes_bar_top.png new file mode 100644 index 00000000..887518aa Binary files /dev/null and b/mods/xpanes/textures/xpanes_bar_top.png differ diff --git a/mods/xpanes/textures/xpanes_grey.png b/mods/xpanes/textures/xpanes_grey.png deleted file mode 100644 index e1c6f76f..00000000 Binary files a/mods/xpanes/textures/xpanes_grey.png and /dev/null differ diff --git a/mods/xpanes/textures/xpanes_white.png b/mods/xpanes/textures/xpanes_white.png index 777bd606..a2f4b636 100644 Binary files a/mods/xpanes/textures/xpanes_white.png and b/mods/xpanes/textures/xpanes_white.png differ diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 00000000..eeea0bfc --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,45 @@ +# This file contains settings of minetest_game that can be changed in +# minetest.conf + +# In creative mode players are able to dig all kind of blocks nearly +# instantly, and have access to unlimited resources. +# Some of the functionality is only available if this setting is present +# at startup. +creative_mode (Creative mode) bool false + +# Flammable nodes will be ignited by nearby igniters. Spreading fire may +# cause severe destruction. +# Spreading fire nodes will disappear when fire is disabled, but +# 'permanent_flame' nodes are unaffected. +enable_fire (Fire) bool true + +# Enable flame sound. +flame_sound (Flame sound) bool true + +# If enabled, steel tools, torches and cobblestone will be given to new +# players. +give_initial_stuff (Give initial items) bool false + +# If enabled, players respawn at the bed they last lay on instead of normal +# spawn. +# This setting is only read at startup. +enable_bed_respawn (Respawn at bed) bool true + +# If enabled, the night can be skipped if more than half of the players are +# in beds. +enable_bed_night_skip (Skip night when sleeping) bool true + +# When TNT explodes, it destroys nearby nodes and damages nearby players. +# This setting is disabled by default on servers. +enable_tnt (TNT) bool true + +# The radius in which nodes will be destroyed by a TNT explosion. +tnt_radius (TNT radius) int 3 0 + +# The time in seconds after which the bones of a dead player can be looted +# by everyone. +# Setting this to 0 will disable sharing of bones completely. +share_bones_time (Bone share time) int 1200 0 + +# Replaces old stairs with new ones. Only required for older worlds. +enable_stairs_replace_abm (Replace old stairs) bool false