diff --git a/.luacheckrc b/.luacheckrc index 3c7ec693..c3df64be 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -7,11 +7,12 @@ read_globals = { "dump", "vector", "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", + "PseudoRandom", "PcgRandom", + "ItemStack", "Settings", "unpack", - -- Silence "accessing undefined field copy of global table". - table = { fields = { "copy" } } + -- Silence errors about custom table methods. + table = { fields = { "copy", "indexof" } } } -- Overwrites minetest.handle_node_drops diff --git a/game.conf b/game.conf index 317180e6..3a4d5f4d 100644 --- a/game.conf +++ b/game.conf @@ -1 +1,3 @@ -name = Illuna +name = TechEth Game +author = minetest, illuna +description = Game of the Illuna TechEth flagship-server, based on the official minetest_game diff --git a/game_api.txt b/game_api.txt index d5d09e92..b3bb3096 100644 --- a/game_api.txt +++ b/game_api.txt @@ -2,10 +2,11 @@ Minetest Game API ================= GitHub Repo: https://github.com/minetest/minetest_game + Introduction ------------ -The Minetest Game subgame offers multiple new possibilities in addition to the Minetest engine's built-in API, +The Minetest Game game offers multiple new possibilities in addition to the Minetest engine's built-in API, allowing you to add new plants to farming mod, buckets for new liquids, new stairs and custom panes. For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt Please note: @@ -14,6 +15,7 @@ Please note: * [#ABC] refers to a section in this document * [pos] refers to a position table `{x = -5, y = 0, z = 200}` + Bucket API ---------- @@ -34,6 +36,7 @@ The bucket API allows registering new types of buckets for non-default liquids. 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 -------- @@ -42,6 +45,7 @@ Beds API def -- See [#Bed definition] ) + * `beds.can_dig(bed_pos)` Returns a boolean whether the bed at `bed_pos` may be dug * `beds.read_spawns() ` Returns a table containing players respawn positions * `beds.kick_players()` Forces all players to leave bed * `beds.skip_night()` Sets world time to morning and saves respawn position of all players currently sleeping @@ -67,6 +71,17 @@ Beds API } } + +Bones API +--------- + +An ordered list of listnames (default: "main", "craft") of the player inventory, +that will be placed into bones or dropped on player death can be looked up or changed +in `bones.player_inventory_lists`. + +e.g. `table.insert(bones.player_inventory_lists, "backpack")` + + Creative API ------------ @@ -88,11 +103,69 @@ 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. + +Chests API +---------- + +The chests API allows the creation of chests, which have their own inventories for holding items. + +`default.chest.get_chest_formspec(pos)` + + * Returns a formspec for a specific chest. + * `pos` Location of the chest node, e.g `{x = 1, y = 1, z = 1}` + +`default.chest.chest_lid_obstructed(pos)` + + * Returns a boolean depending on whether or not a chest has its top obstructed by a solid node. + * `pos` Location of the chest node, e.g `{x = 1, y = 1, z = 1}` + +`default.chest.chest_lid_close(pn)` + + * Closes the chest that a player is currently looking in. + * `pn` The name of the player whose chest is going to be closed + +`default.chest.open_chests` + + * A table indexed by player name to keep track of who opened what chest. + * Key: The name of the player. + * Value: A table containing information about the chest the player is looking at. + e.g `{ pos = {1, 1, 1}, sound = null, swap = "chest" }` + +`default.chest.register_chest(name, def)` + + * Registers new chest + * `name` Name for chest + * `def` See [#Chest Definition] + +### Chest Definition + + description = "Chest", + tiles = { + "default_chest_top.png", + "default_chest_top.png", + "default_chest_side.png", + "default_chest_side.png", + "default_chest_front.png", + "default_chest_inside.png" + }, -- Textures which are applied to the chest model. + sounds = default.node_sound_wood_defaults(), + sound_open = "default_chest_open", + sound_close = "default_chest_close", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, + protected = false, -- If true, only placer can modify chest. + + Doors API --------- The doors mod allows modders to register custom doors and trapdoors. +`doors.registered_doors[name] = Door definition` + * Table of registered doors, indexed by door name + +`doors.registered_trapdoors[name] = Trapdoor definition` + * Table of registered trap doors, indexed by trap door name + `doors.register_door(name, def)` * Registers new door @@ -128,6 +201,13 @@ The doors mod allows modders to register custom doors and trapdoors. has the permissions needed to open this door. If omitted then no permission checks are performed. +`doors.door_toggle(pos, node, clicker)` + + * Toggle door open or shut + * `pos` Position of the door + * `node` Node definition + * `clicker` Player definition for the player that clicked on the door + ### Door definition description = "Door description", @@ -139,6 +219,8 @@ The doors mod allows modders to register custom doors and trapdoors. sound_open = sound play for open door, -- optional sound_close = sound play for close door, -- optional protected = false, -- If true, only placer can open the door (locked for others) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + -- optional function containing the on_rightclick callback, defaults to a doors.door_toggle-wrapper ### Trapdoor definition @@ -151,6 +233,10 @@ The doors mod allows modders to register custom doors and trapdoors. sound_open = sound play for open door, -- optional sound_close = sound play for close door, -- optional protected = false, -- If true, only placer can open the door (locked for others) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + -- function containing the on_rightclick callback + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + -- function containing the on_rightclick callback ### Fence gate definition @@ -160,6 +246,42 @@ The doors mod allows modders to register custom doors and trapdoors. material = "default:wood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults(), -- optional + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + -- function containing the on_rightclick callback + + +Dungeon Loot API +---------------- + +The mod that places chests with loot in dungeons provides an API to register additional loot. + +`dungeon_loot.register(def)` + + * Registers one or more loot items + * `def` Can be a single [#Loot definition] or a list of them + +`dungeon_loot.registered_loot` + + * Table of all registered loot, not to be modified manually + +### Loot definition + + name = "item:name", + chance = 0.5, + -- ^ chance value from 0.0 to 1.0 that the item will appear in the chest when chosen + -- due to an extra step in the selection process, 0.5 does not(!) mean that + -- on average every second chest will have this item + count = {1, 4}, + -- ^ table with minimum and maximum amounts of this item + -- optional, defaults to always single item + y = {-32768, -512}, + -- ^ table with minimum and maximum heights this item can be found at + -- optional, defaults to no height restrictions + types = {"desert"}, + -- ^ table with types of dungeons this item can be found in + -- supported types: "normal" (the cobble/mossycobble one), "sandstone", "desert" + -- optional, defaults to no type restrictions + Fence API --------- @@ -182,6 +304,7 @@ Allows creation of new fences with "fencelike" drawtype. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults(), + Walls API --------- @@ -194,6 +317,7 @@ walls.register(name, desc, texture, mat, sounds) ^ mat = "default:stone". Used to auto-generate crafting recipe. ^ sounds = sounds: see [#Default sounds] + Farming API ----------- @@ -234,6 +358,7 @@ The farming API allows you to easily register plants and hoes. maxlight = default.LIGHT_MAX -- Maximum light to grow } + Fire API -------- @@ -284,8 +409,62 @@ Give Initial Stuff API ^ Adds items to the list of items to be given +Players API +----------- + +The player API can register player models and update the player's appearence + +* `player_api.register_model(name, def)` + * Register a new model to be used by players + * name: model filename such as "character.x", "foo.b3d", etc. + * def: See [#Model definition] + * saved to player_api.registered_models + +* `player_api.registered_player_models[name]` + * Get a model's definition + * see [#Model definition] + +* `player_api.set_model(player, model_name)` + * Change a player's model + * `player`: PlayerRef + * `model_name`: model registered with player_api.register_model() + +* `player_api.set_animation(player, anim_name [, speed])` + * Applies an animation to a player + * anim_name: name of the animation. + * speed: frames per second. If nil, default from the model is used + +* `player_api.set_textures(player, textures)` + * Sets player textures + * `player`: PlayerRef + * `textures`: array of textures, If `textures` is nil the default + textures from the model def are used + +* `player_api.get_animation(player)` + * Returns a table containing fields `model`, `textures` and `animation`. + * Any of the fields of the returned table may be nil. + * player: PlayerRef + +### Model Definition + + { + animation_speed = 30, -- Default animation speed, in FPS. + textures = {"character.png", }, -- Default array of textures. + visual_size = {x = 1, y = 1}, -- Used to scale the model. + animations = { + -- = {x = , y = }, + foo = {x = 0, y = 19}, + bar = {x = 20, y = 39}, + -- ... + }, + collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, -- In nodes from feet position + stepheight = 0.6, -- In nodes + eye_height = 1.47, -- In nodes above feet position + } + + TNT API ----------- +------- `tnt.register_tnt(definition)` @@ -295,6 +474,7 @@ TNT API * `description` A description for your TNT. * `radius` The radius within which the TNT can destroy nodes. The default is 3. * `damage_radius` The radius within which the TNT can damage players and mobs. By default it is twice the `radius`. + * `sound` The sound played when explosion occurs. By default it is `tnt_explode`. * `disable_drops` Disable drops. By default it is set to false. * `ignore_protection` Don't check `minetest.is_protected` before removing a node. * `ignore_on_blast` Don't call `on_blast` even if a node has one. @@ -304,12 +484,13 @@ TNT API * `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`. * `burning` Top tile when lit. By default the name of the tnt with a suffix of `_top_burning_animated.png". -`tnt.boom(position, definition)` +`tnt.boom(position[, definition])` ^ Create an explosion. * `position` The center of explosion. -* `definition` The TNT definion as passed to `tnt.register` +* `definition` The TNT definion as passed to `tnt.register` with the following addition: + * `explode_center` false by default which removes TNT node on blast, when true will explode center node. `tnt.burn(position, [nodename])` @@ -401,11 +582,15 @@ set a players home position and teleport a player to home position. Sfinv API --------- +It is recommended that you read this link for a good introduction to the +sfinv API by its author: https://rubenwardy.com/minetest_modding_book/en/chapters/sfinv.html + ### sfinv Methods **Pages** * sfinv.set_page(player, pagename) - changes the page +* sfinv.get_page(player) - get the current page name. Will never return nil * sfinv.get_homepage_name(player) - get the page name of the first page to show to a player * 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. @@ -502,39 +687,65 @@ And override this function to change the layout: return table.concat(tmp, "") end + Stairs API ---------- The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those delivered with Minetest Game, to keep them compatible with other mods. -`stairs.register_stair(subname, recipeitem, groups, images, description, sounds)` +`stairs.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex)` - * Registers a stair. + * Registers a stair * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname" * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil` - * `groups`: see [Known damage and digging time defining groups] - * `images`: see [Tile definition] - * `description`: used for the description field in the stair's definition - * `sounds`: see [#Default sounds] + * `groups`: See [Known damage and digging time defining groups] + * `images`: See [Tile definition] + * `description`: Used for the description field in the stair's definition + * `sounds`: See [#Default sounds] + * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] -`stairs.register_slab(subname, recipeitem, groups, images, description, sounds)` +`stairs.register_slab(subname, recipeitem, groups, images, description, sounds, worldaligntex)` - * Registers a slabs - * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname" + * Registers a slab + * `subname`: Basically the material name (e.g. cobble) used for the slab name. Nodename pattern: "stairs:slab_subname" * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble" - * `groups`: see [Known damage and digging time defining groups] - * `images`: see [Tile definition] - * `description`: used for the description field in the stair's definition - * `sounds`: see [#Default sounds] + * `groups`: See [Known damage and digging time defining groups] + * `images`: See [Tile definition] + * `description`: Used for the description field in the slab's definition + * `sounds`: See [#Default sounds] + * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] -`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)` +`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex)` - * A wrapper for stairs.register_stair and stairs.register_slab + * Registers an inner corner stair + * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_inner_subname" + * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil` + * `groups`: See [Known damage and digging time defining groups] + * `images`: See [Tile definition] + * `description`: Used for the description field in the stair's definition + * `sounds`: See [#Default sounds] + * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] + +`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex)` + + * Registers an outer corner stair + * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_outer_subname" + * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil` + * `groups`: See [Known damage and digging time defining groups] + * `images`: See [Tile definition] + * `description`: Used for the description field in the stair's definition + * `sounds`: See [#Default sounds] + * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition] + +`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds, worldaligntex)` + + * A wrapper for stairs.register_stair, stairs.register_slab, stairs.register_stair_inner, stairs.register_stair_outer * Uses almost the same arguments as stairs.register_stair - * `desc_stair`: Description for stair node + * `desc_stair`: Description for stair nodes. For corner stairs 'Inner' or 'Outer' will be prefixed * `desc_slab`: Description for slab node + Xpanes API ---------- @@ -552,8 +763,10 @@ Creates panes that automatically connect to each other 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 + use_texture_alpha = true, -- Optional boolean (default: `false`) for colored glass panes } + Raillike definitions -------------------- @@ -587,6 +800,7 @@ Sounds inside the default table can be used within the sounds field of node defi * `default.node_sound_glass_defaults()` * `default.node_sound_metal_defaults()` + Default constants ----------------- @@ -604,25 +818,20 @@ GUI and formspecs `default.gui_bg` - * Background color formspec element + * Deprecated, remove from mods. `default.gui_bg_img` - * Image overlay formspec element for the background to use in formspecs + * Deprecated, remove from mods. `default.gui_slots` - * `listcolors` formspec element that is used to format the slots in formspecs + * Deprecated, remove from mods. `default.gui_survival_form` * Entire formspec for the survival inventory -`default.get_chest_formspec(pos)` - - * Get the chest formspec using the defined GUI elements - * pos: Location of the node - `default.get_furnace_active_formspec(fuel_percent, item_percent)` * Get the active furnace formspec using the defined GUI elements @@ -634,60 +843,6 @@ GUI and formspecs * Get the inactive furnace formspec using the defined GUI elements -Player API ----------- - -The player API can register player models and update the player's appearence - -`default.player_register_model(name, def)` - - * Register a new model to be used by players. - * name: model filename such as "character.x", "foo.b3d", etc. - * def: See [#Model definition] - -`default.registered_player_models[name]` - - * Get a model's definition - * see [#Model definition] - -`default.player_set_model(player, model_name)` - - * Change a player's model - * `player`: PlayerRef - * `model_name`: model registered with player_register_model() - -`default.player_set_animation(player, anim_name [, speed])` - - * Applies an animation to a player - * anim_name: name of the animation. - * speed: frames per second. If nil, default from the model is used - -`default.player_set_textures(player, textures)` - - * Sets player textures - * `player`: PlayerRef - * `textures`: array of textures, If `textures` is nil, the default textures from the model def are used - -default.player_get_animation(player) - - * Returns a table containing fields `model`, `textures` and `animation`. - * Any of the fields of the returned table may be nil. - * player: PlayerRef - -### Model Definition - - { - animation_speed = 30, -- Default animation speed, in FPS. - textures = {"character.png", }, -- Default array of textures. - visual_size = {x = 1, y = 1}, -- Used to scale the model. - animations = { - -- = {x = , y = }, - foo = {x = 0, y = 19}, - bar = {x = 20, y = 39}, - -- ... - }, - } - Leafdecay --------- @@ -725,70 +880,39 @@ callback overridden. All the nodes listed in `leaves` have their Dyes ---- -To make recipes that will work with any dye ever made by anybody, define -them based on groups. You can select any group of groups, based on your need for -amount of colors. +Minetest Game dyes are registered with: -### Color groups + groups = {dye = 1, color_ = 1}, -Base color groups: +To make recipes that will work with dyes from many mods, define them using the +dye group and the color groups. - * `basecolor_white` - * `basecolor_grey` - * `basecolor_black` - * `basecolor_red` - * `basecolor_yellow` - * `basecolor_green` - * `basecolor_cyan` - * `basecolor_blue` - * `basecolor_magenta` +Dye color groups: -Extended color groups ( * means also base color ) + * `color_white` + * `color_grey` + * `color_dark_grey` + * `color_black` + * `color_red` + * `color_pink` + * `color_orange` + * `color_brown` + * `color_yellow` + * `color_green` + * `color_dark_green` + * `color_blue` + * `color_cyan` + * `color_violet` + * `color_magenta` - * `excolor_white` * - * `excolor_lightgrey` - * `excolor_grey` * - * `excolor_darkgrey` - * `excolor_black` * - * `excolor_red` * - * `excolor_orange` - * `excolor_yellow` * - * `excolor_lime` - * `excolor_green` * - * `excolor_aqua` - * `excolor_cyan` * - * `excolor_sky_blue` - * `excolor_blue` * - * `excolor_violet` - * `excolor_magenta` * - * `excolor_red_violet` - -The whole unifieddyes palette as groups: - - * `unicolor_` - -For the following, no white/grey/black is allowed: - - * `unicolor_medium_` - * `unicolor_dark_` - * `unicolor_light_` - * `unicolor__s50` - * `unicolor_medium__s50` - * `unicolor_dark__s50` - -Example of one shapeless recipe using a color group: +Example of one shapeless recipe using the dye group and a color group: minetest.register_craft({ type = "shapeless", - output = ':item_yellow', - recipe = {':item_no_color', 'group:basecolor_yellow'}, + output = ":item_yellow", + recipe = {":item_no_color", "group:dye,color_yellow"}, }) -### Color lists - - * `dye.basecolors` are an array containing the names of available base colors - - * `dye.excolors` are an array containing the names of the available extended colors Trees ----- @@ -826,6 +950,13 @@ Trees * `default.grow_acacia_bush(pos)` * Grows an acaia bush at pos + * `default.grow_pine_bush(pos)` + * Grows a pine bush at pos + + * `default.grow_blueberry_bush(pos)` + * Grows a blueberry bush at pos + + Carts ----- @@ -848,6 +979,7 @@ Carts likely be called many times per second, so the function needs to make sure that the event is handled properly. + Key API ------- diff --git a/minetest.conf.example b/minetest.conf.example index 9393b1a5..452251e1 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -1,18 +1,21 @@ -# This file contains settings of Minetest Game that can be changed in minetest.conf +# This file contains settings of Minetest Game that can be changed in +# minetest.conf. # By default, all the settings are commented and not functional. # Uncomment settings by removing the preceding #. -# Whether creative mode (fast digging of all blocks, unlimited resources) should be enabled +# Whether creative mode (fast digging of all blocks, unlimited resources) should +# be enabled. #creative_mode = false # Sets the behaviour of the inventory items when a player dies. -# "bones": Store all items inside a bone node but drop items if inside protected area -# "drop": Drop all items on the ground -# "keep": Player keeps all items -#bones_mode = "bones" +# bones: Store items in a bone node but drop items if inside protected area. +# drop: Drop items on the ground. +# keep: Player keeps items. +#bones_mode = bones -# The time in seconds after which the bones of a dead player can be looted by everyone -# 0 to disable +# The time in seconds after which the bones of a dead player can be looted by +# everyone. +# 0 to disable. #share_bones_time = 1200 # How much earlier the bones of a dead player can be looted by @@ -20,8 +23,12 @@ # 0 to disable. By default it is "share_bones_time" divide by four. #share_bones_time_early = 300 -# Whether fire should be enabled. If disabled, 'basic flame' nodes will disappear. -# 'permanent flame' nodes will remain with either setting. +# Inform player of condition and location of new bones. +#bones_position_message = false + +# Whether fire should be enabled. If disabled, 'basic_flame' nodes will +# disappear. +# 'permanent_flame' nodes will remain with either setting. #enable_fire = true # Enable flame sound. @@ -30,24 +37,30 @@ # Whether lavacooling should be enabled. #enable_lavacooling = true -# Whether the stuff in initial_stuff should be given to new players +# 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 +#initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel, +default:torch 99,default:cobble 99 -# Whether the TNT mod should be enabled +# Whether the TNT mod should be enabled. #enable_tnt = -# The radius of a TNT explosion +# The radius of a TNT explosion. #tnt_radius = 3 # Enable the stairs mod ABM that replaces the old 'upside down' # stair and slab nodes in old maps with the new param2 versions. #enable_stairs_replace_abm = false -# Whether you allow respawning in beds -# Default value is true +# Whether to allow respawning in beds. +# Default value is true. #enable_bed_respawn = true -# Whether players can skip night by sleeping -# Default value is true +# Whether players can skip night by sleeping. +# Default value is true. #enable_bed_night_skip = true + +# Whether the engine's spawn search, which does not check for a suitable +# starting biome, is used. +# Default value is false. +#engine_spawn = false diff --git a/mods/beds/README.txt b/mods/beds/README.txt index cda6ebd9..b4cf0c44 100644 --- a/mods/beds/README.txt +++ b/mods/beds/README.txt @@ -10,6 +10,10 @@ Various Minetest developers and contributors (MIT) Authors of media (textures) --------------------------- BlockMen (CC BY-SA 3.0) + All textures unless otherwise noted + +TumeniNodes (CC BY-SA 3.0) + beds_bed_under.png 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 diff --git a/mods/beds/api.lua b/mods/beds/api.lua index 97dde43d..ef07fc00 100644 --- a/mods/beds/api.lua +++ b/mods/beds/api.lua @@ -49,21 +49,24 @@ function beds.register_bed(name, def) local node = minetest.get_node(under) local udef = minetest.registered_nodes[node.name] if udef and udef.on_rightclick and - not (placer and placer:get_player_control().sneak) then + not (placer and placer:is_player() and + placer:get_player_control().sneak) then return udef.on_rightclick(under, node, placer, itemstack, pointed_thing) or itemstack end local pos - if minetest.registered_items[minetest.get_node(under).name].buildable_to then + if udef and udef.buildable_to then pos = under else pos = pointed_thing.above end - if minetest.is_protected(pos, placer:get_player_name()) and - not minetest.check_player_privs(placer, "protection_bypass") then - minetest.record_protection_violation(pos, placer:get_player_name()) + local player_name = placer and placer:get_player_name() or "" + + if minetest.is_protected(pos, player_name) and + not minetest.check_player_privs(player_name, "protection_bypass") then + minetest.record_protection_violation(pos, player_name) return itemstack end @@ -72,12 +75,13 @@ function beds.register_bed(name, def) return itemstack end - local dir = minetest.dir_to_facedir(placer:get_look_dir()) + local dir = placer and placer:get_look_dir() and + minetest.dir_to_facedir(placer:get_look_dir()) or 0 local botpos = vector.add(pos, minetest.facedir_to_dir(dir)) - if minetest.is_protected(botpos, placer:get_player_name()) and - not minetest.check_player_privs(placer, "protection_bypass") then - minetest.record_protection_violation(botpos, placer:get_player_name()) + if minetest.is_protected(botpos, player_name) and + not minetest.check_player_privs(player_name, "protection_bypass") then + minetest.record_protection_violation(botpos, player_name) return itemstack end @@ -90,7 +94,7 @@ function beds.register_bed(name, def) minetest.set_node(botpos, {name = name .. "_top", param2 = dir}) if not (creative and creative.is_enabled_for - and creative.is_enabled_for(placer:get_player_name())) then + and creative.is_enabled_for(player_name)) then itemstack:take_item() end return itemstack @@ -137,6 +141,9 @@ function beds.register_bed(name, def) minetest.set_node(newp, {name = name .. "_top", param2 = new_param2}) return true end, + can_dig = function(pos, player) + return beds.can_dig(pos) + end, }) minetest.register_node(name .. "_top", { @@ -156,6 +163,12 @@ function beds.register_bed(name, def) on_destruct = function(pos) destruct_bed(pos, 2) end, + can_dig = function(pos, player) + local node = minetest.get_node(pos) + local dir = minetest.facedir_to_dir(node.param2) + local p = vector.add(pos, dir) + return beds.can_dig(p) + end, }) minetest.register_alias(name, name .. "_bottom") diff --git a/mods/beds/beds.lua b/mods/beds/beds.lua index bb2fd5d3..a971b89e 100644 --- a/mods/beds/beds.lua +++ b/mods/beds/beds.lua @@ -7,19 +7,19 @@ beds.register_bed("beds:fancy_bed", { tiles = { bottom = { "beds_bed_top1.png", - "default_wood.png", + "beds_bed_under.png", "beds_bed_side1.png", "beds_bed_side1.png^[transformFX", - "default_wood.png", + "beds_bed_foot.png", "beds_bed_foot.png", }, top = { "beds_bed_top2.png", - "default_wood.png", + "beds_bed_under.png", "beds_bed_side2.png", "beds_bed_side2.png^[transformFX", "beds_bed_head.png", - "default_wood.png", + "beds_bed_head.png", } }, nodebox = { @@ -58,7 +58,7 @@ beds.register_bed("beds:bed", { tiles = { bottom = { "beds_bed_top_bottom.png^[transformR90", - "default_wood.png", + "beds_bed_under.png", "beds_bed_side_bottom_r.png", "beds_bed_side_bottom_r.png^[transformfx", "beds_transparent.png", @@ -66,7 +66,7 @@ beds.register_bed("beds:bed", { }, top = { "beds_bed_top_top.png^[transformR90", - "default_wood.png", + "beds_bed_under.png", "beds_bed_side_top_r.png", "beds_bed_side_top_r.png^[transformfx", "beds_bed_side_top.png", diff --git a/mods/beds/functions.lua b/mods/beds/functions.lua index 78df9a18..bf7bf90e 100644 --- a/mods/beds/functions.lua +++ b/mods/beds/functions.lua @@ -9,15 +9,18 @@ end -- Helper functions local function get_look_yaw(pos) - local n = minetest.get_node(pos) - if n.param2 == 1 then - return pi / 2, n.param2 - elseif n.param2 == 3 then - return -pi / 2, n.param2 - elseif n.param2 == 0 then - return pi, n.param2 + local rotation = minetest.get_node(pos).param2 + if rotation > 3 then + rotation = rotation % 4 -- Mask colorfacedir values + end + if rotation == 1 then + return pi / 2, rotation + elseif rotation == 3 then + return -pi / 2, rotation + elseif rotation == 0 then + return pi, rotation else - return 0, n.param2 + return 0, rotation end end @@ -58,6 +61,7 @@ local function lay_down(player, pos, bed_pos, state, skip) local p = beds.pos[name] or nil if beds.player[name] ~= nil then beds.player[name] = nil + beds.bed_position[name] = nil player_in_bed = player_in_bed - 1 end -- skip here to prevent sending player specific changes (used for leaving players) @@ -65,7 +69,7 @@ local function lay_down(player, pos, bed_pos, state, skip) return end if p then - player:setpos(p) + player:set_pos(p) end -- physics, eye_offset, etc @@ -80,6 +84,7 @@ local function lay_down(player, pos, bed_pos, state, skip) else beds.player[name] = 1 beds.pos[name] = pos + beds.bed_position[name] = bed_pos player_in_bed = player_in_bed + 1 -- physics, eye_offset, etc @@ -89,7 +94,7 @@ local function lay_down(player, pos, bed_pos, state, skip) local dir = minetest.facedir_to_dir(param2) local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2} player:set_physics_override(0, 0, 0) - player:setpos(p) + player:set_pos(p) default.player_attached[name] = true hud_flags.wielditem = false default.player_set_animation(player, "lay" , 0) @@ -104,12 +109,12 @@ local function update_formspecs(finished) local is_majority = (ges / 2) < player_in_bed if finished then - form_n = beds.formspec .. "label[2.7,11; Good morning.]" + form_n = beds.formspec .. "label[2.7,9; Good morning.]" else - form_n = beds.formspec .. "label[2.2,11;" .. tostring(player_in_bed) .. + form_n = beds.formspec .. "label[2.2,9;" .. tostring(player_in_bed) .. " of " .. tostring(ges) .. " players are in bed]" if is_majority and is_night_skip_enabled() then - form_n = form_n .. "button_exit[2,8;4,0.75;force;Force night skip]" + form_n = form_n .. "button_exit[2,6;4,0.75;force;Force night skip]" end end @@ -134,7 +139,7 @@ end function beds.on_rightclick(pos, player) local name = player:get_player_name() - local ppos = player:getpos() + local ppos = player:get_pos() local tod = minetest.get_timeofday() if tod > 0.2 and tod < 0.805 then @@ -171,6 +176,15 @@ function beds.on_rightclick(pos, player) end end +function beds.can_dig(bed_pos) + -- Check all players in bed which one is at the expected position + for _, player_bed_pos in pairs(beds.bed_position) do + if vector.equals(bed_pos, player_bed_pos) then + return false + end + end + return true +end -- Callbacks -- Only register respawn callback if respawn enabled @@ -180,7 +194,7 @@ if enable_respawn then local name = player:get_player_name() local pos = beds.spawn[name] if pos then - player:setpos(pos) + player:set_pos(pos) return true end end) @@ -205,16 +219,25 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if formname ~= "beds_form" then return end + + -- Because "Force night skip" button is a button_exit, it will set fields.quit + -- and lay_down call will change value of player_in_bed, so it must be taken + -- earlier. + local last_player_in_bed = player_in_bed + if fields.quit or fields.leave then lay_down(player, nil, nil, false) update_formspecs(false) end if fields.force then - update_formspecs(is_night_skip_enabled()) - if is_night_skip_enabled() then + local is_majority = (#minetest.get_connected_players() / 2) < last_player_in_bed + if is_majority and is_night_skip_enabled() then + update_formspecs(true) beds.skip_night() beds.kick_players() + else + update_formspecs(false) end end end) diff --git a/mods/beds/init.lua b/mods/beds/init.lua index 8b258901..5a3959cb 100644 --- a/mods/beds/init.lua +++ b/mods/beds/init.lua @@ -1,11 +1,13 @@ beds = {} beds.player = {} +beds.bed_position = {} beds.pos = {} beds.spawn = {} -beds.formspec = "size[8,15;true]" .. - "bgcolor[#080808BB; true]" .. - "button_exit[2,12;4,0.75;leave;Leave Bed]" +beds.formspec = "size[8,11;true]" .. + "no_prepend[]" .. + "bgcolor[#080808BB;true]" .. + "button_exit[2,10;4,0.75;leave;Leave Bed]" local modpath = minetest.get_modpath("beds") diff --git a/mods/beds/license.txt b/mods/beds/license.txt index 0494b36b..f3c517f9 100644 --- a/mods/beds/license.txt +++ b/mods/beds/license.txt @@ -30,6 +30,7 @@ Licenses of media (textures) Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Copyright (C) 2014-2016 BlockMen +Copyright (C) 2018 TumeniNodes You are free to: Share — copy and redistribute the material in any medium or format. diff --git a/mods/beds/spawns.lua b/mods/beds/spawns.lua index 6b1f4041..baee364d 100644 --- a/mods/beds/spawns.lua +++ b/mods/beds/spawns.lua @@ -53,7 +53,7 @@ end function beds.set_spawns() for name,_ in pairs(beds.player) do local player = minetest.get_player_by_name(name) - local p = player:getpos() + local p = player:get_pos() -- but don't change spawn location if borrowing a bed if not minetest.is_protected(p, name) then beds.spawn[name] = p diff --git a/mods/beds/textures/beds_bed_under.png b/mods/beds/textures/beds_bed_under.png new file mode 100644 index 00000000..a9301156 Binary files /dev/null and b/mods/beds/textures/beds_bed_under.png differ diff --git a/mods/binoculars/README.txt b/mods/binoculars/README.txt new file mode 100644 index 00000000..0c65f6ea --- /dev/null +++ b/mods/binoculars/README.txt @@ -0,0 +1,37 @@ +Minetest Game mod: binoculars +============================= +See license.txt for license information. + +Authors of source code +---------------------- +paramat (MIT) + +Authors of media (textures) +--------------------------- +paramat (CC BY-SA 3.0): + binoculars_binoculars.png + +Crafting +-------- +binoculars:binoculars + +default:obsidian_glass O +default:bronze_ingot B + +O_O +BBB +O_O + +Usage +----- +In survival mode, use of zoom requires the binoculars item in your inventory, +they will allow a 10 degree field of view. +It can take up to 5 seconds for adding to or removal from inventory to have an +effect, however to instantly allow the use of this zoom 'use' (leftclick) the +item. + +Zoom with a field of view of 15 degrees is automatically allowed in creative +mode and for any player with the 'creative' privilege. + +The 'binoculars.update_player_property()' function is global so can be +redefined by a mod for alternative behaviour. diff --git a/mods/binoculars/depends.txt b/mods/binoculars/depends.txt new file mode 100644 index 00000000..1f737c12 --- /dev/null +++ b/mods/binoculars/depends.txt @@ -0,0 +1,2 @@ +default +creative? diff --git a/mods/binoculars/init.lua b/mods/binoculars/init.lua new file mode 100644 index 00000000..0b43a061 --- /dev/null +++ b/mods/binoculars/init.lua @@ -0,0 +1,76 @@ +-- Mod global namespace + +binoculars = {} + + +-- Detect creative mod +local creative_mod = minetest.get_modpath("creative") +-- Cache creative mode setting as fallback if creative mod not present +local creative_mode_cache = minetest.settings:get_bool("creative_mode") + + +-- Update player property +-- Global to allow overriding + +function binoculars.update_player_property(player) + local creative_enabled = + (creative_mod and creative.is_enabled_for(player:get_player_name())) or + creative_mode_cache + local new_zoom_fov = 0 + + if player:get_inventory():contains_item( + "main", "binoculars:binoculars") then + new_zoom_fov = 10 + elseif creative_enabled then + new_zoom_fov = 15 + end + + -- Only set property if necessary to avoid player mesh reload + if player:get_properties().zoom_fov ~= new_zoom_fov then + player:set_properties({zoom_fov = new_zoom_fov}) + end +end + + +-- Set player property 'on joinplayer' + +minetest.register_on_joinplayer(function(player) + binoculars.update_player_property(player) +end) + + +-- Cyclic update of player property + +local function cyclic_update() + for _, player in ipairs(minetest.get_connected_players()) do + binoculars.update_player_property(player) + end + minetest.after(4.7, cyclic_update) +end + +minetest.after(4.7, cyclic_update) + + +-- Binoculars item + +minetest.register_craftitem("binoculars:binoculars", { + description = "Binoculars\nUse with 'Zoom' key", + inventory_image = "binoculars_binoculars.png", + stack_max = 1, + + on_use = function(itemstack, user, pointed_thing) + binoculars.update_player_property(user) + end, +}) + + +-- Crafting + +minetest.register_craft({ + output = "binoculars:binoculars", + recipe = { + {"default:obsidian_glass", "", "default:obsidian_glass"}, + {"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"}, + {"default:obsidian_glass", "", "default:obsidian_glass"}, + } +}) diff --git a/mods/binoculars/license.txt b/mods/binoculars/license.txt new file mode 100644 index 00000000..f3aefda1 --- /dev/null +++ b/mods/binoculars/license.txt @@ -0,0 +1,59 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2017 paramat + +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) 2017 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/binoculars/textures/binoculars_binoculars.png b/mods/binoculars/textures/binoculars_binoculars.png new file mode 100644 index 00000000..5803d48f Binary files /dev/null and b/mods/binoculars/textures/binoculars_binoculars.png differ diff --git a/mods/boats/README.txt b/mods/boats/README.txt index 59631d9d..a2ccb485 100644 --- a/mods/boats/README.txt +++ b/mods/boats/README.txt @@ -13,3 +13,19 @@ Textures: Zeg9 (CC BY-SA 3.0) Model: thetoon and Zeg9 (CC BY-SA 3.0), modified by PavelS(SokolovPavel) (CC BY-SA 3.0), modified by sofar (CC BY-SA 3.0) + +Controls +-------- +Right mouse button = Enter or exit boat when pointing at boat. +Forward = Speed up. + Slow down when moving backwards. +Forward + backward = Enable cruise mode: Boat will accelerate to maximum forward + speed and remain at that speed without needing to hold the + forward key. +Backward = Slow down. + Speed up when moving backwards. + Disable cruise mode. +Left = Turn to the left. + Turn to the right when moving backwards. +Right = Turn to the right. + Turn to the left when moving backwards. diff --git a/mods/boats/depends.txt b/mods/boats/depends.txt index 4ad96d51..8e482ce2 100644 --- a/mods/boats/depends.txt +++ b/mods/boats/depends.txt @@ -1 +1,2 @@ default +player_api diff --git a/mods/boats/init.lua b/mods/boats/init.lua index 4d8f4673..00cf7918 100644 --- a/mods/boats/init.lua +++ b/mods/boats/init.lua @@ -33,18 +33,21 @@ end -- local boat = { - physical = true, - -- Warning: Do not change the position of the collisionbox top surface, - -- lowering it causes the boat to fall through the world if underwater - collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5}, - visual = "mesh", - mesh = "boats_boat.obj", - textures = {"default_wood.png"}, + initial_properties = { + physical = true, + -- Warning: Do not change the position of the collisionbox top surface, + -- lowering it causes the boat to fall through the world if underwater + collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5}, + visual = "mesh", + mesh = "boats_boat.obj", + textures = {"default_wood.png"}, + }, driver = nil, v = 0, last_v = 0, - removed = false + removed = false, + auto = false } @@ -53,15 +56,16 @@ function boat.on_rightclick(self, clicker) return end local name = clicker:get_player_name() - if self.driver and clicker == self.driver then + if self.driver and name == self.driver then self.driver = nil + self.auto = false clicker:set_detach() - default.player_attached[name] = false - default.player_set_animation(clicker, "stand" , 30) - local pos = clicker:getpos() + player_api.player_attached[name] = false + player_api.set_animation(clicker, "stand" , 30) + local pos = clicker:get_pos() pos = {x = pos.x, y = pos.y + 0.2, z = pos.z} minetest.after(0.1, function() - clicker:setpos(pos) + clicker:set_pos(pos) end) elseif not self.driver then local attach = clicker:get_attach() @@ -72,18 +76,25 @@ function boat.on_rightclick(self, clicker) end clicker:set_detach() end - self.driver = clicker + self.driver = name clicker:set_attach(self.object, "", - {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0}) - default.player_attached[name] = true + {x = 0.5, y = 1, z = -3}, {x = 0, y = 0, z = 0}) + player_api.player_attached[name] = true minetest.after(0.2, function() - default.player_set_animation(clicker, "sit" , 30) + player_api.set_animation(clicker, "sit" , 30) end) - clicker:set_look_horizontal(self.object:getyaw()) + clicker:set_look_horizontal(self.object:get_yaw()) end end +-- If driver leaves server while driving boat +function boat.on_detach_child(self, child) + self.driver = nil + self.auto = false +end + + function boat.on_activate(self, staticdata, dtime_s) self.object:set_armor_groups({immortal = 1}) if staticdata then @@ -102,21 +113,23 @@ function boat.on_punch(self, puncher) if not puncher or not puncher:is_player() or self.removed then return end - if self.driver and puncher == self.driver then + + local name = puncher:get_player_name() + if self.driver and name == self.driver then self.driver = nil puncher:set_detach() - default.player_attached[puncher:get_player_name()] = false + player_api.player_attached[name] = false end if not self.driver then self.removed = true local inv = puncher:get_inventory() if not (creative and creative.is_enabled_for - and creative.is_enabled_for(puncher:get_player_name())) + and creative.is_enabled_for(name)) or not inv:contains_item("main", "boats:boat") then local leftover = inv:add_item("main", "boats:boat") -- if no room in inventory add a replacement boat to the world if not leftover:is_empty() then - minetest.add_item(self.object:getpos(), leftover) + minetest.add_item(self.object:get_pos(), leftover) end end -- delay remove to ensure player is detached @@ -128,38 +141,49 @@ end function boat.on_step(self, dtime) - self.v = get_v(self.object:getvelocity()) * get_sign(self.v) + self.v = get_v(self.object:get_velocity()) * get_sign(self.v) if self.driver then - local ctrl = self.driver:get_player_control() - local yaw = self.object:getyaw() - if ctrl.up then - self.v = self.v + 0.1 - elseif ctrl.down then - self.v = self.v - 0.1 - end - if ctrl.left then - if self.v < 0 then - self.object:setyaw(yaw - (1 + dtime) * 0.03) - else - self.object:setyaw(yaw + (1 + dtime) * 0.03) + local driver_objref = minetest.get_player_by_name(self.driver) + if driver_objref then + local ctrl = driver_objref:get_player_control() + if ctrl.up and ctrl.down then + if not self.auto then + self.auto = true + minetest.chat_send_player(self.driver, "[boats] Cruise on") + end + elseif ctrl.down then + self.v = self.v - dtime * 1.8 + if self.auto then + self.auto = false + minetest.chat_send_player(self.driver, "[boats] Cruise off") + end + elseif ctrl.up or self.auto then + self.v = self.v + dtime * 1.8 end - elseif ctrl.right then - if self.v < 0 then - self.object:setyaw(yaw + (1 + dtime) * 0.03) - else - self.object:setyaw(yaw - (1 + dtime) * 0.03) + if ctrl.left then + if self.v < -0.001 then + self.object:set_yaw(self.object:get_yaw() - dtime * 0.9) + else + self.object:set_yaw(self.object:get_yaw() + dtime * 0.9) + end + elseif ctrl.right then + if self.v < -0.001 then + self.object:set_yaw(self.object:get_yaw() + dtime * 0.9) + else + self.object:set_yaw(self.object:get_yaw() - dtime * 0.9) + end end end end - local velo = self.object:getvelocity() + local velo = self.object:get_velocity() if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then - self.object:setpos(self.object:getpos()) + self.object:set_pos(self.object:get_pos()) return end local s = get_sign(self.v) - self.v = self.v - 0.02 * s + self.v = self.v - dtime * 0.6 * s if s ~= get_sign(self.v) then - self.object:setvelocity({x = 0, y = 0, z = 0}) + self.object:set_velocity({x = 0, y = 0, z = 0}) self.v = 0 return end @@ -167,7 +191,7 @@ function boat.on_step(self, dtime) self.v = 5 * get_sign(self.v) end - local p = self.object:getpos() + local p = self.object:get_pos() p.y = p.y - 0.5 local new_velo local new_acce = {x = 0, y = 0, z = 0} @@ -179,13 +203,13 @@ function boat.on_step(self, dtime) else new_acce = {x = 0, y = -9.8, z = 0} end - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) - self.object:setpos(self.object:getpos()) + new_velo = get_velocity(self.v, self.object:get_yaw(), + self.object:get_velocity().y) + self.object:set_pos(self.object:get_pos()) else p.y = p.y + 1 if is_water(p) then - local y = self.object:getvelocity().y + local y = self.object:get_velocity().y if y >= 5 then y = 5 elseif y < 0 then @@ -193,24 +217,24 @@ function boat.on_step(self, dtime) else new_acce = {x = 0, y = 5, z = 0} end - new_velo = get_velocity(self.v, self.object:getyaw(), y) - self.object:setpos(self.object:getpos()) + new_velo = get_velocity(self.v, self.object:get_yaw(), y) + self.object:set_pos(self.object:get_pos()) else new_acce = {x = 0, y = 0, z = 0} - if math.abs(self.object:getvelocity().y) < 1 then - local pos = self.object:getpos() + if math.abs(self.object:get_velocity().y) < 1 then + local pos = self.object:get_pos() pos.y = math.floor(pos.y) + 0.5 - self.object:setpos(pos) - new_velo = get_velocity(self.v, self.object:getyaw(), 0) + self.object:set_pos(pos) + new_velo = get_velocity(self.v, self.object:get_yaw(), 0) else - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) - self.object:setpos(self.object:getpos()) + new_velo = get_velocity(self.v, self.object:get_yaw(), + self.object:get_velocity().y) + self.object:set_pos(self.object:get_pos()) end end end - self.object:setvelocity(new_velo) - self.object:setacceleration(new_acce) + self.object:set_velocity(new_velo) + self.object:set_acceleration(new_acce) end @@ -230,7 +254,8 @@ minetest.register_craftitem("boats:boat", { local node = minetest.get_node(under) local udef = minetest.registered_nodes[node.name] if udef and udef.on_rightclick and - not (placer and placer:get_player_control().sneak) then + not (placer and placer:is_player() and + placer:get_player_control().sneak) then return udef.on_rightclick(under, node, placer, itemstack, pointed_thing) or itemstack end @@ -244,9 +269,12 @@ minetest.register_craftitem("boats:boat", { pointed_thing.under.y = pointed_thing.under.y + 0.5 boat = minetest.add_entity(pointed_thing.under, "boats:boat") if boat then - boat:setyaw(placer:get_look_horizontal()) - if not (creative and creative.is_enabled_for - and creative.is_enabled_for(placer:get_player_name())) then + if placer then + boat:set_yaw(placer:get_look_horizontal()) + end + local player_name = placer and placer:get_player_name() or "" + if not (creative and creative.is_enabled_for and + creative.is_enabled_for(player_name)) then itemstack:take_item() end end diff --git a/mods/bones/init.lua b/mods/bones/init.lua index 2efed395..7bdfda87 100644 --- a/mods/bones/init.lua +++ b/mods/bones/init.lua @@ -1,6 +1,8 @@ -- Minetest 0.4 mod: bones -- See README.txt for licensing and other information. +bones = {} + local function is_owner(pos, name) local owner = minetest.get_meta(pos):get_string("owner") if owner == "" or owner == name or minetest.check_player_privs(name, "protection_bypass") then @@ -11,9 +13,6 @@ end local bones_formspec = "size[8,9]" .. - default.gui_bg .. - default.gui_bg_img .. - default.gui_slots .. "list[current_name;main;0,0.3;8,4;]" .. "list[current_player;main;0,4.85;8,1;]" .. "list[current_player;main;0,6.08;8,3;8]" .. @@ -68,6 +67,12 @@ minetest.register_node("bones:bones", { on_metadata_inventory_take = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) if meta:get_inventory():is_empty("main") then + local inv = player:get_inventory() + if inv:room_for_item("main", {name = "bones:bones"}) then + inv:add_item("main", {name = "bones:bones"}) + else + minetest.add_item(pos, "bones:bones") + end minetest.remove_node(pos) end end, @@ -151,7 +156,7 @@ end local drop = function(pos, itemstack) local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count())) if obj then - obj:setvelocity({ + obj:set_velocity({ x = math.random(-10, 10) / 9, y = 5, z = math.random(-10, 10) / 9, @@ -159,6 +164,18 @@ local drop = function(pos, itemstack) end end +local player_inventory_lists = { "main", "craft" } +bones.player_inventory_lists = player_inventory_lists + +local function is_all_empty(player_inv) + for _, list_name in ipairs(player_inventory_lists) do + if not player_inv:is_empty(list_name) then + return false + end + end + return true +end + minetest.register_on_dieplayer(function(player) local bones_mode = minetest.settings:get("bones_mode") or "bones" @@ -166,21 +183,32 @@ minetest.register_on_dieplayer(function(player) bones_mode = "bones" end + local bones_position_message = minetest.settings:get_bool("bones_position_message") == true + local player_name = player:get_player_name() + local pos = vector.round(player:get_pos()) + local pos_string = minetest.pos_to_string(pos) + -- return if keep inventory set or in creative mode if bones_mode == "keep" or (creative and creative.is_enabled_for and creative.is_enabled_for(player:get_player_name())) then + minetest.log("action", player_name .. " dies at " .. pos_string .. + ". No bones placed") + if bones_position_message then + minetest.chat_send_player(player_name, player_name .. " died at " .. pos_string .. ".") + end return end local player_inv = player:get_inventory() - if player_inv:is_empty("main") and - player_inv:is_empty("craft") then + if is_all_empty(player_inv) then + minetest.log("action", player_name .. " dies at " .. pos_string .. + ". No bones placed") + if bones_position_message then + minetest.chat_send_player(player_name, player_name .. " died at " .. pos_string .. ".") + end return end - local pos = vector.round(player:getpos()) - local player_name = player:get_player_name() - -- 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 local air = minetest.find_node_near(pos, 1, {"air"}) @@ -192,20 +220,19 @@ minetest.register_on_dieplayer(function(player) end if bones_mode == "drop" then - - -- drop inventory items - for i = 1, player_inv:get_size("main") do - drop(pos, player_inv:get_stack("main", i)) + for _, list_name in ipairs(player_inventory_lists) do + for i = 1, player_inv:get_size(list_name) do + drop(pos, player_inv:get_stack(list_name, i)) + end + player_inv:set_list(list_name, {}) end - player_inv:set_list("main", {}) - - -- drop crafting grid items - for i = 1, player_inv:get_size("craft") do - drop(pos, player_inv:get_stack("craft", i)) - end - player_inv:set_list("craft", {}) - drop(pos, ItemStack("bones:bones")) + minetest.log("action", player_name .. " dies at " .. pos_string .. + ". Inventory dropped") + if bones_position_message then + minetest.chat_send_player(player_name, player_name .. " died at " .. pos_string .. + ", and dropped their inventory.") + end return end @@ -214,24 +241,29 @@ minetest.register_on_dieplayer(function(player) minetest.chat_send_player(player_name, "Your stuff is waiting for you at "..minetest.pos_to_string(pos).. ". Go and grab it! ;-)") minetest.log("action", player_name.." left their bones at "..minetest.pos_to_string(pos)) + minetest.log("action", player_name .. " dies at " .. pos_string .. + ". Bones placed") + if bones_position_message then + minetest.chat_send_player(player_name, player_name .. " died at " .. pos_string .. + ", and bones were placed.") + end + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() inv:set_size("main", 8 * 4) - inv:set_list("main", player_inv:get_list("main")) - for i = 1, player_inv:get_size("craft") do - local stack = player_inv:get_stack("craft", i) - if inv:room_for_item("main", stack) then - inv:add_item("main", stack) - else - --drop if no space left - drop(pos, stack) + for _, list_name in ipairs(player_inventory_lists) do + for i = 1, player_inv:get_size(list_name) do + local stack = player_inv:get_stack(list_name, i) + if inv:room_for_item("main", stack) then + inv:add_item("main", stack) + else -- no space left + drop(pos, stack) + end end + player_inv:set_list(list_name, {}) end - player_inv:set_list("main", {}) - player_inv:set_list("craft", {}) - meta:set_string("formspec", bones_formspec) meta:set_string("owner", player_name) diff --git a/mods/bucket/README.txt b/mods/bucket/README.txt index 45e0ec54..58997b26 100644 --- a/mods/bucket/README.txt +++ b/mods/bucket/README.txt @@ -4,9 +4,9 @@ See license.txt for license information. Authors of source code ---------------------- -Kahrl (LGPL 2.1) -celeron55, Perttu Ahola (LGPL 2.1) -Various Minetest developers and contributors (LGPL 2.1) +Kahrl (LGPLv2.1+) +celeron55, Perttu Ahola (LGPLv2.1+) +Various Minetest developers and contributors (LGPLv2.1+) Authors of media (textures) --------------------------- diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua index 5076dece..1d37cb42 100644 --- a/mods/bucket/init.lua +++ b/mods/bucket/init.lua @@ -69,7 +69,8 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name -- Call on_rightclick if the pointed node defines it if ndef and ndef.on_rightclick and - user and not user:get_player_control().sneak then + not (user and user:is_player() and + user:get_player_control().sneak) then return ndef.on_rightclick( pointed_thing.under, node, user, @@ -147,7 +148,7 @@ minetest.register_craftitem("bucket:bucket_empty", { if inv:room_for_item("main", {name=liquiddef.itemname}) then inv:add_item("main", liquiddef.itemname) else - local pos = user:getpos() + local pos = user:get_pos() pos.y = math.floor(pos.y + 0.5) minetest.add_item(pos, liquiddef.itemname) end @@ -188,6 +189,12 @@ bucket.register_liquid( {water_bucket = 1} ) +-- River water source is 'liquid_renewable = false' to avoid horizontal spread +-- of water sources in sloping rivers that can cause water to overflow +-- riverbanks and cause floods. +-- River water source is instead made renewable by the 'force renew' option +-- used here. + bucket.register_liquid( "default:river_water_source", "default:river_water_flowing", diff --git a/mods/butterflies/README.txt b/mods/butterflies/README.txt new file mode 100644 index 00000000..a7f52a07 --- /dev/null +++ b/mods/butterflies/README.txt @@ -0,0 +1,14 @@ +Minetest Game mod: Butterflies +============================== +Adds butterflies to the world on mapgen, which can be caught in a net if the +fireflies mod is also enabled. + +Authors of source code +---------------------- +Shara RedCat (MIT) + +Authors of media (textures) +--------------------------- +Shara RedCat (CC BY-SA 3.0): + butterflies_butterfly_*.png + butterflies_butterfly_*_animated.png \ No newline at end of file diff --git a/mods/butterflies/depends.txt b/mods/butterflies/depends.txt new file mode 100644 index 00000000..df07aca3 --- /dev/null +++ b/mods/butterflies/depends.txt @@ -0,0 +1,2 @@ +default +flowers \ No newline at end of file diff --git a/mods/butterflies/init.lua b/mods/butterflies/init.lua new file mode 100644 index 00000000..008211ee --- /dev/null +++ b/mods/butterflies/init.lua @@ -0,0 +1,133 @@ +-- register butterflies +local butter_list = { + {"white", "White"}, + {"red", "Red"}, + {"violet", "Violet"} +} + +for i in ipairs (butter_list) do + local name = butter_list[i][1] + local desc = butter_list[i][2] + + minetest.register_node("butterflies:butterfly_"..name, { + description = desc.." Butterfly", + drawtype = "plantlike", + tiles = {{ + name = "butterflies_butterfly_"..name.."_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3 + }, + }}, + inventory_image = "butterflies_butterfly_"..name..".png", + wield_image = "butterflies_butterfly_"..name..".png", + waving = 1, + paramtype = "light", + sunlight_propagates = true, + buildable_to = true, + walkable = false, + groups = {catchable = 1}, + selection_box = { + type = "fixed", + fixed = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1}, + }, + floodable = true, + on_place = function(itemstack, placer, pointed_thing) + local player_name = placer:get_player_name() + local pos = pointed_thing.above + + if not minetest.is_protected(pos, player_name) and + not minetest.is_protected(pointed_thing.under, player_name) and + minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name = "butterflies:butterfly_"..name}) + minetest.get_node_timer(pos):start(1) + itemstack:take_item() + end + return itemstack + end, + on_timer = function(pos, elapsed) + if minetest.get_node_light(pos) < 11 then + minetest.set_node(pos, {name = "butterflies:hidden_butterfly_"..name}) + end + minetest.get_node_timer(pos):start(30) + end + }) + + minetest.register_node("butterflies:hidden_butterfly_"..name, { + description = "Hidden "..desc.." Butterfly", + drawtype = "airlike", + inventory_image = "insects_butterfly_"..name..".png", + wield_image = "insects_butterfly_"..name..".png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + pointable = false, + diggable = false, + drop = "", + groups = {not_in_creative_inventory = 1}, + floodable = true, + on_place = function(itemstack, placer, pointed_thing) + local player_name = placer:get_player_name() + local pos = pointed_thing.above + + if not minetest.is_protected(pos, player_name) and + not minetest.is_protected(pointed_thing.under, player_name) and + minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name = "butterflies:hidden_butterfly_"..name}) + minetest.get_node_timer(pos):start(1) + itemstack:take_item() + end + return itemstack + end, + on_timer = function(pos, elapsed) + if minetest.get_node_light(pos) >= 11 then + minetest.set_node(pos, {name = "butterflies:butterfly_"..name}) + end + minetest.get_node_timer(pos):start(30) + end + }) +end + +-- register decoration +minetest.register_decoration({ + name = "butterflies:butterfly", + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + place_offset_y = 2, + sidelen = 80, + fill_ratio = 0.005, + biomes = {"grassland", "deciduous_forest", "floatland_grassland"}, + y_max = 31000, + y_min = 1, + decoration = { + "butterflies:butterfly_white", + "butterflies:butterfly_red", + "butterflies:butterfly_violet" + }, + spawn_by = "group:flower", + num_spawn_by = 1 +}) + +-- get decoration ID +local butterflies = minetest.get_decoration_id("butterflies:butterfly") +minetest.set_gen_notify({decoration = true}, {butterflies}) + +-- start nodetimers +minetest.register_on_generated(function(minp, maxp, blockseed) + local gennotify = minetest.get_mapgen_object("gennotify") + local poslist = {} + + for _, pos in ipairs(gennotify["decoration#"..butterflies] or {}) do + local deco_pos = {x = pos.x, y = pos.y + 3, z = pos.z} + table.insert(poslist, deco_pos) + end + + if #poslist ~= 0 then + for i = 1, #poslist do + local pos = poslist[i] + minetest.get_node_timer(pos):start(1) + end + end +end) diff --git a/mods/butterflies/license.txt b/mods/butterflies/license.txt new file mode 100644 index 00000000..eebdad63 --- /dev/null +++ b/mods/butterflies/license.txt @@ -0,0 +1,58 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (c) 2018 Shara RedCat + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2018 Shara RedCat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ \ No newline at end of file diff --git a/mods/butterflies/textures/butterflies_butterfly_red.png b/mods/butterflies/textures/butterflies_butterfly_red.png new file mode 100644 index 00000000..8edfc365 Binary files /dev/null and b/mods/butterflies/textures/butterflies_butterfly_red.png differ diff --git a/mods/butterflies/textures/butterflies_butterfly_red_animated.png b/mods/butterflies/textures/butterflies_butterfly_red_animated.png new file mode 100644 index 00000000..4a2097bd Binary files /dev/null and b/mods/butterflies/textures/butterflies_butterfly_red_animated.png differ diff --git a/mods/butterflies/textures/butterflies_butterfly_violet.png b/mods/butterflies/textures/butterflies_butterfly_violet.png new file mode 100644 index 00000000..8b8c29dd Binary files /dev/null and b/mods/butterflies/textures/butterflies_butterfly_violet.png differ diff --git a/mods/butterflies/textures/butterflies_butterfly_violet_animated.png b/mods/butterflies/textures/butterflies_butterfly_violet_animated.png new file mode 100644 index 00000000..3f9d72e9 Binary files /dev/null and b/mods/butterflies/textures/butterflies_butterfly_violet_animated.png differ diff --git a/mods/butterflies/textures/butterflies_butterfly_white.png b/mods/butterflies/textures/butterflies_butterfly_white.png new file mode 100644 index 00000000..db4eaec8 Binary files /dev/null and b/mods/butterflies/textures/butterflies_butterfly_white.png differ diff --git a/mods/butterflies/textures/butterflies_butterfly_white_animated.png b/mods/butterflies/textures/butterflies_butterfly_white_animated.png new file mode 100644 index 00000000..e7cada39 Binary files /dev/null and b/mods/butterflies/textures/butterflies_butterfly_white_animated.png differ diff --git a/mods/carts/README.txt b/mods/carts/README.txt index 31ce6449..c0be2d73 100644 --- a/mods/carts/README.txt +++ b/mods/carts/README.txt @@ -6,7 +6,8 @@ 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). +Cart textures are based on original work from PixelBOX by Gambit (permissive +license). [1] https://github.com/SmallJoker/boost_cart/ diff --git a/mods/carts/cart_entity.lua b/mods/carts/cart_entity.lua index 8f733746..855450da 100644 --- a/mods/carts/cart_entity.lua +++ b/mods/carts/cart_entity.lua @@ -1,10 +1,12 @@ 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"}, + initial_properties = { + 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 @@ -27,6 +29,10 @@ function cart_entity:on_rightclick(clicker) elseif not self.driver then self.driver = player_name carts:manage_attachment(clicker, self.object) + + -- player_api does not update the animation + -- when the player is attached, reset to default animation + player_api.set_animation(clicker, "stand") end end @@ -36,29 +42,32 @@ function cart_entity:on_activate(staticdata, dtime_s) return end local data = minetest.deserialize(staticdata) - if not data or type(data) ~= "table" then + if 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 + old_dir = self.old_dir }) end +-- 0.5.x and later: When the driver leaves +function cart_entity:on_detach_child(child) + if child and child:get_player_name() == self.driver then + self.driver = nil + end +end + function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction) - local pos = self.object:getpos() - local vel = self.object:getvelocity() + local pos = self.object:get_pos() + local vel = self.object:get_velocity() if not self.railtype or vector.equals(vel, {x=0, y=0, z=0}) then local node = minetest.get_node(pos).name self.railtype = minetest.get_item_group(node, "connect_to_raillike") @@ -81,12 +90,12 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, -- Detach driver and items if self.driver then if self.old_pos then - self.object:setpos(self.old_pos) + self.object:set_pos(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 + for _, obj_ in ipairs(self.attached_items) do if obj_ then obj_:set_detach() end @@ -99,7 +108,7 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, 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) + minetest.add_item(self.object:get_pos(), leftover) end end self.object:remove() @@ -152,7 +161,7 @@ local function rail_sound(self, dtime) self.sound_handle = nil minetest.after(0.2, minetest.sound_stop, handle) end - local vel = self.object:getvelocity() + local vel = self.object:get_velocity() local speed = vector.length(vel) if speed > 0 then self.sound_handle = minetest.sound_play( @@ -169,32 +178,23 @@ local function get_railparams(pos) return carts.railparams[node.name] or {} end +local v3_len = vector.length local function rail_on_step(self, dtime) - local vel = self.object:getvelocity() + local vel = self.object:get_velocity() if self.punched then vel = vector.add(vel, self.velocity) - self.object:setvelocity(vel) + self.object:set_velocity(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 pos = self.object:get_pos() + local cart_dir = carts:velocity_to_dir(vel) + local same_dir = vector.equals(cart_dir, self.old_dir) 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 + if self.old_pos and not self.punched and same_dir then local flo_pos = vector.round(pos) local flo_old = vector.round(self.old_pos) if vector.equals(flo_pos, flo_old) then @@ -213,20 +213,29 @@ local function rail_on_step(self, dtime) 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 + local stop_wiggle = false + if self.old_pos and same_dir then + -- Detection for "skipping" nodes (perhaps use average dtime?) + -- It's sophisticated enough to take the acceleration in account + local acc = self.object:get_acceleration() + local distance = dtime * (v3_len(vel) + 0.5 * dtime * v3_len(acc)) + + local new_pos, new_dir = carts:pathfinder( + pos, self.old_pos, self.old_dir, distance, 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) + if new_pos then + -- No rail found: set to the expected position + pos = new_pos update.pos = true + cart_dir = new_dir end + elseif self.old_pos and self.old_dir.y ~= 1 and not self.punched then + -- Stop wiggle + stop_wiggle = true end - local cart_dir = carts:velocity_to_dir(vel) local railparams -- dir: New moving direction of the cart @@ -234,16 +243,25 @@ local function rail_on_step(self, dtime) local dir, switch_keys = carts:get_rail_direction( pos, cart_dir, ctrl, self.old_switch, self.railtype ) + local dir_changed = not vector.equals(dir, self.old_dir) local new_acc = {x=0, y=0, z=0} - if vector.equals(dir, {x=0, y=0, z=0}) then + if stop_wiggle or vector.equals(dir, {x=0, y=0, z=0}) then vel = {x = 0, y = 0, z = 0} - pos = vector.round(pos) + local pos_r = vector.round(pos) + if not carts:is_rail(pos_r, self.railtype) + and self.old_pos then + pos = self.old_pos + elseif not stop_wiggle then + pos = pos_r + else + pos.y = math.floor(pos.y + 0.5) + end update.pos = true update.vel = true else -- Direction change detected - if not vector.equals(dir, self.old_dir) then + if dir_changed then vel = vector.multiply(dir, math.abs(vel.x + vel.z)) update.vel = true if dir.y ~= self.old_dir.y then @@ -294,9 +312,9 @@ local function rail_on_step(self, dtime) 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.object:set_acceleration(new_acc) + self.old_pos = vector.round(pos) + if not vector.equals(dir, {x=0, y=0, z=0}) and not stop_wiggle then self.old_dir = vector.new(dir) end self.old_switch = switch_keys @@ -332,7 +350,7 @@ local function rail_on_step(self, dtime) elseif self.old_dir.z < 0 then yaw = 1 end - self.object:setyaw(yaw * math.pi) + self.object:set_yaw(yaw * math.pi) local anim = {x=0, y=0} if dir.y == -1 then @@ -342,9 +360,15 @@ local function rail_on_step(self, dtime) end self.object:set_animation(anim, 1, 0) - self.object:setvelocity(vel) + if update.vel then + self.object:set_velocity(vel) + end if update.pos then - self.object:setpos(pos) + if dir_changed then + self.object:set_pos(pos) + else + self.object:move_to(pos) + end end -- call event handler @@ -367,7 +391,8 @@ minetest.register_craftitem("carts:cart", { local node = minetest.get_node(under) local udef = minetest.registered_nodes[node.name] if udef and udef.on_rightclick and - not (placer and placer:get_player_control().sneak) then + not (placer and placer:is_player() and + placer:get_player_control().sneak) then return udef.on_rightclick(under, node, placer, itemstack, pointed_thing) or itemstack end diff --git a/mods/carts/depends.txt b/mods/carts/depends.txt index 4ad96d51..8e482ce2 100644 --- a/mods/carts/depends.txt +++ b/mods/carts/depends.txt @@ -1 +1,2 @@ default +player_api diff --git a/mods/carts/functions.lua b/mods/carts/functions.lua index 96a12d2b..a54b5948 100644 --- a/mods/carts/functions.lua +++ b/mods/carts/functions.lua @@ -12,13 +12,13 @@ function carts:manage_attachment(player, obj) end local status = obj ~= nil local player_name = player:get_player_name() - if default.player_attached[player_name] == status then + if player_api.player_attached[player_name] == status then return end - default.player_attached[player_name] = status + player_api.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_attach(obj, "", {x=0, y=-4.5, 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() @@ -99,6 +99,16 @@ function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) right.z = -dir.x end + local straight_priority = ctrl and dir.y ~= 0 + + -- Normal, to disallow rail switching up- & downhill + if straight_priority then + cur = self:check_front_up_down(pos, dir, true, railtype) + if cur then + return cur + end + end + if ctrl then if old_switch == 1 then left_check = false @@ -106,14 +116,14 @@ function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) right_check = false end if ctrl.left and left_check then - cur = carts:check_front_up_down(pos, left, false, railtype) + cur = self: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) + cur = self:check_front_up_down(pos, right, false, railtype) if cur then return cur, 2 end @@ -122,9 +132,11 @@ function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) end -- Normal - cur = carts:check_front_up_down(pos, dir, true, railtype) - if cur then - return cur + if not straight_priority then + cur = self:check_front_up_down(pos, dir, true, railtype) + if cur then + return cur + end end -- Left, if not already checked @@ -158,27 +170,37 @@ function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) return {x=0, y=0, z=0} end -function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype) +function carts:pathfinder(pos_, old_pos, old_dir, distance, ctrl, + pf_switch, railtype) + local pos = vector.round(pos_) + if vector.equals(old_pos, pos) then + return + end + local pf_pos = vector.round(old_pos) local pf_dir = vector.new(old_dir) + distance = math.min(carts.path_distance_max, + math.floor(distance + 1)) - for i = 1, 3 do - if vector.equals(pf_pos, pos) then - -- Success! Cart moved on correctly - return true - end + for i = 1, distance do + pf_dir, pf_switch = self:get_rail_direction( + pf_pos, pf_dir, ctrl, pf_switch or 0, railtype) - 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 + return pf_pos, pf_dir end pf_pos = vector.add(pf_pos, pf_dir) + + if vector.equals(pf_pos, pos) then + -- Success! Cart moved on correctly + return + end end - -- Cart not found - return false + -- Not found. Put cart to predicted position + return pf_pos, pf_dir end function carts:register_rail(name, def_overwrite, railparams) diff --git a/mods/carts/init.lua b/mods/carts/init.lua index 53b33cc2..fe45303a 100644 --- a/mods/carts/init.lua +++ b/mods/carts/init.lua @@ -7,14 +7,10 @@ carts.railparams = {} carts.speed_max = 7 -- Set to -1 to disable punching the cart from inside (min = -1) carts.punch_speed_max = 5 +-- Maximal distance for the path correction (for dtime peaks) +carts.path_distance_max = 3 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/creative/README.txt b/mods/creative/README.txt index 82357f30..32e8d22a 100644 --- a/mods/creative/README.txt +++ b/mods/creative/README.txt @@ -9,4 +9,9 @@ Jean-Patrick G. (kilbith) (MIT) Author of media (textures) -------------------------- -Jean-Patrick G. (kilbith) (CC BY-SA 3.0) +paramat (CC BY-SA 3.0): +* creative_prev_icon.png +* creative_next_icon.png +* creative_search_icon.png +* creative_clear_icon.png +* creative_trash_icon.png derived from a texture by kilbith (CC BY-SA 3.0) diff --git a/mods/creative/init.lua b/mods/creative/init.lua index 7b842eda..0f8d4dba 100644 --- a/mods/creative/init.lua +++ b/mods/creative/init.lua @@ -1,8 +1,24 @@ creative = {} +local function update_sfinv(name) + minetest.after(0, function() + local player = minetest.get_player_by_name(name) + if player then + if sfinv.get_page(player):sub(1, 9) == "creative:" then + sfinv.set_page(player, sfinv.get_homepage_name(player)) + else + sfinv.set_player_inventory_formspec(player) + end + end + end) +end + minetest.register_privilege("creative", { description = "Allow player to use creative inventory", - give_to_singleplayer = false + give_to_singleplayer = false, + give_to_admin = false, + on_grant = update_sfinv, + on_revoke = update_sfinv, }) local creative_mode_cache = minetest.settings:get_bool("creative_mode") @@ -46,16 +62,16 @@ end -- Unlimited node placement minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) - return creative.is_enabled_for(placer:get_player_name()) + if placer and placer:is_player() then + return creative.is_enabled_for(placer:get_player_name()) + end end) -- Don't pick up if the item is already in the inventory local old_handle_node_drops = minetest.handle_node_drops function minetest.handle_node_drops(pos, drops, digger) - if not digger or not digger:is_player() then - return - end - if not creative.is_enabled_for(digger:get_player_name()) then + if not digger or not digger:is_player() or + not creative.is_enabled_for(digger:get_player_name()) then return old_handle_node_drops(pos, drops, digger) end local inv = digger:get_inventory() diff --git a/mods/creative/inventory.lua b/mods/creative/inventory.lua index 00b2aa55..6f485d52 100644 --- a/mods/creative/inventory.lua +++ b/mods/creative/inventory.lua @@ -1,4 +1,19 @@ local player_inventory = {} +local inventory_cache = {} + +local function init_creative_cache(items) + inventory_cache[items] = {} + local i_cache = inventory_cache[items] + + for name, def in pairs(items) do + if def.groups.not_in_creative_inventory ~= 1 and + def.description and def.description ~= "" then + i_cache[name] = def + end + end + table.sort(i_cache) + return i_cache +end function creative.init_creative_inventory(player) local player_name = player:get_player_name() @@ -45,11 +60,11 @@ function creative.update_creative_inventory(player_name, tab_content) creative.init_creative_inventory(minetest.get_player_by_name(player_name)) local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) - 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 + local items = inventory_cache[tab_content] or init_creative_cache(tab_content) + + for name, def in pairs(items) do + if 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 @@ -97,21 +112,21 @@ function creative.register_tab(name, title, items) 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] + image_button[5.4,3.25;0.8,0.8;creative_prev_icon.png;creative_prev;] + image_button[7.2,3.25;0.8,0.8;creative_next_icon.png;creative_next;] + image_button[2.1,3.25;0.8,0.8;creative_search_icon.png;creative_search;] + image_button[2.75,3.25;0.8,0.8;creative_clear_icon.png;creative_clear;] tooltip[creative_search;Search] tooltip[creative_clear;Reset] + tooltip[creative_prev;Previous page] + tooltip[creative_next;Next page] 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) + default.get_hotbar_bg(0,4.7) .. creative.formspec_add, false) end, on_enter = function(self, player, context) local player_name = player:get_player_name() @@ -161,10 +176,6 @@ function creative.register_tab(name, title, items) }) end -minetest.register_on_joinplayer(function(player) - creative.update_creative_inventory(player:get_player_name(), minetest.registered_items) -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) diff --git a/mods/creative/license.txt b/mods/creative/license.txt index 4ad1d5ff..50ff9c74 100644 --- a/mods/creative/license.txt +++ b/mods/creative/license.txt @@ -30,6 +30,7 @@ Licenses of media (textures) Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Copyright (C) 2016 Jean-Patrick G. (kilbith) +Copyright (C) 2018 paramat You are free to: Share — copy and redistribute the material in any medium or format. diff --git a/mods/creative/textures/creative_clear_icon.png b/mods/creative/textures/creative_clear_icon.png new file mode 100644 index 00000000..9244264a Binary files /dev/null and b/mods/creative/textures/creative_clear_icon.png differ diff --git a/mods/creative/textures/creative_next_icon.png b/mods/creative/textures/creative_next_icon.png new file mode 100644 index 00000000..82cf3d36 Binary files /dev/null and b/mods/creative/textures/creative_next_icon.png differ diff --git a/mods/creative/textures/creative_prev_icon.png b/mods/creative/textures/creative_prev_icon.png new file mode 100644 index 00000000..b26cd157 Binary files /dev/null and b/mods/creative/textures/creative_prev_icon.png differ diff --git a/mods/creative/textures/creative_search_icon.png b/mods/creative/textures/creative_search_icon.png new file mode 100644 index 00000000..aace8044 Binary files /dev/null and b/mods/creative/textures/creative_search_icon.png differ diff --git a/mods/creative/textures/creative_trash_icon.png b/mods/creative/textures/creative_trash_icon.png index e789ad63..7d7a0a62 100644 Binary files a/mods/creative/textures/creative_trash_icon.png and b/mods/creative/textures/creative_trash_icon.png differ diff --git a/mods/default/README.txt b/mods/default/README.txt index 8af65a9c..96a501b0 100644 --- a/mods/default/README.txt +++ b/mods/default/README.txt @@ -4,14 +4,20 @@ See license.txt for license information. Authors of source code ---------------------- -Originally by celeron55, Perttu Ahola (LGPL 2.1) -Various Minetest developers and contributors (LGPL 2.1) +Originally by celeron55, Perttu Ahola (LGPLv2.1+) +Various Minetest developers and contributors (LGPLv2.1+) -Authors of media (textures, models and sounds) ----------------------------------------------- +The torch code was derived by sofar from the 'torches' mod by +BlockMen (LGPLv2.1+) + +Authors of media (textures, sounds, models and schematics) +---------------------------------------------------------- Everything not listed in here: celeron55, Perttu Ahola (CC BY-SA 3.0) + +Textures +-------- Cisoun's texture pack (CC BY-SA 3.0): default_jungletree.png default_lava.png @@ -23,25 +29,15 @@ Cisoun's texture pack (CC BY-SA 3.0): default_tree_top.png default_water.png -Cisoun's conifers mod (CC BY-SA 3.0): - default_pine_needles.png - -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 (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 (CC BY-SA 3.0): default_water_source_animated.png default_water_flowing_animated.png VanessaE (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 default_desert_sand.png default_desert_stone.png default_sand.png @@ -52,13 +48,6 @@ Calinou (CC BY-SA 3.0): default_brick.png default_papyrus.png default_mineral_copper.png - default_glass_detail.png - -MirceaKitsune (CC BY-SA 3.0): - character.x - -Jordach (CC BY-SA 3.0): - character.png PilzAdam (CC BY-SA 3.0): default_jungleleaves.png @@ -75,6 +64,7 @@ InfinityProject (CC BY-SA 3.0): Splizard (CC BY-SA 3.0): default_pine_sapling.png + default_pine_needles.png Zeg9 (CC BY-SA 3.0): default_coal_block.png @@ -88,11 +78,13 @@ paramat (CC BY-SA 3.0): default_acacia_leaves_simple.png default_acacia_sapling.png default_acacia_bush_sapling.png + default_pine_bush_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_pine_bush_stem.png default_junglewood.png default_jungletree_top.png default_sandstone_brick.png @@ -119,9 +111,24 @@ paramat (CC BY-SA 3.0): default_silver_sandstone.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0) default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0) default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0) + default_bookshelf_slot.png -- Derived from a texture by Gambit (CC-BY-SA 3.0) + default_marram_grass_*.png -- Derived from textures by TumeniNodes (CC-BY-SA 3.0) + default_emergent_jungle_sapling.png + default_permafrost.png -- Derived from a texture by Neuromancer (CC BY-SA 3.0) + default_stones.png -- Derived from a texture by sofar (CC0 1.0) + default_stones_side.png -- Derived from a texture by sofar (CC0 1.0) + default_moss.png + default_moss_side.png + default_fence_rail_acacia_wood + default_fence_rail_aspen_wood -- Derived from a texture by sofar (CC BY-SA 3.0) + default_fence_rail_junglewood + default_fence_rail_pine_wood + default_fence_rail_wood -- Derived from a texture by BlockMen (CC BY-SA 3.0) -brunob.santos (CC BY-SA 4.0): - default_desert_cobble.png +TumeniNodes (CC BY-SA 3.0): + default_desert_cobble.png -- Derived from a texture by brunob.santos (CC BY-SA 3.0) + default_coniferous_litter.png + default_coniferous_litter_side.png BlockMen (CC BY-SA 3.0): default_aspen_leaves.png -- Derived from Sofar's texture @@ -131,7 +138,6 @@ BlockMen (CC BY-SA 3.0): default_gold_ingot.png default_tool_steelsword.png default_diamond.png - default_book.png default_tool_*.png default_lava_source_animated.png default_lava_flowing_animated.png @@ -145,26 +151,19 @@ 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 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) default_chest_inside -sofar (WTFPL): +sofar (CC0 1.0): default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel -Neuromancer (CC BY-SA 2.0): +Neuromancer (CC BY-SA 3.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 (CC BY-SA 3.0): @@ -186,11 +185,12 @@ Gambit (CC BY-SA 3.0): default_snowball.png default_key.png default_key_skeleton.png + default_book.png asl97 (CC BY-SA 3.0): default_ice.png -KevDoy (CC BY-SA 3.0) +KevDoy (CC BY-SA 3.0): heart.png Pithydon (CC BY-SA 3.0) @@ -198,11 +198,10 @@ Pithydon (CC BY-SA 3.0) default_coral_orange.png default_coral_skeleton.png -Ferk (CC0 1.0) +Ferk (CC0 1.0): default_item_smoke.png - default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart -npx (CC BY-SA 3.0) +npx (CC BY-SA 3.0): default_rainforest_litter.png default_rainforest_litter_side.png @@ -221,15 +220,42 @@ kilbith (CC BY-SA 3.0): default_tin_ingot.png default_tin_lump.png +tobyplowy (CC BY-SA 3.0): + default_kelp.png + +CloudyProton (CC BY-SA 3.0): + default_book_written.png, based on default_book.png by Gambit + +Mossmanikin (CC BY-SA 3.0): + default_fern_*.png + +random-geek (CC BY-SA 3.0): + default_blueberries.png + default_blueberry_overlay.png + default_blueberry_bush_leaves.png, derived from default_bush_leaves (by paramat) + default_blueberry_bush_sapling.png + default_dirt.png -- Derived from a texture by Neuromancer (CC BY-SA 3.0) + +Krock (CC0 1.0): + default_glass.png + default_glass_detail.png + +Topywo (CC BY-SA 3.0) + default_coral_cyan.png + default_coral_green.png + default_coral_pink.png + +Extex101 (CC BY-SA 3.0) + default_large_cactus_seedling.png + + +Sounds +------ 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/ -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 @@ -252,8 +278,6 @@ Mito551 (sounds) (CC BY-SA 3.0): default_place_node.3.ogg default_place_node_hard.1.ogg default_place_node_hard.2.ogg - default_snow_footstep.1.ogg - default_snow_footstep.2.ogg default_hard_footstep.1.ogg default_hard_footstep.2.ogg default_hard_footstep.3.ogg @@ -278,14 +302,14 @@ Metal sounds: 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) +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) +blukotek (CC0 1.0): https://www.freesound.org/people/blukotek/sounds/251660/ default_dig_snappy.ogg @@ -298,3 +322,59 @@ Chests sounds added by sofar, derived of several files mixed together: - http://www.freesound.org/people/bulbastre/sounds/126887/ CC-BY-3.0 - http://www.freesound.org/people/Yoyodaman234/sounds/183541/ CC0 +Ryding (CC0 1.0): +http://freesound.org/people/Ryding/sounds/94337/ + default_snow_footstep.*.ogg + +Ferk (CC0 1.0): + default_item_smoke.ogg, based on a sound by http://opengameart.org/users/bart + + +Models +------ +sofar (CC BY-SA 3.0): + chest_open.obj + torch_ceiling.obj + torch_floor.obj + torch_wall.obj + + +Schematics +---------- +paramat (CC BY-SA 3.0): + acacia_bush.mts + acacia_tree.mts + acacia_tree_from_sapling.mts + apple_tree.mts + apple_tree_from_sapling.mts + aspen_tree.mts + aspen_tree_from_sapling.mts + bush.mts + emergent_jungle_tree.mts + emergent_jungle_tree_from_sapling.mts + jungle_tree.mts + jungle_tree_from_sapling.mts + large_cactus.mts + papyrus.mts + pine_tree.mts + pine_tree_from_sapling.mts + snowy_pine_tree_from_sapling.mts + small_pine_tree.mts + small_pine_tree_from_sapling.mts + snowy_small_pine_tree_from_sapling.mts + +Shara RedCat (CC BY-SA 3.0): + acacia_log.mts + apple_log.mts + aspen_log.mts + jungle_log.mts + pine_log.mts + +sofar (CC BY-SA 3.0): + corals.mts + +TumeniNodes (CC BY-SA 3.0): + pine_bush.mts + +random-geek (CC BY-SA 3.0): + blueberry_bush.mts diff --git a/mods/default/chests.lua b/mods/default/chests.lua new file mode 100644 index 00000000..b70e5ad2 --- /dev/null +++ b/mods/default/chests.lua @@ -0,0 +1,318 @@ +default.chest = {} + +function default.chest.get_chest_formspec(pos) + local spos = pos.x .. "," .. pos.y .. "," .. pos.z + local formspec = + "size[8,9]" .. + "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[nodemeta:" .. spos .. ";main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85) + return formspec +end + +function default.chest.chest_lid_obstructed(pos) + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + local def = minetest.registered_nodes[minetest.get_node(above).name] + -- allow ladders, signs, wallmounted things and torches to not obstruct + if def and + (def.drawtype == "airlike" or + def.drawtype == "signlike" or + def.drawtype == "torchlike" or + (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then + return false + end + return true +end + +function default.chest.chest_lid_close(pn) + local chest_open_info = default.chest.open_chests[pn] + local pos = chest_open_info.pos + local sound = chest_open_info.sound + local swap = chest_open_info.swap + + default.chest.open_chests[pn] = nil + for k, v in pairs(default.chest.open_chests) do + if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then + return true + end + end + + local node = minetest.get_node(pos) + minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap, + param2 = node.param2 }) + minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10}) +end + +default.chest.open_chests = {} + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "default:chest" then + return + end + if not player or not fields.quit then + return + end + local pn = player:get_player_name() + + if not default.chest.open_chests[pn] then + return + end + + default.chest.chest_lid_close(pn) + return true +end) + +minetest.register_on_leaveplayer(function(player) + local pn = player:get_player_name() + if default.chest.open_chests[pn] then + default.chest.chest_lid_close(pn) + end +end) + +function default.chest.register_chest(name, d) + local def = table.copy(d) + def.drawtype = "mesh" + def.visual = "mesh" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.legacy_facedir_simple = true + def.is_ground_content = false + + if def.protected then + def.on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end + def.after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Locked Chest (owned by " .. + meta:get_string("owner") .. ")") + end + def.can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and + default.can_interact_with_node(player, pos) + end + def.allow_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return count + end + def.allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return stack:get_count() + end + def.allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return stack:get_count() + end + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + if not default.can_interact_with_node(clicker, pos) then + return itemstack + end + + minetest.sound_play(def.sound_open, {gain = 0.3, + pos = pos, max_hear_distance = 10}) + if not default.chest.chest_lid_obstructed(pos) then + minetest.swap_node(pos, + { name = "default:" .. name .. "_open", + param2 = node.param2 }) + end + minetest.after(0.2, minetest.show_formspec, + clicker:get_player_name(), + "default:chest", default.chest.get_chest_formspec(pos)) + default.chest.open_chests[clicker:get_player_name()] = { pos = pos, + sound = def.sound_close, swap = name } + end + def.on_blast = function() end + def.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 = itemstack:get_meta() + + if itemstack:get_metadata() == "" then + return + end + + if key_meta:get_string("secret") == "" then + key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret) + itemstack:set_metadata("") + end + + if secret ~= key_meta:get_string("secret") then + return + end + + minetest.show_formspec( + player:get_player_name(), + "default:chest_locked", + default.chest.get_chest_formspec(pos) + ) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local pn = player:get_player_name() + + -- verify placer is owner of lockable chest + if owner ~= pn then + minetest.record_protection_violation(pos, pn) + minetest.chat_send_player(pn, "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 + else + def.on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end + def.can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end + def.on_rightclick = function(pos, node, clicker) + minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos, + max_hear_distance = 10}) + if not default.chest.chest_lid_obstructed(pos) then + minetest.swap_node(pos, { + name = "default:" .. name .. "_open", + param2 = node.param2 }) + end + minetest.after(0.2, minetest.show_formspec, + clicker:get_player_name(), + "default:chest", default.chest.get_chest_formspec(pos)) + default.chest.open_chests[clicker:get_player_name()] = { pos = pos, + sound = def.sound_close, swap = name } + end + def.on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "main", drops) + drops[#drops+1] = "default:" .. name + minetest.remove_node(pos) + return drops + end + end + + def.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 chest at " .. minetest.pos_to_string(pos)) + end + def.on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves " .. stack:get_name() .. + " to chest at " .. minetest.pos_to_string(pos)) + end + def.on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes " .. stack:get_name() .. + " from chest at " .. minetest.pos_to_string(pos)) + end + + local def_opened = table.copy(def) + local def_closed = table.copy(def) + + def_opened.mesh = "chest_open.obj" + for i = 1, #def_opened.tiles do + if type(def_opened.tiles[i]) == "string" then + def_opened.tiles[i] = {name = def_opened.tiles[i], backface_culling = true} + elseif def_opened.tiles[i].backface_culling == nil then + def_opened.tiles[i].backface_culling = true + end + end + def_opened.drop = "default:" .. name + def_opened.groups.not_in_creative_inventory = 1 + def_opened.selection_box = { + type = "fixed", + fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 }, + } + def_opened.can_dig = function() + return false + end + def_opened.on_blast = function() end + + def_closed.mesh = nil + def_closed.drawtype = nil + def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal" + def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh + def_closed.tiles[3] = def.tiles[3].."^[transformFX" + + minetest.register_node("default:" .. name, def_closed) + minetest.register_node("default:" .. name .. "_open", def_opened) + + -- convert old chests to this new variant + minetest.register_lbm({ + label = "update chests to opening chests", + name = "default:upgrade_" .. name .. "_v2", + nodenames = {"default:" .. name}, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", nil) + local inv = meta:get_inventory() + local list = inv:get_list("default:chest") + if list then + inv:set_size("main", 8*4) + inv:set_list("main", list) + inv:set_list("default:chest", nil) + end + end + }) +end + +default.chest.register_chest("chest", { + description = "Chest", + tiles = { + "default_chest_top.png", + "default_chest_top.png", + "default_chest_side.png", + "default_chest_side.png", + "default_chest_front.png", + "default_chest_inside.png" + }, + sounds = default.node_sound_wood_defaults(), + sound_open = "default_chest_open", + sound_close = "default_chest_close", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, +}) + +default.chest.register_chest("chest_locked", { + description = "Locked Chest", + tiles = { + "default_chest_top.png", + "default_chest_top.png", + "default_chest_side.png", + "default_chest_side.png", + "default_chest_lock.png", + "default_chest_inside.png" + }, + sounds = default.node_sound_wood_defaults(), + sound_open = "default_chest_open", + sound_close = "default_chest_close", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, + protected = true, +}) diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index 814e8db2..f2d3bd44 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -49,6 +49,13 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "default:pine_wood", + recipe = { + {"default:pine_bush_stem"}, + } +}) + minetest.register_craft({ output = 'default:stick 4', recipe = { @@ -763,14 +770,35 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "default:emergent_jungle_sapling", + recipe = { + {"default:junglesapling", "default:junglesapling", "default:junglesapling"}, + {"default:junglesapling", "default:junglesapling", "default:junglesapling"}, + {"default:junglesapling", "default:junglesapling", "default:junglesapling"}, + } +}) + +minetest.register_craft({ + output = "default:large_cactus_seedling", + recipe = { + {"", "default:cactus", ""}, + {"default:cactus", "default:cactus", "default:cactus"}, + {"", "default:cactus", ""}, + } +}) + + -- -- Crafting (tool repair) -- + minetest.register_craft({ type = "toolrepair", additional_wear = -0.02, }) + -- -- Cooking recipes -- @@ -849,11 +877,12 @@ minetest.register_craft({ cooktime = 5, }) + -- -- Fuels -- --- Support use of group:tree +-- Support use of group:tree, includes default:tree which has the same burn time minetest.register_craft({ type = "fuel", recipe = "group:tree", @@ -876,12 +905,6 @@ minetest.register_craft({ burntime = 26, }) -minetest.register_craft({ - type = "fuel", - recipe = "default:tree", - burntime = 30, -}) - minetest.register_craft({ type = "fuel", recipe = "default:acacia_tree", @@ -895,7 +918,7 @@ minetest.register_craft({ }) --- Support use of group:wood +-- Support use of group:wood, includes default:wood which has the same burn time minetest.register_craft({ type = "fuel", recipe = "group:wood", @@ -914,12 +937,6 @@ minetest.register_craft({ burntime = 6, }) -minetest.register_craft({ - type = "fuel", - recipe = "default:wood", - burntime = 7, -}) - minetest.register_craft({ type = "fuel", recipe = "default:acacia_wood", @@ -933,53 +950,59 @@ minetest.register_craft({ }) --- Support use of group:sapling +-- Support use of group:sapling, includes default:sapling which has the same burn time minetest.register_craft({ type = "fuel", recipe = "group:sapling", - burntime = 10, + burntime = 5, }) minetest.register_craft({ type = "fuel", recipe = "default:bush_sapling", - burntime = 6, + burntime = 3, }) minetest.register_craft({ type = "fuel", recipe = "default:acacia_bush_sapling", - burntime = 7, + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_bush_sapling", + burntime = 2, }) minetest.register_craft({ type = "fuel", recipe = "default:aspen_sapling", - burntime = 8, + burntime = 4, }) minetest.register_craft({ type = "fuel", recipe = "default:pine_sapling", - burntime = 9, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "default:sapling", - burntime = 10, + burntime = 5, }) minetest.register_craft({ type = "fuel", recipe = "default:acacia_sapling", - burntime = 11, + burntime = 6, }) minetest.register_craft({ type = "fuel", recipe = "default:junglesapling", - burntime = 12, + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:emergent_jungle_sapling", + burntime = 7, }) @@ -1014,6 +1037,37 @@ minetest.register_craft({ }) +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_aspen_wood", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_pine_wood", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_wood", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_acacia_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_junglewood", + burntime = 7, +}) + + minetest.register_craft({ type = "fuel", recipe = "default:bush_stem", @@ -1026,16 +1080,22 @@ minetest.register_craft({ burntime = 8, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_bush_stem", + burntime = 6, +}) + minetest.register_craft({ type = "fuel", recipe = "default:junglegrass", - burntime = 2, + burntime = 3, }) minetest.register_craft({ type = "fuel", recipe = "group:leaves", - burntime = 1, + burntime = 4, }) minetest.register_craft({ @@ -1044,10 +1104,16 @@ minetest.register_craft({ burntime = 15, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:large_cactus_seedling", + burntime = 5, +}) + minetest.register_craft({ type = "fuel", recipe = "default:papyrus", - burntime = 1, + burntime = 3, }) minetest.register_craft({ @@ -1059,7 +1125,7 @@ minetest.register_craft({ minetest.register_craft({ type = "fuel", recipe = "default:ladder_wood", - burntime = 2, + burntime = 7, }) minetest.register_craft({ @@ -1092,12 +1158,6 @@ minetest.register_craft({ burntime = 30, }) -minetest.register_craft({ - type = "fuel", - recipe = "default:apple", - burntime = 3, -}) - minetest.register_craft({ type = "fuel", recipe = "default:coal_lump", @@ -1122,6 +1182,18 @@ minetest.register_craft({ burntime = 2, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:fern_1", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:marram_grass_1", + burntime = 2, +}) + minetest.register_craft({ type = "fuel", recipe = "default:paper", diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua index e4a93ae5..6a1b5706 100644 --- a/mods/default/craftitems.lua +++ b/mods/default/craftitems.lua @@ -50,16 +50,14 @@ local function book_on_use(itemstack, user) local formspec if owner == player_name then - formspec = "size[8,8]" .. default.gui_bg .. - default.gui_bg_img .. + formspec = "size[8,8]" .. "field[0.5,1;7.5,0;title;Title:;" .. minetest.formspec_escape(title) .. "]" .. "textarea[0.5,1.5;7.5,7;text;Contents:;" .. minetest.formspec_escape(text) .. "]" .. "button_exit[2.5,7.5;3,1;save;Save]" else - formspec = "size[8,8]" .. default.gui_bg .. - default.gui_bg_img .. + formspec = "size[8,8]" .. "label[0.5,0.5;by " .. owner .. "]" .. "tablecolumns[color;text]" .. "tableoptions[background=#00000000;highlight=#00000000;border=false]" .. @@ -112,6 +110,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end data.description = "\""..short_title.."\" by "..data.owner data.text = fields.text:sub(1, max_text_size) + data.text = data.text:gsub("\r\n", "\n"):gsub("\r", "\n") data.page = 1 data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp) @@ -120,7 +119,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if inv:room_for_item("main", new_stack) then inv:add_item("main", new_stack) else - minetest.add_item(player:getpos(), new_stack) + minetest.add_item(player:get_pos(), new_stack) end else stack:get_meta():from_table({ fields = data }) @@ -246,7 +245,7 @@ minetest.register_craftitem("default:skeleton_key", { itemstack = new_stack else if inv:add_item("main", new_stack):get_count() > 0 then - minetest.add_item(user:getpos(), new_stack) + minetest.add_item(user:get_pos(), new_stack) end -- else: added to inventory successfully end @@ -340,3 +339,9 @@ minetest.register_craftitem("default:flint", { description = "Flint", inventory_image = "default_flint.png" }) + +minetest.register_craftitem("default:blueberries", { + description = "Blueberries", + inventory_image = "default_blueberries.png", + on_use = minetest.item_eat(2), +}) diff --git a/mods/default/depends.txt b/mods/default/depends.txt new file mode 100644 index 00000000..e1c38184 --- /dev/null +++ b/mods/default/depends.txt @@ -0,0 +1 @@ +player_api? diff --git a/mods/default/functions.lua b/mods/default/functions.lua index ed6dd6f5..9ac810ef 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -1,5 +1,3 @@ --- mods/default/functions.lua - -- -- Sounds -- @@ -117,6 +115,21 @@ function default.node_sound_water_defaults(table) return table end +function default.node_sound_snow_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_snow_footstep", gain = 0.2} + table.dig = table.dig or + {name = "default_snow_footstep", gain = 0.3} + table.dug = table.dug or + {name = "default_snow_footstep", gain = 0.3} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + + -- -- Lavacooling -- @@ -149,7 +162,7 @@ if minetest.settings:get_bool("enable_lavacooling") ~= false then label = "Lava cooling", nodenames = {"default:lava_source", "default:lava_flowing"}, neighbors = {"group:cools_lava", "group:water"}, - interval = 1, + interval = 2, chance = 2, catch_up = false, action = function(...) @@ -158,8 +171,9 @@ if minetest.settings:get_bool("enable_lavacooling") ~= false then }) end + -- --- optimized helper to put all items in an inventory into a drops list +-- Optimized helper to put all items in an inventory into a drops list -- function default.get_inventory_drops(pos, inventory, drops) @@ -174,11 +188,12 @@ function default.get_inventory_drops(pos, inventory, drops) end end + -- -- Papyrus and cactus growing -- --- wrapping the functions in abm action is necessary to make overriding them possible +-- Wrapping the functions in ABM action is necessary to make overriding them possible function default.grow_cactus(pos, node) if node.param2 >= 4 then @@ -255,7 +270,7 @@ minetest.register_abm({ -- --- dig upwards +-- Dig upwards -- function default.dig_up(pos, node, digger) @@ -286,7 +301,22 @@ function default.register_fence(name, def) -- Allow almost everything to be overridden local default_fields = { paramtype = "light", - drawtype = "fencelike", + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}}, + -- connect_top = + -- connect_bottom = + connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8}, + {-1/16,-5/16,-1/2,1/16,-3/16,-1/8}}, + connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16}, + {-1/2,-5/16,-1/16,-1/8,-3/16,1/16}}, + connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2}, + {-1/16,-5/16,1/8,1/16,-3/16,1/2}}, + connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16}, + {1/8,-5/16,-1/16,1/2,-3/16,1/16}}, + }, + connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"}, inventory_image = fence_texture, wield_image = fence_texture, tiles = { def.texture }, @@ -299,7 +329,72 @@ function default.register_fence(name, def) groups = {}, } for k, v in pairs(default_fields) do - if not def[k] then + if def[k] == nil then + def[k] = v + end + end + + -- Always add to the fence group, even if no group provided + def.groups.fence = 1 + + def.texture = nil + def.material = nil + + minetest.register_node(name, def) +end + + +-- +-- Fence rail registration helper +-- + +function default.register_fence_rail(name, def) + minetest.register_craft({ + output = name .. " 16", + recipe = { + { def.material, def.material }, + { "", ""}, + { def.material, def.material }, + } + }) + + local fence_rail_texture = "default_fence_rail_overlay.png^" .. def.texture .. + "^default_fence_rail_overlay.png^[makealpha:255,126,126" + -- Allow almost everything to be overridden + local default_fields = { + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = { + {-1/16, 3/16, -1/16, 1/16, 5/16, 1/16}, + {-1/16, -3/16, -1/16, 1/16, -5/16, 1/16} + }, + -- connect_top = + -- connect_bottom = + connect_front = { + {-1/16, 3/16, -1/2, 1/16, 5/16, -1/16}, + {-1/16, -5/16, -1/2, 1/16, -3/16, -1/16}}, + connect_left = { + {-1/2, 3/16, -1/16, -1/16, 5/16, 1/16}, + {-1/2, -5/16, -1/16, -1/16, -3/16, 1/16}}, + connect_back = { + {-1/16, 3/16, 1/16, 1/16, 5/16, 1/2}, + {-1/16, -5/16, 1/16, 1/16, -3/16, 1/2}}, + connect_right = { + {1/16, 3/16, -1/16, 1/2, 5/16, 1/16}, + {1/16, -5/16, -1/16, 1/2, -3/16, 1/16}}, + }, + connects_to = {"group:fence", "group:wall"}, + inventory_image = fence_rail_texture, + wield_image = fence_rail_texture, + tiles = {def.texture}, + sunlight_propagates = true, + is_ground_content = false, + groups = {}, + } + for k, v in pairs(default_fields) do + if def[k] == nil then def[k] = v end end @@ -321,7 +416,7 @@ end -- Prevent decay of placed leaves default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) - if placer and not placer:get_player_control().sneak then + if placer and placer:is_player() and not placer:get_player_control().sneak then local node = minetest.get_node(pos) node.param2 = 1 minetest.set_node(pos, node) @@ -388,6 +483,7 @@ function default.register_leafdecay(def) end end + -- -- Convert dirt to something that fits the environment -- @@ -488,63 +584,7 @@ minetest.register_abm({ -- --- Checks if specified volume intersects a protected volume --- - -function default.intersects_protection(minp, maxp, player_name, interval) - -- 'interval' is the largest allowed interval for the 3D lattice of checks - - -- Compute the optimal float step 'd' for each axis so that all corners and - -- borders are checked. 'd' will be smaller or equal to 'interval'. - -- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the - -- for loop (which might otherwise not be the case due to rounding errors). - local d = {} - for _, c in pairs({"x", "y", "z"}) do - if maxp[c] > minp[c] then - d[c] = (maxp[c] - minp[c]) / math.ceil((maxp[c] - minp[c]) / interval) - 1e-4 - elseif maxp[c] == minp[c] then - d[c] = 1 -- Any value larger than 0 to avoid division by zero - else -- maxp[c] < minp[c], print error and treat as protection intersected - minetest.log("error", "maxp < minp in 'default.intersects_protection()'") - return true - end - end - - for zf = minp.z, maxp.z, d.z do - local z = math.floor(zf + 0.5) - for yf = minp.y, maxp.y, d.y do - local y = math.floor(yf + 0.5) - for xf = minp.x, maxp.x, d.x do - local x = math.floor(xf + 0.5) - if minetest.is_protected({x = x, y = y, z = z}, player_name) then - return true - end - end - end - end - - 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, -}) - - --- --- NOTICE: This method is not an official part of the API yet! +-- NOTICE: This method is not an official part of the API yet. -- This method may change in future. -- @@ -564,7 +604,7 @@ function default.can_interact_with_node(player, pos) return true end - -- is player wielding the right key? + -- Is player wielding the right key? local item = player:get_wielded_item() if item:get_name() == "default:key" then local key_meta = item:get_meta() diff --git a/mods/default/furnace.lua b/mods/default/furnace.lua index 1643d427..a06f3b23 100644 --- a/mods/default/furnace.lua +++ b/mods/default/furnace.lua @@ -5,9 +5,6 @@ function default.get_furnace_active_formspec(fuel_percent, item_percent) return "size[8,8.5]".. - default.gui_bg.. - default.gui_bg_img.. - default.gui_slots.. "list[context;src;2.75,0.5;1,1;]".. "list[context;fuel;2.75,2.5;1,1;]".. "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:".. @@ -28,9 +25,6 @@ end function default.get_furnace_inactive_formspec() return "size[8,8.5]".. - default.gui_bg.. - default.gui_bg_img.. - default.gui_slots.. "list[context;src;2.75,0.5;1,1;]".. "list[context;fuel;2.75,2.5;1,1;]".. "image[2.75,1.5;1,1;default_furnace_fire_bg.png]".. @@ -118,7 +112,7 @@ local function furnace_node_timer(pos, elapsed) local fuel local update = true - while update do + while elapsed > 0 and update do update = false srclist = inv:get_list("src") @@ -133,13 +127,18 @@ local function furnace_node_timer(pos, elapsed) cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) cookable = cooked.time ~= 0 + local el = math.min(elapsed, fuel_totaltime - fuel_time) + if cookable then -- fuel lasts long enough, adjust el to cooking duration + el = math.min(el, cooked.time - src_time) + end + -- 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 + fuel_time = fuel_time + el -- If there is a cookable item then check if it is ready yet if cookable then - src_time = src_time + elapsed + src_time = src_time + el if src_time >= cooked.time then -- Place result in dst list if possible if inv:room_for_item("dst", cooked.item) then @@ -148,6 +147,9 @@ local function furnace_node_timer(pos, elapsed) src_time = src_time - cooked.time update = true end + else + -- Item could not be cooked: probably missing fuel + update = true end end else @@ -165,8 +167,7 @@ local function furnace_node_timer(pos, elapsed) -- 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 + fuel_totaltime = fuel.time + (fuel_totaltime - fuel_time) end else -- We don't need to get new fuel since there is no cookable item @@ -176,7 +177,7 @@ local function furnace_node_timer(pos, elapsed) fuel_time = 0 end - elapsed = 0 + elapsed = elapsed - el end if fuel and fuel_totaltime > fuel.time then @@ -208,11 +209,11 @@ local function furnace_node_timer(pos, elapsed) end local fuel_state = "Empty" - local active = "inactive " + local active = "inactive" local result = false if fuel_totaltime ~= 0 then - active = "active " + active = "active" local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) fuel_state = fuel_percent .. "%" formspec = default.get_furnace_active_formspec(fuel_percent, item_percent) @@ -229,7 +230,7 @@ local function furnace_node_timer(pos, elapsed) minetest.get_node_timer(pos):stop() end - local infotext = "Furnace " .. active .. "(Item: " .. item_state .. + local infotext = "Furnace " .. active .. "\n(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" -- diff --git a/mods/default/init.lua b/mods/default/init.lua index 65e9b06d..b21b3497 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -9,9 +9,12 @@ default = {} default.LIGHT_MAX = 14 -- GUI related stuff -default.gui_bg = "bgcolor[#080808CC;true]" -default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" -default.gui_slots = "listcolors[#79777639;#8EACE542;#141318;#8EACE599;#8EACE521]" +minetest.register_on_joinplayer(function(player) + player:set_formspec_prepend([[ + bgcolor[#080808CC;true] + background[5,5;1,1;gui_formbg.png;true] + listcolors[#79777639;#8EACE542;#141318;#8EACE599;#8EACE521] ]]) +end) function default.get_hotbar_bg(x,y) local out = "" @@ -22,9 +25,6 @@ function default.get_hotbar_bg(x,y) end default.gui_survival_form = "size[8,8.5]".. - default.gui_bg.. - default.gui_bg_img.. - default.gui_slots.. "list[current_player;main;0,4.25;8,1;]".. "list[current_player;main;0,5.5;8,3;8]".. "list[current_player;craft;1.75,0.5;3,3;]".. @@ -40,6 +40,7 @@ local default_path = minetest.get_modpath("default") dofile(default_path.."/functions.lua") dofile(default_path.."/trees.lua") dofile(default_path.."/nodes.lua") +dofile(default_path.."/chests.lua") dofile(default_path.."/furnace.lua") dofile(default_path.."/torch.lua") dofile(default_path.."/tools.lua") @@ -47,6 +48,5 @@ dofile(default_path.."/item_entity.lua") dofile(default_path.."/craftitems.lua") dofile(default_path.."/crafting.lua") dofile(default_path.."/mapgen.lua") -dofile(default_path.."/player.lua") dofile(default_path.."/aliases.lua") dofile(default_path.."/legacy.lua") diff --git a/mods/default/item_entity.lua b/mods/default/item_entity.lua index c34e60e9..2a61f08e 100644 --- a/mods/default/item_entity.lua +++ b/mods/default/item_entity.lua @@ -16,7 +16,7 @@ local item = { burn_up = function(self) -- disappear in a smoke puff self.object:remove() - local p = self.object:getpos() + local p = self.object:get_pos() minetest.sound_play("default_item_smoke", { pos = p, max_hear_distance = 8, @@ -48,7 +48,7 @@ local item = { if self.ignite_timer > 10 then self.ignite_timer = 0 - local node = minetest.get_node_or_nil(self.object:getpos()) + local node = minetest.get_node_or_nil(self.object:get_pos()) if not node then return end diff --git a/mods/default/legacy.lua b/mods/default/legacy.lua index a8c8ad56..935d857a 100644 --- a/mods/default/legacy.lua +++ b/mods/default/legacy.lua @@ -23,3 +23,27 @@ LIGHT_MAX = default.LIGHT_MAX -- Formspecs default.gui_suvival_form = default.gui_survival_form +default.gui_bg = "" +default.gui_bg_img = "" +default.gui_slots = "" + +-- Players +if minetest.get_modpath("player_api") then + default.registered_player_models = player_api.registered_models + default.player_register_model = player_api.register_model + default.player_attached = player_api.player_attached + default.player_get_animation = player_api.get_animation + default.player_set_model = player_api.set_model + default.player_set_textures = player_api.set_textures + default.player_set_animation = player_api.set_animation +end + +-- Chests +default.register_chest = default.chest.register_chest + +-- Check for a volume intersecting protection +function default.intersects_protection(minp, maxp, player_name, interval) + minetest.log("warning", "default.intersects_protection() is " .. + "deprecated, use minetest.is_area_protected() instead.") + minetest.is_area_protected(minp, maxp, player_name, interval) +end diff --git a/mods/default/license.txt b/mods/default/license.txt index 72af7284..fecb1eb8 100644 --- a/mods/default/license.txt +++ b/mods/default/license.txt @@ -2,8 +2,8 @@ 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 +Copyright (C) 2011-2018 celeron55, Perttu Ahola +Copyright (C) 2011-2018 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; @@ -19,7 +19,8 @@ Licenses of media (textures, models and sounds) ----------------------------------------------- Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -Copyright (C) 2010-2016: +Copyright (C) 2010-2018: + celeron55, Perttu Ahola Cisoun G4JC @@ -44,6 +45,12 @@ Copyright (C) 2010-2016: GreenXenith kaeza kilbith + tobyplowy + CloudyProton + TumeniNodes + Mossmanikin + random-geek + Extex101 You are free to: Share — copy and redistribute the material in any medium or format. @@ -75,74 +82,8 @@ 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 @@ -175,3 +116,41 @@ 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 + +Iwan Gabovitch +Ottomaani138 +Ogrebane +blukotek +Sevin7 +Yoyodaman234 +Ryding + +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/default/mapgen.lua b/mods/default/mapgen.lua index 3e80ce33..d0c692df 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -59,8 +59,8 @@ function default.register_mgv6_ores() wherein = {"default:sand"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, - y_min = -15, y_max = 0, + y_min = -15, noise_threshold = 0.0, noise_params = { offset = 0.5, @@ -80,8 +80,8 @@ function default.register_mgv6_ores() wherein = {"default:stone", "default:desert_stone"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, - y_min = -31, y_max = 0, + y_min = -31, noise_threshold = 0.0, noise_params = { offset = 0.5, @@ -101,8 +101,8 @@ function default.register_mgv6_ores() wherein = {"default:stone"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, - y_min = -31, y_max = 31000, + y_min = -31, noise_threshold = 0.0, noise_params = { offset = 0.5, @@ -122,8 +122,8 @@ function default.register_mgv6_ores() wherein = {"default:stone"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, - y_min = -31000, y_max = 31000, + y_min = -31000, noise_threshold = 0.0, noise_params = { offset = 0.5, @@ -146,8 +146,8 @@ function default.register_mgv6_ores() clust_scarcity = 8 * 8 * 8, clust_num_ores = 9, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -157,8 +157,8 @@ function default.register_mgv6_ores() clust_scarcity = 8 * 8 * 8, clust_num_ores = 8, clust_size = 3, - y_min = -31000, y_max = 64, + y_min = -31000, }) minetest.register_ore({ @@ -168,8 +168,8 @@ function default.register_mgv6_ores() clust_scarcity = 24 * 24 * 24, clust_num_ores = 27, clust_size = 6, - y_min = -31000, y_max = 0, + y_min = -31000, }) -- Iron @@ -181,8 +181,8 @@ function default.register_mgv6_ores() clust_scarcity = 9 * 9 * 9, clust_num_ores = 12, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -192,8 +192,8 @@ function default.register_mgv6_ores() clust_scarcity = 7 * 7 * 7, clust_num_ores = 5, clust_size = 3, - y_min = -31000, y_max = 0, + y_min = -31000, }) minetest.register_ore({ @@ -203,8 +203,8 @@ function default.register_mgv6_ores() clust_scarcity = 24 * 24 * 24, clust_num_ores = 27, clust_size = 6, - y_min = -31000, y_max = -64, + y_min = -31000, }) -- Copper @@ -216,8 +216,8 @@ function default.register_mgv6_ores() clust_scarcity = 9 * 9 * 9, clust_num_ores = 5, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -227,8 +227,8 @@ function default.register_mgv6_ores() clust_scarcity = 12 * 12 * 12, clust_num_ores = 4, clust_size = 3, - y_min = -63, y_max = -16, + y_min = -63, }) minetest.register_ore({ @@ -238,8 +238,8 @@ function default.register_mgv6_ores() clust_scarcity = 9 * 9 * 9, clust_num_ores = 5, clust_size = 3, - y_min = -31000, y_max = -64, + y_min = -31000, }) -- Tin @@ -251,8 +251,8 @@ function default.register_mgv6_ores() clust_scarcity = 10 * 10 * 10, clust_num_ores = 5, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -262,8 +262,8 @@ function default.register_mgv6_ores() clust_scarcity = 13 * 13 * 13, clust_num_ores = 4, clust_size = 3, - y_min = -127, y_max = -32, + y_min = -127, }) minetest.register_ore({ @@ -273,8 +273,8 @@ function default.register_mgv6_ores() clust_scarcity = 10 * 10 * 10, clust_num_ores = 5, clust_size = 3, - y_min = -31000, y_max = -128, + y_min = -31000, }) -- Gold @@ -286,8 +286,8 @@ function default.register_mgv6_ores() clust_scarcity = 13 * 13 * 13, clust_num_ores = 5, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -297,8 +297,8 @@ function default.register_mgv6_ores() clust_scarcity = 15 * 15 * 15, clust_num_ores = 3, clust_size = 2, - y_min = -255, y_max = -64, + y_min = -255, }) minetest.register_ore({ @@ -308,8 +308,8 @@ function default.register_mgv6_ores() clust_scarcity = 13 * 13 * 13, clust_num_ores = 5, clust_size = 3, - y_min = -31000, y_max = -256, + y_min = -31000, }) -- Mese crystal @@ -321,8 +321,8 @@ function default.register_mgv6_ores() clust_scarcity = 14 * 14 * 14, clust_num_ores = 5, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -332,8 +332,8 @@ function default.register_mgv6_ores() clust_scarcity = 18 * 18 * 18, clust_num_ores = 3, clust_size = 2, - y_min = -255, y_max = -64, + y_min = -255, }) minetest.register_ore({ @@ -343,8 +343,8 @@ function default.register_mgv6_ores() clust_scarcity = 14 * 14 * 14, clust_num_ores = 5, clust_size = 3, - y_min = -31000, y_max = -256, + y_min = -31000, }) -- Diamond @@ -356,8 +356,8 @@ function default.register_mgv6_ores() clust_scarcity = 15 * 15 * 15, clust_num_ores = 4, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -367,8 +367,8 @@ function default.register_mgv6_ores() clust_scarcity = 17 * 17 * 17, clust_num_ores = 4, clust_size = 3, - y_min = -255, y_max = -128, + y_min = -255, }) minetest.register_ore({ @@ -378,8 +378,8 @@ function default.register_mgv6_ores() clust_scarcity = 15 * 15 * 15, clust_num_ores = 4, clust_size = 3, - y_min = -31000, y_max = -256, + y_min = -31000, }) -- Mese block @@ -391,8 +391,8 @@ function default.register_mgv6_ores() clust_scarcity = 36 * 36 * 36, clust_num_ores = 3, clust_size = 2, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -402,8 +402,8 @@ function default.register_mgv6_ores() clust_scarcity = 36 * 36 * 36, clust_num_ores = 3, clust_size = 2, - y_min = -31000, y_max = -1024, + y_min = -31000, }) end @@ -412,11 +412,109 @@ end function default.register_ores() - -- Blob ore - -- These first to avoid other ores in blobs + -- Stratum ores. + -- These obviously first. + + -- Silver sandstone + + minetest.register_ore({ + ore_type = "stratum", + ore = "default:silver_sandstone", + wherein = {"default:stone"}, + clust_scarcity = 1, + y_max = 46, + y_min = 10, + noise_params = { + offset = 28, + scale = 16, + spread = {x = 128, y = 128, z = 128}, + seed = 90122, + octaves = 1, + }, + stratum_thickness = 4, + biomes = {"cold_desert"}, + }) + + minetest.register_ore({ + ore_type = "stratum", + ore = "default:silver_sandstone", + wherein = {"default:stone"}, + clust_scarcity = 1, + y_max = 42, + y_min = 6, + noise_params = { + offset = 24, + scale = 16, + spread = {x = 128, y = 128, z = 128}, + seed = 90122, + octaves = 1, + }, + stratum_thickness = 2, + biomes = {"cold_desert"}, + }) + + -- Desert sandstone + + minetest.register_ore({ + ore_type = "stratum", + ore = "default:desert_sandstone", + wherein = {"default:desert_stone"}, + clust_scarcity = 1, + y_max = 46, + y_min = 10, + noise_params = { + offset = 28, + scale = 16, + spread = {x = 128, y = 128, z = 128}, + seed = 90122, + octaves = 1, + }, + stratum_thickness = 4, + biomes = {"desert"}, + }) + + minetest.register_ore({ + ore_type = "stratum", + ore = "default:desert_sandstone", + wherein = {"default:desert_stone"}, + clust_scarcity = 1, + y_max = 42, + y_min = 6, + noise_params = { + offset = 24, + scale = 16, + spread = {x = 128, y = 128, z = 128}, + seed = 90122, + octaves = 1, + }, + stratum_thickness = 2, + biomes = {"desert"}, + }) + + -- Sandstone + + minetest.register_ore({ + ore_type = "stratum", + ore = "default:sandstone", + wherein = {"default:desert_stone"}, + clust_scarcity = 1, + y_max = 39, + y_min = 3, + noise_params = { + offset = 21, + scale = 16, + spread = {x = 128, y = 128, z = 128}, + seed = 90122, + octaves = 1, + }, + stratum_thickness = 2, + biomes = {"desert"}, + }) + + -- Blob ore. + -- These before scatter ores to avoid other ores in blobs. -- Clay - -- This first to avoid clay in sand blobs minetest.register_ore({ ore_type = "blob", @@ -424,8 +522,8 @@ function default.register_ores() wherein = {"default:sand"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, - y_min = -15, y_max = 0, + y_min = -15, noise_threshold = 0.0, noise_params = { offset = 0.5, @@ -445,8 +543,8 @@ function default.register_ores() wherein = {"default:stone"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, - y_min = -31000, y_max = 31000, + y_min = -31000, noise_threshold = 0.0, noise_params = { offset = 0.5, @@ -474,8 +572,8 @@ function default.register_ores() wherein = {"default:stone"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, - y_min = -31, y_max = 31000, + y_min = -31, noise_threshold = 0.0, noise_params = { offset = 0.5, @@ -498,8 +596,8 @@ function default.register_ores() wherein = {"default:stone"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, - y_min = -31000, y_max = 31000, + y_min = -31000, noise_threshold = 0.0, noise_params = { offset = 0.5, @@ -530,8 +628,8 @@ function default.register_ores() clust_scarcity = 8 * 8 * 8, clust_num_ores = 9, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -541,89 +639,19 @@ function default.register_ores() clust_scarcity = 8 * 8 * 8, clust_num_ores = 8, clust_size = 3, - y_min = -31000, y_max = 64, + y_min = -127, }) minetest.register_ore({ ore_type = "scatter", ore = "default:stone_with_coal", wherein = "default:stone", - clust_scarcity = 24 * 24 * 24, - clust_num_ores = 27, - clust_size = 6, - y_min = -31000, - y_max = 0, - }) - - -- Iron - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 9 * 9 * 9, - clust_num_ores = 12, - clust_size = 3, - y_min = 1025, - y_max = 31000, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 7 * 7 * 7, - clust_num_ores = 5, - clust_size = 3, - y_min = -31000, - y_max = 0, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_iron", - wherein = "default:stone", - clust_scarcity = 24 * 24 * 24, - clust_num_ores = 27, - clust_size = 6, - y_min = -31000, - y_max = -64, - }) - - -- Copper - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_copper", - wherein = "default:stone", - clust_scarcity = 9 * 9 * 9, - clust_num_ores = 5, - clust_size = 3, - y_min = 1025, - y_max = 31000, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_copper", - wherein = "default:stone", clust_scarcity = 12 * 12 * 12, - clust_num_ores = 4, - clust_size = 3, - y_min = -63, - y_max = -16, - }) - - minetest.register_ore({ - ore_type = "scatter", - ore = "default:stone_with_copper", - wherein = "default:stone", - clust_scarcity = 9 * 9 * 9, - clust_num_ores = 5, - clust_size = 3, + clust_num_ores = 30, + clust_size = 5, + y_max = -128, y_min = -31000, - y_max = -64, }) -- Tin @@ -635,8 +663,8 @@ function default.register_ores() clust_scarcity = 10 * 10 * 10, clust_num_ores = 5, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -646,8 +674,8 @@ function default.register_ores() clust_scarcity = 13 * 13 * 13, clust_num_ores = 4, clust_size = 3, + y_max = -64, y_min = -127, - y_max = -32, }) minetest.register_ore({ @@ -657,8 +685,78 @@ function default.register_ores() clust_scarcity = 10 * 10 * 10, clust_num_ores = 5, clust_size = 3, - y_min = -31000, y_max = -128, + y_min = -31000, + }) + + -- Copper + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 5, + clust_size = 3, + y_max = 31000, + y_min = 1025, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 12 * 12 * 12, + clust_num_ores = 4, + clust_size = 3, + y_max = -64, + y_min = -127, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 5, + clust_size = 3, + y_max = -128, + y_min = -31000, + }) + + -- Iron + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 12, + clust_size = 3, + y_max = 31000, + y_min = 1025, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 7 * 7 * 7, + clust_num_ores = 5, + clust_size = 3, + y_max = -128, + y_min = -255, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 12 * 12 * 12, + clust_num_ores = 29, + clust_size = 5, + y_max = -256, + y_min = -31000, }) -- Gold @@ -670,8 +768,8 @@ function default.register_ores() clust_scarcity = 13 * 13 * 13, clust_num_ores = 5, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -681,8 +779,8 @@ function default.register_ores() clust_scarcity = 15 * 15 * 15, clust_num_ores = 3, clust_size = 2, - y_min = -255, - y_max = -64, + y_max = -256, + y_min = -511, }) minetest.register_ore({ @@ -692,8 +790,8 @@ function default.register_ores() clust_scarcity = 13 * 13 * 13, clust_num_ores = 5, clust_size = 3, + y_max = -512, y_min = -31000, - y_max = -256, }) -- Mese crystal @@ -705,8 +803,8 @@ function default.register_ores() clust_scarcity = 14 * 14 * 14, clust_num_ores = 5, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -716,8 +814,8 @@ function default.register_ores() clust_scarcity = 18 * 18 * 18, clust_num_ores = 3, clust_size = 2, - y_min = -255, - y_max = -64, + y_max = -512, + y_min = -1023, }) minetest.register_ore({ @@ -727,8 +825,8 @@ function default.register_ores() clust_scarcity = 14 * 14 * 14, clust_num_ores = 5, clust_size = 3, + y_max = -1024, y_min = -31000, - y_max = -256, }) -- Diamond @@ -740,8 +838,8 @@ function default.register_ores() clust_scarcity = 15 * 15 * 15, clust_num_ores = 4, clust_size = 3, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -751,8 +849,8 @@ function default.register_ores() clust_scarcity = 17 * 17 * 17, clust_num_ores = 4, clust_size = 3, - y_min = -255, - y_max = -128, + y_max = -1024, + y_min = -2047, }) minetest.register_ore({ @@ -762,8 +860,8 @@ function default.register_ores() clust_scarcity = 15 * 15 * 15, clust_num_ores = 4, clust_size = 3, + y_max = -2048, y_min = -31000, - y_max = -256, }) -- Mese block @@ -775,8 +873,8 @@ function default.register_ores() clust_scarcity = 36 * 36 * 36, clust_num_ores = 3, clust_size = 2, - y_min = 1025, y_max = 31000, + y_min = 1025, }) minetest.register_ore({ @@ -786,8 +884,19 @@ function default.register_ores() clust_scarcity = 36 * 36 * 36, clust_num_ores = 3, clust_size = 2, + y_max = -2048, + y_min = -4095, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:stone", + clust_scarcity = 28 * 28 * 28, + clust_num_ores = 5, + clust_size = 3, + y_max = -4096, y_min = -31000, - y_max = -1024, }) end @@ -809,15 +918,14 @@ function default.register_biomes(upper_limit) depth_top = 1, node_filler = "default:snowblock", depth_filler = 3, - node_stone = "default:ice", + node_stone = "default:cave_ice", node_water_top = "default:ice", depth_water_top = 10, - --node_water = "", node_river_water = "default:ice", node_riverbed = "default:gravel", depth_riverbed = 2, - y_min = -8, y_max = upper_limit, + y_min = -8, heat_point = 0, humidity_point = 73, }) @@ -829,13 +937,10 @@ function default.register_biomes(upper_limit) depth_top = 1, node_filler = "default:sand", depth_filler = 3, - --node_stone = "", node_water_top = "default:ice", depth_water_top = 10, - --node_water = "", - --node_river_water = "", - y_min = -112, y_max = -9, + y_min = -112, heat_point = 0, humidity_point = 73, }) @@ -843,61 +948,57 @@ function default.register_biomes(upper_limit) -- Tundra minetest.register_biome({ - name = "tundra", - node_dust = "default:snowblock", - --node_top = , - --depth_top = , - --node_filler = , - --depth_filler = , - --node_stone = "", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", + name = "tundra_highland", + node_dust = "default:snow", node_riverbed = "default:gravel", depth_riverbed = 2, - y_min = 2, y_max = upper_limit, + y_min = 47, + heat_point = 0, + humidity_point = 40, + }) + + minetest.register_biome({ + name = "tundra", + node_top = "default:permafrost_with_stones", + depth_top = 1, + node_filler = "default:permafrost", + depth_filler = 1, + node_riverbed = "default:gravel", + depth_riverbed = 2, + vertical_blend = 4, + y_max = 46, + y_min = 2, heat_point = 0, humidity_point = 40, }) minetest.register_biome({ name = "tundra_beach", - --node_dust = "", node_top = "default:gravel", depth_top = 1, node_filler = "default:gravel", depth_filler = 2, - --node_stone = "", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", node_riverbed = "default:gravel", depth_riverbed = 2, - y_min = -3, + vertical_blend = 1, y_max = 1, + y_min = -3, heat_point = 0, humidity_point = 40, }) minetest.register_biome({ name = "tundra_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:gravel", depth_riverbed = 2, - y_min = -112, + vertical_blend = 1, y_max = -4, + y_min = -112, heat_point = 0, humidity_point = 40, }) @@ -911,35 +1012,26 @@ function default.register_biomes(upper_limit) depth_top = 1, node_filler = "default:dirt", 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 = 2, y_max = upper_limit, + y_min = 4, heat_point = 25, humidity_point = 70, }) minetest.register_biome({ name = "taiga_ocean", - --node_dust = "", + node_dust = "default:snow", 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, + vertical_blend = 1, + y_max = 3, y_min = -112, - y_max = 1, heat_point = 25, humidity_point = 70, }) @@ -953,35 +1045,26 @@ function default.register_biomes(upper_limit) 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 = 5, y_max = upper_limit, + y_min = 4, heat_point = 20, humidity_point = 35, }) minetest.register_biome({ name = "snowy_grassland_ocean", - --node_dust = "", + node_dust = "default:snow", 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, + vertical_blend = 1, + y_max = 3, y_min = -112, - y_max = 4, heat_point = 20, humidity_point = 35, }) @@ -990,60 +1073,43 @@ function default.register_biomes(upper_limit) 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 = upper_limit, + y_min = 6, 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, + vertical_blend = 1, y_max = 5, + y_min = 4, 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_max = 3, y_min = -112, - y_max = 4, heat_point = 50, humidity_point = 35, }) @@ -1052,60 +1118,43 @@ function default.register_biomes(upper_limit) minetest.register_biome({ name = "coniferous_forest", - --node_dust = "", - node_top = "default:dirt_with_grass", + node_top = "default:dirt_with_coniferous_litter", depth_top = 1, node_filler = "default:dirt", 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 = 6, y_max = upper_limit, + y_min = 6, heat_point = 45, humidity_point = 70, }) minetest.register_biome({ name = "coniferous_forest_dunes", - --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 = 5, + vertical_blend = 1, y_max = 5, + y_min = 4, heat_point = 45, humidity_point = 70, }) minetest.register_biome({ name = "coniferous_forest_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_max = 3, y_min = -112, - y_max = 4, heat_point = 45, humidity_point = 70, }) @@ -1114,60 +1163,43 @@ function default.register_biomes(upper_limit) minetest.register_biome({ name = "deciduous_forest", - --node_dust = "", node_top = "default:dirt_with_grass", depth_top = 1, node_filler = "default:dirt", 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 = 1, y_max = upper_limit, + y_min = 1, heat_point = 60, humidity_point = 68, }) minetest.register_biome({ name = "deciduous_forest_shore", - --node_dust = "", node_top = "default:dirt", depth_top = 1, node_filler = "default:dirt", 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 = -1, y_max = 0, + y_min = -1, heat_point = 60, humidity_point = 68, }) minetest.register_biome({ name = "deciduous_forest_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, + vertical_blend = 1, y_max = -2, + y_min = -112, heat_point = 60, humidity_point = 68, }) @@ -1176,40 +1208,31 @@ function default.register_biomes(upper_limit) minetest.register_biome({ name = "desert", - --node_dust = "", node_top = "default:desert_sand", depth_top = 1, node_filler = "default:desert_sand", depth_filler = 1, node_stone = "default:desert_stone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = 5, y_max = upper_limit, + y_min = 4, heat_point = 92, humidity_point = 16, }) minetest.register_biome({ name = "desert_ocean", - --node_dust = "", node_top = "default:sand", depth_top = 1, node_filler = "default:sand", depth_filler = 3, node_stone = "default:desert_stone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, + vertical_blend = 1, + y_max = 3, y_min = -112, - y_max = 4, heat_point = 92, humidity_point = 16, }) @@ -1218,40 +1241,30 @@ function default.register_biomes(upper_limit) minetest.register_biome({ name = "sandstone_desert", - --node_dust = "", node_top = "default:sand", depth_top = 1, node_filler = "default:sand", 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 = 5, y_max = upper_limit, + y_min = 4, 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_max = 3, y_min = -112, - y_max = 4, heat_point = 60, humidity_point = 0, }) @@ -1260,40 +1273,29 @@ function default.register_biomes(upper_limit) 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 = upper_limit, + y_min = 4, 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, + vertical_blend = 1, + y_max = 3, y_min = -112, - y_max = 4, heat_point = 40, humidity_point = 0, }) @@ -1302,60 +1304,43 @@ function default.register_biomes(upper_limit) minetest.register_biome({ name = "savanna", - --node_dust = "", node_top = "default:dirt_with_dry_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 = 1, y_max = upper_limit, + y_min = 1, heat_point = 89, humidity_point = 42, }) minetest.register_biome({ name = "savanna_shore", - --node_dust = "", node_top = "default:dirt", depth_top = 1, node_filler = "default:dirt", 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 = -1, y_max = 0, + y_min = -1, heat_point = 89, humidity_point = 42, }) minetest.register_biome({ name = "savanna_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, + vertical_blend = 1, y_max = -2, + y_min = -112, heat_point = 89, humidity_point = 42, }) @@ -1364,60 +1349,43 @@ function default.register_biomes(upper_limit) minetest.register_biome({ name = "rainforest", - --node_dust = "", node_top = "default:dirt_with_rainforest_litter", depth_top = 1, node_filler = "default:dirt", 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 = 1, y_max = upper_limit, + y_min = 1, heat_point = 86, humidity_point = 65, }) minetest.register_biome({ name = "rainforest_swamp", - --node_dust = "", node_top = "default:dirt", depth_top = 1, node_filler = "default:dirt", 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 = -1, y_max = 0, + y_min = -1, heat_point = 86, humidity_point = 65, }) minetest.register_biome({ name = "rainforest_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, + vertical_blend = 1, y_max = -2, + y_min = -112, heat_point = 86, humidity_point = 65, }) @@ -1426,18 +1394,8 @@ function default.register_biomes(upper_limit) minetest.register_biome({ name = "underground", - --node_dust = "", - --node_top = "", - --depth_top = , - --node_filler = "", - --depth_filler = , - --node_stone = "", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - y_min = -31000, y_max = -113, + y_min = -31000, heat_point = 50, humidity_point = 50, }) @@ -1445,51 +1403,43 @@ end -- Biomes for floatlands --- Used when mgv7 'biomerepeat' flag is false --- TODO Temporary simple biomes to be developed later + +-- TODO Temporary simple biomes to be replaced by special floatland biomes later. function default.register_floatland_biomes(floatland_level, shadow_limit) - -- Coniferous forest - minetest.register_biome({ - name = "floatland_coniferous_forest", - --node_dust = "", + name = "floatland_grassland", node_top = "default:dirt_with_grass", depth_top = 1, node_filler = "default:dirt", - depth_filler = 3, - --node_stone = "", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - --node_riverbed = "", - --depth_riverbed = , - y_min = floatland_level + 4, + depth_filler = 1, y_max = 31000, + y_min = floatland_level + 2, heat_point = 50, - humidity_point = 50, + humidity_point = 25, }) - -- Coniferous forest ocean + minetest.register_biome({ + name = "floatland_coniferous_forest", + node_top = "default:dirt_with_coniferous_litter", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + y_max = 31000, + y_min = floatland_level + 2, + heat_point = 50, + humidity_point = 75, + }) minetest.register_biome({ - name = "floatland_coniferous_forest_ocean", - --node_dust = "", + name = "floatland_ocean", 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 = "", - --depth_riverbed = , + y_max = floatland_level + 1, y_min = shadow_limit, - y_max = floatland_level + 3, heat_point = 50, humidity_point = 50, }) @@ -1507,6 +1457,7 @@ function default.register_mgv6_decorations() -- Papyrus minetest.register_decoration({ + name = "default:papyrus", deco_type = "simple", place_on = {"default:dirt_with_grass"}, sidelen = 16, @@ -1518,8 +1469,8 @@ function default.register_mgv6_decorations() octaves = 3, persist = 0.7 }, - y_min = 1, y_max = 1, + y_min = 1, decoration = "default:papyrus", height = 2, height_max = 4, @@ -1530,6 +1481,7 @@ function default.register_mgv6_decorations() -- Cacti minetest.register_decoration({ + name = "default:cactus", deco_type = "simple", place_on = {"default:desert_sand"}, sidelen = 16, @@ -1541,8 +1493,8 @@ function default.register_mgv6_decorations() octaves = 3, persist = 0.6 }, - y_min = 1, y_max = 30, + y_min = 1, decoration = "default:cactus", height = 3, height_max = 4, @@ -1552,6 +1504,7 @@ function default.register_mgv6_decorations() for length = 1, 5 do minetest.register_decoration({ + name = "default:grass_"..length, deco_type = "simple", place_on = {"default:dirt_with_grass"}, sidelen = 16, @@ -1563,8 +1516,8 @@ function default.register_mgv6_decorations() octaves = 3, persist = 0.6 }, - y_min = 1, y_max = 30, + y_min = 1, decoration = "default:grass_"..length, }) end @@ -1572,6 +1525,7 @@ function default.register_mgv6_decorations() -- Dry shrubs minetest.register_decoration({ + name = "default:dry_shrub", deco_type = "simple", place_on = {"default:desert_sand", "default:dirt_with_snow"}, sidelen = 16, @@ -1583,9 +1537,10 @@ function default.register_mgv6_decorations() octaves = 3, persist = 0.6 }, - y_min = 1, y_max = 30, + y_min = 1, decoration = "default:dry_shrub", + param2 = 4, }) end @@ -1594,8 +1549,9 @@ end local function register_grass_decoration(offset, scale, length) minetest.register_decoration({ + name = "default:grass_" .. length, deco_type = "simple", - place_on = {"default:dirt_with_grass", "default:sand"}, + place_on = {"default:dirt_with_grass"}, sidelen = 16, noise_params = { offset = offset, @@ -1605,17 +1561,16 @@ local function register_grass_decoration(offset, scale, length) octaves = 3, persist = 0.6 }, - biomes = {"grassland", "grassland_dunes", "deciduous_forest", - "coniferous_forest", "coniferous_forest_dunes", - "floatland_grassland", "floatland_coniferous_forest"}, - y_min = 1, + biomes = {"grassland", "deciduous_forest", "floatland_grassland"}, y_max = 31000, + y_min = 1, decoration = "default:grass_" .. length, }) end local function register_dry_grass_decoration(offset, scale, length) minetest.register_decoration({ + name = "default:dry_grass_" .. length, deco_type = "simple", place_on = {"default:dirt_with_dry_grass"}, sidelen = 16, @@ -1628,129 +1583,208 @@ local function register_dry_grass_decoration(offset, scale, length) persist = 0.6 }, biomes = {"savanna"}, - y_min = 1, y_max = 31000, + y_min = 1, decoration = "default:dry_grass_" .. length, }) end +local function register_fern_decoration(seed, length) + minetest.register_decoration({ + name = "default:fern_" .. length, + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.2, + spread = {x = 100, y = 100, z = 100}, + seed = seed, + octaves = 3, + persist = 0.7 + }, + biomes = {"coniferous_forest", "floatland_coniferous_forest"}, + y_max = 31000, + y_min = 6, + decoration = "default:fern_" .. length, + }) +end + function default.register_decorations() -- Apple tree and log minetest.register_decoration({ + name = "default:apple_tree", deco_type = "schematic", place_on = {"default:dirt_with_grass"}, sidelen = 16, noise_params = { - offset = 0.036, - scale = 0.022, + offset = 0.024, + scale = 0.015, spread = {x = 250, y = 250, z = 250}, seed = 2, octaves = 3, persist = 0.66 }, biomes = {"deciduous_forest"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) minetest.register_decoration({ + name = "default:apple_log", deco_type = "schematic", place_on = {"default:dirt_with_grass"}, + place_offset_y = 1, sidelen = 16, noise_params = { - offset = 0.0018, - scale = 0.0011, + offset = 0.0012, + scale = 0.0007, spread = {x = 250, y = 250, z = 250}, seed = 2, octaves = 3, persist = 0.66 }, biomes = {"deciduous_forest"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/apple_log.mts", flags = "place_center_x", rotation = "random", + spawn_by = "default:dirt_with_grass", + num_spawn_by = 8, }) + -- Emergent jungle tree + -- Due to 32 node height, altitude is limited and prescence depends on chunksize + + local chunksize = tonumber(minetest.get_mapgen_setting("chunksize")) + if chunksize >= 5 then + minetest.register_decoration({ + name = "default:emergent_jungle_tree", + deco_type = "schematic", + place_on = {"default:dirt_with_rainforest_litter"}, + sidelen = 80, + noise_params = { + offset = 0.0, + scale = 0.0025, + spread = {x = 250, y = 250, z = 250}, + seed = 2685, + octaves = 3, + persist = 0.7 + }, + biomes = {"rainforest"}, + y_max = 32, + y_min = 1, + schematic = minetest.get_modpath("default") .. + "/schematics/emergent_jungle_tree.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + place_offset_y = -4, + }) + end + -- Jungle tree and log minetest.register_decoration({ + name = "default:jungle_tree", deco_type = "schematic", place_on = {"default:dirt_with_rainforest_litter", "default:dirt"}, - sidelen = 16, + sidelen = 80, fill_ratio = 0.1, biomes = {"rainforest", "rainforest_swamp"}, - y_min = -1, y_max = 31000, + y_min = -1, schematic = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) minetest.register_decoration({ + name = "default:jungle_log", deco_type = "schematic", - place_on = {"default:dirt_with_rainforest_litter", "default:dirt"}, - sidelen = 16, + place_on = {"default:dirt_with_rainforest_litter"}, + place_offset_y = 1, + sidelen = 80, fill_ratio = 0.005, biomes = {"rainforest", "rainforest_swamp"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/jungle_log.mts", flags = "place_center_x", rotation = "random", + spawn_by = "default:dirt_with_rainforest_litter", + num_spawn_by = 8, }) - -- Taiga and temperate coniferous forest pine tree and log + -- Taiga and temperate coniferous forest pine tree, small pine tree and log minetest.register_decoration({ + name = "default:pine_tree", deco_type = "schematic", - place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, + place_on = {"default:dirt_with_snow", "default:dirt_with_coniferous_litter"}, sidelen = 16, noise_params = { - offset = 0.036, - scale = 0.022, + offset = 0.010, + scale = 0.048, spread = {x = 250, y = 250, z = 250}, seed = 2, octaves = 3, persist = 0.66 }, biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"}, - y_min = 2, y_max = 31000, + y_min = 4, schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts", flags = "place_center_x, place_center_z", }) minetest.register_decoration({ + name = "default:small_pine_tree", deco_type = "schematic", - place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, - sidelen = 80, + place_on = {"default:dirt_with_snow", "default:dirt_with_coniferous_litter"}, + sidelen = 16, noise_params = { - offset = 0.0018, - scale = 0.0011, + offset = 0.010, + scale = -0.048, spread = {x = 250, y = 250, z = 250}, seed = 2, octaves = 3, persist = 0.66 }, - biomes = {"taiga", "coniferous_forest"}, - y_min = 1, + biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"}, y_max = 31000, + y_min = 4, + schematic = minetest.get_modpath("default") .. "/schematics/small_pine_tree.mts", + flags = "place_center_x, place_center_z", + }) + + minetest.register_decoration({ + name = "default:pine_log", + deco_type = "schematic", + place_on = {"default:dirt_with_snow", "default:dirt_with_coniferous_litter"}, + place_offset_y = 1, + sidelen = 80, + fill_ratio = 0.0018, + biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"}, + y_max = 31000, + y_min = 4, schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts", flags = "place_center_x", rotation = "random", + spawn_by = {"default:dirt_with_snow", "default:dirt_with_coniferous_litter"}, + num_spawn_by = 8, }) -- Acacia tree and log minetest.register_decoration({ + name = "default:acacia_tree", deco_type = "schematic", place_on = {"default:dirt_with_dry_grass"}, sidelen = 16, @@ -1763,16 +1797,18 @@ function default.register_decorations() persist = 0.66 }, biomes = {"savanna"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) minetest.register_decoration({ + name = "default:acacia_log", deco_type = "schematic", place_on = {"default:dirt_with_dry_grass"}, + place_offset_y = 1, sidelen = 16, noise_params = { offset = 0, @@ -1783,16 +1819,19 @@ function default.register_decorations() persist = 0.66 }, biomes = {"savanna"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/acacia_log.mts", flags = "place_center_x", rotation = "random", + spawn_by = "default:dirt_with_dry_grass", + num_spawn_by = 8, }) -- Aspen tree and log minetest.register_decoration({ + name = "default:aspen_tree", deco_type = "schematic", place_on = {"default:dirt_with_grass"}, sidelen = 16, @@ -1805,15 +1844,17 @@ function default.register_decorations() persist = 0.66 }, biomes = {"deciduous_forest"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/aspen_tree.mts", flags = "place_center_x, place_center_z", }) minetest.register_decoration({ + name = "default:aspen_log", deco_type = "schematic", place_on = {"default:dirt_with_grass"}, + place_offset_y = 1, sidelen = 16, noise_params = { offset = 0.0, @@ -1824,16 +1865,19 @@ function default.register_decorations() persist = 0.66 }, biomes = {"deciduous_forest"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/aspen_log.mts", flags = "place_center_x", rotation = "random", + spawn_by = "default:dirt_with_grass", + num_spawn_by = 8, }) -- Large cactus minetest.register_decoration({ + name = "default:large_cactus", deco_type = "schematic", place_on = {"default:desert_sand"}, sidelen = 16, @@ -1846,16 +1890,17 @@ function default.register_decorations() persist = 0.6 }, biomes = {"desert"}, - y_min = 5, y_max = 31000, + y_min = 4, schematic = minetest.get_modpath("default") .. "/schematics/large_cactus.mts", - flags = "place_center_x", + flags = "place_center_x, place_center_z", rotation = "random", }) -- Cactus minetest.register_decoration({ + name = "default:cactus", deco_type = "simple", place_on = {"default:desert_sand"}, sidelen = 16, @@ -1868,8 +1913,8 @@ function default.register_decorations() persist = 0.6 }, biomes = {"desert"}, - y_min = 5, y_max = 31000, + y_min = 4, decoration = "default:cactus", height = 2, height_max = 5, @@ -1878,6 +1923,7 @@ function default.register_decorations() -- Papyrus minetest.register_decoration({ + name = "default:papyrus", deco_type = "schematic", place_on = {"default:dirt"}, sidelen = 16, @@ -1890,16 +1936,17 @@ function default.register_decorations() persist = 0.7 }, biomes = {"savanna_shore"}, - y_min = 0, y_max = 0, + y_min = 0, schematic = minetest.get_modpath("default") .. "/schematics/papyrus.mts", }) -- Bush minetest.register_decoration({ + name = "default:bush", deco_type = "schematic", - place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, + place_on = {"default:dirt_with_grass"}, sidelen = 16, noise_params = { offset = -0.004, @@ -1909,17 +1956,41 @@ function default.register_decorations() octaves = 3, persist = 0.7, }, - biomes = {"snowy_grassland", "grassland", "deciduous_forest", + biomes = {"grassland", "deciduous_forest", "floatland_grassland"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/bush.mts", flags = "place_center_x, place_center_z", }) + -- Blueberry bush + + minetest.register_decoration({ + name = "default:blueberry_bush", + 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 = 697, + octaves = 3, + persist = 0.7, + }, + biomes = {"grassland", "snowy_grassland"}, + y_max = 31000, + y_min = 1, + place_offset_y = 1, + schematic = minetest.get_modpath("default") .. "/schematics/blueberry_bush.mts", + flags = "place_center_x, place_center_z", + }) + -- Acacia bush minetest.register_decoration({ + name = "default:acacia_bush", deco_type = "schematic", place_on = {"default:dirt_with_dry_grass"}, sidelen = 16, @@ -1932,12 +2003,34 @@ function default.register_decorations() persist = 0.7, }, biomes = {"savanna"}, - y_min = 1, y_max = 31000, + y_min = 1, schematic = minetest.get_modpath("default") .. "/schematics/acacia_bush.mts", flags = "place_center_x, place_center_z", }) + -- Pine bush + + minetest.register_decoration({ + name = "default:pine_bush", + deco_type = "schematic", + place_on = {"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 = {"taiga", "snowy_grassland"}, + y_max = 31000, + y_min = 4, + schematic = minetest.get_modpath("default") .. "/schematics/pine_bush.mts", + flags = "place_center_x, place_center_z", + }) + -- Grasses register_grass_decoration(-0.03, 0.09, 5) @@ -1954,22 +2047,30 @@ function default.register_decorations() register_dry_grass_decoration(0.07, -0.01, 2) register_dry_grass_decoration(0.09, -0.03, 1) + -- Ferns + + register_fern_decoration(14936, 3) + register_fern_decoration(801, 2) + register_fern_decoration(5, 1) + -- Junglegrass minetest.register_decoration({ + name = "default:junglegrass", deco_type = "simple", place_on = {"default:dirt_with_rainforest_litter"}, - sidelen = 16, + sidelen = 80, fill_ratio = 0.1, biomes = {"rainforest"}, - y_min = 1, y_max = 31000, + y_min = 1, decoration = "default:junglegrass", }) -- Dry shrub minetest.register_decoration({ + name = "default:dry_shrub", deco_type = "simple", place_on = {"default:desert_sand", "default:sand", "default:silver_sand"}, @@ -1983,34 +2084,146 @@ function default.register_decorations() persist = 0.6 }, biomes = {"desert", "sandstone_desert", "cold_desert"}, - y_min = 2, y_max = 31000, + y_min = 2, decoration = "default:dry_shrub", + param2 = 4, + }) + + -- Marram grass + + minetest.register_decoration({ + name = "default:marram_grass", + deco_type = "simple", + place_on = {"default:sand"}, + sidelen = 4, + noise_params = { + offset = -0.4, + scale = 3.0, + spread = {x = 16, y = 16, z = 16}, + seed = 513337, + octaves = 1, + persist = 0.5, + flags = "absvalue" + }, + biomes = {"coniferous_forest_dunes", "grassland_dunes"}, + y_max = 6, + y_min = 4, + decoration = { + "default:marram_grass_1", + "default:marram_grass_2", + "default:marram_grass_3", + }, + }) + + -- Tundra moss + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:permafrost_with_stones"}, + sidelen = 4, + noise_params = { + offset = -0.8, + scale = 2.0, + spread = {x = 100, y = 100, z = 100}, + seed = 53995, + octaves = 3, + persist = 1.0 + }, + biomes = {"tundra"}, + y_max = 50, + y_min = 2, + decoration = "default:permafrost_with_moss", + place_offset_y = -1, + flags = "force_placement", + }) + + -- Tundra patchy snow + + minetest.register_decoration({ + deco_type = "simple", + place_on = { + "default:permafrost_with_moss", + "default:permafrost_with_stones", + "default:stone", + "default:gravel" + }, + sidelen = 4, + noise_params = { + offset = 0, + scale = 1.0, + spread = {x = 100, y = 100, z = 100}, + seed = 172555, + octaves = 3, + persist = 1.0 + }, + biomes = {"tundra", "tundra_beach"}, + y_max = 50, + y_min = 1, + decoration = "default:snow", }) -- Coral reef minetest.register_decoration({ - deco_type = "schematic", + name = "default:corals", + deco_type = "simple", place_on = {"default:sand"}, + place_offset_y = -1, + sidelen = 4, noise_params = { - offset = -0.15, - scale = 0.1, - spread = {x = 100, y = 100, z = 100}, + offset = -4, + scale = 4, + spread = {x = 50, y = 50, z = 50}, seed = 7013, octaves = 3, - persist = 1, + persist = 0.7, }, 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", + y_min = -8, + flags = "force_placement", + decoration = { + "default:coral_green", "default:coral_pink", + "default:coral_cyan", "default:coral_brown", + "default:coral_orange", "default:coral_skeleton", + }, + }) + + -- Kelp + + minetest.register_decoration({ + name = "default:kelp", + deco_type = "simple", + place_on = {"default:sand"}, + place_offset_y = -1, + sidelen = 16, + noise_params = { + offset = -0.04, + scale = 0.1, + spread = {x = 200, y = 200, z = 200}, + seed = 87112, + octaves = 3, + persist = 0.7 + }, + biomes = { + "taiga_ocean", + "snowy_grassland_ocean", + "grassland_ocean", + "coniferous_forest_ocean", + "deciduous_forest_ocean", + "sandstone_desert_ocean", + "cold_desert_ocean"}, + y_max = -5, + y_min = -10, + flags = "force_placement", + decoration = "default:sand_with_kelp", + param2 = 48, + param2_max = 96, }) end @@ -2021,10 +2234,9 @@ end -- Get setting or default local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or - "mountains, ridges, nofloatlands, caverns, biomerepeat" + "mountains, ridges, nofloatlands, caverns" local captures_float = string.match(mgv7_spflags, "floatlands") local captures_nofloat = string.match(mgv7_spflags, "nofloatlands") -local captures_nobiorep = string.match(mgv7_spflags, "nobiomerepeat") -- Get setting or default -- Make global for mods to use to register floatland biomes @@ -2042,12 +2254,11 @@ local mg_name = minetest.get_mapgen_setting("mg_name") if mg_name == "v6" then default.register_mgv6_ores() default.register_mgv6_decorations() +-- Need to check for 'nofloatlands' because that contains +-- 'floatlands' which makes the second condition true. elseif mg_name == "v7" and captures_float == "floatlands" and - -- Need to check for 'nofloatlands' because that contains - -- 'floatlands' which makes the second condition true. - captures_nofloat ~= "nofloatlands" and - captures_nobiorep == "nobiomerepeat" then + captures_nofloat ~= "nofloatlands" then -- Mgv7 with floatlands and floatland biomes default.register_biomes(default.mgv7_shadow_limit - 1) default.register_floatland_biomes( diff --git a/mods/default/models/character.b3d b/mods/default/models/character.b3d deleted file mode 100644 index 9ab45436..00000000 Binary files a/mods/default/models/character.b3d and /dev/null differ diff --git a/mods/default/models/character.blend b/mods/default/models/character.blend deleted file mode 100644 index fca9f659..00000000 Binary files a/mods/default/models/character.blend and /dev/null differ diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index d0a2d18c..b59791a5 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -51,6 +51,11 @@ default:dirt_with_grass_footsteps default:dirt_with_dry_grass default:dirt_with_snow default:dirt_with_rainforest_litter +default:dirt_with_coniferous_litter + +default:permafrost +default:permafrost_with_stones +default:permafrost_with_moss default:sand default:desert_sand @@ -62,8 +67,8 @@ default:clay default:snow default:snowblock - default:ice +default:cave_ice Trees ----- @@ -79,6 +84,7 @@ default:jungletree default:junglewood default:jungleleaves default:junglesapling +default:emergent_jungle_sapling default:pine_tree default:pine_wood @@ -126,6 +132,8 @@ Plantlife --------- default:cactus +default:large_cactus_seedling + default:papyrus default:dry_shrub default:junglegrass @@ -142,12 +150,28 @@ default:dry_grass_3 default:dry_grass_4 default:dry_grass_5 +default:fern_1 +default:fern_2 +default:fern_3 + +default:marram_grass_1 +default:marram_grass_2 +default:marram_grass_3 + default:bush_stem default:bush_leaves default:bush_sapling default:acacia_bush_stem default:acacia_bush_leaves default:acacia_bush_sapling +default:pine_bush_stem +default:pine_bush_needles +default:pine_bush_sapling +default:blueberry_bush_leaves_with_berries +default:blueberry_bush_leaves +default:blueberry_bush_sapling + +default:sand_with_kelp Corals ------ @@ -172,9 +196,6 @@ default:lava_flowing Tools / "Advanced" crafting / Non-"natural" ------------------------------------------- -default:chest -default:chest_locked - default:bookshelf default:sign_wall_wood @@ -463,10 +484,10 @@ 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, spreading_dirt_type = 1, snowy = 1}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1, snowy = 1}, drop = 'default:dirt', sounds = default.node_sound_dirt_defaults({ - footstep = {name = "default_snow_footstep", gain = 0.15}, + footstep = {name = "default_snow_footstep", gain = 0.2}, }), }) @@ -485,6 +506,48 @@ minetest.register_node("default:dirt_with_rainforest_litter", { }), }) +minetest.register_node("default:dirt_with_coniferous_litter", { + description = "Dirt with Coniferous Litter", + tiles = { + "default_coniferous_litter.png", + "default_dirt.png", + {name = "default_dirt.png^default_coniferous_litter_side.png", + tileable_vertical = false} + }, + 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}, + }), +}) + +minetest.register_node("default:permafrost", { + description = "Permafrost", + tiles = {"default_permafrost.png"}, + groups = {cracky = 3}, + sounds = default.node_sound_dirt_defaults(), +}) + +minetest.register_node("default:permafrost_with_stones", { + description = "Permafrost with Stones", + tiles = {"default_permafrost.png^default_stones.png", + "default_permafrost.png", + "default_permafrost.png^default_stones_side.png"}, + groups = {cracky = 3}, + sounds = default.node_sound_gravel_defaults(), +}) + +minetest.register_node("default:permafrost_with_moss", { + description = "Permafrost with Moss", + tiles = {"default_moss.png", "default_permafrost.png", + {name = "default_permafrost.png^default_moss_side.png", + tileable_vertical = false}}, + groups = {cracky = 3}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.25}, + }), +}) + minetest.register_node("default:sand", { description = "Sand", tiles = {"default_sand.png"}, @@ -545,12 +608,14 @@ minetest.register_node("default:snow", { {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, }, }, - groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1, snowy = 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} - }), + collision_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -7 / 16, 0.5}, + }, + }, + groups = {crumbly = 3, falling_node = 1, snowy = 1}, + sounds = default.node_sound_snow_defaults(), on_construct = function(pos) pos.y = pos.y - 1 @@ -563,12 +628,8 @@ minetest.register_node("default:snow", { minetest.register_node("default:snowblock", { description = "Snow Block", tiles = {"default_snow.png"}, - groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 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} - }), + groups = {crumbly = 3, cools_lava = 1, snowy = 1}, + sounds = default.node_sound_snow_defaults(), on_construct = function(pos) pos.y = pos.y - 1 @@ -578,12 +639,24 @@ minetest.register_node("default:snowblock", { end, }) +-- 'is ground content = false' to avoid tunnels in sea ice or ice rivers minetest.register_node("default:ice", { description = "Ice", tiles = {"default_ice.png"}, is_ground_content = false, paramtype = "light", - groups = {cracky = 3, puts_out_fire = 1, cools_lava = 1}, + groups = {cracky = 3, cools_lava = 1, slippery = 3}, + sounds = default.node_sound_glass_defaults(), +}) + +-- Mapgen-placed ice with 'is ground content = true' to contain tunnels +minetest.register_node("default:cave_ice", { + description = "Cave Ice", + tiles = {"default_ice.png"}, + paramtype = "light", + groups = {cracky = 3, cools_lava = 1, slippery = 3, + not_in_creative_inventory = 1}, + drop = "default:ice", sounds = default.node_sound_glass_defaults(), }) @@ -639,8 +712,8 @@ minetest.register_node("default:sapling", { "default:sapling", -- minp, maxp to be checked, relative to sapling pos -- minp_relative.y = 1 because sapling pos has been checked - {x = -2, y = 1, z = -2}, - {x = 2, y = 6, z = 2}, + {x = -3, y = 1, z = -3}, + {x = 3, y = 6, z = 3}, -- maximum interval of interior volume check 4) @@ -691,17 +764,44 @@ minetest.register_node("default:apple", { 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}, + leafdecay = 3, leafdecay_drop = 1, food_apple = 1}, on_use = minetest.item_eat(2), sounds = default.node_sound_leaves_defaults(), after_place_node = function(pos, placer, itemstack) - if placer:is_player() then - minetest.set_node(pos, {name = "default:apple", param2 = 1}) + minetest.set_node(pos, {name = "default:apple", param2 = 1}) + end, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + if oldnode.param2 == 0 then + minetest.set_node(pos, {name = "default:apple_mark"}) + minetest.get_node_timer(pos):start(math.random(300, 1500)) end end, }) +minetest.register_node("default:apple_mark", { + description = "Apple Marker", + drawtype = "airlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + drop = "", + groups = {not_in_creative_inventory = 1}, + on_timer = function(pos, elapsed) + if not minetest.find_node_near(pos, 1, "default:leaves") then + minetest.remove_node(pos) + elseif minetest.get_node_light(pos) < 11 then + minetest.get_node_timer(pos):start(200) + else + minetest.set_node(pos, {name = "default:apple"}) + end + end +}) + minetest.register_node("default:jungletree", { description = "Jungle Tree", @@ -782,6 +882,41 @@ minetest.register_node("default:junglesapling", { end, }) +minetest.register_node("default:emergent_jungle_sapling", { + description = "Emergent Jungle Tree Sapling", + drawtype = "plantlike", + tiles = {"default_emergent_jungle_sapling.png"}, + inventory_image = "default_emergent_jungle_sapling.png", + wield_image = "default_emergent_jungle_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + 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}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(300, 1500)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:emergent_jungle_sapling", + -- minp, maxp to be checked, relative to sapling pos + {x = -3, y = -5, z = -3}, + {x = 3, y = 31, z = 3}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + minetest.register_node("default:pine_tree", { description = "Pine Tree", @@ -853,7 +988,7 @@ minetest.register_node("default:pine_sapling", { -- minp, maxp to be checked, relative to sapling pos -- minp_relative.y = 1 because sapling pos has been checked {x = -2, y = 1, z = -2}, - {x = 2, y = 12, z = 2}, + {x = 2, y = 14, z = 2}, -- maximum interval of interior volume check 4) @@ -933,7 +1068,7 @@ minetest.register_node("default:acacia_sapling", { -- minp, maxp to be checked, relative to sapling pos -- minp_relative.y = 1 because sapling pos has been checked {x = -4, y = 1, z = -4}, - {x = 4, y = 6, z = 4}, + {x = 4, y = 7, z = 4}, -- maximum interval of interior volume check 4) @@ -1174,6 +1309,77 @@ minetest.register_node("default:cactus", { on_place = minetest.rotate_node, }) +minetest.register_node("default:large_cactus_seedling", { + description = "Large Cactus Seedling", + drawtype = "plantlike", + tiles = {"default_large_cactus_seedling.png"}, + inventory_image = "default_large_cactus_seedling.png", + wield_image = "default_large_cactus_seedling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { + -5 / 16, -0.5, -5 / 16, + 5 / 16, 0.5, 5 / 16 + } + }, + groups = {choppy = 3, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_wood_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:large_cactus_seedling", + {x = -2, y = -1, z = -2}, + {x = 2, y = 5, z = 2}, + 4) + + return itemstack + end, + + on_construct = function(pos) + -- Normal cactus farming adds 1 cactus node by ABM, + -- interval 12s, chance 83. + -- Consider starting with 5 cactus nodes. We make sure that growing a + -- large cactus is not a faster way to produce new cactus nodes. + -- Confirmed by experiment, when farming 5 cacti, on average 1 new + -- cactus node is added on average every + -- 83 / 5 = 16.6 intervals = 16.6 * 12 = 199.2s. + -- Large cactus contains on average 14 cactus nodes. + -- 14 * 199.2 = 2788.8s. + -- Set random range to average to 2789s. + minetest.get_node_timer(pos):start(math.random(1859, 3719)) + end, + + on_timer = function(pos) + local node_under = minetest.get_node_or_nil( + {x = pos.x, y = pos.y - 1, z = pos.z}) + if not node_under then + -- Node under not yet loaded, try later + minetest.get_node_timer(pos):start(300) + return + end + + if minetest.get_item_group(node_under.name, "sand") == 0 then + -- Seedling dies + minetest.remove_node(pos) + return + end + + local light_level = minetest.get_node_light(pos) + if not light_level or light_level < 13 then + -- Too dark for growth, try later in case it's night + minetest.get_node_timer(pos):start(300) + return + end + + minetest.log("action", "A large cactus seedling grows into a large" .. + "cactus at ".. minetest.pos_to_string(pos)) + default.grow_large_cactus(pos) + end, +}) + minetest.register_node("default:papyrus", { description = "Papyrus", drawtype = "plantlike", @@ -1203,6 +1409,8 @@ minetest.register_node("default:dry_shrub", { inventory_image = "default_dry_shrub.png", wield_image = "default_dry_shrub.png", paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 4, sunlight_propagates = true, walkable = false, buildable_to = true, @@ -1210,7 +1418,7 @@ minetest.register_node("default:dry_shrub", { sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 4 / 16, 6 / 16}, }, }) @@ -1230,7 +1438,7 @@ minetest.register_node("default:junglegrass", { sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, }, }) @@ -1339,6 +1547,109 @@ for i = 2, 5 do end +minetest.register_node("default:fern_1", { + description = "Fern", + drawtype = "plantlike", + waving = 1, + tiles = {"default_fern_1.png"}, + inventory_image = "default_fern_1.png", + wield_image = "default_fern_1.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -0.25, 6 / 16}, + }, + + on_place = function(itemstack, placer, pointed_thing) + -- place a random fern node + local stack = ItemStack("default:fern_" .. math.random(1, 3)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:fern_1 " .. + itemstack:get_count() - (1 - ret:get_count())) + end, +}) + +for i = 2, 3 do + minetest.register_node("default:fern_" .. i, { + description = "Fern", + drawtype = "plantlike", + waving = 1, + visual_scale = 2, + tiles = {"default_fern_" .. i .. ".png"}, + inventory_image = "default_fern_" .. i .. ".png", + wield_image = "default_fern_" .. i .. ".png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1, + not_in_creative_inventory=1}, + drop = "default:fern_1", + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -0.25, 6 / 16}, + }, + }) +end + + +minetest.register_node("default:marram_grass_1", { + description = "Marram Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_marram_grass_1.png"}, + inventory_image = "default_marram_grass_1.png", + wield_image = "default_marram_grass_1.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, attached_node = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -0.25, 6 / 16}, + }, + + on_place = function(itemstack, placer, pointed_thing) + -- place a random marram grass node + local stack = ItemStack("default:marram_grass_" .. math.random(1, 3)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:marram_grass_1 " .. + itemstack:get_count() - (1 - ret:get_count())) + end, +}) + +for i = 2, 3 do + minetest.register_node("default:marram_grass_" .. i, { + description = "Marram Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_marram_grass_" .. i .. ".png"}, + inventory_image = "default_marram_grass_" .. i .. ".png", + wield_image = "default_marram_grass_" .. i .. ".png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, attached_node = 1, + not_in_creative_inventory=1}, + drop = "default:marram_grass_1", + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -0.25, 6 / 16}, + }, + }) +end + + minetest.register_node("default:bush_stem", { description = "Bush Stem", drawtype = "plantlike", @@ -1410,6 +1721,85 @@ minetest.register_node("default:bush_sapling", { end, }) +minetest.register_node("default:blueberry_bush_leaves_with_berries", { + description = "Blueberry Bush Leaves with Berries", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_blueberry_bush_leaves.png^default_blueberry_overlay.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1, dig_immediate = 3}, + drop = "default:blueberries", + sounds = default.node_sound_leaves_defaults(), + node_dig_prediction = "default:blueberry_bush_leaves", + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + minetest.set_node(pos, {name = "default:blueberry_bush_leaves"}) + minetest.get_node_timer(pos):start(math.random(300, 1500)) + end, +}) + +minetest.register_node("default:blueberry_bush_leaves", { + description = "Blueberry Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_blueberry_bush_leaves.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:blueberry_bush_sapling"}, rarity = 5}, + {items = {"default:blueberry_bush_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + on_timer = function(pos, elapsed) + if minetest.get_node_light(pos) < 11 then + minetest.get_node_timer(pos):start(200) + else + minetest.set_node(pos, {name = "default:blueberry_bush_leaves_with_berries"}) + end + end, + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:blueberry_bush_sapling", { + description = "Blueberry Bush Sapling", + drawtype = "plantlike", + tiles = {"default_blueberry_bush_sapling.png"}, + inventory_image = "default_blueberry_bush_sapling.png", + wield_image = "default_blueberry_bush_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(300, 1500)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:blueberry_bush_sapling", + -- minp, maxp to be checked, relative to sapling pos + {x = -1, y = 0, z = -1}, + {x = 1, y = 1, z = 1}, + -- maximum interval of interior volume check + 2) + + return itemstack + end, +}) + minetest.register_node("default:acacia_bush_stem", { description = "Acacia Bush Stem", drawtype = "plantlike", @@ -1481,11 +1871,302 @@ minetest.register_node("default:acacia_bush_sapling", { end, }) +minetest.register_node("default:pine_bush_stem", { + description = "Pine Bush Stem", + drawtype = "plantlike", + visual_scale = 1.41, + tiles = {"default_pine_bush_stem.png"}, + inventory_image = "default_pine_bush_stem.png", + wield_image = "default_pine_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.5, 7 / 16}, + }, +}) + +minetest.register_node("default:pine_bush_needles", { + description = "Pine Bush Needles", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_pine_needles.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:pine_bush_sapling"}, rarity = 5}, + {items = {"default:pine_bush_needles"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:pine_bush_sapling", { + description = "Pine Bush Sapling", + drawtype = "plantlike", + tiles = {"default_pine_bush_sapling.png"}, + inventory_image = "default_pine_bush_sapling.png", + wield_image = "default_pine_bush_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(300, 1500)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:pine_bush_sapling", + -- minp, maxp to be checked, relative to sapling pos + {x = -1, y = 0, z = -1}, + {x = 1, y = 1, z = 1}, + -- maximum interval of interior volume check + 2) + + return itemstack + end, +}) + +minetest.register_node("default:sand_with_kelp", { + description = "Kelp", + drawtype = "plantlike_rooted", + waving = 1, + tiles = {"default_sand.png"}, + special_tiles = {{name = "default_kelp.png", tileable_vertical = true}}, + inventory_image = "default_kelp.png", + paramtype = "light", + paramtype2 = "leveled", + groups = {snappy = 3}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + {-2/16, 0.5, -2/16, 2/16, 3.5, 2/16}, + }, + }, + node_dig_prediction = "default:sand", + node_placement_prediction = "", + + on_place = function(itemstack, placer, pointed_thing) + -- Call on_rightclick if the pointed node defines it + if pointed_thing.type == "node" and placer and + not placer:get_player_control().sneak then + local node_ptu = minetest.get_node(pointed_thing.under) + local def_ptu = minetest.registered_nodes[node_ptu.name] + if def_ptu and def_ptu.on_rightclick then + return def_ptu.on_rightclick(pointed_thing.under, node_ptu, placer, + itemstack, pointed_thing) + end + end + + local pos = pointed_thing.under + if minetest.get_node(pos).name ~= "default:sand" then + return itemstack + end + + local height = math.random(4, 6) + local pos_top = {x = pos.x, y = pos.y + height, z = pos.z} + local node_top = minetest.get_node(pos_top) + local def_top = minetest.registered_nodes[node_top.name] + local player_name = placer:get_player_name() + + if def_top and def_top.liquidtype == "source" and + minetest.get_item_group(node_top.name, "water") > 0 then + if not minetest.is_protected(pos, player_name) and + not minetest.is_protected(pos_top, player_name) then + minetest.set_node(pos, {name = "default:sand_with_kelp", + param2 = height * 16}) + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(player_name)) then + itemstack:take_item() + end + else + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos, player_name) + end + end + + return itemstack + end, + + after_destruct = function(pos, oldnode) + minetest.set_node(pos, {name = "default:sand"}) + end +}) + -- -- Corals -- +minetest.register_node("default:coral_green", { + description = "Green Coral", + drawtype = "plantlike_rooted", + waving = 1, + paramtype = "light", + tiles = {"default_coral_skeleton.png"}, + special_tiles = {{name = "default_coral_green.png", tileable_vertical = true}}, + inventory_image = "default_coral_green.png", + groups = {snappy = 3}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + {-4/16, 0.5, -4/16, 4/16, 1.5, 4/16}, + }, + }, + node_dig_prediction = "default:coral_skeleton", + node_placement_prediction = "", + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" or not placer then + return itemstack + end + + local player_name = placer:get_player_name() + local pos_under = pointed_thing.under + local pos_above = pointed_thing.above + + if minetest.get_node(pos_under).name ~= "default:coral_skeleton" or + minetest.get_node(pos_above).name ~= "default:water_source" then + return itemstack + end + + if minetest.is_protected(pos_under, player_name) or + minetest.is_protected(pos_above, player_name) then + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos_under, player_name) + return itemstack + end + + minetest.set_node(pos_under, {name = "default:coral_green"}) + if not (creative and creative.is_enabled_for(player_name)) then + itemstack:take_item() + end + + return itemstack + end, + after_destruct = function(pos, oldnode) + minetest.set_node(pos, {name = "default:coral_skeleton"}) + end, +}) + +minetest.register_node("default:coral_pink", { + description = "Pink Coral", + drawtype = "plantlike_rooted", + waving = 1, + paramtype = "light", + tiles = {"default_coral_skeleton.png"}, + special_tiles = {{name = "default_coral_pink.png", tileable_vertical = true}}, + inventory_image = "default_coral_pink.png", + groups = {snappy = 3}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + {-4/16, 0.5, -4/16, 4/16, 1.5, 4/16}, + }, + }, + node_dig_prediction = "default:coral_skeleton", + node_placement_prediction = "", + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" or not placer then + return itemstack + end + + local player_name = placer:get_player_name() + local pos_under = pointed_thing.under + local pos_above = pointed_thing.above + + if minetest.get_node(pos_under).name ~= "default:coral_skeleton" or + minetest.get_node(pos_above).name ~= "default:water_source" then + return itemstack + end + + if minetest.is_protected(pos_under, player_name) or + minetest.is_protected(pos_above, player_name) then + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos_under, player_name) + return itemstack + end + + minetest.set_node(pos_under, {name = "default:coral_pink"}) + if not (creative and creative.is_enabled_for(player_name)) then + itemstack:take_item() + end + + return itemstack + end, + after_destruct = function(pos, oldnode) + minetest.set_node(pos, {name = "default:coral_skeleton"}) + end, +}) + +minetest.register_node("default:coral_cyan", { + description = "Cyan Coral", + drawtype = "plantlike_rooted", + waving = 1, + paramtype = "light", + tiles = {"default_coral_skeleton.png"}, + special_tiles = {{name = "default_coral_cyan.png", tileable_vertical = true}}, + inventory_image = "default_coral_cyan.png", + groups = {snappy = 3}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + {-4/16, 0.5, -4/16, 4/16, 1.5, 4/16}, + }, + }, + node_dig_prediction = "default:coral_skeleton", + node_placement_prediction = "", + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" or not placer then + return itemstack + end + + local player_name = placer:get_player_name() + local pos_under = pointed_thing.under + local pos_above = pointed_thing.above + + if minetest.get_node(pos_under).name ~= "default:coral_skeleton" or + minetest.get_node(pos_above).name ~= "default:water_source" then + return itemstack + end + + if minetest.is_protected(pos_under, player_name) or + minetest.is_protected(pos_above, player_name) then + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos_under, player_name) + return itemstack + end + + minetest.set_node(pos_under, {name = "default:coral_cyan"}) + if not (creative and creative.is_enabled_for(player_name)) then + itemstack:take_item() + end + + return itemstack + end, + after_destruct = function(pos, oldnode) + minetest.set_node(pos, {name = "default:coral_skeleton"}) + end, +}) + minetest.register_node("default:coral_brown", { description = "Brown Coral", tiles = {"default_coral_brown.png"}, @@ -1520,6 +2201,7 @@ minetest.register_node("default:water_source", { tiles = { { name = "default_water_source_animated.png", + backface_culling = false, animation = { type = "vertical_frames", aspect_w = 16, @@ -1527,18 +2209,15 @@ minetest.register_node("default:water_source", { length = 2.0, }, }, - }, - special_tiles = { - -- New-style water source material (mostly unused) { name = "default_water_source_animated.png", + backface_culling = true, animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 2.0, }, - backface_culling = false, }, }, alpha = 160, @@ -1555,7 +2234,7 @@ 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, cools_lava = 1}, + groups = {water = 3, liquid = 3, cools_lava = 1}, sounds = default.node_sound_water_defaults(), }) @@ -1600,8 +2279,8 @@ minetest.register_node("default:water_flowing", { 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, - not_in_creative_inventory = 1, cools_lava = 1}, + groups = {water = 3, liquid = 3, not_in_creative_inventory = 1, + cools_lava = 1}, sounds = default.node_sound_water_defaults(), }) @@ -1612,6 +2291,7 @@ minetest.register_node("default:river_water_source", { tiles = { { name = "default_river_water_source_animated.png", + backface_culling = false, animation = { type = "vertical_frames", aspect_w = 16, @@ -1619,17 +2299,15 @@ minetest.register_node("default:river_water_source", { length = 2.0, }, }, - }, - special_tiles = { { name = "default_river_water_source_animated.png", + backface_culling = true, animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 2.0, }, - backface_culling = false, }, }, alpha = 160, @@ -1645,10 +2323,14 @@ minetest.register_node("default:river_water_source", { liquid_alternative_flowing = "default:river_water_flowing", liquid_alternative_source = "default:river_water_source", liquid_viscosity = 1, + -- Not renewable to avoid horizontal spread of water sources in sloping + -- rivers that can cause water to overflow riverbanks and cause floods. + -- River water source is instead made renewable by the 'force renew' + -- option used in the 'bucket' mod by the river water bucket. 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, cools_lava = 1}, + groups = {water = 3, liquid = 3, cools_lava = 1}, sounds = default.node_sound_water_defaults(), }) @@ -1695,8 +2377,8 @@ minetest.register_node("default:river_water_flowing", { 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, - not_in_creative_inventory = 1, cools_lava = 1}, + groups = {water = 3, liquid = 3, not_in_creative_inventory = 1, + cools_lava = 1}, sounds = default.node_sound_water_defaults(), }) @@ -1707,6 +2389,7 @@ minetest.register_node("default:lava_source", { tiles = { { name = "default_lava_source_animated.png", + backface_culling = false, animation = { type = "vertical_frames", aspect_w = 16, @@ -1714,18 +2397,15 @@ minetest.register_node("default:lava_source", { length = 3.0, }, }, - }, - special_tiles = { - -- New-style lava source material (mostly unused) { name = "default_lava_source_animated.png", + backface_culling = true, animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.0, }, - backface_culling = false, }, }, paramtype = "light", @@ -1798,314 +2478,8 @@ minetest.register_node("default:lava_flowing", { -- Tools / "Advanced" crafting / Non-"natural" -- -function default.get_chest_formspec(pos) - local spos = pos.x .. "," .. pos.y .. "," .. pos.z - local formspec = - "size[8,9]" .. - default.gui_bg .. - default.gui_bg_img .. - default.gui_slots .. - "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" .. - "list[current_player;main;0,4.85;8,1;]" .. - "list[current_player;main;0,6.08;8,3;8]" .. - "listring[nodemeta:" .. spos .. ";main]" .. - "listring[current_player;main]" .. - default.get_hotbar_bg(0,4.85) - return formspec -end - -local function chest_lid_obstructed(pos) - local above = {x = pos.x, y = pos.y + 1, z = pos.z} - local def = minetest.registered_nodes[minetest.get_node(above).name] - -- allow ladders, signs, wallmounted things and torches to not obstruct - if def and - (def.drawtype == "airlike" or - def.drawtype == "signlike" or - def.drawtype == "torchlike" or - (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then - return false - end - return true -end - -local open_chests = {} - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname ~= "default:chest" then - return - end - if not player or not fields.quit then - return - end - local pn = player:get_player_name() - - if not open_chests[pn] then - return - end - - local pos = open_chests[pn].pos - local sound = open_chests[pn].sound - local swap = open_chests[pn].swap - local node = minetest.get_node(pos) - - open_chests[pn] = nil - for k, v in pairs(open_chests) do - if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then - return true - end - end - minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap, - param2 = node.param2 }) - minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10}) - return true -end) - -function default.register_chest(name, d) - local def = table.copy(d) - def.drawtype = "mesh" - def.visual = "mesh" - def.paramtype = "light" - def.paramtype2 = "facedir" - def.legacy_facedir_simple = true - def.is_ground_content = false - - if def.protected then - def.on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) - end - def.after_place_node = function(pos, placer) - local meta = minetest.get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Locked Chest (owned by " .. - meta:get_string("owner") .. ")") - end - def.can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") and - default.can_interact_with_node(player, pos) - end - def.allow_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - if not default.can_interact_with_node(player, pos) then - return 0 - end - return count - end - def.allow_metadata_inventory_put = function(pos, listname, index, stack, player) - if not default.can_interact_with_node(player, pos) then - return 0 - end - return stack:get_count() - end - def.allow_metadata_inventory_take = function(pos, listname, index, stack, player) - if not default.can_interact_with_node(player, pos) then - return 0 - end - return stack:get_count() - end - def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - if not default.can_interact_with_node(clicker, pos) then - return itemstack - end - - minetest.sound_play(def.sound_open, {gain = 0.3, - pos = pos, max_hear_distance = 10}) - if not chest_lid_obstructed(pos) then - minetest.swap_node(pos, - { name = "default:" .. name .. "_open", - param2 = node.param2 }) - end - minetest.after(0.2, minetest.show_formspec, - clicker:get_player_name(), - "default:chest", default.get_chest_formspec(pos)) - open_chests[clicker:get_player_name()] = { pos = pos, - sound = def.sound_close, swap = name } - end - def.on_blast = function() end - def.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 = itemstack:get_meta() - - if key_meta:get_string("secret") == "" then - key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret) - itemstack:set_metadata("") - end - - if secret ~= key_meta:get_string("secret") then - return - end - - minetest.show_formspec( - player:get_player_name(), - "default:chest_locked", - default.get_chest_formspec(pos) - ) - end - def.on_skeleton_key_use = function(pos, player, newsecret) - local meta = minetest.get_meta(pos) - local owner = meta:get_string("owner") - local pn = player:get_player_name() - - -- verify placer is owner of lockable chest - if owner ~= pn then - minetest.record_protection_violation(pos, pn) - minetest.chat_send_player(pn, "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 - else - def.on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Chest") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) - end - def.can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") - end - def.on_rightclick = function(pos, node, clicker) - minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos, - max_hear_distance = 10}) - if not chest_lid_obstructed(pos) then - minetest.swap_node(pos, { - name = "default:" .. name .. "_open", - param2 = node.param2 }) - end - minetest.after(0.2, minetest.show_formspec, - clicker:get_player_name(), - "default:chest", default.get_chest_formspec(pos)) - open_chests[clicker:get_player_name()] = { pos = pos, - sound = def.sound_close, swap = name } - end - end - - def.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 chest at " .. minetest.pos_to_string(pos)) - end - def.on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name() .. - " moves " .. stack:get_name() .. - " to chest at " .. minetest.pos_to_string(pos)) - end - def.on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name() .. - " takes " .. stack:get_name() .. - " from chest at " .. minetest.pos_to_string(pos)) - end - def.on_blast = function(pos) - local drops = {} - default.get_inventory_drops(pos, "main", drops) - drops[#drops+1] = "default:chest" - minetest.remove_node(pos) - return drops - end - - local def_opened = table.copy(def) - local def_closed = table.copy(def) - - def_opened.mesh = "chest_open.obj" - for i = 1, #def_opened.tiles do - if type(def_opened.tiles[i]) == "string" then - def_opened.tiles[i] = {name = def_opened.tiles[i], backface_culling = true} - elseif def_opened.tiles[i].backface_culling == nil then - def_opened.tiles[i].backface_culling = true - end - end - def_opened.drop = "default:" .. name - def_opened.groups.not_in_creative_inventory = 1 - def_opened.selection_box = { - type = "fixed", - fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 }, - } - def_opened.can_dig = function() - return false - end - - def_closed.mesh = nil - def_closed.drawtype = nil - def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal" - def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh - def_closed.tiles[3] = def.tiles[3].."^[transformFX" - - minetest.register_node("default:" .. name, def_closed) - minetest.register_node("default:" .. name .. "_open", def_opened) - - -- convert old chests to this new variant - minetest.register_lbm({ - label = "update chests to opening chests", - name = "default:upgrade_" .. name .. "_v2", - nodenames = {"default:" .. name}, - action = function(pos, node) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", nil) - local inv = meta:get_inventory() - local list = inv:get_list("default:chest") - if list then - inv:set_size("main", 8*4) - inv:set_list("main", list) - inv:set_list("default:chest", nil) - end - end - }) -end - - -default.register_chest("chest", { - description = "Chest", - tiles = { - "default_chest_top.png", - "default_chest_top.png", - "default_chest_side.png", - "default_chest_side.png", - "default_chest_front.png", - "default_chest_inside.png" - }, - sounds = default.node_sound_wood_defaults(), - sound_open = "default_chest_open", - sound_close = "default_chest_close", - groups = {choppy = 2, oddly_breakable_by_hand = 2}, -}) - -default.register_chest("chest_locked", { - description = "Locked Chest", - tiles = { - "default_chest_top.png", - "default_chest_top.png", - "default_chest_side.png", - "default_chest_side.png", - "default_chest_lock.png", - "default_chest_inside.png" - }, - sounds = default.node_sound_wood_defaults(), - sound_open = "default_chest_open", - sound_close = "default_chest_close", - groups = {choppy = 2, oddly_breakable_by_hand = 2}, - protected = true, -}) - local bookshelf_formspec = "size[8,7;]" .. - default.gui_bg .. - default.gui_bg_img .. - default.gui_slots .. "list[context;books;0,0.3;8,2;]" .. "list[current_player;main;0,2.85;8,1;]" .. "list[current_player;main;0,4.08;8,3;8]" .. @@ -2113,23 +2487,41 @@ local bookshelf_formspec = "listring[current_player;main]" .. default.get_hotbar_bg(0,2.85) -local function get_bookshelf_formspec(inv) +local function update_bookshelf(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local invlist = inv:get_list("books") + local formspec = bookshelf_formspec - local invlist = inv and inv:get_list("books") -- Inventory slots overlay local bx, by = 0, 0.3 + local n_written, n_empty = 0, 0 for i = 1, 16 do if i == 9 then bx = 0 by = by + 1 end - if not invlist or invlist[i]:is_empty() then + local stack = invlist[i] + if stack:is_empty() then formspec = formspec .. "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]" + else + local metatable = stack:get_meta():to_table() or {} + if metatable.fields and metatable.fields.text then + n_written = n_written + stack:get_count() + else + n_empty = n_empty + stack:get_count() + end end bx = bx + 1 end - return formspec + meta:set_string("formspec", formspec) + if n_written + n_empty == 0 then + meta:set_string("infotext", "Empty Bookshelf") + else + meta:set_string("infotext", "Bookshelf (" .. n_written .. + " written, " .. n_empty .. " empty books)") + end end minetest.register_node("default:bookshelf", { @@ -2143,9 +2535,9 @@ minetest.register_node("default:bookshelf", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", get_bookshelf_formspec(nil)) local inv = meta:get_inventory() inv:set_size("books", 8 * 2) + update_bookshelf(pos) end, can_dig = function(pos,player) local inv = minetest.get_meta(pos):get_inventory() @@ -2160,20 +2552,17 @@ 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())) + update_bookshelf(pos) 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())) + " puts stuff to bookshelf at " .. minetest.pos_to_string(pos)) + update_bookshelf(pos) 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())) + update_bookshelf(pos) end, on_blast = function(pos) local drops = {} @@ -2286,8 +2675,10 @@ minetest.register_node("default:ladder_steel", { default.register_fence("default:fence_wood", { description = "Apple Wood Fence", texture = "default_fence_wood.png", - inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:wood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults() @@ -2296,8 +2687,10 @@ default.register_fence("default:fence_wood", { default.register_fence("default:fence_acacia_wood", { description = "Acacia Wood Fence", texture = "default_fence_acacia_wood.png", - inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_acacia_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_acacia_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:acacia_wood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults() @@ -2306,8 +2699,10 @@ default.register_fence("default:fence_acacia_wood", { default.register_fence("default:fence_junglewood", { description = "Jungle Wood Fence", texture = "default_fence_junglewood.png", - inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_junglewood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_junglewood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:junglewood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults() @@ -2316,8 +2711,10 @@ default.register_fence("default:fence_junglewood", { default.register_fence("default:fence_pine_wood", { description = "Pine Wood Fence", texture = "default_fence_pine_wood.png", - inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_pine_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_pine_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:pine_wood", groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, sounds = default.node_sound_wood_defaults() @@ -2326,13 +2723,75 @@ default.register_fence("default:fence_pine_wood", { default.register_fence("default:fence_aspen_wood", { description = "Aspen Wood Fence", texture = "default_fence_aspen_wood.png", - inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_aspen_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_aspen_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:aspen_wood", groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, sounds = default.node_sound_wood_defaults() }) +default.register_fence_rail("default:fence_rail_wood", { + description = "Apple Wood Fence Rail", + texture = "default_fence_rail_wood.png", + inventory_image = "default_fence_rail_overlay.png^default_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence_rail("default:fence_rail_acacia_wood", { + description = "Acacia Wood Fence Rail", + texture = "default_fence_rail_acacia_wood.png", + inventory_image = "default_fence_rail_overlay.png^default_acacia_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_acacia_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:acacia_wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence_rail("default:fence_rail_junglewood", { + description = "Jungle Wood Fence Rail", + texture = "default_fence_rail_junglewood.png", + inventory_image = "default_fence_rail_overlay.png^default_junglewood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_junglewood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:junglewood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence_rail("default:fence_rail_pine_wood", { + description = "Pine Wood Fence Rail", + texture = "default_fence_rail_pine_wood.png", + inventory_image = "default_fence_rail_overlay.png^default_pine_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_pine_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:pine_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence_rail("default:fence_rail_aspen_wood", { + description = "Aspen Wood Fence Rail", + texture = "default_fence_rail_aspen_wood.png", + inventory_image = "default_fence_rail_overlay.png^default_aspen_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_aspen_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:aspen_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + minetest.register_node("default:glass", { description = "Glass", drawtype = "glasslike_framed_optional", @@ -2430,12 +2889,6 @@ if minetest.get_mapgen_setting("mg_name") == "v6" then leaves = {"default:jungleleaves"}, radius = 3, }) - - default.register_leafdecay({ - trunks = {"default:pine_tree"}, - leaves = {"default:pine_needles"}, - radius = 3, - }) else default.register_leafdecay({ trunks = {"default:tree"}, @@ -2448,14 +2901,14 @@ else leaves = {"default:jungleleaves"}, radius = 2, }) - - default.register_leafdecay({ - trunks = {"default:pine_tree"}, - leaves = {"default:pine_needles"}, - radius = 2, - }) end +default.register_leafdecay({ + trunks = {"default:pine_tree"}, + leaves = {"default:pine_needles"}, + radius = 3, +}) + default.register_leafdecay({ trunks = {"default:acacia_tree"}, leaves = {"default:acacia_leaves"}, @@ -2479,3 +2932,9 @@ default.register_leafdecay({ leaves = {"default:acacia_bush_leaves"}, radius = 1, }) + +default.register_leafdecay({ + trunks = {"default:pine_bush_stem"}, + leaves = {"default:pine_bush_needles"}, + radius = 1, +}) diff --git a/mods/default/schematics/acacia_bush.mts b/mods/default/schematics/acacia_bush.mts index df955861..3322e3b3 100644 Binary files a/mods/default/schematics/acacia_bush.mts and b/mods/default/schematics/acacia_bush.mts differ diff --git a/mods/default/schematics/acacia_log.mts b/mods/default/schematics/acacia_log.mts index 037bca8c..aff3bd6a 100644 Binary files a/mods/default/schematics/acacia_log.mts and b/mods/default/schematics/acacia_log.mts differ diff --git a/mods/default/schematics/acacia_tree.mts b/mods/default/schematics/acacia_tree.mts index 4732ade3..9b234981 100644 Binary files a/mods/default/schematics/acacia_tree.mts and b/mods/default/schematics/acacia_tree.mts differ diff --git a/mods/default/schematics/acacia_tree_from_sapling.mts b/mods/default/schematics/acacia_tree_from_sapling.mts index 23e8e4b3..c32a995c 100644 Binary files a/mods/default/schematics/acacia_tree_from_sapling.mts and b/mods/default/schematics/acacia_tree_from_sapling.mts differ diff --git a/mods/default/schematics/apple_log.mts b/mods/default/schematics/apple_log.mts index e7ee8f2b..92fb900a 100644 Binary files a/mods/default/schematics/apple_log.mts and b/mods/default/schematics/apple_log.mts differ diff --git a/mods/default/schematics/apple_tree.mts b/mods/default/schematics/apple_tree.mts index 2bd57c1f..d56cd54b 100644 Binary files a/mods/default/schematics/apple_tree.mts and b/mods/default/schematics/apple_tree.mts differ diff --git a/mods/default/schematics/apple_tree_from_sapling.mts b/mods/default/schematics/apple_tree_from_sapling.mts index d258ab1a..23251003 100644 Binary files a/mods/default/schematics/apple_tree_from_sapling.mts and b/mods/default/schematics/apple_tree_from_sapling.mts differ diff --git a/mods/default/schematics/aspen_log.mts b/mods/default/schematics/aspen_log.mts index 180e6fd1..d0c723d7 100644 Binary files a/mods/default/schematics/aspen_log.mts and b/mods/default/schematics/aspen_log.mts differ diff --git a/mods/default/schematics/blueberry_bush.mts b/mods/default/schematics/blueberry_bush.mts new file mode 100644 index 00000000..cf4d8ef8 Binary files /dev/null and b/mods/default/schematics/blueberry_bush.mts differ diff --git a/mods/default/schematics/corals.mts b/mods/default/schematics/corals.mts deleted file mode 100644 index e1bd7ded..00000000 Binary files a/mods/default/schematics/corals.mts and /dev/null differ diff --git a/mods/default/schematics/emergent_jungle_tree.mts b/mods/default/schematics/emergent_jungle_tree.mts new file mode 100644 index 00000000..b5264309 Binary files /dev/null and b/mods/default/schematics/emergent_jungle_tree.mts differ diff --git a/mods/default/schematics/emergent_jungle_tree_from_sapling.mts b/mods/default/schematics/emergent_jungle_tree_from_sapling.mts new file mode 100644 index 00000000..cb4e4e9e Binary files /dev/null and b/mods/default/schematics/emergent_jungle_tree_from_sapling.mts differ diff --git a/mods/default/schematics/jungle_log.mts b/mods/default/schematics/jungle_log.mts index 54fa16d1..34dca436 100644 Binary files a/mods/default/schematics/jungle_log.mts and b/mods/default/schematics/jungle_log.mts differ diff --git a/mods/default/schematics/jungle_tree.mts b/mods/default/schematics/jungle_tree.mts index 01a1b11a..fe93c8c1 100644 Binary files a/mods/default/schematics/jungle_tree.mts and b/mods/default/schematics/jungle_tree.mts differ diff --git a/mods/default/schematics/jungle_tree_from_sapling.mts b/mods/default/schematics/jungle_tree_from_sapling.mts index f93f0141..f32d312b 100644 Binary files a/mods/default/schematics/jungle_tree_from_sapling.mts and b/mods/default/schematics/jungle_tree_from_sapling.mts differ diff --git a/mods/default/schematics/large_cactus.mts b/mods/default/schematics/large_cactus.mts index b71077b3..e453573f 100644 Binary files a/mods/default/schematics/large_cactus.mts and b/mods/default/schematics/large_cactus.mts differ diff --git a/mods/default/schematics/pine_bush.mts b/mods/default/schematics/pine_bush.mts new file mode 100644 index 00000000..ca572a7d Binary files /dev/null and b/mods/default/schematics/pine_bush.mts differ diff --git a/mods/default/schematics/pine_log.mts b/mods/default/schematics/pine_log.mts index 744c38b0..d51a489f 100644 Binary files a/mods/default/schematics/pine_log.mts and b/mods/default/schematics/pine_log.mts differ diff --git a/mods/default/schematics/pine_tree.mts b/mods/default/schematics/pine_tree.mts index 6f27d839..c80532ae 100644 Binary files a/mods/default/schematics/pine_tree.mts and b/mods/default/schematics/pine_tree.mts differ diff --git a/mods/default/schematics/pine_tree_from_sapling.mts b/mods/default/schematics/pine_tree_from_sapling.mts index e42a9965..0800387c 100644 Binary files a/mods/default/schematics/pine_tree_from_sapling.mts and b/mods/default/schematics/pine_tree_from_sapling.mts differ diff --git a/mods/default/schematics/small_pine_tree.mts b/mods/default/schematics/small_pine_tree.mts new file mode 100644 index 00000000..b2832266 Binary files /dev/null and b/mods/default/schematics/small_pine_tree.mts differ diff --git a/mods/default/schematics/small_pine_tree_from_sapling.mts b/mods/default/schematics/small_pine_tree_from_sapling.mts new file mode 100644 index 00000000..a1b11703 Binary files /dev/null and b/mods/default/schematics/small_pine_tree_from_sapling.mts differ diff --git a/mods/default/schematics/snowy_pine_tree_from_sapling.mts b/mods/default/schematics/snowy_pine_tree_from_sapling.mts index 0692049a..3d502a3e 100644 Binary files a/mods/default/schematics/snowy_pine_tree_from_sapling.mts and b/mods/default/schematics/snowy_pine_tree_from_sapling.mts differ diff --git a/mods/default/schematics/snowy_small_pine_tree_from_sapling.mts b/mods/default/schematics/snowy_small_pine_tree_from_sapling.mts new file mode 100644 index 00000000..d017c9e0 Binary files /dev/null and b/mods/default/schematics/snowy_small_pine_tree_from_sapling.mts differ diff --git a/mods/default/sounds/default_chest_close.ogg b/mods/default/sounds/default_chest_close.ogg index 53ff23d2..068d9002 100644 Binary files a/mods/default/sounds/default_chest_close.ogg and b/mods/default/sounds/default_chest_close.ogg differ diff --git a/mods/default/sounds/default_chest_open.ogg b/mods/default/sounds/default_chest_open.ogg index c73c072c..40b0b934 100644 Binary files a/mods/default/sounds/default_chest_open.ogg and b/mods/default/sounds/default_chest_open.ogg differ diff --git a/mods/default/sounds/default_dirt_footstep.1.ogg b/mods/default/sounds/default_dirt_footstep.1.ogg index 84a197d2..201aa3b2 100644 Binary files a/mods/default/sounds/default_dirt_footstep.1.ogg and b/mods/default/sounds/default_dirt_footstep.1.ogg differ diff --git a/mods/default/sounds/default_dirt_footstep.2.ogg b/mods/default/sounds/default_dirt_footstep.2.ogg index 2e23b8a2..2667dbc2 100644 Binary files a/mods/default/sounds/default_dirt_footstep.2.ogg and b/mods/default/sounds/default_dirt_footstep.2.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.1.ogg b/mods/default/sounds/default_snow_footstep.1.ogg index 3260b915..97cc8252 100644 Binary files a/mods/default/sounds/default_snow_footstep.1.ogg and b/mods/default/sounds/default_snow_footstep.1.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.2.ogg b/mods/default/sounds/default_snow_footstep.2.ogg index 4aac1e7f..97a6baa4 100644 Binary files a/mods/default/sounds/default_snow_footstep.2.ogg and b/mods/default/sounds/default_snow_footstep.2.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.3.ogg b/mods/default/sounds/default_snow_footstep.3.ogg index cf4235b7..bde1f21d 100644 Binary files a/mods/default/sounds/default_snow_footstep.3.ogg and b/mods/default/sounds/default_snow_footstep.3.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.4.ogg b/mods/default/sounds/default_snow_footstep.4.ogg new file mode 100644 index 00000000..8ca6a590 Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.4.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.5.ogg b/mods/default/sounds/default_snow_footstep.5.ogg new file mode 100644 index 00000000..220d60c9 Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.5.ogg differ diff --git a/mods/default/textures/default_blueberries.png b/mods/default/textures/default_blueberries.png new file mode 100644 index 00000000..1dbb0d64 Binary files /dev/null and b/mods/default/textures/default_blueberries.png differ diff --git a/mods/default/textures/default_blueberry_bush_leaves.png b/mods/default/textures/default_blueberry_bush_leaves.png new file mode 100644 index 00000000..2cd112c8 Binary files /dev/null and b/mods/default/textures/default_blueberry_bush_leaves.png differ diff --git a/mods/default/textures/default_blueberry_bush_sapling.png b/mods/default/textures/default_blueberry_bush_sapling.png new file mode 100644 index 00000000..5d7393f7 Binary files /dev/null and b/mods/default/textures/default_blueberry_bush_sapling.png differ diff --git a/mods/default/textures/default_blueberry_overlay.png b/mods/default/textures/default_blueberry_overlay.png new file mode 100644 index 00000000..de9de623 Binary files /dev/null and b/mods/default/textures/default_blueberry_overlay.png differ diff --git a/mods/default/textures/default_book.png b/mods/default/textures/default_book.png index 448a7df0..bcf1e6a0 100644 Binary files a/mods/default/textures/default_book.png and b/mods/default/textures/default_book.png differ diff --git a/mods/default/textures/default_book_written.png b/mods/default/textures/default_book_written.png index 9196ac64..f23d1225 100644 Binary files a/mods/default/textures/default_book_written.png and b/mods/default/textures/default_book_written.png differ diff --git a/mods/default/textures/default_bookshelf_slot.png b/mods/default/textures/default_bookshelf_slot.png index 715a3dce..cd2c8bce 100644 Binary files a/mods/default/textures/default_bookshelf_slot.png and b/mods/default/textures/default_bookshelf_slot.png differ diff --git a/mods/default/textures/default_coniferous_litter.png b/mods/default/textures/default_coniferous_litter.png new file mode 100644 index 00000000..da340e0a Binary files /dev/null and b/mods/default/textures/default_coniferous_litter.png differ diff --git a/mods/default/textures/default_coniferous_litter_side.png b/mods/default/textures/default_coniferous_litter_side.png new file mode 100644 index 00000000..07014614 Binary files /dev/null and b/mods/default/textures/default_coniferous_litter_side.png differ diff --git a/mods/default/textures/default_coral_cyan.png b/mods/default/textures/default_coral_cyan.png new file mode 100644 index 00000000..11cc7bfd Binary files /dev/null and b/mods/default/textures/default_coral_cyan.png differ diff --git a/mods/default/textures/default_coral_green.png b/mods/default/textures/default_coral_green.png new file mode 100644 index 00000000..847c5721 Binary files /dev/null and b/mods/default/textures/default_coral_green.png differ diff --git a/mods/default/textures/default_coral_pink.png b/mods/default/textures/default_coral_pink.png new file mode 100644 index 00000000..62d70c6e Binary files /dev/null and b/mods/default/textures/default_coral_pink.png differ diff --git a/mods/default/textures/default_desert_cobble.png b/mods/default/textures/default_desert_cobble.png index 184a9d88..fa1af5d3 100644 Binary files a/mods/default/textures/default_desert_cobble.png and b/mods/default/textures/default_desert_cobble.png differ diff --git a/mods/default/textures/default_dirt.png b/mods/default/textures/default_dirt.png index ca7e4aef..afe4a2e1 100644 Binary files a/mods/default/textures/default_dirt.png and b/mods/default/textures/default_dirt.png differ diff --git a/mods/default/textures/default_emergent_jungle_sapling.png b/mods/default/textures/default_emergent_jungle_sapling.png new file mode 100644 index 00000000..b363b3cc Binary files /dev/null and b/mods/default/textures/default_emergent_jungle_sapling.png differ diff --git a/mods/default/textures/default_fence_rail_acacia_wood.png b/mods/default/textures/default_fence_rail_acacia_wood.png new file mode 100644 index 00000000..64dc90f1 Binary files /dev/null and b/mods/default/textures/default_fence_rail_acacia_wood.png differ diff --git a/mods/default/textures/default_fence_rail_aspen_wood.png b/mods/default/textures/default_fence_rail_aspen_wood.png new file mode 100644 index 00000000..ab16a60c Binary files /dev/null and b/mods/default/textures/default_fence_rail_aspen_wood.png differ diff --git a/mods/default/textures/default_fence_rail_junglewood.png b/mods/default/textures/default_fence_rail_junglewood.png new file mode 100644 index 00000000..ebc1ef06 Binary files /dev/null and b/mods/default/textures/default_fence_rail_junglewood.png differ diff --git a/mods/default/textures/default_fence_rail_overlay.png b/mods/default/textures/default_fence_rail_overlay.png new file mode 100644 index 00000000..4da47aec Binary files /dev/null and b/mods/default/textures/default_fence_rail_overlay.png differ diff --git a/mods/default/textures/default_fence_rail_pine_wood.png b/mods/default/textures/default_fence_rail_pine_wood.png new file mode 100644 index 00000000..fd8d99d6 Binary files /dev/null and b/mods/default/textures/default_fence_rail_pine_wood.png differ diff --git a/mods/default/textures/default_fence_rail_wood.png b/mods/default/textures/default_fence_rail_wood.png new file mode 100644 index 00000000..f84b755b Binary files /dev/null and b/mods/default/textures/default_fence_rail_wood.png differ diff --git a/mods/default/textures/default_fern_1.png b/mods/default/textures/default_fern_1.png new file mode 100644 index 00000000..b307986d Binary files /dev/null and b/mods/default/textures/default_fern_1.png differ diff --git a/mods/default/textures/default_fern_2.png b/mods/default/textures/default_fern_2.png new file mode 100644 index 00000000..6c5f7d54 Binary files /dev/null and b/mods/default/textures/default_fern_2.png differ diff --git a/mods/default/textures/default_fern_3.png b/mods/default/textures/default_fern_3.png new file mode 100644 index 00000000..2c1f605e Binary files /dev/null and b/mods/default/textures/default_fern_3.png differ diff --git a/mods/default/textures/default_glass.png b/mods/default/textures/default_glass.png index da254028..74d6a025 100644 Binary files a/mods/default/textures/default_glass.png and b/mods/default/textures/default_glass.png differ diff --git a/mods/default/textures/default_glass_detail.png b/mods/default/textures/default_glass_detail.png index d38dbb7b..811a4db8 100644 Binary files a/mods/default/textures/default_glass_detail.png and b/mods/default/textures/default_glass_detail.png differ diff --git a/mods/default/textures/default_kelp.png b/mods/default/textures/default_kelp.png new file mode 100644 index 00000000..70b743d5 Binary files /dev/null and b/mods/default/textures/default_kelp.png differ diff --git a/mods/default/textures/default_large_cactus_seedling.png b/mods/default/textures/default_large_cactus_seedling.png new file mode 100644 index 00000000..378351ad Binary files /dev/null and b/mods/default/textures/default_large_cactus_seedling.png differ diff --git a/mods/default/textures/default_marram_grass_1.png b/mods/default/textures/default_marram_grass_1.png new file mode 100644 index 00000000..73ec9e9d Binary files /dev/null and b/mods/default/textures/default_marram_grass_1.png differ diff --git a/mods/default/textures/default_marram_grass_2.png b/mods/default/textures/default_marram_grass_2.png new file mode 100644 index 00000000..2db75c70 Binary files /dev/null and b/mods/default/textures/default_marram_grass_2.png differ diff --git a/mods/default/textures/default_marram_grass_3.png b/mods/default/textures/default_marram_grass_3.png new file mode 100644 index 00000000..f6c155f4 Binary files /dev/null and b/mods/default/textures/default_marram_grass_3.png differ diff --git a/mods/default/textures/default_moss.png b/mods/default/textures/default_moss.png new file mode 100644 index 00000000..479038e9 Binary files /dev/null and b/mods/default/textures/default_moss.png differ diff --git a/mods/default/textures/default_moss_side.png b/mods/default/textures/default_moss_side.png new file mode 100644 index 00000000..4a20345e Binary files /dev/null and b/mods/default/textures/default_moss_side.png differ diff --git a/mods/default/textures/default_permafrost.png b/mods/default/textures/default_permafrost.png new file mode 100644 index 00000000..d7a19a2f Binary files /dev/null and b/mods/default/textures/default_permafrost.png differ diff --git a/mods/default/textures/default_pine_bush_sapling.png b/mods/default/textures/default_pine_bush_sapling.png new file mode 100644 index 00000000..fadeff87 Binary files /dev/null and b/mods/default/textures/default_pine_bush_sapling.png differ diff --git a/mods/default/textures/default_pine_bush_stem.png b/mods/default/textures/default_pine_bush_stem.png new file mode 100644 index 00000000..e239f812 Binary files /dev/null and b/mods/default/textures/default_pine_bush_stem.png differ diff --git a/mods/default/textures/default_pine_needles.png b/mods/default/textures/default_pine_needles.png index ad7373b0..f6997271 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_stones.png b/mods/default/textures/default_stones.png new file mode 100644 index 00000000..4d3b6cfa Binary files /dev/null and b/mods/default/textures/default_stones.png differ diff --git a/mods/default/textures/default_stones_side.png b/mods/default/textures/default_stones_side.png new file mode 100644 index 00000000..7ae823a7 Binary files /dev/null and b/mods/default/textures/default_stones_side.png differ diff --git a/mods/default/textures/gui_hotbar.png b/mods/default/textures/gui_hotbar.png deleted file mode 100644 index 73fb3ca8..00000000 Binary files a/mods/default/textures/gui_hotbar.png and /dev/null differ diff --git a/mods/default/textures/gui_hotbar_selected.png b/mods/default/textures/gui_hotbar_selected.png deleted file mode 100644 index 40bafe6b..00000000 Binary files a/mods/default/textures/gui_hotbar_selected.png and /dev/null differ diff --git a/mods/default/tools.lua b/mods/default/tools.lua index c2cf6e6b..b7f5cf2a 100644 --- a/mods/default/tools.lua +++ b/mods/default/tools.lua @@ -50,6 +50,20 @@ minetest.register_tool("default:pick_stone", { sound = {breaks = "default_tool_breaks"}, }) +minetest.register_tool("default:pick_bronze", { + description = "Bronze Pickaxe", + inventory_image = "default_tool_bronzepick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + cracky = {times={[1]=4.50, [2]=1.80, [3]=0.90}, uses=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + minetest.register_tool("default:pick_steel", { description = "Steel Pickaxe", inventory_image = "default_tool_steelpick.png", @@ -64,20 +78,6 @@ minetest.register_tool("default:pick_steel", { sound = {breaks = "default_tool_breaks"}, }) -minetest.register_tool("default:pick_bronze", { - description = "Bronze Pickaxe", - inventory_image = "default_tool_bronzepick.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - groupcaps={ - cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2}, - }, - damage_groups = {fleshy=4}, - }, - sound = {breaks = "default_tool_breaks"}, -}) - minetest.register_tool("default:pick_mese", { description = "Mese Pickaxe", inventory_image = "default_tool_mesepick.png", @@ -141,6 +141,21 @@ minetest.register_tool("default:shovel_stone", { sound = {breaks = "default_tool_breaks"}, }) +minetest.register_tool("default:shovel_bronze", { + description = "Bronze Shovel", + inventory_image = "default_tool_bronzeshovel.png", + wield_image = "default_tool_bronzeshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.1, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.65, [2]=1.05, [3]=0.45}, uses=25, maxlevel=2}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + minetest.register_tool("default:shovel_steel", { description = "Steel Shovel", inventory_image = "default_tool_steelshovel.png", @@ -156,21 +171,6 @@ minetest.register_tool("default:shovel_steel", { sound = {breaks = "default_tool_breaks"}, }) -minetest.register_tool("default:shovel_bronze", { - description = "Bronze Shovel", - inventory_image = "default_tool_bronzeshovel.png", - wield_image = "default_tool_bronzeshovel.png^[transformR90", - tool_capabilities = { - full_punch_interval = 1.1, - max_drop_level=1, - groupcaps={ - crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40, maxlevel=2}, - }, - damage_groups = {fleshy=3}, - }, - sound = {breaks = "default_tool_breaks"}, -}) - minetest.register_tool("default:shovel_mese", { description = "Mese Shovel", inventory_image = "default_tool_meseshovel.png", @@ -234,6 +234,20 @@ minetest.register_tool("default:axe_stone", { sound = {breaks = "default_tool_breaks"}, }) +minetest.register_tool("default:axe_bronze", { + description = "Bronze Axe", + inventory_image = "default_tool_bronzeaxe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.75, [2]=1.70, [3]=1.15}, uses=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + minetest.register_tool("default:axe_steel", { description = "Steel Axe", inventory_image = "default_tool_steelaxe.png", @@ -248,20 +262,6 @@ minetest.register_tool("default:axe_steel", { sound = {breaks = "default_tool_breaks"}, }) -minetest.register_tool("default:axe_bronze", { - description = "Bronze Axe", - inventory_image = "default_tool_bronzeaxe.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - groupcaps={ - choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=30, maxlevel=2}, - }, - damage_groups = {fleshy=4}, - }, - sound = {breaks = "default_tool_breaks"}, -}) - minetest.register_tool("default:axe_mese", { description = "Mese Axe", inventory_image = "default_tool_meseaxe.png", @@ -323,6 +323,20 @@ minetest.register_tool("default:sword_stone", { sound = {breaks = "default_tool_breaks"}, }) +minetest.register_tool("default:sword_bronze", { + description = "Bronze Sword", + inventory_image = "default_tool_bronzesword.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.75, [2]=1.30, [3]=0.375}, uses=25, maxlevel=2}, + }, + damage_groups = {fleshy=6}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + minetest.register_tool("default:sword_steel", { description = "Steel Sword", inventory_image = "default_tool_steelsword.png", @@ -337,20 +351,6 @@ minetest.register_tool("default:sword_steel", { sound = {breaks = "default_tool_breaks"}, }) -minetest.register_tool("default:sword_bronze", { - description = "Bronze Sword", - inventory_image = "default_tool_bronzesword.png", - tool_capabilities = { - full_punch_interval = 0.8, - max_drop_level=1, - groupcaps={ - 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", @@ -389,7 +389,8 @@ minetest.register_tool("default:key", { local node = minetest.get_node(under) local def = minetest.registered_nodes[node.name] if def and def.on_rightclick and - not (placer and placer:get_player_control().sneak) then + not (placer and placer:is_player() and + placer:get_player_control().sneak) then return def.on_rightclick(under, node, placer, itemstack, pointed_thing) or itemstack end diff --git a/mods/default/torch.lua b/mods/default/torch.lua index 3c3ae965..5de5f89f 100644 --- a/mods/default/torch.lua +++ b/mods/default/torch.lua @@ -1,39 +1,17 @@ - ---[[ - -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 - ---]] +local function on_flood(pos, oldnode, newnode) + minetest.add_item(pos, ItemStack("default:torch 1")) + -- Play flame-extinguish sound if liquid is not an 'igniter' + local nodedef = minetest.registered_items[newnode.name] + if not (nodedef and nodedef.groups and + nodedef.groups.igniter and nodedef.groups.igniter > 0) then + minetest.sound_play( + "default_cool_lava", + {pos = pos, max_hear_distance = 16, gain = 0.1} + ) + end + -- Remove the torch node + return false +end minetest.register_node("default:torch", { description = "Torch", @@ -63,7 +41,8 @@ minetest.register_node("default:torch", { 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 + not (placer and placer:is_player() and + placer:get_player_control().sneak) then return def.on_rightclick(under, node, placer, itemstack, pointed_thing) or itemstack end @@ -83,7 +62,9 @@ minetest.register_node("default:torch", { itemstack:set_name("default:torch") return itemstack - end + end, + floodable = true, + on_flood = on_flood, }) minetest.register_node("default:torch_wall", { @@ -105,6 +86,8 @@ minetest.register_node("default:torch_wall", { wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8}, }, sounds = default.node_sound_wood_defaults(), + floodable = true, + on_flood = on_flood, }) minetest.register_node("default:torch_ceiling", { @@ -126,6 +109,8 @@ minetest.register_node("default:torch_ceiling", { wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8}, }, sounds = default.node_sound_wood_defaults(), + floodable = true, + on_flood = on_flood, }) minetest.register_lbm({ diff --git a/mods/default/trees.lua b/mods/default/trees.lua index d00a6b5e..564b7141 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -81,10 +81,22 @@ function default.grow_sapling(pos) minetest.log("action", "A bush sapling grows into a bush at ".. minetest.pos_to_string(pos)) default.grow_bush(pos) + elseif node.name == "default:blueberry_bush_sapling" then + minetest.log("action", "A blueberry bush sapling grows into a bush at ".. + minetest.pos_to_string(pos)) + default.grow_blueberry_bush(pos) elseif node.name == "default:acacia_bush_sapling" then minetest.log("action", "An acacia bush sapling grows into a bush at ".. minetest.pos_to_string(pos)) default.grow_acacia_bush(pos) + elseif node.name == "default:pine_bush_sapling" then + minetest.log("action", "A pine bush sapling grows into a bush at ".. + minetest.pos_to_string(pos)) + default.grow_pine_bush(pos) + elseif node.name == "default:emergent_jungle_sapling" then + minetest.log("action", "An emergent jungle sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_new_emergent_jungle_tree(pos) end end @@ -379,7 +391,7 @@ end function default.grow_new_apple_tree(pos) local path = minetest.get_modpath("default") .. "/schematics/apple_tree_from_sapling.mts" - minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + minetest.place_schematic({x = pos.x - 3, y = pos.y - 1, z = pos.z - 3}, path, "random", nil, false) end @@ -394,11 +406,27 @@ function default.grow_new_jungle_tree(pos) end +-- New emergent jungle tree + +function default.grow_new_emergent_jungle_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/emergent_jungle_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 3, y = pos.y - 5, z = pos.z - 3}, + path, "random", nil, false) +end + + -- New pine tree function default.grow_new_pine_tree(pos) - local path = minetest.get_modpath("default") .. - "/schematics/pine_tree_from_sapling.mts" + local path + if math.random() > 0.5 then + path = minetest.get_modpath("default") .. + "/schematics/pine_tree_from_sapling.mts" + else + path = minetest.get_modpath("default") .. + "/schematics/small_pine_tree_from_sapling.mts" + end minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, path, "0", nil, false) end @@ -407,8 +435,14 @@ end -- New snowy pine tree function default.grow_new_snowy_pine_tree(pos) - local path = minetest.get_modpath("default") .. - "/schematics/snowy_pine_tree_from_sapling.mts" + local path + if math.random() > 0.5 then + path = minetest.get_modpath("default") .. + "/schematics/snowy_pine_tree_from_sapling.mts" + else + path = minetest.get_modpath("default") .. + "/schematics/snowy_small_pine_tree_from_sapling.mts" + end minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, path, "random", nil, false) end @@ -446,6 +480,15 @@ function default.grow_bush(pos) path, "0", nil, false) end +-- Blueberry bush + +function default.grow_blueberry_bush(pos) + local path = minetest.get_modpath("default") .. + "/schematics/blueberry_bush.mts" + minetest.place_schematic({x = pos.x - 1, y = pos.y, z = pos.z - 1}, + path, "0", nil, false) +end + -- Acacia bush @@ -457,6 +500,26 @@ function default.grow_acacia_bush(pos) end +-- Pine bush + +function default.grow_pine_bush(pos) + local path = minetest.get_modpath("default") .. + "/schematics/pine_bush.mts" + minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + path, "0", nil, false) +end + + +-- Large cactus + +function default.grow_large_cactus(pos) + local path = minetest.get_modpath("default") .. + "/schematics/large_cactus.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "random", nil, false) +end + + -- -- Sapling 'on place' function to check protection of node and resulting tree volume -- @@ -468,7 +531,9 @@ function default.sapling_on_place(itemstack, placer, pointed_thing, 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 + if pdef and pdef.on_rightclick and + not (placer and placer:is_player() and + placer:get_player_control().sneak) then return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing) end @@ -481,21 +546,23 @@ function default.sapling_on_place(itemstack, placer, pointed_thing, end end - local player_name = placer:get_player_name() + local player_name = placer and placer:get_player_name() or "" -- Check sapling position for protection if minetest.is_protected(pos, player_name) then minetest.record_protection_violation(pos, player_name) return itemstack end -- Check tree volume for protection - if default.intersects_protection( + if minetest.is_area_protected( vector.add(pos, minp_relative), vector.add(pos, maxp_relative), player_name, interval) then minetest.record_protection_violation(pos, player_name) -- Print extra information to explain - minetest.chat_send_player(player_name, "Tree will intersect protection") + minetest.chat_send_player(player_name, + itemstack:get_definition().description .. " will intersect protection " .. + "on growth") return itemstack end diff --git a/mods/doors/README.txt b/mods/doors/README.txt index 9ad7093d..9c114b0c 100644 --- a/mods/doors/README.txt +++ b/mods/doors/README.txt @@ -46,8 +46,9 @@ Following textures created by sofar (CC-BY-SA-3.0): 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): - door_glass.png +Glass door textures by Krock and paramat based on textures by VanessaE (CC BY-SA 3.0): + doors_door_glass.png + doors_item_glass.png All other textures (created by PilzAdam) (CC BY-SA 3.0): diff --git a/mods/doors/init.lua b/mods/doors/init.lua index b5515f10..6edafa55 100644 --- a/mods/doors/init.lua +++ b/mods/doors/init.lua @@ -1,10 +1,8 @@ -- our API object doors = {} --- private data -local _doors = {} -_doors.registered_doors = {} -_doors.registered_trapdoors = {} +doors.registered_doors = {} +doors.registered_trapdoors = {} local function replace_old_owner_information(pos) local meta = minetest.get_meta(pos) @@ -18,7 +16,7 @@ end -- returns an object to a door object or nil function doors.get(pos) local node_name = minetest.get_node(pos).name - if _doors.registered_doors[node_name] then + if doors.registered_doors[node_name] then -- A normal upright door return { pos = pos, @@ -26,23 +24,23 @@ function doors.get(pos) if self:state() then return false end - return _doors.door_toggle(self.pos, nil, player) + return doors.door_toggle(self.pos, nil, player) end, close = function(self, player) if not self:state() then return false end - return _doors.door_toggle(self.pos, nil, player) + return doors.door_toggle(self.pos, nil, player) end, toggle = function(self, player) - return _doors.door_toggle(self.pos, nil, player) + return doors.door_toggle(self.pos, nil, player) end, state = function(self) local state = minetest.get_meta(self.pos):get_int("state") return state %2 == 1 end } - elseif _doors.registered_trapdoors[node_name] then + elseif doors.registered_trapdoors[node_name] then -- A trapdoor return { pos = pos, @@ -50,16 +48,16 @@ function doors.get(pos) if self:state() then return false end - return _doors.trapdoor_toggle(self.pos, nil, player) + return doors.trapdoor_toggle(self.pos, nil, player) end, close = function(self, player) if not self:state() then return false end - return _doors.trapdoor_toggle(self.pos, nil, player) + return doors.trapdoor_toggle(self.pos, nil, player) end, toggle = function(self, player) - return _doors.trapdoor_toggle(self.pos, nil, player) + return doors.trapdoor_toggle(self.pos, nil, player) end, state = function(self) return minetest.get_node(self.pos).name:sub(-5) == "_open" @@ -130,7 +128,7 @@ local transform = { }, } -function _doors.door_toggle(pos, node, clicker) +function doors.door_toggle(pos, node, clicker) local meta = minetest.get_meta(pos) node = node or minetest.get_node(pos) local def = minetest.registered_nodes[node.name] @@ -162,6 +160,14 @@ function _doors.door_toggle(pos, node, clicker) end local dir = node.param2 + + -- It's possible param2 is messed up, so, validate before using + -- the input data. This indicates something may have rotated + -- the door, even though that is not supported. + if not transform[state + 1] or not transform[state + 1][dir + 1] then + return false + end + if state % 2 == 0 then minetest.sound_play(def.door.sounds[1], {pos = pos, gain = 0.3, max_hear_distance = 10}) @@ -203,12 +209,7 @@ end local function can_dig_door(pos, digger) replace_old_owner_information(pos) - if default.can_interact_with_node(digger, pos) then - return true - else - minetest.record_protection_violation(pos, digger:get_player_name()) - return false - end + return default.can_interact_with_node(digger, pos) end function doors.register(name, def) @@ -266,7 +267,8 @@ function doors.register(name, def) local node = minetest.get_node(pointed_thing.under) local pdef = minetest.registered_nodes[node.name] if pdef and pdef.on_rightclick and - not placer:get_player_control().sneak then + not (placer and placer:is_player() and + placer:get_player_control().sneak) then return pdef.on_rightclick(pointed_thing.under, node, placer, itemstack, pointed_thing) end @@ -290,12 +292,12 @@ function doors.register(name, def) return itemstack end - local pn = placer:get_player_name() + local pn = placer and placer:get_player_name() or "" if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then return itemstack end - local dir = minetest.dir_to_facedir(placer:get_look_dir()) + local dir = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0 local ref = { {x = -1, y = 0, z = 0}, @@ -369,10 +371,11 @@ function doors.register(name, def) name = name, sounds = { def.sound_close, def.sound_open }, } - - def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - _doors.door_toggle(pos, node, clicker) - return itemstack + if not def.on_rightclick then + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + doors.door_toggle(pos, node, clicker) + return itemstack + end end def.after_dig_node = function(pos, node, meta, digger) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) @@ -410,6 +413,7 @@ function doors.register(name, def) return secret, "a locked door", owner end + def.node_dig_prediction = "" else def.on_blast = function(pos, intensity) minetest.remove_node(pos) @@ -439,8 +443,8 @@ function doors.register(name, def) def.mesh = "door_b.obj" minetest.register_node(":" .. name .. "_b", def) - _doors.registered_doors[name .. "_a"] = true - _doors.registered_doors[name .. "_b"] = true + doors.registered_doors[name .. "_a"] = true + doors.registered_doors[name .. "_b"] = true end doors.register("door_wood", { @@ -527,7 +531,7 @@ end ----trapdoor---- -function _doors.trapdoor_toggle(pos, node, clicker) +function doors.trapdoor_toggle(pos, node, clicker) node = node or minetest.get_node(pos) replace_old_owner_information(pos) @@ -560,7 +564,7 @@ function doors.register_trapdoor(name, def) local name_opened = name.."_open" def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - _doors.trapdoor_toggle(pos, node, clicker) + doors.trapdoor_toggle(pos, node, clicker) return itemstack end @@ -607,6 +611,7 @@ function doors.register_trapdoor(name, def) return secret, "a locked trapdoor", owner end + def.node_dig_prediction = "" else def.on_blast = function(pos, intensity) minetest.remove_node(pos) @@ -662,8 +667,8 @@ function doors.register_trapdoor(name, def) minetest.register_node(name_opened, def_opened) minetest.register_node(name_closed, def_closed) - _doors.registered_trapdoors[name_opened] = true - _doors.registered_trapdoors[name_closed] = true + doors.registered_trapdoors[name_opened] = true + doors.registered_trapdoors[name_closed] = true end doors.register_trapdoor("doors:trapdoor", { diff --git a/mods/doors/textures/doors_door_glass.png b/mods/doors/textures/doors_door_glass.png index 26c427b9..c296a0ff 100644 Binary files a/mods/doors/textures/doors_door_glass.png and b/mods/doors/textures/doors_door_glass.png differ diff --git a/mods/doors/textures/doors_item_glass.png b/mods/doors/textures/doors_item_glass.png index 791a58ab..86406fbb 100644 Binary files a/mods/doors/textures/doors_item_glass.png and b/mods/doors/textures/doors_item_glass.png differ diff --git a/mods/dungeon_loot/README.txt b/mods/dungeon_loot/README.txt new file mode 100644 index 00000000..c500d255 --- /dev/null +++ b/mods/dungeon_loot/README.txt @@ -0,0 +1,11 @@ +Minetest Game mod: dungeon_loot +=============================== +Adds randomly generated chests with some "loot" to generated dungeons, +an API to register additional loot is provided. +Only works if dungeons are actually enabled in mapgen flags. + +License information can be found in license.txt + +Authors of source code +---------------------- +Originally by sfan5 (MIT) diff --git a/mods/sfinv/depends.txt b/mods/dungeon_loot/depends.txt similarity index 100% rename from mods/sfinv/depends.txt rename to mods/dungeon_loot/depends.txt diff --git a/mods/dungeon_loot/init.lua b/mods/dungeon_loot/init.lua new file mode 100644 index 00000000..9d8ac52f --- /dev/null +++ b/mods/dungeon_loot/init.lua @@ -0,0 +1,8 @@ +dungeon_loot = {} + +dungeon_loot.CHESTS_MIN = 0 -- not necessarily in a single dungeon +dungeon_loot.CHESTS_MAX = 2 +dungeon_loot.STACKS_PER_CHEST_MAX = 8 + +dofile(minetest.get_modpath("dungeon_loot") .. "/loot.lua") +dofile(minetest.get_modpath("dungeon_loot") .. "/mapgen.lua") diff --git a/mods/dungeon_loot/license.txt b/mods/dungeon_loot/license.txt new file mode 100644 index 00000000..0af30a0c --- /dev/null +++ b/mods/dungeon_loot/license.txt @@ -0,0 +1,24 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2017 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/dungeon_loot/loot.lua b/mods/dungeon_loot/loot.lua new file mode 100644 index 00000000..3fe0bff6 --- /dev/null +++ b/mods/dungeon_loot/loot.lua @@ -0,0 +1,62 @@ +dungeon_loot.registered_loot = { + -- buckets + {name = "bucket:bucket_empty", chance = 0.55}, + -- water in deserts or above ground, lava otherwise + {name = "bucket:bucket_water", chance = 0.45, types = {"sandstone", "desert"}}, + {name = "bucket:bucket_water", chance = 0.45, y = {0, 32768}, types = {"normal"}}, + {name = "bucket:bucket_lava", chance = 0.45, y = {-32768, -1}, types = {"normal"}}, + + -- various items + {name = "default:stick", chance = 0.6, count = {3, 6}}, + {name = "default:flint", chance = 0.4, count = {1, 3}}, + {name = "vessels:glass_fragments", chance = 0.35, count = {1, 4}}, + {name = "carts:rail", chance = 0.35, count = {1, 6}}, + + -- farming / consumable + {name = "farming:string", chance = 0.5, count = {1, 8}}, + {name = "farming:wheat", chance = 0.5, count = {2, 5}}, + {name = "default:apple", chance = 0.4, count = {1, 4}}, + {name = "farming:seed_cotton", chance = 0.4, count = {1, 4}, types = {"normal"}}, + {name = "default:cactus", chance = 0.4, count = {1, 4}, types = {"sandstone", "desert"}}, + + -- minerals + {name = "default:coal_lump", chance = 0.9, count = {1, 12}}, + {name = "default:gold_ingot", chance = 0.5}, + {name = "default:steel_ingot", chance = 0.4, count = {1, 6}}, + {name = "default:mese_crystal", chance = 0.1, count = {2, 3}}, + + -- tools + {name = "default:sword_wood", chance = 0.6}, + {name = "default:pick_stone", chance = 0.3}, + {name = "default:axe_diamond", chance = 0.05}, + + -- natural materials + {name = "default:sand", chance = 0.8, count = {4, 32}, y = {-64, 32768}, types = {"normal"}}, + {name = "default:desert_sand", chance = 0.8, count = {4, 32}, y = {-64, 32768}, types = {"sandstone"}}, + {name = "default:desert_cobble", chance = 0.8, count = {4, 32}, types = {"desert"}}, + {name = "default:dirt", chance = 0.6, count = {2, 16}, y = {-64, 32768}}, + {name = "default:obsidian", chance = 0.25, count = {1, 3}, y = {-32768, -512}}, + {name = "default:mese", chance = 0.15, y = {-32768, -512}}, +} + +function dungeon_loot.register(t) + if t.name ~= nil then + t = {t} -- single entry + end + for _, loot in ipairs(t) do + table.insert(dungeon_loot.registered_loot, loot) + end +end + +function dungeon_loot._internal_get_loot(pos_y, dungeontype) + -- filter by y pos and type + local ret = {} + for _, l in ipairs(dungeon_loot.registered_loot) do + if l.y == nil or (pos_y >= l.y[1] and pos_y <= l.y[2]) then + if l.types == nil or table.indexof(l.types, dungeontype) ~= -1 then + table.insert(ret, l) + end + end + end + return ret +end diff --git a/mods/dungeon_loot/mapgen.lua b/mods/dungeon_loot/mapgen.lua new file mode 100644 index 00000000..c6a45094 --- /dev/null +++ b/mods/dungeon_loot/mapgen.lua @@ -0,0 +1,168 @@ +minetest.set_gen_notify({dungeon = true, temple = true}) + +local function noise3d_integer(noise, pos) + return math.abs(math.floor(noise:get_3d(pos) * 0x7fffffff)) +end + +local function random_sample(rand, list, count) + local ret = {} + for n = 1, count do + local idx = rand:next(1, #list) + table.insert(ret, list[idx]) + table.remove(list, idx) + end + return ret +end + +local function find_walls(cpos) + local wall = minetest.registered_aliases["mapgen_cobble"] + local wall_alt = minetest.registered_aliases["mapgen_mossycobble"] + local wall_ss = minetest.registered_aliases["mapgen_sandstonebrick"] + local wall_ds = minetest.registered_aliases["mapgen_desert_stone"] + local is_wall = function(node) + return table.indexof({wall, wall_alt, wall_ss, wall_ds}, node.name) ~= -1 + end + + local dirs = {{x=1, z=0}, {x=-1, z=0}, {x=0, z=1}, {x=0, z=-1}} + local get_node = minetest.get_node + + local ret = {} + local mindist = {x=0, z=0} + local min = function(a, b) return a ~= 0 and math.min(a, b) or b end + local wallnode + for _, dir in ipairs(dirs) do + for i = 1, 9 do -- 9 = max room size / 2 + local pos = vector.add(cpos, {x=dir.x*i, y=0, z=dir.z*i}) + + -- continue in that direction until we find a wall-like node + local node = get_node(pos) + if is_wall(node) then + local front_below = vector.subtract(pos, {x=dir.x, y=1, z=dir.z}) + local above = vector.add(pos, {x=0, y=1, z=0}) + + -- check that it: + --- is at least 2 nodes high (not a staircase) + --- has a floor + if is_wall(get_node(front_below)) and is_wall(get_node(above)) then + table.insert(ret, {pos = pos, facing = {x=-dir.x, y=0, z=-dir.z}}) + if dir.z == 0 then + mindist.x = min(mindist.x, i-1) + else + mindist.z = min(mindist.z, i-1) + end + wallnode = node.name + end + -- abort even if it wasn't a wall cause something is in the way + break + end + end + end + + local mapping = { + [wall_ss] = "sandstone", + [wall_ds] = "desert" + } + return { + walls = ret, + size = {x=mindist.x*2, z=mindist.z*2}, + type = mapping[wallnode] or "normal" + } +end + +local function populate_chest(pos, rand, dungeontype) + --minetest.chat_send_all("chest placed at " .. minetest.pos_to_string(pos) .. " [" .. dungeontype .. "]") + --minetest.add_node(vector.add(pos, {x=0, y=1, z=0}), {name="default:torch", param2=1}) + + local item_list = dungeon_loot._internal_get_loot(pos.y, dungeontype) + -- take random (partial) sample of all possible items + assert(#item_list >= dungeon_loot.STACKS_PER_CHEST_MAX) + item_list = random_sample(rand, item_list, dungeon_loot.STACKS_PER_CHEST_MAX) + + -- apply chances / randomized amounts and collect resulting items + local items = {} + for _, loot in ipairs(item_list) do + if rand:next(0, 1000) / 1000 <= loot.chance then + local itemdef = minetest.registered_items[loot.name] + local amount = 1 + if loot.count ~= nil then + amount = rand:next(loot.count[1], loot.count[2]) + end + + if itemdef.tool_capabilities then + for n = 1, amount do + local wear = rand:next(0.20 * 65535, 0.75 * 65535) -- 20% to 75% wear + table.insert(items, ItemStack({name = loot.name, wear = wear})) + end + elseif itemdef.stack_max == 1 then + -- not stackable, add separately + for n = 1, amount do + table.insert(items, loot.name) + end + else + table.insert(items, ItemStack({name = loot.name, count = amount})) + end + end + end + + -- place items at random places in chest + local inv = minetest.get_meta(pos):get_inventory() + local listsz = inv:get_size("main") + assert(listsz >= #items) + for _, item in ipairs(items) do + local index = rand:next(1, listsz) + if inv:get_stack("main", index):is_empty() then + inv:set_stack("main", index, item) + else + inv:add_item("main", item) -- space occupied, just put it anywhere + end + end +end + + +minetest.register_on_generated(function(minp, maxp, blockseed) + local gennotify = minetest.get_mapgen_object("gennotify") + local poslist = gennotify["dungeon"] or {} + for _, entry in ipairs(gennotify["temple"] or {}) do + table.insert(poslist, entry) + end + if #poslist == 0 then return end + + local noise = minetest.get_perlin(10115, 4, 0.5, 1) + local rand = PcgRandom(noise3d_integer(noise, poslist[1])) + + local candidates = {} + -- process at most 8 rooms to keep runtime of this predictable + local num_process = math.min(#poslist, 8) + for i = 1, num_process do + local room = find_walls(poslist[i]) + -- skip small rooms and everything that doesn't at least have 3 walls + if math.min(room.size.x, room.size.z) >= 4 and #room.walls >= 3 then + table.insert(candidates, room) + end + end + + local num_chests = rand:next(dungeon_loot.CHESTS_MIN, dungeon_loot.CHESTS_MAX) + num_chests = math.min(#candidates, num_chests) + local rooms = random_sample(rand, candidates, num_chests) + + for _, room in ipairs(rooms) do + -- choose place somewhere in front of any of the walls + local wall = room.walls[rand:next(1, #room.walls)] + local v, vi -- vector / axis that runs alongside the wall + if wall.facing.x ~= 0 then + v, vi = {x=0, y=0, z=1}, "z" + else + v, vi = {x=1, y=0, z=0}, "x" + end + local chestpos = vector.add(wall.pos, wall.facing) + local off = rand:next(-room.size[vi]/2 + 1, room.size[vi]/2 - 1) + chestpos = vector.add(chestpos, vector.multiply(v, off)) + + if minetest.get_node(chestpos).name == "air" then + -- make it face inwards to the room + local facedir = minetest.dir_to_facedir(vector.multiply(wall.facing, -1)) + minetest.add_node(chestpos, {name = "default:chest", param2 = facedir}) + populate_chest(chestpos, PcgRandom(noise3d_integer(noise, chestpos)), room.type) + end + end +end) diff --git a/mods/dye/init.lua b/mods/dye/init.lua index 54a07abc..42f59cf9 100644 --- a/mods/dye/init.lua +++ b/mods/dye/init.lua @@ -1,9 +1,4 @@ --- Other mods can use these for looping through available colors - dye = {} -dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"} -dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", - "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"} -- Make dye names and descriptions available globally @@ -25,55 +20,48 @@ dye.dyes = { {"pink", "Pink"}, } --- This collection of colors is partly a historic thing, partly something else - -local dyes = { - {"white", "White Dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}}, - {"grey", "Grey Dye", {dye=1, basecolor_grey=1, excolor_grey=1, unicolor_grey=1}}, - {"dark_grey", "Dark Grey Dye", {dye=1, basecolor_darkgrey=1, excolor_darkgrey=1, unicolor_darkgrey=1}}, - {"black", "Black Dye", {dye=1, basecolor_black=1, excolor_black=1, unicolor_black=1}}, - {"violet", "Violet Dye", {dye=1, basecolor_violet=1, excolor_violet=1, unicolor_violet=1}}, - {"blue", "Blue Dye", {dye=1, basecolor_blue=1, excolor_blue=1, unicolor_blue=1}}, - {"cyan", "Cyan Dye", {dye=1, basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}}, - {"dark_green", "Dark Green Dye", {dye=1, basecolor_dark_green=1, excolor_dark_green=1, unicolor_dark_green=1}}, - {"green", "Green Dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_green=1}}, - {"yellow", "Yellow Dye", {dye=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}}, - {"brown", "Brown Dye", {dye=1, basecolor_brown=1, excolor_brown=1, unicolor_brown=1}}, - {"orange", "Orange Dye", {dye=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}}, - {"red", "Red Dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_red=1}}, - {"magenta", "Magenta Dye", {dye=1, basecolor_magenta=1, excolor_magenta=1, unicolor_magenta=1}}, - {"pink", "Pink Dye", {dye=1, basecolor_pink=1, excolor_pink=1, unicolor_rose=1}}, -} - -- Define items -for _, row in ipairs(dyes) do +for _, row in ipairs(dye.dyes) do local name = row[1] local description = row[2] - local groups = row[3] - local item_name = "dye:" .. name - local item_image = "dye_" .. name .. ".png" - minetest.register_craftitem(item_name, { - inventory_image = item_image, - description = description, + local groups = {dye = 1} + groups["color_" .. name] = 1 + + minetest.register_craftitem("dye:" .. name, { + inventory_image = "dye_" .. name .. ".png", + description = description .. " Dye", groups = groups }) + minetest.register_craft({ - type = "shapeless", - output = item_name .. " 4", - recipe = {"group:flower,color_" .. name}, + output = "dye:" .. name .. " 4", + recipe = { + {"group:flower,color_" .. name} + }, }) end --- Manually add coal->black dye +-- Manually add coal -> black dye minetest.register_craft({ - type = "shapeless", output = "dye:black 4", - recipe = {"group:coal"}, + recipe = { + {"group:coal"} + }, +}) + +-- Manually add blueberries->violet dye + +minetest.register_craft({ + output = "dye:violet 2", + recipe = { + {"default:blueberries"} + }, }) -- Mix recipes + local dye_recipes = { -- src1, src2, dst -- RYB mixes diff --git a/mods/farming/README.txt b/mods/farming/README.txt index 3ccd8c30..d46748d7 100644 --- a/mods/farming/README.txt +++ b/mods/farming/README.txt @@ -35,3 +35,6 @@ Created by Gambit (CC BY 3.0): farming_flour.png farming_cotton_seed.png farming_wheat_seed.png + +Created by Napiophelios (CC BY-SA 3.0): + farming_cotton.png diff --git a/mods/farming/api.lua b/mods/farming/api.lua index 150301ad..4a7b93df 100644 --- a/mods/farming/api.lua +++ b/mods/farming/api.lua @@ -83,13 +83,6 @@ farming.register_hoe = function(name, def) if def.inventory_image == nil then def.inventory_image = "unknown_item.png" end - if def.recipe == nil then - def.recipe = { - {"air","air",""}, - {"","group:stick",""}, - {"","group:stick",""} - } - end if def.max_uses == nil then def.max_uses = 30 end @@ -104,18 +97,18 @@ farming.register_hoe = function(name, def) sound = {breaks = "default_tool_breaks"}, }) -- Register its recipe - if def.material == nil then + if def.recipe then minetest.register_craft({ output = name:sub(2), recipe = def.recipe }) - else + elseif def.material then minetest.register_craft({ output = name:sub(2), recipe = { - {def.material, def.material, ""}, - {"", "group:stick", ""}, - {"", "group:stick", ""} + {def.material, def.material}, + {"", "group:stick"}, + {"", "group:stick"} } }) end @@ -144,12 +137,14 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname) local under = minetest.get_node(pt.under) local above = minetest.get_node(pt.above) - if minetest.is_protected(pt.under, placer:get_player_name()) then - minetest.record_protection_violation(pt.under, placer:get_player_name()) + local player_name = placer and placer:get_player_name() or "" + + if minetest.is_protected(pt.under, player_name) then + minetest.record_protection_violation(pt.under, player_name) return end - if minetest.is_protected(pt.above, placer:get_player_name()) then - minetest.record_protection_violation(pt.above, placer:get_player_name()) + if minetest.is_protected(pt.above, player_name) then + minetest.record_protection_violation(pt.above, player_name) return end @@ -180,7 +175,7 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname) minetest.add_node(pt.above, {name = plantname, param2 = 1}) tick(pt.above) if not (creative and creative.is_enabled_for - and creative.is_enabled_for(placer:get_player_name())) then + and creative.is_enabled_for(player_name)) then itemstack:take_item() end return itemstack @@ -310,7 +305,8 @@ farming.register_plant = function(name, def) local node = minetest.get_node(under) local udef = minetest.registered_nodes[node.name] if udef and udef.on_rightclick and - not (placer and placer:get_player_control().sneak) then + not (placer and placer:is_player() and + placer:get_player_control().sneak) then return udef.on_rightclick(under, node, placer, itemstack, pointed_thing) or itemstack end @@ -327,7 +323,7 @@ farming.register_plant = function(name, def) minetest.register_craftitem(":" .. mname .. ":" .. pname, { description = pname:gsub("^%l", string.upper), inventory_image = mname .. "_" .. pname .. ".png", - groups = {flammable = 2}, + groups = def.groups or {flammable = 2}, }) -- Register growing steps diff --git a/mods/farming/hoes.lua b/mods/farming/hoes.lua index 5aae3903..d6a65650 100644 --- a/mods/farming/hoes.lua +++ b/mods/farming/hoes.lua @@ -16,27 +16,32 @@ farming.register_hoe(":farming:hoe_stone", { farming.register_hoe(":farming:hoe_steel", { description = "Steel Hoe", inventory_image = "farming_tool_steelhoe.png", - max_uses = 200, + max_uses = 500, material = "default:steel_ingot" }) +-- The following are deprecated by removing the 'material' field to prevent +-- crafting and removing from creative inventory, to cause them to eventually +-- disappear from worlds. The registrations should be removed in a future +-- release. + farming.register_hoe(":farming:hoe_bronze", { description = "Bronze Hoe", inventory_image = "farming_tool_bronzehoe.png", max_uses = 220, - material = "default:bronze_ingot" + groups = {not_in_creative_inventory = 1}, }) farming.register_hoe(":farming:hoe_mese", { description = "Mese Hoe", inventory_image = "farming_tool_mesehoe.png", max_uses = 350, - material = "default:mese_crystal" + groups = {not_in_creative_inventory = 1}, }) farming.register_hoe(":farming:hoe_diamond", { description = "Diamond Hoe", inventory_image = "farming_tool_diamondhoe.png", max_uses = 500, - material = "default:diamond" + groups = {not_in_creative_inventory = 1}, }) diff --git a/mods/farming/init.lua b/mods/farming/init.lua index 667a6685..723201de 100644 --- a/mods/farming/init.lua +++ b/mods/farming/init.lua @@ -1,13 +1,18 @@ -- Global farming namespace + farming = {} farming.path = minetest.get_modpath("farming") + -- Load files + dofile(farming.path .. "/api.lua") dofile(farming.path .. "/nodes.lua") dofile(farming.path .. "/hoes.lua") + -- WHEAT + farming.register_plant("farming:wheat", { description = "Wheat Seed", paramtype2 = "meshoptions", @@ -16,20 +21,21 @@ farming.register_plant("farming:wheat", { minlight = 13, maxlight = default.LIGHT_MAX, fertility = {"grassland"}, - groups = {flammable = 4}, + groups = {food_wheat = 1, flammable = 4}, place_param2 = 3, }) + minetest.register_craftitem("farming:flour", { description = "Flour", inventory_image = "farming_flour.png", - groups = {flammable = 1}, + groups = {food_flour = 1, flammable = 1}, }) minetest.register_craftitem("farming:bread", { description = "Bread", inventory_image = "farming_bread.png", on_use = minetest.item_eat(5), - groups = {flammable = 2}, + groups = {food_bread = 1, flammable = 2}, }) minetest.register_craft({ @@ -45,7 +51,9 @@ minetest.register_craft({ recipe = "farming:flour" }) + -- Cotton + farming.register_plant("farming:cotton", { description = "Cotton Seed", inventory_image = "farming_cotton_seed.png", @@ -56,7 +64,11 @@ farming.register_plant("farming:cotton", { groups = {flammable = 4}, }) -minetest.register_alias("farming:string", "farming:cotton") +minetest.register_craftitem("farming:string", { + description = "String", + inventory_image = "farming_string.png", + groups = {flammable = 2}, +}) minetest.register_craft({ output = "wool:white", @@ -66,7 +78,17 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "farming:string 2", + recipe = { + {"farming:cotton"}, + {"farming:cotton"}, + } +}) + + -- Straw + minetest.register_craft({ output = "farming:straw 3", recipe = { @@ -83,7 +105,9 @@ minetest.register_craft({ } }) + -- Fuels + minetest.register_craft({ type = "fuel", recipe = "farming:straw", @@ -102,6 +126,12 @@ minetest.register_craft({ burntime = 1, }) +minetest.register_craft({ + type = "fuel", + recipe = "farming:string", + burntime = 1, +}) + minetest.register_craft({ type = "fuel", recipe = "farming:hoe_wood", diff --git a/mods/farming/nodes.lua b/mods/farming/nodes.lua index 1e746ecd..cc9d1f66 100644 --- a/mods/farming/nodes.lua +++ b/mods/farming/nodes.lua @@ -30,6 +30,14 @@ minetest.override_item("default:dirt_with_rainforest_litter", { } }) +minetest.override_item("default:dirt_with_coniferous_litter", { + soil = { + base = "default:dirt_with_coniferous_litter", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + minetest.register_node("farming:soil", { description = "Soil", tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"}, @@ -105,7 +113,8 @@ stairs.register_stair_and_slab( {"farming_straw.png"}, "Straw Stair", "Straw Slab", - default.node_sound_leaves_defaults() + default.node_sound_leaves_defaults(), + true ) minetest.register_abm({ diff --git a/mods/farming/textures/farming_cotton.png b/mods/farming/textures/farming_cotton.png index e2bbfd7a..8aa50e4e 100644 Binary files a/mods/farming/textures/farming_cotton.png and b/mods/farming/textures/farming_cotton.png differ diff --git a/mods/farming/textures/farming_string.png b/mods/farming/textures/farming_string.png new file mode 100644 index 00000000..e2bbfd7a Binary files /dev/null and b/mods/farming/textures/farming_string.png differ diff --git a/mods/fire/README.txt b/mods/fire/README.txt index 099da1c2..25ba26ef 100644 --- a/mods/fire/README.txt +++ b/mods/fire/README.txt @@ -4,8 +4,8 @@ See license.txt for license information. Authors of source code ---------------------- -Originally by Perttu Ahola (celeron55) (LGPL 2.1) -Various Minetest developers and contributors (LGPL 2.1) +Originally by Perttu Ahola (celeron55) (LGPLv2.1+) +Various Minetest developers and contributors (LGPLv2.1+) Authors of media (textures and sounds) -------------------------------------- diff --git a/mods/fire/init.lua b/mods/fire/init.lua index ebbf9474..854c5afb 100644 --- a/mods/fire/init.lua +++ b/mods/fire/init.lua @@ -2,11 +2,38 @@ fire = {} +-- 'Enable fire' setting + +local fire_enabled = minetest.settings:get_bool("enable_fire") +if fire_enabled == nil then + -- enable_fire setting not specified, check for disable_fire + local fire_disabled = minetest.settings:get_bool("disable_fire") + if fire_disabled == nil then + -- Neither setting specified, check whether singleplayer + fire_enabled = minetest.is_singleplayer() + else + fire_enabled = not fire_disabled + end +end -- -- Items -- +-- Flood flame function + +local function flood_flame(pos, oldnode, newnode) + -- Play flame extinguish sound if liquid is not an 'igniter' + local nodedef = minetest.registered_items[newnode.name] + if not (nodedef and nodedef.groups and + nodedef.groups.igniter and nodedef.groups.igniter > 0) then + minetest.sound_play("fire_extinguish_flame", + {pos = pos, max_hear_distance = 16, gain = 0.15}) + end + -- Remove the flame + return false +end + -- Flame nodes minetest.register_node("fire:basic_flame", { @@ -28,22 +55,30 @@ minetest.register_node("fire:basic_flame", { walkable = false, buildable_to = true, sunlight_propagates = true, + floodable = true, damage_per_second = 4, groups = {igniter = 2, dig_immediate = 3, not_in_creative_inventory = 1}, - on_timer = function(pos) - --local f = minetest.find_node_near(pos, 1, {"group:flammable"}) - --if not f then - minetest.remove_node(pos) - -- return - --end - -- Restart timer - return false - end, drop = "", - on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(20, 30)) + on_timer = function(pos) + local f = minetest.find_node_near(pos, 1, {"group:flammable"}) + if not fire_enabled or not f then + minetest.remove_node(pos) + return + end + -- Restart timer + return true end, + + on_construct = function(pos) + if not fire_enabled then + minetest.remove_node(pos) + else + minetest.get_node_timer(pos):start(math.random(20, 30)) + end + end, + + on_flood = flood_flame, }) minetest.register_node("fire:permanent_flame", { @@ -66,9 +101,12 @@ minetest.register_node("fire:permanent_flame", { walkable = false, buildable_to = true, sunlight_propagates = true, + floodable = true, damage_per_second = 4, groups = {igniter = 2, dig_immediate = 3}, drop = "", + + on_flood = flood_flame, }) @@ -169,7 +207,7 @@ if flame_sound then 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 ppos = player:get_pos() local areamin = vector.subtract(ppos, radius) local areamax = vector.add(ppos, radius) local fpos, num = minetest.find_nodes_in_area( @@ -271,51 +309,7 @@ end -- ABMs -- --- Extinguish all flames quickly with water, snow, ice - -minetest.register_abm({ - label = "Extinguish flame", - nodenames = {"fire:basic_flame", "fire:permanent_flame"}, - neighbors = {"group:puts_out_fire"}, - interval = 3, - chance = 1, - catch_up = false, - 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.15}) - end, -}) - - --- Enable the following ABMs according to 'enable fire' setting ---[[ -local fire_enabled = minetest.settings:get_bool("enable_fire") -if fire_enabled == nil then - -- enable_fire setting not specified, check for disable_fire - local fire_disabled = minetest.settings:get_bool("disable_fire") - if fire_disabled == nil then - -- Neither setting specified, check whether singleplayer - fire_enabled = minetest.is_singleplayer() - else - fire_enabled = not fire_disabled - end -end - -if not fire_enabled then - - -- Remove basic flames only if fire disabled - - minetest.register_abm({ - label = "Remove disabled fire", - nodenames = {"fire:basic_flame"}, - interval = 7, - chance = 1, - catch_up = false, - action = minetest.remove_node, - }) - -else -- Fire enabled +if fire_enabled then -- Ignite neighboring nodes, add basic flames @@ -327,10 +321,6 @@ else -- Fire enabled chance = 12, catch_up = false, action = function(pos, node, active_object_count, active_object_count_wider) - -- If there is water or stuff like that around node, don't ignite - if minetest.find_node_near(pos, 1, {"group:puts_out_fire"}) then - return - end local p = minetest.find_node_near(pos, 1, {"air"}) if p then minetest.set_node(p, {name = "fire:basic_flame"}) @@ -362,4 +352,4 @@ else -- Fire enabled end, }) -end]] +end diff --git a/mods/fireflies/README.txt b/mods/fireflies/README.txt new file mode 100644 index 00000000..7382578d --- /dev/null +++ b/mods/fireflies/README.txt @@ -0,0 +1,22 @@ +Minetest Game mod: fireflies +============================ +Adds fireflies to the world on mapgen, which can then be caught in a net and placed in +bottles to provide light. + +Authors of source code +---------------------- +Shara RedCat (MIT) + +Authors of media (textures) +--------------------------- +Shara RedCat (CC BY-SA 3.0): + fireflies_firefly.png + fireflies_firefly_animated.png + fireflies_bugnet.png + fireflies_bottle.png + fireflies_bottle_animated.png + +fireflies_bugnet.png is modified from a texture by tenplus1 (CC0) + +fireflies_bottle.png and fireflies_bottle_animated.png are +modified from a texture by Vanessa Ezekowitz (CC BY-SA 3.0) \ No newline at end of file diff --git a/mods/fireflies/depends.txt b/mods/fireflies/depends.txt new file mode 100644 index 00000000..e0585b46 --- /dev/null +++ b/mods/fireflies/depends.txt @@ -0,0 +1,2 @@ +default +vessels \ No newline at end of file diff --git a/mods/fireflies/init.lua b/mods/fireflies/init.lua new file mode 100644 index 00000000..44d4a31d --- /dev/null +++ b/mods/fireflies/init.lua @@ -0,0 +1,285 @@ +-- firefly +minetest.register_node("fireflies:firefly", { + description = "Firefly", + drawtype = "plantlike", + tiles = {{ + name = "fireflies_firefly_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + }}, + inventory_image = "fireflies_firefly.png", + wield_image = "fireflies_firefly.png", + waving = 1, + paramtype = "light", + sunlight_propagates = true, + buildable_to = true, + walkable = false, + groups = {catchable = 1}, + selection_box = { + type = "fixed", + fixed = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1}, + }, + light_source = 6, + floodable = true, + on_place = function(itemstack, placer, pointed_thing) + local player_name = placer:get_player_name() + local pos = pointed_thing.above + + if not minetest.is_protected(pos, player_name) and + not minetest.is_protected(pointed_thing.under, player_name) and + minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name = "fireflies:firefly"}) + minetest.get_node_timer(pos):start(1) + itemstack:take_item() + end + return itemstack + end, + on_timer = function(pos, elapsed) + if minetest.get_node_light(pos) > 11 then + minetest.set_node(pos, {name = "fireflies:hidden_firefly"}) + end + minetest.get_node_timer(pos):start(30) + end +}) + +minetest.register_node("fireflies:hidden_firefly", { + description = "Hidden Firefly", + drawtype = "airlike", + inventory_image = "fireflies_firefly.png", + wield_image = "fireflies_firefly.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + drop = "", + groups = {not_in_creative_inventory = 1}, + floodable = true, + on_place = function(itemstack, placer, pointed_thing) + local player_name = placer:get_player_name() + local pos = pointed_thing.above + + if not minetest.is_protected(pos, player_name) and + not minetest.is_protected(pointed_thing.under, player_name) and + minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name = "fireflies:hidden_firefly"}) + minetest.get_node_timer(pos):start(1) + itemstack:take_item() + end + return itemstack + end, + on_timer = function(pos, elapsed) + if minetest.get_node_light(pos) <= 11 then + minetest.set_node(pos, {name = "fireflies:firefly"}) + end + minetest.get_node_timer(pos):start(30) + end +}) + + +-- bug net +minetest.register_tool("fireflies:bug_net", { + description = "Bug Net", + inventory_image = "fireflies_bugnet.png", + on_use = function(itemstack, player, pointed_thing) + if not pointed_thing or pointed_thing.type ~= "node" or + minetest.is_protected(pointed_thing.under, player:get_player_name()) then + return + end + local node_name = minetest.get_node(pointed_thing.under).name + local inv = player:get_inventory() + if minetest.get_item_group(node_name, "catchable") == 1 then + minetest.set_node(pointed_thing.under, {name = "air"}) + local stack = ItemStack(node_name.." 1") + local leftover = inv:add_item("main", stack) + if leftover:get_count() > 0 then + minetest.add_item(pointed_thing.under, node_name.." 1") + end + end + if not (creative and creative.is_enabled_for(player:get_player_name())) then + itemstack:add_wear(256) + return itemstack + end + end +}) + +minetest.register_craft( { + output = "fireflies:bug_net", + recipe = { + {"farming:string", "farming:string"}, + {"farming:string", "farming:string"}, + {"default:stick", ""} + } +}) + + +-- firefly in a bottle +minetest.register_node("fireflies:firefly_bottle", { + description = "Firefly in a Bottle", + inventory_image = "fireflies_bottle.png", + wield_image = "fireflies_bottle.png", + tiles = {{ + name = "fireflies_bottle_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + }}, + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + light_source = 9, + walkable = false, + groups = {dig_immediate = 3, attached_node = 1}, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + sounds = default.node_sound_glass_defaults(), + on_rightclick = function(pos, node, player, itemstack, pointed_thing) + local lower_pos = {x = pos.x, y = pos.y + 1, z = pos.z} + if minetest.is_protected(pos, player:get_player_name()) or + minetest.get_node(lower_pos).name ~= "air" then + return + end + + local upper_pos = {x = pos.x, y = pos.y + 2, z = pos.z} + local firefly_pos + + if not minetest.is_protected(upper_pos, player:get_player_name()) and + minetest.get_node(upper_pos).name == "air" then + firefly_pos = upper_pos + elseif not minetest.is_protected(lower_pos, player:get_player_name()) then + firefly_pos = lower_pos + end + + if firefly_pos then + minetest.set_node(pos, {name = "vessels:glass_bottle"}) + minetest.set_node(firefly_pos, {name = "fireflies:firefly"}) + minetest.get_node_timer(firefly_pos):start(1) + end + end +}) + +minetest.register_craft( { + output = "fireflies:firefly_bottle", + recipe = { + {"fireflies:firefly"}, + {"vessels:glass_bottle"} + } +}) + + +-- register fireflies as decorations + +if minetest.get_mapgen_setting("mg_name") == "v6" then + + minetest.register_decoration({ + name = "fireflies:firefly_low", + deco_type = "simple", + place_on = "default:dirt_with_grass", + place_offset_y = 2, + sidelen = 80, + fill_ratio = 0.0002, + y_max = 31000, + y_min = 1, + decoration = "fireflies:hidden_firefly", + }) + + minetest.register_decoration({ + name = "fireflies:firefly_high", + deco_type = "simple", + place_on = "default:dirt_with_grass", + place_offset_y = 3, + sidelen = 80, + fill_ratio = 0.0002, + y_max = 31000, + y_min = 1, + decoration = "fireflies:hidden_firefly", + }) + +else + + minetest.register_decoration({ + name = "fireflies:firefly_low", + deco_type = "simple", + place_on = { + "default:dirt_with_grass", + "default:dirt_with_coniferous_litter", + "default:dirt_with_rainforest_litter", + "default:dirt" + }, + place_offset_y = 2, + sidelen = 80, + fill_ratio = 0.0005, + biomes = { + "deciduous_forest", + "coniferous_forest", + "rainforest", + "rainforest_swamp" + }, + y_max = 31000, + y_min = -1, + decoration = "fireflies:hidden_firefly", + }) + + minetest.register_decoration({ + name = "fireflies:firefly_high", + deco_type = "simple", + place_on = { + "default:dirt_with_grass", + "default:dirt_with_coniferous_litter", + "default:dirt_with_rainforest_litter", + "default:dirt" + }, + place_offset_y = 3, + sidelen = 80, + fill_ratio = 0.0005, + biomes = { + "deciduous_forest", + "coniferous_forest", + "rainforest", + "rainforest_swamp" + }, + y_max = 31000, + y_min = -1, + decoration = "fireflies:hidden_firefly", + }) + +end + + +-- get decoration IDs +local firefly_low = minetest.get_decoration_id("fireflies:firefly_low") +local firefly_high = minetest.get_decoration_id("fireflies:firefly_high") + +minetest.set_gen_notify({decoration = true}, {firefly_low, firefly_high}) + +-- start nodetimers +minetest.register_on_generated(function(minp, maxp, blockseed) + local gennotify = minetest.get_mapgen_object("gennotify") + local poslist = {} + + for _, pos in ipairs(gennotify["decoration#"..firefly_low] or {}) do + local firefly_low_pos = {x = pos.x, y = pos.y + 3, z = pos.z} + table.insert(poslist, firefly_low_pos) + end + for _, pos in ipairs(gennotify["decoration#"..firefly_high] or {}) do + local firefly_high_pos = {x = pos.x, y = pos.y + 4, z = pos.z} + table.insert(poslist, firefly_high_pos) + end + + if #poslist ~= 0 then + for i = 1, #poslist do + local pos = poslist[i] + minetest.get_node_timer(pos):start(1) + end + end +end) diff --git a/mods/fireflies/license.txt b/mods/fireflies/license.txt new file mode 100644 index 00000000..eebdad63 --- /dev/null +++ b/mods/fireflies/license.txt @@ -0,0 +1,58 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (c) 2018 Shara RedCat + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2018 Shara RedCat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ \ No newline at end of file diff --git a/mods/fireflies/textures/fireflies_bottle.png b/mods/fireflies/textures/fireflies_bottle.png new file mode 100644 index 00000000..ecca0363 Binary files /dev/null and b/mods/fireflies/textures/fireflies_bottle.png differ diff --git a/mods/fireflies/textures/fireflies_bottle_animated.png b/mods/fireflies/textures/fireflies_bottle_animated.png new file mode 100644 index 00000000..96062b3c Binary files /dev/null and b/mods/fireflies/textures/fireflies_bottle_animated.png differ diff --git a/mods/fireflies/textures/fireflies_bugnet.png b/mods/fireflies/textures/fireflies_bugnet.png new file mode 100644 index 00000000..8ec3d33b Binary files /dev/null and b/mods/fireflies/textures/fireflies_bugnet.png differ diff --git a/mods/fireflies/textures/fireflies_firefly.png b/mods/fireflies/textures/fireflies_firefly.png new file mode 100644 index 00000000..c0866894 Binary files /dev/null and b/mods/fireflies/textures/fireflies_firefly.png differ diff --git a/mods/fireflies/textures/fireflies_firefly_animated.png b/mods/fireflies/textures/fireflies_firefly_animated.png new file mode 100644 index 00000000..e6932e37 Binary files /dev/null and b/mods/fireflies/textures/fireflies_firefly_animated.png differ diff --git a/mods/flowers/README.txt b/mods/flowers/README.txt index 6fd30942..4b3149c4 100644 --- a/mods/flowers/README.txt +++ b/mods/flowers/README.txt @@ -26,3 +26,5 @@ yyt16384 (CC BY-SA 3.0): paramat (CC BY-SA 3.0): flowers_dandelion_yellow.png -- Derived from RHRhino's texture + flowers_tulip_black.png -- Derived from RHRhino's texture + flowers_chrysanthemum_green.png diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index 529d2258..414b3708 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -75,6 +75,12 @@ flowers.datas = { {-4 / 16, -0.5, -4 / 16, 4 / 16, -2 / 16, 4 / 16}, {color_yellow = 1, flammable = 1} }, + { + "chrysanthemum_green", + "Green Chrysanthemum", + {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + {color_green = 1, flammable = 1} + }, { "geranium", "Blue Geranium", @@ -93,6 +99,12 @@ flowers.datas = { {-5 / 16, -0.5, -5 / 16, 5 / 16, -2 / 16, 5 / 16}, {color_white = 1, flammable = 1} }, + { + "tulip_black", + "Black Tulip", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 3 / 16, 2 / 16}, + {color_black = 1, flammable = 1} + }, } for _,item in pairs(flowers.datas) do @@ -127,24 +139,29 @@ function flowers.flower_spread(pos, node) local pos0 = vector.subtract(pos, 4) local pos1 = vector.add(pos, 4) + -- Testing shows that a threshold of 3 results in an appropriate maximum + -- density of approximately 7 flora per 9x9 area. if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 3 then return end local soils = minetest.find_nodes_in_area_under_air( pos0, pos1, "group:soil") - if #soils > 0 then - local seedling = soils[math.random(#soils)] - local seedling_above = - {x = seedling.x, y = seedling.y + 1, z = seedling.z} - light = minetest.get_node_light(seedling_above) - if not light or light < 13 or - -- Desert sand is in the soil group - minetest.get_node(seedling).name == "default:desert_sand" then - return + local num_soils = #soils + if num_soils >= 1 then + for si = 1, math.min(3, num_soils) do + local soil = soils[math.random(num_soils)] + local soil_name = minetest.get_node(soil).name + local soil_above = {x = soil.x, y = soil.y + 1, z = soil.z} + light = minetest.get_node_light(soil_above) + if light and light >= 13 and + -- Only spread to same surface node + soil_name == under.name and + -- Desert sand is in the soil group + soil_name ~= "default:desert_sand" then + minetest.set_node(soil_above, {name = node.name}) + end end - - minetest.set_node(seedling_above, {name = node.name}) end end @@ -152,7 +169,7 @@ minetest.register_abm({ label = "Flower spread", nodenames = {"group:flora"}, interval = 13, - chance = 96, + chance = 300, action = function(...) flowers.flower_spread(...) end, @@ -173,7 +190,7 @@ minetest.register_node("flowers:mushroom_red", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, attached_node = 1, flammable = 1}, + groups = {snappy = 3, attached_node = 1, flammable = 1, mushroom = 1}, sounds = default.node_sound_leaves_defaults(), on_use = minetest.item_eat(-5), selection_box = { @@ -192,7 +209,7 @@ minetest.register_node("flowers:mushroom_brown", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, attached_node = 1, flammable = 1}, + groups = {food_mushroom = 1, snappy = 3, attached_node = 1, flammable = 1, mushroom = 1}, sounds = default.node_sound_leaves_defaults(), on_use = minetest.item_eat(1), selection_box = { @@ -204,38 +221,34 @@ minetest.register_node("flowers:mushroom_brown", { -- Mushroom spread and death +function flowers.mushroom_spread(pos, node) + if minetest.get_node_light(pos, nil) == 15 then + minetest.remove_node(pos) + return + end + local positions = minetest.find_nodes_in_area_under_air( + {x = pos.x - 1, y = pos.y - 2, z = pos.z - 1}, + {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1}, + {"group:soil", "group:tree"}) + if #positions == 0 then + return + end + local pos2 = positions[math.random(#positions)] + pos2.y = pos2.y + 1 + if minetest.get_node_light(pos, 0.5) <= 3 and + minetest.get_node_light(pos2, 0.5) <= 3 then + minetest.set_node(pos2, {name = node.name}) + end +end + minetest.register_abm({ label = "Mushroom spread", nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"}, interval = 11, - chance = 50, - action = function(pos, node) - if minetest.get_node_light(pos, nil) == 15 then - minetest.remove_node(pos) - return - end - local random = { - x = pos.x + math.random(-2, 2), - y = pos.y + math.random(-1, 1), - z = pos.z + math.random(-2, 2) - } - local random_node = minetest.get_node_or_nil(random) - if not random_node or random_node.name ~= "air" then - return - end - local node_under = minetest.get_node_or_nil({x = random.x, - y = random.y - 1, z = random.z}) - if not node_under then - return - end - - if (minetest.get_item_group(node_under.name, "soil") ~= 0 or - minetest.get_item_group(node_under.name, "tree") ~= 0) and - minetest.get_node_light(pos, 0.5) <= 3 and - minetest.get_node_light(random, 0.5) <= 3 then - minetest.set_node(random, {name = node.name}) - end - end + chance = 150, + action = function(...) + flowers.mushroom_spread(...) + end, }) @@ -264,7 +277,6 @@ minetest.register_node("flowers:waterlily", { liquids_pointable = true, walkable = false, buildable_to = true, - sunlight_propagates = true, floodable = true, groups = {snappy = 3, flower = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), @@ -280,12 +292,17 @@ minetest.register_node("flowers:waterlily", { on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above - local node = minetest.get_node(pointed_thing.under).name - local def = minetest.registered_nodes[node] - local player_name = placer:get_player_name() + local node = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[node.name] + local player_name = placer and placer:get_player_name() or "" + + if def and def.on_rightclick then + return def.on_rightclick(pointed_thing.under, node, placer, itemstack, + pointed_thing) + end if def and def.liquidtype == "source" and - minetest.get_item_group(node, "water") > 0 then + minetest.get_item_group(node.name, "water") > 0 then if not minetest.is_protected(pos, player_name) then minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)}) diff --git a/mods/flowers/mapgen.lua b/mods/flowers/mapgen.lua index 582797a9..49dd0b95 100644 --- a/mods/flowers/mapgen.lua +++ b/mods/flowers/mapgen.lua @@ -2,8 +2,9 @@ -- Mgv6 -- -local function register_mgv6_flower(name) +local function register_mgv6_flower(flower_name) minetest.register_decoration({ + name = "flowers:"..flower_name, deco_type = "simple", place_on = {"default:dirt_with_grass"}, sidelen = 16, @@ -15,14 +16,15 @@ local function register_mgv6_flower(name) octaves = 3, persist = 0.6 }, - y_min = 1, y_max = 30, - decoration = "flowers:"..name, + y_min = 1, + decoration = "flowers:"..flower_name, }) end -local function register_mgv6_mushroom(name) +local function register_mgv6_mushroom(mushroom_name) minetest.register_decoration({ + name = "flowers:"..mushroom_name, deco_type = "simple", place_on = {"default:dirt_with_grass"}, sidelen = 16, @@ -34,9 +36,9 @@ local function register_mgv6_mushroom(name) octaves = 3, persist = 0.6 }, - y_min = 1, y_max = 30, - decoration = "flowers:"..name, + y_min = 1, + decoration = "flowers:"..mushroom_name, spawn_by = "default:tree", num_spawn_by = 1, }) @@ -44,7 +46,8 @@ end local function register_mgv6_waterlily() minetest.register_decoration({ - deco_type = "schematic", + name = "flowers:waterlily", + deco_type = "simple", place_on = {"default:dirt"}, sidelen = 16, noise_params = { @@ -55,10 +58,12 @@ local function register_mgv6_waterlily() octaves = 3, persist = 0.7 }, - y_min = 0, y_max = 0, - schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts", - rotation = "random", + y_min = 0, + decoration = "flowers:waterlily", + param2 = 0, + param2_max = 3, + place_offset_y = 1, }) end @@ -76,13 +81,14 @@ function flowers.register_mgv6_decorations() register_mgv6_waterlily() end - +-- TODO: figure out why we did commented these in the past -- -- All other biome API mapgens --- --[[ -local function register_flower(seed, name) + +local function register_flower(seed, flower_name) minetest.register_decoration({ + name = "flowers:"..flower_name, deco_type = "simple", place_on = {"default:dirt_with_grass"}, sidelen = 16, @@ -94,18 +100,18 @@ local function register_flower(seed, name) octaves = 3, persist = 0.6 }, - biomes = {"grassland", "deciduous_forest", "coniferous_forest", - "floatland_coniferous_forest"}, - y_min = 1, + biomes = {"grassland", "deciduous_forest", "floatland_grassland"}, y_max = 31000, - decoration = "flowers:"..name, + y_min = 1, + decoration = "flowers:"..flower_name, }) end -local function register_mushroom(name) +local function register_mushroom(mushroom_name) minetest.register_decoration({ + name = "flowers:"..mushroom_name, deco_type = "simple", - place_on = {"default:dirt_with_grass"}, + place_on = {"default:dirt_with_grass", "default:dirt_with_coniferous_litter"}, sidelen = 16, noise_params = { offset = 0, @@ -117,15 +123,16 @@ local function register_mushroom(name) }, biomes = {"deciduous_forest", "coniferous_forest", "floatland_coniferous_forest"}, - y_min = 1, y_max = 31000, - decoration = "flowers:"..name, + y_min = 1, + decoration = "flowers:"..mushroom_name, }) end local function register_waterlily() minetest.register_decoration({ - deco_type = "schematic", + name = "default:waterlily", + deco_type = "simple", place_on = {"default:dirt"}, sidelen = 16, noise_params = { @@ -137,10 +144,12 @@ local function register_waterlily() persist = 0.7 }, biomes = {"rainforest_swamp", "savanna_shore", "deciduous_forest_shore"}, - y_min = 0, y_max = 0, - schematic = minetest.get_modpath("flowers") .. "/schematics/waterlily.mts", - rotation = "random", + y_min = 0, + decoration = "flowers:waterlily", + param2 = 0, + param2_max = 3, + place_offset_y = 1, }) end @@ -148,24 +157,26 @@ function flowers.register_decorations() register_flower(436, "rose") register_flower(19822, "tulip") register_flower(1220999, "dandelion_yellow") + register_flower(800081, "chrysanthemum_green") register_flower(36662, "geranium") register_flower(1133, "viola") register_flower(73133, "dandelion_white") + register_flower(42, "tulip_black") register_mushroom("mushroom_brown") register_mushroom("mushroom_red") register_waterlily() end -]] --- +--]] -- Detect mapgen to select functions -- local mg_name = minetest.get_mapgen_setting("mg_name") if mg_name == "v6" then flowers.register_mgv6_decorations() -else +--else -- flowers.register_decorations() end + diff --git a/mods/flowers/schematics/waterlily.mts b/mods/flowers/schematics/waterlily.mts deleted file mode 100644 index 69e1d8e0..00000000 Binary files a/mods/flowers/schematics/waterlily.mts and /dev/null differ diff --git a/mods/flowers/textures/flowers_chrysanthemum_green.png b/mods/flowers/textures/flowers_chrysanthemum_green.png new file mode 100644 index 00000000..11980463 Binary files /dev/null and b/mods/flowers/textures/flowers_chrysanthemum_green.png differ diff --git a/mods/flowers/textures/flowers_tulip_black.png b/mods/flowers/textures/flowers_tulip_black.png new file mode 100644 index 00000000..1dd09f74 Binary files /dev/null and b/mods/flowers/textures/flowers_tulip_black.png differ diff --git a/mods/game_commands/README.txt b/mods/game_commands/README.txt new file mode 100644 index 00000000..a4516082 --- /dev/null +++ b/mods/game_commands/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: game_commands +================================ +See license.txt for license information. + +Authors of source code +---------------------- +rubenwardy (MIT) diff --git a/mods/killme/init.lua b/mods/game_commands/init.lua similarity index 96% rename from mods/killme/init.lua rename to mods/game_commands/init.lua index 9b674754..609c4a75 100644 --- a/mods/killme/init.lua +++ b/mods/game_commands/init.lua @@ -13,7 +13,8 @@ minetest.register_chatcommand("killme", { end end - -- There doesn't seem to be a way to get a default spawn pos from the lua API + -- There doesn't seem to be a way to get a default spawn pos + -- from the lua API return false, "No static_spawnpoint defined" end else diff --git a/mods/game_commands/license.txt b/mods/game_commands/license.txt new file mode 100644 index 00000000..fa855644 --- /dev/null +++ b/mods/game_commands/license.txt @@ -0,0 +1,24 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2017-2018 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. + +For more details: +https://opensource.org/licenses/MIT diff --git a/mods/map/README.txt b/mods/map/README.txt new file mode 100644 index 00000000..c91e0d97 --- /dev/null +++ b/mods/map/README.txt @@ -0,0 +1,44 @@ +Minetest Game mod: map +====================== +See license.txt for license information. + +Authors of source code +---------------------- +paramat (MIT) + +Authors of media (textures) +--------------------------- +TumeniNodes (CC BY-SA 3.0): + map_mapping_kit.png (map) + +paramat (CC BY-SA 3.0): + map_mapping_kit.png (compass and pen) + +Crafting +-------- +map:mapping_kit + +default:glass G +default:paper P +default:stick S +default:steel_ingot I +group:wood W +dye:black D + +GPS +IPI +WPD + +Usage +----- +In survival mode, use of the minimap requires the mapping kit item in your +inventory. It can take up to 5 seconds for adding to or removal from inventory +to have an effect, however to instantly allow the use of the minimap 'use' +(leftclick) the item. +Minimap radar mode is always disallowed in survival mode. + +Minimap and minimap radar mode are automatically allowed in creative mode and +for any player with the 'creative' privilege. + +The 'map.update_hud_flags()' function is global so can be redefined by a mod for +alternative behaviour. diff --git a/mods/map/depends.txt b/mods/map/depends.txt new file mode 100644 index 00000000..4b15f6a3 --- /dev/null +++ b/mods/map/depends.txt @@ -0,0 +1,3 @@ +default +dye +creative? diff --git a/mods/map/init.lua b/mods/map/init.lua new file mode 100644 index 00000000..72b04c70 --- /dev/null +++ b/mods/map/init.lua @@ -0,0 +1,81 @@ +-- Mod global namespace + +map = {} + + +-- Cache creative mode setting + +local creative_mode_cache = minetest.settings:get_bool("creative_mode") + + +-- Update HUD flags +-- Global to allow overriding + +function map.update_hud_flags(player) + local creative_enabled = + (creative and creative.is_enabled_for(player:get_player_name())) or + creative_mode_cache + + local minimap_enabled = creative_enabled or + player:get_inventory():contains_item("main", "map:mapping_kit") + local radar_enabled = creative_enabled + + player:hud_set_flags({ + minimap = minimap_enabled, + minimap_radar = radar_enabled + }) +end + + +-- Set HUD flags 'on joinplayer' + +minetest.register_on_joinplayer(function(player) + map.update_hud_flags(player) +end) + + +-- Cyclic update of HUD flags + +local function cyclic_update() + for _, player in ipairs(minetest.get_connected_players()) do + map.update_hud_flags(player) + end + minetest.after(5.3, cyclic_update) +end + +minetest.after(5.3, cyclic_update) + + +-- Mapping kit item + +minetest.register_craftitem("map:mapping_kit", { + description = "Mapping Kit\nUse with 'Minimap' key", + inventory_image = "map_mapping_kit.png", + stack_max = 1, + groups = {flammable = 3}, + + on_use = function(itemstack, user, pointed_thing) + map.update_hud_flags(user) + end, +}) + + +-- Crafting + +minetest.register_craft({ + output = "map:mapping_kit", + recipe = { + {"default:glass", "default:paper", "default:stick"}, + {"default:steel_ingot", "default:paper", "default:steel_ingot"}, + {"group:wood", "default:paper", "dye:black"}, + } +}) + + +-- Fuel + +minetest.register_craft({ + type = "fuel", + recipe = "map:mapping_kit", + burntime = 5, +}) diff --git a/mods/map/license.txt b/mods/map/license.txt new file mode 100644 index 00000000..a89f59c4 --- /dev/null +++ b/mods/map/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2017 paramat + +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) 2017 TumeniNodes +Copyright (C) 2017 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/map/textures/map_mapping_kit.png b/mods/map/textures/map_mapping_kit.png new file mode 100644 index 00000000..015b878a Binary files /dev/null and b/mods/map/textures/map_mapping_kit.png differ diff --git a/mods/player_api/README.txt b/mods/player_api/README.txt new file mode 100644 index 00000000..22d040cb --- /dev/null +++ b/mods/player_api/README.txt @@ -0,0 +1,32 @@ +Minetest Game mod: player_api +============================= +See license.txt for license information. + +Provides an API to allow multiple mods to set player models and textures. +Also sets the default model, texture, and player flags. + +Authors of source code +---------------------- +Originally by celeron55, Perttu Ahola (LGPLv2.1+) +Various Minetest developers and contributors (LGPLv2.1+) + +Authors of media (textures, models and sounds) +---------------------------------------------- +stujones11 (CC BY-SA 3.0): + character.b3d + character.blend -- Both derived from a model by MirceaKitsune (CC BY-SA 3.0) + +Jordach (CC BY-SA 3.0): + character.png + +paramat (CC BY-SA 3.0): + gui_hotbar.png + gui_hotbar_selected.png + +celeron55, Perttu Ahola (CC BY-SA 3.0): + player.png + player_back.png + +sonictechtonic (CC BY 3.0): +https://www.freesound.org/people/sonictechtonic/sounds/241872/ + player_damage.ogg diff --git a/mods/default/player.lua b/mods/player_api/api.lua similarity index 66% rename from mods/default/player.lua rename to mods/player_api/api.lua index 0a2078d6..e309b08d 100644 --- a/mods/default/player.lua +++ b/mods/player_api/api.lua @@ -1,42 +1,29 @@ -- Minetest 0.4 mod: player -- See README.txt for licensing and other information. +player_api = {} + -- Player animation blending -- Note: This is currently broken due to a bug in Irrlicht, leave at 0 local animation_blend = 0 -default.registered_player_models = { } +player_api.registered_models = { } -- Local for speed. -local models = default.registered_player_models +local models = player_api.registered_models -function default.player_register_model(name, def) +function player_api.register_model(name, def) models[name] = def end --- Default player appearance -default.player_register_model("character.b3d", { - animation_speed = 30, - textures = {"character.png", }, - animations = { - -- Standard animations. - stand = { x= 0, y= 79, }, - lay = { x=162, y=166, }, - walk = { x=168, y=187, }, - mine = { x=189, y=198, }, - walk_mine = { x=200, y=219, }, - sit = { x= 81, y=160, }, - }, -}) - -- Player stats and animations local player_model = {} local player_textures = {} local player_anim = {} local player_sneak = {} -default.player_attached = {} +player_api.player_attached = {} -function default.player_get_animation(player) +function player_api.get_animation(player) local name = player:get_player_name() return { model = player_model[name], @@ -46,7 +33,7 @@ function default.player_get_animation(player) end -- Called when a player's appearance needs to be updated -function default.player_set_model(player, model_name) +function player_api.set_model(player, model_name) local name = player:get_player_name() local model = models[model_name] if model then @@ -57,25 +44,33 @@ function default.player_set_model(player, model_name) mesh = model_name, textures = player_textures[name] or model.textures, visual = "mesh", - visual_size = model.visual_size or {x=1, y=1}, + visual_size = model.visual_size or {x = 1, y = 1}, + collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, + stepheight = model.stepheight or 0.6, + eye_height = model.eye_height or 1.47, }) - default.player_set_animation(player, "stand") + player_api.set_animation(player, "stand") else player:set_properties({ - textures = { "player.png", "player_back.png", }, + textures = {"player.png", "player_back.png"}, visual = "upright_sprite", + collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3}, + stepheight = 0.6, + eye_height = 1.625, }) end player_model[name] = model_name end -function default.player_set_textures(player, textures) +function player_api.set_textures(player, textures) local name = player:get_player_name() - player_textures[name] = textures - player:set_properties({textures = textures,}) + local model = models[player_model[name]] + local model_textures = model and model.textures or nil + player_textures[name] = textures or model_textures + player:set_properties({textures = textures or model_textures,}) end -function default.player_set_animation(player, anim_name, speed) +function player_api.set_animation(player, anim_name, speed) local name = player:get_player_name() if player_anim[name] == anim_name then return @@ -89,16 +84,6 @@ function default.player_set_animation(player, anim_name, speed) player:set_animation(anim, speed or model.animation_speed, animation_blend) end --- Update appearance when the player joins -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) - - player:hud_set_hotbar_image("gui_hotbar.png") - player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") -end) - minetest.register_on_leaveplayer(function(player) local name = player:get_player_name() player_model[name] = nil @@ -107,8 +92,8 @@ minetest.register_on_leaveplayer(function(player) end) -- Localize for better performance. -local player_set_animation = default.player_set_animation -local player_attached = default.player_attached +local player_set_animation = player_api.set_animation +local player_attached = player_api.player_attached -- Check each player and apply animations minetest.register_globalstep(function(dtime) diff --git a/mods/player_api/init.lua b/mods/player_api/init.lua new file mode 100644 index 00000000..7a1f353e --- /dev/null +++ b/mods/player_api/init.lua @@ -0,0 +1,34 @@ +dofile(minetest.get_modpath("player_api") .. "/api.lua") + +-- Default player appearance +player_api.register_model("character.b3d", { + animation_speed = 30, + textures = {"character.png", }, + animations = { + -- Standard animations. + stand = {x = 0, y = 79}, + lay = {x = 162, y = 166}, + walk = {x = 168, y = 187}, + mine = {x = 189, y = 198}, + walk_mine = {x = 200, y = 219}, + sit = {x = 81, y = 160}, + }, + collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, + stepheight = 0.6, + eye_height = 1.47, +}) + +-- Update appearance when the player joins +minetest.register_on_joinplayer(function(player) + player_api.player_attached[player:get_player_name()] = false + player_api.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 + ) + player:hud_set_hotbar_image("gui_hotbar.png") + player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") +end) diff --git a/mods/player_api/license.txt b/mods/player_api/license.txt new file mode 100644 index 00000000..69bb2f8e --- /dev/null +++ b/mods/player_api/license.txt @@ -0,0 +1,84 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2018 celeron55, Perttu Ahola +Copyright (C) 2011-2018 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) 2011-2018 celeron55, Perttu Ahola +Copyright (C) 2012-2018 Jordach +Copyright (C) 2018 stujones11 +Copyright (C) 2018 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 3.0 Unported (CC BY 3.0) +Copyright (C) 2014-2018 sonictechtonic + +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/player_api/models/character.b3d b/mods/player_api/models/character.b3d new file mode 100644 index 00000000..b3b772a4 Binary files /dev/null and b/mods/player_api/models/character.b3d differ diff --git a/mods/player_api/models/character.blend b/mods/player_api/models/character.blend new file mode 100644 index 00000000..652579c1 Binary files /dev/null and b/mods/player_api/models/character.blend differ diff --git a/mods/default/models/character.png b/mods/player_api/models/character.png similarity index 100% rename from mods/default/models/character.png rename to mods/player_api/models/character.png diff --git a/mods/default/sounds/player_damage.ogg b/mods/player_api/sounds/player_damage.ogg similarity index 100% rename from mods/default/sounds/player_damage.ogg rename to mods/player_api/sounds/player_damage.ogg diff --git a/mods/player_api/textures/gui_hotbar.png b/mods/player_api/textures/gui_hotbar.png new file mode 100644 index 00000000..7bc78875 Binary files /dev/null and b/mods/player_api/textures/gui_hotbar.png differ diff --git a/mods/player_api/textures/gui_hotbar_selected.png b/mods/player_api/textures/gui_hotbar_selected.png new file mode 100644 index 00000000..7203e9a7 Binary files /dev/null and b/mods/player_api/textures/gui_hotbar_selected.png differ diff --git a/mods/default/textures/player.png b/mods/player_api/textures/player.png similarity index 100% rename from mods/default/textures/player.png rename to mods/player_api/textures/player.png diff --git a/mods/default/textures/player_back.png b/mods/player_api/textures/player_back.png similarity index 100% rename from mods/default/textures/player_back.png rename to mods/player_api/textures/player_back.png diff --git a/mods/screwdriver/README.txt b/mods/screwdriver/README.txt index 9d39c58c..14c073e7 100644 --- a/mods/screwdriver/README.txt +++ b/mods/screwdriver/README.txt @@ -4,8 +4,8 @@ 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) +Originally by RealBadAngel, Maciej Kasatkin (LGPLv2.1+) +Various Minetest developers and contributors (LGPLv2.1+) License of media (textures) --------------------------- diff --git a/mods/screwdriver/init.lua b/mods/screwdriver/init.lua index dc498ea7..b1e58483 100644 --- a/mods/screwdriver/init.lua +++ b/mods/screwdriver/init.lua @@ -85,9 +85,10 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses) end local pos = pointed_thing.under + local player_name = user and user:get_player_name() or "" - if minetest.is_protected(pos, user:get_player_name()) then - minetest.record_protection_violation(pos, user:get_player_name()) + if minetest.is_protected(pos, player_name) then + minetest.record_protection_violation(pos, player_name) return end @@ -133,8 +134,8 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses) minetest.check_for_falling(pos) end - if not (creative and creative.is_enabled_for - and creative.is_enabled_for(user:get_player_name())) then + if not (creative and creative.is_enabled_for and + creative.is_enabled_for(player_name)) then itemstack:add_wear(65535 / ((uses or 200) - 1)) end diff --git a/mods/sethome/init.lua b/mods/sethome/init.lua index 13a33e57..4563381d 100644 --- a/mods/sethome/init.lua +++ b/mods/sethome/init.lua @@ -61,7 +61,7 @@ sethome.go = function(name) local pos = sethome.get(name) local player = minetest.get_player_by_name(name) if player and pos then - player:setpos(pos) + player:set_pos(pos) return true end return false @@ -89,7 +89,7 @@ minetest.register_chatcommand("sethome", { func = function(name) name = name or "" -- fallback to blank name if nil local player = minetest.get_player_by_name(name) - if player and sethome.set(name, player:getpos()) then + if player and sethome.set(name, player:get_pos()) then return true, "Home set!" end return false, "Player not found!" diff --git a/mods/sfinv/README.md b/mods/sfinv/README.md deleted file mode 100644 index 6ff33923..00000000 --- a/mods/sfinv/README.md +++ /dev/null @@ -1,21 +0,0 @@ -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/README.txt b/mods/sfinv/README.txt new file mode 100644 index 00000000..a7ac794f --- /dev/null +++ b/mods/sfinv/README.txt @@ -0,0 +1,13 @@ +Minetest Game mod: sfinv +======================== +See license.txt for license information. + +Simple Fast Inventory. +A cleaner, simpler, solution to having an advanced inventory in Minetest. +See game_api.txt for this mod's API. +Available for use outside of MTG here: +https://forum.minetest.net/viewtopic.php?t=19765 + +Authors of source code +---------------------- +rubenwardy (MIT) diff --git a/mods/sfinv/api.lua b/mods/sfinv/api.lua index bd6de1ed..cd5b5e8a 100644 --- a/mods/sfinv/api.lua +++ b/mods/sfinv/api.lua @@ -29,16 +29,14 @@ 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]" + return "tabheader[0,0;sfinv_nav_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 .. [[ +local theme_inv = [[ list[current_player;main;0,4.7;8,1;] list[current_player;main;0,5.85;8,3;8] ]] @@ -46,7 +44,6 @@ local theme_inv = default.gui_slots .. [[ 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 } @@ -84,9 +81,20 @@ function sfinv.get_formspec(player, context) return page:get(player, context) else local old_page = context.page - context.page = sfinv.get_homepage_name(player) + local home_page = sfinv.get_homepage_name(player) + + if old_page == home_page then + minetest.log("error", "[sfinv] Couldn't find " .. dump(old_page) .. + ", which is also the old page") + + return "" + end + + context.page = home_page assert(sfinv.pages[context.page], "[sfinv] Invalid homepage") - minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) .. " so using switching to homepage") + minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) .. + " so switching to homepage") + return sfinv.get_formspec(player, context) end end @@ -127,6 +135,11 @@ function sfinv.set_page(player, pagename) sfinv.set_player_inventory_formspec(player, context) end +function sfinv.get_page(player) + local context = sfinv.contexts[player:get_player_name()] + return context and context.page or sfinv.get_homepage_name(player) +end + minetest.register_on_joinplayer(function(player) if sfinv.enabled then sfinv.set_player_inventory_formspec(player) @@ -151,8 +164,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end -- Was a tab selected? - if fields.tabs and context.nav then - local tid = tonumber(fields.tabs) + if fields.sfinv_nav_tabs and context.nav then + local tid = tonumber(fields.sfinv_nav_tabs) if tid and tid > 0 then local id = context.nav[tid] local page = sfinv.pages[id] diff --git a/mods/sfinv/license.txt b/mods/sfinv/license.txt new file mode 100644 index 00000000..e27dc85f --- /dev/null +++ b/mods/sfinv/license.txt @@ -0,0 +1,24 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2016-2018 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. + +For more details: +https://opensource.org/licenses/MIT diff --git a/mods/spawn/README.txt b/mods/spawn/README.txt new file mode 100644 index 00000000..fc16c2a6 --- /dev/null +++ b/mods/spawn/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: spawn +======================== +See license.txt for license information. + +Authors of source code +---------------------- +paramat (MIT) diff --git a/mods/spawn/depends.txt b/mods/spawn/depends.txt new file mode 100644 index 00000000..548489e2 --- /dev/null +++ b/mods/spawn/depends.txt @@ -0,0 +1,2 @@ +default +beds? diff --git a/mods/spawn/init.lua b/mods/spawn/init.lua new file mode 100644 index 00000000..6707932c --- /dev/null +++ b/mods/spawn/init.lua @@ -0,0 +1,144 @@ +-- Disable by mapgen, setting or if 'static_spawnpoint' is set +-------------------------------------------------------------- + +local mg_name = minetest.get_mapgen_setting("mg_name") +if mg_name == "v6" or mg_name == "singlenode" or + minetest.settings:get("static_spawnpoint") or + minetest.settings:get_bool("engine_spawn") then + return +end + + +-- Parameters +------------- + +-- Resolution of search grid in nodes. +local res = 64 +-- Number of points checked in the square search grid (edge * edge). +local checks = 128 * 128 +-- Starting point for biome checks. This also sets the y co-ordinate for all +-- points checked, so the suitable biomes must be active at this y. +local pos = {x = 0, y = 8, z = 0} + + +-- Table of suitable biomes + +local biome_ids = { + minetest.get_biome_id("taiga"), + minetest.get_biome_id("coniferous_forest"), + minetest.get_biome_id("deciduous_forest"), + minetest.get_biome_id("grassland"), + minetest.get_biome_id("savanna"), +} + +-- End of parameters +-------------------- + + +-- Direction table + +local dirs = { + {x = 0, y = 0, z = 1}, + {x = -1, y = 0, z = 0}, + {x = 0, y = 0, z = -1}, + {x = 1, y = 0, z = 0}, +} + + +-- Initial variables + +local edge_len = 1 +local edge_dist = 0 +local dir_step = 0 +local dir_ind = 1 +local searched = false +local success = false +local spawn_pos = {} + + +--Functions +----------- + +-- Get next position on square search spiral + +local function next_pos() + if edge_dist == edge_len then + edge_dist = 0 + dir_ind = dir_ind + 1 + if dir_ind == 5 then + dir_ind = 1 + end + dir_step = dir_step + 1 + edge_len = math.floor(dir_step / 2) + 1 + end + + local dir = dirs[dir_ind] + local move = vector.multiply(dir, res) + + edge_dist = edge_dist + 1 + + return vector.add(pos, move) +end + + +-- Spawn position search + +local function search() + for iter = 1, checks do + local biome_data = minetest.get_biome_data(pos) + -- Sometimes biome_data is nil + local biome = biome_data and biome_data.biome + for id_ind = 1, #biome_ids do + local biome_id = biome_ids[id_ind] + if biome == biome_id then + local spawn_y = minetest.get_spawn_level(pos.x, pos.z) + if spawn_y then + spawn_pos = {x = pos.x, y = spawn_y, z = pos.z} + return true + end + end + end + + pos = next_pos() + end + + return false +end + + +-- On new player spawn and player respawn + +-- Search for spawn position once per server session. If successful, store +-- position and reposition players, otherwise leave them at engine spawn +-- position. + +local function on_spawn(player) + if not searched then + success = search() + searched = true + end + if success then + player:set_pos(spawn_pos) + end +end + +minetest.register_on_newplayer(function(player) + on_spawn(player) +end) + +local enable_bed_respawn = minetest.settings:get_bool("enable_bed_respawn") +if enable_bed_respawn == nil then + enable_bed_respawn = true +end + +minetest.register_on_respawnplayer(function(player) + -- Avoid respawn conflict with beds mod + if beds and enable_bed_respawn and + beds.spawn[player:get_player_name()] then + return + end + + on_spawn(player) + + return true +end) diff --git a/mods/spawn/license.txt b/mods/spawn/license.txt new file mode 100644 index 00000000..a466aabd --- /dev/null +++ b/mods/spawn/license.txt @@ -0,0 +1,24 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2018 paramat + +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/stairs/README.txt b/mods/stairs/README.txt index f2b5b74f..26317f7f 100644 --- a/mods/stairs/README.txt +++ b/mods/stairs/README.txt @@ -4,15 +4,24 @@ See license.txt for license information. 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) +Originally by Kahrl (LGPLv2.1+) and +celeron55, Perttu Ahola (LGPLv2.1+) +Various Minetest developers and contributors (LGPLv2.1+) -Authors of media (models) -------------------------- -Jean-Patrick G. (kilbith) (CC BY-SA 3.0): - stairs_stair.obj -GreenXenith (CC BY-SA 3.0) - stairs_stair_inner.obj stairs_stair_outer.obj +Authors of media (textures) +--------------------------- +Textures +-------- +Copyright (c) 2018 Shara RedCat (CC BY-SA 3.0): + Derived from a texture by PilzAdam (CC BY-SA 3.0): + stairs_obsidian_glass_outer_stairside.png + stairs_obsidian_glass_stairside.png +Copyright (c) 2018 TumeniNodes (CC BY-SA 3.0): + Derived from a texture by celeron55 (CC BY-SA 3.0) and + converted to bright white by Krock (CC BY-SA 3.0): + stairs_glass_stairside.png + stairs_glass_split.png + Derived from a texture by PilzAdam (CC BY-SA 3.0): + stairs_obsidian_glass_split.png diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index c5d0f483..35022300 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -25,30 +25,35 @@ local function rotate_and_place(itemstack, placer, pointed_thing) local p1 = pointed_thing.above local param2 = 0 - local placer_pos = placer:getpos() - if placer_pos then - param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos)) - end + if placer then + local placer_pos = placer:get_pos() + if placer_pos then + param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos)) + end - local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing) - local fpos = finepos.y % 1 + local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing) + local fpos = finepos.y % 1 - if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5) - or (fpos < -0.5 and fpos > -0.999999999) then - param2 = param2 + 20 - if param2 == 21 then - param2 = 23 - elseif param2 == 23 then - param2 = 21 + if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5) + or (fpos < -0.5 and fpos > -0.999999999) then + param2 = param2 + 20 + if param2 == 21 then + param2 = 23 + elseif param2 == 23 then + param2 = 21 + end end end return minetest.item_place(itemstack, placer, pointed_thing, param2) end --- Register stairs. + +-- Register stair -- Node will be called stairs:stair_ -function stairs.register_stair(subname, recipeitem, groups, images, description, sounds) +function stairs.register_stair(subname, recipeitem, groups, images, description, + sounds, worldaligntex) + -- Set backface culling and world-aligned textures local stair_images = {} for i, image in ipairs(images) do if type(image) == "string" then @@ -56,34 +61,35 @@ function stairs.register_stair(subname, recipeitem, groups, images, description, name = image, backface_culling = true, } - elseif image.backface_culling == nil then -- override using any other value + if worldaligntex then + stair_images[i].align_style = "world" + end + else stair_images[i] = table.copy(image) - stair_images[i].backface_culling = true + if stair_images[i].backface_culling == nil then + stair_images[i].backface_culling = true + end + if worldaligntex and stair_images[i].align_style == nil then + stair_images[i].align_style = "world" + end end end - groups.stair = 1 + local new_groups = table.copy(groups) + new_groups.stair = 1 minetest.register_node(":stairs:stair_" .. subname, { description = description, - drawtype = "mesh", - mesh = "stairs_stair.obj", + drawtype = "nodebox", tiles = stair_images, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, - groups = groups, + groups = new_groups, sounds = sounds, - selection_box = { + node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, - }, - }, - collision_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, + {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5}, }, }, on_place = function(itemstack, placer, pointed_thing) @@ -140,22 +146,38 @@ function stairs.register_stair(subname, recipeitem, groups, images, description, end --- Slab facedir to placement 6d matching table -local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4} - --- Register slabs. +-- Register slab -- Node will be called stairs:slab_ -function stairs.register_slab(subname, recipeitem, groups, images, description, sounds) - groups.slab = 1 +function stairs.register_slab(subname, recipeitem, groups, images, description, + sounds, worldaligntex) + -- Set world-aligned textures + local slab_images = {} + for i, image in ipairs(images) do + if type(image) == "string" then + slab_images[i] = { + name = image, + } + if worldaligntex then + slab_images[i].align_style = "world" + end + else + slab_images[i] = table.copy(image) + if worldaligntex and image.align_style == nil then + slab_images[i].align_style = "world" + end + end + end + local new_groups = table.copy(groups) + new_groups.slab = 1 minetest.register_node(":stairs:slab_" .. subname, { description = description, drawtype = "nodebox", - tiles = images, + tiles = slab_images, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, - groups = groups, + groups = new_groups, sounds = sounds, node_box = { type = "fixed", @@ -164,37 +186,17 @@ function stairs.register_slab(subname, recipeitem, groups, images, description, on_place = function(itemstack, placer, pointed_thing) local under = minetest.get_node(pointed_thing.under) local wield_item = itemstack:get_name() + local player_name = placer and placer:get_player_name() or "" local creative_enabled = (creative and creative.is_enabled_for - and creative.is_enabled_for(placer:get_player_name())) + and creative.is_enabled_for(player_name)) - if under and under.name:find("stairs:slab_") then + if under and under.name:find("^stairs:slab_") then -- place slab using under node orientation local dir = minetest.dir_to_facedir(vector.subtract( pointed_thing.above, pointed_thing.under), true) local p2 = under.param2 - -- combine two slabs if possible - if slab_trans_dir[math.floor(p2 / 4)] == dir - and wield_item == under.name 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 creative_enabled then - itemstack:take_item() - end - return itemstack - 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 @@ -279,10 +281,13 @@ if replace then }) end --- Register stairs. + +-- Register inner stair -- Node will be called stairs:stair_inner_ -function stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds) +function stairs.register_stair_inner(subname, recipeitem, groups, images, + description, sounds, worldaligntex) + -- Set backface culling and world-aligned textures local stair_images = {} for i, image in ipairs(images) do if type(image) == "string" then @@ -290,36 +295,36 @@ function stairs.register_stair_inner(subname, recipeitem, groups, images, descri name = image, backface_culling = true, } - elseif image.backface_culling == nil then -- override using any other value + if worldaligntex then + stair_images[i].align_style = "world" + end + else stair_images[i] = table.copy(image) - stair_images[i].backface_culling = true + if stair_images[i].backface_culling == nil then + stair_images[i].backface_culling = true + end + if worldaligntex and stair_images[i].align_style == nil then + stair_images[i].align_style = "world" + end end end - groups.stair = 1 + local new_groups = table.copy(groups) + new_groups.stair = 1 minetest.register_node(":stairs:stair_inner_" .. subname, { - description = description .. " Inner", - drawtype = "mesh", - mesh = "stairs_stair_inner.obj", + description = "Inner " .. description, + drawtype = "nodebox", tiles = stair_images, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, - groups = groups, + groups = new_groups, sounds = sounds, - selection_box = { + node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, - {-0.5, 0, -0.5, 0, 0.5, 0}, - }, - }, - collision_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, - {-0.5, 0, -0.5, 0, 0.5, 0}, + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, + {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5}, + {-0.5, 0.0, -0.5, 0.0, 0.5, 0.0}, }, }, on_place = function(itemstack, placer, pointed_thing) @@ -335,8 +340,8 @@ function stairs.register_stair_inner(subname, recipeitem, groups, images, descri minetest.register_craft({ output = 'stairs:stair_inner_' .. subname .. ' 7', recipe = { - { "", recipeitem, ""}, - { recipeitem, "", recipeitem}, + {"", recipeitem, ""}, + {recipeitem, "", recipeitem}, {recipeitem, recipeitem, recipeitem}, }, }) @@ -357,10 +362,13 @@ function stairs.register_stair_inner(subname, recipeitem, groups, images, descri end end --- Register stairs. + +-- Register outer stair -- Node will be called stairs:stair_outer_ -function stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds) +function stairs.register_stair_outer(subname, recipeitem, groups, images, + description, sounds, worldaligntex) + -- Set backface culling and world-aligned textures local stair_images = {} for i, image in ipairs(images) do if type(image) == "string" then @@ -368,34 +376,35 @@ function stairs.register_stair_outer(subname, recipeitem, groups, images, descri name = image, backface_culling = true, } - elseif image.backface_culling == nil then -- override using any other value + if worldaligntex then + stair_images[i].align_style = "world" + end + else stair_images[i] = table.copy(image) - stair_images[i].backface_culling = true + if stair_images[i].backface_culling == nil then + stair_images[i].backface_culling = true + end + if worldaligntex and stair_images[i].align_style == nil then + stair_images[i].align_style = "world" + end end end - groups.stair = 1 + local new_groups = table.copy(groups) + new_groups.stair = 1 minetest.register_node(":stairs:stair_outer_" .. subname, { - description = description .. " Outer", - drawtype = "mesh", - mesh = "stairs_stair_outer.obj", + description = "Outer " .. description, + drawtype = "nodebox", tiles = stair_images, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, - groups = groups, + groups = new_groups, sounds = sounds, - selection_box = { + node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0, 0.5, 0.5}, - }, - }, - collision_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0, 0.5, 0.5}, + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, + {-0.5, 0.0, 0.0, 0.0, 0.5, 0.5}, }, }, on_place = function(itemstack, placer, pointed_thing) @@ -411,8 +420,7 @@ function stairs.register_stair_outer(subname, recipeitem, groups, images, descri minetest.register_craft({ output = 'stairs:stair_outer_' .. subname .. ' 6', recipe = { - { "", "", ""}, - { "", recipeitem, ""}, + {"", recipeitem, ""}, {recipeitem, recipeitem, recipeitem}, }, }) @@ -433,16 +441,23 @@ function stairs.register_stair_outer(subname, recipeitem, groups, images, descri end end + -- Stair/slab registration function. -- Nodes will be called stairs:{stair,slab}_ -function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds) - stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds) - stairs.register_stair_inner(subname, recipeitem, groups, images, desc_stair, sounds) - stairs.register_stair_outer(subname, recipeitem, groups, images, desc_stair, sounds) - stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds) +function stairs.register_stair_and_slab(subname, recipeitem, groups, images, + desc_stair, desc_slab, sounds, worldaligntex) + stairs.register_stair(subname, recipeitem, groups, images, desc_stair, + sounds, worldaligntex) + stairs.register_stair_inner(subname, recipeitem, groups, images, desc_stair, + sounds, worldaligntex) + stairs.register_stair_outer(subname, recipeitem, groups, images, desc_stair, + sounds, worldaligntex) + stairs.register_slab(subname, recipeitem, groups, images, desc_slab, + sounds, worldaligntex) end + -- Register default stairs and slabs stairs.register_stair_and_slab( @@ -452,7 +467,8 @@ stairs.register_stair_and_slab( {"default_wood.png"}, "Wooden Stair", "Wooden Slab", - default.node_sound_wood_defaults() + default.node_sound_wood_defaults(), + false ) stairs.register_stair_and_slab( @@ -462,7 +478,8 @@ stairs.register_stair_and_slab( {"default_junglewood.png"}, "Jungle Wood Stair", "Jungle Wood Slab", - default.node_sound_wood_defaults() + default.node_sound_wood_defaults(), + false ) stairs.register_stair_and_slab( @@ -472,7 +489,8 @@ stairs.register_stair_and_slab( {"default_pine_wood.png"}, "Pine Wood Stair", "Pine Wood Slab", - default.node_sound_wood_defaults() + default.node_sound_wood_defaults(), + false ) stairs.register_stair_and_slab( @@ -482,7 +500,8 @@ stairs.register_stair_and_slab( {"default_acacia_wood.png"}, "Acacia Wood Stair", "Acacia Wood Slab", - default.node_sound_wood_defaults() + default.node_sound_wood_defaults(), + false ) stairs.register_stair_and_slab( @@ -492,7 +511,8 @@ stairs.register_stair_and_slab( {"default_aspen_wood.png"}, "Aspen Wood Stair", "Aspen Wood Slab", - default.node_sound_wood_defaults() + default.node_sound_wood_defaults(), + false ) stairs.register_stair_and_slab( @@ -502,7 +522,8 @@ stairs.register_stair_and_slab( {"default_stone.png"}, "Stone Stair", "Stone Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -512,7 +533,8 @@ stairs.register_stair_and_slab( {"default_cobble.png"}, "Cobblestone Stair", "Cobblestone Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -522,7 +544,8 @@ stairs.register_stair_and_slab( {"default_mossycobble.png"}, "Mossy Cobblestone Stair", "Mossy Cobblestone Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -532,7 +555,8 @@ stairs.register_stair_and_slab( {"default_stone_brick.png"}, "Stone Brick Stair", "Stone Brick Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + false ) stairs.register_stair_and_slab( @@ -542,7 +566,8 @@ stairs.register_stair_and_slab( {"default_stone_block.png"}, "Stone Block Stair", "Stone Block Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -552,7 +577,8 @@ stairs.register_stair_and_slab( {"default_desert_stone.png"}, "Desert Stone Stair", "Desert Stone Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -562,7 +588,8 @@ stairs.register_stair_and_slab( {"default_desert_cobble.png"}, "Desert Cobblestone Stair", "Desert Cobblestone Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -572,7 +599,8 @@ stairs.register_stair_and_slab( {"default_desert_stone_brick.png"}, "Desert Stone Brick Stair", "Desert Stone Brick Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + false ) stairs.register_stair_and_slab( @@ -582,7 +610,8 @@ stairs.register_stair_and_slab( {"default_desert_stone_block.png"}, "Desert Stone Block Stair", "Desert Stone Block Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -592,7 +621,8 @@ stairs.register_stair_and_slab( {"default_sandstone.png"}, "Sandstone Stair", "Sandstone Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -602,7 +632,8 @@ stairs.register_stair_and_slab( {"default_sandstone_brick.png"}, "Sandstone Brick Stair", "Sandstone Brick Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + false ) stairs.register_stair_and_slab( @@ -612,7 +643,8 @@ stairs.register_stair_and_slab( {"default_sandstone_block.png"}, "Sandstone Block Stair", "Sandstone Block Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -622,7 +654,8 @@ stairs.register_stair_and_slab( {"default_desert_sandstone.png"}, "Desert Sandstone Stair", "Desert Sandstone Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -632,7 +665,8 @@ stairs.register_stair_and_slab( {"default_desert_sandstone_brick.png"}, "Desert Sandstone Brick Stair", "Desert Sandstone Brick Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + false ) stairs.register_stair_and_slab( @@ -642,7 +676,8 @@ stairs.register_stair_and_slab( {"default_desert_sandstone_block.png"}, "Desert Sandstone Block Stair", "Desert Sandstone Block Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -652,7 +687,8 @@ stairs.register_stair_and_slab( {"default_silver_sandstone.png"}, "Silver Sandstone Stair", "Silver Sandstone Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -662,7 +698,8 @@ stairs.register_stair_and_slab( {"default_silver_sandstone_brick.png"}, "Silver Sandstone Brick Stair", "Silver Sandstone Brick Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + false ) stairs.register_stair_and_slab( @@ -672,7 +709,8 @@ stairs.register_stair_and_slab( {"default_silver_sandstone_block.png"}, "Silver Sandstone Block Stair", "Silver Sandstone Block Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -682,7 +720,8 @@ stairs.register_stair_and_slab( {"default_obsidian.png"}, "Obsidian Stair", "Obsidian Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -692,7 +731,8 @@ stairs.register_stair_and_slab( {"default_obsidian_brick.png"}, "Obsidian Brick Stair", "Obsidian Brick Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + false ) stairs.register_stair_and_slab( @@ -702,7 +742,8 @@ stairs.register_stair_and_slab( {"default_obsidian_block.png"}, "Obsidian Block Stair", "Obsidian Block Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + true ) stairs.register_stair_and_slab( @@ -712,7 +753,8 @@ stairs.register_stair_and_slab( {"default_brick.png"}, "Brick Stair", "Brick Slab", - default.node_sound_stone_defaults() + default.node_sound_stone_defaults(), + false ) stairs.register_stair_and_slab( @@ -722,7 +764,8 @@ stairs.register_stair_and_slab( {"default_steel_block.png"}, "Steel Block Stair", "Steel Block Slab", - default.node_sound_metal_defaults() + default.node_sound_metal_defaults(), + true ) stairs.register_stair_and_slab( @@ -732,7 +775,8 @@ stairs.register_stair_and_slab( {"default_tin_block.png"}, "Tin Block Stair", "Tin Block Slab", - default.node_sound_metal_defaults() + default.node_sound_metal_defaults(), + true ) stairs.register_stair_and_slab( @@ -742,7 +786,8 @@ stairs.register_stair_and_slab( {"default_copper_block.png"}, "Copper Block Stair", "Copper Block Slab", - default.node_sound_metal_defaults() + default.node_sound_metal_defaults(), + true ) stairs.register_stair_and_slab( @@ -752,7 +797,8 @@ stairs.register_stair_and_slab( {"default_bronze_block.png"}, "Bronze Block Stair", "Bronze Block Slab", - default.node_sound_metal_defaults() + default.node_sound_metal_defaults(), + true ) stairs.register_stair_and_slab( @@ -762,29 +808,122 @@ stairs.register_stair_and_slab( {"default_gold_block.png"}, "Gold Block Stair", "Gold Block Slab", - default.node_sound_metal_defaults() + default.node_sound_metal_defaults(), + true ) stairs.register_stair_and_slab( "ice", "default:ice", - {cracky = 3, puts_out_fire = 1, cools_lava = 1}, + {cracky = 3, cools_lava = 1, slippery = 3}, {"default_ice.png"}, "Ice Stair", "Ice Slab", - default.node_sound_glass_defaults() + default.node_sound_glass_defaults(), + true ) stairs.register_stair_and_slab( "snowblock", "default:snowblock", - {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1}, + {crumbly = 3, cools_lava = 1, snowy = 1}, {"default_snow.png"}, "Snow Block Stair", "Snow Block Slab", - 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} - }) + default.node_sound_snow_defaults(), + true +) + +-- Glass stair nodes need to be registered individually to utilize specialized textures. + +stairs.register_stair( + "glass", + "default:glass", + {cracky = 3}, + {"stairs_glass_split.png", "default_glass.png", + "stairs_glass_stairside.png^[transformFX", "stairs_glass_stairside.png", + "default_glass.png", "stairs_glass_split.png"}, + "Glass Stair", + default.node_sound_glass_defaults(), + false +) + +stairs.register_slab( + "glass", + "default:glass", + {cracky = 3}, + {"default_glass.png", "default_glass.png", "stairs_glass_split.png"}, + "Glass Slab", + default.node_sound_glass_defaults(), + false +) + +stairs.register_stair_inner( + "glass", + "default:glass", + {cracky = 3}, + {"stairs_glass_stairside.png^[transformR270", "default_glass.png", + "stairs_glass_stairside.png^[transformFX", "default_glass.png", + "default_glass.png", "stairs_glass_stairside.png"}, + "Glass Stair", + default.node_sound_glass_defaults(), + false +) + +stairs.register_stair_outer( + "glass", + "default:glass", + {cracky = 3}, + {"stairs_glass_stairside.png^[transformR90", "default_glass.png", + "stairs_glass_outer_stairside.png", "stairs_glass_stairside.png", + "stairs_glass_stairside.png^[transformR90","stairs_glass_outer_stairside.png"}, + "Glass Stair", + default.node_sound_glass_defaults(), + false +) + +stairs.register_stair( + "obsidian_glass", + "default:obsidian_glass", + {cracky = 3}, + {"stairs_obsidian_glass_split.png", "default_obsidian_glass.png", + "stairs_obsidian_glass_stairside.png^[transformFX", "stairs_obsidian_glass_stairside.png", + "default_obsidian_glass.png", "stairs_obsidian_glass_split.png"}, + "Obsidian Glass Stair", + default.node_sound_glass_defaults(), + false +) + +stairs.register_slab( + "obsidian_glass", + "default:obsidian_glass", + {cracky = 3}, + {"default_obsidian_glass.png", "default_obsidian_glass.png", "stairs_obsidian_glass_split.png"}, + "Obsidian Glass Slab", + default.node_sound_glass_defaults(), + false +) + +stairs.register_stair_inner( + "obsidian_glass", + "default:obsidian_glass", + {cracky = 3}, + {"stairs_obsidian_glass_stairside.png^[transformR270", "default_obsidian_glass.png", + "stairs_obsidian_glass_stairside.png^[transformFX", "default_obsidian_glass.png", + "default_obsidian_glass.png", "stairs_obsidian_glass_stairside.png"}, + "Obsidian Glass Stair", + default.node_sound_glass_defaults(), + false +) + +stairs.register_stair_outer( + "obsidian_glass", + "default:obsidian_glass", + {cracky = 3}, + {"stairs_obsidian_glass_stairside.png^[transformR90", "default_obsidian_glass.png", + "stairs_obsidian_glass_outer_stairside.png", "stairs_obsidian_glass_stairside.png", + "stairs_obsidian_glass_stairside.png^[transformR90","stairs_obsidian_glass_outer_stairside.png"}, + "Obsidian Glass Stair", + default.node_sound_glass_defaults(), + false ) diff --git a/mods/stairs/license.txt b/mods/stairs/license.txt index 411823ae..57bd98cf 100644 --- a/mods/stairs/license.txt +++ b/mods/stairs/license.txt @@ -2,9 +2,9 @@ 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 +Copyright (C) 2011-2017 Kahrl +Copyright (C) 2011-2017 celeron55, Perttu Ahola +Copyright (C) 2012-2017 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; @@ -14,39 +14,3 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY 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) -Copyright (C) 2017 GreenXenith - -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/stairs/models/stairs_stair.obj b/mods/stairs/models/stairs_stair.obj deleted file mode 100644 index 198edf6e..00000000 --- a/mods/stairs/models/stairs_stair.obj +++ /dev/null @@ -1,115 +0,0 @@ -# Blender v2.72 (sub 0) OBJ File: '' -# www.blender.org -mtllib stairs.mtl -o stairs_top -v -0.500000 0.000000 -0.500000 -v -0.500000 0.000000 0.000000 -v 0.500000 0.000000 0.000000 -v 0.500000 0.000000 -0.500000 -v -0.500000 0.500000 0.000000 -v 0.500000 0.500000 0.000000 -v -0.500000 0.500000 0.500000 -v 0.500000 0.500000 0.500000 -vt 0.000000 0.000000 -vt 1.000000 0.000000 -vt 1.000000 0.500000 -vt 0.000000 0.500000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vn 0.000000 1.000000 0.000000 -g stairs_top -usemtl None -s off -f 4/1/1 1/2/1 2/3/1 3/4/1 -f 7/5/1 8/6/1 6/4/1 5/3/1 -o stairs_bottom -v -0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 -0.500000 -v -0.500000 -0.500000 0.500000 -v 0.500000 -0.500000 0.500000 -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 -g stairs_bottom -usemtl None -s off -f 11/7/2 9/8/2 10/9/2 12/10/2 -o stairs_right -v -0.500000 0.000000 -0.500000 -v -0.500000 -0.500000 -0.500000 -v -0.500000 0.000000 0.000000 -v -0.500000 -0.500000 0.500000 -v -0.500000 0.500000 0.000000 -v -0.500000 0.500000 0.500000 -vt 0.000000 0.500000 -vt 0.000000 0.000000 -vt 0.500000 0.500000 -vt 1.000000 1.000000 -vt 0.500000 1.000000 -vt 1.000000 0.000000 -vn -1.000000 0.000000 0.000000 -g stairs_right -usemtl None -s off -f 13/11/3 14/12/3 15/13/3 -f 15/13/3 18/14/3 17/15/3 -f 14/12/3 16/16/3 15/13/3 -f 16/16/3 18/14/3 15/13/3 -o stairs_left -v 0.500000 0.000000 0.000000 -v 0.500000 -0.500000 -0.500000 -v 0.500000 0.000000 -0.500000 -v 0.500000 -0.500000 0.500000 -v 0.500000 0.500000 0.000000 -v 0.500000 0.500000 0.500000 -vt 0.500000 0.500000 -vt 1.000000 0.000000 -vt 1.000000 0.500000 -vt 0.500000 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.000000 -vn 1.000000 0.000000 0.000000 -g stairs_left -usemtl None -s off -f 19/17/4 20/18/4 21/19/4 -f 19/17/4 23/20/4 24/21/4 -f 20/18/4 19/17/4 22/22/4 -f 19/17/4 24/21/4 22/22/4 -o stairs_back -v -0.500000 -0.500000 0.500000 -v 0.500000 -0.500000 0.500000 -v -0.500000 0.500000 0.500000 -v 0.500000 0.500000 0.500000 -vt 1.000000 0.000000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.000000 -vn 0.000000 -0.000000 1.000000 -g stairs_back -usemtl None -s off -f 26/23/5 28/24/5 27/25/5 25/26/5 -o stairs_front -v -0.500000 0.000000 -0.500000 -v -0.500000 -0.500000 -0.500000 -v -0.500000 0.000000 0.000000 -v 0.500000 0.000000 0.000000 -v 0.500000 -0.500000 -0.500000 -v 0.500000 0.000000 -0.500000 -v -0.500000 0.500000 0.000000 -v 0.500000 0.500000 0.000000 -vt 1.000000 0.000000 -vt 1.000000 0.500000 -vt 0.000000 0.500000 -vt 0.000000 0.000000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vn 0.000000 0.000000 -1.000000 -g stairs_front -usemtl None -s off -f 30/27/6 29/28/6 34/29/6 33/30/6 -f 31/28/6 35/31/6 36/32/6 32/29/6 diff --git a/mods/stairs/models/stairs_stair_inner.obj b/mods/stairs/models/stairs_stair_inner.obj deleted file mode 100644 index 5e4968e8..00000000 --- a/mods/stairs/models/stairs_stair_inner.obj +++ /dev/null @@ -1,161 +0,0 @@ -# Blender v2.78 (sub 0) OBJ File: '' -# www.blender.org -mtllib stairs_inner_stair.mtl -o stairs_back_right_stairs_back.001 -v 0.500000 -0.500000 0.500000 -v 0.500000 0.500000 0.500000 -v -0.500000 0.500000 0.500000 -v -0.500000 -0.500000 0.500000 -vt 1.0000 0.0000 -vt 1.0000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.0000 -vn 0.0000 -0.0000 1.0000 -usemtl None.001 -s 1 -f 1/1/1 2/2/1 3/3/1 4/4/1 -o stairs_front_right_stairs_back.003 -v 0.000000 0.000000 -0.500000 -v 0.000000 0.000000 0.000000 -v 0.000000 0.500000 0.000000 -v 0.000000 0.500000 -0.500000 -v -0.500000 0.000000 -0.500000 -v -0.500000 -0.500000 -0.500000 -v -0.500000 0.000000 0.000000 -v -0.500000 0.500000 0.500000 -v -0.500000 0.500000 0.000000 -v -0.500000 -0.500000 0.500000 -vt 0.0000 0.5000 -vt 0.5000 0.5000 -vt 0.5000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.5000 -vt 0.0000 0.0000 -vt 0.5000 0.5000 -vt 1.0000 1.0000 -vt 0.5000 1.0000 -vt 1.0000 0.0000 -vn -1.0000 0.0000 0.0000 -usemtl None -s 1 -f 5/5/2 6/6/2 7/7/2 8/8/2 -f 9/9/2 10/10/2 11/11/2 -f 11/11/2 12/12/2 13/13/2 -f 10/10/2 14/14/2 11/11/2 -f 14/14/2 12/12/2 11/11/2 -o stairs_bottom -v -0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 0.500000 -vt 1.0000 0.0000 -vt 1.0000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.0000 -vn 0.0000 -1.0000 -0.0000 -usemtl None -s 1 -f 15/15/3 16/16/3 17/17/3 18/18/3 -o stairs_front_left_stairs_front.002 -v -0.500000 0.000000 0.000000 -v -0.500000 0.500000 0.000000 -v 0.000000 0.500000 0.000000 -v 0.000000 0.000000 0.000000 -v -0.500000 -0.500000 -0.500000 -v -0.500000 0.000000 -0.500000 -v 0.500000 0.000000 -0.500000 -v 0.500000 -0.500000 -0.500000 -v 0.000000 0.000000 -0.500000 -v 0.000000 0.500000 -0.500000 -v 0.500000 0.500000 -0.500000 -v 0.500000 0.000000 -0.500000 -vt 1.0000 0.5000 -vt 1.0000 1.0000 -vt 0.5000 1.0000 -vt 0.5000 0.5000 -vt 1.0000 0.0000 -vt 1.0000 0.5000 -vt 0.0000 0.5000 -vt 0.0000 0.0000 -vt 0.5000 0.5000 -vt 0.5000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.5000 -vn 0.0000 0.0000 -1.0000 -usemtl None -s 1 -f 19/19/4 20/20/4 21/21/4 22/22/4 -f 23/23/4 24/24/4 25/25/4 26/26/4 -f 27/27/4 28/28/4 29/29/4 30/30/4 -o stairs_top_stairs_top.001 -v 0.000000 0.000000 -0.500000 -v -0.500000 0.000000 -0.500000 -v -0.500000 0.000000 0.000000 -v 0.000000 0.000000 0.000000 -v 0.500000 0.500000 -0.500000 -v 0.000000 0.500000 -0.500000 -v 0.000000 0.500000 0.000000 -v 0.500000 0.500000 0.000000 -v -0.500000 0.500000 0.500000 -v 0.500000 0.500000 0.500000 -v 0.500000 0.500000 0.000000 -v -0.500000 0.500000 0.000000 -vt 0.5000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.5000 -vt 0.5000 0.5000 -vt 1.0000 1.0000 -vt 0.5000 1.0000 -vt 0.5000 0.5000 -vt 1.0000 0.5000 -vt 0.0000 0.0000 -vt 1.0000 0.0000 -vt 1.0000 0.5000 -vt 0.0000 0.5000 -vn 0.0000 1.0000 0.0000 -usemtl None -s 1 -f 31/31/5 32/32/5 33/33/5 34/34/5 -f 35/35/5 36/36/5 37/37/5 38/38/5 -f 39/39/5 40/40/5 41/41/5 42/42/5 -o stairs_back_left_stairs_back.005 -v 0.500000 0.000000 -0.500000 -v 0.500000 0.500000 -0.500000 -v 0.500000 0.500000 0.000000 -v 0.500000 0.000000 0.000000 -v 0.500000 0.000000 0.000000 -v 0.500000 0.500000 0.000000 -v 0.500000 0.500000 0.500000 -v 0.500000 -0.000000 0.500000 -v 0.500000 -0.500000 -0.500000 -v 0.500000 0.000000 -0.500000 -v 0.500000 0.000000 0.000000 -v 0.500000 -0.500000 -0.000000 -v 0.500000 -0.500000 -0.000000 -v 0.500000 0.000000 0.000000 -v 0.500000 -0.000000 0.500000 -v 0.500000 -0.500000 0.500000 -vt 0.5000 0.5000 -vt 0.5000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.5000 -vt 1.0000 0.0000 -vt 1.0000 0.5000 -vt 0.5000 0.5000 -vt 0.5000 0.0000 -vt 0.5000 0.0000 -vt 0.5000 0.5000 -vt 0.0000 0.5000 -vt 0.0000 0.0000 -vt 1.0000 0.5000 -vt 1.0000 1.0000 -vt 0.5000 1.0000 -vt 0.5000 0.5000 -vn 1.0000 0.0000 0.0000 -usemtl None -s 1 -f 47/43/6 48/44/6 49/45/6 50/46/6 -f 51/47/6 52/48/6 53/49/6 54/50/6 -f 55/51/6 56/52/6 57/53/6 58/54/6 -usemtl None.002 -f 43/55/6 44/56/6 45/57/6 46/58/6 diff --git a/mods/stairs/models/stairs_stair_outer.obj b/mods/stairs/models/stairs_stair_outer.obj deleted file mode 100644 index cc1975b0..00000000 --- a/mods/stairs/models/stairs_stair_outer.obj +++ /dev/null @@ -1,136 +0,0 @@ -# Blender v2.78 (sub 0) OBJ File: '' -# www.blender.org -mtllib stairs_outer_stair.mtl -o stairs_bottom -v -0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 0.500000 -vt 1.0000 0.0000 -vt 1.0000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.0000 -vn 0.0000 -1.0000 -0.0000 -usemtl None -s 1 -f 1/1/1 2/2/1 3/3/1 4/4/1 -o stairs_back_left_stairs_left -v 0.500000 0.000000 0.000000 -v 0.500000 -0.500000 -0.500000 -v 0.500000 0.000000 -0.500000 -v 0.500000 0.500000 0.000000 -v 0.500000 0.500000 0.500000 -v 0.500000 -0.500000 0.500000 -vt 0.5000 0.5000 -vt 1.0000 0.0000 -vt 1.0000 0.5000 -vt 0.5000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.0000 -vn 1.0000 0.0000 0.0000 -usemtl None -s 1 -f 5/5/2 6/6/2 7/7/2 -f 5/5/2 8/8/2 9/9/2 -f 6/6/2 5/5/2 10/10/2 -f 5/5/2 9/9/2 10/10/2 -o stairs_back_right_stairs_back -v 0.000000 -0.500000 0.500000 -v 0.000000 -0.000000 0.500000 -v -0.500000 -0.000000 0.500000 -v -0.500000 -0.500000 0.500000 -v 0.500000 -0.500000 0.500000 -v 0.500000 -0.000000 0.500000 -v 0.500000 0.500000 0.500000 -v 0.000000 0.500000 0.500000 -vt 0.5000 0.0000 -vt 0.5000 0.5000 -vt 0.0000 0.5000 -vt 0.0000 0.0000 -vt 1.0000 0.0000 -vt 1.0000 0.5000 -vt 1.0000 1.0000 -vt 0.5000 1.0000 -vn 0.0000 -0.0000 1.0000 -usemtl None -s 1 -f 11/11/3 12/12/3 13/13/3 14/14/3 -f 15/15/3 16/16/3 12/12/3 11/11/3 -f 16/16/3 17/17/3 18/18/3 12/12/3 -o stairs_top_stairs_top.001 -v 0.000000 0.500000 0.500000 -v 0.501689 0.500000 0.500000 -v 0.501689 0.500000 0.000000 -v 0.000000 0.500000 0.000000 -v -0.500000 -0.000000 0.500000 -v 0.001689 -0.000000 0.500000 -v 0.001689 0.000000 0.000000 -v -0.500000 0.000000 0.000000 -v 0.500000 0.000000 -0.500000 -v -0.500000 0.000000 -0.500000 -v -0.500000 0.000000 0.000000 -v 0.500000 0.000000 0.000000 -vt 0.5000 0.0000 -vt 1.0000 0.0000 -vt 1.0000 0.5000 -vt 0.5000 0.5000 -vt 0.0000 0.0000 -vt 0.5000 0.0000 -vt 0.5000 0.5000 -vt 0.0000 0.5000 -vt 1.0000 1.0000 -vt 0.0000 1.0000 -vt 0.0000 0.5000 -vt 1.0000 0.5000 -vn 0.0000 1.0000 0.0000 -usemtl None -s 1 -f 19/19/4 20/20/4 21/21/4 22/22/4 -usemtl None.004 -f 23/23/4 24/24/4 25/25/4 26/26/4 -f 27/27/4 28/28/4 29/29/4 30/30/4 -o stairs_front_left_stairs_front.000 -v -0.500000 -0.500000 -0.500000 -v -0.500000 0.000000 -0.500000 -v 0.500000 0.000000 -0.500000 -v 0.500000 -0.500000 -0.500000 -v 0.500000 0.500000 0.000000 -v 0.500000 0.000000 0.000000 -v 0.000000 0.000000 0.000000 -v 0.000000 0.500000 0.000000 -vt 1.0000 0.0000 -vt 1.0000 0.5000 -vt -0.0000 0.5000 -vt -0.0000 0.0000 -vt 0.5000 0.5000 -vt 0.5000 1.0000 -vt -0.0000 1.0000 -vt -0.0000 0.5000 -vn 0.0000 0.0000 -1.0000 -usemtl None.001 -s 1 -f 31/31/5 32/32/5 33/33/5 34/34/5 -usemtl None.003 -f 37/35/5 38/36/5 35/37/5 36/38/5 -o stairs_front_right_stairs_right.001_stairs_front_left_stairs_front.002 -v -0.500000 -0.500000 0.500000 -v -0.500000 0.000000 0.500000 -v -0.500000 0.000000 -0.500000 -v -0.500000 -0.500000 -0.500000 -v 0.000000 0.000000 0.500000 -v 0.000000 0.500000 0.500000 -v 0.000000 0.500000 -0.000000 -v -0.000000 0.000000 0.000000 -vt 1.0000 0.0000 -vt 1.0000 0.5021 -vt -0.0000 0.5021 -vt -0.0000 0.0000 -vt 1.0000 0.5021 -vt 1.0000 1.0000 -vt 0.5000 1.0000 -vt 0.5000 0.5021 -vn -1.0000 0.0000 0.0000 -usemtl None.002 -s 1 -f 39/39/6 40/40/6 41/41/6 42/42/6 -f 43/43/6 44/44/6 45/45/6 46/46/6 diff --git a/mods/stairs/textures/stairs_glass_outer_stairside.png b/mods/stairs/textures/stairs_glass_outer_stairside.png new file mode 100644 index 00000000..9b298c8b Binary files /dev/null and b/mods/stairs/textures/stairs_glass_outer_stairside.png differ diff --git a/mods/stairs/textures/stairs_glass_split.png b/mods/stairs/textures/stairs_glass_split.png new file mode 100644 index 00000000..62879597 Binary files /dev/null and b/mods/stairs/textures/stairs_glass_split.png differ diff --git a/mods/stairs/textures/stairs_glass_stairside.png b/mods/stairs/textures/stairs_glass_stairside.png new file mode 100644 index 00000000..c4242943 Binary files /dev/null and b/mods/stairs/textures/stairs_glass_stairside.png differ diff --git a/mods/stairs/textures/stairs_obsidian_glass_outer_stairside.png b/mods/stairs/textures/stairs_obsidian_glass_outer_stairside.png new file mode 100644 index 00000000..63db4a2d Binary files /dev/null and b/mods/stairs/textures/stairs_obsidian_glass_outer_stairside.png differ diff --git a/mods/stairs/textures/stairs_obsidian_glass_split.png b/mods/stairs/textures/stairs_obsidian_glass_split.png new file mode 100644 index 00000000..7647b9b0 Binary files /dev/null and b/mods/stairs/textures/stairs_obsidian_glass_split.png differ diff --git a/mods/stairs/textures/stairs_obsidian_glass_stairside.png b/mods/stairs/textures/stairs_obsidian_glass_stairside.png new file mode 100644 index 00000000..850f4c61 Binary files /dev/null and b/mods/stairs/textures/stairs_obsidian_glass_stairside.png differ diff --git a/mods/tnt/README.txt b/mods/tnt/README.txt index 4e74841c..1970804f 100644 --- a/mods/tnt/README.txt +++ b/mods/tnt/README.txt @@ -23,22 +23,35 @@ All gunpowder textures except tnt_gunpowder_inventory.png. sofar (sofar@foo-projects.org) (CC BY-SA 3.0): tnt_blast.png +paramat (CC BY-SA 3.0) +tnt_tnt_stick.png - Derived from a texture by benrob0329. + 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 fuse for TNT. -To craft TNT place items like this: --- wood - gunpowder -- wood - -gunpowder gunpowder gunpowder --- wood - gunpowder -- wood - -There are different ways to blow up TNT: +Craft gunpowder by placing coal and gravel in the crafting area. +The gunpowder can be used to craft TNT sticks or as a fuse trail for TNT. + +To craft 2 TNT sticks: +G_G +GPG +G_G +G = gunpowder +P = paper +The sticks are not usable as an explosive. + +Craft TNT from 9 TNT sticks. + +There are different ways to ignite TNT: 1. Hit it with a torch. - 2. Hit a gunpowder fuse that leads to a TNT block with a torch or flint-and-steel. + 2. Hit a gunpowder fuse trail that leads to TNT with a torch or + flint-and-steel. 3. Activate it with mesecons (fastest way). -Be aware of the damage radius of 6 blocks! +For 1 TNT: +Node destruction radius is 3 nodes. +Player and object damage radius is 6 nodes. diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index 39923262..a12e18fc 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -59,8 +59,8 @@ local function eject_drops(drops, pos, radius) local obj = minetest.add_item(drop_pos, dropitem) if obj then obj:get_luaentity().collect = true - obj:setacceleration({x = 0, y = -10, z = 0}) - obj:setvelocity({x = math.random(-3, 3), + obj:set_acceleration({x = 0, y = -10, z = 0}) + obj:set_velocity({x = math.random(-3, 3), y = math.random(0, 10), z = math.random(-3, 3)}) end @@ -153,7 +153,7 @@ end local function entity_physics(pos, radius, drops) local objs = minetest.get_objects_inside_radius(pos, radius) for _, obj in pairs(objs) do - local obj_pos = obj:getpos() + local obj_pos = obj:get_pos() local dist = math.max(1, vector.distance(pos, obj_pos)) local damage = (4 / dist) * radius @@ -165,7 +165,7 @@ local function entity_physics(pos, radius, drops) local moveoff = vector.multiply(dir, dist + 1.0) local newpos = vector.add(pos, moveoff) newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0}) - obj:setpos(newpos) + obj:set_pos(newpos) obj:set_hp(obj:get_hp() - damage) else @@ -180,8 +180,8 @@ local function entity_physics(pos, radius, drops) end if do_knockback then - local obj_vel = obj:getvelocity() - obj:setvelocity(calc_velocity(pos, obj_pos, + local obj_vel = obj:get_velocity() + obj:set_velocity(calc_velocity(pos, obj_pos, obj_vel, radius * 10)) end if do_damage then @@ -209,6 +209,7 @@ local function add_effects(pos, radius, drops) collisiondetection = false, vertical = false, texture = "tnt_boom.png", + glow = 15, }) minetest.add_particlespawner({ amount = 64, @@ -273,7 +274,7 @@ function tnt.burn(pos, nodename) end end -local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owner) +local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owner, explode_center) pos = vector.round(pos) -- scan for adjacent TNT nodes first, and enlarge the explosion local vm1 = VoxelManip() @@ -287,6 +288,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning") local c_tnt_boom = minetest.get_content_id("tnt:boom") local c_air = minetest.get_content_id("air") + -- make sure we still have explosion even when centre node isnt tnt related + if explode_center then + count = 1 + end for z = pos.z - 2, pos.z + 2 do for y = pos.y - 2, pos.y + 2 do @@ -383,14 +388,21 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne end function tnt.boom(pos, def) + def = def or {} + def.radius = def.radius or 1 + def.damage_radius = def.damage_radius or def.radius * 2 local meta = minetest.get_meta(pos) local owner = meta:get_string("owner") - minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) - minetest.set_node(pos, {name = "tnt:boom"}) + if not def.explode_center then + minetest.set_node(pos, {name = "tnt:boom"}) + end + local sound = def.sound or "tnt_explode" + minetest.sound_play(sound, {pos = pos, gain = 1.5, + max_hear_distance = math.min(def.radius * 20, 128)}) local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, - def.ignore_on_blast, owner) + def.ignore_on_blast, owner, def.explode_center) -- append entity drops - local damage_radius = (radius / def.radius) * def.damage_radius + local damage_radius = (radius / math.max(1, def.radius)) * def.damage_radius entity_physics(pos, damage_radius, drops) if not def.disable_drops then eject_drops(drops, pos, radius) @@ -406,12 +418,6 @@ minetest.register_node("tnt:boom", { walkable = false, drop = "", groups = {dig_immediate = 3}, - on_construct = function(pos) - minetest.get_node_timer(pos):start(0.4) - end, - on_timer = function(pos, elapsed) - minetest.remove_node(pos) - end, -- unaffected by explosions on_blast = function() end, }) @@ -545,13 +551,28 @@ minetest.register_craft({ recipe = {"default:coal_lump", "default:gravel"} }) +minetest.register_craftitem("tnt:tnt_stick", { + description = "TNT Stick", + inventory_image = "tnt_tnt_stick.png", + groups = {flammable = 5}, +}) + if enable_tnt then + minetest.register_craft({ + output = "tnt:tnt_stick 2", + recipe = { + {"tnt:gunpowder", "", "tnt:gunpowder"}, + {"tnt:gunpowder", "default:paper", "tnt:gunpowder"}, + {"tnt:gunpowder", "", "tnt:gunpowder"}, + } + }) + minetest.register_craft({ output = "tnt:tnt", recipe = { - {"group:wood", "tnt:gunpowder", "group:wood"}, - {"tnt:gunpowder", "tnt:gunpowder", "tnt:gunpowder"}, - {"group:wood", "tnt:gunpowder", "group:wood"} + {"tnt:tnt_stick", "tnt:tnt_stick", "tnt:tnt_stick"}, + {"tnt:tnt_stick", "tnt:tnt_stick", "tnt:tnt_stick"}, + {"tnt:tnt_stick", "tnt:tnt_stick", "tnt:tnt_stick"} } }) diff --git a/mods/tnt/license.txt b/mods/tnt/license.txt index 210f2bdc..2c57df38 100644 --- a/mods/tnt/license.txt +++ b/mods/tnt/license.txt @@ -35,6 +35,7 @@ Copyright (C) 2014-2016 BlockMen Copyright (C) 2014-2016 ShadowNinja Copyright (C) 2015-2016 Wuzzy Copyright (C) 2016 sofar (sofar@foo-projects.org) +Copyright (C) 2018 paramat You are free to: Share — copy and redistribute the material in any medium or format. diff --git a/mods/tnt/textures/tnt_tnt_stick.png b/mods/tnt/textures/tnt_tnt_stick.png new file mode 100644 index 00000000..bc47a291 Binary files /dev/null and b/mods/tnt/textures/tnt_tnt_stick.png differ diff --git a/mods/vessels/README.txt b/mods/vessels/README.txt index 5bb798c8..a54e330f 100644 --- a/mods/vessels/README.txt +++ b/mods/vessels/README.txt @@ -4,9 +4,9 @@ See license.txt for license information. 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) +Originally by Vanessa Ezekowitz (LGPLv2.1+) +Modified by Perttu Ahola (LGPLv2.1+) +Various Minetest developers and contributors (LGPLv2.1+) Authors of media (textures) --------------------------- diff --git a/mods/vessels/init.lua b/mods/vessels/init.lua index 43d80922..e5c68a74 100644 --- a/mods/vessels/init.lua +++ b/mods/vessels/init.lua @@ -3,9 +3,6 @@ local vessels_shelf_formspec = "size[8,7;]" .. - default.gui_bg .. - default.gui_bg_img .. - default.gui_slots .. "list[context;vessels;0,0.3;8,2;]" .. "list[current_player;main;0,2.85;8,1;]" .. "list[current_player;main;0,4.08;8,3;8]" .. diff --git a/mods/walls/README.txt b/mods/walls/README.txt index 0389174d..ba33bd77 100644 --- a/mods/walls/README.txt +++ b/mods/walls/README.txt @@ -4,4 +4,4 @@ See license.txt for license information. Authors of source code ---------------------- -Auke Kok (LGPL 2.1) +Auke Kok (LGPLv2.1+) diff --git a/mods/walls/init.lua b/mods/walls/init.lua index bee8e465..91a89cf1 100644 --- a/mods/walls/init.lua +++ b/mods/walls/init.lua @@ -1,6 +1,10 @@ walls = {} -walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) +walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wall_sounds) + --make wall_texture_table paramenter backwards compatible for mods passing single texture + if type(wall_texture_table) ~= "table" then + wall_texture_table = { wall_texture_table } + end -- inventory node, and pole-type wall start item minetest.register_node(wall_name, { description = wall_desc, @@ -14,10 +18,10 @@ walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sou connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, }, - connects_to = { "group:wall", "group:stone" }, + connects_to = { "group:wall", "group:stone", "group:fence" }, paramtype = "light", is_ground_content = false, - tiles = { wall_texture, }, + tiles = wall_texture_table, walkable = true, groups = { cracky = 3, wall = 1, stone = 2 }, sounds = wall_sounds, @@ -35,12 +39,12 @@ walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sou end -walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png", +walls.register("walls:cobble", "Cobblestone Wall", {"default_cobble.png"}, "default:cobble", default.node_sound_stone_defaults()) -walls.register("walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png", +walls.register("walls:mossycobble", "Mossy Cobblestone Wall", {"default_mossycobble.png"}, "default:mossycobble", default.node_sound_stone_defaults()) -walls.register("walls:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png", +walls.register("walls:desertcobble", "Desert Cobblestone Wall", {"default_desert_cobble.png"}, "default:desert_cobble", default.node_sound_stone_defaults()) diff --git a/mods/wool/init.lua b/mods/wool/init.lua index 3001a390..3e565a47 100644 --- a/mods/wool/init.lua +++ b/mods/wool/init.lua @@ -1,27 +1,23 @@ --- This uses a trick: you can first define the recipes using all of the base --- colors, and then some recipes using more specific colors for a few non-base --- colors available. When crafting, the last recipes will be checked first. - local dyes = { - {"white", "White", "basecolor_white"}, - {"grey", "Grey", "basecolor_grey"}, - {"black", "Black", "basecolor_black"}, - {"red", "Red", "basecolor_red"}, - {"yellow", "Yellow", "basecolor_yellow"}, - {"green", "Green", "basecolor_green"}, - {"cyan", "Cyan", "basecolor_cyan"}, - {"blue", "Blue", "basecolor_blue"}, - {"magenta", "Magenta", "basecolor_magenta"}, - {"orange", "Orange", "excolor_orange"}, - {"violet", "Violet", "excolor_violet"}, - {"brown", "Brown", "unicolor_brown"}, - {"pink", "Pink", "unicolor_rose"}, - {"dark_grey", "Dark Grey", "unicolor_darkgrey"}, - {"dark_green", "Dark Green", "unicolor_dark_green"}, + {"white", "White"}, + {"grey", "Grey"}, + {"black", "Black"}, + {"red", "Red"}, + {"yellow", "Yellow"}, + {"green", "Green"}, + {"cyan", "Cyan"}, + {"blue", "Blue"}, + {"magenta", "Magenta"}, + {"orange", "Orange"}, + {"violet", "Violet"}, + {"brown", "Brown"}, + {"pink", "Pink"}, + {"dark_grey", "Dark Grey"}, + {"dark_green", "Dark Green"}, } for i = 1, #dyes do - local name, desc, craft_color_group = unpack(dyes[i]) + local name, desc = unpack(dyes[i]) minetest.register_node("wool:" .. name, { description = desc .. " Wool", @@ -35,13 +31,11 @@ for i = 1, #dyes do minetest.register_craft{ type = "shapeless", output = "wool:" .. name, - recipe = {"group:dye," .. craft_color_group, "group:wool"}, + recipe = {"group:dye,color_" .. name, "group:wool"}, } end - --- legacy - +-- Legacy -- Backwards compatibility with jordach's 16-color wool mod minetest.register_alias("wool:dark_blue", "wool:blue") minetest.register_alias("wool:gold", "wool:yellow") diff --git a/mods/xpanes/README.txt b/mods/xpanes/README.txt index bcbc1294..47161da5 100644 --- a/mods/xpanes/README.txt +++ b/mods/xpanes/README.txt @@ -19,3 +19,6 @@ Gambit (CC BY-SA 3.0): paramat (CC BY-SA 3.0): xpanes_bar_top.png + +Krock (CC0 1.0): + xpanes_edge.png diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua index 40fddba6..653c8cd9 100644 --- a/mods/xpanes/init.lua +++ b/mods/xpanes/init.lua @@ -104,6 +104,7 @@ function xpanes.register_pane(name, def) groups = flatgroups, drop = "xpanes:" .. name .. "_flat", sounds = def.sounds, + use_texture_alpha = def.use_texture_alpha or false, node_box = { type = "fixed", fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, @@ -128,6 +129,7 @@ function xpanes.register_pane(name, def) groups = groups, drop = "xpanes:" .. name .. "_flat", sounds = def.sounds, + use_texture_alpha = def.use_texture_alpha or false, node_box = { type = "connected", fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}}, @@ -147,7 +149,7 @@ end xpanes.register_pane("pane", { description = "Glass Pane", - textures = {"default_glass.png","xpanes_pane_half.png","xpanes_white.png"}, + textures = {"default_glass.png","xpanes_pane_half.png","xpanes_edge.png"}, inventory_image = "default_glass.png", wield_image = "default_glass.png", sounds = default.node_sound_glass_defaults(), @@ -158,8 +160,21 @@ xpanes.register_pane("pane", { } }) +xpanes.register_pane("obsidian_pane", { + description = "Obsidian Glass Pane", + textures = {"default_obsidian_glass.png","xpanes_pane_half.png","xpanes_edge_obsidian.png"}, + inventory_image = "default_obsidian_glass.png", + wield_image = "default_obsidian_glass.png", + sounds = default.node_sound_glass_defaults(), + groups = {snappy=2, cracky=3}, + recipe = { + {"default:obsidian_glass", "default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass", "default:obsidian_glass"} + } +}) + xpanes.register_pane("bar", { - description = "Iron Bar", + description = "Steel Bars", textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_bar_top.png"}, inventory_image = "xpanes_bar.png", wield_image = "xpanes_bar.png", diff --git a/mods/xpanes/textures/xpanes_bar_top.png b/mods/xpanes/textures/xpanes_bar_top.png index 887518aa..7b74508f 100644 Binary files a/mods/xpanes/textures/xpanes_bar_top.png and b/mods/xpanes/textures/xpanes_bar_top.png differ diff --git a/mods/xpanes/textures/xpanes_edge.png b/mods/xpanes/textures/xpanes_edge.png new file mode 100644 index 00000000..5768d663 Binary files /dev/null and b/mods/xpanes/textures/xpanes_edge.png differ diff --git a/mods/xpanes/textures/xpanes_edge_obsidian.png b/mods/xpanes/textures/xpanes_edge_obsidian.png new file mode 100644 index 00000000..abdd14e3 Binary files /dev/null and b/mods/xpanes/textures/xpanes_edge_obsidian.png differ diff --git a/mods/xpanes/textures/xpanes_space.png b/mods/xpanes/textures/xpanes_space.png index 016cb352..331e3658 100644 Binary files a/mods/xpanes/textures/xpanes_space.png and b/mods/xpanes/textures/xpanes_space.png differ diff --git a/mods/xpanes/textures/xpanes_white.png b/mods/xpanes/textures/xpanes_white.png deleted file mode 100644 index a2f4b636..00000000 Binary files a/mods/xpanes/textures/xpanes_white.png and /dev/null differ diff --git a/schematic_tables.txt b/schematic_tables.txt new file mode 100644 index 00000000..89e8a855 --- /dev/null +++ b/schematic_tables.txt @@ -0,0 +1,2211 @@ +Minetest Game schematic tables +============================== + +This document acts as the official record of all schematic tables used in +Minetest Game, and should be updated by any commit that adds a table type +schematic. + +The following tables are for pasting into mods that contain a function to +convert the Lua tables into .mts files. Such mods often have two functions to +process two formats of the 'data' table: + +The standard table format is described in the 'Schematic specifier' section of +the lua_api.txt file in the Minetest Engine. +The 'data' table appears as a sequence of vertical slices through the structure +the schematic describes. +Each XY-plane slice has the X-rows formatted in order of increasing Y, so the +slices of the structure visually appear upside-down in the table. +In this document this format is used where 'mts_save()' appears. + +The transformed table format was created to be easier to work with. +Each XY-plane slice has the X-rows formatted in order of decreasing Y, so the +slices of the structure visually appear upright in the table. +In this document this format is used where 'mts_save_up()' appears. + + +-- This node will not replace existing world nodes + +local _ = {name = "air", prob = 0} + + +-- Mapgen Apple tree + +local M = {name = "default:leaves", prob = 255} +local N = {name = "default:leaves", prob = 223} +local F = {name = "default:apple", prob = 63} +local Y = {name = "default:tree", prob = 255, force_place = true} +local T = {name = "default:tree", prob = 255} + +mts_save("apple_tree", { + size = {x = 7, y = 8, z = 7}, + data = { + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, M, N, _, _, + _, _, _, N, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, M, M, F, M, M, _, + _, N, M, M, M, N, _, + _, _, N, M, N, _, _, + _, _, _, _, _, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, M, Y, _, _, M, N, + _, M, M, _, Y, M, _, + _, N, M, M, M, N, _, + _, _, _, N, _, _, _, + + _, _, _, Y, _, _, _, + _, _, _, Y, _, _, _, + _, _, _, Y, _, _, _, + _, _, _, Y, _, _, _, + M, F, _, Y, _, F, M, + N, M, _, _, _, M, N, + _, M, M, M, M, M, _, + _, _, N, M, N, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, M, _, _, Y, M, N, + _, M, Y, _, M, M, _, + _, N, M, M, M, N, _, + _, _, _, N, _, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, M, M, F, M, M, _, + _, N, M, M, M, N, _, + _, _, N, M, N, _, _, + _, _, _, _, _, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, M, N, _, _, + _, _, _, N, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + }, +}) + + +-- Apple tree from sapling + +mts_save("apple_tree_from_sapling", { + size = {x = 7, y = 8, z = 7}, + data = { + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, M, N, _, _, + _, _, _, N, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, M, M, F, M, M, _, + _, N, M, M, M, N, _, + _, _, N, M, N, _, _, + _, _, _, _, _, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, M, T, _, _, M, N, + _, M, M, _, T, M, _, + _, N, M, M, M, N, _, + _, _, _, N, _, _, _, + + _, _, _, T, _, _, _, + _, _, _, Y, _, _, _, + _, _, _, T, _, _, _, + _, _, _, T, _, _, _, + M, F, _, T, _, F, M, + N, M, _, _, _, M, N, + _, M, M, M, M, M, _, + _, _, N, M, N, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, M, _, _, T, M, N, + _, M, T, _, M, M, _, + _, N, M, M, M, N, _, + _, _, _, N, _, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, M, M, F, M, M, _, + _, N, M, M, M, N, _, + _, _, N, M, N, _, _, + _, _, _, _, _, _, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, M, N, _, _, + _, _, _, N, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + }, +}) + + +-- Mapgen Jungle tree + +local L = {name = "default:jungleleaves", prob = 255} +local N = {name = "default:jungleleaves", prob = 223} +local M = {name = "default:jungleleaves", prob = 191} +local B = {name = "default:jungletree", prob = 255, force_place = true} +local Y = {name = "default:jungletree", prob = 191, force_place = true} +local U = {name = "default:jungletree", prob = 127, force_place = true} +local I = {name = "default:jungletree", prob = 255} + +mts_save("jungle_tree", { + size = {x = 5, y = 17, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, L, N, _, _, + _, _, N, L, N, + _, _, _, _, _, + _, _, _, _, _, + M, N, N, N, M, + M, N, N, N, M, + _, _, _, _, _, + + _, _, B, _, _, + _, _, B, _, _, + _, _, U, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + L, B, L, _, _, + _, _, L, B, L, + _, _, _, _, _, + _, _, _, _, _, + N, B, L, B, N, + N, L, L, L, N, + _, N, N, N, _, + + _, B, B, B, _, + _, B, B, B, _, + _, U, B, U, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, L, N, + N, L, B, _, _, + N, L, B, _, _, + _, _, B, L, N, + _, _, B, L, N, + _, _, B, _, _, + N, L, L, L, N, + N, L, L, L, N, + _, N, L, N, _, + + _, _, B, _, _, + _, _, B, _, _, + _, _, U, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, L, B, L, + L, B, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, L, B, L, + _, _, _, _, _, + N, B, L, B, N, + N, L, L, L, N, + _, N, N, N, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, N, L, N, + N, L, N, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, N, L, N, + _, _, _, _, _, + M, N, N, N, M, + M, N, N, N, M, + _, _, _, _, _, + }, + yslice_prob = { + {ypos=6, prob=191}, + {ypos=7, prob=191}, + {ypos=8, prob=191}, + {ypos=9, prob=191}, + {ypos=10, prob=191}, + }, +}) + + +-- Jungle tree from sapling + +local B = {name = "default:jungletree", prob = 255} +local C = {name = "default:jungletree", prob = 255, force_place = true} +local Y = {name = "default:jungletree", prob = 191} +local U = {name = "default:jungletree", prob = 127} + +mts_save("jungle_tree_from_sapling", { + size = {x = 5, y = 17, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, L, N, _, _, + _, _, N, L, N, + _, _, _, _, _, + _, _, _, _, _, + M, N, N, N, M, + M, N, N, N, M, + _, _, _, _, _, + + _, _, B, _, _, + _, _, B, _, _, + _, _, U, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + L, B, L, _, _, + _, _, L, B, L, + _, _, _, _, _, + _, _, _, _, _, + N, B, L, B, N, + N, L, L, L, N, + _, N, N, N, _, + + _, B, B, B, _, + _, B, C, B, _, + _, U, B, U, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, L, N, + N, L, B, _, _, + N, L, B, _, _, + _, _, B, L, N, + _, _, B, L, N, + _, _, B, _, _, + N, L, L, L, N, + N, L, L, L, N, + _, N, L, N, _, + + _, _, B, _, _, + _, _, B, _, _, + _, _, U, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, L, B, L, + L, B, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, L, B, L, + _, _, _, _, _, + N, B, L, B, N, + N, L, L, L, N, + _, N, N, N, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, N, L, N, + N, L, N, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, N, L, N, + _, _, _, _, _, + M, N, N, N, M, + M, N, N, N, M, + _, _, _, _, _, + }, + yslice_prob = { + {ypos=6, prob=191}, + {ypos=7, prob=191}, + {ypos=8, prob=191}, + {ypos=9, prob=191}, + {ypos=10, prob=191}, + }, +}) + + +-- Mapgen Pine tree + +local L = {name = "default:pine_needles", prob = 255} +local M = {name = "default:pine_needles", prob = 223} +local N = {name = "default:pine_needles", prob = 191} +local T = {name = "default:pine_tree", prob = 255, force_place = true} +local B = {name = "default:pine_tree", prob = 255} + +mts_save("pine_tree", { + size = {x = 5, y = 16, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + L, _, T, _, L, + _, L, T, L, _, + _, _, T, _, _, + L, _, T, _, L, + _, L, T, L, _, + _, _, T, _, _, + L, _, T, _, L, + _, L, L, L, _, + _, _, L, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + {ypos = 5, prob = 127}, + {ypos = 9, prob = 127}, + {ypos = 12, prob = 127}, + }, +}) + + +-- Pine tree from sapling + +local T = {name = "default:pine_tree", prob = 255} +local U = {name = "default:pine_tree", prob = 255, force_place = true} + +mts_save("pine_tree_from_sapling", { + size = {x = 5, y = 16, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + + _, _, T, _, _, + _, _, U, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + L, _, T, _, L, + _, L, T, L, _, + _, _, T, _, _, + L, _, T, _, L, + _, L, T, L, _, + _, _, T, _, _, + L, _, T, _, L, + _, L, L, L, _, + _, _, L, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + {ypos = 5, prob = 127}, + {ypos = 9, prob = 127}, + {ypos = 12, prob = 127}, + }, +}) + + +-- Snowy pine tree from sapling + +local T = {name = "default:pine_tree", prob = 255} +local U = {name = "default:pine_tree", prob = 255, force_place = true} +local L = {name = "default:pine_needles", prob = 255} +local S = {name = "default:snow", prob = 255} + +mts_save("snowy_pine_tree_from_sapling", { + size = {x = 5, y = 16, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + L, L, L, L, L, + S, S, S, S, S, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + L, L, _, L, M, + S, L, L, L, _, + _, _, _, _, _, + _, L, _, L, L, + _, L, L, L, S, + _, S, S, S, _, + _, _, _, _, _, + + _, _, T, _, _, + _, _, U, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + L, _, T, _, L, + _, L, T, L, _, + _, _, T, _, _, + L, _, T, _, L, + _, L, T, L, _, + _, _, T, _, _, + L, _, T, _, L, + S, L, L, L, S, + _, S, L, S, _, + _, _, S, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + M, L, _, L, M, + _, L, L, L, _, + _, _, _, _, _, + L, L, _, L, L, + S, L, L, L, S, + _, S, S, S, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, L, + _, _, _, _, S, + _, _, _, _, _, + L, L, L, L, _, + S, S, S, S, _, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + {ypos = 8, prob = 127}, + {ypos = 11, prob = 127}, + }, +}) + + +-- Mapgen Acacia tree + +local L = {name = "default:acacia_leaves", prob = 255} +local M = {name = "default:acacia_leaves", prob = 223} +local T = {name = "default:acacia_tree", prob = 255, force_place = true} + +mts_save("acacia_tree", { + size = {x = 9, y = 9, z = 9}, + data = { + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + M, M, M, M, _, _, _, _, _, + _, _, _, _, M, M, M, M, M, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + M, L, L, M, _, _, _, _, _, + _, _, _, _, M, L, L, L, M, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, T, _, _, _, _, _, _, + M, L, L, M, _, _, T, _, _, + _, _, _, _, M, L, L, L, M, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, T, _, _, _, _, _, + _, _, _, _, _, T, _, _, _, + M, M, M, M, _, _, _, _, _, + _, _, _, _, M, L, L, L, M, + + _, _, _, _, T, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + M, M, M, M, M, M, M, M, M, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, T, _, _, _, + _, _, _, T, _, _, _, _, _, + _, _, _, _, _, M, M, M, M, + M, L, L, L, M, _, _, _, _, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, T, _, _, + _, _, T, _, _, M, L, L, M, + M, L, L, L, M, _, _, _, _, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, M, L, L, M, + M, L, L, L, M, _, _, _, _, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, M, M, M, M, + M, M, M, M, M, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + }, +}) + + +-- Acacia tree from sapling + +local T = {name = "default:acacia_tree", prob = 255} +local U = {name = "default:acacia_tree", prob = 255, force_place = true} + +mts_save("acacia_tree_from_sapling", { + size = {x = 9, y = 9, z = 9}, + data = { + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + M, M, M, M, _, _, _, _, _, + _, _, _, _, M, M, M, M, M, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + M, L, L, M, _, _, _, _, _, + _, _, _, _, M, L, L, L, M, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, T, _, _, _, _, _, _, + M, L, L, M, _, _, T, _, _, + _, _, _, _, M, L, L, L, M, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, T, _, _, _, _, _, + _, _, _, _, _, T, _, _, _, + M, M, M, M, _, _, _, _, _, + _, _, _, _, M, L, L, L, M, + + _, _, _, _, T, _, _, _, _, + _, _, _, _, U, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, T, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + M, M, M, M, M, M, M, M, M, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, T, _, _, _, + _, _, _, T, _, _, _, _, _, + _, _, _, _, _, M, M, M, M, + M, L, L, L, M, _, _, _, _, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, T, _, _, + _, _, T, _, _, M, L, L, M, + M, L, L, L, M, _, _, _, _, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, M, L, L, M, + M, L, L, L, M, _, _, _, _, + + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, _, _, _, _, + _, _, _, _, _, M, M, M, M, + M, M, M, M, M, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + }, +}) + + +-- Mapgen Aspen tree + +local T = {name = "default:aspen_tree", prob = 255, force_place = true} +local B = {name = "default:aspen_tree", prob = 255} +local L = {name = "default:aspen_leaves", prob = 255} +local M = {name = "default:aspen_leaves", prob = 223} +local N = {name = "default:aspen_leaves", prob = 127} + +mts_save("aspen_tree", { + size = {x = 5, y = 14, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + _, _, _, _, _, + + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, L, T, L, _, + L, L, T, L, L, + _, L, T, L, _, + L, L, T, L, L, + _, L, T, L, _, + L, L, T, L, L, + _, L, L, L, _, + _, _, L, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + {ypos = 8, prob = 127}, + {ypos = 10, prob = 127}, + }, +}) + + +-- Aspen tree from sapling + +mts_save("aspen_tree_from_sapling", { + size = {x = 5, y = 14, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + _, _, _, _, _, + + _, _, B, _, _, + _, _, T, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, _, B, _, _, + _, L, B, L, _, + L, L, B, L, L, + _, L, B, L, _, + L, L, B, L, L, + _, L, B, L, _, + L, L, B, L, L, + _, L, L, L, _, + _, _, L, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + M, L, L, L, M, + _, M, L, M, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + N, M, L, M, N, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + {ypos = 8, prob = 127}, + {ypos = 10, prob = 127}, + }, +}) + + +-- Mapgen emergent jungle tree + +local L = {name = "default:jungleleaves", prob = 255} +local N = {name = "default:jungleleaves", prob = 223} +local M = {name = "default:jungleleaves", prob = 127} +local B = {name = "default:jungletree", prob = 255, force_place = true} +local U = {name = "default:jungletree", prob = 127, force_place = true} + +mts_save("emergent_jungle_tree", { + size = {x = 7, y = 37, z = 7}, + data = { + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + B, _, _, _, _, _, B, + B, _, _, _, _, _, B, + B, _, _, _, _, _, B, + U, _, _, _, _, _, U, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, N, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, N, N, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, N, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, N, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, N, N, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, M, M, M, M, M, _, + _, N, N, N, N, N, _, + _, N, N, N, N, N, _, + _, N, N, N, N, N, _, + _, _, _, _, _, _, _, + + _, _, _, _, _, _, _, + _, _, B, _, B, _, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, U, B, _, B, U, _, + _, _, U, _, U, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, B, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, B, N, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, B, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, B, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, B, N, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + M, _, _, _, _, _, M, + N, L, _, _, _, L, N, + N, B, L, L, L, B, N, + N, L, L, L, L, L, N, + _, N, N, N, N, N, _, + + _, _, B, _, B, _, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, U, B, B, B, U, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + N, N, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, _, B, B, N, N, + N, N, N, B, _, _, _, + _, _, _, B, _, _, _, + _, _, N, B, N, _, _, + _, _, _, B, _, _, _, + _, _, _, B, N, N, N, + N, N, B, B, _, _, _, + _, _, _, B, _, _, _, + _, _, _, B, B, N, N, + N, N, N, B, _, _, _, + _, _, _, B, _, _, _, + M, _, B, B, B, _, M, + N, _, B, _, B, _, N, + N, L, L, _, L, L, N, + N, L, L, L, L, L, N, + _, N, L, L, L, N, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + N, B, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, B, N, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + N, B, B, B, B, _, _, + _, _, B, B, B, _, _, + M, _, B, _, B, _, M, + N, _, _, _, _, _, N, + N, L, _, _, _, L, N, + N, L, L, L, L, L, N, + _, N, L, L, L, N, _, + + _, _, B, _, B, _, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, U, B, B, B, U, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, _, B, _, _, _, + N, N, N, B, _, _, _, + _, _, _, B, B, N, N, + _, _, _, B, _, _, _, + N, N, B, B, _, _, _, + _, _, _, B, N, N, N, + _, _, _, B, _, _, _, + _, _, N, B, N, _, _, + _, _, _, B, _, _, _, + N, N, N, B, _, _, _, + _, _, _, B, _, _, _, + M, _, B, B, B, _, M, + N, _, B, _, B, _, N, + N, L, L, _, L, L, N, + N, L, L, L, L, L, N, + _, N, L, L, L, N, _, + + _, _, _, _, _, _, _, + _, _, B, _, B, _, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, U, B, _, B, U, _, + _, _, U, _, U, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, B, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, B, N, + _, _, _, _, _, _, _, + N, B, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, B, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + M, _, _, _, _, _, M, + N, L, _, _, _, L, N, + N, B, L, L, L, B, N, + N, L, L, L, L, L, N, + _, N, N, N, N, N, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + B, _, _, _, _, _, B, + B, _, _, _, _, _, B, + B, _, _, _, _, _, B, + U, _, _, _, _, _, U, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, N, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, N, N, + _, _, _, _, _, _, _, + N, N, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, N, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, M, M, M, M, M, _, + _, N, N, N, N, N, _, + _, N, N, N, N, N, _, + _, N, N, N, N, N, _, + _, _, _, _, _, _, _, + }, + yslice_prob = { + {ypos = 13, prob = 127}, + {ypos = 14, prob = 127}, + {ypos = 15, prob = 127}, + {ypos = 16, prob = 127}, + {ypos = 17, prob = 127}, + {ypos = 18, prob = 127}, + {ypos = 19, prob = 127}, + {ypos = 20, prob = 127}, + {ypos = 21, prob = 127}, + {ypos = 22, prob = 127}, + {ypos = 23, prob = 127}, + {ypos = 24, prob = 127}, + }, +}) + + +-- Emergent jungle tree from sapling + +local L = {name = "default:jungleleaves", prob = 255} +local N = {name = "default:jungleleaves", prob = 223} +local M = {name = "default:jungleleaves", prob = 127} +local S = {name = "default:jungletree", prob = 255, force_place = true} +local B = {name = "default:jungletree", prob = 255} +local U = {name = "default:jungletree", prob = 127} + +mts_save("emergent_jungle_tree_from_sapling", { + size = {x = 7, y = 37, z = 7}, + data = { + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + B, _, _, _, _, _, B, + B, _, _, _, _, _, B, + B, _, _, _, _, _, B, + U, _, _, _, _, _, U, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, N, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, N, N, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, N, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, N, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, N, N, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, M, M, M, M, M, _, + _, N, N, N, N, N, _, + _, N, N, N, N, N, _, + _, N, N, N, N, N, _, + _, _, _, _, _, _, _, + + _, _, _, _, _, _, _, + _, _, B, _, B, _, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, U, B, _, B, U, _, + _, _, U, _, U, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, B, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, B, N, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, B, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + N, B, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, B, N, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + M, _, _, _, _, _, M, + N, L, _, _, _, L, N, + N, B, L, L, L, B, N, + N, L, L, L, L, L, N, + _, N, N, N, N, N, _, + + _, _, B, _, B, _, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, U, B, B, B, U, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + N, N, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, _, B, B, N, N, + N, N, N, B, _, _, _, + _, _, _, B, _, _, _, + _, _, N, B, N, _, _, + _, _, _, B, _, _, _, + _, _, _, B, N, N, N, + N, N, B, B, _, _, _, + _, _, _, B, _, _, _, + _, _, _, B, B, N, N, + N, N, N, B, _, _, _, + _, _, _, B, _, _, _, + M, _, B, B, B, _, M, + N, _, B, _, B, _, N, + N, L, L, _, L, L, N, + N, L, L, L, L, L, N, + _, N, L, L, L, N, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, B, B, B, _, _, + _, _, B, S, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + N, B, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, B, N, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + N, B, B, B, B, _, _, + _, _, B, B, B, _, _, + M, _, B, _, B, _, M, + N, _, _, _, _, _, N, + N, L, _, _, _, L, N, + N, L, L, L, L, L, N, + _, N, L, L, L, N, _, + + _, _, B, _, B, _, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, B, B, B, B, B, _, + _, U, B, B, B, U, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, B, B, B, _, _, + _, _, _, B, _, _, _, + N, N, N, B, _, _, _, + _, _, _, B, B, N, N, + _, _, _, B, _, _, _, + N, N, B, B, _, _, _, + _, _, _, B, N, N, N, + _, _, _, B, _, _, _, + _, _, N, B, N, _, _, + _, _, _, B, _, _, _, + N, N, N, B, _, _, _, + _, _, _, B, _, _, _, + M, _, B, B, B, _, M, + N, _, B, _, B, _, N, + N, L, L, _, L, L, N, + N, L, L, L, L, L, N, + _, N, L, L, L, N, _, + + _, _, _, _, _, _, _, + _, _, B, _, B, _, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, B, B, _, B, B, _, + _, U, B, _, B, U, _, + _, _, U, _, U, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, B, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, B, N, + _, _, _, _, _, _, _, + N, B, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, B, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + M, _, _, _, _, _, M, + N, L, _, _, _, L, N, + N, B, L, L, L, B, N, + N, L, L, L, L, L, N, + _, N, N, N, N, N, _, + + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + B, _, _, _, _, _, B, + B, _, _, _, _, _, B, + B, _, _, _, _, _, B, + U, _, _, _, _, _, U, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, N, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, N, N, N, + _, _, _, _, _, _, _, + N, N, N, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, N, N, N, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, _, _, _, _, _, _, + _, M, M, M, M, M, _, + _, N, N, N, N, N, _, + _, N, N, N, N, N, _, + _, N, N, N, N, N, _, + _, _, _, _, _, _, _, + }, + yslice_prob = { + {ypos = 13, prob = 127}, + {ypos = 14, prob = 127}, + {ypos = 15, prob = 127}, + {ypos = 16, prob = 127}, + {ypos = 17, prob = 127}, + {ypos = 18, prob = 127}, + {ypos = 19, prob = 127}, + {ypos = 20, prob = 127}, + {ypos = 21, prob = 127}, + {ypos = 22, prob = 127}, + {ypos = 23, prob = 127}, + {ypos = 24, prob = 127}, + }, +}) + + +-- Mapgen small pine tree + +local L = {name = "default:pine_needles", prob = 255} +local M = {name = "default:pine_needles", prob = 223} +local N = {name = "default:pine_needles", prob = 191} +local T = {name = "default:pine_tree", prob = 255, force_place = true} +local B = {name = "default:pine_tree", prob = 255} +local S = {name = "default:snow", prob = 255} + +mts_save("small_pine_tree", { + size = {x = 5, y = 12, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + L, L, _, L, L, + _, L, L, L, _, + _, L, L, L, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + _, _, T, _, _, + L, _, T, _, L, + L, L, T, L, L, + _, L, T, L, _, + _, L, T, L, _, + _, L, T, L, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, L, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + L, L, _, L, L, + _, L, L, L, _, + _, L, L, L, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + }, +}) + + +-- Small pine tree from sapling + +mts_save("small_pine_tree_from_sapling", { + size = {x = 5, y = 12, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + L, L, _, L, L, + _, L, L, L, _, + _, L, L, L, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, B, _, _, + _, _, T, _, _, + _, _, B, _, _, + _, _, B, _, _, + L, _, B, _, L, + L, L, B, L, L, + _, L, B, L, _, + _, L, B, L, _, + _, L, B, L, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, L, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + L, L, _, L, L, + _, L, L, L, _, + _, L, L, L, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, L, L, L, _, + _, _, L, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + {ypos = 4, prob = 127}, + }, +}) + + +-- Snowy small pine tree from sapling + +mts_save("snowy_small_pine_tree_from_sapling", { + size = {x = 5, y = 13, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, L, L, L, _, + _, S, L, S, _, + _, _, S, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + L, L, _, L, L, + S, L, L, L, S, + _, L, L, L, _, + _, L, L, L, _, + _, S, L, S, _, + _, _, L, _, _, + _, _, S, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, B, _, _, + _, _, T, _, _, + _, _, B, _, _, + _, _, B, _, _, + L, _, B, _, L, + L, L, B, L, L, + S, L, B, L, S, + _, L, B, L, _, + _, L, B, L, _, + _, L, L, L, _, + _, S, L, S, _, + _, _, L, _, _, + _, _, S, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + L, L, _, L, L, + S, L, L, L, S, + _, L, L, L, _, + _, L, L, L, _, + _, S, L, S, _, + _, _, L, _, _, + _, _, S, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, L, L, L, _, + _, S, L, S, _, + _, _, S, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + }, +}) + + +-- Apple tree log + +mts_save("apple_log", { + size = {x = 4, y = 2, z = 1}, + data = { + {name = "default:tree", param2 = 12, prob = 127}, + {name = "default:tree", param2 = 12}, + {name = "default:tree", param2 = 12}, + {name = "default:tree", param2 = 12}, + {name = "air", prob = 0}, + {name = "flowers:mushroom_brown", prob = 63}, + {name = "air", prob = 0}, + {name = "air", prob = 0}, + }, +}) + + +-- Jungletree log + +mts_save("jungle_log", { + size = {x = 5, y = 2, z = 1}, + data = { + {name = "default:jungletree", param2 = 12, prob = 127}, + {name = "default:jungletree", param2 = 12}, + {name = "default:jungletree", param2 = 12}, + {name = "default:jungletree", param2 = 12}, + {name = "default:jungletree", param2 = 12, prob = 127}, + {name = "air", prob = 0}, + {name = "air", prob = 0}, + {name = "flowers:mushroom_brown", prob = 127}, + {name = "air", prob = 0}, + {name = "air", prob = 0}, + }, +}) + + +-- Pine tree log + +mts_save("pine_log", { + size = {x = 5, y = 2, z = 1}, + data = { + {name = "default:pine_tree", param2 = 12, prob = 127}, + {name = "default:pine_tree", param2 = 12}, + {name = "default:pine_tree", param2 = 12}, + {name = "default:pine_tree", param2 = 12}, + {name = "default:pine_tree", param2 = 12, prob = 127}, + {name = "air", prob = 0}, + {name = "air", prob = 0}, + {name = "flowers:mushroom_red", prob = 63}, + {name = "air", prob = 0}, + {name = "air", prob = 0}, + }, +}) + + +-- Acacia tree log + +mts_save("acacia_log", { + size = {x = 5, y = 1, z = 1}, + data = { + {name = "default:acacia_tree", param2 = 12, prob = 127}, + {name = "default:acacia_tree", param2 = 12}, + {name = "default:acacia_tree", param2 = 12}, + {name = "default:acacia_tree", param2 = 12}, + {name = "default:acacia_tree", param2 = 12, prob = 127}, + }, +}) + + +-- Aspen tree log + +mts_save("aspen_log", { + size = {x = 5, y = 2, z = 1}, + data = { + {name = "default:aspen_tree", param2 = 12, prob = 127}, + {name = "default:aspen_tree", param2 = 12}, + {name = "default:aspen_tree", param2 = 12}, + {name = "default:aspen_tree", param2 = 12}, + {name = "default:aspen_tree", param2 = 12, prob = 127}, + {name = "air", prob = 0}, + {name = "flowers:mushroom_red", prob = 63}, + {name = "flowers:mushroom_brown", prob = 63}, + {name = "air", prob = 0}, + {name = "air", prob = 0}, + }, +}) + + +-- Large cactus + +local C = {name = "default:cactus", prob = 255, param2 = 20} +local R = {name = "default:cactus", prob = 255, param2 = 20, force_place = true} +local E = {name = "default:cactus", prob = 127, param2 = 20} + +mts_save("large_cactus", { + size = {x = 5, y = 7, z = 5}, + data = { + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, R, _, _, + _, _, R, _, _, + _, _, C, _, _, + C, C, C, C, C, + C, _, C, _, C, + E, _, C, _, E, + _, _, C, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + _, _, _, _, _, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + }, +}) + + +-- Papyrus + +mts_save("papyrus", { + size = {x = 1, y = 7, z = 1}, + data = { + {name = "default:dirt", prob = 255, force_place = true}, + {name = "default:dirt", prob = 255, force_place = true}, + {name = "default:papyrus", prob = 255}, + {name = "default:papyrus", prob = 255}, + {name = "default:papyrus", prob = 255}, + {name = "default:papyrus", prob = 255}, + {name = "default:papyrus", prob = 255}, + }, + yslice_prob = { + {ypos = 2, prob = 127}, + {ypos = 3, prob = 127}, + }, +}) + + +-- Bush + +local L = {name = "default:bush_leaves", prob = 255} +local M = {name = "default:bush_leaves", prob = 191} +local N = {name = "default:bush_leaves", prob = 127} +local S = {name = "default:bush_stem", prob = 255, force_place = true} + +mts_save("bush", { + size = {x = 3, y = 3, z = 3}, + data = { + _, _, _, + M, L, M, + N, M, N, + + _, _, _, + L, S, L, + M, L, M, + + _, _, _, + M, L, M, + N, M, N, + }, +}) + + +-- Blueberry bush + +local L = {name = "default:blueberry_bush_leaves_with_berries", prob = 255, force_place = true} +local M = {name = "default:blueberry_bush_leaves_with_berries", prob = 223} +local N = {name = "default:blueberry_bush_leaves_with_berries", prob = 95} + +mts_save("blueberry_bush", { + size = {x = 3, y = 1, z = 3}, + data = { + N, M, N, + + M, L, M, + + N, M, N, + }, +}) + + +-- Acacia bush + +local L = {name = "default:acacia_bush_leaves", prob = 255} +local M = {name = "default:acacia_bush_leaves", prob = 191} +local N = {name = "default:acacia_bush_leaves", prob = 127} +local S = {name = "default:acacia_bush_stem", prob = 255, force_place = true} + +mts_save("acacia_bush", { + size = {x = 3, y = 3, z = 3}, + data = { + _, _, _, + N, M, N, + M, L, M, + + _, _, _, + M, S, M, + L, L, L, + + _, _, _, + N, M, N, + M, L, M, + }, +}) + + +-- Pine bush + +local L = {name = "default:pine_bush_needles", prob = 255} +local M = {name = "default:pine_bush_needles", prob = 191} +local N = {name = "default:pine_bush_needles", prob = 127} +local S = {name = "default:pine_bush_stem", prob = 255, force_place = true} + +mts_save("pine_bush", { + size = {x = 3, y = 3, z = 3}, + data = { + _, _, _, + M, L, M, + N, M, N, + + _, _, _, + L, S, L, + M, L, M, + + _, _, _, + M, L, M, + N, M, N, + }, +}) diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 00000000..5498b601 Binary files /dev/null and b/screenshot.png differ diff --git a/settingtypes.txt b/settingtypes.txt index 2c48d849..7f6a12ba 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -39,20 +39,28 @@ enable_tnt (TNT) bool true # The radius in which nodes will be destroyed by a TNT explosion. tnt_radius (TNT radius) int 3 0 +# Sets the behaviour of the inventory items when a player dies. +# bones: Store items in a bone node but drop items if inside protected area. +# drop: Drop items on the ground. +# keep: Player keeps items. +bones_mode (Bones mode) enum bones bones,drop,keep + # 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 +share_bones_time (Bones share time) int 1200 0 + +# How much earlier the bones of a dead player can be looted by +# everyone if the player dies in a protected area they don't own. +# 0 to disable. By default it is "share_bones_time" divide by four. +share_bones_time_early (Earlier bones share time) int 300 0 + +# Inform player of condition and location of new bones. +bones_position_message (Inform player about bones) bool false # Replaces old stairs with new ones. Only required for older worlds. enable_stairs_replace_abm (Replace old stairs) bool false -# Enable the PB&J Pup mod entirely -pbj_pup_enable (Enable PB&J pup mod) bool true - -# Generate PB&J Pup blocks in the world -pbj_pup_generate (Generate PBJ Pup blocks in world) bool true - -# Let the PB&J Pup mod replace Nyan Cat nodes -pbj_pup_alias_nyancat (Replace Nyan Cat blocks) bool false - +# If enabled, use the engine's spawn search which does not check for a +# suitable starting biome. +engine_spawn (Use engine spawn search) bool false