commit 0954c4c7d1a27b95e53999e39e7c4f1fffe0a84b Author: rubenwardy Date: Thu Jul 16 18:44:01 2015 +0100 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..717f5fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +## Generic ignorable patterns and files +*~ +.*.swp +*bak* +tags +*.vim + +## Files related to minetest development cycle +*.patch diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..24465e8 --- /dev/null +++ b/README.txt @@ -0,0 +1,22 @@ +CaptureTheFlag +============== + +Uses the [CTF PvP engine](https://github.com/rubenwardy/ctf_pvp_engine) + +* Fast rounds of CTF games +* Removed nodes for focus + +System Requirements +------------------- + +You'll need to host save your game on an SSD +or mount it in the ramdisk (use redis, leveldb or + [sqlite with this guide](https://forum.minetest.net/viewtopic.php?f=10&t=9588)) + +License +------- +Created by [rubenwardy](http://rubenwardy.com/) +Code: LGPL 2.1 or later +Textures: CC-BY-SA 3.0 + +Derived from [minetest_game](https://github.com/minetest/minetest_game) diff --git a/game.conf b/game.conf new file mode 100644 index 0000000..012a869 --- /dev/null +++ b/game.conf @@ -0,0 +1 @@ +name = Capture the Flag diff --git a/game_api.txt b/game_api.txt new file mode 100644 index 0000000..791a7f9 --- /dev/null +++ b/game_api.txt @@ -0,0 +1,384 @@ +minetest_game API +====================== +GitHub Repo: https://github.com/minetest/minetest_game + +Introduction +------------ +The minetest_game gamemode offers multiple new possibilities in addition to Minetest'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: + [XYZ] refers to a section the Minetest API + [#ABC] refers to a section in this document + ^ Explanation for line above + +Bucket API +---------- +The bucket API allows registering new types of buckets for non-default liquids. + + bucket.register_liquid( + "default:lava_source", -- Source node name + "default:lava_flowing", -- Flowing node name + "bucket:bucket_lava", -- Name to be used for bucket + "bucket_lava.png", -- Bucket texture (for wielditem and inventory_image) + "Lava Bucket" -- Bucket description + ) + +Beds API +-------- + beds.register_bed( + "beds:bed", -- Bed name + def: See [#Bed definition] -- Bed definition + ) + + 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 + +#Bed definition +--------------- +{ + description = "Simple Bed", + inventory_image = "beds_bed.png", + wield_image = "beds_bed.png", + tiles = { + bottom = {[Tile definition], + ^ the tiles of the bottom part of the bed + }, + top = {[Tile definition], + ^ the tiles of the bottom part of the bed + } + }, + nodebox = { + bottom = regular nodebox, see [Node boxes], -- bottm part of bed + top = regular nodebox, see [Node boxes], -- top part of bed + }, + selectionbox = regular nodebox, see [Node boxes], -- for both nodeboxes + recipe = { -- Craft recipe + {"group:wool", "group:wool", "group:wool"}, + {"group:wood", "group:wood", "group:wood"} + } +} + +Doors API +--------- +The doors mod allows modders to register custom doors and trapdoors. + +doors.register_door(name, def) +^ name: "Door name" +^ def: See [#Door definition] + -> Registers new door + +doors.register_trapdoor(name, def) +^ name: "Trapdoor name" +^ def: See [#Trapdoor definition] + -> Registers new trapdoor + +#Door definition +---------------- +{ + description = "Door description", + inventory_image = "mod_door_inv.png", + groups = {group = 1}, + tiles_bottom: [Tile definition], + ^ the tiles of the bottom part of the door {front, side} + tiles_top: [Tile definition], + ^ the tiles of the bottom part of the door {front, side} + node_box_bottom = regular nodebox, see [Node boxes], OPTIONAL, + node_box_top = regular nodebox, see [Node boxes], OPTIONAL, + selection_box_bottom = regular nodebox, see [Node boxes], OPTIONAL, + selection_box_top = regular nodebox, see [Node boxes], OPTIONAL, + sound_open_door = sound play for open door, OPTIONAL, + sound_close_door = sound play for close door, OPTIONAL, + only_placer_can_open = true/false, + ^ If true, only placer can open the door (locked for others) +} + +#Trapdoor definition +---------------- +{ + tile_front = "doors_trapdoor.png", + ^ the texture for the front and back of the trapdoor + tile_side: "doors_trapdoor_side.png", + ^ the tiles of the four side parts of the trapdoor + sound_open = sound to play when opening the trapdoor, OPTIONAL, + sound_close = sound to play when closing the trapdoor, OPTIONAL, + -> You can add any other node definition properties for minetest.register_node, + such as wield_image, inventory_image, sounds, groups, description, ... + Only node_box, selection_box, tiles, drop, drawtype, paramtype, paramtype2, on_rightclick + will be overwritten by the trapdoor registration function +} + +Farming API +----------- +The farming API allows you to easily register plants and hoes. + +farming.register_hoe(name, hoe definition) + -> Register a new hoe, see [#hoe definition] + +farming.register_plant(name, Plant definition) + -> Register a new growing plant, see [#Plant definition] + +#Hoe Definition +--------------- +{ + description = "", -- Description for tooltip + inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image + max_uses = 30, -- Uses until destroyed + material = "", -- Material for recipes + recipe = { -- Craft recipe, if material isn't used + {"air", "air", "air"}, + {"", "group:stick"}, + {"", "group:stick"}, + } +} + +#Plant definition +----------------- +{ + description = "", -- Description of seed item + inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image + steps = 8, -- How many steps the plant has to grow, until it can be harvested + ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber) + minlight = 13, -- Minimum light to grow + maxlight = default.LIGHT_MAX -- Maximum light to grow +} + +Screwdriver API +--------------- +The screwdriver API allows you to control a node's behaviour when a screwdriver is used on it. +To use it, add the on_screwdriver function to the node definition. +on_rotate(pos, node, user, mode, new_param2) +^ pos: position of the node that the screwdriver is being used on +^ node: that node +^ user: the player who used the screwdriver +^ mode: screwdriver.ROTATE_FACE or screwdriver.ROTATE_AXIS +^ new_param2: the new value of param2 that would have been set if on_rotate wasn't there +^ return value: false to disallow rotation, nil to keep default behaviour, true to allow + it but to indicate that changed have already been made (so the screwdriver will wear out) +^ use on_rotate = screwdriver.disallow to always disallow rotation +^ use on_rotate = screwdriver.rotate_simple to allow only face rotation + +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) + -> 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" + -> 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] + +stairs.register_slab(subname, recipeitem, groups, images, description, sounds) + -> Registers a slabs + -> 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" + -> 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] + +stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds) + -> A wrapper for stairs.register_stair and stairs.register_slab + -> Uses almost the same arguments as stairs.register_stair + -> desc_stair: Description for stair node + -> desc_slab: Description for slab node + +Xpanes API +---------- +Creates panes that automatically connect to each other + +xpanes.register_pane(subname, def) + -> subname: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}" + -> def: See [#Pane definition] + +#Pane definition +---------------- +{ + textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"}, + ^ More tiles aren't supported + groups = {group = rating}, + ^ Uses the known node groups, see [Known damage and digging time defining groups] + sounds = SoundSpec, + ^ See [#Default sounds] + recipe = {{"","","","","","","","",""}}, + ^ Recipe field only +} + +Raillike definitions +-------------------- +The following nodes use the group `connect_to_raillike` and will only connect to +raillike nodes within this group and the same group value. +Use `minetest.raillike_group()` to get the group value. + +| Node type | Raillike group name ++-----------------------+---------------------------------- +| default:rail | "rail" +| tnt:gunpowder | "gunpowder" +| tnt:gunpowder_burning | "gunpowder" + +Example: +If you want to add a new rail type and want it to connect with default:rail, +add `connect_to_raillike=minetest.raillike_group("rail")` into the `groups` table +of your node. + + +Default sounds +-------------- +Sounds inside the default table can be used within the sounds field of node definitions. + +default.node_sound_defaults() +default.node_sound_stone_defaults() +default.node_sound_dirt_defaults() +default.node_sound_sand_defaults() +default.node_sound_wood_defaults() +default.node_sound_leaves_defaults() +default.node_sound_glass_defaults() + +Default constants +----------------- +default.LIGHT_MAX +^ The maximum light level (see [Node definition] light_source) + +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 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 +--------- +To enable leaf decay for a node, add it to the "leafdecay" group. + +The rating of the group determines how far from a node in the group "tree" +the node can be without decaying. + +If param2 of the node is ~= 0, the node will always be preserved. Thus, if +the player places a node of that kind, you will want to set param2=1 or so. + +The function default.after_place_leaves can be set as after_place_node of a node +to set param2 to 1 if the player places the node (should not be used for nodes +that use param2 otherwise (e.g. facedir)). + +If the node is in the leafdecay_drop group then it will always be dropped as an +item. + +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. + +#Color groups +------------- +Base color groups: +- basecolor_white +- basecolor_grey +- basecolor_black +- basecolor_red +- basecolor_yellow +- basecolor_green +- basecolor_cyan +- basecolor_blue +- basecolor_magenta + +Extended color groups (* = equal to a base color): +* 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: +minetest.register_craft({ + type = "shapeless", + output = ':item_yellow', + recipe = {':item_no_color', 'group:basecolor_yellow'}, +}) + +#Color lists +------------ +dye.basecolors +^ Array containing the names of available base colors + +dye.excolors +^ Array containing the names of the available extended colors + +Trees +----- +default.grow_tree(pos, is_apple_tree) +^ Grows a tree or apple tree at pos + +default.grow_jungle_tree(pos) +^ Grows a jungletree at pos + +default.grow_pine_tree(pos) +^ Grows a pinetree at pos diff --git a/menu/header.png b/menu/header.png new file mode 100644 index 0000000..c22192d Binary files /dev/null and b/menu/header.png differ diff --git a/menu/icon.png b/menu/icon.png new file mode 100644 index 0000000..16f0ce7 Binary files /dev/null and b/menu/icon.png differ diff --git a/minetest.conf b/minetest.conf new file mode 100644 index 0000000..d6d3fd1 --- /dev/null +++ b/minetest.conf @@ -0,0 +1,15 @@ +give_initial_stuff = true +enable_pvp = true +fixed_map_seed = 14703851313754985906 +map_generation_limit = 160 + +# See mods/ctf_pvp_engine/minetest.conf.example for ctf_pvp_engine settings. +ctf.flag.capture_take = true +ctf.allocate_mode = 3 +ctf.diplomacy = false +ctf.players_can_change_team = false +ctf.node_ownership = false +ctf.new_game.teams = red, red, 15, 7, 39; blue, blue, -9, 9, -43 +ctf.new_game.clear_inv = true +ctf.endgame.destroy_team = true +ctf.endgame.reset_on_winner = true diff --git a/minetest.conf.example b/minetest.conf.example new file mode 100644 index 0000000..38869e7 --- /dev/null +++ b/minetest.conf.example @@ -0,0 +1,26 @@ +# 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 +#creative_mode = false + +# The time in seconds after which the bones of a dead player can be looted by everyone +# 0 to disable +#share_bones_time = 1200 + +# Whether fire should be disabled (all fire nodes will instantly disappear) +#disable_fire = false + +# Whether steel tools, torches and cobblestone should be given to new players +#give_initial_stuff = false + +# Whether the TNT mod should be enabled +#enable_tnt = + +# The radius of a TNT explosion +#tnt_radius = 3 + +# See mods/ctf_pvp_engine/minetest.conf.example for ctf_pvp_engine settings. diff --git a/mods/bones/README.txt b/mods/bones/README.txt new file mode 100644 index 0000000..b0ebed8 --- /dev/null +++ b/mods/bones/README.txt @@ -0,0 +1,17 @@ +Minetest 0.4 mod: bones +======================= + +License of source code: +----------------------- +Copyright (C) 2012 PilzAdam + +WTFPL + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +---------------------- +Bad_Command_ diff --git a/mods/bones/depends.txt b/mods/bones/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/bones/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/bones/init.lua b/mods/bones/init.lua new file mode 100644 index 0000000..f35d519 --- /dev/null +++ b/mods/bones/init.lua @@ -0,0 +1,219 @@ +-- 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 then + return true + end + return false +end + +bones.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]".. + default.get_hotbar_bg(0,4.85) + +local share_bones_time = tonumber(minetest.setting_get("share_bones_time") or 1200) +local share_bones_time_early = tonumber(minetest.setting_get("share_bones_time_early") or (share_bones_time/4)) + +minetest.register_node("bones:bones", { + description = "Bones", + tiles = { + "bones_top.png", + "bones_bottom.png", + "bones_side.png", + "bones_side.png", + "bones_rear.png", + "bones_front.png" + }, + paramtype2 = "facedir", + groups = {dig_immediate=2}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_gravel_footstep", gain=0.5}, + dug = {name="default_gravel_footstep", gain=1.0}, + }), + + can_dig = function(pos, player) + local inv = minetest.get_meta(pos):get_inventory() + return is_owner(pos, player:get_player_name()) and inv:is_empty("main") + end, + + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + if is_owner(pos, player:get_player_name()) then + return count + end + return 0 + end, + + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + return 0 + end, + + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if is_owner(pos, player:get_player_name()) then + return stack:get_count() + end + return 0 + end, + + on_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if meta:get_inventory():is_empty("main") then + minetest.remove_node(pos) + end + end, + + on_punch = function(pos, node, player) + if(not is_owner(pos, player:get_player_name())) then + return + end + + local inv = minetest.get_meta(pos):get_inventory() + local player_inv = player:get_inventory() + local has_space = true + + for i=1,inv:get_size("main") do + local stk = inv:get_stack("main", i) + if player_inv:room_for_item("main", stk) then + inv:set_stack("main", i, nil) + player_inv:add_item("main", stk) + else + has_space = false + break + end + end + + -- remove bones if player emptied them + if has_space then + minetest.remove_node(pos) + end + end, + + on_timer = function(pos, elapsed) + local meta = minetest.get_meta(pos) + local time = meta:get_int("time") + elapsed + if time >= share_bones_time then + meta:set_string("infotext", meta:get_string("owner").."'s old bones") + meta:set_string("owner", "") + else + meta:set_int("time", time) + return true + end + end, +}) + +local function may_replace(pos, player) + local node_name = minetest.get_node(pos).name + local node_definition = minetest.registered_nodes[node_name] + + -- if the node is unknown, we let the protection mod decide + -- this is consistent with when a player could dig or not dig it + -- unknown decoration would often be removed + -- while unknown building materials in use would usually be left + if not node_definition then + -- only replace nodes that are not protected + return not minetest.is_protected(pos, player:get_player_name()) + end + + -- allow replacing air and liquids + if node_name == "air" or node_definition.liquidtype ~= "none" then + return true + end + + -- don't replace filled chests and other nodes that don't allow it + local can_dig_func = node_definition.can_dig + if can_dig_func and not can_dig_func(pos, player) then + return false + end + + -- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones? + -- flowers being squished by bones are more realistical than a squished stone, too + -- exception are of course any protected buildable_to + return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name()) +end + +minetest.register_on_dieplayer(function(player) + if minetest.setting_getbool("creative_mode") then + return + end + + local player_inv = player:get_inventory() + if player_inv:is_empty("main") and + player_inv:is_empty("craft") then + return + end + + local pos = player:getpos() + pos.x = math.floor(pos.x+0.5) + pos.y = math.floor(pos.y+0.5) + pos.z = math.floor(pos.z+0.5) + local param2 = minetest.dir_to_facedir(player:get_look_dir()) + local player_name = player:get_player_name() + local player_inv = player:get_inventory() + + if (not may_replace(pos, player)) then + if (may_replace({x=pos.x, y=pos.y+1, z=pos.z}, player)) then + -- drop one node above if there's space + -- this should solve most cases of protection related deaths in which players dig straight down + -- yet keeps the bones reachable + pos.y = pos.y+1 + else + -- drop items instead of delete + for i=1,player_inv:get_size("main") do + minetest.add_item(pos, player_inv:get_stack("main", i)) + end + for i=1,player_inv:get_size("craft") do + minetest.add_item(pos, player_inv:get_stack("craft", i)) + end + -- empty lists main and craft + player_inv:set_list("main", {}) + player_inv:set_list("craft", {}) + return + end + end + + minetest.set_node(pos, {name="bones:bones", param2=param2}) + + 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 + minetest.add_item(pos, stack) + end + end + + player_inv:set_list("main", {}) + player_inv:set_list("craft", {}) + + meta:set_string("formspec", bones.bones_formspec) + meta:set_string("owner", player_name) + + if share_bones_time ~= 0 then + meta:set_string("infotext", player_name.."'s fresh bones") + + if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then + meta:set_int("time", 0) + else + meta:set_int("time", (share_bones_time - share_bones_time_early)) + end + + minetest.get_node_timer(pos):start(10) + else + meta:set_string("infotext", player_name.."'s bones") + end +end) diff --git a/mods/bones/textures/bones_bottom.png b/mods/bones/textures/bones_bottom.png new file mode 100644 index 0000000..ada72ce Binary files /dev/null and b/mods/bones/textures/bones_bottom.png differ diff --git a/mods/bones/textures/bones_front.png b/mods/bones/textures/bones_front.png new file mode 100644 index 0000000..9dcbb97 Binary files /dev/null and b/mods/bones/textures/bones_front.png differ diff --git a/mods/bones/textures/bones_rear.png b/mods/bones/textures/bones_rear.png new file mode 100644 index 0000000..8e1ac10 Binary files /dev/null and b/mods/bones/textures/bones_rear.png differ diff --git a/mods/bones/textures/bones_side.png b/mods/bones/textures/bones_side.png new file mode 100644 index 0000000..3b4810c Binary files /dev/null and b/mods/bones/textures/bones_side.png differ diff --git a/mods/bones/textures/bones_top.png b/mods/bones/textures/bones_top.png new file mode 100644 index 0000000..6119864 Binary files /dev/null and b/mods/bones/textures/bones_top.png differ diff --git a/mods/bucket/README.txt b/mods/bucket/README.txt new file mode 100644 index 0000000..7dad641 --- /dev/null +++ b/mods/bucket/README.txt @@ -0,0 +1,26 @@ +Minetest 0.4 mod: bucket +========================= + +License of source code: +----------------------- +Copyright (C) 2011-2012 Kahrl +Copyright (C) 2011-2012 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + + diff --git a/mods/bucket/depends.txt b/mods/bucket/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/mods/bucket/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua new file mode 100644 index 0000000..89730de --- /dev/null +++ b/mods/bucket/init.lua @@ -0,0 +1,192 @@ +-- Minetest 0.4 mod: bucket +-- See README.txt for licensing and other information. + +minetest.register_alias("bucket", "bucket:bucket_empty") +minetest.register_alias("bucket_water", "bucket:bucket_water") +minetest.register_alias("bucket_lava", "bucket:bucket_lava") + +minetest.register_craft({ + output = 'bucket:bucket_empty 1', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'', 'default:steel_ingot', ''}, + } +}) + +bucket = {} +bucket.liquids = {} + +local function check_protection(pos, name, text) + if minetest.is_protected(pos, name) then + minetest.log("action", (name ~= "" and name or "A mod") + .. " tried to " .. text + .. " at protected position " + .. minetest.pos_to_string(pos) + .. " with a bucket") + minetest.record_protection_violation(pos, name) + return true + end + return false +end + +-- Register a new liquid +-- source = name of the source node +-- flowing = name of the flowing node +-- itemname = name of the new bucket item (or nil if liquid is not takeable) +-- inventory_image = texture of the new bucket item (ignored if itemname == nil) +-- name = text description of the bucket item +-- groups = (optional) groups of the bucket item, for example {water_bucket = 1} +-- This function can be called from any mod (that depends on bucket). +function bucket.register_liquid(source, flowing, itemname, inventory_image, name, groups) + bucket.liquids[source] = { + source = source, + flowing = flowing, + itemname = itemname, + } + bucket.liquids[flowing] = bucket.liquids[source] + + if itemname ~= nil then + minetest.register_craftitem(itemname, { + description = name, + inventory_image = inventory_image, + stack_max = 1, + liquids_pointable = true, + groups = groups, + on_place = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + + local node = minetest.get_node_or_nil(pointed_thing.under) + local ndef + if node then + ndef = minetest.registered_nodes[node.name] + end + -- 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 + return ndef.on_rightclick( + pointed_thing.under, + node, user, + itemstack) or itemstack + end + + local place_liquid = function(pos, node, source, flowing) + if check_protection(pos, + user and user:get_player_name() or "", + "place "..source) then + return + end + minetest.add_node(pos, {name=source}) + end + + -- Check if pointing to a buildable node + if ndef and ndef.buildable_to then + -- buildable; replace the node + place_liquid(pointed_thing.under, node, + source, flowing) + else + -- not buildable to; place the liquid above + -- check if the node above can be replaced + local node = minetest.get_node_or_nil(pointed_thing.above) + if node and minetest.registered_nodes[node.name].buildable_to then + place_liquid(pointed_thing.above, + node, source, + flowing) + else + -- do not remove the bucket with the liquid + return + end + end + return {name="bucket:bucket_empty"} + end + }) + end +end + +minetest.register_craftitem("bucket:bucket_empty", { + description = "Empty Bucket", + inventory_image = "bucket.png", + stack_max = 99, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + -- Check if pointing to a liquid source + local node = minetest.get_node(pointed_thing.under) + local liquiddef = bucket.liquids[node.name] + local item_count = user:get_wielded_item():get_count() + + if liquiddef ~= nil + and liquiddef.itemname ~= nil + and node.name == liquiddef.source then + if check_protection(pointed_thing.under, + user:get_player_name(), + "take ".. node.name) then + return + end + + -- default set to return filled bucket + local giving_back = liquiddef.itemname + + -- check if holding more than 1 empty bucket + if item_count > 1 then + + -- if space in inventory add filled bucked, otherwise drop as item + local inv = user:get_inventory() + if inv:room_for_item("main", {name=liquiddef.itemname}) then + inv:add_item("main", liquiddef.itemname) + else + local pos = user:getpos() + pos.y = math.floor(pos.y + 0.5) + core.add_item(pos, liquiddef.itemname) + end + + -- set to return empty buckets minus 1 + giving_back = "bucket:bucket_empty "..tostring(item_count-1) + + end + + minetest.add_node(pointed_thing.under, {name="air"}) + + return ItemStack(giving_back) + end + end, +}) + +bucket.register_liquid( + "default:water_source", + "default:water_flowing", + "bucket:bucket_water", + "bucket_water.png", + "Water Bucket", + {water_bucket = 1} +) + +bucket.register_liquid( + "default:river_water_source", + "default:river_water_flowing", + "bucket:bucket_river_water", + "bucket_river_water.png", + "River Water Bucket", + {water_bucket = 1} +) + +bucket.register_liquid( + "default:lava_source", + "default:lava_flowing", + "bucket:bucket_lava", + "bucket_lava.png", + "Lava Bucket" +) + +minetest.register_craft({ + type = "fuel", + recipe = "bucket:bucket_lava", + burntime = 60, + replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}}, +}) + diff --git a/mods/bucket/textures/bucket.png b/mods/bucket/textures/bucket.png new file mode 100644 index 0000000..6779528 Binary files /dev/null and b/mods/bucket/textures/bucket.png differ diff --git a/mods/bucket/textures/bucket_lava.png b/mods/bucket/textures/bucket_lava.png new file mode 100644 index 0000000..d2baeb9 Binary files /dev/null and b/mods/bucket/textures/bucket_lava.png differ diff --git a/mods/bucket/textures/bucket_river_water.png b/mods/bucket/textures/bucket_river_water.png new file mode 100644 index 0000000..1d9e62a Binary files /dev/null and b/mods/bucket/textures/bucket_river_water.png differ diff --git a/mods/bucket/textures/bucket_water.png b/mods/bucket/textures/bucket_water.png new file mode 100644 index 0000000..877692a Binary files /dev/null and b/mods/bucket/textures/bucket_water.png differ diff --git a/mods/creative/README.txt b/mods/creative/README.txt new file mode 100644 index 0000000..7d49b98 --- /dev/null +++ b/mods/creative/README.txt @@ -0,0 +1,22 @@ +Minetest 0.4 mod: creative +========================== + +Implements creative mode. + +Switch on by using the "creative_mode" setting. + +Registered items that +- have a description, and +- do not have the group not_in_creative_inventory +are added to the creative inventory. + +License of source code and media files: +--------------------------------------- +Copyright (C) 2012 Perttu Ahola (celeron55) + +This program is free software. It comes without any warranty, to +the extent permitted by applicable law. You can redistribute it +and/or modify it under the terms of the Do What The Fuck You Want +To Public License, Version 2, as published by Sam Hocevar. See +http://sam.zoy.org/wtfpl/COPYING for more details. + diff --git a/mods/creative/depends.txt b/mods/creative/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/creative/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/creative/init.lua b/mods/creative/init.lua new file mode 100644 index 0000000..68d5180 --- /dev/null +++ b/mods/creative/init.lua @@ -0,0 +1,177 @@ +-- minetest/creative/init.lua + +creative_inventory = {} +creative_inventory.creative_inventory_size = 0 + +-- Create detached creative inventory after loading all mods +minetest.after(0, function() + local inv = minetest.create_detached_inventory("creative", { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + if minetest.setting_getbool("creative_mode") then + return count + else + return 0 + end + end, + allow_put = function(inv, listname, index, stack, player) + return 0 + end, + allow_take = function(inv, listname, index, stack, player) + if minetest.setting_getbool("creative_mode") then + return -1 + else + return 0 + end + end, + on_move = function(inv, from_list, from_index, to_list, to_index, count, player) + end, + on_put = function(inv, listname, index, stack, player) + end, + on_take = function(inv, listname, index, stack, player) + --print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack)) + if stack then + minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory") + --print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count())) + end + end, + }) + local creative_list = {} + for name,def in pairs(minetest.registered_items) do + if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) + and def.description and def.description ~= "" then + table.insert(creative_list, name) + end + end + table.sort(creative_list) + inv:set_size("main", #creative_list) + for _,itemstring in ipairs(creative_list) do + inv:add_item("main", ItemStack(itemstring)) + end + creative_inventory.creative_inventory_size = #creative_list + --print("creative inventory size: "..dump(creative_inventory.creative_inventory_size)) +end) + +-- Create the trash field +local trash = minetest.create_detached_inventory("creative_trash", { + -- Allow the stack to be placed and remove it in on_put() + -- This allows the creative inventory to restore the stack + allow_put = function(inv, listname, index, stack, player) + if minetest.setting_getbool("creative_mode") then + return stack:get_count() + else + return 0 + end + end, + on_put = function(inv, listname, index, stack, player) + inv:set_stack(listname, index, "") + end, +}) +trash:set_size("main", 1) + + +creative_inventory.set_creative_formspec = function(player, start_i, pagenum) + pagenum = math.floor(pagenum) + local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1) + player:set_inventory_formspec( + "size[13,7.5]".. + --"image[6,0.6;1,2;player.png]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_player;main;5,3.5;8,1;]".. + "list[current_player;main;5,4.75;8,3;8]".. + "list[current_player;craft;8,0;3,3;]".. + "list[current_player;craftpreview;12,1;1,1;]".. + "image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]".. + "list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]".. + "label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]".. + "button[0.3,6.5;1.6,1;creative_prev;<<]".. + "button[2.7,6.5;1.6,1;creative_next;>>]".. + "listring[current_player;main]".. + "listring[current_player;craft]".. + "listring[current_player;main]".. + "listring[detached:creative;main]".. + "label[5,1.5;Trash:]".. + "list[detached:creative_trash;main;5,2;1,1;]".. + default.get_hotbar_bg(5,3.5) + ) +end +minetest.register_on_joinplayer(function(player) + -- If in creative mode, modify player's inventory forms + if not minetest.setting_getbool("creative_mode") then + return + end + creative_inventory.set_creative_formspec(player, 0, 1) +end) +minetest.register_on_player_receive_fields(function(player, formname, fields) + if not minetest.setting_getbool("creative_mode") then + return + end + -- Figure out current page from formspec + local current_page = 0 + local formspec = player:get_inventory_formspec() + local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]") + start_i = tonumber(start_i) or 0 + + if fields.creative_prev then + start_i = start_i - 4*6 + end + if fields.creative_next then + start_i = start_i + 4*6 + end + + if start_i < 0 then + start_i = start_i + 4*6 + end + if start_i >= creative_inventory.creative_inventory_size then + start_i = start_i - 4*6 + end + + if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then + start_i = 0 + end + + creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1) +end) + +if minetest.setting_getbool("creative_mode") then + local digtime = 0.5 + minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x=1,y=1,z=2.5}, + range = 10, + tool_capabilities = { + full_punch_interval = 0.5, + max_drop_level = 3, + groupcaps = { + crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, + cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, + snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, + choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, + oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, + }, + damage_groups = {fleshy = 10}, + } + }) + + minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) + return true + end) + + function minetest.handle_node_drops(pos, drops, digger) + if not digger or not digger:is_player() then + return + end + local inv = digger:get_inventory() + if inv then + for _,item in ipairs(drops) do + item = ItemStack(item):get_name() + if not inv:contains_item("main", item) then + inv:add_item("main", item) + end + end + end + end + +end diff --git a/mods/ctf_pvp_engine b/mods/ctf_pvp_engine new file mode 160000 index 0000000..68e7cd3 --- /dev/null +++ b/mods/ctf_pvp_engine @@ -0,0 +1 @@ +Subproject commit 68e7cd397f486395d616d3fd00d6e20398841719 diff --git a/mods/default/README.txt b/mods/default/README.txt new file mode 100644 index 0000000..9474e45 --- /dev/null +++ b/mods/default/README.txt @@ -0,0 +1,204 @@ +Minetest 0.4 mod: default +========================== + +License of source code: +----------------------- +Copyright (C) 2011-2012 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + +Cisoun's WTFPL texture pack: + default_jungletree.png + default_jungletree_top.png + default_lava.png + default_leaves.png + default_sapling.png + default_sign_wall.png + default_stone.png + default_tree.png + default_tree_top.png + default_water.png + +Cisoun's conifers mod (WTFPL): + default_pine_needles.png + +Originating from G4JC's Almost MC Texture Pack: + default_torch.png + default_torch_on_ceiling.png + default_torch_on_floor.png + +VanessaE's animated torches (WTFPL): + default_torch_animated.png + default_torch_on_ceiling_animated.png + default_torch_on_floor_animated.png + default_torch_on_floor.png + +RealBadAngel's animated water (WTFPL): + default_water_source_animated.png + default_water_flowing_animated.png + +VanessaE (WTFPL): + default_nc_back.png + default_nc_front.png + default_nc_rb.png + default_nc_side.png + default_grass_*.png + default_desert_sand.png + default_desert_stone.png + default_desert_stone_brick.png + default_sand.png + +Calinou (CC BY-SA): + default_brick.png + default_papyrus.png + default_mineral_copper.png + default_glass_detail.png + +MirceaKitsune (WTFPL): + character.x + +Jordach (CC BY-SA 3.0): + character.png + +PilzAdam (WTFPL): + default_jungleleaves.png + default_junglesapling.png + default_junglewood.png + default_obsidian_glass.png + default_obsidian_shard.png + default_mineral_gold.png + default_snowball.png + +jojoa1997 (WTFPL): + default_obsidian.png + +InfinityProject (WTFPL): + default_mineral_diamond.png + +Splizard (CC BY-SA 3.0): + default_snow.png + default_snow_side.png + default_ice.png + default_pine_sapling.png + +Zeg9 (CC BY-SA 3.0): + default_coal_block.png + default_steel_block.png + default_copper_block.png + default_bronze_block.png + default_gold_block.png + +paramat (CC BY-SA 3.0): + wieldhand.png, based on character.png by Jordach (CC BY-SA 3.0) + default_pinetree.png + default_pinetree_top.png + default_pinewood.png + default_sandstone_brick.png + default_obsidian_brick.png + default_river_water.png + default_river_water_source_animated.png + default_river_water_flowing_animated.png + +brunob.santos (CC BY-SA 4.0): + default_desert_cobble.png + +BlockMen (CC BY-SA 3.0): + default_stone_brick.png + default_wood.png + default_clay_brick.png + default_iron_ingot.png + 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 + default_stick.png + default_chest_front.png + default_chest_lock.png + default_chest_side.png + default_chest_top.png + default_mineral_mese.png + default_meselamp.png + bubble.png + heart.png + gui_*.png + +Neuromancer (CC BY-SA 2.0): + default_cobble.png, based on texture by Brane praefect + default_mossycobble.png, based on texture by Brane praefect +Neuromancer (CC BY-SA 3.0): + default_dirt.png + default_furnace_*.png + +Philipbenr (CC BY-SA 3.0): + default_grass.png + default_grass_side.png + +Glass breaking sounds (CC BY 3.0): + 1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ + 2: http://www.freesound.org/people/Tomlija/sounds/97669/ + 3: http://www.freesound.org/people/lsprice/sounds/88808/ + +Mito551 (sounds) (CC BY-SA): + default_dig_choppy.ogg + default_dig_cracky.ogg + default_dig_crumbly.1.ogg + default_dig_crumbly.2.ogg + default_dig_dig_immediate.ogg + default_dig_oddly_breakable_by_hand.ogg + default_dug_node.1.ogg + default_dug_node.2.ogg + default_grass_footstep.1.ogg + default_grass_footstep.2.ogg + default_grass_footstep.3.ogg + default_gravel_footstep.1.ogg + default_gravel_footstep.2.ogg + default_gravel_footstep.3.ogg + default_gravel_footstep.4.ogg + default_grass_footstep.1.ogg + default_place_node.1.ogg + default_place_node.2.ogg + 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 + default_sand_footstep.1.ogg + default_sand_footstep.2.ogg + default_wood_footstep.1.ogg + default_wood_footstep.2.ogg + default_dirt_footstep.1.ogg + default_dirt_footstep.2.ogg + default_glass_footstep.ogg + +Gambit (WTFPL): + default_bronze_ingot.png + default_copper_ingot.png + default_copper_lump.png + default_iron_lump.png + default_gold_lump.png + default_clay_lump.png + default_coal.png + default_grass_*.png + default_paper.png + default_diamond_block.png diff --git a/mods/default/aliases.lua b/mods/default/aliases.lua new file mode 100644 index 0000000..7247751 --- /dev/null +++ b/mods/default/aliases.lua @@ -0,0 +1,72 @@ +-- mods/default/aliases.lua + +-- Aliases to support loading worlds using nodes following the old naming convention +-- These can also be helpful when using chat commands, for example /giveme +minetest.register_alias("stone", "default:stone") +minetest.register_alias("stone_with_coal", "default:stone_with_coal") +minetest.register_alias("stone_with_iron", "default:stone_with_iron") +minetest.register_alias("dirt_with_grass", "default:dirt_with_grass") +minetest.register_alias("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps") +minetest.register_alias("dirt", "default:dirt") +minetest.register_alias("sand", "default:sand") +minetest.register_alias("gravel", "default:gravel") +minetest.register_alias("sandstone", "default:sandstone") +minetest.register_alias("clay", "default:clay") +minetest.register_alias("brick", "default:brick") +minetest.register_alias("tree", "default:tree") +minetest.register_alias("jungletree", "default:jungletree") +minetest.register_alias("junglegrass", "default:junglegrass") +minetest.register_alias("leaves", "default:leaves") +minetest.register_alias("cactus", "default:cactus") +minetest.register_alias("papyrus", "default:papyrus") +minetest.register_alias("bookshelf", "default:bookshelf") +minetest.register_alias("glass", "default:glass") +minetest.register_alias("wooden_fence", "default:fence_wood") +minetest.register_alias("rail", "default:rail") +minetest.register_alias("ladder", "default:ladder") +minetest.register_alias("wood", "default:wood") +minetest.register_alias("mese", "default:mese") +minetest.register_alias("cloud", "default:cloud") +minetest.register_alias("water_flowing", "default:water_flowing") +minetest.register_alias("water_source", "default:water_source") +minetest.register_alias("lava_flowing", "default:lava_flowing") +minetest.register_alias("lava_source", "default:lava_source") +minetest.register_alias("torch", "default:torch") +minetest.register_alias("sign_wall", "default:sign_wall") +minetest.register_alias("furnace", "default:furnace") +minetest.register_alias("chest", "default:chest") +minetest.register_alias("locked_chest", "default:chest_locked") +minetest.register_alias("cobble", "default:cobble") +minetest.register_alias("mossycobble", "default:mossycobble") +minetest.register_alias("steelblock", "default:steelblock") +minetest.register_alias("nyancat", "default:nyancat") +minetest.register_alias("nyancat_rainbow", "default:nyancat_rainbow") +minetest.register_alias("sapling", "default:sapling") +minetest.register_alias("apple", "default:apple") + +minetest.register_alias("WPick", "default:pick_wood") +minetest.register_alias("STPick", "default:pick_stone") +minetest.register_alias("SteelPick", "default:pick_steel") +minetest.register_alias("MesePick", "default:pick_mese") +minetest.register_alias("WShovel", "default:shovel_wood") +minetest.register_alias("STShovel", "default:shovel_stone") +minetest.register_alias("SteelShovel", "default:shovel_steel") +minetest.register_alias("WAxe", "default:axe_wood") +minetest.register_alias("STAxe", "default:axe_stone") +minetest.register_alias("SteelAxe", "default:axe_steel") +minetest.register_alias("WSword", "default:sword_wood") +minetest.register_alias("STSword", "default:sword_stone") +minetest.register_alias("SteelSword", "default:sword_steel") + +minetest.register_alias("Stick", "default:stick") +minetest.register_alias("paper", "default:paper") +minetest.register_alias("book", "default:book") +minetest.register_alias("lump_of_coal", "default:coal_lump") +minetest.register_alias("lump_of_iron", "default:iron_lump") +minetest.register_alias("lump_of_clay", "default:clay_lump") +minetest.register_alias("steel_ingot", "default:steel_ingot") +minetest.register_alias("clay_brick", "default:clay_brick") +minetest.register_alias("snow", "default:snow") + +-- Mese now comes in the form of blocks, ore, crystal and fragments +minetest.register_alias("default:mese", "default:mese_block") diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua new file mode 100644 index 0000000..354efa4 --- /dev/null +++ b/mods/default/crafting.lua @@ -0,0 +1,838 @@ +-- mods/default/crafting.lua + +minetest.register_craft({ + output = 'default:wood 4', + recipe = { + {'default:tree'}, + } +}) + +minetest.register_craft({ + output = 'default:junglewood 4', + recipe = { + {'default:jungletree'}, + } +}) + +minetest.register_craft({ + output = 'default:pinewood 4', + recipe = { + {'default:pinetree'}, + } +}) + +minetest.register_craft({ + output = 'default:stick 4', + recipe = { + {'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:fence_wood 2', + recipe = { + {'group:stick', 'group:stick', 'group:stick'}, + {'group:stick', 'group:stick', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sign_wall', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:torch 4', + recipe = { + {'default:coal_lump'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:pick_wood', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_stone', + recipe = { + {'group:stone', 'group:stone', 'group:stone'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_diamond', + recipe = { + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_wood', + recipe = { + {'group:wood'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_stone', + recipe = { + {'group:stone'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_steel', + recipe = { + {'default:steel_ingot'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_bronze', + recipe = { + {'default:bronze_ingot'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_mese', + recipe = { + {'default:mese_crystal'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_diamond', + recipe = { + {'default:diamond'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_wood', + recipe = { + {'group:wood', 'group:wood'}, + {'group:wood', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_stone', + recipe = { + {'group:stone', 'group:stone'}, + {'group:stone', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_diamond', + recipe = { + {'default:diamond', 'default:diamond'}, + {'default:diamond', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_wood', + recipe = { + {'group:wood', 'group:wood'}, + {'group:stick', 'group:wood'}, + {'group:stick',''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_stone', + recipe = { + {'group:stone', 'group:stone'}, + {'group:stick', 'group:stone'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'group:stick', 'default:steel_ingot'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot'}, + {'group:stick', 'default:bronze_ingot'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal'}, + {'group:stick', 'default:mese_crystal'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_diamond', + recipe = { + {'default:diamond', 'default:diamond'}, + {'group:stick', 'default:diamond'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:sword_wood', + recipe = { + {'group:wood'}, + {'group:wood'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_stone', + recipe = { + {'group:stone'}, + {'group:stone'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_steel', + recipe = { + {'default:steel_ingot'}, + {'default:steel_ingot'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_bronze', + recipe = { + {'default:bronze_ingot'}, + {'default:bronze_ingot'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_mese', + recipe = { + {'default:mese_crystal'}, + {'default:mese_crystal'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_diamond', + recipe = { + {'default:diamond'}, + {'default:diamond'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:rail 24', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:steel_ingot', 'group:stick', 'default:steel_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:chest', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', '', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:chest_locked', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'default:steel_ingot', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:furnace', + recipe = { + {'group:stone', 'group:stone', 'group:stone'}, + {'group:stone', '', 'group:stone'}, + {'group:stone', 'group:stone', 'group:stone'}, + } +}) + +minetest.register_craft({ + type = "shapeless", + output = "default:bronze_ingot", + recipe = {"default:steel_ingot", "default:copper_ingot"}, +}) + +minetest.register_craft({ + output = 'default:coalblock', + recipe = { + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + } +}) + +minetest.register_craft({ + output = 'default:coal_lump 9', + recipe = { + {'default:coalblock'}, + } +}) + +minetest.register_craft({ + output = 'default:steelblock', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:steel_ingot 9', + recipe = { + {'default:steelblock'}, + } +}) + +minetest.register_craft({ + output = 'default:copperblock', + recipe = { + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:copper_ingot 9', + recipe = { + {'default:copperblock'}, + } +}) + +minetest.register_craft({ + output = 'default:bronzeblock', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:bronze_ingot 9', + recipe = { + {'default:bronzeblock'}, + } +}) + +minetest.register_craft({ + output = 'default:goldblock', + recipe = { + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:gold_ingot 9', + recipe = { + {'default:goldblock'}, + } +}) + +minetest.register_craft({ + output = 'default:diamondblock', + recipe = { + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'default:diamond', 'default:diamond', 'default:diamond'}, + } +}) + +minetest.register_craft({ + output = 'default:diamond 9', + recipe = { + {'default:diamondblock'}, + } +}) + +minetest.register_craft({ + output = 'default:sandstone', + recipe = { + {'group:sand', 'group:sand'}, + {'group:sand', 'group:sand'}, + } +}) + +minetest.register_craft({ + output = 'default:sand 4', + recipe = { + {'default:sandstone'}, + } +}) + +minetest.register_craft({ + output = 'default:sandstonebrick 4', + recipe = { + {'default:sandstone', 'default:sandstone'}, + {'default:sandstone', 'default:sandstone'}, + } +}) + +minetest.register_craft({ + output = 'default:clay', + recipe = { + {'default:clay_lump', 'default:clay_lump'}, + {'default:clay_lump', 'default:clay_lump'}, + } +}) + +minetest.register_craft({ + output = 'default:brick', + recipe = { + {'default:clay_brick', 'default:clay_brick'}, + {'default:clay_brick', 'default:clay_brick'}, + } +}) + +minetest.register_craft({ + output = 'default:clay_brick 4', + recipe = { + {'default:brick'}, + } +}) + +minetest.register_craft({ + output = 'default:paper', + recipe = { + {'default:papyrus', 'default:papyrus', 'default:papyrus'}, + } +}) + +minetest.register_craft({ + output = 'default:book', + recipe = { + {'default:paper'}, + {'default:paper'}, + {'default:paper'}, + } +}) + +minetest.register_craft({ + output = 'default:bookshelf', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'default:book', 'default:book', 'default:book'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:ladder', + recipe = { + {'group:stick', '', 'group:stick'}, + {'group:stick', 'group:stick', 'group:stick'}, + {'group:stick', '', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = 'default:mese_crystal 9', + recipe = { + {'default:mese'}, + } +}) + +minetest.register_craft({ + output = 'default:mese_crystal_fragment 9', + recipe = { + {'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = 'default:meselamp 1', + recipe = { + {'', 'default:mese_crystal',''}, + {'default:mese_crystal', 'default:glass', 'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = 'default:obsidian_shard 9', + recipe = { + {'default:obsidian'} + } +}) + +minetest.register_craft({ + output = 'default:obsidian', + recipe = { + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + } +}) + +minetest.register_craft({ + output = 'default:obsidianbrick 4', + recipe = { + {'default:obsidian', 'default:obsidian'}, + {'default:obsidian', 'default:obsidian'} + } +}) + +minetest.register_craft({ + output = 'default:stonebrick 4', + recipe = { + {'default:stone', 'default:stone'}, + {'default:stone', 'default:stone'}, + } +}) + +minetest.register_craft({ + output = 'default:desert_stonebrick 4', + recipe = { + {'default:desert_stone', 'default:desert_stone'}, + {'default:desert_stone', 'default:desert_stone'}, + } +}) + +minetest.register_craft({ + output = 'default:snowblock', + recipe = { + {'default:snow', 'default:snow', 'default:snow'}, + {'default:snow', 'default:snow', 'default:snow'}, + {'default:snow', 'default:snow', 'default:snow'}, + } +}) + +minetest.register_craft({ + output = 'default:snow 9', + recipe = { + {'default:snowblock'}, + } +}) + +-- +-- Crafting (tool repair) +-- +minetest.register_craft({ + type = "toolrepair", + additional_wear = -0.02, +}) + +-- +-- Cooking recipes +-- + +minetest.register_craft({ + type = "cooking", + output = "default:glass", + recipe = "group:sand", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:obsidian_glass", + recipe = "default:obsidian_shard", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:stone", + recipe = "default:cobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:stone", + recipe = "default:mossycobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:desert_stone", + recipe = "default:desert_cobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:steel_ingot", + recipe = "default:iron_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:copper_ingot", + recipe = "default:copper_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:gold_ingot", + recipe = "default:gold_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:clay_brick", + recipe = "default:clay_lump", +}) + +-- +-- Fuels +-- + +minetest.register_craft({ + type = "fuel", + recipe = "group:tree", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglegrass", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "group:leaves", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:cactus", + burntime = 15, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:papyrus", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:bookshelf", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_wood", + burntime = 15, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:ladder", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "group:wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:lava_source", + burntime = 60, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:torch", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sign_wall", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:chest", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:chest_locked", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:nyancat", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:nyancat_rainbow", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:apple", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:coal_lump", + burntime = 40, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:coalblock", + burntime = 370, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglesapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:grass_1", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_sapling", + burntime = 10, +}) + diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua new file mode 100644 index 0000000..facff57 --- /dev/null +++ b/mods/default/craftitems.lua @@ -0,0 +1,159 @@ +-- mods/default/craftitems.lua + +minetest.register_craftitem("default:stick", { + description = "Stick", + inventory_image = "default_stick.png", + groups = {stick=1}, +}) + +minetest.register_craftitem("default:paper", { + description = "Paper", + inventory_image = "default_paper.png", +}) + +local function book_on_use(itemstack, user, pointed_thing) + local player_name = user:get_player_name() + local data = minetest.deserialize(itemstack:get_metadata()) + local title, text, owner = "", "", player_name + if data then + title, text, owner = data.title, data.text, data.owner + end + local formspec + if owner == player_name then + formspec = "size[8,8]"..default.gui_bg.. + "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.. + "label[0.5,0.5;by "..owner.."]".. + "label[0.5,0;"..minetest.formspec_escape(title).."]".. + "textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]" + end + minetest.show_formspec(user:get_player_name(), "default:book", formspec) +end + +minetest.register_on_player_receive_fields(function(player, form_name, fields) + if form_name ~= "default:book" or not fields.save or + fields.title == "" or fields.text == "" then + return + end + local inv = player:get_inventory() + local stack = player:get_wielded_item() + local new_stack, data + if stack:get_name() ~= "default:book_written" then + local count = stack:get_count() + if count == 1 then + stack:set_name("default:book_written") + else + stack:set_count(count - 1) + new_stack = ItemStack("default:book_written") + end + else + data = minetest.deserialize(stack:get_metadata()) + end + if not data then data = {} end + data.title = fields.title + data.text = fields.text + data.owner = player:get_player_name() + local data_str = minetest.serialize(data) + if new_stack then + new_stack:set_metadata(data_str) + if inv:room_for_item("main", new_stack) then + inv:add_item("main", new_stack) + else + minetest.add_item(player:getpos(), new_stack) + end + else + stack:set_metadata(data_str) + end + player:set_wielded_item(stack) +end) + +minetest.register_craftitem("default:book", { + description = "Book", + inventory_image = "default_book.png", + groups = {book=1}, + on_use = book_on_use, +}) + +minetest.register_craftitem("default:book_written", { + description = "Book With Text", + inventory_image = "default_book.png", + groups = {book=1, not_in_creative_inventory=1}, + stack_max = 1, + on_use = book_on_use, +}) + +minetest.register_craftitem("default:coal_lump", { + description = "Coal Lump", + inventory_image = "default_coal_lump.png", + groups = {coal = 1} +}) + +minetest.register_craftitem("default:iron_lump", { + description = "Iron Lump", + inventory_image = "default_iron_lump.png", +}) + +minetest.register_craftitem("default:copper_lump", { + description = "Copper Lump", + inventory_image = "default_copper_lump.png", +}) + +minetest.register_craftitem("default:mese_crystal", { + description = "Mese Crystal", + inventory_image = "default_mese_crystal.png", +}) + +minetest.register_craftitem("default:gold_lump", { + description = "Gold Lump", + inventory_image = "default_gold_lump.png", +}) + +minetest.register_craftitem("default:diamond", { + description = "Diamond", + inventory_image = "default_diamond.png", +}) + +minetest.register_craftitem("default:clay_lump", { + description = "Clay Lump", + inventory_image = "default_clay_lump.png", +}) + +minetest.register_craftitem("default:steel_ingot", { + description = "Steel Ingot", + inventory_image = "default_steel_ingot.png", +}) + +minetest.register_craftitem("default:copper_ingot", { + description = "Copper Ingot", + inventory_image = "default_copper_ingot.png", +}) + +minetest.register_craftitem("default:bronze_ingot", { + description = "Bronze Ingot", + inventory_image = "default_bronze_ingot.png", +}) + +minetest.register_craftitem("default:gold_ingot", { + description = "Gold Ingot", + inventory_image = "default_gold_ingot.png" +}) + +minetest.register_craftitem("default:mese_crystal_fragment", { + description = "Mese Crystal Fragment", + inventory_image = "default_mese_crystal_fragment.png", +}) + +minetest.register_craftitem("default:clay_brick", { + description = "Clay Brick", + inventory_image = "default_clay_brick.png", +}) + +minetest.register_craftitem("default:obsidian_shard", { + description = "Obsidian Shard", + inventory_image = "default_obsidian_shard.png", +}) diff --git a/mods/default/functions.lua b/mods/default/functions.lua new file mode 100644 index 0000000..426e27c --- /dev/null +++ b/mods/default/functions.lua @@ -0,0 +1,345 @@ +-- mods/default/functions.lua + +-- +-- Sounds +-- + +function default.node_sound_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "", gain = 1.0} + table.dug = table.dug or + {name = "default_dug_node", gain = 0.25} + table.place = table.place or + {name = "default_place_node_hard", gain = 1.0} + return table +end + +function default.node_sound_stone_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_hard_footstep", gain = 0.5} + table.dug = table.dug or + {name = "default_hard_footstep", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_dirt_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_dirt_footstep", gain = 1.0} + table.dug = table.dug or + {name = "default_dirt_footstep", gain = 1.5} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_sand_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_sand_footstep", gain = 0.2} + table.dug = table.dug or + {name = "default_sand_footstep", gain = 0.4} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_wood_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_wood_footstep", gain = 0.5} + table.dug = table.dug or + {name = "default_wood_footstep", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_leaves_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_grass_footstep", gain = 0.35} + table.dug = table.dug or + {name = "default_grass_footstep", gain = 0.7} + table.dig = table.dig or + {name = "default_dig_crumbly", gain = 0.4} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_glass_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_glass_footstep", gain = 0.5} + table.dug = table.dug or + {name = "default_break_glass", gain = 1.0} + default.node_sound_defaults(table) + return table +end + + +-- +-- Lavacooling +-- + +default.cool_lava_source = function(pos) + minetest.set_node(pos, {name = "default:obsidian"}) + minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25}) +end + +default.cool_lava_flowing = function(pos) + minetest.set_node(pos, {name = "default:stone"}) + minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25}) +end + +minetest.register_abm({ + nodenames = {"default:lava_flowing"}, + neighbors = {"group:water"}, + interval = 1, + chance = 1, + action = function(...) + default.cool_lava_flowing(...) + end, +}) + +minetest.register_abm({ + nodenames = {"default:lava_source"}, + neighbors = {"group:water"}, + interval = 1, + chance = 1, + action = function(...) + default.cool_lava_source(...) + end, +}) + + +-- +-- Papyrus and cactus growing +-- + +-- wrapping the functions in abm action is necessary to make overriding them possible + +function default.grow_cactus(pos, node) + if node.param2 >= 4 then + return + end + pos.y = pos.y - 1 + if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then + return + end + pos.y = pos.y + 1 + local height = 0 + while node.name == "default:cactus" and height < 4 do + height = height + 1 + pos.y = pos.y + 1 + node = minetest.get_node(pos) + end + if height == 4 or node.name ~= "air" then + return + end + minetest.set_node(pos, {name = "default:cactus"}) + return true +end + +function default.grow_papyrus(pos, node) + pos.y = pos.y - 1 + local name = minetest.get_node(pos).name + if name ~= "default:dirt_with_grass" and name ~= "default:dirt" then + return + end + if not minetest.find_node_near(pos, 3, {"group:water"}) then + return + end + pos.y = pos.y + 1 + local height = 0 + while node.name == "default:papyrus" and height < 4 do + height = height + 1 + pos.y = pos.y + 1 + node = minetest.get_node(pos) + end + if height == 4 or node.name ~= "air" then + return + end + minetest.set_node(pos, {name = "default:papyrus"}) + return true +end + +minetest.register_abm({ + nodenames = {"default:cactus"}, + neighbors = {"group:sand"}, + interval = 50, + chance = 20, + action = function(...) + default.grow_cactus(...) + end +}) + +minetest.register_abm({ + nodenames = {"default:papyrus"}, + neighbors = {"default:dirt", "default:dirt_with_grass"}, + interval = 50, + chance = 20, + action = function(...) + default.grow_papyrus(...) + end +}) + + +-- +-- dig upwards +-- + +function default.dig_up(pos, node, digger) + if digger == nil then return end + local np = {x = pos.x, y = pos.y + 1, z = pos.z} + local nn = minetest.get_node(np) + if nn.name == node.name then + minetest.node_dig(np, nn, digger) + end +end + + +-- +-- Leafdecay +-- + +default.leafdecay_trunk_cache = {} +default.leafdecay_enable_cache = true +-- Spread the load of finding trunks +default.leafdecay_trunk_find_allow_accumulator = 0 + +minetest.register_globalstep(function(dtime) + local finds_per_second = 5000 + default.leafdecay_trunk_find_allow_accumulator = + math.floor(dtime * finds_per_second) +end) + +default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) + local node = minetest.get_node(pos) + node.param2 = 1 + minetest.set_node(pos, node) +end + +minetest.register_abm({ + nodenames = {"group:leafdecay"}, + neighbors = {"air", "group:liquid"}, + -- A low interval and a high inverse chance spreads the load + interval = 2, + chance = 5, + + action = function(p0, node, _, _) + --print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") + local do_preserve = false + local d = minetest.registered_nodes[node.name].groups.leafdecay + if not d or d == 0 then + --print("not groups.leafdecay") + return + end + local n0 = minetest.get_node(p0) + if n0.param2 ~= 0 then + --print("param2 ~= 0") + return + end + local p0_hash = nil + if default.leafdecay_enable_cache then + p0_hash = minetest.hash_node_position(p0) + local trunkp = default.leafdecay_trunk_cache[p0_hash] + if trunkp then + local n = minetest.get_node(trunkp) + local reg = minetest.registered_nodes[n.name] + -- Assume ignore is a trunk, to make the thing + -- work at the border of the active area + if n.name == "ignore" or (reg and reg.groups.tree and + reg.groups.tree ~= 0) then + --print("cached trunk still exists") + return + end + --print("cached trunk is invalid") + -- Cache is invalid + table.remove(default.leafdecay_trunk_cache, p0_hash) + end + end + if default.leafdecay_trunk_find_allow_accumulator <= 0 then + return + end + default.leafdecay_trunk_find_allow_accumulator = + default.leafdecay_trunk_find_allow_accumulator - 1 + -- Assume ignore is a trunk, to make the thing + -- work at the border of the active area + local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"}) + if p1 then + do_preserve = true + if default.leafdecay_enable_cache then + --print("caching trunk") + -- Cache the trunk + default.leafdecay_trunk_cache[p0_hash] = p1 + end + end + if not do_preserve then + -- Drop stuff other than the node itself + local itemstacks = minetest.get_node_drops(n0.name) + for _, itemname in ipairs(itemstacks) do + if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or + itemname ~= n0.name then + local p_drop = { + x = p0.x - 0.5 + math.random(), + y = p0.y - 0.5 + math.random(), + z = p0.z - 0.5 + math.random(), + } + minetest.add_item(p_drop, itemname) + end + end + -- Remove node + minetest.remove_node(p0) + nodeupdate(p0) + end + end +}) + + +-- +-- Grass growing +-- + +minetest.register_abm({ + nodenames = {"default:dirt"}, + interval = 2, + chance = 200, + action = function(pos, node) + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + local name = minetest.get_node(above).name + local nodedef = minetest.registered_nodes[name] + if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") and + nodedef.liquidtype == "none" and + (minetest.get_node_light(above) or 0) >= 13 then + if name == "default:snow" or name == "default:snowblock" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + else + minetest.set_node(pos, {name = "default:dirt_with_grass"}) + end + end + end +}) + +minetest.register_abm({ + nodenames = {"default:dirt_with_grass"}, + interval = 2, + chance = 20, + action = function(pos, node) + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + local name = minetest.get_node(above).name + local nodedef = minetest.registered_nodes[name] + if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or + nodedef.paramtype == "light") and + nodedef.liquidtype == "none") then + minetest.set_node(pos, {name = "default:dirt"}) + end + end +}) + diff --git a/mods/default/furnace.lua b/mods/default/furnace.lua new file mode 100644 index 0000000..6d89aae --- /dev/null +++ b/mods/default/furnace.lua @@ -0,0 +1,291 @@ + +-- +-- Formspecs +-- + +local function active_formspec(fuel_percent, item_percent) + local formspec = + "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_name;src;2.75,0.5;1,1;]".. + "list[current_name;fuel;2.75,2.5;1,1;]".. + "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:".. + (100-fuel_percent)..":default_furnace_fire_fg.png]".. + "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:".. + (item_percent)..":gui_furnace_arrow_fg.png^[transformR270]".. + "list[current_name;dst;4.75,0.96;2,2;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "listring[current_name;dst]".. + "listring[current_player;main]".. + "listring[current_name;src]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0, 4.25) + return formspec +end + +local inactive_formspec = + "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_name;src;2.75,0.5;1,1;]".. + "list[current_name;fuel;2.75,2.5;1,1;]".. + "image[2.75,1.5;1,1;default_furnace_fire_bg.png]".. + "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. + "list[current_name;dst;4.75,0.96;2,2;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "listring[current_name;dst]".. + "listring[current_player;main]".. + "listring[current_name;src]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0, 4.25) + +-- +-- Node callback functions that are the same for active and inactive furnace +-- + +local function can_dig(pos, player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src") +end + +local function allow_metadata_inventory_put(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if listname == "fuel" then + if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then + if inv:is_empty("src") then + meta:set_string("infotext", "Furnace is empty") + end + return stack:get_count() + else + return 0 + end + elseif listname == "src" then + return stack:get_count() + elseif listname == "dst" then + return 0 + end +end + +local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local stack = inv:get_stack(from_list, from_index) + return allow_metadata_inventory_put(pos, to_list, to_index, stack, player) +end + +local function allow_metadata_inventory_take(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() +end + +-- +-- Node definitions +-- + +minetest.register_node("default:furnace", { + description = "Furnace", + tiles = { + "default_furnace_top.png", "default_furnace_bottom.png", + "default_furnace_side.png", "default_furnace_side.png", + "default_furnace_side.png", "default_furnace_front.png" + }, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + + can_dig = can_dig, + + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_move = allow_metadata_inventory_move, + allow_metadata_inventory_take = allow_metadata_inventory_take, +}) + +minetest.register_node("default:furnace_active", { + description = "Furnace", + tiles = { + "default_furnace_top.png", "default_furnace_bottom.png", + "default_furnace_side.png", "default_furnace_side.png", + "default_furnace_side.png", + { + image = "default_furnace_front_active.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + } + }, + paramtype2 = "facedir", + light_source = 8, + drop = "default:furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + + can_dig = can_dig, + + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_move = allow_metadata_inventory_move, + allow_metadata_inventory_take = allow_metadata_inventory_take, +}) + +-- +-- ABM +-- + +local function swap_node(pos, name) + local node = minetest.get_node(pos) + if node.name == name then + return + end + node.name = name + minetest.swap_node(pos, node) +end + +minetest.register_abm({ + nodenames = {"default:furnace", "default:furnace_active"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + -- + -- Inizialize metadata + -- + local meta = minetest.get_meta(pos) + local fuel_time = meta:get_float("fuel_time") or 0 + local src_time = meta:get_float("src_time") or 0 + local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 + + -- + -- Inizialize inventory + -- + local inv = meta:get_inventory() + for listname, size in pairs({ + src = 1, + fuel = 1, + dst = 4, + }) do + if inv:get_size(listname) ~= size then + inv:set_size(listname, size) + end + end + local srclist = inv:get_list("src") + local fuellist = inv:get_list("fuel") + local dstlist = inv:get_list("dst") + + -- + -- Cooking + -- + + -- Check if we have cookable content + local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + local cookable = true + + if cooked.time == 0 then + cookable = false + 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 + 1 + + -- If there is a cookable item then check if it is ready yet + if cookable then + src_time = src_time + 1 + if src_time >= cooked.time then + -- Place result in dst list if possible + if inv:room_for_item("dst", cooked.item) then + inv:add_item("dst", cooked.item) + inv:set_stack("src", 1, aftercooked.items[1]) + src_time = 0 + end + end + end + else + -- Furnace ran out of fuel + if cookable then + -- We need to get new fuel + local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + + if fuel.time == 0 then + -- No valid fuel in fuel list + fuel_totaltime = 0 + fuel_time = 0 + src_time = 0 + else + -- Take fuel from fuel list + inv:set_stack("fuel", 1, afterfuel.items[1]) + + fuel_totaltime = fuel.time + fuel_time = 0 + + end + else + -- We don't need to get new fuel since there is no cookable item + fuel_totaltime = 0 + fuel_time = 0 + src_time = 0 + end + end + + -- + -- Update formspec, infotext and node + -- + local formspec = inactive_formspec + local item_state = "" + local item_percent = 0 + if cookable then + item_percent = math.floor(src_time / cooked.time * 100) + item_state = item_percent .. "%" + else + if srclist[1]:is_empty() then + item_state = "Empty" + else + item_state = "Not cookable" + end + end + + local fuel_state = "Empty" + local active = "inactive " + if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then + active = "active " + local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) + fuel_state = fuel_percent .. "%" + formspec = active_formspec(fuel_percent, item_percent) + swap_node(pos, "default:furnace_active") + else + if not fuellist[1]:is_empty() then + fuel_state = "0%" + end + swap_node(pos, "default:furnace") + end + + local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" + + -- + -- Set meta values + -- + meta:set_float("fuel_totaltime", fuel_totaltime) + meta:set_float("fuel_time", fuel_time) + meta:set_float("src_time", src_time) + meta:set_string("formspec", formspec) + meta:set_string("infotext", infotext) + end, +}) diff --git a/mods/default/init.lua b/mods/default/init.lua new file mode 100644 index 0000000..6f1b148 --- /dev/null +++ b/mods/default/init.lua @@ -0,0 +1,48 @@ +-- Minetest 0.4 mod: default +-- See README.txt for licensing and other information. + +-- The API documentation in here was moved into game_api.txt + +-- Definitions made by this mod that other mods can use too +default = {} + +default.LIGHT_MAX = 14 + +-- GUI related stuff +default.gui_bg = "bgcolor[#080808BB;true]" +default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" +default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + +function default.get_hotbar_bg(x,y) + local out = "" + for i=0,7,1 do + out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]" + end + return out +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;]".. + "list[current_player;craftpreview;5.75,1.5;1,1;]".. + "image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. + "listring[current_player;main]".. + "listring[current_player;craft]".. + default.get_hotbar_bg(0,4.25) + +-- Load files +dofile(minetest.get_modpath("default").."/functions.lua") +dofile(minetest.get_modpath("default").."/nodes.lua") +dofile(minetest.get_modpath("default").."/furnace.lua") +dofile(minetest.get_modpath("default").."/tools.lua") +dofile(minetest.get_modpath("default").."/craftitems.lua") +dofile(minetest.get_modpath("default").."/crafting.lua") +dofile(minetest.get_modpath("default").."/mapgen.lua") +dofile(minetest.get_modpath("default").."/player.lua") +dofile(minetest.get_modpath("default").."/trees.lua") +dofile(minetest.get_modpath("default").."/aliases.lua") +dofile(minetest.get_modpath("default").."/legacy.lua") diff --git a/mods/default/legacy.lua b/mods/default/legacy.lua new file mode 100644 index 0000000..76fcc8e --- /dev/null +++ b/mods/default/legacy.lua @@ -0,0 +1,25 @@ +-- mods/default/legacy.lua + +-- Horrible crap to support old code registering falling nodes +-- Don't use this and never do what this does, it's completely wrong! +-- (More specifically, the client and the C++ code doesn't get the group) +function default.register_falling_node(nodename, texture) + minetest.log("error", debug.traceback()) + minetest.log('error', "WARNING: default.register_falling_node is deprecated") + if minetest.registered_nodes[nodename] then + minetest.registered_nodes[nodename].groups.falling_node = 1 + end +end + +function default.spawn_falling_node(p, nodename) + spawn_falling_node(p, nodename) +end + +-- Liquids +WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha +WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity +LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity +LIGHT_MAX = default.LIGHT_MAX + +-- Formspecs +default.gui_suvival_form = default.gui_survival_form diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua new file mode 100644 index 0000000..4865341 --- /dev/null +++ b/mods/default/mapgen.lua @@ -0,0 +1,711 @@ +-- +-- Aliases for map generator outputs +-- + + +minetest.register_alias("mapgen_stone", "default:stone") +minetest.register_alias("mapgen_dirt", "default:dirt") +minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass") +minetest.register_alias("mapgen_sand", "default:sand") +minetest.register_alias("mapgen_water_source", "default:water_source") +minetest.register_alias("mapgen_river_water_source", "default:river_water_source") +minetest.register_alias("mapgen_lava_source", "default:lava_source") +minetest.register_alias("mapgen_gravel", "default:gravel") +minetest.register_alias("mapgen_desert_stone", "default:desert_stone") +minetest.register_alias("mapgen_desert_sand", "default:desert_sand") +minetest.register_alias("mapgen_dirt_with_snow", "default:dirt_with_snow") +minetest.register_alias("mapgen_snowblock", "default:snowblock") +minetest.register_alias("mapgen_snow", "default:snow") +minetest.register_alias("mapgen_ice", "default:ice") +minetest.register_alias("mapgen_sandstone", "default:sandstone") + +minetest.register_alias("mapgen_tree", "default:tree") +minetest.register_alias("mapgen_leaves", "default:leaves") +minetest.register_alias("mapgen_apple", "default:apple") +minetest.register_alias("mapgen_jungletree", "default:jungletree") +minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves") +minetest.register_alias("mapgen_junglegrass", "default:junglegrass") +minetest.register_alias("mapgen_pinetree", "default:pinetree") +minetest.register_alias("mapgen_pine_needles", "default:pine_needles") + +minetest.register_alias("mapgen_cobble", "default:cobble") +minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") +minetest.register_alias("mapgen_mossycobble", "default:mossycobble") +minetest.register_alias("mapgen_sandstonebrick", "default:sandstonebrick") +minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstonebrick") + + +-- +-- Register ores +-- + + +-- Blob ore first to avoid other ores inside blobs + +function default.register_ores() + minetest.register_ore({ + ore_type = "blob", + ore = "default:clay", + wherein = {"default:sand"}, + clust_scarcity = 24 * 24 * 24, + clust_size = 7, + y_min = -15, + y_max = 0, + noise_threshhold = 0, + noise_params = { + offset = 0.35, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = -316, + octaves = 1, + persist = 0.5 + }, + }) + + minetest.register_ore({ + ore_type = "blob", + ore = "default:sand", + wherein = {"default:stone"}, + clust_scarcity = 24 * 24 * 24, + clust_size = 7, + y_min = -63, + y_max = 4, + noise_threshhold = 0, + noise_params = { + offset = 0.35, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 2316, + octaves = 1, + persist = 0.5 + }, + }) + + minetest.register_ore({ + ore_type = "blob", + ore = "default:dirt", + wherein = {"default:stone"}, + clust_scarcity = 24 * 24 * 24, + clust_size = 7, + y_min = -63, + y_max = 31000, + noise_threshhold = 0, + noise_params = { + offset = 0.35, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 17676, + octaves = 1, + persist = 0.5 + }, + }) + + minetest.register_ore({ + ore_type = "blob", + ore = "default:gravel", + wherein = {"default:stone"}, + clust_scarcity = 24 * 24 * 24, + clust_size = 7, + y_min = -31000, + y_max = 31000, + noise_threshhold = 0, + noise_params = { + offset = 0.35, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 766, + octaves = 1, + persist = 0.5 + }, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 8 * 8 * 8, + clust_num_ores = 8, + clust_size = 3, + y_min = -31000, + y_max = 64, + }) + + 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, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 12 * 12 * 12, + clust_num_ores = 3, + clust_size = 2, + y_min = -15, + y_max = 2, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 5, + clust_size = 3, + y_min = -63, + y_max = -16, + }) + + 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 = -64, + }) + + 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, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 18 * 18 * 18, + clust_num_ores = 3, + clust_size = 2, + y_min = -255, + y_max = -64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 14 * 14 * 14, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:stone", + clust_scarcity = 36 * 36 * 36, + clust_num_ores = 3, + clust_size = 2, + y_min = -31000, + y_max = -1024, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 15 * 15 * 15, + clust_num_ores = 3, + clust_size = 2, + y_min = -255, + y_max = -64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 13 * 13 * 13, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 17 * 17 * 17, + clust_num_ores = 4, + clust_size = 3, + y_min = -255, + y_max = -128, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 15 * 15 * 15, + clust_num_ores = 4, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + 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, + y_min = -31000, + y_max = -64, + }) +end + + +-- +-- Register biomes +-- + + +function default.register_biomes() + minetest.clear_registered_biomes() + + minetest.register_biome({ + name = "default: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 = "", + y_min = 5, + y_max = 31000, + heat_point = 50, + humidity_point = 50, + }) + + minetest.register_biome({ + name = "default:grassland_ocean", + --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 = "", + y_min = -31000, + y_max = 4, + heat_point = 50, + humidity_point = 50, + }) +end + + +-- +-- Register mgv6 decorations +-- + + +function default.register_mgv6_decorations() + + -- Papyrus + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 8, + noise_params = { + offset = -0.3, + scale = 0.7, + spread = {x = 100, y = 100, z = 100}, + seed = 354, + octaves = 3, + persist = 0.7 + }, + y_min = 1, + y_max = 1, + decoration = "default:papyrus", + height = 2, + height_max = 4, + spawn_by = "default:water_source", + num_spawn_by = 1, + }) + + -- Cacti + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand"}, + sidelen = 16, + noise_params = { + offset = -0.012, + scale = 0.024, + spread = {x = 100, y = 100, z = 100}, + seed = 230, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:cactus", + height = 3, + height_max = 4, + }) + + -- Grasses + + for length = 1, 5 do + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.007, + spread = {x = 100, y = 100, z = 100}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:grass_"..length, + }) + end + + -- Dry shrubs + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.035, + spread = {x = 100, y = 100, z = 100}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:dry_shrub", + }) +end + + +-- +-- Register decorations +-- + + +function default.register_decorations() + + -- Flowers + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x = 200, y = 200, z = 200}, + seed = 436, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:rose", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x = 200, y = 200, z = 200}, + seed = 19822, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = 33, + y_max = 31000, + decoration = "flowers:tulip", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x = 200, y = 200, z = 200}, + seed = 1220999, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:dandelion_yellow", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x = 200, y = 200, z = 200}, + seed = 36662, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:geranium", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x = 200, y = 200, z = 200}, + seed = 1133, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:viola", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.03, + spread = {x = 200, y = 200, z = 200}, + seed = 73133, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "flowers:dandelion_white", + }) + + -- Grasses + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.04, + scale = 0.04, + spread = {x = 200, y = 200, z = 200}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_1", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.02, + scale = 0.06, + spread = {x = 200, y = 200, z = 200}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_2", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.08, + spread = {x = 200, y = 200, z = 200}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_3", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.02, + scale = 0.10, + spread = {x = 200, y = 200, z = 200}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_4", + }) + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.04, + scale = 0.12, + spread = {x = 200, y = 200, z = 200}, + seed = 66440, + octaves = 3, + persist = 0.6 + }, + biomes = {"default:grassland"}, + y_min = -31000, + y_max = 31000, + decoration = "default:grass_5", + }) +end + + +-- +-- Detect mapgen to select functions +-- + + +-- Mods using singlenode mapgen can call these functions to enable +-- the use of minetest.generate_ores or minetest.generate_decorations + +local mg_params = minetest.get_mapgen_params() +if mg_params.mgname == "v6" then + default.register_ores() + default.register_mgv6_decorations() +elseif mg_params.mgname ~= "singlenode" then + default.register_ores() + default.register_biomes() + default.register_decorations() +end + + +-- +-- Generate nyan cats in all mapgens +-- + + +-- facedir: 0/1/2/3 (head node facedir value) +-- length: length of rainbow tail +function default.make_nyancat(pos, facedir, length) + local tailvec = {x = 0, y = 0, z = 0} + if facedir == 0 then + tailvec.z = 1 + elseif facedir == 1 then + tailvec.x = 1 + elseif facedir == 2 then + tailvec.z = -1 + elseif facedir == 3 then + tailvec.x = -1 + else + --print("default.make_nyancat(): Invalid facedir: "+dump(facedir)) + facedir = 0 + tailvec.z = 1 + end + local p = {x = pos.x, y = pos.y, z = pos.z} + minetest.set_node(p, {name = "default:nyancat", param2 = facedir}) + for i = 1, length do + p.x = p.x + tailvec.x + p.z = p.z + tailvec.z + minetest.set_node(p, {name = "default:nyancat_rainbow", param2 = facedir}) + end +end + + +function default.generate_nyancats(minp, maxp, seed) + local height_min = -31000 + local height_max = -32 + if maxp.y < height_min or minp.y > height_max then + return + end + local y_min = math.max(minp.y, height_min) + local y_max = math.min(maxp.y, height_max) + local volume = (maxp.x - minp.x + 1) * (y_max - y_min + 1) * (maxp.z - minp.z + 1) + local pr = PseudoRandom(seed + 9324342) + local max_num_nyancats = math.floor(volume / (16 * 16 * 16)) + for i = 1, max_num_nyancats do + if pr:next(0, 1000) == 0 then + local x0 = pr:next(minp.x, maxp.x) + local y0 = pr:next(minp.y, maxp.y) + local z0 = pr:next(minp.z, maxp.z) + local p0 = {x = x0, y = y0, z = z0} + default.make_nyancat(p0, pr:next(0, 3), pr:next(3, 15)) + end + end +end + + +minetest.register_on_generated(default.generate_nyancats) diff --git a/mods/default/models/character.b3d b/mods/default/models/character.b3d new file mode 100644 index 0000000..bc9d927 Binary files /dev/null and b/mods/default/models/character.b3d differ diff --git a/mods/default/models/character.blend b/mods/default/models/character.blend new file mode 100644 index 0000000..34c5624 Binary files /dev/null and b/mods/default/models/character.blend differ diff --git a/mods/default/models/character.png b/mods/default/models/character.png new file mode 100644 index 0000000..0502178 Binary files /dev/null and b/mods/default/models/character.png differ diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua new file mode 100644 index 0000000..0796db5 --- /dev/null +++ b/mods/default/nodes.lua @@ -0,0 +1,1597 @@ +-- mods/default/nodes.lua + +--[[ Index: + +Stone +----- +(1. Material 2. Cobble variant 3. Brick variant [4. Modified forms]) + +default:stone +default:cobble +default:stonebrick +default:mossycobble + +default:desert_stone +default:desert_cobble +default:desert_stonebrick + +default:sandstone +default:sandstonebrick + +default:obsidian +default:obsidianbrick + +Soft / Non-Stone +---------------- +(1. Material [2. Modified forms]) + +default:dirt +default:dirt_with_grass +default:dirt_with_grass_footsteps +default:dirt_with_snow + +default:sand +default:desert_sand + +default:gravel + +default:clay + +default:snow +default:snowblock + +default:ice + +Trees +----- +(1. Trunk 2. Fabricated trunk 3. Leaves 4. Sapling [5. Fruits]) + +default:tree +default:wood +default:leaves +default:sapling +default:apple + +default:jungletree +default:junglewood +default:jungleleaves +default:junglesapling + +default:pinetree +default:pinewood +default:pine_needles +default:pine_sapling + +Ores +---- +(1. In stone 2. Block) + +default:stone_with_coal +default:coalblock + +default:stone_with_iron +default:steelblock + +default:stone_with_copper +default:copperblock +default:bronzeblock + +default:stone_with_gold +default:goldblock + +default:stone_with_mese +default:mese + +default:stone_with_diamond +default:diamondblock + +Plantlife (non-cubic) +--------------------- +default:cactus +default:papyrus +default:dry_shrub +default:junglegrass +default:grass_1 +default:grass_2 +default:grass_3 +default:grass_4 +default:grass_5 + +Liquids +------- +(1. Source 2. Flowing) + +default:water_source +default:water_flowing + +default:river_water_source +default:river_water_flowing + +default:lava_source +default:lava_flowing + +Tools / "Advanced" crafting / Non-"natural" +------------------------------------------- +default:torch + +default:chest +default:chest_locked + +default:bookshelf + +default:sign_wall +default:ladder +default:fence_wood + +default:glass +default:obsidian_glass + +default:rail + +default:brick + +default:meselamp + +Misc +---- +default:cloud +default:nyancat +default:nyancat_rainbow + +--]] + +-- +-- Stone +-- + +minetest.register_node("default:stone", { + description = "Stone", + tiles = {"default_stone.png"}, + groups = {cracky=3, stone=1}, + drop = 'default:cobble', + legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:cobble", { + description = "Cobblestone", + tiles = {"default_cobble.png"}, + is_ground_content = false, + groups = {cracky=3, stone=2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:stonebrick", { + description = "Stone Brick", + tiles = {"default_stone_brick.png"}, + is_ground_content = false, + groups = {cracky=2, stone=1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:mossycobble", { + description = "Mossy Cobblestone", + tiles = {"default_mossycobble.png"}, + is_ground_content = false, + groups = {cracky=3, stone=1}, + sounds = default.node_sound_stone_defaults(), +}) + + + +minetest.register_node("default:desert_stone", { + description = "Desert Stone", + tiles = {"default_desert_stone.png"}, + groups = {cracky=3, stone=1}, + drop = 'default:desert_cobble', + legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_cobble", { + description = "Desert Cobblestone", + tiles = {"default_desert_cobble.png"}, + is_ground_content = false, + groups = {cracky=3, stone=2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_stonebrick", { + description = "Desert Stone Brick", + tiles = {"default_desert_stone_brick.png"}, + is_ground_content = false, + groups = {cracky=2, stone=1}, + sounds = default.node_sound_stone_defaults(), +}) + + + +minetest.register_node("default:sandstone", { + description = "Sandstone", + tiles = {"default_sandstone.png"}, + groups = {crumbly=2,cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:sandstonebrick", { + description = "Sandstone Brick", + tiles = {"default_sandstone_brick.png"}, + is_ground_content = false, + groups = {cracky=2}, + sounds = default.node_sound_stone_defaults(), +}) + + + +minetest.register_node("default:obsidian", { + description = "Obsidian", + tiles = {"default_obsidian.png"}, + sounds = default.node_sound_stone_defaults(), + groups = {cracky=1,level=2}, +}) + +minetest.register_node("default:obsidianbrick", { + description = "Obsidian Brick", + tiles = {"default_obsidian_brick.png"}, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + groups = {cracky=1,level=2}, +}) + +-- +-- Soft / Non-Stone +-- + +minetest.register_node("default:dirt", { + description = "Dirt", + tiles = {"default_dirt.png"}, + groups = {crumbly=3,soil=1}, + sounds = default.node_sound_dirt_defaults(), +}) + +minetest.register_node("default:dirt_with_grass", { + description = "Dirt with Grass", + tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, + groups = {crumbly=3,soil=1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_grass_footstep", gain=0.25}, + }), +}) + +minetest.register_node("default:dirt_with_grass_footsteps", { + description = "Dirt with Grass and Footsteps", + tiles = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, + groups = {crumbly=3,soil=1,not_in_creative_inventory=1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_grass_footstep", gain=0.25}, + }), +}) + +minetest.register_node("default:dirt_with_snow", { + description = "Dirt with Snow", + tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"}, + groups = {crumbly=3,soil=1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_snow_footstep", gain=0.25}, + }), +}) + + + +minetest.register_node("default:sand", { + description = "Sand", + tiles = {"default_sand.png"}, + groups = {crumbly=3, falling_node=1, sand=1}, + sounds = default.node_sound_sand_defaults(), +}) + +minetest.register_node("default:desert_sand", { + description = "Desert Sand", + tiles = {"default_desert_sand.png"}, + groups = {crumbly=3, falling_node=1, sand=1}, + sounds = default.node_sound_sand_defaults(), +}) + + + +minetest.register_node("default:gravel", { + description = "Gravel", + tiles = {"default_gravel.png"}, + groups = {crumbly=2, falling_node=1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_gravel_footstep", gain=0.5}, + dug = {name="default_gravel_footstep", gain=1.0}, + }), +}) + + + +minetest.register_node("default:clay", { + description = "Clay", + tiles = {"default_clay.png"}, + groups = {crumbly=3}, + drop = 'default:clay_lump 4', + sounds = default.node_sound_dirt_defaults(), +}) + + + +minetest.register_node("default:snow", { + description = "Snow", + tiles = {"default_snow.png"}, + inventory_image = "default_snowball.png", + wield_image = "default_snowball.png", + paramtype = "light", + buildable_to = true, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5}, + }, + }, + groups = {crumbly=3,falling_node=1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_snow_footstep", gain=0.25}, + dug = {name="default_snow_footstep", gain=0.75}, + }), + + on_construct = function(pos) + pos.y = pos.y - 1 + if minetest.get_node(pos).name == "default:dirt_with_grass" then + minetest.set_node(pos, {name="default:dirt_with_snow"}) + end + end, +}) + + +minetest.register_node("default:snowblock", { + description = "Snow Block", + tiles = {"default_snow.png"}, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_snow_footstep", gain=0.25}, + dug = {name="default_snow_footstep", gain=0.75}, + }), +}) + + + +minetest.register_node("default:ice", { + description = "Ice", + tiles = {"default_ice.png"}, + is_ground_content = false, + paramtype = "light", + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults(), +}) + +-- +-- Trees +-- + +minetest.register_node("default:tree", { + description = "Tree", + tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:wood", { + description = "Wooden Planks", + tiles = {"default_wood.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:sapling", { + description = "Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_sapling.png"}, + inventory_image = "default_sapling.png", + wield_image = "default_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + }, + groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("default:leaves", { + description = "Leaves", + drawtype = "allfaces_optional", + waving = 1, + visual_scale = 1.3, + tiles = {"default_leaves.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3, leafdecay=3, flammable=2, leaves=1}, + drop = { + max_items = 1, + items = { + { + -- player will get sapling with 1/20 chance + items = {'default:sapling'}, + rarity = 20, + }, + { + -- player will get leaves only if he get no saplings, + -- this is because max_items is 1 + items = {'default:leaves'}, + } + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:apple", { + description = "Apple", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_apple.png"}, + inventory_image = "default_apple.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + selection_box = { + type = "fixed", + fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} + }, + groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=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}) + end + end, +}) + + + +minetest.register_node("default:jungletree", { + description = "Jungle Tree", + tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:junglewood", { + description = "Junglewood Planks", + tiles = {"default_junglewood.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:jungleleaves", { + description = "Jungle Leaves", + drawtype = "allfaces_optional", + waving = 1, + visual_scale = 1.3, + tiles = {"default_jungleleaves.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3, leafdecay=3, flammable=2, leaves=1}, + drop = { + max_items = 1, + items = { + { + -- player will get sapling with 1/20 chance + items = {'default:junglesapling'}, + rarity = 20, + }, + { + -- player will get leaves only if he get no saplings, + -- this is because max_items is 1 + items = {'default:jungleleaves'}, + } + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:junglesapling", { + description = "Jungle Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_junglesapling.png"}, + inventory_image = "default_junglesapling.png", + wield_image = "default_junglesapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + }, + groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1}, + sounds = default.node_sound_leaves_defaults(), +}) + + + +minetest.register_node("default:pinetree", { + description = "Pine Tree", + tiles = {"default_pinetree_top.png", "default_pinetree_top.png", "default_pinetree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:pinewood", { + description = "Pinewood Planks", + tiles = {"default_pinewood.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:pine_needles",{ + description = "Pine Needles", + drawtype = "allfaces_optional", + visual_scale = 1.3, + tiles = {"default_pine_needles.png"}, + waving = 1, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3, leafdecay=3, flammable=2, leaves=1}, + drop = { + max_items = 1, + items = { + { + -- player will get sapling with 1/20 chance + items = {"default:pine_sapling"}, + rarity = 20, + }, + { + -- player will get leaves only if he get no saplings, + -- this is because max_items is 1 + items = {"default:pine_needles"}, + } + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:pine_sapling", { + description = "Pine Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_pine_sapling.png"}, + inventory_image = "default_pine_sapling.png", + wield_image = "default_pine_sapling.png", + paramtype = "light", + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + }, + groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +-- +-- Ores +-- + +minetest.register_node("default:stone_with_coal", { + description = "Coal Ore", + tiles = {"default_stone.png^default_mineral_coal.png"}, + groups = {cracky=3}, + drop = 'default:coal_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coalblock", { + description = "Coal Block", + tiles = {"default_coal_block.png"}, + is_ground_content = false, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + + + +minetest.register_node("default:stone_with_iron", { + description = "Iron Ore", + tiles = {"default_stone.png^default_mineral_iron.png"}, + groups = {cracky=2}, + drop = 'default:iron_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:steelblock", { + description = "Steel Block", + tiles = {"default_steel_block.png"}, + is_ground_content = false, + groups = {cracky=1,level=2}, + sounds = default.node_sound_stone_defaults(), +}) + + + +minetest.register_node("default:stone_with_copper", { + description = "Copper Ore", + tiles = {"default_stone.png^default_mineral_copper.png"}, + groups = {cracky=2}, + drop = 'default:copper_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:copperblock", { + description = "Copper Block", + tiles = {"default_copper_block.png"}, + is_ground_content = false, + groups = {cracky=1,level=2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:bronzeblock", { + description = "Bronze Block", + tiles = {"default_bronze_block.png"}, + is_ground_content = false, + groups = {cracky=1,level=2}, + sounds = default.node_sound_stone_defaults(), +}) + + + +minetest.register_node("default:stone_with_mese", { + description = "Mese Ore", + tiles = {"default_stone.png^default_mineral_mese.png"}, + paramtype = "light", + groups = {cracky = 1}, + drop = "default:mese_crystal", + sounds = default.node_sound_stone_defaults(), + light_source = 1, +}) + +minetest.register_node("default:mese", { + description = "Mese Block", + tiles = {"default_mese_block.png"}, + paramtype = "light", + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_stone_defaults(), + light_source = 3, +}) + + + + +minetest.register_node("default:stone_with_gold", { + description = "Gold Ore", + tiles = {"default_stone.png^default_mineral_gold.png"}, + groups = {cracky=2}, + drop = "default:gold_lump", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:goldblock", { + description = "Gold Block", + tiles = {"default_gold_block.png"}, + is_ground_content = false, + groups = {cracky=1}, + sounds = default.node_sound_stone_defaults(), +}) + + + +minetest.register_node("default:stone_with_diamond", { + description = "Diamond Ore", + tiles = {"default_stone.png^default_mineral_diamond.png"}, + groups = {cracky=1}, + drop = "default:diamond", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:diamondblock", { + description = "Diamond Block", + tiles = {"default_diamond_block.png"}, + is_ground_content = false, + groups = {cracky=1,level=3}, + sounds = default.node_sound_stone_defaults(), +}) + +-- +-- Plantlife (non-cubic) +-- + +minetest.register_node("default:cactus", { + description = "Cactus", + tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"}, + paramtype2 = "facedir", + groups = {snappy=1,choppy=3,flammable=2}, + sounds = default.node_sound_wood_defaults(), + on_place = minetest.rotate_node, + + after_dig_node = function(pos, node, metadata, digger) + default.dig_up(pos, node, digger) + end, +}) + +minetest.register_node("default:papyrus", { + description = "Papyrus", + drawtype = "plantlike", + tiles = {"default_papyrus.png"}, + inventory_image = "default_papyrus.png", + wield_image = "default_papyrus.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + }, + groups = {snappy=3,flammable=2}, + sounds = default.node_sound_leaves_defaults(), + + after_dig_node = function(pos, node, metadata, digger) + default.dig_up(pos, node, digger) + end, +}) + +minetest.register_node("default:dry_shrub", { + description = "Dry Shrub", + drawtype = "plantlike", + waving = 1, + visual_scale = 1.0, + tiles = {"default_dry_shrub.png"}, + inventory_image = "default_dry_shrub.png", + wield_image = "default_dry_shrub.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 = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, +}) + +minetest.register_node("default:junglegrass", { + description = "Jungle Grass", + drawtype = "plantlike", + waving = 1, + visual_scale = 1.3, + tiles = {"default_junglegrass.png"}, + inventory_image = "default_junglegrass.png", + wield_image = "default_junglegrass.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy=3,flammable=2,flora=1,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, +}) + +minetest.register_node("default:grass_1", { + description = "Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_grass_1.png"}, + -- Use texture of a taller grass stage in inventory + inventory_image = "default_grass_3.png", + wield_image = "default_grass_3.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 = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, + + on_place = function(itemstack, placer, pointed_thing) + -- place a random grass node + local stack = ItemStack("default:grass_"..math.random(1,5)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count())) + end, +}) + +for i=2,5 do + minetest.register_node("default:grass_"..i, { + description = "Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_grass_"..i..".png"}, + inventory_image = "default_grass_"..i..".png", + wield_image = "default_grass_"..i..".png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, + }) +end + +-- +-- Liquids +-- + +minetest.register_node("default:water_source", { + description = "Water Source", + inventory_image = minetest.inventorycube("default_water.png"), + drawtype = "liquid", + tiles = { + { + name = "default_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + special_tiles = { + -- New-style water source material (mostly unused) + { + name = "default_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + backface_culling = false, + }, + }, + alpha = 160, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:water_flowing", + liquid_alternative_source = "default:water_source", + liquid_viscosity = 1, + post_effect_color = {a=120, r=30, g=60, b=90}, + groups = {water=3, liquid=3, puts_out_fire=1}, +}) + +minetest.register_node("default:water_flowing", { + description = "Flowing Water", + inventory_image = minetest.inventorycube("default_water.png"), + drawtype = "flowingliquid", + tiles = {"default_water.png"}, + special_tiles = { + { + name = "default_water_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + { + name = "default_water_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + }, + alpha = 160, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:water_flowing", + liquid_alternative_source = "default:water_source", + liquid_viscosity = 1, + post_effect_color = {a=120, r=30, g=60, b=90}, + groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1}, +}) + + +minetest.register_node("default:river_water_source", { + description = "River Water Source", + inventory_image = minetest.inventorycube("default_river_water.png"), + drawtype = "liquid", + tiles = { + { + name = "default_river_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + special_tiles = { + { + name = "default_river_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + backface_culling = false, + }, + }, + alpha = 160, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:river_water_flowing", + liquid_alternative_source = "default:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a=120, r=30, g=76, b=90}, + groups = {water=3, liquid=3, puts_out_fire=1}, +}) + +minetest.register_node("default:river_water_flowing", { + description = "Flowing River Water", + inventory_image = minetest.inventorycube("default_river_water.png"), + drawtype = "flowingliquid", + tiles = {"default_river_water.png"}, + special_tiles = { + { + name = "default_river_water_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + { + name = "default_river_water_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + }, + alpha = 160, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:river_water_flowing", + liquid_alternative_source = "default:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a=120, r=30, g=76, b=90}, + groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1}, +}) + + + +minetest.register_node("default:lava_source", { + description = "Lava Source", + inventory_image = minetest.inventorycube("default_lava.png"), + drawtype = "liquid", + tiles = { + { + name = "default_lava_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0, + }, + }, + }, + special_tiles = { + -- New-style lava source material (mostly unused) + { + name = "default_lava_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0, + }, + backface_culling = false, + }, + }, + paramtype = "light", + light_source = default.LIGHT_MAX - 1, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:lava_flowing", + liquid_alternative_source = "default:lava_source", + liquid_viscosity = 7, + liquid_renewable = false, + damage_per_second = 4 * 2, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=2, hot=3, igniter=1}, +}) + +minetest.register_node("default:lava_flowing", { + description = "Flowing Lava", + inventory_image = minetest.inventorycube("default_lava.png"), + drawtype = "flowingliquid", + tiles = {"default_lava.png"}, + special_tiles = { + { + name = "default_lava_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.3, + }, + }, + { + name = "default_lava_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.3, + }, + }, + }, + paramtype = "light", + paramtype2 = "flowingliquid", + light_source = default.LIGHT_MAX - 1, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:lava_flowing", + liquid_alternative_source = "default:lava_source", + liquid_viscosity = 7, + liquid_renewable = false, + damage_per_second = 4 * 2, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1}, +}) + +-- +-- Tools / "Advanced" crafting / Non-"natural" +-- + +minetest.register_node("default:torch", { + description = "Torch", + drawtype = "torchlike", + tiles = { + { + name = "default_torch_on_floor_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0 + }, + }, + { + name="default_torch_on_ceiling_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0 + }, + }, + { + name="default_torch_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0 + }, + }, + }, + inventory_image = "default_torch_on_floor.png", + wield_image = "default_torch_on_floor.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + is_ground_content = false, + walkable = false, + light_source = default.LIGHT_MAX - 1, + selection_box = { + type = "wallmounted", + wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1}, + wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1}, + wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1}, + }, + groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1}, + legacy_wallmounted = true, + sounds = default.node_sound_defaults(), +}) + + + +local chest_formspec = + "size[8,9]".. + default.gui_bg.. + 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]".. + "listring[current_name;main]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0,4.85) + +local function get_locked_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 has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("default:chest", { + description = "Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, + paramtype2 = "facedir", + groups = {choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", chest_formspec) + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + 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, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + + + +minetest.register_node("default:chest_locked", { + description = "Locked Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"}, + paramtype2 = "facedir", + groups = {choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + + 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, + 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, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and has_locked_chest_privilege(meta, player) + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, + on_rightclick = function(pos, node, clicker) + local meta = minetest.get_meta(pos) + if has_locked_chest_privilege(meta, clicker) then + minetest.show_formspec( + clicker:get_player_name(), + "default:chest_locked", + get_locked_chest_formspec(pos) + ) + end + end, + on_blast = function() end, +}) + + + +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]".. + "listring[context;books]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0,2.85) + +minetest.register_node("default:bookshelf", { + description = "Bookshelf", + tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"}, + is_ground_content = false, + groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3}, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", bookshelf_formspec) + local inv = meta:get_inventory() + inv:set_size("books", 8*2) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("books") + end, + + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local to_stack = inv:get_stack(listname, index) + if listname == "books" then + if minetest.get_item_group(stack:get_name(), "book") ~= 0 + and to_stack:is_empty() then + return 1 + else + return 0 + end + end + end, + + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local stack = inv:get_stack(from_list, from_index) + local to_stack = inv:get_stack(to_list, to_index) + if to_list == "books" then + if minetest.get_item_group(stack:get_name(), "book") ~= 0 + and to_stack:is_empty() then + return 1 + else + return 0 + end + end + end, + + 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)) + 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)) + 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)) + end, +}) + + + +minetest.register_node("default:sign_wall", { + description = "Sign", + drawtype = "nodebox", + tiles = {"default_sign.png"}, + inventory_image = "default_sign_wall.png", + wield_image = "default_sign_wall.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + is_ground_content = false, + walkable = false, + node_box = { + type = "wallmounted", + wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}, + wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125}, + wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375}, + }, + groups = {choppy=2,dig_immediate=2,attached_node=1}, + legacy_wallmounted = true, + sounds = default.node_sound_defaults(), + + on_construct = function(pos) + --local n = minetest.get_node(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[text;;${text}]") + meta:set_string("infotext", "\"\"") + end, + on_receive_fields = function(pos, formname, fields, sender) + --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields)) + if minetest.is_protected(pos, sender:get_player_name()) then + minetest.record_protection_violation(pos, sender:get_player_name()) + return + end + local meta = minetest.get_meta(pos) + if not fields.text then return end + minetest.log("action", (sender:get_player_name() or "").." wrote \""..fields.text.. + "\" to sign at "..minetest.pos_to_string(pos)) + meta:set_string("text", fields.text) + meta:set_string("infotext", '"'..fields.text..'"') + end, +}) + +minetest.register_node("default:ladder", { + description = "Ladder", + drawtype = "signlike", + tiles = {"default_ladder.png"}, + inventory_image = "default_ladder.png", + wield_image = "default_ladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2}, + legacy_wallmounted = true, + sounds = default.node_sound_wood_defaults(), +}) + +local fence_texture = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126" +minetest.register_node("default:fence_wood", { + description = "Wooden Fence", + drawtype = "fencelike", + tiles = {"default_wood.png"}, + inventory_image = fence_texture, + wield_image = fence_texture, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2}, + sounds = default.node_sound_wood_defaults(), +}) + + + +minetest.register_node("default:glass", { + description = "Glass", + drawtype = "glasslike_framed_optional", + tiles = {"default_glass.png", "default_glass_detail.png"}, + inventory_image = minetest.inventorycube("default_glass.png"), + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky=3,oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("default:obsidian_glass", { + description = "Obsidian Glass", + drawtype = "glasslike", + tiles = {"default_obsidian_glass.png"}, + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + sounds = default.node_sound_glass_defaults(), + groups = {cracky=3,oddly_breakable_by_hand=3}, +}) + + + +minetest.register_node("default:rail", { + description = "Rail", + drawtype = "raillike", + tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"}, + inventory_image = "default_rail.png", + wield_image = "default_rail.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + selection_box = { + type = "fixed", + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + groups = {bendy=2,dig_immediate=2,attached_node=1,connect_to_raillike=minetest.raillike_group("rail")}, +}) + + + +minetest.register_node("default:brick", { + description = "Brick Block", + tiles = {"default_brick.png"}, + is_ground_content = false, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:meselamp", { + description = "Mese Lamp", + drawtype = "glasslike", + tiles = {"default_meselamp.png"}, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_glass_defaults(), + light_source = default.LIGHT_MAX, +}) + +-- +-- Misc +-- + +minetest.register_node("default:cloud", { + description = "Cloud", + tiles = {"default_cloud.png"}, + is_ground_content = false, + sounds = default.node_sound_defaults(), + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_node("default:nyancat", { + description = "Nyan Cat", + tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png", + "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"}, + paramtype2 = "facedir", + groups = {cracky=2}, + is_ground_content = false, + legacy_facedir_simple = true, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("default:nyancat_rainbow", { + description = "Nyan Cat Rainbow", + tiles = { + "default_nc_rb.png^[transformR90", "default_nc_rb.png^[transformR90", + "default_nc_rb.png", "default_nc_rb.png" + }, + paramtype2 = "facedir", + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_defaults(), +}) diff --git a/mods/default/player.lua b/mods/default/player.lua new file mode 100644 index 0000000..e4fb2ad --- /dev/null +++ b/mods/default/player.lua @@ -0,0 +1,159 @@ +-- Minetest 0.4 mod: player +-- See README.txt for licensing and other information. + +-- 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 = { } + +-- Local for speed. +local models = default.registered_player_models + +function default.player_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, }, + -- Extra animations (not currently used by the game). + sit = { x= 81, y=160, }, + }, +}) + +-- Player stats and animations +local player_model = {} +local player_textures = {} +local player_anim = {} +local player_sneak = {} +default.player_attached = {} + +function default.player_get_animation(player) + local name = player:get_player_name() + return { + model = player_model[name], + textures = player_textures[name], + animation = player_anim[name], + } +end + +-- Called when a player's appearance needs to be updated +function default.player_set_model(player, model_name) + local name = player:get_player_name() + local model = models[model_name] + if model then + if player_model[name] == model_name then + return + end + player:set_properties({ + mesh = model_name, + textures = player_textures[name] or model.textures, + visual = "mesh", + visual_size = model.visual_size or {x=1, y=1}, + }) + default.player_set_animation(player, "stand") + else + player:set_properties({ + textures = { "player.png", "player_back.png", }, + visual = "upright_sprite", + }) + end + player_model[name] = model_name +end + +function default.player_set_textures(player, textures) + local name = player:get_player_name() + player_textures[name] = textures + player:set_properties({textures = textures,}) +end + +function default.player_set_animation(player, anim_name, speed) + local name = player:get_player_name() + if player_anim[name] == anim_name then + return + end + local model = player_model[name] and models[player_model[name]] + if not (model and model.animations[anim_name]) then + return + end + local anim = model.animations[anim_name] + player_anim[name] = anim_name + 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) + + -- set GUI + if not minetest.setting_getbool("creative_mode") then + player:set_inventory_formspec(default.gui_survival_form) + end + 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 + player_anim[name] = nil + player_textures[name] = nil +end) + +-- Localize for better performance. +local player_set_animation = default.player_set_animation +local player_attached = default.player_attached + +-- Check each player and apply animations +minetest.register_globalstep(function(dtime) + for _, player in pairs(minetest.get_connected_players()) do + local name = player:get_player_name() + local model_name = player_model[name] + local model = model_name and models[model_name] + if model and not player_attached[name] then + local controls = player:get_player_control() + local walking = false + local animation_speed_mod = model.animation_speed or 30 + + -- Determine if the player is walking + if controls.up or controls.down or controls.left or controls.right then + walking = true + end + + -- Determine if the player is sneaking, and reduce animation speed if so + if controls.sneak then + animation_speed_mod = animation_speed_mod / 2 + end + + -- Apply animations based on what the player is doing + if player:get_hp() == 0 then + player_set_animation(player, "lay") + elseif walking then + if player_sneak[name] ~= controls.sneak then + player_anim[name] = nil + player_sneak[name] = controls.sneak + end + if controls.LMB then + player_set_animation(player, "walk_mine", animation_speed_mod) + else + player_set_animation(player, "walk", animation_speed_mod) + end + elseif controls.LMB then + player_set_animation(player, "mine") + else + player_set_animation(player, "stand", animation_speed_mod) + end + end + end +end) diff --git a/mods/default/sounds/default_break_glass.1.ogg b/mods/default/sounds/default_break_glass.1.ogg new file mode 100644 index 0000000..b1ccc5f Binary files /dev/null and b/mods/default/sounds/default_break_glass.1.ogg differ diff --git a/mods/default/sounds/default_break_glass.2.ogg b/mods/default/sounds/default_break_glass.2.ogg new file mode 100644 index 0000000..b6cc9e8 Binary files /dev/null and b/mods/default/sounds/default_break_glass.2.ogg differ diff --git a/mods/default/sounds/default_break_glass.3.ogg b/mods/default/sounds/default_break_glass.3.ogg new file mode 100644 index 0000000..ae6a6bf Binary files /dev/null and b/mods/default/sounds/default_break_glass.3.ogg differ diff --git a/mods/default/sounds/default_cool_lava.1.ogg b/mods/default/sounds/default_cool_lava.1.ogg new file mode 100644 index 0000000..42506dd Binary files /dev/null and b/mods/default/sounds/default_cool_lava.1.ogg differ diff --git a/mods/default/sounds/default_cool_lava.2.ogg b/mods/default/sounds/default_cool_lava.2.ogg new file mode 100644 index 0000000..2747ab8 Binary files /dev/null and b/mods/default/sounds/default_cool_lava.2.ogg differ diff --git a/mods/default/sounds/default_cool_lava.3.ogg b/mods/default/sounds/default_cool_lava.3.ogg new file mode 100644 index 0000000..8baeac3 Binary files /dev/null and b/mods/default/sounds/default_cool_lava.3.ogg differ diff --git a/mods/default/sounds/default_dig_choppy.ogg b/mods/default/sounds/default_dig_choppy.ogg new file mode 100644 index 0000000..e2ecd84 Binary files /dev/null and b/mods/default/sounds/default_dig_choppy.ogg differ diff --git a/mods/default/sounds/default_dig_cracky.ogg b/mods/default/sounds/default_dig_cracky.ogg new file mode 100644 index 0000000..da11679 Binary files /dev/null and b/mods/default/sounds/default_dig_cracky.ogg differ diff --git a/mods/default/sounds/default_dig_crumbly.ogg b/mods/default/sounds/default_dig_crumbly.ogg new file mode 100644 index 0000000..a0b2a1f Binary files /dev/null and b/mods/default/sounds/default_dig_crumbly.ogg differ diff --git a/mods/default/sounds/default_dig_dig_immediate.ogg b/mods/default/sounds/default_dig_dig_immediate.ogg new file mode 100644 index 0000000..e65d766 Binary files /dev/null and b/mods/default/sounds/default_dig_dig_immediate.ogg differ diff --git a/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg b/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg new file mode 100644 index 0000000..ef4d7b1 Binary files /dev/null and b/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg differ diff --git a/mods/default/sounds/default_dirt_footstep.1.ogg b/mods/default/sounds/default_dirt_footstep.1.ogg new file mode 100644 index 0000000..84a197d Binary files /dev/null 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 new file mode 100644 index 0000000..2e23b8a Binary files /dev/null and b/mods/default/sounds/default_dirt_footstep.2.ogg differ diff --git a/mods/default/sounds/default_dug_node.1.ogg b/mods/default/sounds/default_dug_node.1.ogg new file mode 100644 index 0000000..c04975d Binary files /dev/null and b/mods/default/sounds/default_dug_node.1.ogg differ diff --git a/mods/default/sounds/default_dug_node.2.ogg b/mods/default/sounds/default_dug_node.2.ogg new file mode 100644 index 0000000..9f20926 Binary files /dev/null and b/mods/default/sounds/default_dug_node.2.ogg differ diff --git a/mods/default/sounds/default_glass_footstep.ogg b/mods/default/sounds/default_glass_footstep.ogg new file mode 100644 index 0000000..191287a Binary files /dev/null and b/mods/default/sounds/default_glass_footstep.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.1.ogg b/mods/default/sounds/default_grass_footstep.1.ogg new file mode 100644 index 0000000..22d1ad6 Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.1.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.2.ogg b/mods/default/sounds/default_grass_footstep.2.ogg new file mode 100644 index 0000000..4ccd8a0 Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.2.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.3.ogg b/mods/default/sounds/default_grass_footstep.3.ogg new file mode 100644 index 0000000..20db84e Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.3.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.1.ogg b/mods/default/sounds/default_gravel_footstep.1.ogg new file mode 100644 index 0000000..8d260ce Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.1.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.2.ogg b/mods/default/sounds/default_gravel_footstep.2.ogg new file mode 100644 index 0000000..2aba2c6 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.2.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.3.ogg b/mods/default/sounds/default_gravel_footstep.3.ogg new file mode 100644 index 0000000..1bcd8a1 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.3.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.4.ogg b/mods/default/sounds/default_gravel_footstep.4.ogg new file mode 100644 index 0000000..696c9ff Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.4.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.1.ogg b/mods/default/sounds/default_hard_footstep.1.ogg new file mode 100644 index 0000000..1748bc5 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.1.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.2.ogg b/mods/default/sounds/default_hard_footstep.2.ogg new file mode 100644 index 0000000..fe39fd7 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.2.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.3.ogg b/mods/default/sounds/default_hard_footstep.3.ogg new file mode 100644 index 0000000..5030e06 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.3.ogg differ diff --git a/mods/default/sounds/default_place_node.1.ogg b/mods/default/sounds/default_place_node.1.ogg new file mode 100644 index 0000000..46b9756 Binary files /dev/null and b/mods/default/sounds/default_place_node.1.ogg differ diff --git a/mods/default/sounds/default_place_node.2.ogg b/mods/default/sounds/default_place_node.2.ogg new file mode 100644 index 0000000..d34c01a Binary files /dev/null and b/mods/default/sounds/default_place_node.2.ogg differ diff --git a/mods/default/sounds/default_place_node.3.ogg b/mods/default/sounds/default_place_node.3.ogg new file mode 100644 index 0000000..fc29365 Binary files /dev/null and b/mods/default/sounds/default_place_node.3.ogg differ diff --git a/mods/default/sounds/default_place_node_hard.1.ogg b/mods/default/sounds/default_place_node_hard.1.ogg new file mode 100644 index 0000000..9f97fac Binary files /dev/null and b/mods/default/sounds/default_place_node_hard.1.ogg differ diff --git a/mods/default/sounds/default_place_node_hard.2.ogg b/mods/default/sounds/default_place_node_hard.2.ogg new file mode 100644 index 0000000..1d3b3de Binary files /dev/null and b/mods/default/sounds/default_place_node_hard.2.ogg differ diff --git a/mods/default/sounds/default_sand_footstep.1.ogg b/mods/default/sounds/default_sand_footstep.1.ogg new file mode 100644 index 0000000..65b68c7 Binary files /dev/null and b/mods/default/sounds/default_sand_footstep.1.ogg differ diff --git a/mods/default/sounds/default_sand_footstep.2.ogg b/mods/default/sounds/default_sand_footstep.2.ogg new file mode 100644 index 0000000..57f35f3 Binary files /dev/null and b/mods/default/sounds/default_sand_footstep.2.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.1.ogg b/mods/default/sounds/default_snow_footstep.1.ogg new file mode 100644 index 0000000..3260b91 Binary files /dev/null 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 new file mode 100644 index 0000000..4aac1e7 Binary files /dev/null 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 new file mode 100644 index 0000000..cf4235b Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.3.ogg differ diff --git a/mods/default/sounds/default_wood_footstep.1.ogg b/mods/default/sounds/default_wood_footstep.1.ogg new file mode 100644 index 0000000..34f63a1 Binary files /dev/null and b/mods/default/sounds/default_wood_footstep.1.ogg differ diff --git a/mods/default/sounds/default_wood_footstep.2.ogg b/mods/default/sounds/default_wood_footstep.2.ogg new file mode 100644 index 0000000..124fc29 Binary files /dev/null and b/mods/default/sounds/default_wood_footstep.2.ogg differ diff --git a/mods/default/textures/bubble.png b/mods/default/textures/bubble.png new file mode 100644 index 0000000..100fe15 Binary files /dev/null and b/mods/default/textures/bubble.png differ diff --git a/mods/default/textures/crack_anylength.png b/mods/default/textures/crack_anylength.png new file mode 100644 index 0000000..297eced Binary files /dev/null and b/mods/default/textures/crack_anylength.png differ diff --git a/mods/default/textures/default_apple.png b/mods/default/textures/default_apple.png new file mode 100644 index 0000000..7549bfd Binary files /dev/null and b/mods/default/textures/default_apple.png differ diff --git a/mods/default/textures/default_book.png b/mods/default/textures/default_book.png new file mode 100644 index 0000000..15af2b6 Binary files /dev/null and b/mods/default/textures/default_book.png differ diff --git a/mods/default/textures/default_bookshelf.png b/mods/default/textures/default_bookshelf.png new file mode 100644 index 0000000..10d6483 Binary files /dev/null and b/mods/default/textures/default_bookshelf.png differ diff --git a/mods/default/textures/default_brick.png b/mods/default/textures/default_brick.png new file mode 100644 index 0000000..ab19121 Binary files /dev/null and b/mods/default/textures/default_brick.png differ diff --git a/mods/default/textures/default_brick_normal.png b/mods/default/textures/default_brick_normal.png new file mode 100644 index 0000000..9947439 Binary files /dev/null and b/mods/default/textures/default_brick_normal.png differ diff --git a/mods/default/textures/default_bronze_block.png b/mods/default/textures/default_bronze_block.png new file mode 100644 index 0000000..1d0c9d5 Binary files /dev/null and b/mods/default/textures/default_bronze_block.png differ diff --git a/mods/default/textures/default_bronze_ingot.png b/mods/default/textures/default_bronze_ingot.png new file mode 100644 index 0000000..6cccdf6 Binary files /dev/null and b/mods/default/textures/default_bronze_ingot.png differ diff --git a/mods/default/textures/default_cactus_side.png b/mods/default/textures/default_cactus_side.png new file mode 100644 index 0000000..8d6c40c Binary files /dev/null and b/mods/default/textures/default_cactus_side.png differ diff --git a/mods/default/textures/default_cactus_top.png b/mods/default/textures/default_cactus_top.png new file mode 100644 index 0000000..cf46aa2 Binary files /dev/null and b/mods/default/textures/default_cactus_top.png differ diff --git a/mods/default/textures/default_chest_front.png b/mods/default/textures/default_chest_front.png new file mode 100644 index 0000000..85227d8 Binary files /dev/null and b/mods/default/textures/default_chest_front.png differ diff --git a/mods/default/textures/default_chest_lock.png b/mods/default/textures/default_chest_lock.png new file mode 100644 index 0000000..73f46c7 Binary files /dev/null and b/mods/default/textures/default_chest_lock.png differ diff --git a/mods/default/textures/default_chest_side.png b/mods/default/textures/default_chest_side.png new file mode 100644 index 0000000..44a65a4 Binary files /dev/null and b/mods/default/textures/default_chest_side.png differ diff --git a/mods/default/textures/default_chest_top.png b/mods/default/textures/default_chest_top.png new file mode 100644 index 0000000..f1a5cb5 Binary files /dev/null and b/mods/default/textures/default_chest_top.png differ diff --git a/mods/default/textures/default_clay.png b/mods/default/textures/default_clay.png new file mode 100644 index 0000000..76e5a40 Binary files /dev/null and b/mods/default/textures/default_clay.png differ diff --git a/mods/default/textures/default_clay_brick.png b/mods/default/textures/default_clay_brick.png new file mode 100644 index 0000000..dc7a431 Binary files /dev/null and b/mods/default/textures/default_clay_brick.png differ diff --git a/mods/default/textures/default_clay_lump.png b/mods/default/textures/default_clay_lump.png new file mode 100644 index 0000000..c1d0220 Binary files /dev/null and b/mods/default/textures/default_clay_lump.png differ diff --git a/mods/default/textures/default_cloud.png b/mods/default/textures/default_cloud.png new file mode 100644 index 0000000..faf0ec1 Binary files /dev/null and b/mods/default/textures/default_cloud.png differ diff --git a/mods/default/textures/default_coal_block.png b/mods/default/textures/default_coal_block.png new file mode 100644 index 0000000..6fe9ed9 Binary files /dev/null and b/mods/default/textures/default_coal_block.png differ diff --git a/mods/default/textures/default_coal_lump.png b/mods/default/textures/default_coal_lump.png new file mode 100644 index 0000000..792961d Binary files /dev/null and b/mods/default/textures/default_coal_lump.png differ diff --git a/mods/default/textures/default_cobble.png b/mods/default/textures/default_cobble.png new file mode 100644 index 0000000..d379840 Binary files /dev/null and b/mods/default/textures/default_cobble.png differ diff --git a/mods/default/textures/default_cobble_normal.png b/mods/default/textures/default_cobble_normal.png new file mode 100644 index 0000000..37de21e Binary files /dev/null and b/mods/default/textures/default_cobble_normal.png differ diff --git a/mods/default/textures/default_copper_block.png b/mods/default/textures/default_copper_block.png new file mode 100644 index 0000000..8533754 Binary files /dev/null and b/mods/default/textures/default_copper_block.png differ diff --git a/mods/default/textures/default_copper_ingot.png b/mods/default/textures/default_copper_ingot.png new file mode 100644 index 0000000..bcad9c0 Binary files /dev/null and b/mods/default/textures/default_copper_ingot.png differ diff --git a/mods/default/textures/default_copper_lump.png b/mods/default/textures/default_copper_lump.png new file mode 100644 index 0000000..998c592 Binary files /dev/null and b/mods/default/textures/default_copper_lump.png differ diff --git a/mods/default/textures/default_desert_cobble.png b/mods/default/textures/default_desert_cobble.png new file mode 100644 index 0000000..f914c98 Binary files /dev/null and b/mods/default/textures/default_desert_cobble.png differ diff --git a/mods/default/textures/default_desert_sand.png b/mods/default/textures/default_desert_sand.png new file mode 100644 index 0000000..371b8c7 Binary files /dev/null and b/mods/default/textures/default_desert_sand.png differ diff --git a/mods/default/textures/default_desert_sand_normal.png b/mods/default/textures/default_desert_sand_normal.png new file mode 100644 index 0000000..b0b7932 Binary files /dev/null and b/mods/default/textures/default_desert_sand_normal.png differ diff --git a/mods/default/textures/default_desert_stone.png b/mods/default/textures/default_desert_stone.png new file mode 100644 index 0000000..5d3aded Binary files /dev/null and b/mods/default/textures/default_desert_stone.png differ diff --git a/mods/default/textures/default_desert_stone_brick.png b/mods/default/textures/default_desert_stone_brick.png new file mode 100644 index 0000000..cc0f04a Binary files /dev/null and b/mods/default/textures/default_desert_stone_brick.png differ diff --git a/mods/default/textures/default_desert_stone_normal.png b/mods/default/textures/default_desert_stone_normal.png new file mode 100644 index 0000000..e245682 Binary files /dev/null and b/mods/default/textures/default_desert_stone_normal.png differ diff --git a/mods/default/textures/default_diamond.png b/mods/default/textures/default_diamond.png new file mode 100644 index 0000000..a8dac74 Binary files /dev/null and b/mods/default/textures/default_diamond.png differ diff --git a/mods/default/textures/default_diamond_block.png b/mods/default/textures/default_diamond_block.png new file mode 100644 index 0000000..20c33ed Binary files /dev/null and b/mods/default/textures/default_diamond_block.png differ diff --git a/mods/default/textures/default_dirt.png b/mods/default/textures/default_dirt.png new file mode 100644 index 0000000..ca7e4ae Binary files /dev/null and b/mods/default/textures/default_dirt.png differ diff --git a/mods/default/textures/default_dry_shrub.png b/mods/default/textures/default_dry_shrub.png new file mode 100644 index 0000000..e8a7f27 Binary files /dev/null and b/mods/default/textures/default_dry_shrub.png differ diff --git a/mods/default/textures/default_fence_overlay.png b/mods/default/textures/default_fence_overlay.png new file mode 100644 index 0000000..718184c Binary files /dev/null and b/mods/default/textures/default_fence_overlay.png differ diff --git a/mods/default/textures/default_furnace_bottom.png b/mods/default/textures/default_furnace_bottom.png new file mode 100644 index 0000000..b79ed06 Binary files /dev/null and b/mods/default/textures/default_furnace_bottom.png differ diff --git a/mods/default/textures/default_furnace_fire_bg.png b/mods/default/textures/default_furnace_fire_bg.png new file mode 100644 index 0000000..126204a Binary files /dev/null and b/mods/default/textures/default_furnace_fire_bg.png differ diff --git a/mods/default/textures/default_furnace_fire_fg.png b/mods/default/textures/default_furnace_fire_fg.png new file mode 100644 index 0000000..63888f3 Binary files /dev/null and b/mods/default/textures/default_furnace_fire_fg.png differ diff --git a/mods/default/textures/default_furnace_front.png b/mods/default/textures/default_furnace_front.png new file mode 100644 index 0000000..8c1798e Binary files /dev/null and b/mods/default/textures/default_furnace_front.png differ diff --git a/mods/default/textures/default_furnace_front_active.png b/mods/default/textures/default_furnace_front_active.png new file mode 100644 index 0000000..ea43ed9 Binary files /dev/null and b/mods/default/textures/default_furnace_front_active.png differ diff --git a/mods/default/textures/default_furnace_side.png b/mods/default/textures/default_furnace_side.png new file mode 100644 index 0000000..33408cf Binary files /dev/null and b/mods/default/textures/default_furnace_side.png differ diff --git a/mods/default/textures/default_furnace_top.png b/mods/default/textures/default_furnace_top.png new file mode 100644 index 0000000..b79ed06 Binary files /dev/null and b/mods/default/textures/default_furnace_top.png differ diff --git a/mods/default/textures/default_glass.png b/mods/default/textures/default_glass.png new file mode 100644 index 0000000..da25402 Binary files /dev/null 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 new file mode 100644 index 0000000..d38dbb7 Binary files /dev/null and b/mods/default/textures/default_glass_detail.png differ diff --git a/mods/default/textures/default_gold_block.png b/mods/default/textures/default_gold_block.png new file mode 100644 index 0000000..170d50b Binary files /dev/null and b/mods/default/textures/default_gold_block.png differ diff --git a/mods/default/textures/default_gold_ingot.png b/mods/default/textures/default_gold_ingot.png new file mode 100644 index 0000000..ba66471 Binary files /dev/null and b/mods/default/textures/default_gold_ingot.png differ diff --git a/mods/default/textures/default_gold_lump.png b/mods/default/textures/default_gold_lump.png new file mode 100644 index 0000000..d5a1be7 Binary files /dev/null and b/mods/default/textures/default_gold_lump.png differ diff --git a/mods/default/textures/default_grass.png b/mods/default/textures/default_grass.png new file mode 100644 index 0000000..7c17c6f Binary files /dev/null and b/mods/default/textures/default_grass.png differ diff --git a/mods/default/textures/default_grass_1.png b/mods/default/textures/default_grass_1.png new file mode 100644 index 0000000..5052930 Binary files /dev/null and b/mods/default/textures/default_grass_1.png differ diff --git a/mods/default/textures/default_grass_2.png b/mods/default/textures/default_grass_2.png new file mode 100644 index 0000000..9d99a6a Binary files /dev/null and b/mods/default/textures/default_grass_2.png differ diff --git a/mods/default/textures/default_grass_3.png b/mods/default/textures/default_grass_3.png new file mode 100644 index 0000000..4833df4 Binary files /dev/null and b/mods/default/textures/default_grass_3.png differ diff --git a/mods/default/textures/default_grass_4.png b/mods/default/textures/default_grass_4.png new file mode 100644 index 0000000..1496fb1 Binary files /dev/null and b/mods/default/textures/default_grass_4.png differ diff --git a/mods/default/textures/default_grass_5.png b/mods/default/textures/default_grass_5.png new file mode 100644 index 0000000..a212535 Binary files /dev/null and b/mods/default/textures/default_grass_5.png differ diff --git a/mods/default/textures/default_grass_footsteps.png b/mods/default/textures/default_grass_footsteps.png new file mode 100644 index 0000000..3741a0b Binary files /dev/null and b/mods/default/textures/default_grass_footsteps.png differ diff --git a/mods/default/textures/default_grass_side.png b/mods/default/textures/default_grass_side.png new file mode 100644 index 0000000..87ae3ca Binary files /dev/null and b/mods/default/textures/default_grass_side.png differ diff --git a/mods/default/textures/default_gravel.png b/mods/default/textures/default_gravel.png new file mode 100644 index 0000000..ad48fa4 Binary files /dev/null and b/mods/default/textures/default_gravel.png differ diff --git a/mods/default/textures/default_ice.png b/mods/default/textures/default_ice.png new file mode 100644 index 0000000..2046eac Binary files /dev/null and b/mods/default/textures/default_ice.png differ diff --git a/mods/default/textures/default_iron_lump.png b/mods/default/textures/default_iron_lump.png new file mode 100644 index 0000000..db61a94 Binary files /dev/null and b/mods/default/textures/default_iron_lump.png differ diff --git a/mods/default/textures/default_junglegrass.png b/mods/default/textures/default_junglegrass.png new file mode 100644 index 0000000..25abb71 Binary files /dev/null and b/mods/default/textures/default_junglegrass.png differ diff --git a/mods/default/textures/default_jungleleaves.png b/mods/default/textures/default_jungleleaves.png new file mode 100644 index 0000000..870b4bb Binary files /dev/null and b/mods/default/textures/default_jungleleaves.png differ diff --git a/mods/default/textures/default_junglesapling.png b/mods/default/textures/default_junglesapling.png new file mode 100644 index 0000000..05e1e50 Binary files /dev/null and b/mods/default/textures/default_junglesapling.png differ diff --git a/mods/default/textures/default_jungletree.png b/mods/default/textures/default_jungletree.png new file mode 100644 index 0000000..bf0403e Binary files /dev/null and b/mods/default/textures/default_jungletree.png differ diff --git a/mods/default/textures/default_jungletree_top.png b/mods/default/textures/default_jungletree_top.png new file mode 100644 index 0000000..e3a3ccc Binary files /dev/null and b/mods/default/textures/default_jungletree_top.png differ diff --git a/mods/default/textures/default_junglewood.png b/mods/default/textures/default_junglewood.png new file mode 100644 index 0000000..6198d26 Binary files /dev/null and b/mods/default/textures/default_junglewood.png differ diff --git a/mods/default/textures/default_ladder.png b/mods/default/textures/default_ladder.png new file mode 100644 index 0000000..c167fff Binary files /dev/null and b/mods/default/textures/default_ladder.png differ diff --git a/mods/default/textures/default_lava.png b/mods/default/textures/default_lava.png new file mode 100644 index 0000000..b0d429e Binary files /dev/null and b/mods/default/textures/default_lava.png differ diff --git a/mods/default/textures/default_lava_flowing_animated.png b/mods/default/textures/default_lava_flowing_animated.png new file mode 100644 index 0000000..2ec0746 Binary files /dev/null and b/mods/default/textures/default_lava_flowing_animated.png differ diff --git a/mods/default/textures/default_lava_source_animated.png b/mods/default/textures/default_lava_source_animated.png new file mode 100644 index 0000000..32267a6 Binary files /dev/null and b/mods/default/textures/default_lava_source_animated.png differ diff --git a/mods/default/textures/default_leaves.png b/mods/default/textures/default_leaves.png new file mode 100644 index 0000000..e39535c Binary files /dev/null and b/mods/default/textures/default_leaves.png differ diff --git a/mods/default/textures/default_mese_block.png b/mods/default/textures/default_mese_block.png new file mode 100644 index 0000000..2e6895d Binary files /dev/null and b/mods/default/textures/default_mese_block.png differ diff --git a/mods/default/textures/default_mese_crystal.png b/mods/default/textures/default_mese_crystal.png new file mode 100644 index 0000000..f1d71f1 Binary files /dev/null and b/mods/default/textures/default_mese_crystal.png differ diff --git a/mods/default/textures/default_mese_crystal_fragment.png b/mods/default/textures/default_mese_crystal_fragment.png new file mode 100644 index 0000000..d5416ab Binary files /dev/null and b/mods/default/textures/default_mese_crystal_fragment.png differ diff --git a/mods/default/textures/default_meselamp.png b/mods/default/textures/default_meselamp.png new file mode 100644 index 0000000..b227a25 Binary files /dev/null and b/mods/default/textures/default_meselamp.png differ diff --git a/mods/default/textures/default_mineral_coal.png b/mods/default/textures/default_mineral_coal.png new file mode 100644 index 0000000..6d1386b Binary files /dev/null and b/mods/default/textures/default_mineral_coal.png differ diff --git a/mods/default/textures/default_mineral_coal_normal.png b/mods/default/textures/default_mineral_coal_normal.png new file mode 100644 index 0000000..8d685f9 Binary files /dev/null and b/mods/default/textures/default_mineral_coal_normal.png differ diff --git a/mods/default/textures/default_mineral_copper.png b/mods/default/textures/default_mineral_copper.png new file mode 100644 index 0000000..c4c518e Binary files /dev/null and b/mods/default/textures/default_mineral_copper.png differ diff --git a/mods/default/textures/default_mineral_copper_normal.png b/mods/default/textures/default_mineral_copper_normal.png new file mode 100644 index 0000000..a6d1795 Binary files /dev/null and b/mods/default/textures/default_mineral_copper_normal.png differ diff --git a/mods/default/textures/default_mineral_diamond.png b/mods/default/textures/default_mineral_diamond.png new file mode 100644 index 0000000..39c0f83 Binary files /dev/null and b/mods/default/textures/default_mineral_diamond.png differ diff --git a/mods/default/textures/default_mineral_diamond_normal.png b/mods/default/textures/default_mineral_diamond_normal.png new file mode 100644 index 0000000..8d685f9 Binary files /dev/null and b/mods/default/textures/default_mineral_diamond_normal.png differ diff --git a/mods/default/textures/default_mineral_gold.png b/mods/default/textures/default_mineral_gold.png new file mode 100644 index 0000000..2220add Binary files /dev/null and b/mods/default/textures/default_mineral_gold.png differ diff --git a/mods/default/textures/default_mineral_gold_normal.png b/mods/default/textures/default_mineral_gold_normal.png new file mode 100644 index 0000000..8d685f9 Binary files /dev/null and b/mods/default/textures/default_mineral_gold_normal.png differ diff --git a/mods/default/textures/default_mineral_iron.png b/mods/default/textures/default_mineral_iron.png new file mode 100644 index 0000000..bfec8b1 Binary files /dev/null and b/mods/default/textures/default_mineral_iron.png differ diff --git a/mods/default/textures/default_mineral_iron_normal.png b/mods/default/textures/default_mineral_iron_normal.png new file mode 100644 index 0000000..72fc6c1 Binary files /dev/null and b/mods/default/textures/default_mineral_iron_normal.png differ diff --git a/mods/default/textures/default_mineral_mese.png b/mods/default/textures/default_mineral_mese.png new file mode 100644 index 0000000..566d379 Binary files /dev/null and b/mods/default/textures/default_mineral_mese.png differ diff --git a/mods/default/textures/default_mineral_mese_normal.png b/mods/default/textures/default_mineral_mese_normal.png new file mode 100644 index 0000000..8229c68 Binary files /dev/null and b/mods/default/textures/default_mineral_mese_normal.png differ diff --git a/mods/default/textures/default_mossycobble.png b/mods/default/textures/default_mossycobble.png new file mode 100644 index 0000000..1ae7c91 Binary files /dev/null and b/mods/default/textures/default_mossycobble.png differ diff --git a/mods/default/textures/default_nc_back.png b/mods/default/textures/default_nc_back.png new file mode 100644 index 0000000..e479ace Binary files /dev/null and b/mods/default/textures/default_nc_back.png differ diff --git a/mods/default/textures/default_nc_front.png b/mods/default/textures/default_nc_front.png new file mode 100644 index 0000000..c9dd6a3 Binary files /dev/null and b/mods/default/textures/default_nc_front.png differ diff --git a/mods/default/textures/default_nc_rb.png b/mods/default/textures/default_nc_rb.png new file mode 100644 index 0000000..685a22c Binary files /dev/null and b/mods/default/textures/default_nc_rb.png differ diff --git a/mods/default/textures/default_nc_side.png b/mods/default/textures/default_nc_side.png new file mode 100644 index 0000000..3152c33 Binary files /dev/null and b/mods/default/textures/default_nc_side.png differ diff --git a/mods/default/textures/default_obsidian.png b/mods/default/textures/default_obsidian.png new file mode 100644 index 0000000..8f4a49c Binary files /dev/null and b/mods/default/textures/default_obsidian.png differ diff --git a/mods/default/textures/default_obsidian_brick.png b/mods/default/textures/default_obsidian_brick.png new file mode 100644 index 0000000..30c67ca Binary files /dev/null and b/mods/default/textures/default_obsidian_brick.png differ diff --git a/mods/default/textures/default_obsidian_glass.png b/mods/default/textures/default_obsidian_glass.png new file mode 100644 index 0000000..d5ac83d Binary files /dev/null and b/mods/default/textures/default_obsidian_glass.png differ diff --git a/mods/default/textures/default_obsidian_shard.png b/mods/default/textures/default_obsidian_shard.png new file mode 100644 index 0000000..a988d8c Binary files /dev/null and b/mods/default/textures/default_obsidian_shard.png differ diff --git a/mods/default/textures/default_paper.png b/mods/default/textures/default_paper.png new file mode 100644 index 0000000..8f23924 Binary files /dev/null and b/mods/default/textures/default_paper.png differ diff --git a/mods/default/textures/default_papyrus.png b/mods/default/textures/default_papyrus.png new file mode 100644 index 0000000..a85e809 Binary files /dev/null and b/mods/default/textures/default_papyrus.png differ diff --git a/mods/default/textures/default_pine_needles.png b/mods/default/textures/default_pine_needles.png new file mode 100644 index 0000000..1a32f63 Binary files /dev/null and b/mods/default/textures/default_pine_needles.png differ diff --git a/mods/default/textures/default_pine_sapling.png b/mods/default/textures/default_pine_sapling.png new file mode 100644 index 0000000..c30131d Binary files /dev/null and b/mods/default/textures/default_pine_sapling.png differ diff --git a/mods/default/textures/default_pinetree.png b/mods/default/textures/default_pinetree.png new file mode 100644 index 0000000..4a5328f Binary files /dev/null and b/mods/default/textures/default_pinetree.png differ diff --git a/mods/default/textures/default_pinetree_top.png b/mods/default/textures/default_pinetree_top.png new file mode 100644 index 0000000..8705710 Binary files /dev/null and b/mods/default/textures/default_pinetree_top.png differ diff --git a/mods/default/textures/default_pinewood.png b/mods/default/textures/default_pinewood.png new file mode 100644 index 0000000..6844ceb Binary files /dev/null and b/mods/default/textures/default_pinewood.png differ diff --git a/mods/default/textures/default_rail.png b/mods/default/textures/default_rail.png new file mode 100644 index 0000000..26fed02 Binary files /dev/null and b/mods/default/textures/default_rail.png differ diff --git a/mods/default/textures/default_rail_crossing.png b/mods/default/textures/default_rail_crossing.png new file mode 100644 index 0000000..ba66e01 Binary files /dev/null and b/mods/default/textures/default_rail_crossing.png differ diff --git a/mods/default/textures/default_rail_curved.png b/mods/default/textures/default_rail_curved.png new file mode 100644 index 0000000..9084ac2 Binary files /dev/null and b/mods/default/textures/default_rail_curved.png differ diff --git a/mods/default/textures/default_rail_t_junction.png b/mods/default/textures/default_rail_t_junction.png new file mode 100644 index 0000000..486c416 Binary files /dev/null and b/mods/default/textures/default_rail_t_junction.png differ diff --git a/mods/default/textures/default_river_water.png b/mods/default/textures/default_river_water.png new file mode 100644 index 0000000..3b55c5f Binary files /dev/null and b/mods/default/textures/default_river_water.png differ diff --git a/mods/default/textures/default_river_water_flowing_animated.png b/mods/default/textures/default_river_water_flowing_animated.png new file mode 100644 index 0000000..536acc5 Binary files /dev/null and b/mods/default/textures/default_river_water_flowing_animated.png differ diff --git a/mods/default/textures/default_river_water_source_animated.png b/mods/default/textures/default_river_water_source_animated.png new file mode 100644 index 0000000..daa5653 Binary files /dev/null and b/mods/default/textures/default_river_water_source_animated.png differ diff --git a/mods/default/textures/default_sand.png b/mods/default/textures/default_sand.png new file mode 100644 index 0000000..645a300 Binary files /dev/null and b/mods/default/textures/default_sand.png differ diff --git a/mods/default/textures/default_sand_normal.png b/mods/default/textures/default_sand_normal.png new file mode 100644 index 0000000..0258dec Binary files /dev/null and b/mods/default/textures/default_sand_normal.png differ diff --git a/mods/default/textures/default_sandstone.png b/mods/default/textures/default_sandstone.png new file mode 100644 index 0000000..16e3d13 Binary files /dev/null and b/mods/default/textures/default_sandstone.png differ diff --git a/mods/default/textures/default_sandstone_brick.png b/mods/default/textures/default_sandstone_brick.png new file mode 100644 index 0000000..e7150e5 Binary files /dev/null and b/mods/default/textures/default_sandstone_brick.png differ diff --git a/mods/default/textures/default_sandstone_brick_normal.png b/mods/default/textures/default_sandstone_brick_normal.png new file mode 100644 index 0000000..9ef5865 Binary files /dev/null and b/mods/default/textures/default_sandstone_brick_normal.png differ diff --git a/mods/default/textures/default_sapling.png b/mods/default/textures/default_sapling.png new file mode 100644 index 0000000..3fd64f0 Binary files /dev/null and b/mods/default/textures/default_sapling.png differ diff --git a/mods/default/textures/default_sign.png b/mods/default/textures/default_sign.png new file mode 100644 index 0000000..912a372 Binary files /dev/null and b/mods/default/textures/default_sign.png differ diff --git a/mods/default/textures/default_sign_wall.png b/mods/default/textures/default_sign_wall.png new file mode 100644 index 0000000..56a7d2e Binary files /dev/null and b/mods/default/textures/default_sign_wall.png differ diff --git a/mods/default/textures/default_snow.png b/mods/default/textures/default_snow.png new file mode 100644 index 0000000..2a2439f Binary files /dev/null and b/mods/default/textures/default_snow.png differ diff --git a/mods/default/textures/default_snow_side.png b/mods/default/textures/default_snow_side.png new file mode 100644 index 0000000..3e98915 Binary files /dev/null and b/mods/default/textures/default_snow_side.png differ diff --git a/mods/default/textures/default_snowball.png b/mods/default/textures/default_snowball.png new file mode 100644 index 0000000..ecdba9a Binary files /dev/null and b/mods/default/textures/default_snowball.png differ diff --git a/mods/default/textures/default_steel_block.png b/mods/default/textures/default_steel_block.png new file mode 100644 index 0000000..7f49f61 Binary files /dev/null and b/mods/default/textures/default_steel_block.png differ diff --git a/mods/default/textures/default_steel_ingot.png b/mods/default/textures/default_steel_ingot.png new file mode 100644 index 0000000..8100b01 Binary files /dev/null and b/mods/default/textures/default_steel_ingot.png differ diff --git a/mods/default/textures/default_stick.png b/mods/default/textures/default_stick.png new file mode 100644 index 0000000..0378d07 Binary files /dev/null and b/mods/default/textures/default_stick.png differ diff --git a/mods/default/textures/default_stone.png b/mods/default/textures/default_stone.png new file mode 100644 index 0000000..63cb7c4 Binary files /dev/null and b/mods/default/textures/default_stone.png differ diff --git a/mods/default/textures/default_stone_brick.png b/mods/default/textures/default_stone_brick.png new file mode 100644 index 0000000..c254cc6 Binary files /dev/null and b/mods/default/textures/default_stone_brick.png differ diff --git a/mods/default/textures/default_stone_brick_normal.png b/mods/default/textures/default_stone_brick_normal.png new file mode 100644 index 0000000..893714f Binary files /dev/null and b/mods/default/textures/default_stone_brick_normal.png differ diff --git a/mods/default/textures/default_stone_normal.png b/mods/default/textures/default_stone_normal.png new file mode 100644 index 0000000..66fc0b9 Binary files /dev/null and b/mods/default/textures/default_stone_normal.png differ diff --git a/mods/default/textures/default_tnt_bottom.png b/mods/default/textures/default_tnt_bottom.png new file mode 100644 index 0000000..4eda060 Binary files /dev/null and b/mods/default/textures/default_tnt_bottom.png differ diff --git a/mods/default/textures/default_tnt_side.png b/mods/default/textures/default_tnt_side.png new file mode 100644 index 0000000..947f862 Binary files /dev/null and b/mods/default/textures/default_tnt_side.png differ diff --git a/mods/default/textures/default_tnt_top.png b/mods/default/textures/default_tnt_top.png new file mode 100644 index 0000000..473c8fd Binary files /dev/null and b/mods/default/textures/default_tnt_top.png differ diff --git a/mods/default/textures/default_tool_bronzeaxe.png b/mods/default/textures/default_tool_bronzeaxe.png new file mode 100644 index 0000000..8ae43b5 Binary files /dev/null and b/mods/default/textures/default_tool_bronzeaxe.png differ diff --git a/mods/default/textures/default_tool_bronzepick.png b/mods/default/textures/default_tool_bronzepick.png new file mode 100644 index 0000000..c88a5f0 Binary files /dev/null and b/mods/default/textures/default_tool_bronzepick.png differ diff --git a/mods/default/textures/default_tool_bronzeshovel.png b/mods/default/textures/default_tool_bronzeshovel.png new file mode 100644 index 0000000..d7d800e Binary files /dev/null and b/mods/default/textures/default_tool_bronzeshovel.png differ diff --git a/mods/default/textures/default_tool_bronzesword.png b/mods/default/textures/default_tool_bronzesword.png new file mode 100644 index 0000000..cdab898 Binary files /dev/null and b/mods/default/textures/default_tool_bronzesword.png differ diff --git a/mods/default/textures/default_tool_diamondaxe.png b/mods/default/textures/default_tool_diamondaxe.png new file mode 100644 index 0000000..e32a0bf Binary files /dev/null and b/mods/default/textures/default_tool_diamondaxe.png differ diff --git a/mods/default/textures/default_tool_diamondpick.png b/mods/default/textures/default_tool_diamondpick.png new file mode 100644 index 0000000..f9883c6 Binary files /dev/null and b/mods/default/textures/default_tool_diamondpick.png differ diff --git a/mods/default/textures/default_tool_diamondshovel.png b/mods/default/textures/default_tool_diamondshovel.png new file mode 100644 index 0000000..d0fe24d Binary files /dev/null and b/mods/default/textures/default_tool_diamondshovel.png differ diff --git a/mods/default/textures/default_tool_diamondsword.png b/mods/default/textures/default_tool_diamondsword.png new file mode 100644 index 0000000..dbccd0e Binary files /dev/null and b/mods/default/textures/default_tool_diamondsword.png differ diff --git a/mods/default/textures/default_tool_meseaxe.png b/mods/default/textures/default_tool_meseaxe.png new file mode 100644 index 0000000..c01fb4f Binary files /dev/null and b/mods/default/textures/default_tool_meseaxe.png differ diff --git a/mods/default/textures/default_tool_mesepick.png b/mods/default/textures/default_tool_mesepick.png new file mode 100644 index 0000000..1b2e25b Binary files /dev/null and b/mods/default/textures/default_tool_mesepick.png differ diff --git a/mods/default/textures/default_tool_meseshovel.png b/mods/default/textures/default_tool_meseshovel.png new file mode 100644 index 0000000..00813a2 Binary files /dev/null and b/mods/default/textures/default_tool_meseshovel.png differ diff --git a/mods/default/textures/default_tool_mesesword.png b/mods/default/textures/default_tool_mesesword.png new file mode 100644 index 0000000..d395d3a Binary files /dev/null and b/mods/default/textures/default_tool_mesesword.png differ diff --git a/mods/default/textures/default_tool_steelaxe.png b/mods/default/textures/default_tool_steelaxe.png new file mode 100644 index 0000000..1528cad Binary files /dev/null and b/mods/default/textures/default_tool_steelaxe.png differ diff --git a/mods/default/textures/default_tool_steelpick.png b/mods/default/textures/default_tool_steelpick.png new file mode 100644 index 0000000..a7543a1 Binary files /dev/null and b/mods/default/textures/default_tool_steelpick.png differ diff --git a/mods/default/textures/default_tool_steelshovel.png b/mods/default/textures/default_tool_steelshovel.png new file mode 100644 index 0000000..65e4045 Binary files /dev/null and b/mods/default/textures/default_tool_steelshovel.png differ diff --git a/mods/default/textures/default_tool_steelsword.png b/mods/default/textures/default_tool_steelsword.png new file mode 100644 index 0000000..630a339 Binary files /dev/null and b/mods/default/textures/default_tool_steelsword.png differ diff --git a/mods/default/textures/default_tool_stoneaxe.png b/mods/default/textures/default_tool_stoneaxe.png new file mode 100644 index 0000000..cc36054 Binary files /dev/null and b/mods/default/textures/default_tool_stoneaxe.png differ diff --git a/mods/default/textures/default_tool_stonepick.png b/mods/default/textures/default_tool_stonepick.png new file mode 100644 index 0000000..237d739 Binary files /dev/null and b/mods/default/textures/default_tool_stonepick.png differ diff --git a/mods/default/textures/default_tool_stoneshovel.png b/mods/default/textures/default_tool_stoneshovel.png new file mode 100644 index 0000000..11711bd Binary files /dev/null and b/mods/default/textures/default_tool_stoneshovel.png differ diff --git a/mods/default/textures/default_tool_stonesword.png b/mods/default/textures/default_tool_stonesword.png new file mode 100644 index 0000000..1a493ac Binary files /dev/null and b/mods/default/textures/default_tool_stonesword.png differ diff --git a/mods/default/textures/default_tool_woodaxe.png b/mods/default/textures/default_tool_woodaxe.png new file mode 100644 index 0000000..68f1fd8 Binary files /dev/null and b/mods/default/textures/default_tool_woodaxe.png differ diff --git a/mods/default/textures/default_tool_woodpick.png b/mods/default/textures/default_tool_woodpick.png new file mode 100644 index 0000000..0aed583 Binary files /dev/null and b/mods/default/textures/default_tool_woodpick.png differ diff --git a/mods/default/textures/default_tool_woodshovel.png b/mods/default/textures/default_tool_woodshovel.png new file mode 100644 index 0000000..dcef2b5 Binary files /dev/null and b/mods/default/textures/default_tool_woodshovel.png differ diff --git a/mods/default/textures/default_tool_woodsword.png b/mods/default/textures/default_tool_woodsword.png new file mode 100644 index 0000000..c78ba50 Binary files /dev/null and b/mods/default/textures/default_tool_woodsword.png differ diff --git a/mods/default/textures/default_torch.png b/mods/default/textures/default_torch.png new file mode 100644 index 0000000..e21aac3 Binary files /dev/null and b/mods/default/textures/default_torch.png differ diff --git a/mods/default/textures/default_torch_animated.png b/mods/default/textures/default_torch_animated.png new file mode 100644 index 0000000..cdf33ef Binary files /dev/null and b/mods/default/textures/default_torch_animated.png differ diff --git a/mods/default/textures/default_torch_on_ceiling.png b/mods/default/textures/default_torch_on_ceiling.png new file mode 100644 index 0000000..89f41f5 Binary files /dev/null and b/mods/default/textures/default_torch_on_ceiling.png differ diff --git a/mods/default/textures/default_torch_on_ceiling_animated.png b/mods/default/textures/default_torch_on_ceiling_animated.png new file mode 100644 index 0000000..3a8b5ad Binary files /dev/null and b/mods/default/textures/default_torch_on_ceiling_animated.png differ diff --git a/mods/default/textures/default_torch_on_floor.png b/mods/default/textures/default_torch_on_floor.png new file mode 100644 index 0000000..bc4bdd6 Binary files /dev/null and b/mods/default/textures/default_torch_on_floor.png differ diff --git a/mods/default/textures/default_torch_on_floor_animated.png b/mods/default/textures/default_torch_on_floor_animated.png new file mode 100644 index 0000000..ad51c03 Binary files /dev/null and b/mods/default/textures/default_torch_on_floor_animated.png differ diff --git a/mods/default/textures/default_tree.png b/mods/default/textures/default_tree.png new file mode 100644 index 0000000..10e297b Binary files /dev/null and b/mods/default/textures/default_tree.png differ diff --git a/mods/default/textures/default_tree_top.png b/mods/default/textures/default_tree_top.png new file mode 100644 index 0000000..da99bce Binary files /dev/null and b/mods/default/textures/default_tree_top.png differ diff --git a/mods/default/textures/default_water.png b/mods/default/textures/default_water.png new file mode 100644 index 0000000..00500e9 Binary files /dev/null and b/mods/default/textures/default_water.png differ diff --git a/mods/default/textures/default_water_flowing_animated.png b/mods/default/textures/default_water_flowing_animated.png new file mode 100644 index 0000000..070d797 Binary files /dev/null and b/mods/default/textures/default_water_flowing_animated.png differ diff --git a/mods/default/textures/default_water_source_animated.png b/mods/default/textures/default_water_source_animated.png new file mode 100644 index 0000000..7e7f9ff Binary files /dev/null and b/mods/default/textures/default_water_source_animated.png differ diff --git a/mods/default/textures/default_wood.png b/mods/default/textures/default_wood.png new file mode 100644 index 0000000..af56d6c Binary files /dev/null and b/mods/default/textures/default_wood.png differ diff --git a/mods/default/textures/gui_formbg.png b/mods/default/textures/gui_formbg.png new file mode 100644 index 0000000..c543466 Binary files /dev/null and b/mods/default/textures/gui_formbg.png differ diff --git a/mods/default/textures/gui_furnace_arrow_bg.png b/mods/default/textures/gui_furnace_arrow_bg.png new file mode 100644 index 0000000..046d8cd Binary files /dev/null and b/mods/default/textures/gui_furnace_arrow_bg.png differ diff --git a/mods/default/textures/gui_furnace_arrow_fg.png b/mods/default/textures/gui_furnace_arrow_fg.png new file mode 100644 index 0000000..8d3c396 Binary files /dev/null and b/mods/default/textures/gui_furnace_arrow_fg.png differ diff --git a/mods/default/textures/gui_hb_bg.png b/mods/default/textures/gui_hb_bg.png new file mode 100644 index 0000000..99248e1 Binary files /dev/null and b/mods/default/textures/gui_hb_bg.png differ diff --git a/mods/default/textures/gui_hotbar.png b/mods/default/textures/gui_hotbar.png new file mode 100644 index 0000000..73fb3ca Binary files /dev/null and b/mods/default/textures/gui_hotbar.png differ diff --git a/mods/default/textures/gui_hotbar_selected.png b/mods/default/textures/gui_hotbar_selected.png new file mode 100644 index 0000000..40bafe6 Binary files /dev/null and b/mods/default/textures/gui_hotbar_selected.png differ diff --git a/mods/default/textures/heart.png b/mods/default/textures/heart.png new file mode 100644 index 0000000..fb8dcc7 Binary files /dev/null and b/mods/default/textures/heart.png differ diff --git a/mods/default/textures/player.png b/mods/default/textures/player.png new file mode 100644 index 0000000..6d61c43 Binary files /dev/null and b/mods/default/textures/player.png differ diff --git a/mods/default/textures/player_back.png b/mods/default/textures/player_back.png new file mode 100644 index 0000000..5e9ef05 Binary files /dev/null and b/mods/default/textures/player_back.png differ diff --git a/mods/default/textures/wieldhand.png b/mods/default/textures/wieldhand.png new file mode 100644 index 0000000..69f4b7b Binary files /dev/null and b/mods/default/textures/wieldhand.png differ diff --git a/mods/default/tools.lua b/mods/default/tools.lua new file mode 100644 index 0000000..a948886 --- /dev/null +++ b/mods/default/tools.lua @@ -0,0 +1,332 @@ +-- mods/default/tools.lua + +-- The hand +minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x=1,y=1,z=2.5}, + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level = 0, + groupcaps = { + crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1}, + snappy = {times={[3]=0.40}, uses=0, maxlevel=1}, + oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0} + }, + damage_groups = {fleshy=1}, + } +}) + +-- +-- Picks +-- + +minetest.register_tool("default:pick_wood", { + description = "Wooden Pickaxe", + inventory_image = "default_tool_woodpick.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + cracky = {times={[3]=1.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, +}) +minetest.register_tool("default:pick_stone", { + description = "Stone Pickaxe", + inventory_image = "default_tool_stonepick.png", + tool_capabilities = { + full_punch_interval = 1.3, + max_drop_level=0, + groupcaps={ + cracky = {times={[2]=2.0, [3]=1.00}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=3}, + }, +}) +minetest.register_tool("default:pick_steel", { + description = "Steel Pickaxe", + inventory_image = "default_tool_steelpick.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=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, +}) +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}, + }, +}) +minetest.register_tool("default:pick_mese", { + description = "Mese Pickaxe", + inventory_image = "default_tool_mesepick.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=3, + groupcaps={ + cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, +}) +minetest.register_tool("default:pick_diamond", { + description = "Diamond Pickaxe", + inventory_image = "default_tool_diamondpick.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=3, + groupcaps={ + cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, +}) + +-- +-- Shovels +-- + +minetest.register_tool("default:shovel_wood", { + description = "Wooden Shovel", + inventory_image = "default_tool_woodshovel.png", + wield_image = "default_tool_woodshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + crumbly = {times={[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, +}) +minetest.register_tool("default:shovel_stone", { + description = "Stone Shovel", + inventory_image = "default_tool_stoneshovel.png", + wield_image = "default_tool_stoneshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.4, + max_drop_level=0, + groupcaps={ + crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, +}) +minetest.register_tool("default:shovel_steel", { + description = "Steel Shovel", + inventory_image = "default_tool_steelshovel.png", + wield_image = "default_tool_steelshovel.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=30, maxlevel=2}, + }, + damage_groups = {fleshy=3}, + }, +}) +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}, + }, +}) +minetest.register_tool("default:shovel_mese", { + description = "Mese Shovel", + inventory_image = "default_tool_meseshovel.png", + wield_image = "default_tool_meseshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=4}, + }, +}) +minetest.register_tool("default:shovel_diamond", { + description = "Diamond Shovel", + inventory_image = "default_tool_diamondshovel.png", + wield_image = "default_tool_diamondshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=4}, + }, +}) + +-- +-- Axes +-- + +minetest.register_tool("default:axe_wood", { + description = "Wooden Axe", + inventory_image = "default_tool_woodaxe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + groupcaps={ + choppy = {times={[2]=3.00, [3]=1.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, +}) +minetest.register_tool("default:axe_stone", { + description = "Stone Axe", + inventory_image = "default_tool_stoneaxe.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + choppy={times={[1]=3.00, [2]=2.00, [3]=1.30}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=3}, + }, +}) +minetest.register_tool("default:axe_steel", { + description = "Steel Axe", + inventory_image = "default_tool_steelaxe.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=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, +}) +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}, + }, +}) +minetest.register_tool("default:axe_mese", { + description = "Mese Axe", + inventory_image = "default_tool_meseaxe.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=6}, + }, +}) +minetest.register_tool("default:axe_diamond", { + description = "Diamond Axe", + inventory_image = "default_tool_diamondaxe.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=7}, + }, +}) + +-- +-- Swords +-- + +minetest.register_tool("default:sword_wood", { + description = "Wooden Sword", + inventory_image = "default_tool_woodsword.png", + tool_capabilities = { + full_punch_interval = 1, + max_drop_level=0, + groupcaps={ + snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + } +}) +minetest.register_tool("default:sword_stone", { + description = "Stone Sword", + inventory_image = "default_tool_stonesword.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=4}, + } +}) +minetest.register_tool("default:sword_steel", { + description = "Steel Sword", + inventory_image = "default_tool_steelsword.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=30, maxlevel=2}, + }, + damage_groups = {fleshy=6}, + } +}) +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}, + } +}) +minetest.register_tool("default:sword_mese", { + description = "Mese Sword", + inventory_image = "default_tool_mesesword.png", + tool_capabilities = { + full_punch_interval = 0.7, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=7}, + } +}) +minetest.register_tool("default:sword_diamond", { + description = "Diamond Sword", + inventory_image = "default_tool_diamondsword.png", + tool_capabilities = { + full_punch_interval = 0.7, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3}, + }, + damage_groups = {fleshy=8}, + } +}) diff --git a/mods/default/trees.lua b/mods/default/trees.lua new file mode 100644 index 0000000..8e50355 --- /dev/null +++ b/mods/default/trees.lua @@ -0,0 +1,348 @@ +-- +-- Grow trees +-- + +local random = math.random + +local function can_grow(pos) + local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z}) + if not node_under then + return false + end + local name_under = node_under.name + local is_soil = minetest.get_item_group(name_under, "soil") + if is_soil == 0 then + return false + end + return true +end + +-- Sapling ABMs + +minetest.register_abm({ + nodenames = {"default:sapling"}, + interval = 10, + chance = 50, + action = function(pos, node) + if not can_grow(pos) then + return + end + + minetest.log("action", "A sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_tree(pos, random(1, 4) == 1) + end +}) + +minetest.register_abm({ + nodenames = {"default:junglesapling"}, + interval = 11, + chance = 50, + action = function(pos, node) + if not can_grow(pos) then + return + end + + minetest.log("action", "A jungle sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_jungle_tree(pos) + end +}) + +minetest.register_abm({ + nodenames = {"default:pine_sapling"}, + interval = 12, + chance = 50, + action = function(pos, node) + if not can_grow(pos) then + return + end + + minetest.log("action", "A pine sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_pine_tree(pos) + end +}) + +-- Appletree, jungletree function + +local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, + height, size, iters, is_apple_tree) + local x, y, z = pos.x, pos.y, pos.z + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_apple = minetest.get_content_id("default:apple") + + -- Trunk + data[a:index(x, y, z)] = tree_cid -- Force-place lowest trunk node to replace sapling + for yy = y + 1, y + height - 1 do + local vi = a:index(x, yy, z) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or node_id == leaves_cid then + data[vi] = tree_cid + end + end + + -- Force leaves near the trunk + for z_dist = -1, 1 do + for y_dist = -size, 1 do + local vi = a:index(x - 1, y + height + y_dist, z + z_dist) + for x_dist = -1, 1 do + if data[vi] == c_air or data[vi] == c_ignore then + if is_apple_tree and random(1, 8) == 1 then + data[vi] = c_apple + else + data[vi] = leaves_cid + end + end + vi = vi + 1 + end + end + end + + -- Randomly add leaves in 2x2x2 clusters. + for i = 1, iters do + local clust_x = x + random(-size, size - 1) + local clust_y = y + height + random(-size, 0) + local clust_z = z + random(-size, size - 1) + + for xi = 0, 1 do + for yi = 0, 1 do + for zi = 0, 1 do + local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi) + if data[vi] == c_air or data[vi] == c_ignore then + if is_apple_tree and random(1, 8) == 1 then + data[vi] = c_apple + else + data[vi] = leaves_cid + end + end + end + end + end + end +end + +-- Appletree + +function default.grow_tree(pos, is_apple_tree, bad) + --[[ + NOTE: Tree-placing code is currently duplicated in the engine + and in games that have saplings; both are deprecated but not + replaced yet + --]] + if bad then + error("Deprecated use of default.grow_tree") + end + + local x, y, z = pos.x, pos.y, pos.z + local height = random(4, 5) + local c_tree = minetest.get_content_id("default:tree") + local c_leaves = minetest.get_content_id("default:leaves") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = pos.x - 2, y = pos.y, z = pos.z - 2}, + {x = pos.x + 2, y = pos.y + height + 1, z = pos.z + 2} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree) + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + +-- Jungletree + +function default.grow_jungle_tree(pos, bad) + --[[ + NOTE: Jungletree-placing code is currently duplicated in the engine + and in games that have saplings; both are deprecated but not + replaced yet + --]] + if bad then + error("Deprecated use of default.grow_jungle_tree") + end + + local x, y, z = pos.x, pos.y, pos.z + local height = random(8, 12) + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_jungletree = minetest.get_content_id("default:jungletree") + local c_jungleleaves = minetest.get_content_id("default:jungleleaves") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = pos.x - 3, y = pos.y - 1, z = pos.z - 3}, + {x = pos.x + 3, y = pos.y + height + 1, z = pos.z + 3} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + add_trunk_and_leaves(data, a, pos, c_jungletree, c_jungleleaves, height, 3, 30, false) + + -- Roots + for z_dist = -1, 1 do + local vi_1 = a:index(x - 1, y - 1, z + z_dist) + local vi_2 = a:index(x - 1, y, z + z_dist) + for x_dist = -1, 1 do + if random(1, 3) >= 2 then + if data[vi_1] == c_air or data[vi_1] == c_ignore then + data[vi_1] = c_jungletree + elseif data[vi_2] == c_air or data[vi_2] == c_ignore then + data[vi_2] = c_jungletree + end + end + vi_1 = vi_1 + 1 + vi_2 = vi_2 + 1 + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + +-- Pinetree from mg mapgen mod, design by sfan5, pointy top added by paramat + +local function add_pine_needles(data, vi, c_air, c_ignore, c_snow, c_pine_needles) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or node_id == c_snow then + data[vi] = c_pine_needles + end +end + +local function add_snow(data, vi, c_air, c_ignore, c_snow) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore then + data[vi] = c_snow + end +end + +function default.grow_pine_tree(pos) + local x, y, z = pos.x, pos.y, pos.z + local maxy = y + random(9, 13) -- Trunk top + + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_pinetree = minetest.get_content_id("default:pinetree") + local c_pine_needles = minetest.get_content_id("default:pine_needles") + local c_snow = minetest.get_content_id("default:snow") + local c_snowblock = minetest.get_content_id("default:snowblock") + local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = x - 3, y = y - 1, z = z - 3}, + {x = x + 3, y = maxy + 3, z = z + 3} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + -- Scan for snow nodes near sapling to enable snow on branches + local snow = false + for yy = y - 1, y + 1 do + for zz = z - 1, z + 1 do + local vi = a:index(x - 1, yy, zz) + for xx = x - 1, x + 1 do + local nodid = data[vi] + if nodid == c_snow or nodid == c_snowblock or nodid == c_dirtsnow then + snow = true + end + vi = vi + 1 + end + end + end + + -- Upper branches layer + local dev = 3 + for yy = maxy - 1, maxy + 1 do + for zz = z - dev, z + dev do + local vi = a:index(x - dev, yy, zz) + local via = a:index(x - dev, yy + 1, zz) + for xx = x - dev, x + dev do + if random() < 0.95 - dev * 0.05 then + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + end + vi = vi + 1 + via = via + 1 + end + end + dev = dev - 1 + end + + -- Centre top nodes + add_pine_needles(data, a:index(x, maxy + 1, z), c_air, c_ignore, c_snow, + c_pine_needles) + add_pine_needles(data, a:index(x, maxy + 2, z), c_air, c_ignore, c_snow, + c_pine_needles) -- Paramat added a pointy top node + if snow then + add_snow(data, a:index(x, maxy + 3, z), c_air, c_ignore, c_snow) + end + + -- Lower branches layer + local my = 0 + for i = 1, 20 do -- Random 2x2 squares of needles + local xi = x + random(-3, 2) + local yy = maxy + random(-6, -5) + local zi = z + random(-3, 2) + if yy > my then + my = yy + end + for zz = zi, zi+1 do + local vi = a:index(xi, yy, zz) + local via = a:index(xi, yy + 1, zz) + for xx = xi, xi + 1 do + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + vi = vi + 1 + via = via + 1 + end + end + end + + local dev = 2 + for yy = my + 1, my + 2 do + for zz = z - dev, z + dev do + local vi = a:index(x - dev, yy, zz) + local via = a:index(x - dev, yy + 1, zz) + for xx = x - dev, x + dev do + if random() < 0.95 - dev * 0.05 then + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + end + vi = vi + 1 + via = via + 1 + end + end + dev = dev - 1 + end + + -- Trunk + data[a:index(x, y, z)] = c_pinetree -- Force-place lowest trunk node to replace sapling + for yy = y + 1, maxy do + local vi = a:index(x, yy, z) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or node_id == c_pine_needles then + data[vi] = c_pinetree + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + diff --git a/mods/doors/README.txt b/mods/doors/README.txt new file mode 100644 index 0000000..146af8e --- /dev/null +++ b/mods/doors/README.txt @@ -0,0 +1,46 @@ +Minetest 0.4 mod: doors +======================= +version: 1.3 + +License of source code: +----------------------- +Copyright (C) 2012 PilzAdam +modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor) + +This program is free software. It comes without any warranty, to +the extent permitted by applicable law. You can redistribute it +and/or modify it under the terms of the Do What The Fuck You Want +To Public License, Version 2, as published by Sam Hocevar. See +http://sam.zoy.org/wtfpl/COPYING for more details. + +License of textures +-------------------------------------- +following Textures created by Fernando Zapata (CC BY-SA 3.0): + door_wood.png + door_wood_a.png + door_wood_a_r.png + door_wood_b.png + door_wood_b_r.png + +following Textures created by BlockMen (WTFPL): + door_trapdoor.png + door_obsidian_glass_side.png + +following textures created by celeron55 (CC BY-SA 3.0): + door_trapdoor_side.png + door_glass_a.png + door_glass_b.png + +following Textures created by PenguinDad (CC BY-SA 4.0): + door_glass.png + door_obsidian_glass.png + +All other textures (created by PilzAdam): WTFPL + + +License of sounds +-------------------------------------- +Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen + door_open.ogg +Closing-Sound created by bennstir (CC BY 3.0) + door_close.ogg diff --git a/mods/doors/depends.txt b/mods/doors/depends.txt new file mode 100644 index 0000000..5e28bee --- /dev/null +++ b/mods/doors/depends.txt @@ -0,0 +1,2 @@ +default +screwdriver? diff --git a/mods/doors/init.lua b/mods/doors/init.lua new file mode 100644 index 0000000..a553565 --- /dev/null +++ b/mods/doors/init.lua @@ -0,0 +1,502 @@ +doors = {} + +-- Registers a door +function doors.register_door(name, def) + def.groups.not_in_creative_inventory = 1 + + local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}} + + if not def.node_box_bottom then + def.node_box_bottom = box + end + if not def.node_box_top then + def.node_box_top = box + end + if not def.selection_box_bottom then + def.selection_box_bottom= box + end + if not def.selection_box_top then + def.selection_box_top = box + end + + if not def.sound_close_door then + def.sound_close_door = "doors_door_close" + end + if not def.sound_open_door then + def.sound_open_door = "doors_door_open" + end + + + minetest.register_craftitem(name, { + description = def.description, + inventory_image = def.inventory_image, + + on_place = function(itemstack, placer, pointed_thing) + if not pointed_thing.type == "node" then + return itemstack + end + + local ptu = pointed_thing.under + local nu = minetest.get_node(ptu) + if minetest.registered_nodes[nu.name].on_rightclick then + return minetest.registered_nodes[nu.name].on_rightclick(ptu, nu, placer, itemstack) + end + + local pt = pointed_thing.above + local pt2 = {x=pt.x, y=pt.y, z=pt.z} + pt2.y = pt2.y+1 + if + not minetest.registered_nodes[minetest.get_node(pt).name].buildable_to or + not minetest.registered_nodes[minetest.get_node(pt2).name].buildable_to or + not placer or + not placer:is_player() + then + return itemstack + end + + if minetest.is_protected(pt, placer:get_player_name()) or + minetest.is_protected(pt2, placer:get_player_name()) then + minetest.record_protection_violation(pt, placer:get_player_name()) + return itemstack + end + + local p2 = minetest.dir_to_facedir(placer:get_look_dir()) + local pt3 = {x=pt.x, y=pt.y, z=pt.z} + if p2 == 0 then + pt3.x = pt3.x-1 + elseif p2 == 1 then + pt3.z = pt3.z+1 + elseif p2 == 2 then + pt3.x = pt3.x+1 + elseif p2 == 3 then + pt3.z = pt3.z-1 + end + if minetest.get_item_group(minetest.get_node(pt3).name, "door") == 0 then + minetest.set_node(pt, {name=name.."_b_1", param2=p2}) + minetest.set_node(pt2, {name=name.."_t_1", param2=p2}) + else + minetest.set_node(pt, {name=name.."_b_2", param2=p2}) + minetest.set_node(pt2, {name=name.."_t_2", param2=p2}) + minetest.get_meta(pt):set_int("right", 1) + minetest.get_meta(pt2):set_int("right", 1) + end + + if def.only_placer_can_open then + local pn = placer:get_player_name() + local meta = minetest.get_meta(pt) + meta:set_string("doors_owner", pn) + meta:set_string("infotext", "Owned by "..pn) + meta = minetest.get_meta(pt2) + meta:set_string("doors_owner", pn) + meta:set_string("infotext", "Owned by "..pn) + end + + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, + }) + + local tt = def.tiles_top + local tb = def.tiles_bottom + + local function after_dig_node(pos, name, digger) + local node = minetest.get_node(pos) + if node.name == name then + minetest.node_dig(pos, node, digger) + end + end + + local function check_and_blast(pos, name) + local node = minetest.get_node(pos) + if node.name == name then + minetest.remove_node(pos) + end + end + + local function make_on_blast(base_name, dir, door_type, other_door_type) + if def.only_placer_can_open then + return function() end + else + return function(pos, intensity) + check_and_blast(pos, base_name .. door_type) + pos.y = pos.y + dir + check_and_blast(pos, base_name .. other_door_type) + end + end + end + + local function on_rightclick(pos, dir, check_name, replace, replace_dir, params) + pos.y = pos.y+dir + if not minetest.get_node(pos).name == check_name then + return + end + local p2 = minetest.get_node(pos).param2 + p2 = params[p2+1] + + minetest.swap_node(pos, {name=replace_dir, param2=p2}) + + pos.y = pos.y-dir + minetest.swap_node(pos, {name=replace, param2=p2}) + + local snd_1 = def.sound_close_door + local snd_2 = def.sound_open_door + if params[1] == 3 then + snd_1 = def.sound_open_door + snd_2 = def.sound_close_door + end + + if minetest.get_meta(pos):get_int("right") ~= 0 then + minetest.sound_play(snd_1, {pos = pos, gain = 0.3, max_hear_distance = 10}) + else + minetest.sound_play(snd_2, {pos = pos, gain = 0.3, max_hear_distance = 10}) + end + end + + local function check_player_priv(pos, player) + if not def.only_placer_can_open then + return true + end + local meta = minetest.get_meta(pos) + local pn = player:get_player_name() + return meta:get_string("doors_owner") == pn + end + + local function on_rotate(pos, node, dir, user, check_name, mode, new_param2) + if not check_player_priv(pos, user) then + return false + end + if mode ~= screwdriver.ROTATE_FACE then + return false + end + + pos.y = pos.y + dir + if not minetest.get_node(pos).name == check_name then + return false + end + if minetest.is_protected(pos, user:get_player_name()) then + minetest.record_protection_violation(pos, user:get_player_name()) + return false + end + + local node2 = minetest.get_node(pos) + node2.param2 = (node2.param2 + 1) % 4 + minetest.swap_node(pos, node2) + + pos.y = pos.y - dir + node.param2 = (node.param2 + 1) % 4 + minetest.swap_node(pos, node) + return true + end + + minetest.register_node(name.."_b_1", { + tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + drop = name, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = def.node_box_bottom + }, + selection_box = { + type = "fixed", + fixed = def.selection_box_bottom + }, + groups = def.groups, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + pos.y = pos.y+1 + after_dig_node(pos, name.."_t_1", digger) + end, + + on_rightclick = function(pos, node, clicker) + if check_player_priv(pos, clicker) then + on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) + end + end, + + on_rotate = function(pos, node, user, mode, new_param2) + return on_rotate(pos, node, 1, user, name.."_t_1", mode) + end, + + can_dig = check_player_priv, + sounds = def.sounds, + sunlight_propagates = def.sunlight, + on_blast = make_on_blast(name, 1, "_b_1", "_t_1") + }) + + minetest.register_node(name.."_t_1", { + tiles = {tt[2], tt[2], tt[2], tt[2], tt[1], tt[1].."^[transformfx"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + drop = "", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = def.node_box_top + }, + selection_box = { + type = "fixed", + fixed = def.selection_box_top + }, + groups = def.groups, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + pos.y = pos.y-1 + after_dig_node(pos, name.."_b_1", digger) + end, + + on_rightclick = function(pos, node, clicker) + if check_player_priv(pos, clicker) then + on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0}) + end + end, + + on_rotate = function(pos, node, user, mode, new_param2) + return on_rotate(pos, node, -1, user, name.."_b_1", mode) + end, + + can_dig = check_player_priv, + sounds = def.sounds, + sunlight_propagates = def.sunlight, + on_blast = make_on_blast(name, -1, "_t_1", "_b_1") + }) + + minetest.register_node(name.."_b_2", { + tiles = {tb[2], tb[2], tb[2], tb[2], tb[1].."^[transformfx", tb[1]}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + drop = name, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = def.node_box_bottom + }, + selection_box = { + type = "fixed", + fixed = def.selection_box_bottom + }, + groups = def.groups, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + pos.y = pos.y+1 + after_dig_node(pos, name.."_t_2", digger) + end, + + on_rightclick = function(pos, node, clicker) + if check_player_priv(pos, clicker) then + on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) + end + end, + + on_rotate = function(pos, node, user, mode, new_param2) + return on_rotate(pos, node, 1, user, name.."_t_2", mode) + end, + + can_dig = check_player_priv, + sounds = def.sounds, + sunlight_propagates = def.sunlight, + on_blast = make_on_blast(name, 1, "_b_2", "_t_2") + }) + + minetest.register_node(name.."_t_2", { + tiles = {tt[2], tt[2], tt[2], tt[2], tt[1].."^[transformfx", tt[1]}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + drop = "", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = def.node_box_top + }, + selection_box = { + type = "fixed", + fixed = def.selection_box_top + }, + groups = def.groups, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + pos.y = pos.y-1 + after_dig_node(pos, name.."_b_2", digger) + end, + + on_rightclick = function(pos, node, clicker) + if check_player_priv(pos, clicker) then + on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2}) + end + end, + + on_rotate = function(pos, node, user, mode, new_param2) + return on_rotate(pos, node, -1, user, name.."_b_2", mode) + end, + + can_dig = check_player_priv, + sounds = def.sounds, + sunlight_propagates = def.sunlight, + on_blast = make_on_blast(name, -1, "_t_2", "_b_2") + }) + +end + +doors.register_door("doors:door_wood", { + description = "Wooden Door", + inventory_image = "doors_wood.png", + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1}, + tiles_bottom = {"doors_wood_b.png", "doors_brown.png"}, + tiles_top = {"doors_wood_a.png", "doors_brown.png"}, + sounds = default.node_sound_wood_defaults(), + sunlight = false, +}) + +minetest.register_craft({ + output = "doors:door_wood", + recipe = { + {"group:wood", "group:wood"}, + {"group:wood", "group:wood"}, + {"group:wood", "group:wood"} + } +}) + +doors.register_door("doors:door_steel", { + description = "Steel Door", + inventory_image = "doors_steel.png", + groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1}, + tiles_bottom = {"doors_steel_b.png", "doors_grey.png"}, + tiles_top = {"doors_steel_a.png", "doors_grey.png"}, + only_placer_can_open = true, + sounds = default.node_sound_wood_defaults(), + sunlight = false, +}) + +minetest.register_craft({ + output = "doors:door_steel", + recipe = { + {"default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot"} + } +}) + +doors.register_door("doors:door_glass", { + description = "Glass Door", + inventory_image = "doors_glass.png", + groups = {snappy=1,cracky=1,oddly_breakable_by_hand=3,door=1}, + tiles_bottom = {"doors_glass_b.png", "doors_glass_side.png"}, + tiles_top = {"doors_glass_a.png", "doors_glass_side.png"}, + sounds = default.node_sound_glass_defaults(), + sunlight = true, +}) + +minetest.register_craft({ + output = "doors:door_glass", + recipe = { + {"default:glass", "default:glass"}, + {"default:glass", "default:glass"}, + {"default:glass", "default:glass"} + } +}) + +doors.register_door("doors:door_obsidian_glass", { + description = "Obsidian Glass Door", + inventory_image = "doors_obsidian_glass.png", + groups = {snappy=1,cracky=1,oddly_breakable_by_hand=3,door=1}, + tiles_bottom = {"doors_obsidian_glass_b.png", "doors_obsidian_glass_side.png"}, + tiles_top = {"doors_obsidian_glass_a.png", "doors_obsidian_glass_side.png"}, + sounds = default.node_sound_glass_defaults(), + sunlight = true, +}) + +minetest.register_craft({ + output = "doors:door_obsidian_glass", + recipe = { + {"default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass"} + } +}) + + +----trapdoor---- + +function doors.register_trapdoor(name, def) + local name_closed = name + local name_opened = name.."_open" + + def.on_rightclick = function (pos, node) + local newname = node.name == name_closed and name_opened or name_closed + local sound = false + if node.name == name_closed then sound = def.sound_open end + if node.name == name_opened then sound = def.sound_close end + if sound then + minetest.sound_play(sound, {pos = pos, gain = 0.3, max_hear_distance = 10}) + end + minetest.set_node(pos, {name = newname, param1 = node.param1, param2 = node.param2}) + end + + def.on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple + + -- Common trapdoor configuration + def.drawtype = "nodebox" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.is_ground_content = false + + local def_opened = table.copy(def) + local def_closed = table.copy(def) + + def_closed.node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5} + } + def_closed.selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5} + } + def_closed.tiles = { def.tile_front, def.tile_front, def.tile_side, def.tile_side, + def.tile_side, def.tile_side } + + def_opened.node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5} + } + def_opened.selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5} + } + def_opened.tiles = { def.tile_side, def.tile_side, def.tile_side, def.tile_side, + def.tile_front, def.tile_front } + def_opened.drop = name_closed + def_opened.groups.not_in_creative_inventory = 1 + + minetest.register_node(name_opened, def_opened) + minetest.register_node(name_closed, def_closed) +end + + + +doors.register_trapdoor("doors:trapdoor", { + description = "Trapdoor", + inventory_image = "doors_trapdoor.png", + wield_image = "doors_trapdoor.png", + tile_front = "doors_trapdoor.png", + tile_side = "doors_trapdoor_side.png", + groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=2, door=1}, + sounds = default.node_sound_wood_defaults(), + sound_open = "doors_door_open", + sound_close = "doors_door_close" +}) + +minetest.register_craft({ + output = 'doors:trapdoor 2', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', '', ''}, + } +}) diff --git a/mods/doors/sounds/doors_door_close.ogg b/mods/doors/sounds/doors_door_close.ogg new file mode 100644 index 0000000..a39452b Binary files /dev/null and b/mods/doors/sounds/doors_door_close.ogg differ diff --git a/mods/doors/sounds/doors_door_open.ogg b/mods/doors/sounds/doors_door_open.ogg new file mode 100644 index 0000000..7ec7f48 Binary files /dev/null and b/mods/doors/sounds/doors_door_open.ogg differ diff --git a/mods/doors/textures/doors_brown.png b/mods/doors/textures/doors_brown.png new file mode 100644 index 0000000..8c8e3d8 Binary files /dev/null and b/mods/doors/textures/doors_brown.png differ diff --git a/mods/doors/textures/doors_glass.png b/mods/doors/textures/doors_glass.png new file mode 100644 index 0000000..49ec245 Binary files /dev/null and b/mods/doors/textures/doors_glass.png differ diff --git a/mods/doors/textures/doors_glass_a.png b/mods/doors/textures/doors_glass_a.png new file mode 100644 index 0000000..da25402 Binary files /dev/null and b/mods/doors/textures/doors_glass_a.png differ diff --git a/mods/doors/textures/doors_glass_b.png b/mods/doors/textures/doors_glass_b.png new file mode 100644 index 0000000..da25402 Binary files /dev/null and b/mods/doors/textures/doors_glass_b.png differ diff --git a/mods/doors/textures/doors_glass_side.png b/mods/doors/textures/doors_glass_side.png new file mode 100644 index 0000000..755672b Binary files /dev/null and b/mods/doors/textures/doors_glass_side.png differ diff --git a/mods/doors/textures/doors_grey.png b/mods/doors/textures/doors_grey.png new file mode 100644 index 0000000..ad110c7 Binary files /dev/null and b/mods/doors/textures/doors_grey.png differ diff --git a/mods/doors/textures/doors_obsidian_glass.png b/mods/doors/textures/doors_obsidian_glass.png new file mode 100644 index 0000000..c327720 Binary files /dev/null and b/mods/doors/textures/doors_obsidian_glass.png differ diff --git a/mods/doors/textures/doors_obsidian_glass_a.png b/mods/doors/textures/doors_obsidian_glass_a.png new file mode 100644 index 0000000..d5ac83d Binary files /dev/null and b/mods/doors/textures/doors_obsidian_glass_a.png differ diff --git a/mods/doors/textures/doors_obsidian_glass_b.png b/mods/doors/textures/doors_obsidian_glass_b.png new file mode 100644 index 0000000..d5ac83d Binary files /dev/null and b/mods/doors/textures/doors_obsidian_glass_b.png differ diff --git a/mods/doors/textures/doors_obsidian_glass_side.png b/mods/doors/textures/doors_obsidian_glass_side.png new file mode 100644 index 0000000..aa4c63a Binary files /dev/null and b/mods/doors/textures/doors_obsidian_glass_side.png differ diff --git a/mods/doors/textures/doors_steel.png b/mods/doors/textures/doors_steel.png new file mode 100644 index 0000000..042a1bc Binary files /dev/null and b/mods/doors/textures/doors_steel.png differ diff --git a/mods/doors/textures/doors_steel_a.png b/mods/doors/textures/doors_steel_a.png new file mode 100644 index 0000000..84ff11d Binary files /dev/null and b/mods/doors/textures/doors_steel_a.png differ diff --git a/mods/doors/textures/doors_steel_b.png b/mods/doors/textures/doors_steel_b.png new file mode 100644 index 0000000..77ffbe3 Binary files /dev/null and b/mods/doors/textures/doors_steel_b.png differ diff --git a/mods/doors/textures/doors_trapdoor.png b/mods/doors/textures/doors_trapdoor.png new file mode 100644 index 0000000..e92c8b2 Binary files /dev/null and b/mods/doors/textures/doors_trapdoor.png differ diff --git a/mods/doors/textures/doors_trapdoor_side.png b/mods/doors/textures/doors_trapdoor_side.png new file mode 100644 index 0000000..c860523 Binary files /dev/null and b/mods/doors/textures/doors_trapdoor_side.png differ diff --git a/mods/doors/textures/doors_wood.png b/mods/doors/textures/doors_wood.png new file mode 100644 index 0000000..d3a62ab Binary files /dev/null and b/mods/doors/textures/doors_wood.png differ diff --git a/mods/doors/textures/doors_wood_a.png b/mods/doors/textures/doors_wood_a.png new file mode 100644 index 0000000..86a747a Binary files /dev/null and b/mods/doors/textures/doors_wood_a.png differ diff --git a/mods/doors/textures/doors_wood_b.png b/mods/doors/textures/doors_wood_b.png new file mode 100644 index 0000000..9665098 Binary files /dev/null and b/mods/doors/textures/doors_wood_b.png differ diff --git a/mods/dropondie/LICENSE b/mods/dropondie/LICENSE new file mode 100644 index 0000000..e06d208 --- /dev/null +++ b/mods/dropondie/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/mods/dropondie/README.md b/mods/dropondie/README.md new file mode 100644 index 0000000..1914b79 --- /dev/null +++ b/mods/dropondie/README.md @@ -0,0 +1,4 @@ +minetest-dropondie +================== + +Minecraft-like drop-all-items-on-die mod diff --git a/mods/dropondie/depends.txt b/mods/dropondie/depends.txt new file mode 100644 index 0000000..e69de29 diff --git a/mods/dropondie/description.txt b/mods/dropondie/description.txt new file mode 100644 index 0000000..29f1833 --- /dev/null +++ b/mods/dropondie/description.txt @@ -0,0 +1 @@ +With this mod, players will drop all their items in their inventory on the ground when they die. diff --git a/mods/dropondie/init.lua b/mods/dropondie/init.lua new file mode 100644 index 0000000..fbe01c4 --- /dev/null +++ b/mods/dropondie/init.lua @@ -0,0 +1,43 @@ +local drop = function(pos, itemstack) + + local it = itemstack:take_item(itemstack:get_count()) + local obj = core.add_item(pos, it) + + if obj then + + obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)}) + + local remi = minetest.setting_get("remove_items") + + if remi and remi == "true" then + obj:remove() + end + + end + return itemstack +end + +minetest.register_on_dieplayer(function(player) + + if minetest.setting_getbool("creative_mode") then + return + end + + local pos = player:getpos() + pos.y = math.floor(pos.y + 0.5) + + minetest.chat_send_player(player:get_player_name(), 'at '..math.floor(pos.x)..','..math.floor(pos.y)..','..math.floor(pos.z)) + + local player_inv = player:get_inventory() + + for i=1,player_inv:get_size("main") do + drop(pos, player_inv:get_stack("main", i)) + player_inv:set_stack("main", i, nil) + end + + for i=1,player_inv:get_size("craft") do + drop(pos, player_inv:get_stack("craft", i)) + player_inv:set_stack("craft", i, nil) + end + +end) diff --git a/mods/fire/README.txt b/mods/fire/README.txt new file mode 100644 index 0000000..fdbce15 --- /dev/null +++ b/mods/fire/README.txt @@ -0,0 +1,32 @@ +Minetest 0.4 mod: fire +====================== + +License of source code: +----------------------- +Copyright (C) 2012 Perttu Ahola (celeron55) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2012 Perttu Ahola (celeron55) + +fire_small.ogg sampled from: + http://www.freesound.org/people/dobroide/sounds/4211/ + +fire_large.ogg sampled from: + http://www.freesound.org/people/Dynamicell/sounds/17548/ + +fire_basic_flame_animated.png: + Muadtralk diff --git a/mods/fire/init.lua b/mods/fire/init.lua new file mode 100644 index 0000000..20b1dd2 --- /dev/null +++ b/mods/fire/init.lua @@ -0,0 +1,189 @@ +-- minetest/fire/init.lua + +fire = {} + +minetest.register_node("fire:basic_flame", { + description = "Fire", + drawtype = "firelike", + tiles = {{ + name="fire_basic_flame_animated.png", + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}, + }}, + inventory_image = "fire_basic_flame.png", + light_source = 14, + groups = {igniter=2,dig_immediate=3}, + drop = '', + walkable = false, + buildable_to = true, + damage_per_second = 4, + + on_construct = function(pos) + minetest.after(0, fire.on_flame_add_at, pos) + end, + + on_destruct = function(pos) + minetest.after(0, fire.on_flame_remove_at, pos) + end, + + -- unaffected by explosions + on_blast = function() end, +}) + +fire.D = 6 +-- key: position hash of low corner of area +-- value: {handle=sound handle, name=sound name} +fire.sounds = {} + +function fire.get_area_p0p1(pos) + local p0 = { + x=math.floor(pos.x/fire.D)*fire.D, + y=math.floor(pos.y/fire.D)*fire.D, + z=math.floor(pos.z/fire.D)*fire.D, + } + local p1 = { + x=p0.x+fire.D-1, + y=p0.y+fire.D-1, + z=p0.z+fire.D-1 + } + return p0, p1 +end + +function fire.update_sounds_around(pos) + local p0, p1 = fire.get_area_p0p1(pos) + local cp = {x=(p0.x+p1.x)/2, y=(p0.y+p1.y)/2, z=(p0.z+p1.z)/2} + local flames_p = minetest.find_nodes_in_area(p0, p1, {"fire:basic_flame"}) + --print("number of flames at "..minetest.pos_to_string(p0).."/" + -- ..minetest.pos_to_string(p1)..": "..#flames_p) + local should_have_sound = (#flames_p > 0) + local wanted_sound = nil + if #flames_p >= 9 then + wanted_sound = {name="fire_large", gain=1.5} + elseif #flames_p > 0 then + wanted_sound = {name="fire_small", gain=1.5} + end + local p0_hash = minetest.hash_node_position(p0) + local sound = fire.sounds[p0_hash] + if not sound then + if should_have_sound then + fire.sounds[p0_hash] = { + handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 16, loop=true}), + name = wanted_sound.name, + } + end + else + if not wanted_sound then + minetest.sound_stop(sound.handle) + fire.sounds[p0_hash] = nil + elseif sound.name ~= wanted_sound.name then + minetest.sound_stop(sound.handle) + fire.sounds[p0_hash] = { + handle = minetest.sound_play(wanted_sound, {pos=cp, max_hear_distance = 16, loop=true}), + name = wanted_sound.name, + } + end + end +end + +function fire.on_flame_add_at(pos) + fire.update_sounds_around(pos) +end + +function fire.on_flame_remove_at(pos) + fire.update_sounds_around(pos) +end + +function fire.find_pos_for_flame_around(pos) + return minetest.find_node_near(pos, 1, {"air"}) +end + +function fire.flame_should_extinguish(pos) + if minetest.setting_getbool("disable_fire") then return true end + --return minetest.find_node_near(pos, 1, {"group:puts_out_fire"}) + local p0 = {x=pos.x-2, y=pos.y, z=pos.z-2} + local p1 = {x=pos.x+2, y=pos.y, z=pos.z+2} + local ps = minetest.find_nodes_in_area(p0, p1, {"group:puts_out_fire"}) + return (#ps ~= 0) +end + +-- Ignite neighboring nodes +minetest.register_abm({ + nodenames = {"group:flammable"}, + neighbors = {"group:igniter"}, + interval = 5, + chance = 2, + action = function(p0, node, _, _) + -- If there is water or stuff like that around flame, don't ignite + if fire.flame_should_extinguish(p0) then + return + end + local p = fire.find_pos_for_flame_around(p0) + if p then + minetest.set_node(p, {name="fire:basic_flame"}) + end + end, +}) + +-- Rarely ignite things from far +minetest.register_abm({ + nodenames = {"group:igniter"}, + neighbors = {"air"}, + interval = 5, + chance = 10, + action = function(p0, node, _, _) + local reg = minetest.registered_nodes[node.name] + if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then + return + end + local d = reg.groups.igniter + local p = minetest.find_node_near(p0, d, {"group:flammable"}) + if p then + -- If there is water or stuff like that around flame, don't ignite + if fire.flame_should_extinguish(p) then + return + end + local p2 = fire.find_pos_for_flame_around(p) + if p2 then + minetest.set_node(p2, {name="fire:basic_flame"}) + end + end + end, +}) + +-- Remove flammable nodes and flame +minetest.register_abm({ + nodenames = {"fire:basic_flame"}, + interval = 3, + chance = 2, + action = function(p0, node, _, _) + -- If there is water or stuff like that around flame, remove flame + if fire.flame_should_extinguish(p0) then + minetest.remove_node(p0) + return + end + -- Make the following things rarer + if math.random(1,3) == 1 then + return + end + -- If there are no flammable nodes around flame, remove flame + if not minetest.find_node_near(p0, 1, {"group:flammable"}) then + minetest.remove_node(p0) + return + end + if math.random(1,4) == 1 then + -- remove a flammable node around flame + local p = minetest.find_node_near(p0, 1, {"group:flammable"}) + if p then + -- If there is water or stuff like that around flame, don't remove + if fire.flame_should_extinguish(p0) then + return + end + minetest.remove_node(p) + nodeupdate(p) + end + else + -- remove flame + minetest.remove_node(p0) + end + end, +}) + diff --git a/mods/fire/sounds/fire_large.ogg b/mods/fire/sounds/fire_large.ogg new file mode 100644 index 0000000..fe78e62 Binary files /dev/null and b/mods/fire/sounds/fire_large.ogg differ diff --git a/mods/fire/sounds/fire_small.ogg b/mods/fire/sounds/fire_small.ogg new file mode 100644 index 0000000..5aac595 Binary files /dev/null and b/mods/fire/sounds/fire_small.ogg differ diff --git a/mods/fire/textures/fire_basic_flame.png b/mods/fire/textures/fire_basic_flame.png new file mode 100644 index 0000000..1da0702 Binary files /dev/null and b/mods/fire/textures/fire_basic_flame.png differ diff --git a/mods/fire/textures/fire_basic_flame_animated.png b/mods/fire/textures/fire_basic_flame_animated.png new file mode 100644 index 0000000..1cdd9fd Binary files /dev/null and b/mods/fire/textures/fire_basic_flame_animated.png differ diff --git a/mods/give_initial_stuff/depends.txt b/mods/give_initial_stuff/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/mods/give_initial_stuff/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/mods/give_initial_stuff/init.lua b/mods/give_initial_stuff/init.lua new file mode 100644 index 0000000..28e6442 --- /dev/null +++ b/mods/give_initial_stuff/init.lua @@ -0,0 +1,12 @@ +function give_initial_stuff(player) + if minetest.setting_getbool("give_initial_stuff") then + minetest.log("action", "Giving initial stuff to player "..player:get_player_name()) + player:get_inventory():add_item('main', 'default:pick_steel') + player:get_inventory():add_item('main', 'default:torch 99') + player:get_inventory():add_item('main', 'default:axe_steel') + player:get_inventory():add_item('main', 'default:shovel_steel') + player:get_inventory():add_item('main', 'default:cobble 99') + end +end + +minetest.register_on_newplayer(give_initial_stuff) diff --git a/mods/stairs/README.txt b/mods/stairs/README.txt new file mode 100644 index 0000000..716a677 --- /dev/null +++ b/mods/stairs/README.txt @@ -0,0 +1,26 @@ +Minetest 0.4 mod: stairs +========================= + +License of source code: +----------------------- +Copyright (C) 2011-2012 Kahrl +Copyright (C) 2011-2012 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + + diff --git a/mods/stairs/depends.txt b/mods/stairs/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/stairs/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua new file mode 100644 index 0000000..7f84b4c --- /dev/null +++ b/mods/stairs/init.lua @@ -0,0 +1,319 @@ +-- Minetest 0.4 mod: stairs +-- See README.txt for licensing and other information. + +stairs = {} + +-- Node will be called stairs:stair_ +function stairs.register_stair(subname, recipeitem, groups, images, description, sounds) + minetest.register_node(":stairs:stair_" .. subname, { + description = description, + drawtype = "mesh", + mesh = "stairs_stair.obj", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = groups, + sounds = sounds, + selection_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}, + }, + }, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local p0 = pointed_thing.under + local p1 = pointed_thing.above + local param2 = 0 + + local placer_pos = placer:getpos() + if placer_pos then + local dir = { + x = p1.x - placer_pos.x, + y = p1.y - placer_pos.y, + z = p1.z - placer_pos.z + } + param2 = minetest.dir_to_facedir(dir) + end + + if p0.y-1 == p1.y then + param2 = param2 + 20 + if param2 == 21 then + param2 = 23 + elseif param2 == 23 then + param2 = 21 + end + end + + return minetest.item_place(itemstack, placer, pointed_thing, param2) + end, + }) + + -- for replace ABM + minetest.register_node(":stairs:stair_" .. subname.."upside_down", { + replace_name = "stairs:stair_" .. subname, + groups = {slabs_replace=1}, + }) + + minetest.register_craft({ + output = 'stairs:stair_' .. subname .. ' 6', + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + -- Flipped recipe for the silly minecrafters + minetest.register_craft({ + output = 'stairs:stair_' .. subname .. ' 6', + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + +-- Node will be called stairs:slab_ +function stairs.register_slab(subname, recipeitem, groups, images, description, sounds) + minetest.register_node(":stairs:slab_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = groups, + sounds = sounds, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + -- If it's being placed on an another similar one, replace it with + -- a full block + local slabpos = nil + local slabnode = nil + local p0 = pointed_thing.under + local p1 = pointed_thing.above + local n0 = minetest.get_node(p0) + local n1 = minetest.get_node(p1) + local param2 = 0 + + local n0_is_upside_down = (n0.name == "stairs:slab_" .. subname and + n0.param2 >= 20) + + if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and p0.y+1 == p1.y then + slabpos = p0 + slabnode = n0 + elseif n1.name == "stairs:slab_" .. subname then + slabpos = p1 + slabnode = n1 + end + if slabpos then + -- Remove the slab at slabpos + minetest.remove_node(slabpos) + -- Make a fake stack of a single item and try to place it + local fakestack = ItemStack(recipeitem) + fakestack:set_count(itemstack:get_count()) + + pointed_thing.above = slabpos + local success + fakestack, success = minetest.item_place(fakestack, placer, pointed_thing) + -- If the item was taken from the fake stack, decrement original + if success then + itemstack:set_count(fakestack:get_count()) + -- Else put old node back + else + minetest.set_node(slabpos, slabnode) + end + return itemstack + end + + -- Upside down slabs + if p0.y-1 == p1.y then + -- Turn into full block if pointing at a existing slab + if n0_is_upside_down then + -- Remove the slab at the position of the slab + minetest.remove_node(p0) + -- Make a fake stack of a single item and try to place it + local fakestack = ItemStack(recipeitem) + fakestack:set_count(itemstack:get_count()) + + pointed_thing.above = p0 + local success + fakestack, success = minetest.item_place(fakestack, placer, pointed_thing) + -- If the item was taken from the fake stack, decrement original + if success then + itemstack:set_count(fakestack:get_count()) + -- Else put old node back + else + minetest.set_node(p0, n0) + end + return itemstack + end + + -- Place upside down slab + param2 = 20 + end + + -- If pointing at the side of a upside down slab + if n0_is_upside_down and p0.y+1 ~= p1.y then + param2 = 20 + end + + return minetest.item_place(itemstack, placer, pointed_thing, param2) + end, + }) + + -- for replace ABM + minetest.register_node(":stairs:slab_" .. subname.."upside_down", { + replace_name = "stairs:slab_"..subname, + groups = {slabs_replace=1}, + }) + + minetest.register_craft({ + output = 'stairs:slab_' .. subname .. ' 6', + recipe = { + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + +-- Replace old "upside_down" nodes with new param2 versions +minetest.register_abm({ + nodenames = {"group:slabs_replace"}, + interval = 1, + chance = 1, + action = function(pos, node) + node.name = minetest.registered_nodes[node.name].replace_name + node.param2 = node.param2 + 20 + if node.param2 == 21 then + node.param2 = 23 + elseif node.param2 == 23 then + node.param2 = 21 + end + minetest.set_node(pos, node) + end, +}) + +-- 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_slab(subname, recipeitem, groups, images, desc_slab, sounds) +end + +stairs.register_stair_and_slab("wood", "default:wood", + {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + {"default_wood.png"}, + "Wooden Stair", + "Wooden Slab", + default.node_sound_wood_defaults()) + +stairs.register_stair_and_slab("stone", "default:stone", + {cracky=3}, + {"default_stone.png"}, + "Stone Stair", + "Stone Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("cobble", "default:cobble", + {cracky=3}, + {"default_cobble.png"}, + "Cobblestone Stair", + "Cobblestone Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("desert_stone", "default:desert_stone", + {cracky=3}, + {"default_desert_stone.png"}, + "Desertstone Stair", + "Desertstone Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("desert_cobble", "default:desert_cobble", + {cracky=3}, + {"default_desert_cobble.png"}, + "Desert Cobblestone Stair", + "Desert Cobblestone Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("desert_stonebrick", "default:desert_stonebrick", + {cracky=3}, + {"default_desert_stone_brick.png"}, + "Desert Stone Brick Stair", + "Desert Stone Brick Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("brick", "default:brick", + {cracky=3}, + {"default_brick.png"}, + "Brick Stair", + "Brick Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("sandstone", "default:sandstone", + {crumbly=2,cracky=2}, + {"default_sandstone.png"}, + "Sandstone Stair", + "Sandstone Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("sandstonebrick", "default:sandstonebrick", + {crumbly=2,cracky=2}, + {"default_sandstone_brick.png"}, + "Sandstone Brick Stair", + "Sandstone Brick Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("junglewood", "default:junglewood", + {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + {"default_junglewood.png"}, + "Junglewood Stair", + "Junglewood Slab", + default.node_sound_wood_defaults()) + +stairs.register_stair_and_slab("stonebrick", "default:stonebrick", + {cracky=3}, + {"default_stone_brick.png"}, + "Stone Brick Stair", + "Stone Brick Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("pinewood", "default:pinewood", + {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + {"default_pinewood.png"}, + "Pinewood Stair", + "Pinewood Slab", + default.node_sound_wood_defaults()) + +stairs.register_stair_and_slab("obsidian", "default:obsidian", + {cracky=1,level=2}, + {"default_obsidian.png"}, + "Obsidian Stair", + "Obsidian Slab", + default.node_sound_stone_defaults()) + +stairs.register_stair_and_slab("obsidianbrick", "default:obsidianbrick", + {cracky=1,level=2}, + {"default_obsidian_brick.png"}, + "Obsidian Brick Stair", + "Obsidian Brick Slab", + default.node_sound_stone_defaults()) diff --git a/mods/stairs/models/stairs_stair.obj b/mods/stairs/models/stairs_stair.obj new file mode 100644 index 0000000..929c733 --- /dev/null +++ b/mods/stairs/models/stairs_stair.obj @@ -0,0 +1,43 @@ +v -.5 0 -.5 +v -.5 -.5 -.5 +v -.5 0 0 +v .5 0 0 +v .5 -.5 -.5 +v .5 0 -.5 +v -.5 -.5 .5 +v .5 -.5 .5 +v -.5 .5 0 +v .5 .5 0 +v -.5 .5 .5 +v .5 .5 .5 +vt 0 .5 +vt 0 0 +vt .5 .5 +vt 1 0 +vt 1 .5 +vt 1 1 +vt 0 1 +vt .5 1 +vt 1 0 +vt 1 1 +vt 0 1 +vt 0 0 +vn -1 0 0 +vn 1 0 0 +vn 0 0 -1 +vn 0 -1 0 +vn 0 1 0 +vn 0 0 1 +s off +f 1/1/1 2/2/1 3/3/1 +f 4/3/2 5/4/2 6/5/2 +f 2/4/3 1/5/3 6/1/3 5/2/3 +f 7/4/4 2/6/4 5/7/4 8/2/4 +f 6/2/5 1/4/5 3/5/5 4/1/5 +f 3/5/3 9/6/3 10/7/3 4/1/3 +f 11/6/5 12/7/5 10/1/5 9/5/5 +f 4/3/2 10/8/2 12/7/2 +f 8/9/6 12/10/6 11/11/6 7/12/6 +f 3/3/1 11/6/1 9/8/1 +f 2/2/1 7/4/1 11/6/1 +f 5/4/2 12/7/2 8/2/2 diff --git a/mods/tnt/README.txt b/mods/tnt/README.txt new file mode 100644 index 0000000..90a3467 --- /dev/null +++ b/mods/tnt/README.txt @@ -0,0 +1,36 @@ +=== TNT mod for Minetest === +by PilzAdam and ShadowNinja + +Introduction: +This mod adds TNT to Minetest. TNT is a tool to help the player +in mining. + +How to use the mod: +Craft gunpowder by placing coal and gravel in the crafting area. The +gunpowder can be used to craft TNT or as fuze for TNT. To craft TNT +surround gunpowder with 4 wood in a + shape. +There are different ways to blow up TNT: + 1. Hit it with a torch. + 2. Hit a gunpowder fuze that leads to a TNT block with a torch. + 3. Activate it with mesecons (fastest way) +Be aware of the damage radius of 7 blocks! + +License: +WTFPL (see below) + +See also: +http://minetest.net/ + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/mods/tnt/depends.txt b/mods/tnt/depends.txt new file mode 100644 index 0000000..5ff216f --- /dev/null +++ b/mods/tnt/depends.txt @@ -0,0 +1,3 @@ +default +fire + diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua new file mode 100644 index 0000000..8ce018b --- /dev/null +++ b/mods/tnt/init.lua @@ -0,0 +1,390 @@ + +-- Default to enabled in singleplayer and disabled in multiplayer +local singleplayer = minetest.is_singleplayer() +local setting = minetest.setting_getbool("enable_tnt") +if (not singleplayer and setting ~= true) or + (singleplayer and setting == false) then + return +end + +-- loss probabilities array (one in X will be lost) +local loss_prob = {} + +loss_prob["default:cobble"] = 3 +loss_prob["default:dirt"] = 4 + +local radius = tonumber(minetest.setting_get("tnt_radius") or 3) + +-- Fill a list with data for content IDs, after all nodes are registered +local cid_data = {} +minetest.after(0, function() + for name, def in pairs(minetest.registered_nodes) do + cid_data[minetest.get_content_id(name)] = { + name = name, + drops = def.drops, + flammable = def.groups.flammable, + on_blast = def.on_blast, + } + end +end) + +local function rand_pos(center, pos, radius) + pos.x = center.x + math.random(-radius, radius) + pos.z = center.z + math.random(-radius, radius) +end + +local function eject_drops(drops, pos, radius) + local drop_pos = vector.new(pos) + for _, item in pairs(drops) do + local count = item:get_count() + local max = item:get_stack_max() + if count > max then + item:set_count(max) + end + while count > 0 do + if count < max then + item:set_count(count) + end + rand_pos(pos, drop_pos, radius) + local obj = minetest.add_item(drop_pos, item) + if obj then + obj:get_luaentity().collect = true + obj:setacceleration({x=0, y=-10, z=0}) + obj:setvelocity({x=math.random(-3, 3), y=10, + z=math.random(-3, 3)}) + end + count = count - max + end + end +end + +local function add_drop(drops, item) + item = ItemStack(item) + local name = item:get_name() + if loss_prob[name] ~= nil and math.random(1, loss_prob[name]) == 1 then + return + end + + local drop = drops[name] + if drop == nil then + drops[name] = item + else + drop:set_count(drop:get_count() + item:get_count()) + end +end + +local fire_node = {name="fire:basic_flame"} + +local function destroy(drops, pos, cid) + if minetest.is_protected(pos, "") then + return + end + local def = cid_data[cid] + if def and def.on_blast then + def.on_blast(vector.new(pos), 1) + return + end + if def and def.flammable then + minetest.set_node(pos, fire_node) + else + minetest.remove_node(pos) + if def then + local node_drops = minetest.get_node_drops(def.name, "") + for _, item in ipairs(node_drops) do + add_drop(drops, item) + end + end + end +end + + +local function calc_velocity(pos1, pos2, old_vel, power) + local vel = vector.direction(pos1, pos2) + vel = vector.normalize(vel) + vel = vector.multiply(vel, power) + + -- Divide by distance + local dist = vector.distance(pos1, pos2) + dist = math.max(dist, 1) + vel = vector.divide(vel, dist) + + -- Add old velocity + vel = vector.add(vel, old_vel) + return vel +end + +local function entity_physics(pos, radius) + -- Make the damage radius larger than the destruction radius + radius = radius * 2 + local objs = minetest.get_objects_inside_radius(pos, radius) + for _, obj in pairs(objs) do + local obj_pos = obj:getpos() + local obj_vel = obj:getvelocity() + local dist = math.max(1, vector.distance(pos, obj_pos)) + + if obj_vel ~= nil then + obj:setvelocity(calc_velocity(pos, obj_pos, + obj_vel, radius * 10)) + end + + local damage = (4 / dist) * radius + obj:set_hp(obj:get_hp() - damage) + end +end + +local function add_effects(pos, radius) + minetest.add_particlespawner({ + amount = 128, + time = 1, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x=-20, y=-20, z=-20}, + maxvel = {x=20, y=20, z=20}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 3, + minsize = 8, + maxsize = 16, + texture = "tnt_smoke.png", + }) +end + +local function burn(pos) + local name = minetest.get_node(pos).name + if name == "tnt:tnt" then + minetest.sound_play("tnt_ignite", {pos=pos}) + minetest.set_node(pos, {name="tnt:tnt_burning"}) + minetest.get_node_timer(pos):start(1) + elseif name == "tnt:gunpowder" then + minetest.sound_play("tnt_gunpowder_burning", {pos=pos, gain=2}) + minetest.set_node(pos, {name="tnt:gunpowder_burning"}) + minetest.get_node_timer(pos):start(1) + end +end + +local function explode(pos, radius) + local pos = vector.round(pos) + local vm = VoxelManip() + local pr = PseudoRandom(os.time()) + local p1 = vector.subtract(pos, radius) + local p2 = vector.add(pos, radius) + local minp, maxp = vm:read_from_map(p1, p2) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + local drops = {} + local p = {} + + local c_air = minetest.get_content_id("air") + + for z = -radius, radius do + for y = -radius, radius do + local vi = a:index(pos.x + (-radius), pos.y + y, pos.z + z) + for x = -radius, radius do + if (x * x) + (y * y) + (z * z) <= + (radius * radius) + pr:next(-radius, radius) then + local cid = data[vi] + p.x = pos.x + x + p.y = pos.y + y + p.z = pos.z + z + if cid ~= c_air then + destroy(drops, p, cid) + end + end + vi = vi + 1 + end + end + end + + return drops +end + + +local function boom(pos) + minetest.sound_play("tnt_explode", {pos=pos, gain=1.5, max_hear_distance=2*64}) + minetest.set_node(pos, {name="tnt:boom"}) + minetest.get_node_timer(pos):start(0.5) + + local drops = explode(pos, radius) + entity_physics(pos, radius) + eject_drops(drops, pos, radius) + add_effects(pos, radius) +end + +minetest.register_node("tnt:tnt", { + description = "TNT", + tiles = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png"}, + is_ground_content = false, + groups = {dig_immediate=2, mesecon=2}, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + minetest.sound_play("tnt_ignite", {pos=pos}) + minetest.set_node(pos, {name="tnt:tnt_burning"}) + minetest.get_node_timer(pos):start(4) + end + end, + on_blast = function(pos, intensity) + burn(pos) + end, + mesecons = {effector = {action_on = boom}}, +}) + +minetest.register_node("tnt:tnt_burning", { + tiles = { + { + name = "tnt_top_burning_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + "tnt_bottom.png", "tnt_side.png"}, + light_source = 5, + drop = "", + sounds = default.node_sound_wood_defaults(), + on_timer = boom, + -- unaffected by explosions + on_blast = function() end, +}) + +minetest.register_node("tnt:boom", { + drawtype = "plantlike", + tiles = {"tnt_boom.png"}, + light_source = default.LIGHT_MAX, + walkable = false, + drop = "", + groups = {dig_immediate=3}, + on_timer = function(pos, elapsed) + minetest.remove_node(pos) + end, + -- unaffected by explosions + on_blast = function() end, +}) + +minetest.register_node("tnt:gunpowder", { + description = "Gun Powder", + drawtype = "raillike", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + walkable = false, + tiles = {"tnt_gunpowder_straight.png", "tnt_gunpowder_curved.png", "tnt_gunpowder_t_junction.png", "tnt_gunpowder_crossing.png"}, + inventory_image = "tnt_gunpowder_inventory.png", + wield_image = "tnt_gunpowder_inventory.png", + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + groups = {dig_immediate=2,attached_node=1,connect_to_raillike=minetest.raillike_group("gunpowder")}, + sounds = default.node_sound_leaves_defaults(), + + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + burn(pos) + end + end, + on_blast = function(pos, intensity) + burn(pos) + end, +}) + +minetest.register_node("tnt:gunpowder_burning", { + drawtype = "raillike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + light_source = 5, + tiles = {{ + name = "tnt_gunpowder_burning_straight_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_curved_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_t_junction_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_crossing_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }}, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + drop = "", + groups = {dig_immediate=2,attached_node=1,connect_to_raillike=minetest.raillike_group("gunpowder")}, + sounds = default.node_sound_leaves_defaults(), + on_timer = function(pos, elapsed) + for dx = -1, 1 do + for dz = -1, 1 do + for dy = -1, 1 do + if not (dx == 0 and dz == 0) then + burn({ + x = pos.x + dx, + y = pos.y + dy, + z = pos.z + dz, + }) + end + end + end + end + minetest.remove_node(pos) + end, + -- unaffected by explosions + on_blast = function() end, +}) + +minetest.register_abm({ + nodenames = {"tnt:tnt", "tnt:gunpowder"}, + neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"}, + interval = 1, + chance = 1, + action = burn, +}) + +minetest.register_craft({ + output = "tnt:gunpowder", + type = "shapeless", + recipe = {"default:coal_lump", "default:gravel"} +}) + +minetest.register_craft({ + output = "tnt:tnt", + recipe = { + {"", "group:wood", ""}, + {"group:wood", "tnt:gunpowder", "group:wood"}, + {"", "group:wood", ""} + } +}) + +if minetest.setting_get("log_mods") then + minetest.debug("[TNT] Loaded!") +end + diff --git a/mods/tnt/sounds/tnt_explode.ogg b/mods/tnt/sounds/tnt_explode.ogg new file mode 100644 index 0000000..a414ea0 Binary files /dev/null and b/mods/tnt/sounds/tnt_explode.ogg differ diff --git a/mods/tnt/sounds/tnt_gunpowder_burning.ogg b/mods/tnt/sounds/tnt_gunpowder_burning.ogg new file mode 100644 index 0000000..5c5bfaf Binary files /dev/null and b/mods/tnt/sounds/tnt_gunpowder_burning.ogg differ diff --git a/mods/tnt/sounds/tnt_ignite.ogg b/mods/tnt/sounds/tnt_ignite.ogg new file mode 100644 index 0000000..199f206 Binary files /dev/null and b/mods/tnt/sounds/tnt_ignite.ogg differ diff --git a/mods/tnt/textures/tnt_boom.png b/mods/tnt/textures/tnt_boom.png new file mode 100644 index 0000000..c848bfc Binary files /dev/null and b/mods/tnt/textures/tnt_boom.png differ diff --git a/mods/tnt/textures/tnt_bottom.png b/mods/tnt/textures/tnt_bottom.png new file mode 100644 index 0000000..95f66cb Binary files /dev/null and b/mods/tnt/textures/tnt_bottom.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png new file mode 100644 index 0000000..a901f7b Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png new file mode 100644 index 0000000..bc01806 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png new file mode 100644 index 0000000..c860ace Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png new file mode 100644 index 0000000..a556072 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_crossing.png b/mods/tnt/textures/tnt_gunpowder_crossing.png new file mode 100644 index 0000000..916c84e Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_crossing.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_curved.png b/mods/tnt/textures/tnt_gunpowder_curved.png new file mode 100644 index 0000000..cb8b4ea Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_curved.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_inventory.png b/mods/tnt/textures/tnt_gunpowder_inventory.png new file mode 100644 index 0000000..105a2d2 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_inventory.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_straight.png b/mods/tnt/textures/tnt_gunpowder_straight.png new file mode 100644 index 0000000..8ab0e3c Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_straight.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_t_junction.png b/mods/tnt/textures/tnt_gunpowder_t_junction.png new file mode 100644 index 0000000..ac997a7 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_t_junction.png differ diff --git a/mods/tnt/textures/tnt_side.png b/mods/tnt/textures/tnt_side.png new file mode 100644 index 0000000..d303473 Binary files /dev/null and b/mods/tnt/textures/tnt_side.png differ diff --git a/mods/tnt/textures/tnt_smoke.png b/mods/tnt/textures/tnt_smoke.png new file mode 100644 index 0000000..488b50f Binary files /dev/null and b/mods/tnt/textures/tnt_smoke.png differ diff --git a/mods/tnt/textures/tnt_top.png b/mods/tnt/textures/tnt_top.png new file mode 100644 index 0000000..31b807c Binary files /dev/null and b/mods/tnt/textures/tnt_top.png differ diff --git a/mods/tnt/textures/tnt_top_burning.png b/mods/tnt/textures/tnt_top_burning.png new file mode 100644 index 0000000..fc0d490 Binary files /dev/null and b/mods/tnt/textures/tnt_top_burning.png differ diff --git a/mods/tnt/textures/tnt_top_burning_animated.png b/mods/tnt/textures/tnt_top_burning_animated.png new file mode 100644 index 0000000..18a270f Binary files /dev/null and b/mods/tnt/textures/tnt_top_burning_animated.png differ