diff --git a/README.md b/README.md index cccb3cdf..9c8a269c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Extreme Survival created by maikerumine
- Minetest 0.4.14 mod: "Extreme Survival"
+ Minetest 0.4.16 mod: "Extreme Survival"
namespace: extreme_survival
- (c) 2014-2016 by: maikerumine
+ (c) 2014-2017 by: maikerumine
https://github.com/maikerumine
LGPLv2.1 (SEE BOTTOM)
======================= diff --git a/mods/a_mapgen_mods/flowlib/README.txt b/mods/a_mapgen_mods/flowlib/README.txt new file mode 100644 index 00000000..5425ce96 --- /dev/null +++ b/mods/a_mapgen_mods/flowlib/README.txt @@ -0,0 +1,7 @@ +Waterlib +================ +Simple flow functions for use in Minetest mods by Qwertymine3 + +License of source code: +----------------------- +WTFPL diff --git a/mods/a_mapgen_mods/flowlib/init.lua b/mods/a_mapgen_mods/flowlib/init.lua new file mode 100644 index 00000000..96baf99b --- /dev/null +++ b/mods/a_mapgen_mods/flowlib/init.lua @@ -0,0 +1,146 @@ +flowlib = {} + +--sum of direction vectors must match an array index +local function to_unit_vector(dir_vector) + --(sum,root) + -- (0,1), (1,1+0=1), (2,1+1=2), (3,1+2^2=5), (4,2^2+2^2=8) + local inv_roots = {[0] = 1, [1] = 1, [2] = 0.70710678118655, [4] = 0.5 + , [5] = 0.44721359549996, [8] = 0.35355339059327} + local sum = dir_vector.x*dir_vector.x + dir_vector.z*dir_vector.z + return {x=dir_vector.x*inv_roots[sum],y=dir_vector.y + ,z=dir_vector.z*inv_roots[sum]} +end + +local is_touching = function(realpos,nodepos,radius) + local boarder = 0.5 - radius + return (math.abs(realpos - nodepos) > (boarder)) +end + +flowlib.is_touching = is_touching + +local is_water = function(pos) + return (minetest.get_item_group(minetest.get_node( + {x=pos.x,y=pos.y,z=pos.z}).name + , "water") ~= 0) +end + +flowlib.is_water = is_water + +local node_is_water = function(node) + return (minetest.get_item_group(node.name, "water") ~= 0) +end + +flowlib.node_is_water = node_is_water + +local is_lava = function(pos) + return (minetest.get_item_group(minetest.get_node( + {x=pos.x,y=pos.y,z=pos.z}).name + , "lava") ~= 0) +end + +flowlib.is_lava = is_lava + +local node_is_lava = function(node) + return (minetest.get_item_group(node.name, "lava") ~= 0) +end + +flowlib.node_is_lava = node_is_lava + + +local is_liquid = function(pos) + return (minetest.get_item_group(minetest.get_node( + {x=pos.x,y=pos.y,z=pos.z}).name + , "liquid") ~= 0) +end + +flowlib.is_liquid = is_liquid + +local node_is_liquid = function(node) + return (minetest.get_item_group(node.name, "liquid") ~= 0) +end + +flowlib.node_is_liquid = node_is_liquid + +--This code is more efficient +local function quick_flow_logic(node,pos_testing,direction) + local name = node.name + if minetest.registered_nodes[name].liquidtype == "source" then + local node_testing = minetest.get_node(pos_testing) + local param2_testing = node_testing.param2 + if minetest.registered_nodes[node_testing.name].liquidtype + ~= "flowing" then + return 0 + else + return direction + end + elseif minetest.registered_nodes[name].liquidtype == "flowing" then + local node_testing = minetest.get_node(pos_testing) + local param2_testing = node_testing.param2 + if minetest.registered_nodes[node_testing.name].liquidtype + == "source" then + return -direction + elseif minetest.registered_nodes[node_testing.name].liquidtype + == "flowing" then + if param2_testing < node.param2 then + if (node.param2 - param2_testing) > 6 then + return -direction + else + return direction + end + elseif param2_testing > node.param2 then + if (param2_testing - node.param2) > 6 then + return direction + else + return -direction + end + end + end + end + return 0 +end + +local quick_flow = function(pos,node) + local x = 0 + local z = 0 + + if not node_is_liquid(node) then + return {x=0,y=0,z=0} + end + + x = x + quick_flow_logic(node,{x=pos.x-1,y=pos.y,z=pos.z},-1) + x = x + quick_flow_logic(node,{x=pos.x+1,y=pos.y,z=pos.z}, 1) + z = z + quick_flow_logic(node,{x=pos.x,y=pos.y,z=pos.z-1},-1) + z = z + quick_flow_logic(node,{x=pos.x,y=pos.y,z=pos.z+1}, 1) + + return to_unit_vector({x=x,y=0,z=z}) +end + +flowlib.quick_flow = quick_flow + + + --if not in water but touching, move centre to touching block + --x has higher precedence than z + --if pos changes with x, it affects z +local move_centre = function(pos,realpos,node,radius) + if is_touching(realpos.x,pos.x,radius) then + if is_liquid({x=pos.x-1,y=pos.y,z=pos.z}) then + node = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}) + pos = {x=pos.x-1,y=pos.y,z=pos.z} + elseif is_liquid({x=pos.x+1,y=pos.y,z=pos.z}) then + node = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}) + pos = {x=pos.x+1,y=pos.y,z=pos.z} + end + end + if is_touching(realpos.z,pos.z,radius) then + if is_liquid({x=pos.x,y=pos.y,z=pos.z-1}) then + node = minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}) + pos = {x=pos.x,y=pos.y,z=pos.z-1} + elseif is_liquid({x=pos.x,y=pos.y,z=pos.z+1}) then + node = minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}) + pos = {x=pos.x,y=pos.y,z=pos.z+1} + end + end + return pos,node +end + +flowlib.move_centre = move_centre diff --git a/mods/a_mapgen_mods/flowlib/mod.conf b/mods/a_mapgen_mods/flowlib/mod.conf new file mode 100644 index 00000000..0d982481 --- /dev/null +++ b/mods/a_mapgen_mods/flowlib/mod.conf @@ -0,0 +1 @@ +name = flowlib diff --git a/mods/a_mapgen_mods/roadvalleys/README.txt b/mods/a_mapgen_mods/roadvalleys/README.txt new file mode 100644 index 00000000..ec1828ec --- /dev/null +++ b/mods/a_mapgen_mods/roadvalleys/README.txt @@ -0,0 +1,7 @@ +roadvalleys 0.1.0 by paramat +For Minetest 0.4.13 and later +Depends default +Licenses: Source code LGPL (2.1). Media (textures) CC BY-SA 3.0 +See license.txt for license information + +Use with Minetest core mapgen 'valleys' only. diff --git a/mods/a_mapgen_mods/roadvalleys/depends.txt b/mods/a_mapgen_mods/roadvalleys/depends.txt new file mode 100644 index 00000000..331d858c --- /dev/null +++ b/mods/a_mapgen_mods/roadvalleys/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/mods/a_mapgen_mods/roadvalleys/init.lua b/mods/a_mapgen_mods/roadvalleys/init.lua new file mode 100644 index 00000000..3289e5d7 --- /dev/null +++ b/mods/a_mapgen_mods/roadvalleys/init.lua @@ -0,0 +1,373 @@ +-- Parameters + +local DEBUG = true + +-- Mapgen valleys noises + +local np_terrain_height = { + offset = -10, + scale = 50, + spread = {x = 1024, y = 1024, z = 1024}, + seed = 5202, + octaves = 6, + persist = 0.4, + lacunarity = 2.0, +} + +local np_valley_depth = { + offset = 5, + scale = 4, + spread = {x = 512, y = 512, z = 512}, + seed = -1914, + octaves = 1, + persist = 0.0, + lacunarity = 2.0, +} + +-- Mod noises + +-- 2D noise for patha + +local np_patha = { + offset = 0, + scale = 1, + spread = {x = 1024, y = 1024, z = 1024}, + seed = 11711, + octaves = 3, + persist = 0.4 +} + +-- 2D noise for pathb + +local np_pathb = { + offset = 0, + scale = 1, + spread = {x = 2048, y = 2048, z = 2048}, + seed = 8017, + octaves = 4, + persist = 0.4 +} + +-- 2D noise for pathc + +local np_pathc = { + offset = 0, + scale = 1, + spread = {x = 4096, y = 4096, z = 4096}, + seed = 300707, + octaves = 5, + persist = 0.4 +} + +-- 2D noise for pathd + +local np_pathd = { + offset = 0, + scale = 1, + spread = {x = 8192, y = 8192, z = 8192}, + seed = 80033, + octaves = 6, + persist = 0.4 +} + + +-- Do files + +dofile(minetest.get_modpath("roadvalleys") .. "/nodes.lua") + + +-- Constants + +local c_roadblack = minetest.get_content_id("roadvalleys:road_black") +local c_roadslab = minetest.get_content_id("roadvalleys:road_black_slab") +local c_roadwhite = minetest.get_content_id("roadvalleys:road_white") +local c_concrete = minetest.get_content_id("roadvalleys:concrete") + +local c_air = minetest.CONTENT_AIR +local c_ignore = minetest.CONTENT_IGNORE +local c_stone = minetest.get_content_id("default:stone") +local c_sastone = minetest.get_content_id("default:sandstone") +local c_destone = minetest.get_content_id("default:desert_stone") +local c_ice = minetest.get_content_id("default:ice") +local c_tree = minetest.get_content_id("default:tree") +local c_leaves = minetest.get_content_id("default:leaves") +local c_apple = minetest.get_content_id("default:apple") +local c_jungletree = minetest.get_content_id("default:jungletree") +local c_jungleleaves = minetest.get_content_id("default:jungleleaves") +local c_pinetree = minetest.get_content_id("default:pine_tree") +local c_pineneedles = minetest.get_content_id("default:pine_needles") +local c_snow = minetest.get_content_id("default:snow") +local c_acaciatree = minetest.get_content_id("default:acacia_tree") +local c_acacialeaves = minetest.get_content_id("default:acacia_leaves") +local c_aspentree = minetest.get_content_id("default:aspen_tree") +local c_aspenleaves = minetest.get_content_id("default:aspen_leaves") +local c_meselamp = minetest.get_content_id("default:meselamp") + + +-- Initialise noise objects to nil + +local nobj_terrain_height = nil +local nobj_valley_depth = nil +local nobj_patha = nil +local nobj_pathb = nil +local nobj_pathc = nil +local nobj_pathd = nil + + +-- Localise noise buffers + +local nbuf_terrain_height = {} +local nbuf_valley_depth = {} +local nbuf_patha = {} +local nbuf_pathb = {} +local nbuf_pathc = {} +local nbuf_pathd = {} + + +-- Localise data buffer + +local dbuf = {} + + +-- On generated function + +minetest.register_on_generated(function(minp, maxp, seed) + if minp.y > 0 or maxp.y < 0 then + return + end + + local t1 = os.clock() + + local x1 = maxp.x + local y1 = maxp.y + local z1 = maxp.z + local x0 = minp.x + local y0 = minp.y + local z0 = minp.z + + local sidelen = x1 - x0 + 1 + local emerlen = sidelen + 32 + local overlen = sidelen + 9 + local pmapdims = {x = overlen, y = overlen, z = 1} + local pmapminp = {x = x0 - 5, y = z0 - 5} + + nobj_terrain_height = nobj_terrain_height or + minetest.get_perlin_map(np_terrain_height, pmapdims) + nobj_valley_depth = nobj_valley_depth or + minetest.get_perlin_map(np_valley_depth, pmapdims) + nobj_patha = nobj_patha or minetest.get_perlin_map(np_patha, pmapdims) + nobj_pathb = nobj_pathb or minetest.get_perlin_map(np_pathb, pmapdims) + nobj_pathc = nobj_pathc or minetest.get_perlin_map(np_pathc, pmapdims) + nobj_pathd = nobj_pathd or minetest.get_perlin_map(np_pathd, pmapdims) + + local nvals_terrain_height = + nobj_terrain_height:get2dMap_flat(pmapminp, nbuf_terrain_height) + local nvals_valley_depth = + nobj_valley_depth:get2dMap_flat(pmapminp, nbuf_valley_depth) + local nvals_patha = nobj_patha:get2dMap_flat(pmapminp, nbuf_patha) + local nvals_pathb = nobj_pathb:get2dMap_flat(pmapminp, nbuf_pathb) + local nvals_pathc = nobj_pathc:get2dMap_flat(pmapminp, nbuf_pathc) + local nvals_pathd = nobj_pathd:get2dMap_flat(pmapminp, nbuf_pathd) + + local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") + local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax} + local data = vm:get_data(dbuf) + + local ni = 1 + for z = z0 - 5, z1 + 4 do + local n_xprepatha = nil + local n_xprepathb = nil + local n_xprepathc = nil + local n_xprepathd = nil + -- x0 - 5, z0 - 5 is to setup initial values of 'xprepath_', 'zprepath_' + for x = x0 - 5, x1 + 4 do + local n_patha = nvals_patha[ni] + local n_zprepatha = nvals_patha[(ni - overlen)] + local n_pathb = nvals_pathb[ni] + local n_zprepathb = nvals_pathb[(ni - overlen)] + local n_pathc = nvals_pathc[ni] + local n_zprepathc = nvals_pathc[(ni - overlen)] + local n_pathd = nvals_pathd[ni] + local n_zprepathd = nvals_pathd[(ni - overlen)] + + if x >= x0 - 4 and z >= z0 - 4 then + local n_terrain_height = nvals_terrain_height[ni] + local n_valley_depth = nvals_valley_depth[ni] + -- *** math.floor() fixes scattered bridge elements bug *** + local tlevel = math.floor(n_terrain_height + + (n_valley_depth * n_valley_depth)) + -- Add 6 to terrain level so that bridges pass over rivers + local pathy = math.min(math.max(tlevel + 6, 7), 42) + + if (n_patha >= 0 and n_xprepatha < 0) -- detect sign change of noise + or (n_patha < 0 and n_xprepatha >= 0) + or (n_patha >= 0 and n_zprepatha < 0) + or (n_patha < 0 and n_zprepatha >= 0) + + or (n_pathb >= 0 and n_xprepathb < 0) + or (n_pathb < 0 and n_xprepathb >= 0) + or (n_pathb >= 0 and n_zprepathb < 0) + or (n_pathb < 0 and n_zprepathb >= 0) + + or (n_pathc >= 0 and n_xprepathc < 0) + or (n_pathc < 0 and n_xprepathc >= 0) + or (n_pathc >= 0 and n_zprepathc < 0) + or (n_pathc < 0 and n_zprepathc >= 0) + + or (n_pathd >= 0 and n_xprepathd < 0) + or (n_pathd < 0 and n_xprepathd >= 0) + or (n_pathd >= 0 and n_zprepathd < 0) + or (n_pathd < 0 and n_zprepathd >= 0) then + -- scan disk 5 nodes above path + local tunnel = false + local excatop + + for zz = z - 4, z + 4 do + local vi = area:index(x - 4, pathy + 5, zz) + for xx = x - 4, x + 4 do + local nodid = data[vi] + if nodid == c_stone + or nodid == c_destone + or nodid == c_sastone + or nodid == c_ice then + tunnel = true + end + vi = vi + 1 + end + end + + if tunnel then + excatop = pathy + 5 + else + excatop = y1 + end + -- place path node brush + local vi = area:index(x, pathy, z) + data[vi] = c_roadwhite + + for k = -4, 4 do + local vi = area:index(x - 4, pathy, z + k) + for i = -4, 4 do + local radsq = (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2 + if radsq <= 13 then + local nodid = data[vi] + if nodid ~= c_roadwhite then + data[vi] = c_roadblack + end + elseif radsq <= 25 then + local nodid = data[vi] + if nodid ~= c_roadblack + and nodid ~= c_roadwhite then + data[vi] = c_roadslab + end + end + vi = vi + 1 + end + end + -- foundations or bridge structure + for k = -4, 4 do + local vi = area:index(x - 4, pathy - 1, z + k) + for i = -4, 4 do + local radsq = (math.abs(i)) ^ 2 + (math.abs(k)) ^ 2 + if radsq <= 25 then + local nodid = data[vi] + if nodid ~= c_roadblack + and nodid ~= c_roadwhite + and nodid ~= c_roadslab then + data[vi] = c_concrete + end + end + if radsq <= 2 then + local viu = vi - emerlen + local nodid = data[viu] + if nodid ~= c_roadblack + and nodid ~= c_roadwhite + and nodid ~= c_roadslab then + data[viu] = c_concrete + end + end + vi = vi + 1 + end + end + -- bridge columns + if math.random() <= 0.0625 then + for xx = x - 1, x + 1 do + for zz = z - 1, z + 1 do + local vi = area:index(xx, pathy - 3, zz) + for y = pathy - 3, y0 - 16, -1 do + local nodid = data[vi] + if nodid == c_stone + or nodid == c_destone + or nodid == c_sastone then + break + else + data[vi] = c_concrete + end + vi = vi - emerlen + end + end + end + end + -- excavate above path + for y = pathy + 1, excatop do + for zz = z - 4, z + 4 do + local vi = area:index(x - 4, y, zz) + for xx = x - 4, x + 4 do + local nodid = data[vi] + if tunnel and y == excatop then -- tunnel ceiling + if nodid ~= c_air + and nodid ~= c_ignore + and nodid ~= c_meselamp then + if (math.abs(zz - z) == 4 + or math.abs(xx - x) == 4) + and math.random() <= 0.2 then + data[vi] = c_meselamp + else + data[vi] = c_concrete + end + end + elseif y <= pathy + 5 then + if nodid ~= c_roadblack + and nodid ~= c_roadslab + and nodid ~= c_roadwhite then + data[vi] = c_air + end + elseif nodid == c_tree + or nodid == c_leaves + or nodid == c_apple + or nodid == c_jungletree + or nodid == c_jungleleaves + or nodid == c_pinetree + or nodid == c_pineneedles + or nodid == c_snow + or nodid == c_acaciatree + or nodid == c_acacialeaves + or nodid == c_aspentree + or nodid == c_aspenleaves then + data[vi] = c_air + end + vi = vi + 1 + end + end + end + end + end + + n_xprepatha = n_patha + n_xprepathb = n_pathb + n_xprepathc = n_pathc + n_xprepathd = n_pathd + ni = ni + 1 + end + end + + vm:set_data(data) + vm:set_lighting({day = 0, night = 0}) + vm:calc_lighting() + vm:write_to_map(data) + + local chugent = math.ceil((os.clock() - t1) * 1000) + if DEBUG then + print ("[roadvalleys] "..chugent.." ms") + end +end) diff --git a/mods/a_mapgen_mods/roadvalleys/license.txt b/mods/a_mapgen_mods/roadvalleys/license.txt new file mode 100644 index 00000000..356b756a --- /dev/null +++ b/mods/a_mapgen_mods/roadvalleys/license.txt @@ -0,0 +1,49 @@ +License of source code +---------------------- +Copyright (C) 2016-2017 paramat + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +License of media (textures) +--------------------------- +Copyright (C) 2016 paramat + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) + +You are free to: + +Share — copy and redistribute the material in any medium or format +Adapt — remix, transform, and build upon the material for any purpose, even commercially. + +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/a_mapgen_mods/roadvalleys/nodes.lua b/mods/a_mapgen_mods/roadvalleys/nodes.lua new file mode 100644 index 00000000..cfa59da5 --- /dev/null +++ b/mods/a_mapgen_mods/roadvalleys/nodes.lua @@ -0,0 +1,43 @@ +minetest.register_node("roadvalleys:road_black", { + description = "Road Black", + tiles = {"roadvalleys_road_black.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("roadvalleys:road_black_slab", { + description = "Road Black Slab", + tiles = {"roadvalleys_road_black.png"}, + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + node_box = { + type = "fixed", + fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}}, + }, + selection_box = { + type = "fixed", + fixed = {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}}, + }, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("roadvalleys:road_white", { + description = "Road White", + tiles = {"roadvalleys_road_white.png"}, + paramtype = "light", + --light_source = 12, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("roadvalleys:concrete", { + description = "Concrete", + tiles = {"roadvalleys_concrete.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) diff --git a/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_concrete.png b/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_concrete.png new file mode 100644 index 00000000..9c91051a Binary files /dev/null and b/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_concrete.png differ diff --git a/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_road_black.png b/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_road_black.png new file mode 100644 index 00000000..49314b51 Binary files /dev/null and b/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_road_black.png differ diff --git a/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_road_white.png b/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_road_white.png new file mode 100644 index 00000000..1286de84 Binary files /dev/null and b/mods/a_mapgen_mods/roadvalleys/textures/roadvalleys_road_white.png differ diff --git a/mods/a_mapgen_mods/tsm_railcorridors/README.md b/mods/a_mapgen_mods/tsm_railcorridors/README.md new file mode 100644 index 00000000..8af1d886 --- /dev/null +++ b/mods/a_mapgen_mods/tsm_railcorridors/README.md @@ -0,0 +1,17 @@ +# Railway corridors [`tsm_railcorridors`] +MineClone 2 adaption. NO TREASURER SUPPORT! + +* Current version 0.11.0 + +Minetest mod for adding underground corridors with rails and wood constructions with +a few treasure chests now and then. Optional Treasurer support is available for adding +treasures from various mods. + +Use the advanced settings to finetune the railway corridors. + +* Forum thread: https://forum.minetest.net/viewtopic.php?t=10339 +* License: MIT License. + +## Info for modders +Want to include this mod in a subgame, but you hate the dependencies? +You can edit the node names in gameconfig.lua to fit your needs. :-) diff --git a/mods/a_mapgen_mods/tsm_railcorridors/depends.txt b/mods/a_mapgen_mods/tsm_railcorridors/depends.txt new file mode 100644 index 00000000..a29e39b8 --- /dev/null +++ b/mods/a_mapgen_mods/tsm_railcorridors/depends.txt @@ -0,0 +1,3 @@ +default +tnt +farming diff --git a/mods/a_mapgen_mods/tsm_railcorridors/description.txt b/mods/a_mapgen_mods/tsm_railcorridors/description.txt new file mode 100644 index 00000000..33bfd506 --- /dev/null +++ b/mods/a_mapgen_mods/tsm_railcorridors/description.txt @@ -0,0 +1 @@ +Adds simple underground mines with railways and occasional treasure chests. diff --git a/mods/a_mapgen_mods/tsm_railcorridors/gameconfig.lua b/mods/a_mapgen_mods/tsm_railcorridors/gameconfig.lua new file mode 100644 index 00000000..060970a5 --- /dev/null +++ b/mods/a_mapgen_mods/tsm_railcorridors/gameconfig.lua @@ -0,0 +1,98 @@ +-- This file stores the various node types. This makes it easier to plug this mod into subgames +-- in which you need to change the node names. + +-- Adapted for MineClone 2! + +-- Node names (Don't use aliases!) +tsm_railcorridors.nodes = { + dirt = "default:dirt", + chest = "default:chest", + rail = "carts:rail", + torch_floor = "default:torch", + torch_wall = "default:torch_wall", + + --[[ Wood types for the corridors. Corridors are made out of full wood blocks + and posts. For each corridor system, a random wood type is chosen with the chance + specified in per mille. ]] + corridor_woods = { + { wood = "default:wood", post = "default:fence_wood", chance = 900}, + { wood = "default:junglewood", post = "default:fence_junglewood", chance = 100}, + }, +} + +-- Fallback function. Returns a random treasure. This function is called for chests +-- only if the Treasurer mod is not found. +-- pr: A PseudoRandom object +function tsm_railcorridors.get_default_treasure(pr) + -- UNUSED IN MINECLONE 2! +end + +-- MineClone 2's treasure function. Gets all treasures for a single chest. +-- Based on information from Minecraft Wiki. +function tsm_railcorridors.get_treasures(pr) + local items = {} + -- First roll + local r1 = pr:next(1,71) + if r1 <= 30 then + table.insert(items, "mobs:nametag") + elseif r1 <= 50 then + table.insert(items, "farming:carrot_gold") + elseif r1 <= 60 then + -- TODO: Enchanted Book + table.insert(items, "default:book") + elseif r1 <= 65 then + -- Nothing! + elseif r1 <= 70 then + table.insert(items, "default:pick_steel") + else + -- TODO: Enchanted Golden Apple + table.insert(items, "farming:carrot_gold") + end + + -- Second roll + local r2stacks = pr:next(2,4) + for i=1, r2stacks do + local r2 = pr:next(1,83) + if r2 <= 15 then + table.insert(items, "farming:bread "..pr:next(1,3)) + elseif r2 <= 25 then + table.insert(items, "default:coal_lump "..pr:next(3,8)) + elseif r2 <= 35 then + table.insert(items, "farming:tomato "..pr:next(2,4)) + elseif r2 <= 45 then + table.insert(items, "farming:melon_slice "..pr:next(2,4)) + elseif r2 <= 55 then + table.insert(items, "farming:carrot "..pr:next(2,4)) + elseif r2 <= 65 then + table.insert(items, "default:steel_ingot "..pr:next(1,5)) + elseif r2 <= 70 then + table.insert(items, "dye:blue "..pr:next(4,9)) + elseif r2 <= 75 then + table.insert(items, "default:mese_crystal_fragment "..pr:next(4,9)) + elseif r2 <= 80 then + table.insert(items, "default:gold_ingot "..pr:next(1,3)) + else + table.insert(items, "default:diamond "..pr:next(1,2)) + end + end + + -- Third roll + for i=1, 3 do + local r3 = pr:next(1,50) + if r3 <= 20 then + table.insert(items, "carts:rail "..pr:next(4,8)) + elseif r3 <= 35 then + table.insert(items, "default:torch "..pr:next(1,16)) + elseif r3 <= 40 then + -- TODO: Activator Rail + table.insert(items, "carts:rail "..pr:next(1,4)) + elseif r3 <= 45 then + -- TODO: Detector Rail + table.insert(items, "carts:rail "..pr:next(1,4)) + else + table.insert(items, "carts:powerrail "..pr:next(1,4)) + end + end + + return items +end diff --git a/mods/a_mapgen_mods/tsm_railcorridors/init.lua b/mods/a_mapgen_mods/tsm_railcorridors/init.lua new file mode 100644 index 00000000..a45e0303 --- /dev/null +++ b/mods/a_mapgen_mods/tsm_railcorridors/init.lua @@ -0,0 +1,580 @@ +tsm_railcorridors = {} + +-- Load node names +dofile(minetest.get_modpath(minetest.get_current_modname()).."/gameconfig.lua") + +-- Settings +local setting + +-- Probability function +-- TODO: Check if this is correct +local P = function (float) + return math.floor(32767 * float) +end + +-- Wahrscheinlichkeit für jeden Chunk, solche Gänge mit Schienen zu bekommen +-- Probability for every newly generated chunk to get corridors +local probability_railcaves_in_chunk = P(0.3) +setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_railcaves_in_chunk")) +if setting then + probability_railcaves_in_chunk = P(setting) +end + +-- Innerhalb welcher Parameter soll sich die Pfadlänge bewegen? (Forks heben den Maximalwert auf) +-- Minimal and maximal value of path length (forks don't look up this value) +local way_min = 4; +local way_max = 7; +setting = tonumber(minetest.setting_get("tsm_railcorridors_way_min")) +if setting then + way_min = setting +end +setting = tonumber(minetest.setting_get("tsm_railcorridors_way_max")) +if setting then + way_max = setting +end + +-- Wahrsch. für jeden geraden Teil eines Korridors, Fackeln zu bekommen +-- Probability for every horizontal part of a corridor to be with torches +local probability_torches_in_segment = P(0.5) +setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_torches_in_segment")) +if setting then + probability_torches_in_segment = P(setting) +end + +-- Wahrsch. für jeden Teil eines Korridors, nach oben oder nach unten zu gehen +-- Probability for every part of a corridor to go up or down +local probability_up_or_down = P(0.2) +setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_up_or_down")) +if setting then + probability_up_or_down = P(setting) +end + +-- Wahrscheinlichkeit für jeden Teil eines Korridors, sich zu verzweigen – vorsicht, wenn fast jeder Gang sich verzweigt, kann der Algorithums unlösbar werden und MT hängt sich auf +-- Probability for every part of a corridor to fork – caution, too high values may cause MT to hang on. +local probability_fork = P(0.04) +setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_fork")) +if setting then + probability_fork = P(setting) +end + +-- Wahrscheinlichkeit für jeden geraden Teil eines Korridors eine Kiste zu enthalten +-- Probability for every part of a corridor to contain a chest +local probability_chest = P(0.05) +setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_chest")) +if setting then + probability_chest = P(setting) +end + +-- Probability for a rail corridor system to be damaged +local probability_damage = P(0.90) +setting = tonumber(minetest.setting_get("tsm_railcorridors_probability_damage")) +if setting then + probability_damage = P(setting) +end + +-- Max. and min. heights between rail corridors are generated +--local height_min = mcl_vars.mg_bedrock_overworld_max + 5 -- FIXME: Above lava layers +local height_min = -958 +--local height_max = mcl_util.layer_to_y(60) +local height_max = -23 + +-- Chaos Mode: If enabled, rail corridors don't stop generating when hitting obstacles +local chaos_mode = minetest.setting_getbool("tsm_railcorridors_chaos") or false + +-- Parameter Ende + +-- random generator +local pr +local pr_initialized = false + +local function InitRandomizer(seed) + pr = PseudoRandom(seed) + pr_initialized = true +end + + +-- Checks if the mapgen is allowed to carve through this structure and only sets +-- the node if it is allowed. Does never build in liquids. +-- If check_above is true, don't build if the node above is attached (e.g. rail) +-- or a liquid. +local function SetNodeIfCanBuild(pos, node, check_above) + if check_above then + local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name + local abovedef = minetest.registered_nodes[abovename] + if abovename == "unknown" or abovename == "ignore" or (abovedef.groups and abovedef.groups.attached_node) or abovedef.liquidtype ~= "none" then + return false + end + end + local name = minetest.get_node(pos).name + local def = minetest.registered_nodes[name] + if name ~= "unknown" and name ~= "ignore" and def.is_ground_content and def.liquidtype == "none" then + minetest.set_node(pos, node) + return true + else + return false + end +end + +-- Tries to place a rail, taking the damage chance into account +local function PlaceRail(pos, damage_chance) + if damage_chance ~= nil and damage_chance > 0 then + local x = pr:next(0,100) + if x <= damage_chance then + return false + end + end + return SetNodeIfCanBuild(pos, {name=tsm_railcorridors.nodes.rail}) +end + +-- Returns true if the node as point can be considered “ground”, that is, a solid material +-- in which mine shafts can be built into, e.g. stone, but not air or water +local function IsGround(pos) + local nodename = minetest.get_node(pos).name + local nodedef = minetest.registered_nodes[nodename] + return nodename ~= "unknown" and nodename ~= "ignore" and nodedef.is_ground_content and nodedef.walkable and nodedef.liquidtype == "none" +end + +-- Returns true if rails are allowed to be placed on top of this node +local function IsRailSurface(pos) + local nodename = minetest.get_node(pos).name + local nodedef = minetest.registered_nodes[nodename] + return nodename ~= "unknown" and nodename ~= "ignore" and nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") +end + +-- Checks if the node is empty space which requires to be filled by a platform +local function NeedsPlatform(pos) + local node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + local node2 = minetest.get_node({x=pos.x,y=pos.y-2,z=pos.z}) + local nodedef = minetest.registered_nodes[node.name] + return node.name ~= "ignore" and node.name ~= "unknown" and nodedef.is_ground_content and ((nodedef.walkable == false and node2.name ~= tsm_railcorridors.nodes.dirt) or (nodedef.groups and nodedef.groups.falling_node)) +end + +-- Create a cube filled with the specified nodes +-- Specialties: +-- * Avoids floating rails for non-solid nodes like air +-- Returns true if all nodes could be set +-- Returns false if setting one or more nodes failed +local function Cube(p, radius, node) + local y_top = p.y+radius + local nodedef = minetest.registered_nodes[node.name] + local solid = nodedef.walkable and (nodedef.node_box == nil or nodedef.node_box.type == "regular") and nodedef.liquidtype == "none" + -- Check if all the nodes could be set + local built_all = true + for zi = p.z-radius, p.z+radius do + for yi = y_top, p.y-radius, -1 do + for xi = p.x-radius, p.x+radius do + local ok = false + if not solid and yi == y_top then + local topdef = minetest.registered_nodes[minetest.get_node({x=xi,y=yi+1,z=zi}).name] + if not (topdef.groups and topdef.groups.attached_node) and topdef.liquidtype == "none" then + ok = true + end + else + ok = true + end + local built = false + if ok then + built = SetNodeIfCanBuild({x=xi,y=yi,z=zi}, node) + end + if not built then + built_all = false + end + end + end + end + return built_all +end + +local function Platform(p, radius, node) + for zi = p.z-radius, p.z+radius do + for xi = p.x-radius, p.x+radius do + local np = NeedsPlatform({x=xi,y=p.y,z=zi}) + if np then + minetest.set_node({x=xi,y=p.y-1,z=zi}, node) + end + end + end +end + + +-- Random chest items +-- Zufälliger Kisteninhalt + +-- chests +local function Place_Chest(pos, param2) + if SetNodeIfCanBuild(pos, {name=tsm_railcorridors.nodes.chest, param2=param2}) then + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local items = tsm_railcorridors.get_treasures(pr) + for i=1, math.min(#items, inv:get_size("main")) do + inv:set_stack("main", i, ItemStack(items[i])) + end + end +end + +local function WoodBulk(pos, wood) + SetNodeIfCanBuild({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=wood}) + SetNodeIfCanBuild({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=wood}) + SetNodeIfCanBuild({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=wood}) + SetNodeIfCanBuild({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=wood}) +end + +-- Gänge mit Schienen +-- Corridors with rails + +-- Returns , +-- success: true if corridor could be placed entirely +-- segments: Number of segments successfully placed +local function corridor_part(start_point, segment_vector, segment_count, wood, post, is_final) + local p = {x=start_point.x, y=start_point.y, z=start_point.z} + local torches = pr:next() < probability_torches_in_segment + local dir = {0, 0} + local torchdir = {1, 1} + local node_wood = {name=wood} + local node_fence = {name=post} + if segment_vector.x == 0 and segment_vector.z ~= 0 then + dir = {1, 0} + torchdir = {5, 4} + elseif segment_vector.x ~= 0 and segment_vector.z == 0 then + dir = {0, 1} + torchdir = {3, 2} + end + for segmentindex = 0, segment_count-1 do + local dug = Cube(p, 1, {name="air"}) + if not chaos_mode and segmentindex > 0 and not dug then return false, segmentindex end + -- Add wooden platform, if neccessary. To avoid floating rails + if segment_vector.y == 0 then + Platform({x=p.x, y=p.y-1, z=p.z}, 1, node_wood) + end + -- Diese komischen Holz-Konstruktionen + -- These strange wood structs + if segmentindex % 2 == 1 and segment_vector.y == 0 then + local calc = { + p.x+dir[1], p.z+dir[2], -- X and Z, added by direction + p.x-dir[1], p.z-dir[2], -- subtracted + p.x+dir[2], p.z+dir[1], -- orthogonal + p.x-dir[2], p.z-dir[1], -- orthogonal, the other way + } + --[[ Shape: + WWW + P.P + PrP + pfp + W = wood + P = post (above floor level) + p = post (in floor level, only placed if no floor) + + From previous generation (for reference): + f = floor + r = rail + . = air + ]] + + -- Don't place those wood structs below open air + if not (minetest.get_node({x=calc[1], y=p.y+2, z=calc[2]}).name == "air" and + minetest.get_node({x=calc[3], y=p.y+2, z=calc[4]}).name == "air" and + minetest.get_node({x=p.x, y=p.y+2, z=p.z}).name == "air") then + + -- Left post and planks + local left_ok = true + left_ok = SetNodeIfCanBuild({x=calc[1], y=p.y-1, z=calc[2]}, node_fence) + if left_ok then left_ok = SetNodeIfCanBuild({x=calc[1], y=p.y , z=calc[2]}, node_fence) end + if left_ok then left_ok = SetNodeIfCanBuild({x=calc[1], y=p.y+1, z=calc[2]}, node_wood) end + + -- Right post and planks + local right_ok = true + right_ok = SetNodeIfCanBuild({x=calc[3], y=p.y-1, z=calc[4]}, node_fence) + if right_ok then right_ok = SetNodeIfCanBuild({x=calc[3], y=p.y , z=calc[4]}, node_fence) end + if right_ok then right_ok = SetNodeIfCanBuild({x=calc[3], y=p.y+1, z=calc[4]}, node_wood) end + + -- Middle planks + local top_planks_ok = false + if left_ok and right_ok then top_planks_ok = SetNodeIfCanBuild({x=p.x, y=p.y+1, z=p.z}, node_wood) end + + if minetest.get_node({x=p.x,y=p.y-2,z=p.z}).name=="air" then + if left_ok then SetNodeIfCanBuild({x=calc[1], y=p.y-2, z=calc[2]}, node_fence) end + if right_ok then SetNodeIfCanBuild({x=calc[3], y=p.y-2, z=calc[4]}, node_fence) end + end + -- Torches on the middle planks + if torches and top_planks_ok then + -- Place torches at horizontal sides + SetNodeIfCanBuild({x=calc[5], y=p.y+1, z=calc[6]}, {name=tsm_railcorridors.nodes.torch_wall, param2=torchdir[1]}, true) + SetNodeIfCanBuild({x=calc[7], y=p.y+1, z=calc[8]}, {name=tsm_railcorridors.nodes.torch_wall, param2=torchdir[2]}, true) + end + elseif torches then + -- Try to build torches instead of the wood structs + local node = {name=tsm_railcorridors.nodes.torch_floor, param2=minetest.dir_to_wallmounted({x=0,y=-1,z=0})} + + -- Try two different height levels + local pos1 = {x=calc[1], y=p.y-2, z=calc[2]} + local pos2 = {x=calc[3], y=p.y-2, z=calc[4]} + local nodedef1 = minetest.registered_nodes[minetest.get_node(pos1).name] + local nodedef2 = minetest.registered_nodes[minetest.get_node(pos2).name] + + if nodedef1.walkable then + pos1.y = pos1.y + 1 + end + SetNodeIfCanBuild(pos1, node, true) + + if nodedef2.walkable then + pos2.y = pos2.y + 1 + end + SetNodeIfCanBuild(pos2, node, true) + + end + end + + -- nächster Punkt durch Vektoraddition + -- next way point + p = vector.add(p, segment_vector) + end + + -- End of the corridor; create the final piece + if is_final then + local dug = Cube(p, 1, {name="air"}) + if not chaos_mode and not dug then return false, segment_count end + Platform({x=p.x, y=p.y-1, z=p.z}, 1, node_wood) + end + return true, segment_count +end + +local function corridor_func(waypoint, coord, sign, up_or_down, up, wood, post, is_final, up_or_down_next, damage) + local segamount = 3 + if up_or_down then + segamount = 1 + end + if sign then + segamount = 0-segamount + end + local vek = {x=0,y=0,z=0}; + local start = table.copy(waypoint) + if coord == "x" then + vek.x=segamount + if up_or_down and up == false then + start.x=start.x+segamount + end + elseif coord == "z" then + vek.z=segamount + if up_or_down and up == false then + start.z=start.z+segamount + end + end + if up_or_down then + if up then + vek.y = 1 + else + vek.y = -1 + end + end + local segcount = pr:next(4,6) + if up_or_down and up == false then + Cube(waypoint, 1, {name="air"}) + end + local corridor_dug, corridor_segments_dug = corridor_part(start, vek, segcount, wood, post, is_final) + local corridor_vek = {x=vek.x*segcount, y=vek.y*segcount, z=vek.z*segcount} + + -- nachträglich Schienen legen + -- after this: rails + segamount = 1 + if sign then + segamount = 0-segamount + end + if coord == "x" then + vek.x=segamount + elseif coord == "z" then + vek.z=segamount + end + if up_or_down then + if up then + vek.y = 1 + else + vek.y = -1 + end + end + local chestplace = -1 + if corridor_dug and not up_or_down and pr:next() < probability_chest then + chestplace = pr:next(1,segcount+1) + end + local railsegcount + if not chaos_mode and not corridor_dug then + railsegcount = corridor_segments_dug * 3 + elseif not up_or_down then + railsegcount = segcount * 3 + else + railsegcount = segcount + end + for i=1,railsegcount do + local p = {x=waypoint.x+vek.x*i, y=waypoint.y+vek.y*i-1, z=waypoint.z+vek.z*i} + if (minetest.get_node({x=p.x,y=p.y-1,z=p.z}).name=="air" and minetest.get_node({x=p.x,y=p.y-3,z=p.z}).name~=tsm_railcorridors.nodes.rail) then + p.y = p.y - 1; + if i == chestplace then + chestplace = chestplace + 1 + end + end + if IsRailSurface({x=p.x,y=p.y-1,z=p.z}) then + PlaceRail(p, damage) + end + if i == chestplace then + if minetest.get_node({x=p.x+vek.z,y=p.y-1,z=p.z-vek.x}).name == post then + chestplace = chestplace + 1 + else + Place_Chest({x=p.x+vek.z,y=p.y,z=p.z-vek.x}, minetest.dir_to_facedir(vek)) + end + end + end + + local offset = table.copy(corridor_vek) + local final_point = vector.add(waypoint, offset) + if up_or_down then + if up then + offset.y = offset.y - 1 + final_point = vector.add(waypoint, offset) + else + offset[coord] = offset[coord] + segamount + final_point = vector.add(waypoint, offset) + if IsRailSurface({x=final_point.x,y=final_point.y-2,z=final_point.z}) then + PlaceRail({x=final_point.x,y=final_point.y-1,z=final_point.z}, damage) + end + end + end + if not corridor_dug then + return false + else + return final_point + end +end + +local function start_corridor(waypoint, coord, sign, length, psra, wood, post, damage) + local wp = waypoint + local c = coord + local s = sign + local ud = false -- up or down + local udn = false -- up or down is next + local up + for i=1,length do + local needs_platform + -- Up or down? + if udn then + needs_platform = NeedsPlatform(wp) + if needs_platform then + ud = false + end + ud = true + -- Force direction near the height limits + if wp.y >= height_max - 12 then + up = false + elseif wp.y <= height_min + 12 then + up = true + else + -- Chose random direction in between + up = pr:next(0, 2) < 1 + end + else + ud = false + end + -- Update up/down next + if pr:next() < probability_up_or_down and i~=1 and not udn and not needs_platform then + udn = i < length + elseif udn and not needs_platform then + udn = false + end + -- Make corridor / Korridor graben + wp = corridor_func(wp,c,s, ud, up, wood, post, i == length, udn, damage) + if wp == false then return end + -- Verzweigung? + -- Fork? + if pr:next() < probability_fork then + local p = {x=wp.x, y=wp.y, z=wp.z} + start_corridor(wp, c, s, pr:next(way_min,way_max), psra, wood, post, damage) + if c == "x" then c="z" else c="x" end + start_corridor(wp, c, s, pr:next(way_min,way_max), psra, wood, post, damage) + start_corridor(wp, c, not s, pr:next(way_min,way_max), psra, wood, post, damage) + WoodBulk({x=p.x, y=p.y-1, z=p.z}, wood) + WoodBulk({x=p.x, y=p.y, z=p.z}, wood) + WoodBulk({x=p.x, y=p.y+1, z=p.z}, wood) + WoodBulk({x=p.x, y=p.y+2, z=p.z}, wood) + return + end + -- coord und sign verändern + -- randomly change sign and coord + if c=="x" then + c="z" + elseif c=="z" then + c="x" + end; + s = pr:next(0, 2) < 1 + end +end + +local function place_corridors(main_cave_coords, psra) + --[[ ALWAYS start building in the ground. Prevents corridors starting + in mid-air or in liquids. ]] + if not IsGround(main_cave_coords) then + return + end + + -- Determine if this corridor system is “damaged” (some rails removed) and to which extent + local damage = 0 + if pr:next() < probability_damage then + damage = pr:next(10, 50) + end + --[[ Starter cube: A big hollow dirt cube from which the corridors will extend. + Corridor generation starts here. ]] + if pr:next(0, 100) < 50 then + Cube(main_cave_coords, 4, {name=tsm_railcorridors.nodes.dirt}) + Cube(main_cave_coords, 3, {name="air"}) + PlaceRail({x=main_cave_coords.x, y=main_cave_coords.y-3, z=main_cave_coords.z}, damage) + main_cave_coords.y =main_cave_coords.y - 1 + else + Cube(main_cave_coords, 3, {name=tsm_railcorridors.nodes.dirt}) + Cube(main_cave_coords, 2, {name="air"}) + PlaceRail({x=main_cave_coords.x, y=main_cave_coords.y-2, z=main_cave_coords.z}, damage) + end + local xs = pr:next(0, 2) < 1 + local zs = pr:next(0, 2) < 1; + + -- Select random wood type (found in gameconfig.lua) + local rnd = pr:next(1,1000) + + local woodtype = 1 + local accumulated_chance = 0 + for w=1, #tsm_railcorridors.nodes.corridor_woods do + local woodtable = tsm_railcorridors.nodes.corridor_woods[w] + accumulated_chance = accumulated_chance + woodtable.chance + if accumulated_chance > 1000 then + minetest.log("warning", "[tsm_railcorridors] Warning: Wood chances add up to over 100%!") + break + end + if rnd <= accumulated_chance then + woodtype = w + break + end + end + local wood = tsm_railcorridors.nodes.corridor_woods[woodtype].wood + local post = tsm_railcorridors.nodes.corridor_woods[woodtype].post + start_corridor(main_cave_coords, "x", xs, pr:next(way_min,way_max), psra, wood, post, damage) + start_corridor(main_cave_coords, "z", zs, pr:next(way_min,way_max), psra, wood, post, damage) + -- Auch mal die andere Richtung? + -- Try the other direction? + if pr:next(0, 100) < 70 then + start_corridor(main_cave_coords, "x", not xs, pr:next(way_min,way_max), psra, wood, post, damage) + end + if pr:next(0, 100) < 70 then + start_corridor(main_cave_coords, "z", not zs, pr:next(way_min,way_max), psra, wood, post, damage) + end +end + +minetest.register_on_generated(function(minp, maxp, blockseed) + InitRandomizer(blockseed) + if minp.y < height_max and maxp.y > height_min and pr:next() < probability_railcaves_in_chunk then + -- Get semi-random height in chunk + + local buffer = 5 + local y = pr:next(minp.y + buffer, maxp.y - buffer) + y = math.floor(math.max(height_min, math.min(height_max, y))) + local p = {x=minp.x+(maxp.x-minp.x)/2, y=y, z=minp.z+(maxp.z-minp.z)/2} + -- Haupthöhle und alle weiteren + -- Corridors; starting with main cave out of dirt + place_corridors(p, pr) + end +end) diff --git a/mods/a_mapgen_mods/tsm_railcorridors/mod.conf b/mods/a_mapgen_mods/tsm_railcorridors/mod.conf new file mode 100644 index 00000000..db3b9740 --- /dev/null +++ b/mods/a_mapgen_mods/tsm_railcorridors/mod.conf @@ -0,0 +1 @@ +name = tsm_railcorridors diff --git a/mods/a_mapgen_mods/tsm_railcorridors/settingtypes.txt b/mods/a_mapgen_mods/tsm_railcorridors/settingtypes.txt new file mode 100644 index 00000000..c6668fa7 --- /dev/null +++ b/mods/a_mapgen_mods/tsm_railcorridors/settingtypes.txt @@ -0,0 +1,30 @@ +#Probability (0.0 to 1.0) for every newly generated chunk to get rail corridors. +tsm_railcorridors_probability_railcaves_in_chunk (Rail corridor probability) float 0.3 0.0 1.0 + +#Minimum rail corridor path length (excludes forks). +tsm_railcorridors_way_min (Minimum rail corridor length) int 4 1 + +#Maximum rail corridor path length (excludes forks). +tsm_railcorridors_way_max (Maximum rail corridor length) int 7 1 + +#Probability (0.0 to 1.0) for every horizontal part of a rail corridor to have torches. +tsm_railcorridors_probability_torches_in_segment (Torch probability) float 0.5 0.0 1.0 + +#Probability (0.0 to 1.0) for every part of a rail corridor to go up or down. +tsm_railcorridors_probability_up_or_down (Stairway probability) float 0.2 0.0 1.0 + +#Probability (0.0 to 1.0) for every part of a rail corridor to fork. +#Caution! Too high values may cause Minetest to hang. +tsm_railcorridors_probability_fork (Fork probability) float 0.04 0.0 1.0 + +#Probability (0.0 to 1.0) for every part of a rail corridor to contain a treasure chest. +tsm_railcorridors_probability_chest (Chest probability) float 0.05 0.0 1.0 + +#Probability (0.0 to 1.0) for a rail corridor system to have damaged/incomplete railways +tsm_railcorridors_probability_damage (Damaged railway probability) float 0.90 0.0 1.0 + +#If enabled, rail corridors continue to generate through obstacles such +#as other rail corridors (without destroying them, mostly). This may lead +#to pretty chaotic rail corridors, but they are also more free to spread. +#If disabled, rail corridors spread in a orderly fashion. +tsm_railcorridors_chaos (Chaos Mode) bool false diff --git a/mods/beds/README.txt b/mods/beds/README.txt index 9710c459..cda6ebd9 100644 --- a/mods/beds/README.txt +++ b/mods/beds/README.txt @@ -1,30 +1,26 @@ Minetest Game mod: beds ======================= -by BlockMen (c) 2014-2015 +See license.txt for license information. -Version: 1.1.1 +Authors of source code +---------------------- +Originally by BlockMen (MIT) +Various Minetest developers and contributors (MIT) -About -~~~~~ -This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing -in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other -players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced -if more than 50% of the players are lying in bed and use this option. +Authors of media (textures) +--------------------------- +BlockMen (CC BY-SA 3.0) -Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point -is set to the beds location and you will respawn there after death. -You can disable the respawn at beds by setting "enable_bed_respawn = false" in minetest.conf -You can also disable the night skip feature by setting "enable_bed_night_skip = false" in minetest.conf or by using -the /set command ingame. +This mod adds a bed to Minetest which allows to skip the night. +To sleep, rightclick the bed. If playing in singleplayer mode the night gets skipped +immediately. If playing multiplayer you get shown how many other players are in bed too, +if all players are sleeping the night gets skipped. The night skip can be forced if more +than 50% of the players are lying in bed and use this option. - -License of source code, textures: WTFPL ---------------------------------------- -(c) Copyright BlockMen (2014-2015) - - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Another feature is a controlled respawning. If you have slept in bed (not just lying in +it) your respawn point is set to the beds location and you will respawn there after +death. +You can disable the respawn at beds by setting "enable_bed_respawn = false" in +minetest.conf. +You can disable the night skip feature by setting "enable_bed_night_skip = false" in +minetest.conf or by using the /set command in-game. diff --git a/mods/beds/api.lua b/mods/beds/api.lua index 53d4e488..97dde43d 100644 --- a/mods/beds/api.lua +++ b/mods/beds/api.lua @@ -16,7 +16,7 @@ local function destruct_bed(pos, n) if reverse then reverse = not reverse minetest.remove_node(other) - nodeupdate(other) + minetest.check_for_falling(other) else reverse = not reverse end @@ -33,8 +33,8 @@ function beds.register_bed(name, def) paramtype2 = "facedir", is_ground_content = false, stack_max = 1, - groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1}, - sounds = default.node_sound_wood_defaults(), + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1}, + sounds = def.sounds or default.node_sound_wood_defaults(), node_box = { type = "fixed", fixed = def.nodebox.bottom, @@ -46,6 +46,14 @@ function beds.register_bed(name, def) on_place = function(itemstack, placer, pointed_thing) local under = pointed_thing.under + local node = minetest.get_node(under) + local udef = minetest.registered_nodes[node.name] + if udef and udef.on_rightclick and + not (placer and placer:get_player_control().sneak) then + return udef.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + local pos if minetest.registered_items[minetest.get_node(under).name].buildable_to then pos = under @@ -59,8 +67,8 @@ function beds.register_bed(name, def) return itemstack end - local def = minetest.registered_nodes[minetest.get_node(pos).name] - if not def or not def.buildable_to then + local node_def = minetest.registered_nodes[minetest.get_node(pos).name] + if not node_def or not node_def.buildable_to then return itemstack end @@ -81,7 +89,8 @@ function beds.register_bed(name, def) minetest.set_node(pos, {name = name .. "_bottom", param2 = dir}) minetest.set_node(botpos, {name = name .. "_top", param2 = dir}) - if not minetest.setting_getbool("creative_mode") then + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(placer:get_player_name())) then itemstack:take_item() end return itemstack @@ -91,8 +100,9 @@ function beds.register_bed(name, def) destruct_bed(pos, 1) end, - on_rightclick = function(pos, node, clicker) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) beds.on_rightclick(pos, clicker) + return itemstack end, on_rotate = function(pos, node, user, mode, new_param2) @@ -112,8 +122,8 @@ function beds.register_bed(name, def) end local newp = vector.add(pos, minetest.facedir_to_dir(new_param2)) local node3 = minetest.get_node_or_nil(newp) - local def = node3 and minetest.registered_nodes[node3.name] - if not def or not def.buildable_to then + local node_def = node3 and minetest.registered_nodes[node3.name] + if not node_def or not node_def.buildable_to then return false end if minetest.is_protected(newp, user:get_player_name()) then @@ -136,8 +146,8 @@ function beds.register_bed(name, def) paramtype2 = "facedir", is_ground_content = false, pointable = false, - groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2}, - sounds = default.node_sound_wood_defaults(), + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2}, + sounds = def.sounds or default.node_sound_wood_defaults(), drop = name .. "_bottom", node_box = { type = "fixed", diff --git a/mods/beds/beds.lua b/mods/beds/beds.lua index 5f31f136..bb2fd5d3 100644 --- a/mods/beds/beds.lua +++ b/mods/beds/beds.lua @@ -66,7 +66,7 @@ beds.register_bed("beds:bed", { }, top = { "beds_bed_top_top.png^[transformR90", - "default_wood.png", + "default_wood.png", "beds_bed_side_top_r.png", "beds_bed_side_top_r.png^[transformfx", "beds_bed_side_top.png", @@ -88,3 +88,17 @@ beds.register_bed("beds:bed", { minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom") minetest.register_alias("beds:bed_top_red", "beds:bed_top") + +-- Fuel + +minetest.register_craft({ + type = "fuel", + recipe = "beds:fancy_bed_bottom", + burntime = 13, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "beds:bed_bottom", + burntime = 12, +}) diff --git a/mods/beds/functions.lua b/mods/beds/functions.lua index 85ee97cf..78df9a18 100644 --- a/mods/beds/functions.lua +++ b/mods/beds/functions.lua @@ -1,7 +1,7 @@ local pi = math.pi local player_in_bed = 0 local is_sp = minetest.is_singleplayer() -local enable_respawn = minetest.setting_getbool("enable_bed_respawn") +local enable_respawn = minetest.settings:get_bool("enable_bed_respawn") if enable_respawn == nil then enable_respawn = true end @@ -22,7 +22,7 @@ local function get_look_yaw(pos) end local function is_night_skip_enabled() - local enable_night_skip = minetest.setting_getbool("enable_bed_night_skip") + local enable_night_skip = minetest.settings:get_bool("enable_bed_night_skip") if enable_night_skip == nil then enable_night_skip = true end @@ -70,7 +70,7 @@ local function lay_down(player, pos, bed_pos, state, skip) -- physics, eye_offset, etc player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}) - player:set_look_yaw(math.random(1, 180) / 100) + player:set_look_horizontal(math.random(1, 180) / 100) default.player_attached[name] = false player:set_physics_override(1, 1, 1) hud_flags.wielditem = true @@ -85,7 +85,7 @@ local function lay_down(player, pos, bed_pos, state, skip) -- physics, eye_offset, etc player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0}) local yaw, param2 = get_look_yaw(bed_pos) - player:set_look_yaw(yaw) + player:set_look_horizontal(yaw) local dir = minetest.facedir_to_dir(param2) local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2} player:set_physics_override(0, 0, 0) @@ -100,7 +100,7 @@ end local function update_formspecs(finished) local ges = #minetest.get_connected_players() - local form_n = "" + local form_n local is_majority = (ges / 2) < player_in_bed if finished then @@ -130,7 +130,6 @@ end function beds.skip_night() minetest.set_timeofday(0.23) - beds.set_spawns() end function beds.on_rightclick(pos, player) @@ -149,7 +148,7 @@ function beds.on_rightclick(pos, player) -- move to bed if not beds.player[name] then lay_down(player, ppos, pos) - beds.set_spawns()--hack for set spawn maikerumine + beds.set_spawns() -- save respawn positions when entering bed else lay_down(player, nil, nil, false) end @@ -174,23 +173,18 @@ end -- Callbacks - -minetest.register_on_joinplayer(function(player) - beds.read_spawns() -end) - --- respawn player at bed if enabled and valid position is found -minetest.register_on_respawnplayer(function(player) - if not enable_respawn then - return false - end - local name = player:get_player_name() - local pos = beds.spawn[name] or nil - if pos then - player:setpos(pos) - return true - end -end) +-- Only register respawn callback if respawn enabled +if enable_respawn then + -- respawn player at bed if enabled and valid position is found + minetest.register_on_respawnplayer(function(player) + local name = player:get_player_name() + local pos = beds.spawn[name] + if pos then + player:setpos(pos) + return true + end + end) +end minetest.register_on_leaveplayer(function(player) local name = player:get_player_name() diff --git a/mods/beds/license.txt b/mods/beds/license.txt new file mode 100644 index 00000000..0494b36b --- /dev/null +++ b/mods/beds/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2014-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 BlockMen + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/beds/spawns.lua b/mods/beds/spawns.lua index 48b8a669..6b1f4041 100644 --- a/mods/beds/spawns.lua +++ b/mods/beds/spawns.lua @@ -32,11 +32,11 @@ function beds.read_spawns() beds.save_spawns() os.rename(file, file .. ".backup") file = org_file - else - spawns = {} end end +beds.read_spawns() + function beds.save_spawns() if not beds.spawn then return diff --git a/mods/boats/README.txt b/mods/boats/README.txt index 1de71678..59631d9d 100644 --- a/mods/boats/README.txt +++ b/mods/boats/README.txt @@ -1,16 +1,15 @@ Minetest Game mod: boats ======================== -by PilzAdam +See license.txt for license information. -License of source code: ------------------------ -WTFPL +Authors of source code +---------------------- +Originally by PilzAdam (MIT) +Various Minetest developers and contributors (MIT) -License of media (textures and sounds): ---------------------------------------- -WTFPL - -Authors of media files: ------------------------ -textures: Zeg9 -model: thetoon and Zeg9, modified by PavelS(SokolovPavel) +Authors of media (textures and model) +------------------------------------- +Textures: Zeg9 (CC BY-SA 3.0) +Model: thetoon and Zeg9 (CC BY-SA 3.0), + modified by PavelS(SokolovPavel) (CC BY-SA 3.0), + modified by sofar (CC BY-SA 3.0) diff --git a/mods/boats/init.lua b/mods/boats/init.lua index f8d0ccb4..4d8f4673 100644 --- a/mods/boats/init.lua +++ b/mods/boats/init.lua @@ -34,6 +34,8 @@ end local boat = { physical = true, + -- Warning: Do not change the position of the collisionbox top surface, + -- lowering it causes the boat to fall through the world if underwater collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5}, visual = "mesh", mesh = "boats_boat.obj", @@ -77,7 +79,7 @@ function boat.on_rightclick(self, clicker) minetest.after(0.2, function() default.player_set_animation(clicker, "sit" , 30) end) - self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) + clicker:set_look_horizontal(self.object:getyaw()) end end @@ -107,18 +109,20 @@ function boat.on_punch(self, puncher) end if not self.driver then self.removed = true + local inv = puncher:get_inventory() + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(puncher:get_player_name())) + or not inv:contains_item("main", "boats:boat") then + local leftover = inv:add_item("main", "boats:boat") + -- if no room in inventory add a replacement boat to the world + if not leftover:is_empty() then + minetest.add_item(self.object:getpos(), leftover) + end + end -- delay remove to ensure player is detached minetest.after(0.1, function() self.object:remove() end) - if not minetest.setting_getbool("creative_mode") then - local inv = puncher:get_inventory() - if inv:room_for_item("main", "boats:boat") then - inv:add_item("main", "boats:boat") - else - minetest.add_item(self.object:getpos(), "boats:boat") - end - end end end @@ -165,7 +169,7 @@ function boat.on_step(self, dtime) local p = self.object:getpos() p.y = p.y - 0.5 - local new_velo = {x = 0, y = 0, z = 0} + local new_velo local new_acce = {x = 0, y = 0, z = 0} if not is_water(p) then local nodedef = minetest.registered_nodes[minetest.get_node(p).name] @@ -219,18 +223,32 @@ minetest.register_craftitem("boats:boat", { wield_image = "boats_wield.png", wield_scale = {x = 2, y = 2, z = 1}, liquids_pointable = true, + groups = {flammable = 2}, on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local udef = minetest.registered_nodes[node.name] + if udef and udef.on_rightclick and + not (placer and placer:get_player_control().sneak) then + return udef.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + if pointed_thing.type ~= "node" then - return + return itemstack end if not is_water(pointed_thing.under) then - return + return itemstack end pointed_thing.under.y = pointed_thing.under.y + 0.5 - minetest.add_entity(pointed_thing.under, "boats:boat") - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() + boat = minetest.add_entity(pointed_thing.under, "boats:boat") + if boat then + boat:setyaw(placer:get_look_horizontal()) + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(placer:get_player_name())) then + itemstack:take_item() + end end return itemstack end, @@ -245,3 +263,9 @@ minetest.register_craft({ {"group:wood", "group:wood", "group:wood"}, }, }) + +minetest.register_craft({ + type = "fuel", + recipe = "boats:boat", + burntime = 20, +}) diff --git a/mods/boats/license.txt b/mods/boats/license.txt new file mode 100644 index 00000000..d4afe75f --- /dev/null +++ b/mods/boats/license.txt @@ -0,0 +1,63 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures and model) +-------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Zeg9 +Copyright (C) 2012-2016 thetoon +Copyright (C) 2012-2016 PavelS(SokolovPavel) +Copyright (C) 2016 sofar (sofar@foo-projects.org) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/bucket/README.txt b/mods/bucket/README.txt index a6674b43..45e0ec54 100644 --- a/mods/bucket/README.txt +++ b/mods/bucket/README.txt @@ -1,26 +1,13 @@ Minetest Game mod: bucket ========================= +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2011-2012 Kahrl -Copyright (C) 2011-2012 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ -Everything not listed in here: -Copyright (C) 2010-2012 celeron55, Perttu Ahola - +Authors of source code +---------------------- +Kahrl (LGPL 2.1) +celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) +Authors of media (textures) +--------------------------- +ElementW (CC BY-SA 3.0) diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua index 3770be6a..5076dece 100644 --- a/mods/bucket/init.lua +++ b/mods/bucket/init.lua @@ -36,12 +36,17 @@ end -- inventory_image = texture of the new bucket item (ignored if itemname == nil) -- name = text description of the bucket item -- groups = (optional) groups of the bucket item, for example {water_bucket = 1} +-- force_renew = (optional) bool. Force the liquid source to renew if it has a +-- source neighbour, even if defined as 'liquid_renewable = false'. +-- Needed to avoid creating holes in sloping rivers. -- This function can be called from any mod (that depends on bucket). -function bucket.register_liquid(source, flowing, itemname, inventory_image, name, groups) +function bucket.register_liquid(source, flowing, itemname, inventory_image, name, + groups, force_renew) bucket.liquids[source] = { source = source, flowing = flowing, itemname = itemname, + force_renew = force_renew, } bucket.liquids[flowing] = bucket.liquids[source] @@ -110,8 +115,11 @@ minetest.register_craftitem("bucket:bucket_empty", { stack_max = 99, liquids_pointable = true, on_use = function(itemstack, user, pointed_thing) - -- Must be pointing to node - if pointed_thing.type ~= "node" then + if pointed_thing.type == "object" then + pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil) + return user:get_wielded_item() + elseif pointed_thing.type ~= "node" then + -- do nothing if it's neither object nor node return end -- Check if pointing to a liquid source @@ -141,7 +149,7 @@ minetest.register_craftitem("bucket:bucket_empty", { else local pos = user:getpos() pos.y = math.floor(pos.y + 0.5) - core.add_item(pos, liquiddef.itemname) + minetest.add_item(pos, liquiddef.itemname) end -- set to return empty buckets minus 1 @@ -149,9 +157,24 @@ minetest.register_craftitem("bucket:bucket_empty", { end - minetest.add_node(pointed_thing.under, {name="air"}) + -- force_renew requires a source neighbour + local source_neighbor = false + if liquiddef.force_renew then + source_neighbor = + minetest.find_node_near(pointed_thing.under, 1, liquiddef.source) + end + if not (source_neighbor and liquiddef.force_renew) then + minetest.add_node(pointed_thing.under, {name = "air"}) + end return ItemStack(giving_back) + else + -- non-liquid nodes will have their on_punch triggered + local node_def = minetest.registered_nodes[node.name] + if node_def then + node_def.on_punch(pointed_thing.under, node, user, pointed_thing) + end + return user:get_wielded_item() end end, }) @@ -171,7 +194,8 @@ bucket.register_liquid( "bucket:bucket_river_water", "bucket_river_water.png", "River Water Bucket", - {water_bucket = 1} + {water_bucket = 1}, + true ) bucket.register_liquid( diff --git a/mods/bucket/license.txt b/mods/bucket/license.txt new file mode 100644 index 00000000..a5156ae6 --- /dev/null +++ b/mods/bucket/license.txt @@ -0,0 +1,51 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 Kahrl +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2011-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2015-2016 ElementW + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/builtin_item/.gitignore b/mods/builtin_item/.gitignore deleted file mode 100644 index d9c069a6..00000000 --- a/mods/builtin_item/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -## Generic ignorable patterns and files -*~ -.*.swp -debug.txt diff --git a/mods/builtin_item/README.md b/mods/builtin_item/README.md deleted file mode 100644 index b1e70fc8..00000000 --- a/mods/builtin_item/README.md +++ /dev/null @@ -1,25 +0,0 @@ -item_entity.lua - -edited by TenPlus1 - -Features: -- Items are destroyed by lava -- Items are moved along by flowing water (new routine) -- Items are removed after 120 seconds or the time that is specified by - remove_items in minetest.conf (-1 disables it) -- Particle effects added - - - 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/builtin_item/depends.txt b/mods/builtin_item/depends.txt deleted file mode 100644 index 7c506cfb..00000000 --- a/mods/builtin_item/depends.txt +++ /dev/null @@ -1,2 +0,0 @@ -default -mobs? \ No newline at end of file diff --git a/mods/builtin_item/init.lua b/mods/builtin_item/init.lua deleted file mode 100644 index febaa7e0..00000000 --- a/mods/builtin_item/init.lua +++ /dev/null @@ -1,450 +0,0 @@ --- Minetest: builtin/item_entity.lua (27th January 2016) - --- water flow functions by QwertyMine3, edited by TenPlus1 -local function to_unit_vector(dir_vector) - - local inv_roots = { - [0] = 1, - [1] = 1, - [2] = 0.70710678118655, - [4] = 0.5, - [5] = 0.44721359549996, - [8] = 0.35355339059327 - } - - local sum = dir_vector.x * dir_vector.x + dir_vector.z * dir_vector.z - - return { - x = dir_vector.x * inv_roots[sum], - y = dir_vector.y, - z = dir_vector.z * inv_roots[sum] - } -end - -local function is_touching(realpos, nodepos, radius) - - return (math.abs(realpos - nodepos) > (0.5 - radius)) -end - -local function node_ok(pos) - - local node = minetest.get_node_or_nil(pos) - - if not node then - return minetest.registered_nodes["default:dirt"] - end - - if minetest.registered_nodes[node.name] then - return node - end - - return minetest.registered_nodes["default:dirt"] -end - -local function is_water(pos) - - return (minetest.registered_nodes[ - node_ok({x = pos.x, y = pos.y, z = pos.z}).name].groups.water) -end - -local function is_liquid(pos) - - return (minetest.registered_nodes[ - node_ok({x = pos.x, y = pos.y, z = pos.z}).name].groups.liquid) -end - -local function node_is_liquid(node) - - return (minetest.registered_nodes[node.name].groups.liquid) -end - -local function quick_flow_logic(node, pos_testing, direction) - - if minetest.registered_nodes[node.name].liquidtype == "source" then - - local node_testing = node_ok(pos_testing) - local param2_testing = node_testing.param2 - - if minetest.registered_nodes[node_testing.name].liquidtype ~= "flowing" then - return 0 - else - return direction - end - - elseif minetest.registered_nodes[node.name].liquidtype == "flowing" then - - local node_testing = node_ok(pos_testing) - local param2_testing = node_testing.param2 - - if minetest.registered_nodes[node_testing.name].liquidtype == "source" then - return -direction - - elseif minetest.registered_nodes[node_testing.name].liquidtype == "flowing" then - - if param2_testing < node.param2 then - - if (node.param2 - param2_testing) > 6 then - return -direction - else - return direction - end - - elseif param2_testing > node.param2 then - - if (param2_testing - node.param2) > 6 then - return direction - else - return -direction - end - end - end - end - - return 0 -end - -local function quick_flow(pos, node) - - local x, z = 0, 0 - - if not node_is_liquid(node) then - return {x = 0, y = 0, z = 0} - end - - x = x + quick_flow_logic(node, {x = pos.x - 1, y = pos.y, z = pos.z},-1) - x = x + quick_flow_logic(node, {x = pos.x + 1, y = pos.y, z = pos.z}, 1) - z = z + quick_flow_logic(node, {x = pos.x, y = pos.y, z = pos.z - 1},-1) - z = z + quick_flow_logic(node, {x = pos.x, y = pos.y, z = pos.z + 1}, 1) - - return to_unit_vector({x = x, y = 0, z = z}) -end - ---if not in water but touching, move centre to touching block ---x has higher precedence than z -- if pos changes with x, it affects z -local function move_centre(pos, realpos, node, radius) - - if is_touching(realpos.x, pos.x, radius) then - - if is_liquid({x = pos.x - 1, y = pos.y, z = pos.z}) then - pos = {x = pos.x - 1, y = pos.y, z = pos.z} - node = node_ok(pos) - - elseif is_liquid({x = pos.x + 1, y = pos.y, z = pos.z}) then - pos = {x = pos.x + 1, y = pos.y, z = pos.z} - node = node_ok(pos) - end - end - - if is_touching(realpos.z, pos.z, radius) then - - if is_liquid({x = pos.x, y = pos.y, z = pos.z - 1}) then - pos = {x = pos.x, y = pos.y, z = pos.z - 1} - node = node_ok(pos) - - elseif is_liquid({x = pos.x, y = pos.y, z = pos.z + 1}) then - pos = {x = pos.x, y = pos.y, z = pos.z + 1} - node = node_ok(pos) - end - end - - return pos, node -end --- END water flow functions - -function core.spawn_item(pos, item) - - local obj = core.add_entity(pos, "__builtin:item") - - -- Don't use obj if it couldn't be added to the map. - if obj then - obj:get_luaentity():set_item(ItemStack(item):to_string()) - end - - return obj -end - --- if item_entity_ttl is not set, enity will have default life time --- setting to -1 disables the feature -local time_to_live = tonumber(core.setting_get("item_entity_ttl")) or 900 - --- if destroy_item is 1 then dropped items will burn inside lava -local destroy_item = tonumber(core.setting_get("destroy_item")) or 1 - --- entity gravity -local gravity = tonumber(minetest.setting_get("movement_gravity")) or 9.81 - --- particle effects for when item is destroyed -local function add_effects(pos) - - minetest.add_particlespawner({ - amount = 1, - time = 0.25, - minpos = pos, - maxpos = pos, - minvel = {x = -1, y = 2, z = -1}, - maxvel = {x = 1, y = 5, z = 1}, - minacc = {x = -4, y = -4, z = -4}, - maxacc = {x = 4, y = 4, z = 4}, - minexptime = 1, - maxexptime = 3, - minsize = 1, - maxsize = 4, - texture = "tnt_smoke.png", - }) -end - --- check if within map limits (-30911 to 30927) -local function within_limits(pos) - - if pos.x > -30913 - and pos.x < 30928 - and pos.y > -30913 - and pos.y < 30928 - and pos.z > -30913 - and pos.z < 30928 then - return true -- within limits - end - - return false -- beyond limits -end - -core.register_entity(":__builtin:item", { - initial_properties = { - hp_max = 1, - physical = true, - collide_with_objects = false, - collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.3, 0.3}, - visual = "wielditem", - visual_size = {x = 0.4, y = 0.4}, - textures = {""}, - spritediv = {x = 1, y = 1}, - initial_sprite_basepos = {x = 0, y = 0}, - is_visible = false, - infotext = "", - }, - - itemstring = "", - physical_state = true, - age = 0, - - set_item = function(self, itemstring) - - self.itemstring = itemstring - - local stack = ItemStack(itemstring) - local itemname = stack:get_name() - local max_count = stack:get_stack_max() - local count = math.min(stack:get_count(), max_count) - local size = 0.2 + 0.1 * (count / max_count) - - if not core.registered_items[itemname] then - itemname = "unknown" - end - - self.object:set_properties({ - is_visible = true, - visual = "wielditem", - textures = {itemname}, - visual_size = {x = size, y = size}, - collisionbox = {-size, -size, -size, size, size, size}, - automatic_rotate = math.pi * 0.5, - infotext = core.registered_items[itemname].description - }) - end, - - update_gravity = function(self) - if not self.physical_state then - self.object:setacceleration({x = 0, y = 0, z = 0}) - return - end - - self.object:setacceleration({x = 0, y = -gravity, z = 0}) - end, - - get_staticdata = function(self) - - return core.serialize({ - itemstring = self.itemstring, - always_collect = self.always_collect, - age = self.age, - dropped_by = self.dropped_by - }) - end, - - on_activate = function(self, staticdata, dtime_s) - - -- special function to fast remove entities (xanadu only) - if (mobs and mobs.entity and mobs.entity == false) - or not self then - - self.object:remove() - - return - end - - if string.sub(staticdata, 1, string.len("return")) == "return" then - - local data = core.deserialize(staticdata) - - if data and type(data) == "table" then - - self.itemstring = data.itemstring - self.always_collect = data.always_collect - self.age = data.age or 0 - self.age = self.age + dtime_s - self.dropped_by = data.dropped_by - end - else - self.itemstring = staticdata - end - - self.object:set_armor_groups({immortal = 1}) - self.object:setvelocity({x = 0, y = 2, z = 0}) - self:update_gravity() - self:set_item(self.itemstring) - end, - - try_merge_with = function(self, own_stack, object, entity) - - if self.age == entity.age then - -- Can not merge with itself - return false - end - - local stack = ItemStack(entity.itemstring) - local name = stack:get_name() - - if own_stack:get_name() ~= name or own_stack:get_free_space() == 0 then - -- Can not merge different or full stack - return false - end - - local count = own_stack:get_count() - local total_count = stack:get_count() + count - local max_count = stack:get_stack_max() - - -- Merge the remote stack into this one - if total_count > max_count then - return false - end - - local pos = object:getpos() - pos.y = pos.y + ((total_count - count) / max_count) * 0.15 - - self:set_item(name .. " " .. total_count) - - entity.itemstring = "" - object:remove() - - return true - end, - - on_step = function(self, dtime) - - self.age = self.age + dtime - if time_to_live > 0 and self.age > time_to_live then - self.itemstring = "" - self.object:remove() - return - end - - local pos = self.object:getpos() - local node = node_ok({ - x = pos.x, - y = pos.y - 0.5, - z = pos.z - }) - local def = core.registered_nodes[node.name] - - -- destroy item when dropped into lava (if enabled) - if destroy_item > 0 and def.groups.lava then - minetest.sound_play("builtin_item_lava", { - pos = pos, - max_hear_distance = 6, - gain = 0.5 - }) - add_effects(pos) - self.object:remove() - return - end - - -- flowing water pushes item along (by QwertyMine3) - local nod = node_ok({x = pos.x, y = pos.y + 0.5, z = pos.z}) - if minetest.registered_nodes[nod.name].liquidtype == "flowing" then - - local vec = quick_flow(self.object:getpos(), - node_ok(self.object:getpos())) - - if vec then - - local v = self.object:getvelocity() - - self.object:setvelocity( - {x = vec.x, y = v.y, z = vec.z}) - - end - - return - end - - -- Ignore is walkable -> stop until the block loaded - local entity_fall = (def and not def.walkable) - - if self.physical_state == entity_fall then - return - end - - self.object:setvelocity({x = 0, y = 0, z = 0}) - self.physical_state = entity_fall - self.object:set_properties({ - physical = entity_fall - }) - - self:update_gravity() - - -- Collect the items around to merge with - local own_stack = ItemStack(self.itemstring) - if own_stack:get_free_space() == 0 then - return - end - - local objects = core.get_objects_inside_radius(pos, 0.8) - - for k, object in pairs(objects) do - - local entity = object:get_luaentity() - - if entity and entity.name == "__builtin:item" then - - if self:try_merge_with(own_stack, object, entity) then - - own_stack = ItemStack(self.itemstring) - - if own_stack:get_free_space() == 0 then - return - end - end - end - end - end, - - on_punch = function(self, puncher) - - local inv = puncher:get_inventory() - - if inv and self.itemstring ~= "" then - - local left = inv:add_item("main", self.itemstring) - - if left and not left:is_empty() then - - self:set_item(left:to_string()) - - return - end - end - - self.itemstring = "" - self.object:remove() - end, -}) diff --git a/mods/builtin_item/sounds/builtin_item_lava.ogg b/mods/builtin_item/sounds/builtin_item_lava.ogg deleted file mode 100644 index 5c293fe9..00000000 Binary files a/mods/builtin_item/sounds/builtin_item_lava.ogg and /dev/null differ diff --git a/mods/builtin_item/textures/tnt_smoke.png b/mods/builtin_item/textures/tnt_smoke.png deleted file mode 100644 index 488b50fe..00000000 Binary files a/mods/builtin_item/textures/tnt_smoke.png and /dev/null differ diff --git a/mods/creative/README.txt b/mods/creative/README.txt index fa735524..82357f30 100644 --- a/mods/creative/README.txt +++ b/mods/creative/README.txt @@ -1,23 +1,12 @@ Minetest Game mod: creative =========================== +See license.txt for license information. -Implements creative mode. - -Switch on by using the "creative_mode" setting. - -Registered items that -- have a description, and -- do not have the group not_in_creative_inventory -are added to the creative inventory. - -License of source code and media files: ---------------------------------------- -Copyright (C) 2012 Perttu Ahola (celeron55) -Copyright (C) 2016 Jean-Patrick G. (kilbith) - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Jean-Patrick G. (kilbith) (MIT) +Author of media (textures) +-------------------------- +Jean-Patrick G. (kilbith) (CC BY-SA 3.0) diff --git a/mods/creative/depends.txt b/mods/creative/depends.txt index 4ad96d51..975e6525 100644 --- a/mods/creative/depends.txt +++ b/mods/creative/depends.txt @@ -1 +1,2 @@ default +sfinv diff --git a/mods/creative/init.lua b/mods/creative/init.lua index 1e7b4087..51d6f792 100644 --- a/mods/creative/init.lua +++ b/mods/creative/init.lua @@ -1,228 +1,22 @@ --- minetest/creative/init.lua - creative = {} -local player_inventory = {} -local creative_mode = minetest.setting_getbool("creative_mode") --- Create detached creative inventory after loading all mods -creative.init_creative_inventory = function(owner) - local owner_name = owner:get_player_name() - player_inventory[owner_name] = { - size = 0, - filter = "", - start_i = 1, - tab_id = 2, - } +local creative_mode_cache = minetest.settings:get_bool("creative_mode") - minetest.create_detached_inventory("creative_" .. owner_name, { - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - if creative_mode and not to_list == "main" then - return count - else - return 0 - end - end, - allow_put = function(inv, listname, index, stack, player) - return 0 - end, - allow_take = function(inv, listname, index, stack, player) - if creative_mode then - return -1 - else - return 0 - end - end, - on_move = function(inv, from_list, from_index, to_list, to_index, count, player) - end, - on_put = function(inv, listname, index, stack, player) - end, - on_take = function(inv, listname, index, stack, player) - local player_name, stack_name = player:get_player_name(), stack:get_name() - --print(player_name .. " takes item from creative inventory; listname = " .. listname .. ", index = " .. index .. ", stack = " .. dump(stack:to_table())) - if stack then - minetest.log("action", player_name .. " takes " .. stack_name .. " from creative inventory") - --print("Stack name: " .. stack_name .. ", Stack count: " .. stack:get_count()) - end - end, - }) - - creative.update_creative_inventory(owner_name) - --print("creative inventory size: " .. player_inventory[player_name].size) +function creative.is_enabled_for(name) + return creative_mode_cache end -local function tab_category(tab_id) - local id_category = { - nil, -- Reserved for crafting tab. - minetest.registered_items, - minetest.registered_nodes, - minetest.registered_tools, - minetest.registered_craftitems - } +dofile(minetest.get_modpath("creative") .. "/inventory.lua") - -- If index out of range, show default ("All") page. - return id_category[tab_id] or id_category[2] -end - -function creative.update_creative_inventory(player_name) - local creative_list = {} - local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) - local inv = player_inventory[player_name] - - for name, def in pairs(tab_category(inv.tab_id)) do - if not (def.groups.not_in_creative_inventory == 1) and - def.description and def.description ~= "" and - (def.name:find(inv.filter, 1, true) or - def.description:lower():find(inv.filter, 1, true)) then - creative_list[#creative_list+1] = name - end - end - - table.sort(creative_list) - player_inv:set_size("main", #creative_list) - player_inv:set_list("main", creative_list) - inv.size = #creative_list -end - --- Create the trash field -local trash = minetest.create_detached_inventory("creative_trash", { - -- Allow the stack to be placed and remove it in on_put() - -- This allows the creative inventory to restore the stack - allow_put = function(inv, listname, index, stack, player) - if creative_mode then - return stack:get_count() - else - return 0 - end - end, - on_put = function(inv, listname) - inv:set_list(listname, {}) - end, -}) -trash:set_size("main", 1) - -creative.formspec_add = "" - -creative.set_creative_formspec = function(player, start_i) - local player_name = player:get_player_name() - local inv = player_inventory[player_name] - local pagenum = math.floor(start_i / (3*8) + 1) - local pagemax = math.ceil(inv.size / (3*8)) - - player:set_inventory_formspec([[ - size[8,8.6] - image[4.06,3.4;0.8,0.8;creative_trash_icon.png] - list[current_player;main;0,4.7;8,1;] - list[current_player;main;0,5.85;8,3;8] - list[detached:creative_trash;main;4,3.3;1,1;] - listring[] - tablecolumns[color;text;color;text] - tableoptions[background=#00000000;highlight=#00000000;border=false] - button[5.4,3.2;0.8,0.9;creative_prev;<] - button[7.25,3.2;0.8,0.9;creative_next;>] - button[2.1,3.4;0.8,0.5;creative_search;?] - button[2.75,3.4;0.8,0.5;creative_clear;X] - tooltip[creative_search;Search] - tooltip[creative_clear;Reset] - listring[current_player;main] - ]] .. - "field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" .. - "listring[detached:creative_" .. player_name .. ";main]" .. - "tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;" .. tostring(inv.tab_id) .. ";true;false]" .. - "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" .. - "table[6.05,3.35;1.15,0.5;pagenum;#FFFF00," .. tostring(pagenum) .. ",#FFFFFF,/ " .. tostring(pagemax) .. "]" .. - default.get_hotbar_bg(0,4.7) .. - default.gui_bg .. default.gui_bg_img .. default.gui_slots - .. creative.formspec_add - ) -end - -creative.set_crafting_formspec = function(player) - player:set_inventory_formspec([[ - size[8,8.6] - list[current_player;craft;2,0.75;3,3;] - list[current_player;craftpreview;6,1.75;1,1;] - list[current_player;main;0,4.7;8,1;] - list[current_player;main;0,5.85;8,3;8] - list[detached:creative_trash;main;0,2.75;1,1;] - image[0.06,2.85;0.8,0.8;creative_trash_icon.png] - image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270] - tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;1;true;false] - listring[current_player;main] - listring[current_player;craft] - ]] .. - default.get_hotbar_bg(0,4.7) .. - default.gui_bg .. default.gui_bg_img .. default.gui_slots - ) -end - -minetest.register_on_joinplayer(function(player) - -- If in creative mode, modify player's inventory forms - if not creative_mode then - return - end - creative.init_creative_inventory(player) - creative.set_creative_formspec(player, 0) -end) - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname ~= "" or not creative_mode then - return - end - - local player_name = player:get_player_name() - local inv = player_inventory[player_name] - - if fields.quit then - if inv.tab_id == 1 then - creative.set_crafting_formspec(player) - end - elseif fields.creative_tabs then - local tab = tonumber(fields.creative_tabs) - inv.tab_id = tab - player_inventory[player_name].start_i = 1 - - if tab == 1 then - creative.set_crafting_formspec(player) - else - creative.update_creative_inventory(player_name) - creative.set_creative_formspec(player, 0) - end - elseif fields.creative_clear then - player_inventory[player_name].start_i = 1 - inv.filter = "" - creative.update_creative_inventory(player_name) - creative.set_creative_formspec(player, 0) - elseif fields.creative_search then - player_inventory[player_name].start_i = 1 - inv.filter = fields.creative_filter:lower() - creative.update_creative_inventory(player_name) - creative.set_creative_formspec(player, 0) - else - local start_i = player_inventory[player_name].start_i or 0 - - if fields.creative_prev then - start_i = start_i - 3*8 - if start_i < 0 then - start_i = inv.size - (inv.size % (3*8)) - if inv.size == start_i then - start_i = math.max(0, inv.size - (3*8)) - end - end - elseif fields.creative_next then - start_i = start_i + 3*8 - if start_i >= inv.size then - start_i = 0 - end - end - - player_inventory[player_name].start_i = start_i - creative.set_creative_formspec(player, start_i) - end -end) - -if creative_mode then - local digtime = 0.5 - local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 3} +if creative_mode_cache then + -- Dig time is modified according to difference (leveldiff) between tool + -- 'maxlevel' and node 'level'. Digtime is divided by the larger of + -- leveldiff and 1. + -- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been + -- increased such that nodes of differing levels have an insignificant + -- effect on digtime. + local digtime = 42 + local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256} minetest.register_item(":", { type = "none", @@ -242,22 +36,27 @@ if creative_mode then damage_groups = {fleshy = 10}, } }) +end - minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) - return true - end) +-- Unlimited node placement +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) + return creative.is_enabled_for(placer:get_player_name()) +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 +-- Don't pick up if the item is already in the inventory +local old_handle_node_drops = minetest.handle_node_drops +function minetest.handle_node_drops(pos, drops, digger) + if not digger or not digger:is_player() then + return + end + if not creative.is_enabled_for(digger:get_player_name()) then + return old_handle_node_drops(pos, drops, digger) + end + local inv = digger:get_inventory() + if inv then + for _, item in ipairs(drops) do + if not inv:contains_item("main", item, true) then + inv:add_item("main", item) end end end diff --git a/mods/creative/inventory.lua b/mods/creative/inventory.lua new file mode 100644 index 00000000..0e1d813e --- /dev/null +++ b/mods/creative/inventory.lua @@ -0,0 +1,177 @@ +local player_inventory = {} + +function creative.init_creative_inventory(player) + local player_name = player:get_player_name() + player_inventory[player_name] = { + size = 0, + filter = "", + start_i = 0 + } + + minetest.create_detached_inventory("creative_" .. player_name, { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2) + if not to_list == "main" then + return count + else + return 0 + end + end, + allow_put = function(inv, listname, index, stack, player2) + return 0 + end, + allow_take = function(inv, listname, index, stack, player2) + return -1 + end, + on_move = function(inv, from_list, from_index, to_list, to_index, count, player2) + end, + on_put = function(inv, listname, index, stack, player2) + end, + on_take = function(inv, listname, index, stack, player2) + if stack and stack:get_count() > 0 then + minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory") + end + end, + }, player_name) + + return player_inventory[player_name] +end + +function creative.update_creative_inventory(player_name, tab_content) + local creative_list = {} + local inv = player_inventory[player_name] or + creative.init_creative_inventory(minetest.get_player_by_name(player_name)) + local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) + + for name, def in pairs(tab_content) do + if not (def.groups.not_in_creative_inventory == 1) and + def.description and def.description ~= "" and + (def.name:find(inv.filter, 1, true) or + def.description:lower():find(inv.filter, 1, true)) then + creative_list[#creative_list+1] = name + end + end + + table.sort(creative_list) + player_inv:set_size("main", #creative_list) + player_inv:set_list("main", creative_list) + inv.size = #creative_list +end + +-- Create the trash field +local trash = minetest.create_detached_inventory("creative_trash", { + -- Allow the stack to be placed and remove it in on_put() + -- This allows the creative inventory to restore the stack + allow_put = function(inv, listname, index, stack, player) + return stack:get_count() + end, + on_put = function(inv, listname) + inv:set_list(listname, {}) + end, +}) +trash:set_size("main", 1) + +creative.formspec_add = "" + +function creative.register_tab(name, title, items) + sfinv.register_page("creative:" .. name, { + title = title, + is_in_nav = function(self, player, context) + return creative.is_enabled_for(player:get_player_name()) + end, + get = function(self, player, context) + local player_name = player:get_player_name() + creative.update_creative_inventory(player_name, items) + local inv = player_inventory[player_name] + local start_i = inv.start_i or 0 + local pagenum = math.floor(start_i / (3*8) + 1) + local pagemax = math.ceil(inv.size / (3*8)) + return sfinv.make_formspec(player, context, + "label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" .. + [[ + image[4.06,3.4;0.8,0.8;creative_trash_icon.png] + listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] + list[current_player;main;0,4.7;8,1;] + list[current_player;main;0,5.85;8,3;8] + list[detached:creative_trash;main;4,3.3;1,1;] + listring[] + button[5.4,3.2;0.8,0.9;creative_prev;<] + button[7.25,3.2;0.8,0.9;creative_next;>] + button[2.1,3.4;0.8,0.5;creative_search;?] + button[2.75,3.4;0.8,0.5;creative_clear;X] + tooltip[creative_search;Search] + tooltip[creative_clear;Reset] + listring[current_player;main] + field_close_on_enter[creative_filter;false] + ]] .. + "field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" .. + "listring[detached:creative_" .. player_name .. ";main]" .. + "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" .. + default.get_hotbar_bg(0,4.7) .. + default.gui_bg .. default.gui_bg_img .. default.gui_slots + .. creative.formspec_add, false) + end, + on_enter = function(self, player, context) + local player_name = player:get_player_name() + local inv = player_inventory[player_name] + if inv then + inv.start_i = 0 + end + end, + on_player_receive_fields = function(self, player, context, fields) + local player_name = player:get_player_name() + local inv = player_inventory[player_name] + assert(inv) + + if fields.creative_clear then + inv.start_i = 0 + inv.filter = "" + creative.update_creative_inventory(player_name, items) + sfinv.set_player_inventory_formspec(player, context) + elseif fields.creative_search or + fields.key_enter_field == "creative_filter" then + inv.start_i = 0 + inv.filter = fields.creative_filter:lower() + creative.update_creative_inventory(player_name, items) + sfinv.set_player_inventory_formspec(player, context) + elseif not fields.quit then + local start_i = inv.start_i or 0 + + if fields.creative_prev then + start_i = start_i - 3*8 + if start_i < 0 then + start_i = inv.size - (inv.size % (3*8)) + if inv.size == start_i then + start_i = math.max(0, inv.size - (3*8)) + end + end + elseif fields.creative_next then + start_i = start_i + 3*8 + if start_i >= inv.size then + start_i = 0 + end + end + + inv.start_i = start_i + sfinv.set_player_inventory_formspec(player, context) + end + end + }) +end + +minetest.register_on_joinplayer(function(player) + creative.update_creative_inventory(player:get_player_name(), minetest.registered_items) +end) + +creative.register_tab("all", "All", minetest.registered_items) +creative.register_tab("nodes", "Nodes", minetest.registered_nodes) +creative.register_tab("tools", "Tools", minetest.registered_tools) +creative.register_tab("craftitems", "Items", minetest.registered_craftitems) + +local old_homepage_name = sfinv.get_homepage_name +function sfinv.get_homepage_name(player) + if creative.is_enabled_for(player:get_player_name()) then + return "creative:all" + else + return old_homepage_name(player) + end +end diff --git a/mods/creative/license.txt b/mods/creative/license.txt new file mode 100644 index 00000000..4ad1d5ff --- /dev/null +++ b/mods/creative/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2016 Jean-Patrick G. (kilbith) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/default/aliases.lua b/mods/default/aliases.lua index 1259ac0e..6db3fc8d 100644 --- a/mods/default/aliases.lua +++ b/mods/default/aliases.lua @@ -22,7 +22,7 @@ minetest.register_alias("papyrus", "default:papyrus") minetest.register_alias("bookshelf", "default:bookshelf") minetest.register_alias("glass", "default:glass") minetest.register_alias("wooden_fence", "default:fence_wood") -minetest.register_alias("rail", "default:rail") +minetest.register_alias("rail", "carts:rail") minetest.register_alias("ladder", "default:ladder_wood") minetest.register_alias("wood", "default:wood") minetest.register_alias("mese", "default:mese") diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index 7ce62d2b..50ffb1ae 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -35,6 +35,20 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = 'default:wood', + recipe = { + {'default:bush_stem'}, + } +}) + +minetest.register_craft({ + output = 'default:acacia_wood', + recipe = { + {'default:acacia_bush_stem'}, + } +}) + minetest.register_craft({ output = 'default:stick 4', recipe = { @@ -339,11 +353,9 @@ minetest.register_craft({ }) minetest.register_craft({ - output = 'default:rail 24', + output = 'default:skeleton_key', recipe = { - {'default:steel_ingot', '', 'default:steel_ingot'}, - {'default:steel_ingot', 'group:stick', 'default:steel_ingot'}, - {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:gold_ingot'}, } }) @@ -380,12 +392,6 @@ minetest.register_craft({ } }) -minetest.register_craft({ - type = "shapeless", - output = "default:bronze_ingot", - recipe = {"default:steel_ingot", "default:copper_ingot"}, -}) - minetest.register_craft({ output = 'default:coalblock', recipe = { @@ -434,6 +440,31 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "default:tinblock", + recipe = { + {"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"}, + {"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"}, + {"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"}, + } +}) + +minetest.register_craft({ + output = "default:tin_ingot 9", + recipe = { + {"default:tinblock"}, + } +}) + +minetest.register_craft({ + output = "default:bronze_ingot 9", + recipe = { + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "default:tin_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + } +}) + minetest.register_craft({ output = 'default:bronzeblock', recipe = { @@ -483,34 +514,98 @@ minetest.register_craft({ }) minetest.register_craft({ - output = 'default:sandstone', + output = "default:sandstone", recipe = { - {'group:sand', 'group:sand'}, - {'group:sand', 'group:sand'}, + {"default:sand", "default:sand"}, + {"default:sand", "default:sand"}, } }) minetest.register_craft({ - output = 'default:sand 4', + output = "default:sand 4", recipe = { - {'default:sandstone'}, + {"default:sandstone"}, } }) minetest.register_craft({ - output = 'default:sandstonebrick 4', + output = "default:sandstonebrick 4", recipe = { - {'default:sandstone', 'default:sandstone'}, - {'default:sandstone', 'default:sandstone'}, + {"default:sandstone", "default:sandstone"}, + {"default:sandstone", "default:sandstone"}, } }) minetest.register_craft({ - output = 'default:sandstone_block 9', + output = "default:sandstone_block 9", recipe = { - {'default:sandstone', 'default:sandstone', 'default:sandstone'}, - {'default:sandstone', 'default:sandstone', 'default:sandstone'}, - {'default:sandstone', 'default:sandstone', 'default:sandstone'}, + {"default:sandstone", "default:sandstone", "default:sandstone"}, + {"default:sandstone", "default:sandstone", "default:sandstone"}, + {"default:sandstone", "default:sandstone", "default:sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:desert_sandstone", + recipe = { + {"default:desert_sand", "default:desert_sand"}, + {"default:desert_sand", "default:desert_sand"}, + } +}) + +minetest.register_craft({ + output = "default:desert_sand 4", + recipe = { + {"default:desert_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:desert_sandstone_brick 4", + recipe = { + {"default:desert_sandstone", "default:desert_sandstone"}, + {"default:desert_sandstone", "default:desert_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:desert_sandstone_block 9", + recipe = { + {"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"}, + {"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"}, + {"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:silver_sandstone", + recipe = { + {"default:silver_sand", "default:silver_sand"}, + {"default:silver_sand", "default:silver_sand"}, + } +}) + +minetest.register_craft({ + output = "default:silver_sand 4", + recipe = { + {"default:silver_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:silver_sandstone_brick 4", + recipe = { + {"default:silver_sandstone", "default:silver_sandstone"}, + {"default:silver_sandstone", "default:silver_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:silver_sandstone_block 9", + recipe = { + {"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"}, + {"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"}, + {"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"}, } }) @@ -570,11 +665,11 @@ minetest.register_craft({ }) minetest.register_craft({ - output = 'default:ladder_wood 3', + output = "default:ladder_wood 5", recipe = { - {'group:stick', '', 'group:stick'}, - {'group:stick', 'group:stick', 'group:stick'}, - {'group:stick', '', 'group:stick'}, + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + {"group:stick", "", "group:stick"}, } }) @@ -620,10 +715,19 @@ minetest.register_craft({ }) minetest.register_craft({ - output = 'default:meselamp 1', + output = 'default:meselamp', recipe = { - {'', 'default:mese_crystal',''}, - {'default:mese_crystal', 'default:glass', 'default:mese_crystal'}, + {'default:glass'}, + {'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = "default:mese_post_light 3", + recipe = { + {"", "default:glass", ""}, + {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"}, + {"", "group:wood", ""}, } }) @@ -764,6 +868,12 @@ minetest.register_craft({ recipe = "default:copper_lump", }) +minetest.register_craft({ + type = "cooking", + output = "default:tin_ingot", + recipe = "default:tin_lump", +}) + minetest.register_craft({ type = "cooking", output = "default:gold_ingot", @@ -776,6 +886,20 @@ minetest.register_craft({ recipe = "default:clay_lump", }) +minetest.register_craft({ + type = 'cooking', + output = 'default:gold_ingot', + recipe = 'default:skeleton_key', + cooktime = 5, +}) + +minetest.register_craft({ + type = 'cooking', + output = 'default:gold_ingot', + recipe = 'default:key', + cooktime = 5, +}) + -- -- Fuels -- @@ -867,6 +991,18 @@ minetest.register_craft({ burntime = 10, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:bush_sapling", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_bush_sapling", + burntime = 7, +}) + minetest.register_craft({ type = "fuel", recipe = "default:aspen_sapling", @@ -901,34 +1037,46 @@ minetest.register_craft({ minetest.register_craft({ type = "fuel", recipe = "default:fence_aspen_wood", - burntime = 11, + burntime = 5, }) minetest.register_craft({ type = "fuel", recipe = "default:fence_pine_wood", - burntime = 13, + burntime = 6, }) minetest.register_craft({ type = "fuel", recipe = "default:fence_wood", - burntime = 15, + burntime = 7, }) minetest.register_craft({ type = "fuel", recipe = "default:fence_acacia_wood", - burntime = 17, + burntime = 8, }) minetest.register_craft({ type = "fuel", recipe = "default:fence_junglewood", - burntime = 19, + burntime = 9, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:bush_stem", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_bush_stem", + burntime = 8, +}) + minetest.register_craft({ type = "fuel", recipe = "default:junglegrass", @@ -962,7 +1110,7 @@ minetest.register_craft({ minetest.register_craft({ type = "fuel", recipe = "default:ladder_wood", - burntime = 5, + burntime = 2, }) minetest.register_craft({ @@ -1024,3 +1172,58 @@ minetest.register_craft({ recipe = "default:dry_grass_1", burntime = 2, }) + +minetest.register_craft({ + type = "fuel", + recipe = "default:paper", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:book", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:book_written", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:dry_shrub", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "group:stick", + burntime = 1, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:pick_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:shovel_wood", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:axe_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sword_wood", + burntime = 5, +}) diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua index 0c51c713..33cdd5f6 100644 --- a/mods/default/craftitems.lua +++ b/mods/default/craftitems.lua @@ -12,14 +12,23 @@ minetest.register_craftitem("default:paper", { groups = {flammable = 3}, }) + local lpp = 14 -- Lines per book's page local function book_on_use(itemstack, user) local player_name = user:get_player_name() - local data = minetest.deserialize(itemstack:get_metadata()) + local meta = itemstack:get_meta() local title, text, owner = "", "", player_name local page, page_max, lines, string = 1, 1, {}, "" - if data then + -- Backwards compatibility + local old_data = minetest.deserialize(itemstack:get_metadata()) + if old_data then + meta:from_table({ fields = old_data }) + end + + local data = meta:to_table().fields + + if data.owner then title = data.title text = data.text owner = data.owner @@ -63,6 +72,7 @@ local function book_on_use(itemstack, user) end minetest.show_formspec(player_name, "default:book", formspec) + return itemstack end minetest.register_on_player_receive_fields(function(player, formname, fields) @@ -81,35 +91,42 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) new_stack = ItemStack("default:book_written") end else - data = minetest.deserialize(stack:get_metadata()) + data = stack:get_meta():to_table().fields + end + + if data and data.owner and data.owner ~= player:get_player_name() then + return end if not data then data = {} end data.title = fields.title + data.owner = player:get_player_name() + data.description = "\""..fields.title.."\" by "..data.owner data.text = fields.text data.text_len = #data.text data.page = 1 data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp) - data.owner = player:get_player_name() - local data_str = minetest.serialize(data) if new_stack then - new_stack:set_metadata(data_str) + new_stack:get_meta():from_table({ fields = data }) 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) + stack:get_meta():from_table({ fields = data }) end elseif fields.book_next or fields.book_prev then - local data = minetest.deserialize(stack:get_metadata()) + local data = stack:get_meta():to_table().fields if not data or not data.page then return end + data.page = tonumber(data.page) + data.page_max = tonumber(data.page_max) + if fields.book_next then data.page = data.page + 1 if data.page > data.page_max then @@ -122,11 +139,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end - local data_str = minetest.serialize(data) - stack:set_metadata(data_str) - book_on_use(stack, player) + stack:get_meta():from_table({fields = data}) + stack = book_on_use(stack, player) end + -- Update stack player:set_wielded_item(stack) end) @@ -167,13 +184,69 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv if not original then return end - local copymeta = original:get_metadata() + local copymeta = original:get_meta():to_table() -- copy of the book held by player's mouse cursor - itemstack:set_metadata(copymeta) + itemstack:get_meta():from_table(copymeta) -- put the book with metadata back in the craft grid craft_inv:set_stack("craft", index, original) end) +minetest.register_craftitem("default:skeleton_key", { + description = "Skeleton Key", + inventory_image = "default_key_skeleton.png", + groups = {key = 1}, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local pos = pointed_thing.under + local node = minetest.get_node(pos) + + if not node then + return itemstack + end + + local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use + if not on_skeleton_key_use then + return itemstack + end + + -- make a new key secret in case the node callback needs it + local random = math.random + local newsecret = string.format( + "%04x%04x%04x%04x", + random(2^16) - 1, random(2^16) - 1, + random(2^16) - 1, random(2^16) - 1) + + local secret, _, _ = on_skeleton_key_use(pos, user, newsecret) + + if secret then + local inv = minetest.get_inventory({type="player", name=user:get_player_name()}) + + -- update original itemstack + itemstack:take_item() + + -- finish and return the new key + local new_stack = ItemStack("default:key") + local meta = new_stack:get_meta() + meta:set_string("secret", secret) + meta:set_string("description", "Key to "..user:get_player_name().."'s " + ..minetest.registered_nodes[node.name].description) + + if itemstack:get_count() == 0 then + itemstack = new_stack + else + if inv:add_item("main", new_stack):get_count() > 0 then + minetest.add_item(user:getpos(), new_stack) + end -- else: added to inventory successfully + end + + return itemstack + end + end +}) + minetest.register_craftitem("default:coal_lump", { description = "Coal Lump", inventory_image = "default_coal_lump.png", @@ -190,6 +263,11 @@ minetest.register_craftitem("default:copper_lump", { inventory_image = "default_copper_lump.png", }) +minetest.register_craftitem("default:tin_lump", { + description = "Tin Lump", + inventory_image = "default_tin_lump.png", +}) + minetest.register_craftitem("default:mese_crystal", { description = "Mese Crystal", inventory_image = "default_mese_crystal.png", @@ -220,6 +298,11 @@ minetest.register_craftitem("default:copper_ingot", { inventory_image = "default_copper_ingot.png", }) +minetest.register_craftitem("default:tin_ingot", { + description = "Tin Ingot", + inventory_image = "default_tin_ingot.png", +}) + minetest.register_craftitem("default:bronze_ingot", { description = "Bronze Ingot", inventory_image = "default_bronze_ingot.png", @@ -249,4 +332,3 @@ minetest.register_craftitem("default:flint", { description = "Flint", inventory_image = "default_flint.png" }) - diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 429ce9fe..5dc22cab 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -18,7 +18,7 @@ end function default.node_sound_stone_defaults(table) table = table or {} table.footstep = table.footstep or - {name = "default_hard_footstep", gain = 0.5} + {name = "default_hard_footstep", gain = 0.3} table.dug = table.dug or {name = "default_hard_footstep", gain = 1.0} default.node_sound_defaults(table) @@ -28,9 +28,9 @@ end function default.node_sound_dirt_defaults(table) table = table or {} table.footstep = table.footstep or - {name = "default_dirt_footstep", gain = 1.0} + {name = "default_dirt_footstep", gain = 0.4} table.dug = table.dug or - {name = "default_dirt_footstep", gain = 1.5} + {name = "default_dirt_footstep", gain = 1.0} table.place = table.place or {name = "default_place_node", gain = 1.0} default.node_sound_defaults(table) @@ -52,7 +52,7 @@ end function default.node_sound_gravel_defaults(table) table = table or {} table.footstep = table.footstep or - {name = "default_gravel_footstep", gain = 0.5} + {name = "default_gravel_footstep", gain = 0.4} table.dug = table.dug or {name = "default_gravel_footstep", gain = 1.0} table.place = table.place or @@ -64,7 +64,7 @@ end function default.node_sound_wood_defaults(table) table = table or {} table.footstep = table.footstep or - {name = "default_wood_footstep", gain = 0.5} + {name = "default_wood_footstep", gain = 0.3} table.dug = table.dug or {name = "default_wood_footstep", gain = 1.0} default.node_sound_defaults(table) @@ -74,11 +74,9 @@ end function default.node_sound_leaves_defaults(table) table = table or {} table.footstep = table.footstep or - {name = "default_grass_footstep", gain = 0.35} + {name = "default_grass_footstep", gain = 0.45} 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) @@ -88,6 +86,8 @@ end function default.node_sound_glass_defaults(table) table = table or {} table.footstep = table.footstep or + {name = "default_glass_footstep", gain = 0.3} + table.dig = table.dig or {name = "default_glass_footstep", gain = 0.5} table.dug = table.dug or {name = "default_break_glass", gain = 1.0} @@ -98,7 +98,7 @@ end function default.node_sound_metal_defaults(table) table = table or {} table.footstep = table.footstep or - {name = "default_metal_footstep", gain = 0.5} + {name = "default_metal_footstep", gain = 0.4} table.dig = table.dig or {name = "default_dig_metal", gain = 0.5} table.dug = table.dug or @@ -109,6 +109,14 @@ function default.node_sound_metal_defaults(table) return table end +function default.node_sound_water_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_water_footstep", gain = 0.2} + default.node_sound_defaults(table) + return table +end + -- -- Lavacooling -- @@ -123,18 +131,17 @@ default.cool_lava = function(pos, node) {pos = pos, max_hear_distance = 16, gain = 0.25}) end -minetest.register_abm({ - label = "Lava cooling", - nodenames = {"default:lava_source", "default:lava_flowing"}, - neighbors = {"group:water"}, - interval = 1, - chance = 1, - catch_up = false, - action = function(...) - default.cool_lava(...) - end, -}) - +if minetest.settings:get_bool("enable_lavacooling") ~= false then + minetest.register_abm({ + label = "Lava cooling", + nodenames = {"default:lava_source", "default:lava_flowing"}, + neighbors = {"group:cools_lava", "group:water"}, + interval = 1, + chance = 2, + catch_up = false, + action = default.cool_lava, + }) +end -- -- optimized helper to put all items in an inventory into a drops list @@ -176,6 +183,9 @@ function default.grow_cactus(pos, node) if height == 4 or node.name ~= "air" then return end + if minetest.get_node_light(pos) < 13 then + return + end minetest.set_node(pos, {name = "default:cactus"}) return true end @@ -199,6 +209,9 @@ function default.grow_papyrus(pos, node) if height == 4 or node.name ~= "air" then return end + if minetest.get_node_light(pos) < 13 then + return + end minetest.set_node(pos, {name = "default:papyrus"}) return true end @@ -209,9 +222,7 @@ minetest.register_abm({ neighbors = {"group:sand"}, interval = 12, chance = 83, - action = function(...) - default.grow_cactus(...) - end + action = default.grow_cactus }) minetest.register_abm({ @@ -220,9 +231,7 @@ minetest.register_abm({ neighbors = {"default:dirt", "default:dirt_with_grass"}, interval = 14, chance = 71, - action = function(...) - default.grow_papyrus(...) - end + action = default.grow_papyrus }) @@ -311,47 +320,65 @@ default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) end end --- Leafdecay ABM - -minetest.register_abm({ - label = "Leaf decay", - nodenames = {"group:leafdecay"}, - neighbors = {"air"}, - interval = 2, - chance = 10, - catch_up = false, - - action = function(pos, node, _, _) - -- Check if leaf is placed - if node.param2 ~= 0 then - return +-- Leafdecay +local function leafdecay_after_destruct(pos, oldnode, def) + for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius), + vector.add(pos, def.radius), def.leaves)) do + local node = minetest.get_node(v) + local timer = minetest.get_node_timer(v) + if node.param2 == 0 and not timer:is_started() then + timer:start(math.random(20, 120) / 10) end + end +end - local rad = minetest.registered_nodes[node.name].groups.leafdecay - -- Assume ignore is a trunk, to make this - -- work at the border of a loaded area - if minetest.find_node_near(pos, rad, {"ignore", "group:tree"}) then - return - end - -- Drop stuff - local itemstacks = minetest.get_node_drops(node.name) - for _, itemname in ipairs(itemstacks) do - if itemname ~= node.name or - minetest.get_item_group(node.name, "leafdecay_drop") ~= 0 then - local p_drop = { - x = pos.x - 0.5 + math.random(), - y = pos.y - 0.5 + math.random(), - z = pos.z - 0.5 + math.random(), - } - minetest.add_item(p_drop, itemname) +local function leafdecay_on_timer(pos, def) + if minetest.find_node_near(pos, def.radius, def.trunks) then + return false + end + + local node = minetest.get_node(pos) + local drops = minetest.get_node_drops(node.name) + for _, item in ipairs(drops) do + local is_leaf + for _, v in pairs(def.leaves) do + if v == item then + is_leaf = true end end - -- Remove node - minetest.remove_node(pos) - nodeupdate(pos) + if minetest.get_item_group(item, "leafdecay_drop") ~= 0 or + not is_leaf then + minetest.add_item({ + x = pos.x - 0.5 + math.random(), + y = pos.y - 0.5 + math.random(), + z = pos.z - 0.5 + math.random(), + }, item) + end end -}) + minetest.remove_node(pos) + minetest.check_for_falling(pos) +end + +function default.register_leafdecay(def) + assert(def.leaves) + assert(def.trunks) + assert(def.radius) + for _, v in pairs(def.trunks) do + minetest.override_item(v, { + after_destruct = function(pos, oldnode) + leafdecay_after_destruct(pos, oldnode, def) + end, + }) + end + for _, v in pairs(def.leaves) do + minetest.override_item(v, { + on_timer = function(pos) + leafdecay_on_timer(pos, def) + end, + }) + end +end -- -- Convert dirt to something that fits the environment @@ -429,7 +456,7 @@ minetest.register_abm({ minetest.register_abm({ label = "Moss growth", - nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble"}, + nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble", "walls:cobble"}, neighbors = {"group:water"}, interval = 16, chance = 200, @@ -441,6 +468,8 @@ minetest.register_abm({ minetest.set_node(pos, {name = "stairs:slab_mossycobble", param2 = node.param2}) elseif node.name == "stairs:stair_cobble" then minetest.set_node(pos, {name = "stairs:stair_mossycobble", param2 = node.param2}) + elseif node.name == "walls:cobble" then + minetest.set_node(pos, {name = "walls:mossycobble", param2 = node.param2}) end end }) @@ -500,3 +529,46 @@ minetest.register_abm({ minetest.set_node(pos, {name = "default:coral_skeleton"}) end, }) + + +-- +-- NOTICE: This method is not an official part of the API yet! +-- This method may change in future. +-- + +function default.can_interact_with_node(player, pos) + if player then + if minetest.check_player_privs(player, "protection_bypass") then + return true + end + else + return false + end + + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + + if not owner or owner == "" or owner == player:get_player_name() then + return true + end + + -- is player wielding the right key? + local item = player:get_wielded_item() + if item:get_name() == "default:key" then + local key_meta = item:get_meta() + + if key_meta:get_string("secret") == "" then + local key_oldmeta = item:get_metadata() + if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then + return false + end + + key_meta:set_string("secret", minetest.parse_json(key_oldmeta).secret) + item:set_metadata("") + end + + return meta:get_string("key_lock_secret") == key_meta:get_string("secret") + end + + return false +end diff --git a/mods/default/furnace.lua b/mods/default/furnace.lua index 17c9280d..4b822058 100644 --- a/mods/default/furnace.lua +++ b/mods/default/furnace.lua @@ -4,7 +4,7 @@ -- local function active_formspec(fuel_percent, item_percent) - local formspec = + local formspec = "size[8,8.5]".. default.gui_bg.. default.gui_bg_img.. @@ -22,6 +22,8 @@ local function active_formspec(fuel_percent, item_percent) "listring[current_player;main]".. "listring[current_name;src]".. "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_player;main]".. default.get_hotbar_bg(0, 4.25) return formspec end @@ -42,6 +44,8 @@ local inactive_formspec = "listring[current_player;main]".. "listring[current_name;src]".. "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_player;main]".. default.get_hotbar_bg(0, 4.25) -- @@ -109,62 +113,78 @@ local function furnace_node_timer(pos, elapsed) local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 local inv = meta:get_inventory() - local srclist = inv:get_list("src") - local fuellist = inv:get_list("fuel") + local srclist, fuellist - -- - -- Cooking - -- + local cookable, cooked + local fuel - -- Check if we have cookable content - local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - local cookable = true + local update = true + while update do + update = false - if cooked.time == 0 then - cookable = false - end + srclist = inv:get_list("src") + fuellist = inv:get_list("fuel") - -- Check if we have enough fuel to burn - if fuel_time < fuel_totaltime then - -- The furnace is currently active and has enough fuel - fuel_time = fuel_time + 1 + -- + -- Cooking + -- - -- If there is a cookable item then check if it is ready yet - if cookable then - src_time = src_time + 1 - if src_time >= cooked.time then - -- Place result in dst list if possible - if inv:room_for_item("dst", cooked.item) then - inv:add_item("dst", cooked.item) - inv:set_stack("src", 1, aftercooked.items[1]) - src_time = 0 + -- Check if we have cookable content + local aftercooked + cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + cookable = cooked.time ~= 0 + + -- Check if we have enough fuel to burn + if fuel_time < fuel_totaltime then + -- The furnace is currently active and has enough fuel + fuel_time = fuel_time + elapsed + -- If there is a cookable item then check if it is ready yet + if cookable then + src_time = src_time + elapsed + if src_time >= cooked.time then + -- Place result in dst list if possible + if inv:room_for_item("dst", cooked.item) then + inv:add_item("dst", cooked.item) + inv:set_stack("src", 1, aftercooked.items[1]) + src_time = src_time - cooked.time + update = true + end end end - end - else - -- Furnace ran out of fuel - if cookable then - -- We need to get new fuel - local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) - - if fuel.time == 0 then - -- No valid fuel in fuel list - fuel_totaltime = 0 - fuel_time = 0 - src_time = 0 - else - -- Take fuel from fuel list - inv:set_stack("fuel", 1, afterfuel.items[1]) - - fuel_totaltime = fuel.time - fuel_time = 0 - end else - -- We don't need to get new fuel since there is no cookable item - fuel_totaltime = 0 + -- Furnace ran out of fuel + if cookable then + -- We need to get new fuel + local afterfuel + fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + + if fuel.time == 0 then + -- No valid fuel in fuel list + fuel_totaltime = 0 + src_time = 0 + else + -- Take fuel from fuel list + inv:set_stack("fuel", 1, afterfuel.items[1]) + update = true + fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) + src_time = src_time + elapsed + end + else + -- We don't need to get new fuel since there is no cookable item + fuel_totaltime = 0 + src_time = 0 + end fuel_time = 0 - src_time = 0 end + + elapsed = 0 + end + + if fuel and fuel_totaltime > fuel.time then + fuel_totaltime = fuel.time + end + if srclist[1]:is_empty() then + src_time = 0 end -- @@ -192,7 +212,7 @@ local function furnace_node_timer(pos, elapsed) local active = "inactive " local result = false - if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then + if fuel_totaltime ~= 0 then active = "active " local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) fuel_state = fuel_percent .. "%" @@ -206,8 +226,7 @@ local function furnace_node_timer(pos, elapsed) end swap_node(pos, "default:furnace") -- stop timer on the inactive furnace - local timer = minetest.get_node_timer(pos) - timer:stop() + minetest.get_node_timer(pos):stop() end local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" @@ -255,13 +274,11 @@ minetest.register_node("default:furnace", { end, on_metadata_inventory_move = function(pos) - local timer = minetest.get_node_timer(pos) - timer:start(1.0) + minetest.get_node_timer(pos):start(1.0) end, on_metadata_inventory_put = function(pos) -- start timer function, it will sort out whether furnace can burn or not. - local timer = minetest.get_node_timer(pos) - timer:start(1.0) + minetest.get_node_timer(pos):start(1.0) end, on_blast = function(pos) local drops = {} diff --git a/mods/default/init.lua b/mods/default/init.lua index 08e9efe4..7b5f62f3 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -41,6 +41,7 @@ dofile(default_path.."/functions.lua") dofile(default_path.."/trees.lua") dofile(default_path.."/nodes.lua") dofile(default_path.."/furnace.lua") +dofile(default_path.."/torch.lua") dofile(default_path.."/tools.lua") dofile(default_path.."/item_entity.lua") dofile(default_path.."/craftitems.lua") diff --git a/mods/default/license.txt b/mods/default/license.txt index 137923c8..72af7284 100644 --- a/mods/default/license.txt +++ b/mods/default/license.txt @@ -41,6 +41,9 @@ Copyright (C) 2010-2016: asl97 KevDoy Mito551 + GreenXenith + kaeza + kilbith You are free to: Share — copy and redistribute the material in any medium or format. @@ -144,6 +147,9 @@ Copyright (C) 2009 cmusounddesign Copyright (C) 2010 Tomlija Copyright (C) 2010 lsprice Copyright (C) 2014 sonictechtonic +Copyright (C) 2015 yadronoff +Copyright (C) 2007 HerbertBoland +Copyright (C) 2006 AGFX You are free to: Share — copy and redistribute the material in any medium or format. diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua index 52aa294c..1305226a 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -1,5 +1,5 @@ -- --- Aliases for map generator outputs +-- Aliases for map generators -- minetest.register_alias("mapgen_stone", "default:stone") @@ -34,17 +34,21 @@ 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_stair_desert_stone", "stairs:stair_desert_stone") minetest.register_alias("mapgen_sandstonebrick", "default:sandstonebrick") -minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstonebrick") +minetest.register_alias("mapgen_stair_sandstone_block", "stairs:stair_sandstone_block") -- -- Register ores -- -function default.register_ores() - -- Blob ores - -- These first to avoid other ores in blobs +-- Blob ores +-- These first to avoid other ores in blobs + +-- Mgv6 + +function default.register_mgv6_blob_ores() -- Clay -- This first to avoid clay in sand blobs @@ -73,8 +77,7 @@ function default.register_ores() minetest.register_ore({ ore_type = "blob", ore = "default:sand", - wherein = {"default:stone", "default:sandstone", - "default:desert_stone"}, + wherein = {"default:stone", "default:desert_stone"}, clust_scarcity = 16 * 16 * 16, clust_size = 5, y_min = -31, @@ -131,8 +134,123 @@ function default.register_ores() persist = 0.0 }, }) +end - -- Scatter ores + +-- All mapgens except mgv6 + +function default.register_blob_ores() + + -- Clay + + minetest.register_ore({ + ore_type = "blob", + ore = "default:clay", + wherein = {"default:sand"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -15, + y_max = 0, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = -316, + octaves = 1, + persist = 0.0 + }, + }) + + -- Silver sand + + minetest.register_ore({ + ore_type = "blob", + ore = "default:silver_sand", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31000, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 2316, + octaves = 1, + persist = 0.0 + }, + biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean", + "taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean", + "grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest", + "coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest", + "deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert", + "cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean", + "rainforest", "rainforest_swamp", "rainforest_ocean", "underground", + "floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"} + }) + + -- Dirt + + minetest.register_ore({ + ore_type = "blob", + ore = "default:dirt", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 17676, + octaves = 1, + persist = 0.0 + }, + biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest", + "deciduous_forest", "deciduous_forest_shore", "savanna", "savanna_shore", + "rainforest", "rainforest_swamp", "floatland_grassland", + "floatland_coniferous_forest"} + }) + + -- Gravel + + minetest.register_ore({ + ore_type = "blob", + ore = "default:gravel", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31000, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 766, + octaves = 1, + persist = 0.0 + }, + biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean", + "taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean", + "grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest", + "coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest", + "deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert", + "cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean", + "rainforest", "rainforest_swamp", "rainforest_ocean", "underground", + "floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"} + }) +end + + +-- Scatter ores +-- All mapgens + +function default.register_ores() -- Coal @@ -239,6 +357,41 @@ function default.register_ores() y_max = -64, }) + -- Tin + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_tin", + wherein = "default:stone", + clust_scarcity = 10 * 10 * 10, + clust_num_ores = 5, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_tin", + wherein = "default:stone", + clust_scarcity = 13 * 13 * 13, + clust_num_ores = 4, + clust_size = 3, + y_min = -127, + y_max = -32, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_tin", + wherein = "default:stone", + clust_scarcity = 10 * 10 * 10, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -128, + }) + -- Gold minetest.register_ore({ @@ -374,15 +527,14 @@ end -- Register biomes -- --- All mapgens except mgv6 and singlenode +-- All mapgens except mgv6 -function default.register_biomes() - minetest.clear_registered_biomes() +function default.register_biomes(upper_limit) - -- Permanent ice + -- Icesheet minetest.register_biome({ - name = "glacier", + name = "icesheet", node_dust = "default:snowblock", node_top = "default:snowblock", depth_top = 1, @@ -396,38 +548,38 @@ function default.register_biomes() node_riverbed = "default:gravel", depth_riverbed = 2, y_min = -8, - y_max = 31000, + y_max = upper_limit, heat_point = 0, - humidity_point = 50, + humidity_point = 73, }) minetest.register_biome({ - name = "glacier_ocean", + name = "icesheet_ocean", node_dust = "default:snowblock", node_top = "default:sand", depth_top = 1, node_filler = "default:sand", depth_filler = 3, --node_stone = "", - --node_water_top = "", - --depth_water_top = , + node_water_top = "default:ice", + depth_water_top = 10, --node_water = "", --node_river_water = "", y_min = -112, y_max = -9, heat_point = 0, - humidity_point = 50, + humidity_point = 73, }) - -- Cold + -- Tundra minetest.register_biome({ name = "tundra", - --node_dust = "", - node_top = "default:dirt_with_snow", - depth_top = 1, - node_filler = "default:dirt", - depth_filler = 1, + node_dust = "default:snowblock", + --node_top = , + --depth_top = , + --node_filler = , + --depth_filler = , --node_stone = "", --node_water_top = "", --depth_water_top = , @@ -436,9 +588,9 @@ function default.register_biomes() node_riverbed = "default:gravel", depth_riverbed = 2, y_min = 2, - y_max = 31000, - heat_point = 15, - humidity_point = 35, + y_max = upper_limit, + heat_point = 0, + humidity_point = 40, }) minetest.register_biome({ @@ -457,8 +609,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = -3, y_max = 1, - heat_point = 15, - humidity_point = 35, + heat_point = 0, + humidity_point = 40, }) minetest.register_biome({ @@ -477,10 +629,11 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = -4, - heat_point = 15, - humidity_point = 35, + heat_point = 0, + humidity_point = 40, }) + -- Taiga minetest.register_biome({ name = "taiga", @@ -497,9 +650,9 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = 2, - y_max = 31000, - heat_point = 15, - humidity_point = 65, + y_max = upper_limit, + heat_point = 25, + humidity_point = 70, }) minetest.register_biome({ @@ -518,16 +671,16 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = 1, - heat_point = 15, - humidity_point = 65, + heat_point = 25, + humidity_point = 70, }) - -- Temperate + -- Snowy grassland minetest.register_biome({ - name = "stone_grassland", - --node_dust = "", - node_top = "default:dirt_with_grass", + name = "snowy_grassland", + node_dust = "default:snow", + node_top = "default:dirt_with_snow", depth_top = 1, node_filler = "default:dirt", depth_filler = 1, @@ -538,34 +691,14 @@ function default.register_biomes() --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = 6, - y_max = 31000, - heat_point = 40, - humidity_point = 35, - }) - - minetest.register_biome({ - name = "stone_grassland_dunes", - --node_dust = "", - node_top = "default:sand", - depth_top = 1, - node_filler = "default:sand", - depth_filler = 2, - --node_stone = "", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - node_riverbed = "default:sand", - depth_riverbed = 2, y_min = 5, - y_max = 5, - heat_point = 40, + y_max = upper_limit, + heat_point = 20, humidity_point = 35, }) minetest.register_biome({ - name = "stone_grassland_ocean", + name = "snowy_grassland_ocean", --node_dust = "", node_top = "default:sand", depth_top = 1, @@ -580,10 +713,73 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 40, + heat_point = 20, humidity_point = 35, }) + -- Grassland + + minetest.register_biome({ + name = "grassland", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 6, + y_max = upper_limit, + heat_point = 50, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "grassland_dunes", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 2, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 5, + heat_point = 50, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "grassland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 50, + humidity_point = 35, + }) + + -- Coniferous forest minetest.register_biome({ name = "coniferous_forest", @@ -600,9 +796,9 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = 6, - y_max = 31000, - heat_point = 40, - humidity_point = 65, + y_max = upper_limit, + heat_point = 45, + humidity_point = 70, }) minetest.register_biome({ @@ -621,8 +817,8 @@ function default.register_biomes() depth_riverbed = 2, y_min = 5, y_max = 5, - heat_point = 40, - humidity_point = 65, + heat_point = 45, + humidity_point = 70, }) minetest.register_biome({ @@ -641,71 +837,11 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 40, - humidity_point = 65, - }) - - - minetest.register_biome({ - name = "sandstone_grassland", - --node_dust = "", - node_top = "default:dirt_with_grass", - depth_top = 1, - node_filler = "default:dirt", - depth_filler = 1, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - node_riverbed = "default:sand", - depth_riverbed = 2, - y_min = 6, - y_max = 31000, - heat_point = 60, - humidity_point = 35, - }) - - minetest.register_biome({ - name = "sandstone_grassland_dunes", - --node_dust = "", - node_top = "default:sand", - depth_top = 1, - node_filler = "default:sand", - depth_filler = 2, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - node_riverbed = "default:sand", - depth_riverbed = 2, - y_min = 5, - y_max = 5, - heat_point = 60, - humidity_point = 35, - }) - - minetest.register_biome({ - name = "sandstone_grassland_ocean", - --node_dust = "", - node_top = "default:sand", - depth_top = 1, - node_filler = "default:sand", - depth_filler = 3, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - node_riverbed = "default:sand", - depth_riverbed = 2, - y_min = -112, - y_max = 4, - heat_point = 60, - humidity_point = 35, + heat_point = 45, + humidity_point = 70, }) + -- Deciduous forest minetest.register_biome({ name = "deciduous_forest", @@ -722,13 +858,13 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = 1, - y_max = 31000, + y_max = upper_limit, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) minetest.register_biome({ - name = "deciduous_forest_swamp", + name = "deciduous_forest_shore", --node_dust = "", node_top = "default:dirt", depth_top = 1, @@ -741,10 +877,10 @@ function default.register_biomes() --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = -3, + y_min = -1, y_max = 0, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) minetest.register_biome({ @@ -762,12 +898,12 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = -112, - y_max = -4, + y_max = -2, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) - -- Hot + -- Desert minetest.register_biome({ name = "desert", @@ -784,9 +920,9 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = 5, - y_max = 31000, - heat_point = 85, - humidity_point = 20, + y_max = upper_limit, + heat_point = 92, + humidity_point = 16, }) minetest.register_biome({ @@ -805,10 +941,95 @@ function default.register_biomes() depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 85, - humidity_point = 20, + heat_point = 92, + humidity_point = 16, }) + -- Sandstone desert + + minetest.register_biome({ + name = "sandstone_desert", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 1, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 60, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "sandstone_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 60, + humidity_point = 0, + }) + + -- Cold desert + + minetest.register_biome({ + name = "cold_desert", + --node_dust = "", + node_top = "default:silver_sand", + depth_top = 1, + node_filler = "default:silver_sand", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 40, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "cold_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 40, + humidity_point = 0, + }) + + -- Savanna minetest.register_biome({ name = "savanna", @@ -825,13 +1046,13 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = 1, - y_max = 31000, - heat_point = 85, - humidity_point = 50, + y_max = upper_limit, + heat_point = 89, + humidity_point = 42, }) minetest.register_biome({ - name = "savanna_swamp", + name = "savanna_shore", --node_dust = "", node_top = "default:dirt", depth_top = 1, @@ -844,10 +1065,10 @@ function default.register_biomes() --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = -3, + y_min = -1, y_max = 0, - heat_point = 85, - humidity_point = 50, + heat_point = 89, + humidity_point = 42, }) minetest.register_biome({ @@ -865,16 +1086,17 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = -112, - y_max = -4, - heat_point = 85, - humidity_point = 50, + y_max = -2, + heat_point = 89, + humidity_point = 42, }) + -- Rainforest minetest.register_biome({ name = "rainforest", --node_dust = "", - node_top = "default:dirt_with_grass", + node_top = "default:dirt_with_rainforest_litter", depth_top = 1, node_filler = "default:dirt", depth_filler = 3, @@ -886,9 +1108,9 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = 1, - y_max = 31000, - heat_point = 85, - humidity_point = 80, + y_max = upper_limit, + heat_point = 86, + humidity_point = 65, }) minetest.register_biome({ @@ -905,10 +1127,10 @@ function default.register_biomes() --node_river_water = "", node_riverbed = "default:sand", depth_riverbed = 2, - y_min = -3, + y_min = -1, y_max = 0, - heat_point = 85, - humidity_point = 80, + heat_point = 86, + humidity_point = 65, }) minetest.register_biome({ @@ -926,9 +1148,9 @@ function default.register_biomes() node_riverbed = "default:sand", depth_riverbed = 2, y_min = -112, - y_max = -4, - heat_point = 85, - humidity_point = 80, + y_max = -2, + heat_point = 86, + humidity_point = 65, }) -- Underground @@ -953,6 +1175,100 @@ function default.register_biomes() end +-- Biomes for floatlands + +function default.register_floatland_biomes(floatland_level, shadow_limit) + + -- Coniferous forest + + minetest.register_biome({ + name = "floatland_coniferous_forest", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 70, + }) + + -- Grassland + + minetest.register_biome({ + name = "floatland_grassland", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 35, + }) + + -- Sandstone desert + + minetest.register_biome({ + name = "floatland_sandstone_desert", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 1, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 0, + }) + + -- Floatland ocean / underground + + minetest.register_biome({ + name = "floatland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = shadow_limit, + y_max = floatland_level + 1, + heat_point = 50, + humidity_point = 50, + }) +end + + -- -- Register decorations -- @@ -960,7 +1276,6 @@ end -- Mgv6 function default.register_mgv6_decorations() - minetest.clear_registered_decorations() -- Papyrus @@ -1047,7 +1362,8 @@ function default.register_mgv6_decorations() }) end --- All mapgens except mgv6 and singlenode + +-- All mapgens except mgv6 local function register_grass_decoration(offset, scale, length) minetest.register_decoration({ @@ -1062,13 +1378,12 @@ local function register_grass_decoration(offset, scale, length) octaves = 3, persist = 0.6 }, - biomes = {"stone_grassland", "sandstone_grassland", - "deciduous_forest", "coniferous_forest", - "stone_grassland_dunes", "sandstone_grassland_dunes", - "coniferous_forest_dunes"}, + biomes = {"grassland", "grassland_dunes", "deciduous_forest", + "coniferous_forest", "coniferous_forest_dunes", + "floatland_grassland", "floatland_coniferous_forest"}, y_min = 1, y_max = 31000, - decoration = "default:grass_"..length, + decoration = "default:grass_" .. length, }) end @@ -1088,12 +1403,12 @@ local function register_dry_grass_decoration(offset, scale, length) biomes = {"savanna"}, y_min = 1, y_max = 31000, - decoration = "default:dry_grass_"..length, + decoration = "default:dry_grass_" .. length, }) end + function default.register_decorations() - minetest.clear_registered_decorations() -- Apple tree and log @@ -1112,8 +1427,9 @@ function default.register_decorations() biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/apple_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts", flags = "place_center_x, place_center_z", + rotation = "random", }) minetest.register_decoration({ @@ -1131,20 +1447,7 @@ function default.register_decorations() biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:tree", param2 = 12, prob = 191}, - {name = "default:tree", param2 = 12}, - {name = "default:tree", param2 = 12, prob = 127}, - {name = "air", prob = 0}, - {name = "flowers:mushroom_brown", prob = 63}, - {name = "air", prob = 0}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/apple_log.mts", flags = "place_center_x", rotation = "random", }) @@ -1153,39 +1456,26 @@ function default.register_decorations() minetest.register_decoration({ deco_type = "schematic", - place_on = {"default:dirt_with_grass", "default:dirt"}, - sidelen = 80, + place_on = {"default:dirt_with_rainforest_litter", "default:dirt"}, + sidelen = 16, fill_ratio = 0.1, biomes = {"rainforest", "rainforest_swamp"}, - y_min = 0, + y_min = -1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/jungle_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) minetest.register_decoration({ deco_type = "schematic", - place_on = {"default:dirt_with_grass", "default:dirt"}, - sidelen = 80, + place_on = {"default:dirt_with_rainforest_litter", "default:dirt"}, + sidelen = 16, fill_ratio = 0.005, biomes = {"rainforest", "rainforest_swamp"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:jungletree", param2 = 12, prob = 191}, - {name = "default:jungletree", param2 = 12}, - {name = "default:jungletree", param2 = 12, prob = 127}, - {name = "air", prob = 0}, - {name = "flowers:mushroom_brown", prob = 127}, - {name = "air", prob = 0}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/jungle_log.mts", flags = "place_center_x", rotation = "random", }) @@ -1204,10 +1494,10 @@ function default.register_decorations() octaves = 3, persist = 0.66 }, - biomes = {"taiga", "coniferous_forest"}, + biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"}, y_min = 2, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/pine_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts", flags = "place_center_x, place_center_z", }) @@ -1226,20 +1516,7 @@ function default.register_decorations() biomes = {"taiga", "coniferous_forest"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:pine_tree", param2 = 12, prob = 191}, - {name = "default:pine_tree", param2 = 12}, - {name = "default:pine_tree", param2 = 12, prob = 127}, - {name = "air", prob = 0}, - {name = "flowers:mushroom_red", prob = 63}, - {name = "air", prob = 0}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts", flags = "place_center_x", rotation = "random", }) @@ -1261,7 +1538,7 @@ function default.register_decorations() biomes = {"savanna"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/acacia_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) @@ -1281,17 +1558,7 @@ function default.register_decorations() biomes = {"savanna"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 2, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:acacia_tree", param2 = 12, prob = 191}, - {name = "default:acacia_tree", param2 = 12}, - {name = "default:acacia_tree", param2 = 12, prob = 127}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_log.mts", flags = "place_center_x", rotation = "random", }) @@ -1313,7 +1580,7 @@ function default.register_decorations() biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/aspen_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/aspen_tree.mts", flags = "place_center_x, place_center_z", }) @@ -1332,23 +1599,11 @@ function default.register_decorations() biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:aspen_tree", param2 = 12}, - {name = "default:aspen_tree", param2 = 12}, - {name = "default:aspen_tree", param2 = 12, prob = 127}, - {name = "flowers:mushroom_red", prob = 63}, - {name = "flowers:mushroom_brown", prob = 63}, - {name = "air", prob = 0}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/aspen_log.mts", flags = "place_center_x", rotation = "random", }) + -- Large cactus minetest.register_decoration({ @@ -1366,7 +1621,7 @@ function default.register_decorations() biomes = {"desert"}, y_min = 5, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/large_cactus.mts", + schematic = minetest.get_modpath("default") .. "/schematics/large_cactus.mts", flags = "place_center_x", rotation = "random", }) @@ -1407,10 +1662,53 @@ function default.register_decorations() octaves = 3, persist = 0.7 }, - biomes = {"savanna_swamp"}, + biomes = {"savanna_shore"}, y_min = 0, y_max = 0, - schematic = minetest.get_modpath("default").."/schematics/papyrus.mts", + schematic = minetest.get_modpath("default") .. "/schematics/papyrus.mts", + }) + + -- Bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 137, + octaves = 3, + persist = 0.7, + }, + biomes = {"snowy_grassland", "grassland", "deciduous_forest", + "floatland_grassland"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/bush.mts", + flags = "place_center_x, place_center_z", + }) + + -- Acacia bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 90155, + octaves = 3, + persist = 0.7, + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_bush.mts", + flags = "place_center_x, place_center_z", }) -- Grasses @@ -1433,8 +1731,8 @@ function default.register_decorations() minetest.register_decoration({ deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 80, + place_on = {"default:dirt_with_rainforest_litter"}, + sidelen = 16, fill_ratio = 0.1, biomes = {"rainforest"}, y_min = 1, @@ -1446,7 +1744,8 @@ function default.register_decorations() minetest.register_decoration({ deco_type = "simple", - place_on = {"default:desert_sand", "default:dirt_with_snow"}, + place_on = {"default:desert_sand", + "default:sand", "default:silver_sand"}, sidelen = 16, noise_params = { offset = 0, @@ -1456,24 +1755,72 @@ function default.register_decorations() octaves = 3, persist = 0.6 }, - biomes = {"desert", "tundra"}, + biomes = {"desert", "sandstone_desert", "cold_desert"}, y_min = 2, y_max = 31000, decoration = "default:dry_shrub", }) + + -- Coral reef + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:sand"}, + noise_params = { + offset = -0.15, + scale = 0.1, + spread = {x = 100, y = 100, z = 100}, + seed = 7013, + octaves = 3, + persist = 1, + }, + biomes = { + "desert_ocean", + "savanna_ocean", + "rainforest_ocean", + }, + y_min = -8, + y_max = -2, + schematic = minetest.get_modpath("default") .. "/schematics/corals.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) end -- --- Detect mapgen to select functions +-- Detect mapgen, flags and parameters to select functions -- +-- Get setting or default +local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or + "mountains, ridges, nofloatlands" +local captures_float = string.match(mgv7_spflags, "floatlands") +local captures_nofloat = string.match(mgv7_spflags, "nofloatlands") + +local mgv7_floatland_level = minetest.get_mapgen_setting("mgv7_floatland_level") or 1280 +local mgv7_shadow_limit = minetest.get_mapgen_setting("mgv7_shadow_limit") or 1024 + +minetest.clear_registered_biomes() +minetest.clear_registered_ores() +minetest.clear_registered_decorations() + local mg_name = minetest.get_mapgen_setting("mg_name") if mg_name == "v6" then + default.register_mgv6_blob_ores() default.register_ores() default.register_mgv6_decorations() +elseif mg_name == "v7" and captures_float == "floatlands" and + captures_nofloat ~= "nofloatlands" then + -- Mgv7 with floatlands + default.register_biomes(mgv7_shadow_limit - 1) + default.register_floatland_biomes(mgv7_floatland_level, mgv7_shadow_limit) + default.register_blob_ores() + default.register_ores() + default.register_decorations() else - default.register_biomes() + default.register_biomes(31000) + default.register_blob_ores() default.register_ores() default.register_decorations() end diff --git a/mods/default/models/character.b3d b/mods/default/models/character.b3d index 7558e6f8..9ab45436 100644 Binary files a/mods/default/models/character.b3d and b/mods/default/models/character.b3d differ diff --git a/mods/default/models/character.blend b/mods/default/models/character.blend index 7324325a..fca9f659 100644 Binary files a/mods/default/models/character.blend and b/mods/default/models/character.blend differ diff --git a/mods/default/models/chest_open.obj b/mods/default/models/chest_open.obj new file mode 100644 index 00000000..72ba175a --- /dev/null +++ b/mods/default/models/chest_open.obj @@ -0,0 +1,79 @@ +# Blender v2.78 (sub 0) OBJ File: 'chest-open.blend' +# www.blender.org +o Top_Cube.002_None_Top_Cube.002_None_bottom +v -0.500000 0.408471 0.720970 +v -0.500000 1.115578 0.013863 +v -0.500000 0.894607 -0.207108 +v -0.500000 0.187501 0.499999 +v 0.500000 1.115578 0.013863 +v 0.500000 0.408471 0.720970 +v 0.500000 0.187501 0.499999 +v 0.500000 0.894607 -0.207108 +v -0.500000 0.187500 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 0.187500 -0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +vt 0.0000 1.0000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.0000 +vt 0.0000 1.0000 +vt 1.0000 1.0000 +vt 1.0000 0.6875 +vt 0.0000 0.6875 +vt 1.0000 1.0000 +vt 0.0000 0.6875 +vt 1.0000 0.6875 +vt 1.0000 0.6875 +vt 1.0000 0.0000 +vt 0.0000 0.0000 +vt 1.0000 0.6875 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 1.0000 0.6875 +vt 1.0000 0.0000 +vt 0.0000 1.0000 +vt 0.0000 0.6875 +vt 0.0000 0.6875 +vt 0.0000 0.0000 +vt 1.0000 0.5000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.5000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vn 0.0000 0.7071 0.7071 +vn -0.0000 -1.0000 -0.0000 +vn -1.0000 0.0000 0.0000 +vn 1.0000 0.0000 -0.0000 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 0.0000 1.0000 +vn -0.0000 0.7071 -0.7071 +vn -0.0000 0.0000 -1.0000 +vn -0.0000 -0.7071 -0.7071 +vn -0.0000 1.0000 -0.0000 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Top +s off +f 6/1/1 5/2/1 2/3/1 1/4/1 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Bottom +f 11/5/2 10/6/2 14/7/2 13/8/2 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Right-Left +f 1/9/3 2/10/3 3/11/3 4/12/3 +f 5/13/4 6/1/4 7/14/4 8/15/4 +f 4/12/3 9/16/3 10/17/3 11/18/3 +f 12/19/4 7/14/4 13/8/4 14/20/4 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Back +f 6/21/5 1/9/5 4/12/5 7/22/5 +f 7/22/6 4/12/6 11/18/6 13/23/6 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Front +f 2/10/7 5/24/7 8/25/7 3/11/7 +f 9/16/8 12/26/8 14/27/8 10/17/8 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Inside +f 4/28/9 3/29/9 8/30/9 7/31/9 +f 7/31/10 12/32/10 9/33/10 4/28/10 diff --git a/mods/default/models/torch_ceiling.obj b/mods/default/models/torch_ceiling.obj new file mode 100644 index 00000000..ea51f3ce --- /dev/null +++ b/mods/default/models/torch_ceiling.obj @@ -0,0 +1,58 @@ +# Blender v2.77 (sub 0) OBJ File: 'torch_ceiling.blend' +# www.blender.org +mtllib torch_ceiling.mtl +o Cube_Cube.001 +v -0.062469 -0.047331 0.068152 +v -0.062469 -0.559515 -0.164388 +v -0.062469 0.004344 -0.045667 +v -0.062469 -0.507839 -0.278206 +v 0.062531 -0.047331 0.068152 +v 0.062531 -0.559515 -0.164388 +v 0.062531 0.004344 -0.045667 +v 0.062531 -0.507839 -0.278206 +v 0.353584 0.040000 0.363553 +v 0.353584 -0.397500 0.363553 +v -0.353522 0.040000 -0.343553 +v -0.353522 -0.397500 -0.343553 +v 0.353584 0.040000 -0.343553 +v -0.353522 0.040000 0.363553 +v 0.353584 -0.397500 -0.343553 +v -0.353522 -0.397500 0.363553 +vt 0.5625 0.5000 +vt 0.5625 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.5000 +vt 0.4375 0.0000 +vt 0.5625 0.0000 +vt 0.5625 0.1250 +vt 0.4375 0.1250 +vt 0.5625 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.0000 +vt 0.5625 0.6250 +vt 0.5625 0.0000 +vt 1.0000 0.5625 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.5625 +vt 0.0000 0.5625 +vt 1.0000 0.5625 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vn 0.0000 0.9105 0.4134 +vn -0.0000 -0.4134 0.9105 +vn -1.0000 0.0000 0.0000 +vn 0.7071 0.0000 -0.7071 +vn 0.7071 0.0000 0.7071 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/9/2 4/6/2 8/5/2 7/10/2 +f 1/11/3 3/9/3 4/6/3 2/12/3 +f 5/13/2 1/11/2 2/12/2 6/14/2 +f 7/10/3 8/5/3 6/14/3 5/13/3 +usemtl Material.002 +f 9/15/4 10/16/4 12/17/4 11/18/4 +f 13/19/5 14/20/5 16/21/5 15/22/5 diff --git a/mods/default/models/torch_floor.obj b/mods/default/models/torch_floor.obj new file mode 100644 index 00000000..e2487efe --- /dev/null +++ b/mods/default/models/torch_floor.obj @@ -0,0 +1,50 @@ +# Blender v2.76 (sub 11) OBJ File: 'torch_floor.blend' +# www.blender.org +mtllib torch_floor.mtl +o Cube_Cube.001 +v 0.062500 0.062500 -0.062500 +v 0.062500 -0.500000 -0.062500 +v 0.062500 0.062500 0.062500 +v 0.062500 -0.500000 0.062500 +v -0.062500 0.062500 -0.062500 +v -0.062500 -0.500000 -0.062500 +v -0.062500 0.062500 0.062500 +v -0.062500 -0.500000 0.062500 +v -0.353553 -0.500000 0.353553 +v -0.353553 0.500000 0.353553 +v 0.353553 -0.500000 -0.353553 +v 0.353553 0.500000 -0.353553 +v -0.353553 -0.500000 -0.353553 +v 0.353553 -0.500000 0.353553 +v -0.353553 0.500000 -0.353553 +v 0.353553 0.500000 0.353553 +vt 0.562500 0.500000 +vt 0.562500 0.625000 +vt 0.437500 0.625000 +vt 0.437500 0.500000 +vt 0.437500 0.000000 +vt 0.562500 0.000000 +vt 0.562500 0.125000 +vt 0.437500 0.125000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 1.000000 0.000000 0.000000 +vn -0.707100 0.000000 -0.707100 +vn -0.707100 -0.000000 0.707100 +g Cube_Cube.001_Cube_Cube.001_Material.001 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/2/2 4/6/2 8/5/2 7/3/2 +f 1/3/3 3/2/3 4/6/3 2/5/3 +f 5/2/2 1/3/2 2/5/2 6/6/2 +f 7/3/3 8/5/3 6/6/3 5/2/3 +g Cube_Cube.001_Cube_Cube.001_Material.002 +usemtl Material.002 +f 9/9/4 10/10/4 12/11/4 11/12/4 +f 13/12/5 14/9/5 16/10/5 15/11/5 diff --git a/mods/default/models/torch_wall.obj b/mods/default/models/torch_wall.obj new file mode 100644 index 00000000..57baa9e6 --- /dev/null +++ b/mods/default/models/torch_wall.obj @@ -0,0 +1,64 @@ +# Blender v2.76 (sub 11) OBJ File: 'torch_wall.blend' +# www.blender.org +mtllib torch_wall.mtl +o Cube_Cube.001 +v 0.062469 -0.195248 0.023570 +v 0.062469 -0.476498 -0.463570 +v 0.062469 -0.303502 0.086070 +v 0.062469 -0.584752 -0.401070 +v -0.062531 -0.195248 0.023570 +v -0.062531 -0.476498 -0.463570 +v -0.062531 -0.303502 0.086070 +v -0.062531 -0.584752 -0.401070 +v -0.353584 -0.613553 0.022500 +v -0.353584 -0.613553 0.460000 +v 0.353522 0.093553 0.022500 +v 0.353522 0.093553 0.460000 +v -0.353584 0.093553 0.022500 +v 0.353522 -0.613553 0.022500 +v -0.353584 0.093553 0.460000 +v 0.353522 -0.613553 0.460000 +v 0.353553 0.056811 -0.121957 +v 0.353553 -0.224439 -0.609096 +v -0.353553 -0.555561 0.231596 +v -0.353553 -0.836811 -0.255543 +v -0.353553 0.056811 -0.121957 +v -0.353553 -0.224439 -0.609096 +v 0.353553 -0.555561 0.231596 +v 0.353553 -0.836811 -0.255543 +vt 0.562500 0.500000 +vt 0.562500 0.625000 +vt 0.437500 0.625000 +vt 0.437500 0.500000 +vt 0.437500 0.000000 +vt 0.562500 0.000000 +vt 0.562500 0.125000 +vt 0.437500 0.125000 +vt 0.000000 0.562500 +vt 0.000000 -0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.562500 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn -0.000000 0.500000 0.866000 +vn -0.000000 0.866000 -0.500000 +vn 1.000000 0.000000 0.000000 +vn -0.707100 0.612400 -0.353600 +vn -0.707100 -0.612400 0.353600 +vn -0.707100 0.707100 -0.000000 +vn -0.707100 -0.707100 -0.000000 +g Cube_Cube.001_Cube_Cube.001_Material.001 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/2/2 4/6/2 8/5/2 7/3/2 +f 1/3/3 3/2/3 4/6/3 2/5/3 +f 5/2/2 1/3/2 2/5/2 6/6/2 +f 7/3/3 8/5/3 6/6/3 5/2/3 +f 17/9/4 18/10/4 20/11/4 19/12/4 +f 21/9/5 22/10/5 24/11/5 23/12/5 +g Cube_Cube.001_Cube_Cube.001_Material.002 +usemtl Material.002 +f 9/12/6 10/13/6 12/14/6 11/9/6 +f 13/9/7 14/12/7 16/13/7 15/14/7 diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index f14d0e9d..f14e8b21 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -30,6 +30,12 @@ default:desert_stone_block default:sandstone default:sandstonebrick default:sandstone_block +default:desert_sandstone +default:desert_sandstone_brick +default:desert_sandstone_block +default:silver_sandstone +default:silver_sandstone_brick +default:silver_sandstone_block default:obsidian default:obsidianbrick @@ -44,6 +50,7 @@ default:dirt_with_grass default:dirt_with_grass_footsteps default:dirt_with_dry_grass default:dirt_with_snow +default:dirt_with_rainforest_litter default:sand default:desert_sand @@ -100,6 +107,10 @@ default:steelblock default:stone_with_copper default:copperblock + +default:stone_with_tin +default:tinblock + default:bronzeblock default:stone_with_gold @@ -131,6 +142,13 @@ default:dry_grass_3 default:dry_grass_4 default:dry_grass_5 +default:bush_stem +default:bush_leaves +default:bush_sapling +default:acacia_bush_stem +default:acacia_bush_leaves +default:acacia_bush_sapling + Corals ------ @@ -154,8 +172,6 @@ default:lava_flowing Tools / "Advanced" crafting / Non-"natural" ------------------------------------------- -default:torch - default:chest default:chest_locked @@ -176,11 +192,10 @@ default:fence_aspen_wood default:glass default:obsidian_glass -default:rail - default:brick default:meselamp +default:mese_post_light Misc ---- @@ -272,7 +287,6 @@ minetest.register_node("default:desert_stone_block", { sounds = default.node_sound_stone_defaults(), }) - minetest.register_node("default:sandstone", { description = "Sandstone", tiles = {"default_sandstone.png"}, @@ -298,6 +312,55 @@ minetest.register_node("default:sandstone_block", { sounds = default.node_sound_stone_defaults(), }) +minetest.register_node("default:desert_sandstone", { + description = "Desert Sandstone", + tiles = {"default_desert_sandstone.png"}, + groups = {crumbly = 1, cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_sandstone_brick", { + description = "Desert Sandstone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_desert_sandstone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_sandstone_block", { + description = "Desert Sandstone Block", + tiles = {"default_desert_sandstone_block.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:silver_sandstone", { + description = "Silver Sandstone", + tiles = {"default_silver_sandstone.png"}, + groups = {crumbly = 1, cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:silver_sandstone_brick", { + description = "Silver Sandstone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_silver_sandstone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:silver_sandstone_block", { + description = "Silver Sandstone Block", + tiles = {"default_silver_sandstone_block.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) minetest.register_node("default:obsidian", { description = "Obsidian", @@ -377,13 +440,28 @@ minetest.register_node("default:dirt_with_snow", { tiles = {"default_snow.png", "default_dirt.png", {name = "default_dirt.png^default_snow_side.png", tileable_vertical = false}}, - groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, + groups = {crumbly = 3, spreading_dirt_type = 1, snowy = 1}, drop = 'default:dirt', sounds = default.node_sound_dirt_defaults({ footstep = {name = "default_snow_footstep", gain = 0.15}, }), }) +minetest.register_node("default:dirt_with_rainforest_litter", { + description = "Dirt with Rainforest Litter", + tiles = { + "default_rainforest_litter.png", + "default_dirt.png", + {name = "default_dirt.png^default_rainforest_litter_side.png", + tileable_vertical = false} + }, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, + drop = "default:dirt", + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.4}, + }), +}) + minetest.register_node("default:sand", { description = "Sand", tiles = {"default_sand.png"}, @@ -437,7 +515,6 @@ minetest.register_node("default:snow", { paramtype = "light", buildable_to = true, floodable = true, - walkable = false, drawtype = "nodebox", node_box = { type = "fixed", @@ -445,7 +522,7 @@ minetest.register_node("default:snow", { {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, }, }, - groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1}, + groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1, snowy = 1}, sounds = default.node_sound_dirt_defaults({ footstep = {name = "default_snow_footstep", gain = 0.15}, dug = {name = "default_snow_footstep", gain = 0.2}, @@ -463,12 +540,19 @@ minetest.register_node("default:snow", { minetest.register_node("default:snowblock", { description = "Snow Block", tiles = {"default_snow.png"}, - groups = {crumbly = 3, puts_out_fire = 1}, + groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1}, sounds = default.node_sound_dirt_defaults({ footstep = {name = "default_snow_footstep", gain = 0.15}, dug = {name = "default_snow_footstep", gain = 0.2}, dig = {name = "default_snow_footstep", gain = 0.2} }), + + on_construct = function(pos) + pos.y = pos.y - 1 + if minetest.get_node(pos).name == "default:dirt_with_grass" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + end + end, }) minetest.register_node("default:ice", { @@ -476,7 +560,7 @@ minetest.register_node("default:ice", { tiles = {"default_ice.png"}, is_ground_content = false, paramtype = "light", - groups = {cracky = 3, puts_out_fire = 1}, + groups = {cracky = 3, puts_out_fire = 1, cools_lava = 1}, sounds = default.node_sound_glass_defaults(), }) @@ -508,7 +592,6 @@ minetest.register_node("default:wood", { 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", @@ -518,16 +601,16 @@ minetest.register_node("default:sapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1, sapling = 1}, sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(60,234)) + minetest.get_node_timer(pos):start(math.random(2400,4800)) end, ---[[ + on_place = function(itemstack, placer, pointed_thing) itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, "default:sapling", @@ -540,14 +623,12 @@ minetest.register_node("default:sapling", { return itemstack end, - ]] }) minetest.register_node("default:leaves", { description = "Leaves", drawtype = "allfaces_optional", waving = 1, - visual_scale = 1.3, tiles = {"default_leaves.png"}, special_tiles = {"default_leaves_simple.png"}, paramtype = "light", @@ -576,7 +657,6 @@ minetest.register_node("default: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", @@ -585,7 +665,7 @@ minetest.register_node("default:apple", { is_ground_content = false, selection_box = { type = "fixed", - fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} + fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16} }, groups = {fleshy = 3, dig_immediate = 3, flammable = 2, leafdecay = 3, leafdecay_drop = 1}, @@ -613,7 +693,7 @@ minetest.register_node("default:jungletree", { }) minetest.register_node("default:junglewood", { - description = "Junglewood Planks", + description = "Jungle Wood Planks", paramtype2 = "facedir", place_param2 = 0, tiles = {"default_junglewood.png"}, @@ -626,7 +706,6 @@ minetest.register_node("default:jungleleaves", { description = "Jungle Leaves", drawtype = "allfaces_optional", waving = 1, - visual_scale = 1.3, tiles = {"default_jungleleaves.png"}, special_tiles = {"default_jungleleaves_simple.png"}, paramtype = "light", @@ -647,7 +726,6 @@ minetest.register_node("default:jungleleaves", { 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", @@ -657,16 +735,16 @@ minetest.register_node("default:junglesapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1, sapling = 1}, sounds = default.node_sound_leaves_defaults(), on_construct = function(pos) - minetest.get_node_timer(pos):start(math.random(60,234)) + minetest.get_node_timer(pos):start(math.random(2400,4800)) end, ---[[ + on_place = function(itemstack, placer, pointed_thing) itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, "default:junglesapling", @@ -679,7 +757,6 @@ minetest.register_node("default:junglesapling", { return itemstack end, - ]] }) @@ -708,7 +785,6 @@ minetest.register_node("default:pine_wood", { minetest.register_node("default:pine_needles",{ description = "Pine Needles", drawtype = "allfaces_optional", - visual_scale = 1.3, tiles = {"default_pine_needles.png"}, waving = 1, paramtype = "light", @@ -729,7 +805,6 @@ minetest.register_node("default:pine_needles",{ 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", @@ -739,7 +814,7 @@ minetest.register_node("default:pine_sapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 3, attached_node = 1, sapling = 1}, @@ -748,7 +823,7 @@ minetest.register_node("default:pine_sapling", { on_construct = function(pos) minetest.get_node_timer(pos):start(math.random(2400,4800)) end, ---[[ + on_place = function(itemstack, placer, pointed_thing) itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, "default:pine_sapling", @@ -761,7 +836,6 @@ minetest.register_node("default:pine_sapling", { return itemstack end, - ]] }) @@ -790,8 +864,8 @@ minetest.register_node("default:acacia_wood", { minetest.register_node("default:acacia_leaves", { description = "Acacia Leaves", drawtype = "allfaces_optional", - visual_scale = 1.3, tiles = {"default_acacia_leaves.png"}, + special_tiles = {"default_acacia_leaves_simple.png"}, waving = 1, paramtype = "light", is_ground_content = false, @@ -811,7 +885,6 @@ minetest.register_node("default:acacia_leaves", { minetest.register_node("default:acacia_sapling", { description = "Acacia Tree Sapling", drawtype = "plantlike", - visual_scale = 1.0, tiles = {"default_acacia_sapling.png"}, inventory_image = "default_acacia_sapling.png", wield_image = "default_acacia_sapling.png", @@ -821,7 +894,7 @@ minetest.register_node("default:acacia_sapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 2, attached_node = 1, sapling = 1}, @@ -830,7 +903,7 @@ minetest.register_node("default:acacia_sapling", { on_construct = function(pos) minetest.get_node_timer(pos):start(math.random(2400,4800)) end, ---[[ + on_place = function(itemstack, placer, pointed_thing) itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, "default:acacia_sapling", @@ -843,7 +916,6 @@ minetest.register_node("default:acacia_sapling", { return itemstack end, - ]] }) minetest.register_node("default:aspen_tree", { @@ -871,7 +943,6 @@ minetest.register_node("default:aspen_wood", { minetest.register_node("default:aspen_leaves", { description = "Aspen Leaves", drawtype = "allfaces_optional", - visual_scale = 1.3, tiles = {"default_aspen_leaves.png"}, waving = 1, paramtype = "light", @@ -892,7 +963,6 @@ minetest.register_node("default:aspen_leaves", { minetest.register_node("default:aspen_sapling", { description = "Aspen Tree Sapling", drawtype = "plantlike", - visual_scale = 1.0, tiles = {"default_aspen_sapling.png"}, inventory_image = "default_aspen_sapling.png", wield_image = "default_aspen_sapling.png", @@ -902,7 +972,7 @@ minetest.register_node("default:aspen_sapling", { on_timer = default.grow_sapling, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16} }, groups = {snappy = 2, dig_immediate = 3, flammable = 3, attached_node = 1, sapling = 1}, @@ -911,7 +981,7 @@ minetest.register_node("default:aspen_sapling", { on_construct = function(pos) minetest.get_node_timer(pos):start(math.random(2400,4800)) end, ---[[ + on_place = function(itemstack, placer, pointed_thing) itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, "default:aspen_sapling", @@ -924,7 +994,6 @@ minetest.register_node("default:aspen_sapling", { return itemstack end, - ]] }) -- @@ -981,6 +1050,24 @@ minetest.register_node("default:copperblock", { sounds = default.node_sound_metal_defaults(), }) + +minetest.register_node("default:stone_with_tin", { + description = "Tin Ore", + tiles = {"default_stone.png^default_mineral_tin.png"}, + groups = {cracky = 2}, + drop = "default:tin_lump", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:tinblock", { + description = "Tin Block", + tiles = {"default_tin_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), +}) + + minetest.register_node("default:bronzeblock", { description = "Bronze Block", tiles = {"default_bronze_block.png"}, @@ -1050,7 +1137,7 @@ minetest.register_node("default:cactus", { tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"}, paramtype2 = "facedir", - groups = {snappy = 1, choppy = 3}, + groups = {choppy = 3}, sounds = default.node_sound_wood_defaults(), on_place = minetest.rotate_node, }) @@ -1066,7 +1153,7 @@ minetest.register_node("default:papyrus", { walkable = false, selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, }, groups = {snappy = 3, flammable = 2}, sounds = default.node_sound_leaves_defaults(), @@ -1080,7 +1167,6 @@ 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", @@ -1092,7 +1178,7 @@ minetest.register_node("default:dry_shrub", { sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16}, }, }) @@ -1100,7 +1186,7 @@ minetest.register_node("default:junglegrass", { description = "Jungle Grass", drawtype = "plantlike", waving = 1, - visual_scale = 1.3, + visual_scale = 1.69, tiles = {"default_junglegrass.png"}, inventory_image = "default_junglegrass.png", wield_image = "default_junglegrass.png", @@ -1108,11 +1194,11 @@ minetest.register_node("default:junglegrass", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1}, + groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16}, }, }) @@ -1133,7 +1219,7 @@ minetest.register_node("default:grass_1", { sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16}, }, on_place = function(itemstack, placer, pointed_thing) @@ -1163,7 +1249,7 @@ for i = 2, 5 do sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16}, }, }) end @@ -1185,7 +1271,7 @@ minetest.register_node("default:dry_grass_1", { sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16}, }, on_place = function(itemstack, placer, pointed_thing) @@ -1215,12 +1301,155 @@ for i = 2, 5 do sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16}, }, }) end +minetest.register_node("default:bush_stem", { + description = "Bush Stem", + drawtype = "plantlike", + visual_scale = 1.41, + tiles = {"default_bush_stem.png"}, + inventory_image = "default_bush_stem.png", + wield_image = "default_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}, + }, +}) + +minetest.register_node("default:bush_leaves", { + description = "Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_leaves_simple.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:bush_sapling"}, rarity = 5}, + {items = {"default:bush_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:bush_sapling", { + description = "Bush Sapling", + drawtype = "plantlike", + tiles = {"default_bush_sapling.png"}, + inventory_image = "default_bush_sapling.png", + wield_image = "default_bush_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(1200, 2400)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:bush_sapling", + -- minp, maxp to be checked, relative to sapling pos + {x = -1, y = 0, z = -1}, + {x = 1, y = 1, z = 1}, + -- maximum interval of interior volume check + 2) + + return itemstack + end, +}) + +minetest.register_node("default:acacia_bush_stem", { + description = "Acacia Bush Stem", + drawtype = "plantlike", + visual_scale = 1.41, + tiles = {"default_acacia_bush_stem.png"}, + inventory_image = "default_acacia_bush_stem.png", + wield_image = "default_acacia_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}, + }, +}) + +minetest.register_node("default:acacia_bush_leaves", { + description = "Acacia Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_acacia_leaves_simple.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:acacia_bush_sapling"}, rarity = 5}, + {items = {"default:acacia_bush_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:acacia_bush_sapling", { + description = "Acacia Bush Sapling", + drawtype = "plantlike", + tiles = {"default_acacia_bush_sapling.png"}, + inventory_image = "default_acacia_bush_sapling.png", + wield_image = "default_acacia_bush_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(1200, 2400)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:acacia_bush_sapling", + -- minp, maxp to be checked, relative to sapling pos + {x = -1, y = 0, z = -1}, + {x = 1, y = 1, z = 1}, + -- maximum interval of interior volume check + 2) + + return itemstack + end, +}) + + -- -- Corals -- @@ -1294,7 +1523,8 @@ minetest.register_node("default:water_source", { liquid_alternative_source = "default:water_source", liquid_viscosity = 1, post_effect_color = {a = 103, r = 30, g = 60, b = 90}, - groups = {water = 3, liquid = 3, puts_out_fire = 1}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), }) minetest.register_node("default:water_flowing", { @@ -1339,7 +1569,8 @@ minetest.register_node("default:water_flowing", { liquid_viscosity = 1, post_effect_color = {a = 103, r = 30, g = 60, b = 90}, groups = {water = 3, liquid = 3, puts_out_fire = 1, - not_in_creative_inventory = 1}, + not_in_creative_inventory = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), }) @@ -1385,7 +1616,8 @@ minetest.register_node("default:river_water_source", { liquid_renewable = false, liquid_range = 2, post_effect_color = {a = 103, r = 30, g = 76, b = 90}, - groups = {water = 3, liquid = 3, puts_out_fire = 1}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), }) minetest.register_node("default:river_water_flowing", { @@ -1432,7 +1664,8 @@ minetest.register_node("default:river_water_flowing", { liquid_range = 2, post_effect_color = {a = 103, r = 30, g = 76, b = 90}, groups = {water = 3, liquid = 3, puts_out_fire = 1, - not_in_creative_inventory = 1}, + not_in_creative_inventory = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), }) @@ -1533,71 +1766,7 @@ minetest.register_node("default:lava_flowing", { -- Tools / "Advanced" crafting / Non-"natural" -- -minetest.register_node("default:torch", { - description = "Torch", - drawtype = "torchlike", - tiles = { - { - name = "default_torch_on_floor_animated.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 3.0 - }, - }, - { - name="default_torch_on_ceiling_animated.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 3.0 - }, - }, - { - name="default_torch_animated.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 3.0 - }, - }, - }, - inventory_image = "default_torch_on_floor.png", - wield_image = "default_torch_on_floor.png", - paramtype = "light", - paramtype2 = "wallmounted", - sunlight_propagates = true, - is_ground_content = false, - walkable = false, - light_source = default.LIGHT_MAX - 1, - selection_box = { - type = "wallmounted", - wall_top = {-0.1, 0.5 - 0.6, -0.1, 0.1, 0.5, 0.1}, - wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5 + 0.6, 0.1}, - wall_side = {-0.5, -0.3, -0.1, -0.5 + 0.3, 0.3, 0.1}, - }, - groups = {choppy = 2, dig_immediate = 3, flammable = 1, attached_node = 1}, - legacy_wallmounted = true, - sounds = default.node_sound_defaults(), -}) - - -local chest_formspec = - "size[8,9]" .. - default.gui_bg .. - 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 function get_chest_formspec(pos) local spos = pos.x .. "," .. pos.y .. "," .. pos.z local formspec = "size[8,9]" .. @@ -1610,141 +1779,287 @@ local function get_locked_chest_formspec(pos) "listring[nodemeta:" .. spos .. ";main]" .. "listring[current_player;main]" .. default.get_hotbar_bg(0,4.85) - return formspec + return formspec end -local function has_locked_chest_privilege(meta, player) - local name = "" - if player then - if minetest.check_player_privs(player, "protection_bypass") then - return true - end - name = player:get_player_name() - end - if name ~= meta:get_string("owner") then +local function chest_lid_obstructed(pos) + local above = { x = pos.x, y = pos.y + 1, z = pos.z } + local def = minetest.registered_nodes[minetest.get_node(above).name] + -- allow ladders, signs, wallmounted things and torches to not obstruct + if def.drawtype == "airlike" or + def.drawtype == "signlike" or + def.drawtype == "torchlike" or + (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then return false end return true end -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(), +local open_chests = {} - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", chest_formspec) - 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, +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "default:chest" then + return + end + if not player or not fields.quit then + return + end + local pn = player:get_player_name() + + if not open_chests[pn] then + return + end + + local pos = open_chests[pn].pos + local sound = open_chests[pn].sound + local swap = open_chests[pn].swap + local node = minetest.get_node(pos) + + open_chests[pn] = nil + for k, v in pairs(open_chests) do + if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then + return true + end + end + minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap, + param2 = node.param2 }) + minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10}) + return true +end) + +function default.register_chest(name, d) + local def = table.copy(d) + def.drawtype = "mesh" + def.visual = "mesh" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.legacy_facedir_simple = true + def.is_ground_content = false + + if def.protected then + def.on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end + def.after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Locked Chest (owned by " .. + meta:get_string("owner") .. ")") + end + def.can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and + default.can_interact_with_node(player, pos) + end + def.allow_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return count + end + def.allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return stack:get_count() + end + def.allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return stack:get_count() + end + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + if not default.can_interact_with_node(clicker, pos) then + return itemstack + end + + minetest.sound_play(def.sound_open, {gain = 0.3, + pos = pos, max_hear_distance = 10}) + if not chest_lid_obstructed(pos) then + minetest.swap_node(pos, + { name = "default:" .. name .. "_open", + param2 = node.param2 }) + end + minetest.after(0.2, minetest.show_formspec, + clicker:get_player_name(), + "default:chest", get_chest_formspec(pos)) + open_chests[clicker:get_player_name()] = { pos = pos, + sound = def.sound_close, swap = name } + end + def.on_blast = function() end + def.on_key_use = function(pos, player) + local secret = minetest.get_meta(pos):get_string("key_lock_secret") + local itemstack = player:get_wielded_item() + local key_meta = itemstack:get_meta() + + if key_meta:get_string("secret") == "" then + key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret) + itemstack:set_metadata("") + end + + if secret ~= key_meta:get_string("secret") then + return + end + + minetest.show_formspec( + player:get_player_name(), + "default:chest_locked", + get_chest_formspec(pos) + ) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local pn = player:get_player_name() + + -- verify placer is owner of lockable chest + if owner ~= pn then + minetest.record_protection_violation(pos, pn) + minetest.chat_send_player(pn, "You do not own this chest.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked chest", owner + end + else + def.on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end + def.can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end + def.on_rightclick = function(pos, node, clicker) + minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos, + max_hear_distance = 10}) + if not chest_lid_obstructed(pos) then + minetest.swap_node(pos, { + name = "default:" .. name .. "_open", + param2 = node.param2 }) + end + minetest.after(0.2, minetest.show_formspec, + clicker:get_player_name(), + "default:chest", get_chest_formspec(pos)) + open_chests[clicker:get_player_name()] = { pos = pos, + sound = def.sound_close, swap = name } + end + end + + def.on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) minetest.log("action", player:get_player_name() .. " moves stuff in chest at " .. minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) + end + def.on_metadata_inventory_put = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " moves " .. stack:get_name() .. " to chest at " .. minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) + end + def.on_metadata_inventory_take = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " takes " .. stack:get_name() .. " from chest at " .. minetest.pos_to_string(pos)) - end, - on_blast = function(pos) + end + def.on_blast = function(pos) local drops = {} default.get_inventory_drops(pos, "main", drops) drops[#drops+1] = "default:chest" minetest.remove_node(pos) return drops - end, -}) + 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, + local def_opened = table.copy(def) + local def_closed = table.copy(def) + + def_opened.mesh = "chest_open.obj" + def_opened.drop = "default:" .. name + def_opened.groups.not_in_creative_inventory = 1 + def_opened.selection_box = { + type = "fixed", + fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 }, + } + def_opened.can_dig = function() + return false + end + + def_closed.mesh = nil + def_closed.drawtype = nil + def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal" + def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh + def_closed.tiles[3] = def.tiles[3].."^[transformFX" + + minetest.register_node("default:" .. name, def_closed) + minetest.register_node("default:" .. name .. "_open", def_opened) + + -- convert old chests to this new variant + minetest.register_lbm({ + label = "update chests to opening chests", + name = "default:upgrade_" .. name .. "_v2", + nodenames = {"default:" .. name}, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", nil) + local inv = meta:get_inventory() + local list = inv:get_list("default:chest") + if list then + inv:set_size("main", 8*4) + inv:set_list("main", list) + inv:set_list("default:chest", nil) + end + end + }) +end + + +default.register_chest("chest", { + description = "Chest", + tiles = { + "default_chest_top.png", + "default_chest_top.png", + "default_chest_side.png", + "default_chest_side.png", + "default_chest_front.png", + "default_chest_inside.png" + }, sounds = default.node_sound_wood_defaults(), - - 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("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 " .. stack:get_name() .. - " 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 " .. stack:get_name() .. - " from locked chest at " .. minetest.pos_to_string(pos)) - end, - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - 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 - return itemstack - end, - on_blast = function() end, + sound_open = "default_chest_open", + sound_close = "default_chest_close", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, }) +default.register_chest("chest_locked", { + description = "Locked Chest", + tiles = { + "default_chest_top.png", + "default_chest_top.png", + "default_chest_side.png", + "default_chest_side.png", + "default_chest_lock.png", + "default_chest_inside.png" + }, + sounds = default.node_sound_wood_defaults(), + sound_open = "default_chest_open", + sound_close = "default_chest_close", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, + protected = true, +}) local bookshelf_formspec = "size[8,7;]" .. @@ -1758,6 +2073,25 @@ local bookshelf_formspec = "listring[current_player;main]" .. default.get_hotbar_bg(0,2.85) +local function get_bookshelf_formspec(inv) + local formspec = bookshelf_formspec + local invlist = inv and inv:get_list("books") + -- Inventory slots overlay + local bx, by = 0, 0.3 + for i = 1, 16 do + if i == 9 then + bx = 0 + by = by + 1 + end + if not invlist or invlist[i]:is_empty() then + formspec = formspec .. + "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]" + end + bx = bx + 1 + end + return formspec +end + minetest.register_node("default:bookshelf", { description = "Bookshelf", tiles = {"default_wood.png", "default_wood.png", "default_wood.png", @@ -1769,7 +2103,7 @@ minetest.register_node("default:bookshelf", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", bookshelf_formspec) + meta:set_string("formspec", get_bookshelf_formspec(nil)) local inv = meta:get_inventory() inv:set_size("books", 8 * 2) end, @@ -1786,14 +2120,20 @@ minetest.register_node("default:bookshelf", { on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) minetest.log("action", player:get_player_name() .. " moves stuff in bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " moves stuff to bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " takes stuff from bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) end, on_blast = function(pos) local drops = {} @@ -1924,7 +2264,7 @@ default.register_fence("default:fence_acacia_wood", { }) default.register_fence("default:fence_junglewood", { - description = "Junglewood Fence", + description = "Jungle Wood Fence", texture = "default_fence_junglewood.png", inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", @@ -1958,6 +2298,7 @@ minetest.register_node("default:glass", { drawtype = "glasslike_framed_optional", tiles = {"default_glass.png", "default_glass_detail.png"}, paramtype = "light", + paramtype2 = "glasslikeliquidlevel", sunlight_propagates = true, is_ground_content = false, groups = {cracky = 3, oddly_breakable_by_hand = 3}, @@ -1969,6 +2310,7 @@ minetest.register_node("default:obsidian_glass", { drawtype = "glasslike_framed_optional", tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"}, paramtype = "light", + paramtype2 = "glasslikeliquidlevel", is_ground_content = false, sunlight_propagates = true, sounds = default.node_sound_glass_defaults(), @@ -1976,27 +2318,6 @@ minetest.register_node("default:obsidian_glass", { }) -minetest.register_node("default:rail", { - description = "Rail", - drawtype = "raillike", - tiles = {"default_rail.png", "default_rail_curved.png", - "default_rail_t_junction.png", "default_rail_crossing.png"}, - inventory_image = "default_rail.png", - wield_image = "default_rail.png", - paramtype = "light", - sunlight_propagates = true, - walkable = false, - is_ground_content = false, - selection_box = { - type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, - }, - groups = {dig_immediate = 2, attached_node = 1, - connect_to_raillike = minetest.raillike_group("rail")}, -}) - - minetest.register_node("default:brick", { description = "Brick Block", paramtype2 = "facedir", @@ -2020,6 +2341,27 @@ minetest.register_node("default:meselamp", { light_source = default.LIGHT_MAX, }) +minetest.register_node("default:mese_post_light", { + description = "Mese Post Light", + tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png", + "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png", + "default_mese_post_light_side.png", "default_mese_post_light_side.png"}, + wield_image = "default_mese_post_light_side.png", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16}, + }, + }, + paramtype = "light", + light_source = default.LIGHT_MAX, + sunlight_propagates = true, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults(), +}) + -- -- Misc -- @@ -2031,3 +2373,69 @@ minetest.register_node("default:cloud", { sounds = default.node_sound_defaults(), groups = {not_in_creative_inventory = 1}, }) + +-- +-- register trees for leafdecay +-- + +if minetest.get_mapgen_setting("mg_name") == "v6" then + default.register_leafdecay({ + trunks = {"default:tree"}, + leaves = {"default:apple", "default:leaves"}, + radius = 2, + }) + + default.register_leafdecay({ + trunks = {"default:jungletree"}, + leaves = {"default:jungleleaves"}, + radius = 3, + }) + + default.register_leafdecay({ + trunks = {"default:pine_tree"}, + leaves = {"default:pine_needles"}, + radius = 3, + }) +else + default.register_leafdecay({ + trunks = {"default:tree"}, + leaves = {"default:apple", "default:leaves"}, + radius = 3, + }) + + default.register_leafdecay({ + trunks = {"default:jungletree"}, + leaves = {"default:jungleleaves"}, + radius = 2, + }) + + default.register_leafdecay({ + trunks = {"default:pine_tree"}, + leaves = {"default:pine_needles"}, + radius = 2, + }) +end + +default.register_leafdecay({ + trunks = {"default:acacia_tree"}, + leaves = {"default:acacia_leaves"}, + radius = 2, +}) + +default.register_leafdecay({ + trunks = {"default:aspen_tree"}, + leaves = {"default:aspen_leaves"}, + radius = 3, +}) + +default.register_leafdecay({ + trunks = {"default:bush_stem"}, + leaves = {"default:bush_leaves"}, + radius = 1, +}) + +default.register_leafdecay({ + trunks = {"default:acacia_bush_stem"}, + leaves = {"default:acacia_bush_leaves"}, + radius = 1, +}) diff --git a/mods/default/player.lua b/mods/default/player.lua index 8fb0aca8..0a2078d6 100644 --- a/mods/default/player.lua +++ b/mods/default/player.lua @@ -94,11 +94,7 @@ minetest.register_on_joinplayer(function(player) default.player_attached[player:get_player_name()] = false default.player_set_model(player, "character.b3d") player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) - - -- set GUI - if not minetest.setting_getbool("creative_mode") then - player:set_inventory_formspec(default.gui_survival_form) - end + player:hud_set_hotbar_image("gui_hotbar.png") player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") end) diff --git a/mods/default/schematics/acacia_bush.mts b/mods/default/schematics/acacia_bush.mts new file mode 100644 index 00000000..df955861 Binary files /dev/null and b/mods/default/schematics/acacia_bush.mts differ diff --git a/mods/default/schematics/acacia_log.mts b/mods/default/schematics/acacia_log.mts new file mode 100644 index 00000000..037bca8c Binary files /dev/null and b/mods/default/schematics/acacia_log.mts differ diff --git a/mods/default/schematics/apple_log.mts b/mods/default/schematics/apple_log.mts new file mode 100644 index 00000000..e7ee8f2b Binary files /dev/null and b/mods/default/schematics/apple_log.mts differ diff --git a/mods/default/schematics/apple_tree.mts b/mods/default/schematics/apple_tree.mts index ac09b466..2bd57c1f 100644 Binary files a/mods/default/schematics/apple_tree.mts and b/mods/default/schematics/apple_tree.mts differ diff --git a/mods/default/schematics/apple_tree_from_sapling.mts b/mods/default/schematics/apple_tree_from_sapling.mts index 5d35a154..d258ab1a 100644 Binary files a/mods/default/schematics/apple_tree_from_sapling.mts and b/mods/default/schematics/apple_tree_from_sapling.mts differ diff --git a/mods/default/schematics/aspen_log.mts b/mods/default/schematics/aspen_log.mts new file mode 100644 index 00000000..180e6fd1 Binary files /dev/null and b/mods/default/schematics/aspen_log.mts differ diff --git a/mods/default/schematics/aspen_tree.mts b/mods/default/schematics/aspen_tree.mts index 724aae08..429a831c 100644 Binary files a/mods/default/schematics/aspen_tree.mts and b/mods/default/schematics/aspen_tree.mts differ diff --git a/mods/default/schematics/aspen_tree_from_sapling.mts b/mods/default/schematics/aspen_tree_from_sapling.mts index b7ca1619..b7ab3ee6 100644 Binary files a/mods/default/schematics/aspen_tree_from_sapling.mts and b/mods/default/schematics/aspen_tree_from_sapling.mts differ diff --git a/mods/default/schematics/bush.mts b/mods/default/schematics/bush.mts new file mode 100644 index 00000000..d08cf5f5 Binary files /dev/null and b/mods/default/schematics/bush.mts differ diff --git a/mods/default/schematics/corals.mts b/mods/default/schematics/corals.mts new file mode 100644 index 00000000..e1bd7ded Binary files /dev/null and b/mods/default/schematics/corals.mts differ diff --git a/mods/default/schematics/jungle_log.mts b/mods/default/schematics/jungle_log.mts new file mode 100644 index 00000000..54fa16d1 Binary files /dev/null and b/mods/default/schematics/jungle_log.mts differ diff --git a/mods/default/schematics/jungle_tree.mts b/mods/default/schematics/jungle_tree.mts index 329364a8..01a1b11a 100644 Binary files a/mods/default/schematics/jungle_tree.mts and b/mods/default/schematics/jungle_tree.mts differ diff --git a/mods/default/schematics/jungle_tree_from_sapling.mts b/mods/default/schematics/jungle_tree_from_sapling.mts index babaa45f..f93f0141 100644 Binary files a/mods/default/schematics/jungle_tree_from_sapling.mts and b/mods/default/schematics/jungle_tree_from_sapling.mts differ diff --git a/mods/default/schematics/papyrus.mts b/mods/default/schematics/papyrus.mts index a3b67776..1333a7c4 100644 Binary files a/mods/default/schematics/papyrus.mts and b/mods/default/schematics/papyrus.mts differ diff --git a/mods/default/schematics/pine_log.mts b/mods/default/schematics/pine_log.mts new file mode 100644 index 00000000..744c38b0 Binary files /dev/null and b/mods/default/schematics/pine_log.mts differ diff --git a/mods/default/schematics/pine_tree.mts b/mods/default/schematics/pine_tree.mts index 3a3fa7ad..6f27d839 100644 Binary files a/mods/default/schematics/pine_tree.mts and b/mods/default/schematics/pine_tree.mts differ diff --git a/mods/default/schematics/pine_tree_from_sapling.mts b/mods/default/schematics/pine_tree_from_sapling.mts index 629c5da0..e42a9965 100644 Binary files a/mods/default/schematics/pine_tree_from_sapling.mts and b/mods/default/schematics/pine_tree_from_sapling.mts differ diff --git a/mods/default/sounds/default_chest_close.ogg b/mods/default/sounds/default_chest_close.ogg new file mode 100644 index 00000000..53ff23d2 Binary files /dev/null and b/mods/default/sounds/default_chest_close.ogg differ diff --git a/mods/default/sounds/default_chest_open.ogg b/mods/default/sounds/default_chest_open.ogg new file mode 100644 index 00000000..c73c072c Binary files /dev/null and b/mods/default/sounds/default_chest_open.ogg differ diff --git a/mods/default/sounds/default_dig_snappy.ogg b/mods/default/sounds/default_dig_snappy.ogg new file mode 100644 index 00000000..3686fcdd Binary files /dev/null and b/mods/default/sounds/default_dig_snappy.ogg differ diff --git a/mods/default/sounds/default_item_smoke.ogg b/mods/default/sounds/default_item_smoke.ogg index e1c84078..038a46e4 100644 Binary files a/mods/default/sounds/default_item_smoke.ogg and b/mods/default/sounds/default_item_smoke.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.1.ogg b/mods/default/sounds/default_tool_breaks.1.ogg new file mode 100644 index 00000000..2a571ae2 Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.1.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.2.ogg b/mods/default/sounds/default_tool_breaks.2.ogg new file mode 100644 index 00000000..17893520 Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.2.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.3.ogg b/mods/default/sounds/default_tool_breaks.3.ogg new file mode 100644 index 00000000..a99c4b7e Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.3.ogg differ diff --git a/mods/default/sounds/default_water_footstep.1.ogg b/mods/default/sounds/default_water_footstep.1.ogg new file mode 100644 index 00000000..63b9744c Binary files /dev/null and b/mods/default/sounds/default_water_footstep.1.ogg differ diff --git a/mods/default/sounds/default_water_footstep.2.ogg b/mods/default/sounds/default_water_footstep.2.ogg new file mode 100644 index 00000000..8d79c1f4 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.2.ogg differ diff --git a/mods/default/sounds/default_water_footstep.3.ogg b/mods/default/sounds/default_water_footstep.3.ogg new file mode 100644 index 00000000..f8891506 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.3.ogg differ diff --git a/mods/default/sounds/default_water_footstep.4.ogg b/mods/default/sounds/default_water_footstep.4.ogg new file mode 100644 index 00000000..6f1eab82 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.4.ogg differ diff --git a/mods/default/textures/default_acacia_bush_sapling.png b/mods/default/textures/default_acacia_bush_sapling.png new file mode 100644 index 00000000..940b3aac Binary files /dev/null and b/mods/default/textures/default_acacia_bush_sapling.png differ diff --git a/mods/default/textures/default_acacia_bush_stem.png b/mods/default/textures/default_acacia_bush_stem.png new file mode 100644 index 00000000..29039152 Binary files /dev/null and b/mods/default/textures/default_acacia_bush_stem.png differ diff --git a/mods/default/textures/default_acacia_leaves_simple.png b/mods/default/textures/default_acacia_leaves_simple.png new file mode 100644 index 00000000..3c7015bb Binary files /dev/null and b/mods/default/textures/default_acacia_leaves_simple.png differ diff --git a/mods/default/textures/default_bookshelf_slot.png b/mods/default/textures/default_bookshelf_slot.png new file mode 100644 index 00000000..715a3dce Binary files /dev/null and b/mods/default/textures/default_bookshelf_slot.png differ diff --git a/mods/default/textures/default_bush_sapling.png b/mods/default/textures/default_bush_sapling.png new file mode 100644 index 00000000..905ba4b8 Binary files /dev/null and b/mods/default/textures/default_bush_sapling.png differ diff --git a/mods/default/textures/default_bush_stem.png b/mods/default/textures/default_bush_stem.png new file mode 100644 index 00000000..18b615f7 Binary files /dev/null and b/mods/default/textures/default_bush_stem.png differ diff --git a/mods/default/textures/default_chest_inside.png b/mods/default/textures/default_chest_inside.png new file mode 100644 index 00000000..5f7b6b13 Binary files /dev/null and b/mods/default/textures/default_chest_inside.png differ diff --git a/mods/default/textures/default_key.png b/mods/default/textures/default_key.png new file mode 100644 index 00000000..783d3139 Binary files /dev/null and b/mods/default/textures/default_key.png differ diff --git a/mods/default/textures/default_key_skeleton.png b/mods/default/textures/default_key_skeleton.png new file mode 100644 index 00000000..2b3497d3 Binary files /dev/null and b/mods/default/textures/default_key_skeleton.png differ diff --git a/mods/default/textures/default_mese_post_light_side.png b/mods/default/textures/default_mese_post_light_side.png new file mode 100644 index 00000000..c23b551a Binary files /dev/null and b/mods/default/textures/default_mese_post_light_side.png differ diff --git a/mods/default/textures/default_mese_post_light_side_dark.png b/mods/default/textures/default_mese_post_light_side_dark.png new file mode 100644 index 00000000..c4fc7cea Binary files /dev/null and b/mods/default/textures/default_mese_post_light_side_dark.png differ diff --git a/mods/default/textures/default_mese_post_light_top.png b/mods/default/textures/default_mese_post_light_top.png new file mode 100644 index 00000000..6834bd36 Binary files /dev/null and b/mods/default/textures/default_mese_post_light_top.png differ diff --git a/mods/default/textures/default_mineral_tin.png b/mods/default/textures/default_mineral_tin.png new file mode 100644 index 00000000..232d4b53 Binary files /dev/null and b/mods/default/textures/default_mineral_tin.png differ diff --git a/mods/default/textures/default_rainforest_litter.png b/mods/default/textures/default_rainforest_litter.png new file mode 100644 index 00000000..d762deb4 Binary files /dev/null and b/mods/default/textures/default_rainforest_litter.png differ diff --git a/mods/default/textures/default_rainforest_litter_side.png b/mods/default/textures/default_rainforest_litter_side.png new file mode 100644 index 00000000..7ccb11de Binary files /dev/null and b/mods/default/textures/default_rainforest_litter_side.png differ diff --git a/mods/default/tools.lua b/mods/default/tools.lua index d4dd9739..45c779f1 100644 --- a/mods/default/tools.lua +++ b/mods/default/tools.lua @@ -33,7 +33,9 @@ minetest.register_tool("default:pick_wood", { damage_groups = {fleshy=2}, }, groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_stone", { description = "Stone Pickaxe", inventory_image = "default_tool_stonepick.png", @@ -45,7 +47,9 @@ minetest.register_tool("default:pick_stone", { }, damage_groups = {fleshy=3}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_steel", { description = "Steel Pickaxe", inventory_image = "default_tool_steelpick.png", @@ -57,7 +61,9 @@ minetest.register_tool("default:pick_steel", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_bronze", { description = "Bronze Pickaxe", inventory_image = "default_tool_bronzepick.png", @@ -69,7 +75,9 @@ minetest.register_tool("default:pick_bronze", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_mese", { description = "Mese Pickaxe", inventory_image = "default_tool_mesepick.png", @@ -81,7 +89,9 @@ minetest.register_tool("default:pick_mese", { }, damage_groups = {fleshy=5}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:pick_diamond", { description = "Diamond Pickaxe", inventory_image = "default_tool_diamondpick.png", @@ -93,6 +103,7 @@ minetest.register_tool("default:pick_diamond", { }, damage_groups = {fleshy=5}, }, + sound = {breaks = "default_tool_breaks"}, }) -- @@ -112,7 +123,9 @@ minetest.register_tool("default:shovel_wood", { damage_groups = {fleshy=2}, }, groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_stone", { description = "Stone Shovel", inventory_image = "default_tool_stoneshovel.png", @@ -125,7 +138,9 @@ minetest.register_tool("default:shovel_stone", { }, damage_groups = {fleshy=2}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_steel", { description = "Steel Shovel", inventory_image = "default_tool_steelshovel.png", @@ -138,7 +153,9 @@ minetest.register_tool("default:shovel_steel", { }, damage_groups = {fleshy=3}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_bronze", { description = "Bronze Shovel", inventory_image = "default_tool_bronzeshovel.png", @@ -151,7 +168,9 @@ minetest.register_tool("default:shovel_bronze", { }, damage_groups = {fleshy=3}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_mese", { description = "Mese Shovel", inventory_image = "default_tool_meseshovel.png", @@ -164,7 +183,9 @@ minetest.register_tool("default:shovel_mese", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:shovel_diamond", { description = "Diamond Shovel", inventory_image = "default_tool_diamondshovel.png", @@ -177,6 +198,7 @@ minetest.register_tool("default:shovel_diamond", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) -- @@ -195,7 +217,9 @@ minetest.register_tool("default:axe_wood", { damage_groups = {fleshy=2}, }, groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_stone", { description = "Stone Axe", inventory_image = "default_tool_stoneaxe.png", @@ -207,7 +231,9 @@ minetest.register_tool("default:axe_stone", { }, damage_groups = {fleshy=3}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_steel", { description = "Steel Axe", inventory_image = "default_tool_steelaxe.png", @@ -219,7 +245,9 @@ minetest.register_tool("default:axe_steel", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_bronze", { description = "Bronze Axe", inventory_image = "default_tool_bronzeaxe.png", @@ -231,7 +259,9 @@ minetest.register_tool("default:axe_bronze", { }, damage_groups = {fleshy=4}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_mese", { description = "Mese Axe", inventory_image = "default_tool_meseaxe.png", @@ -243,7 +273,9 @@ minetest.register_tool("default:axe_mese", { }, damage_groups = {fleshy=6}, }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:axe_diamond", { description = "Diamond Axe", inventory_image = "default_tool_diamondaxe.png", @@ -255,6 +287,7 @@ minetest.register_tool("default:axe_diamond", { }, damage_groups = {fleshy=7}, }, + sound = {breaks = "default_tool_breaks"}, }) -- @@ -273,7 +306,9 @@ minetest.register_tool("default:sword_wood", { damage_groups = {fleshy=2}, }, groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_stone", { description = "Stone Sword", inventory_image = "default_tool_stonesword.png", @@ -284,8 +319,10 @@ minetest.register_tool("default:sword_stone", { snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1}, }, damage_groups = {fleshy=4}, - } + }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_steel", { description = "Steel Sword", inventory_image = "default_tool_steelsword.png", @@ -296,8 +333,10 @@ minetest.register_tool("default:sword_steel", { snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2}, }, damage_groups = {fleshy=6}, - } + }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_bronze", { description = "Bronze Sword", inventory_image = "default_tool_bronzesword.png", @@ -308,8 +347,10 @@ minetest.register_tool("default:sword_bronze", { snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=40, maxlevel=2}, }, damage_groups = {fleshy=6}, - } + }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_mese", { description = "Mese Sword", inventory_image = "default_tool_mesesword.png", @@ -320,8 +361,10 @@ minetest.register_tool("default:sword_mese", { snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3}, }, damage_groups = {fleshy=7}, - } + }, + sound = {breaks = "default_tool_breaks"}, }) + minetest.register_tool("default:sword_diamond", { description = "Diamond Sword", inventory_image = "default_tool_diamondsword.png", @@ -332,5 +375,45 @@ minetest.register_tool("default:sword_diamond", { snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3}, }, damage_groups = {fleshy=8}, - } + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:key", { + description = "Key", + inventory_image = "default_key.png", + groups = {key = 1, not_in_creative_inventory = 1}, + stack_max = 1, + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local def = minetest.registered_nodes[node.name] + if def and def.on_rightclick and + not (placer and placer:get_player_control().sneak) then + return def.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + if pointed_thing.type ~= "node" then + return itemstack + end + + local pos = pointed_thing.under + node = minetest.get_node(pos) + + if not node or node.name == "ignore" then + return itemstack + end + + local ndef = minetest.registered_nodes[node.name] + if not ndef then + return itemstack + end + + local on_key_use = ndef.on_key_use + if on_key_use then + on_key_use(pos, placer) + end + + return nil + end }) diff --git a/mods/default/torch.lua b/mods/default/torch.lua new file mode 100644 index 00000000..3c3ae965 --- /dev/null +++ b/mods/default/torch.lua @@ -0,0 +1,146 @@ + +--[[ + +Torch mod - formerly mod "Torches" +====================== + +(c) Copyright BlockMen (2013-2015) +(C) Copyright sofar (2016) + +This mod changes the default torch drawtype from "torchlike" to "mesh", +giving the torch a three dimensional appearance. The mesh contains the +proper pixel mapping to make the animation appear as a particle above +the torch, while in fact the animation is just the texture of the mesh. + + +License: +~~~~~~~~ +(c) Copyright BlockMen (2013-2015) + +Textures and Meshes/Models: +CC-BY 3.0 BlockMen +Note that the models were entirely done from scratch by sofar. + +Code: +Licensed under the GNU LGPL version 2.1 or higher. +You can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License +as published by the Free Software Foundation; + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt + +--]] + +minetest.register_node("default:torch", { + description = "Torch", + drawtype = "mesh", + mesh = "torch_floor.obj", + inventory_image = "default_torch_on_floor.png", + wield_image = "default_torch_on_floor.png", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + liquids_pointable = false, + light_source = 12, + groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_bottom = {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local def = minetest.registered_nodes[node.name] + if def and def.on_rightclick and + ((not placer) or (placer and not placer:get_player_control().sneak)) then + return def.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + + local above = pointed_thing.above + local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above)) + local fakestack = itemstack + if wdir == 0 then + fakestack:set_name("default:torch_ceiling") + elseif wdir == 1 then + fakestack:set_name("default:torch") + else + fakestack:set_name("default:torch_wall") + end + + itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir) + itemstack:set_name("default:torch") + + return itemstack + end +}) + +minetest.register_node("default:torch_wall", { + drawtype = "mesh", + mesh = "torch_wall.obj", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = 12, + groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:torch_ceiling", { + drawtype = "mesh", + mesh = "torch_ceiling.obj", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = 12, + groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_lbm({ + name = "default:3dtorch", + nodenames = {"default:torch", "torches:floor", "torches:wall"}, + action = function(pos, node) + if node.param2 == 0 then + minetest.set_node(pos, {name = "default:torch_ceiling", + param2 = node.param2}) + elseif node.param2 == 1 then + minetest.set_node(pos, {name = "default:torch", + param2 = node.param2}) + else + minetest.set_node(pos, {name = "default:torch_wall", + param2 = node.param2}) + end + end +}) diff --git a/mods/default/trees-416.zip b/mods/default/trees-416.zip new file mode 100644 index 00000000..f82a2c0e Binary files /dev/null and b/mods/default/trees-416.zip differ diff --git a/mods/default/trees.lua b/mods/default/trees.lua index 3bc66887..81c9831e 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -17,7 +17,7 @@ function default.can_grow(pos) return false end local light_level = minetest.get_node_light(pos) - if not light_level or light_level < 10 then + if not light_level or light_level < 13 then return false end return true @@ -27,8 +27,7 @@ end -- 'is snow nearby' function local function is_snow_nearby(pos) - return minetest.find_node_near(pos, 1, - {"default:snow", "default:snowblock", "default:dirt_with_snow"}) + return minetest.find_node_near(pos, 1, {"group:snowy"}) end @@ -37,7 +36,7 @@ end function default.grow_sapling(pos) if not default.can_grow(pos) then -- try a bit later again - minetest.get_node_timer(pos):start(math.random(2, 6)) + minetest.get_node_timer(pos):start(math.random(240, 600)) return end @@ -78,6 +77,14 @@ function default.grow_sapling(pos) minetest.log("action", "An aspen sapling grows into a tree at ".. minetest.pos_to_string(pos)) default.grow_new_aspen_tree(pos) + elseif node.name == "default:bush_sapling" then + minetest.log("action", "A bush sapling grows into a bush at ".. + minetest.pos_to_string(pos)) + default.grow_bush(pos) + elseif node.name == "default:acacia_bush_sapling" then + minetest.log("action", "An acacia bush sapling grows into a bush at ".. + minetest.pos_to_string(pos)) + default.grow_acacia_bush(pos) end end @@ -373,7 +380,7 @@ function default.grow_new_apple_tree(pos) local path = minetest.get_modpath("default") .. "/schematics/apple_tree_from_sapling.mts" minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, - path, "0", nil, false) + path, "random", nil, false) end @@ -426,7 +433,30 @@ function default.grow_new_aspen_tree(pos) path, "0", nil, false) end ---[[ + +-- Bushes do not need 'from sapling' schematic variants because +-- only the stem node is force-placed in the schematic. + +-- Bush + +function default.grow_bush(pos) + local path = minetest.get_modpath("default") .. + "/schematics/bush.mts" + minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + path, "0", nil, false) +end + + +-- Acacia bush + +function default.grow_acacia_bush(pos) + local path = minetest.get_modpath("default") .. + "/schematics/acacia_bush.mts" + minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + path, "0", nil, false) +end + + -- -- Sapling 'on place' function to check protection of node and resulting tree volume -- @@ -458,21 +488,48 @@ function default.sapling_on_place(itemstack, placer, pointed_thing, return itemstack end -- Check tree volume for protection - if not default.intersects_protection( + if default.intersects_protection( vector.add(pos, minp_relative), vector.add(pos, maxp_relative), player_name, interval) then - minetest.set_node(pos, {name = sapling_name}) - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() - end - else minetest.record_protection_violation(pos, player_name) -- Print extra information to explain minetest.chat_send_player(player_name, "Tree will intersect protection") + return itemstack + end + + minetest.log("action", player_name .. " places node " + .. sapling_name .. " at " .. minetest.pos_to_string(pos)) + + local take_item = not (creative and creative.is_enabled_for + and creative.is_enabled_for(player_name)) + local newnode = {name = sapling_name} + local ndef = minetest.registered_nodes[sapling_name] + minetest.set_node(pos, newnode) + + -- Run callback + if ndef and ndef.after_place_node then + -- Deepcopy place_to and pointed_thing because callback can modify it + if ndef.after_place_node(table.copy(pos), placer, + itemstack, table.copy(pointed_thing)) then + take_item = false + end + end + + -- Run script hook + for _, callback in ipairs(minetest.registered_on_placenodes) do + -- Deepcopy pos, node and pointed_thing because callback can modify them + if callback(table.copy(pos), table.copy(newnode), + placer, table.copy(node or {}), + itemstack, table.copy(pointed_thing)) then + take_item = false + end + end + + if take_item then + itemstack:take_item() end return itemstack end -]] \ No newline at end of file diff --git a/mods/doors/init.lua b/mods/doors/init.lua index a80b6786..13347a37 100644 --- a/mods/doors/init.lua +++ b/mods/doors/init.lua @@ -6,6 +6,15 @@ local _doors = {} _doors.registered_doors = {} _doors.registered_trapdoors = {} +local function replace_old_owner_information(pos) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("doors_owner") + if owner and owner ~= "" then + meta:set_string("owner", owner) + meta:set_string("doors_owner", "") + end +end + -- returns an object to a door object or nil function doors.get(pos) local node_name = minetest.get_node(pos).name @@ -82,7 +91,7 @@ minetest.register_node("doors:hidden", { on_blast = function() end, tiles = {"doors_blank.png"}, -- 1px transparent block inside door hinge near node top. - nodebox = { + node_box = { type = "fixed", fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}, }, @@ -139,13 +148,10 @@ function _doors.door_toggle(pos, node, clicker) state = tonumber(state) end - if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then - local owner = meta:get_string("doors_owner") - if owner ~= "" then - if clicker:get_player_name() ~= owner then - return false - end - end + replace_old_owner_information(pos) + + if clicker and not default.can_interact_with_node(clicker, pos) then + return false end -- until Lua-5.2 we have no bitwise operators :( @@ -196,11 +202,13 @@ local function on_place_node(place_to, newnode, end local function can_dig_door(pos, digger) - local digger_name = digger and digger:get_player_name() - if digger_name and minetest.get_player_privs(digger_name).protection_bypass then + replace_old_owner_information(pos) + if default.can_interact_with_node(digger, pos) then return true + else + minetest.record_protection_violation(pos, digger:get_player_name()) + return false end - return minetest.get_meta(pos):get_string("doors_owner") == digger_name end function doors.register(name, def) @@ -246,6 +254,7 @@ function doors.register(name, def) minetest.register_craftitem(":" .. name, { description = def.description, inventory_image = def.inventory_image, + groups = table.copy(def.groups), on_place = function(itemstack, placer, pointed_thing) local pos @@ -256,7 +265,8 @@ function doors.register(name, def) local node = minetest.get_node(pointed_thing.under) local pdef = minetest.registered_nodes[node.name] - if pdef and pdef.on_rightclick then + if pdef and pdef.on_rightclick and + not placer:get_player_control().sneak then return pdef.on_rightclick(pointed_thing.under, node, placer, itemstack, pointed_thing) end @@ -314,14 +324,16 @@ function doors.register(name, def) meta:set_int("state", state) if def.protected then - meta:set_string("doors_owner", pn) + meta:set_string("owner", pn) meta:set_string("infotext", "Owned by " .. pn) end - if not minetest.setting_getbool("creative_mode") then + if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then itemstack:take_item() end + minetest.sound_play(def.sounds.place, {pos = pos}) + on_place_node(pos, minetest.get_node(pos), placer, node, itemstack, pointed_thing) @@ -364,13 +376,40 @@ function doors.register(name, def) end def.after_dig_node = function(pos, node, meta, digger) minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) - nodeupdate({x = pos.x, y = pos.y + 1, z = pos.z}) + minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z}) + end + def.on_rotate = function(pos, node, user, mode, new_param2) + return false end - def.on_rotate = screwdriver and screwdriver.rotate_simple or false if def.protected then def.can_dig = can_dig_door def.on_blast = function() end + def.on_key_use = function(pos, player) + local door = doors.get(pos) + door:toggle(player) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + replace_old_owner_information(pos) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local pname = player:get_player_name() + + -- verify placer is owner of lockable door + if owner ~= pname then + minetest.record_protection_violation(pos, pname) + minetest.chat_send_player(pname, "You do not own this locked door.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked door", owner + end else def.on_blast = function(pos, intensity) minetest.remove_node(pos) @@ -422,7 +461,7 @@ doors.register("door_steel", { inventory_image = "doors_item_steel.png", protected = true, groups = {cracky = 1, level = 2}, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), sound_open = "doors_steel_door_open", sound_close = "doors_steel_door_close", recipe = { @@ -490,14 +529,11 @@ end function _doors.trapdoor_toggle(pos, node, clicker) node = node or minetest.get_node(pos) - if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then - local meta = minetest.get_meta(pos) - local owner = meta:get_string("doors_owner") - if owner ~= "" then - if clicker:get_player_name() ~= owner then - return false - end - end + + replace_old_owner_information(pos) + + if clicker and not default.can_interact_with_node(clicker, pos) then + return false end local def = minetest.registered_nodes[node.name] @@ -519,7 +555,7 @@ function doors.register_trapdoor(name, def) if not name:find(":") then name = "doors:" .. name end - + local name_closed = name local name_opened = name.."_open" @@ -539,13 +575,38 @@ function doors.register_trapdoor(name, def) def.after_place_node = function(pos, placer, itemstack, pointed_thing) local pn = placer:get_player_name() local meta = minetest.get_meta(pos) - meta:set_string("doors_owner", pn) + meta:set_string("owner", pn) meta:set_string("infotext", "Owned by "..pn) - return minetest.setting_getbool("creative_mode") + return (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) end def.on_blast = function() end + def.on_key_use = function(pos, player) + local door = doors.get(pos) + door:toggle(player) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + replace_old_owner_information(pos) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local pname = player:get_player_name() + + -- verify placer is owner of lockable door + if owner ~= pname then + minetest.record_protection_violation(pos, pname) + minetest.chat_send_player(pname, "You do not own this trapdoor.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked trapdoor", owner + end else def.on_blast = function(pos, intensity) minetest.remove_node(pos) @@ -621,7 +682,7 @@ doors.register_trapdoor("doors:trapdoor_steel", { tile_front = "doors_trapdoor_steel.png", tile_side = "doors_trapdoor_steel_side.png", protected = true, - sounds = default.node_sound_stone_defaults(), + sounds = default.node_sound_metal_defaults(), sound_open = "doors_steel_door_open", sound_close = "doors_steel_door_close", groups = {cracky = 1, level = 2, door = 1}, @@ -696,7 +757,7 @@ function doors.register_fencegate(name, def) fence_open.collision_box = { type = "fixed", fixed = {{-1/2, -1/2, -1/4, -3/8, 1/2, 1/4}, - {-5/8, -3/8, -1/2, -3/8, 3/8, 0}}, + {-1/2, -3/8, -1/2, -3/8, 3/8, 0}}, } minetest.register_node(":" .. name .. "_closed", fence_closed) @@ -726,7 +787,7 @@ doors.register_fencegate("doors:gate_acacia_wood", { }) doors.register_fencegate("doors:gate_junglewood", { - description = "Junglewood Fence Gate", + description = "Jungle Wood Fence Gate", texture = "default_junglewood.png", material = "default:junglewood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} @@ -745,3 +806,48 @@ doors.register_fencegate("doors:gate_aspen_wood", { material = "default:aspen_wood", groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3} }) + + +----fuels---- + +minetest.register_craft({ + type = "fuel", + recipe = "doors:trapdoor", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:door_wood", + burntime = 14, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_wood_closed", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_acacia_wood_closed", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_junglewood_closed", + burntime = 9, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_pine_wood_closed", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_aspen_wood_closed", + burntime = 5, +}) diff --git a/mods/doors/textures/doors_door_glass.png b/mods/doors/textures/doors_door_glass.png index f597299b..26c427b9 100644 Binary files a/mods/doors/textures/doors_door_glass.png and b/mods/doors/textures/doors_door_glass.png differ diff --git a/mods/doors/textures/doors_door_obsidian_glass.png b/mods/doors/textures/doors_door_obsidian_glass.png index 107a5a1a..07ac5b20 100644 Binary files a/mods/doors/textures/doors_door_obsidian_glass.png and b/mods/doors/textures/doors_door_obsidian_glass.png differ diff --git a/mods/dye/README.txt b/mods/dye/README.txt index b1035419..a2fbdd24 100644 --- a/mods/dye/README.txt +++ b/mods/dye/README.txt @@ -1,15 +1,13 @@ Minetest Game mod: dye ====================== - +See license.txt for license information. See init.lua for documentation. -License of source code and media files: ---------------------------------------- -Copyright (C) 2012 Perttu Ahola (celeron55) - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) +Authors of media (textures) +--------------------------- +Perttu Ahola (celeron55) (CC BY-SA 3.0) diff --git a/mods/dye/init.lua b/mods/dye/init.lua index d414d77c..80284576 100644 --- a/mods/dye/init.lua +++ b/mods/dye/init.lua @@ -74,36 +74,39 @@ minetest.register_craft({ }) -- Mix recipes --- Just mix everything to everything somehow sanely - -local mixbases = {"pink", "magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white"} - -local mixes = { - -- pink, magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white - white = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","grey", "grey", "grey","white"}, - grey = {"pink", "pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet","dark_grey","grey", "grey"}, - dark_grey = {"brown", "brown", "brown", "brown", "brown", "brown", "dark_green","dark_green","blue", "blue", "violet","black", "dark_grey"}, - black = {"black", "black", "black", "black", "black", "black", "black", "black", "black","black", "black", "black"}, - violet = {"magenta","magenta","magenta","red", "brown", "red", "cyan", "brown", "blue", "violet","violet"}, - blue = {"violet", "violet", "magenta","brown", "brown", "dark_green","cyan", "cyan", "cyan", "blue"}, - cyan = {"brown", "blue", "brown", "dark_green","dark_grey", "green", "cyan", "dark_green","cyan"}, - dark_green = {"brown", "brown", "brown", "brown", "brown", "green", "green", "dark_green"}, - green = {"yellow", "brown", "yellow", "yellow", "dark_green","green", "green"}, - yellow = {"orange", "red", "orange", "yellow", "orange", "yellow"}, - brown = {"brown", "brown", "brown", "orange", "brown"}, - orange = {"orange", "red", "orange", "orange"}, - red = {"pink", "magenta","red"}, - magenta = {"magenta","magenta"}, - pink = {"pink"}, +local dye_recipes = { + -- src1, src2, dst + -- RYB mixes + {"red", "blue", "violet"}, -- "purple" + {"yellow", "red", "orange"}, + {"yellow", "blue", "green"}, + -- RYB complementary mixes + {"yellow", "violet", "dark_grey"}, + {"blue", "orange", "dark_grey"}, + -- CMY mixes - approximation + {"cyan", "yellow", "green"}, + {"cyan", "magenta", "blue"}, + {"yellow", "magenta", "red"}, + -- other mixes that result in a color we have + {"red", "green", "brown"}, + {"magenta", "blue", "violet"}, + {"green", "blue", "cyan"}, + {"pink", "violet", "magenta"}, + -- mixes with black + {"white", "black", "grey"}, + {"grey", "black", "dark_grey"}, + {"green", "black", "dark_green"}, + {"orange", "black", "brown"}, + -- mixes with white + {"white", "red", "pink"}, + {"white", "dark_grey", "grey"}, + {"white", "dark_green", "green"}, } -for one, results in pairs(mixes) do - for i, result in ipairs(results) do - local another = mixbases[i] - minetest.register_craft({ - type = "shapeless", - output = 'dye:' .. result .. ' 2', - recipe = {'dye:' .. one, 'dye:' .. another}, - }) - end +for _, mix in pairs(dye_recipes) do + minetest.register_craft({ + type = "shapeless", + output = 'dye:' .. mix[3] .. ' 2', + recipe = {'dye:' .. mix[1], 'dye:' .. mix[2]}, + }) end diff --git a/mods/dye/license.txt b/mods/dye/license.txt new file mode 100644 index 00000000..bf9d3501 --- /dev/null +++ b/mods/dye/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/es/biome.lua b/mods/es/biome.lua index c6c35d83..26dc82cc 100644 --- a/mods/es/biome.lua +++ b/mods/es/biome.lua @@ -9,16 +9,116 @@ minetest.clear_registered_biomes() minetest.clear_registered_decorations() + + + +-- Biomes for floatlands + +function default.register_floatland_biomes(floatland_level, shadow_limit) + + -- Coniferous forest + + minetest.register_biome({ + name = "floatland_coniferous_forest", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 70, + }) + + -- Grassland + + minetest.register_biome({ + name = "floatland_grassland", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 35, + }) + + -- Sandstone desert + + minetest.register_biome({ + name = "floatland_sandstone_desert", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 1, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 0, + }) + + -- Floatland ocean / underground + + minetest.register_biome({ + name = "floatland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = shadow_limit, + y_max = floatland_level + 1, + heat_point = 50, + humidity_point = 50, + }) +end + -- -- Register biomes -- + -- All mapgens except mgv6 and singlenode - -- Permanent ice + +function default.register_biomes(upper_limit) + + -- Icesheet minetest.register_biome({ - name = "glacier", + name = "icesheet", node_dust = "default:snowblock", node_top = "default:snowblock", depth_top = 1, @@ -29,48 +129,52 @@ minetest.clear_registered_decorations() depth_water_top = 10, --node_water = "", node_river_water = "default:ice", + node_riverbed = "default:gravel", + depth_riverbed = 2, y_min = -8, - y_max = 31000, + y_max = upper_limit, heat_point = 0, - humidity_point = 50, + humidity_point = 73, }) minetest.register_biome({ - name = "glacier_ocean", + name = "icesheet_ocean", node_dust = "default:snowblock", - node_top = "default:snowblock", + node_top = "default:sand", depth_top = 1, - node_filler = "default:ice", + node_filler = "default:sand", depth_filler = 3, --node_stone = "", - --node_water_top = "", - --depth_water_top = , + node_water_top = "default:ice", + depth_water_top = 10, --node_water = "", --node_river_water = "", y_min = -112, y_max = -9, heat_point = 0, - humidity_point = 50, + humidity_point = 73, }) - -- Cold + -- Tundra minetest.register_biome({ name = "tundra", - --node_dust = "", - node_top = "default:dirt_with_snow", - depth_top = 1, - node_filler = "default:dirt", - depth_filler = 1, + node_dust = "default:snowblock", + --node_top = , + --depth_top = , + --node_filler = , + --depth_filler = , --node_stone = "", --node_water_top = "", --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, y_min = 2, - y_max = 31000, - heat_point = 15, - humidity_point = 35, + y_max = upper_limit, + heat_point = 0, + humidity_point = 40, }) minetest.register_biome({ @@ -85,16 +189,18 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, y_min = -3, y_max = 1, - heat_point = 15, - humidity_point = 35, + heat_point = 0, + humidity_point = 40, }) minetest.register_biome({ name = "tundra_ocean", --node_dust = "", - node_top = "default:ice", + node_top = "default:sand", depth_top = 1, node_filler = "default:sand", depth_filler = 3, @@ -103,12 +209,15 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, y_min = -112, y_max = -4, - heat_point = 15, - humidity_point = 35, + heat_point = 0, + humidity_point = 40, }) + -- Taiga minetest.register_biome({ name = "taiga", @@ -122,16 +231,18 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = 2, - y_max = 31000, - heat_point = 15, - humidity_point = 65, + y_max = upper_limit, + heat_point = 25, + humidity_point = 70, }) minetest.register_biome({ name = "taiga_ocean", --node_dust = "", - node_top = "default:dirt", + node_top = "default:sand", depth_top = 1, node_filler = "default:sand", depth_filler = 3, @@ -140,16 +251,60 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = -112, y_max = 1, - heat_point = 15, - humidity_point = 65, + heat_point = 25, + humidity_point = 70, }) - -- Temperate + -- Snowy grassland minetest.register_biome({ - name = "stone_grassland", + name = "snowy_grassland", + node_dust = "default:snow", + node_top = "default:dirt_with_snow", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 20, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "snowy_grassland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 20, + humidity_point = 35, + }) + + -- Grassland + + minetest.register_biome({ + name = "grassland", --node_dust = "", node_top = "default:dirt_with_grass", depth_top = 1, @@ -160,14 +315,16 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = 6, - y_max = 31000, - heat_point = 40, + y_max = upper_limit, + heat_point = 50, humidity_point = 35, }) minetest.register_biome({ - name = "stone_grassland_dunes", + name = "grassland_dunes", --node_dust = "", node_top = "default:sand", depth_top = 1, @@ -178,14 +335,16 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = 5, y_max = 5, - heat_point = 40, + heat_point = 50, humidity_point = 35, }) minetest.register_biome({ - name = "stone_grassland_ocean", + name = "grassland_ocean", --node_dust = "", node_top = "default:sand", depth_top = 1, @@ -196,12 +355,15 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 40, + heat_point = 50, humidity_point = 35, }) + -- Coniferous forest minetest.register_biome({ name = "coniferous_forest", @@ -215,10 +377,12 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = 6, - y_max = 31000, - heat_point = 40, - humidity_point = 65, + y_max = upper_limit, + heat_point = 45, + humidity_point = 70, }) minetest.register_biome({ @@ -226,17 +390,19 @@ minetest.clear_registered_decorations() --node_dust = "", node_top = "default:sand", depth_top = 1, - node_filler = "default:gravel", + node_filler = "default:sand", depth_filler = 3, --node_stone = "", --node_water_top = "", --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = 5, y_max = 5, - heat_point = 40, - humidity_point = 65, + heat_point = 45, + humidity_point = 70, }) minetest.register_biome({ @@ -251,66 +417,15 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 40, - humidity_point = 65, + heat_point = 45, + humidity_point = 70, }) - - minetest.register_biome({ - name = "sandstone_grassland", - --node_dust = "", - node_top = "default:dirt_with_grass", - depth_top = 1, - node_filler = "default:dirt", - depth_filler = 1, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - y_min = 6, - y_max = 31000, - heat_point = 60, - humidity_point = 35, - }) - - minetest.register_biome({ - name = "sandstone_grassland_dunes", - --node_dust = "", - node_top = "default:sand", - depth_top = 1, - node_filler = "default:sand", - depth_filler = 2, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - y_min = 5, - y_max = 5, - heat_point = 60, - humidity_point = 35, - }) - - minetest.register_biome({ - name = "sandstone_grassland_ocean", - --node_dust = "", - node_top = "default:sand", - depth_top = 1, - node_filler = "default:sand", - depth_filler = 3, - node_stone = "default:sandstone", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - y_min = -112, - y_max = 4, - heat_point = 60, - humidity_point = 35, - }) + -- Deciduous forest minetest.register_biome({ name = "deciduous_forest", @@ -324,14 +439,16 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = 1, - y_max = 31000, + y_max = upper_limit, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) minetest.register_biome({ - name = "deciduous_forest_swamp", + name = "deciduous_forest_shore", --node_dust = "", node_top = "default:dirt", depth_top = 1, @@ -342,16 +459,18 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", - y_min = -3, + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -1, y_max = 0, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) minetest.register_biome({ name = "deciduous_forest_ocean", --node_dust = "", - node_top = "default:dirt", + node_top = "default:sand", depth_top = 1, node_filler = "default:sand", depth_filler = 3, @@ -360,13 +479,15 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = -112, - y_max = -4, + y_max = -2, heat_point = 60, - humidity_point = 65, + humidity_point = 68, }) - -- Hot + -- Desert minetest.register_biome({ name = "desert", @@ -380,10 +501,12 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = 5, - y_max = 31000, - heat_point = 85, - humidity_point = 20, + y_max = upper_limit, + heat_point = 92, + humidity_point = 16, }) minetest.register_biome({ @@ -398,12 +521,99 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = -112, y_max = 4, - heat_point = 85, - humidity_point = 20, + heat_point = 92, + humidity_point = 16, }) + -- Sandstone desert + + minetest.register_biome({ + name = "sandstone_desert", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 1, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 60, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "sandstone_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 60, + humidity_point = 0, + }) + + -- Cold desert + + minetest.register_biome({ + name = "cold_desert", + --node_dust = "", + node_top = "default:silver_sand", + depth_top = 1, + node_filler = "default:silver_sand", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 40, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "cold_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 40, + humidity_point = 0, + }) + + -- Savanna minetest.register_biome({ name = "savanna", @@ -417,32 +627,16 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, y_min = 1, - y_max = 31000, - heat_point = 85, - humidity_point = 50, + y_max = upper_limit, + heat_point = 89, + humidity_point = 42, }) minetest.register_biome({ - name = "savanna_swamp", - --node_dust = "", - node_top = "es:dry_dirt", - depth_top = 1, - node_filler = "default:dirt", - depth_filler = 3, - --node_stone = "", - --node_water_top = "", - --depth_water_top = , - --node_water = "", - --node_river_water = "", - y_min = -3, - y_max = 0, - heat_point = 85, - humidity_point = 50, - }) - - minetest.register_biome({ - name = "savanna_ocean", + name = "savanna_shore", --node_dust = "", node_top = "es:mud", depth_top = 1, @@ -453,29 +647,54 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", - y_min = -112, - y_max = -4, - heat_point = 85, - humidity_point = 50, + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -1, + y_max = 0, + heat_point = 89, + humidity_point = 42, }) - minetest.register_biome({ - name = "rainforest", + name = "savanna_ocean", --node_dust = "", - node_top = "default:dirt_with_grass", + node_top = "es:mud", depth_top = 1, - node_filler = "default:dirt", + node_filler = "es:mud", depth_filler = 3, --node_stone = "", --node_water_top = "", --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "es:mud", + depth_riverbed = 2, + y_min = -112, + y_max = -2, + heat_point = 89, + humidity_point = 42, + }) + + -- Rainforest + + minetest.register_biome({ + name = "rainforest", + --node_dust = "", + node_top = "default:dirt_with_rainforest_litter", + depth_top = 1, + node_filler = "es:mud", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "es:mud", + depth_riverbed = 2, y_min = 1, - y_max = 31000, - heat_point = 85, - humidity_point = 80, + y_max = upper_limit, + heat_point = 86, + humidity_point = 65, }) minetest.register_biome({ @@ -490,10 +709,12 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", - y_min = -3, + node_riverbed = "es:mud", + depth_riverbed = 2, + y_min = -1, y_max = 0, - heat_point = 85, - humidity_point = 80, + heat_point = 86, + humidity_point = 65, }) minetest.register_biome({ @@ -508,10 +729,12 @@ minetest.clear_registered_decorations() --depth_water_top = , --node_water = "", --node_river_water = "", + node_riverbed = "es:mud", + depth_riverbed = 2, y_min = -112, - y_max = -4, - heat_point = 85, - humidity_point = 80, + y_max = -2, + heat_point = 86, + humidity_point = 65, }) -- Underground @@ -532,8 +755,8 @@ minetest.clear_registered_decorations() y_max = -113, heat_point = 50, humidity_point = 50, - }) - + }) +--end --ES BIOMES --HOT minetest.register_biome({ @@ -680,7 +903,7 @@ minetest.clear_registered_decorations() heat_point = 25, humidity_point = 35, }) - +end --DECORATIONS @@ -1052,12 +1275,95 @@ end --DEFAULT V7 ---- --- Register decorations --- +function default.register_mgv6_decorations() + + -- Papyrus + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + 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, + }) + + -- Long 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 --- All mapgens except mgv6 and singlenode +-- All mapgens except mgv6 local function register_grass_decoration(offset, scale, length) minetest.register_decoration({ @@ -1072,13 +1378,12 @@ local function register_grass_decoration(offset, scale, length) octaves = 3, persist = 0.6 }, - biomes = {"stone_grassland", "sandstone_grassland", - "deciduous_forest", "coniferous_forest", - "stone_grassland_dunes", "sandstone_grassland_dunes", - "coniferous_forest_dunes"}, + biomes = {"grassland", "grassland_dunes", "deciduous_forest", + "coniferous_forest", "coniferous_forest_dunes", + "floatland_grassland", "floatland_coniferous_forest"}, y_min = 1, y_max = 31000, - decoration = "default:grass_"..length, + decoration = "default:grass_" .. length, }) end @@ -1098,12 +1403,12 @@ local function register_dry_grass_decoration(offset, scale, length) biomes = {"savanna"}, y_min = 1, y_max = 31000, - decoration = "default:dry_grass_"..length, + decoration = "default:dry_grass_" .. length, }) end ---function default.register_decorations() - --minetest.clear_registered_decorations() + +function default.register_decorations() -- Apple tree and log @@ -1122,8 +1427,9 @@ end biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/apple_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts", flags = "place_center_x, place_center_z", + rotation = "random", }) minetest.register_decoration({ @@ -1141,20 +1447,7 @@ end biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:tree", param2 = 12, prob = 191}, - {name = "default:tree", param2 = 12}, - {name = "default:tree", param2 = 12, prob = 127}, - {name = "air", prob = 0}, - {name = "flowers:mushroom_brown", prob = 63}, - {name = "air", prob = 0}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/apple_log.mts", flags = "place_center_x", rotation = "random", }) @@ -1163,39 +1456,26 @@ end minetest.register_decoration({ deco_type = "schematic", - place_on = {"default:dirt_with_grass", "default:dirt"}, - sidelen = 80, - fill_ratio = 0.09, + place_on = {"default:dirt_with_rainforest_litter", "default:dirt"}, + sidelen = 16, + fill_ratio = 0.1, biomes = {"rainforest", "rainforest_swamp"}, - y_min = 0, + y_min = -1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/jungle_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) minetest.register_decoration({ deco_type = "schematic", - place_on = {"default:dirt_with_grass", "default:dirt"}, - sidelen = 80, - fill_ratio = 0.01, + place_on = {"default:dirt_with_rainforest_litter", "default:dirt"}, + sidelen = 16, + fill_ratio = 0.005, biomes = {"rainforest", "rainforest_swamp"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:jungletree", param2 = 12, prob = 191}, - {name = "default:jungletree", param2 = 12}, - {name = "default:jungletree", param2 = 12, prob = 127}, - {name = "air", prob = 0}, - {name = "flowers:mushroom_brown", prob = 127}, - {name = "air", prob = 0}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/jungle_log.mts", flags = "place_center_x", rotation = "random", }) @@ -1214,10 +1494,10 @@ end octaves = 3, persist = 0.66 }, - biomes = {"taiga", "coniferous_forest"}, + biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"}, y_min = 2, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/pine_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts", flags = "place_center_x, place_center_z", }) @@ -1236,20 +1516,7 @@ end biomes = {"taiga", "coniferous_forest"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:pine_tree", param2 = 12, prob = 191}, - {name = "default:pine_tree", param2 = 12}, - {name = "default:pine_tree", param2 = 12, prob = 127}, - {name = "air", prob = 0}, - {name = "flowers:mushroom_red", prob = 63}, - {name = "air", prob = 0}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts", flags = "place_center_x", rotation = "random", }) @@ -1271,7 +1538,7 @@ end biomes = {"savanna"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/acacia_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts", flags = "place_center_x, place_center_z", rotation = "random", }) @@ -1291,17 +1558,7 @@ end biomes = {"savanna"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 2, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:acacia_tree", param2 = 12, prob = 191}, - {name = "default:acacia_tree", param2 = 12}, - {name = "default:acacia_tree", param2 = 12, prob = 127}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_log.mts", flags = "place_center_x", rotation = "random", }) @@ -1323,7 +1580,7 @@ end biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/aspen_tree.mts", + schematic = minetest.get_modpath("default") .. "/schematics/aspen_tree.mts", flags = "place_center_x, place_center_z", }) @@ -1342,23 +1599,11 @@ end biomes = {"deciduous_forest"}, y_min = 1, y_max = 31000, - schematic = { - size = {x = 3, y = 3, z = 1}, - data = { - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "air", prob = 0}, - {name = "default:aspen_tree", param2 = 12}, - {name = "default:aspen_tree", param2 = 12}, - {name = "default:aspen_tree", param2 = 12, prob = 127}, - {name = "flowers:mushroom_red", prob = 63}, - {name = "flowers:mushroom_brown", prob = 63}, - {name = "air", prob = 0}, - }, - }, + schematic = minetest.get_modpath("default") .. "/schematics/aspen_log.mts", flags = "place_center_x", rotation = "random", }) + -- Large cactus minetest.register_decoration({ @@ -1376,7 +1621,7 @@ end biomes = {"desert"}, y_min = 5, y_max = 31000, - schematic = minetest.get_modpath("default").."/schematics/large_cactus.mts", + schematic = minetest.get_modpath("default") .. "/schematics/large_cactus.mts", flags = "place_center_x", rotation = "random", }) @@ -1400,7 +1645,7 @@ end y_max = 31000, decoration = "default:cactus", height = 2, - y_max = 5, + height_max = 5, }) -- Papyrus @@ -1417,10 +1662,53 @@ end octaves = 3, persist = 0.7 }, - biomes = {"savanna_swamp"}, + biomes = {"savanna_shore"}, y_min = 0, y_max = 0, - schematic = minetest.get_modpath("default").."/schematics/papyrus.mts", + schematic = minetest.get_modpath("default") .. "/schematics/papyrus.mts", + }) + + -- Bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 137, + octaves = 3, + persist = 0.7, + }, + biomes = {"snowy_grassland", "grassland", "deciduous_forest", + "floatland_grassland"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/bush.mts", + flags = "place_center_x, place_center_z", + }) + + -- Acacia bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 90155, + octaves = 3, + persist = 0.7, + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_bush.mts", + flags = "place_center_x, place_center_z", }) -- Grasses @@ -1443,8 +1731,8 @@ end minetest.register_decoration({ deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 80, + place_on = {"default:dirt_with_rainforest_litter"}, + sidelen = 16, fill_ratio = 0.1, biomes = {"rainforest"}, y_min = 1, @@ -1456,7 +1744,8 @@ end minetest.register_decoration({ deco_type = "simple", - place_on = {"default:desert_sand", "default:dirt_with_snow"}, + place_on = {"default:desert_sand", + "default:sand", "default:silver_sand"}, sidelen = 16, noise_params = { offset = 0, @@ -1466,83 +1755,72 @@ end octaves = 3, persist = 0.6 }, - biomes = {"desert", "tundra"}, + biomes = {"desert", "sandstone_desert", "cold_desert"}, y_min = 2, y_max = 31000, decoration = "default:dry_shrub", }) ---end + -- Coral reef --- --- Generate nyan cats --- - --- All mapgens except singlenode - -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 - 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 y_min = -31000 - --local y_max = -32 - local y_max = 32 - if maxp.y < y_min or minp.y > y_max then - return - end - local y_min = math.max(minp.y, y_min) - local y_max = math.min(maxp.y, y_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 + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:sand"}, + noise_params = { + offset = -0.15, + scale = 0.1, + spread = {x = 100, y = 100, z = 100}, + seed = 7013, + octaves = 3, + persist = 1, + }, + biomes = { + "desert_ocean", + "savanna_ocean", + "rainforest_ocean", + }, + y_min = -8, + y_max = -2, + schematic = minetest.get_modpath("default") .. "/schematics/corals.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) end -- --- Detect mapgen to select functions +-- Detect mapgen, flags and parameters 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 +-- Get setting or default +local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or + "mountains, ridges, nofloatlands" +local captures_float = string.match(mgv7_spflags, "floatlands") +local captures_nofloat = string.match(mgv7_spflags, "nofloatlands") + +local mgv7_floatland_level = minetest.get_mapgen_setting("mgv7_floatland_level") or 1280 +local mgv7_shadow_limit = minetest.get_mapgen_setting("mgv7_shadow_limit") or 1024 + +minetest.clear_registered_biomes() +minetest.clear_registered_ores() +minetest.clear_registered_decorations() + +local mg_name = minetest.get_mapgen_setting("mg_name") +if mg_name == "v6" then + default.register_mgv6_blob_ores() default.register_ores() default.register_mgv6_decorations() - minetest.register_on_generated(default.generate_nyancats) -elseif mg_params.mgname ~= "singlenode" then - default.register_biomes() +elseif mg_name == "v7" and captures_float == "floatlands" and + captures_nofloat ~= "nofloatlands" then + -- Mgv7 with floatlands + default.register_biomes(mgv7_shadow_limit - 1) + default.register_floatland_biomes(mgv7_floatland_level, mgv7_shadow_limit) + default.register_blob_ores() + default.register_ores() + default.register_decorations() +else + default.register_biomes(31000) + default.register_blob_ores() default.register_ores() default.register_decorations() - minetest.register_on_generated(default.generate_nyancats) end -]] \ No newline at end of file diff --git a/mods/farming/README.txt b/mods/farming/README.txt index 86a5fe3e..95c8154d 100644 --- a/mods/farming/README.txt +++ b/mods/farming/README.txt @@ -13,6 +13,8 @@ This mod works by adding your new plant to the {growing=1} group and numbering t Changelog: +1.25 - Added check for farming.conf setting file to disable specific crops globally (inside mod folder) or world specific (inside world folder) +1.24 - Added Hemp which can be crafted into fibre, paper, string, rope and oil. 1.23 - Huge code tweak and tidy done and added barley seeds to be found in dry grass, barley can make flour for bread also. 1.22 - Added grape bushes at high climates which can be cultivated into grape vines using trellis (9 sticks). 1.21 - Added auto-refill code for planting crops (thanks crabman77), also fixed a few bugs @@ -45,6 +47,9 @@ Changelog: 0.1 - Fixed growing bug 0.0 - Initial release +Lucky Blocks: 11 (plus 3 for default farming items) + + License of media (textures): ---------------------------- Created by PilzAdam (License: WTFPL): @@ -147,4 +152,5 @@ Created by TenPlus1 farming_rhubarb_2.png farming_rhubarb_3.png farming_rhubarb.png - farming_rhubarb_pie.png \ No newline at end of file + farming_rhubarb_pie.png + farming_hemp*.png diff --git a/mods/farming/beanpole.lua b/mods/farming/beanpole.lua index cef27673..fd933837 100644 --- a/mods/farming/beanpole.lua +++ b/mods/farming/beanpole.lua @@ -6,6 +6,60 @@ local S = farming.intllib +-- place beans +function place_beans(itemstack, placer, pointed_thing, plantname) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + -- check if pointing at bean pole + if under.name ~= "farming:beanpole" then + return + end + + -- add the node and remove 1 item from the itemstack + minetest.set_node(pt.under, {name = plantname}) + + minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) + + if not minetest.setting_getbool("creative_mode") then + + itemstack:take_item() + + -- check for refill + if itemstack:get_count() == 0 then + + minetest.after(0.20, + farming.refill_plant, + placer, + "farming:beans", + placer:get_wield_index() + ) + end + end + + return itemstack +end + -- beans minetest.register_craftitem("farming:beans", { description = S("Green Beans"), @@ -13,39 +67,8 @@ minetest.register_craftitem("farming:beans", { on_use = minetest.item_eat(1), on_place = function(itemstack, placer, pointed_thing) - - if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then - return - end - - local nodename = minetest.get_node(pointed_thing.under).name - - if nodename == "farming:beanpole" then - minetest.set_node(pointed_thing.under, {name = "farming:beanpole_1"}) - - minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0}) - else - return - end - - if not minetest.setting_getbool("creative_mode") then - - itemstack:take_item() - - -- check for refill - if itemstack:get_count() == 0 then - - minetest.after(0.20, - farming.refill_plant, - placer, - "farming:beans", - placer:get_wield_index() - ) - end - end - - return itemstack - end + return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1") + end, }) -- beans can be used for green dye @@ -62,7 +85,7 @@ minetest.register_node("farming:beanpole", { drawtype = "plantlike", tiles = {"farming_beanpole.png"}, inventory_image = "farming_beanpole.png", - visual_scale = 1.45, + visual_scale = 1.90, -- 1.45, paramtype = "light", walkable = false, buildable_to = true, @@ -125,7 +148,7 @@ minetest.register_craft({ local crop_def = { drawtype = "plantlike", tiles = {"farming_beanpole_1.png"}, - visual_scale = 1.45, + visual_scale = 1.90, -- 1.45, paramtype = "light", walkable = false, buildable_to = true, diff --git a/mods/farming/cocoa.lua b/mods/farming/cocoa.lua index 29cc96b0..fad1733e 100644 --- a/mods/farming/cocoa.lua +++ b/mods/farming/cocoa.lua @@ -10,14 +10,21 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname) if not pt or pt.type ~= "node" then return end - + local under = minetest.get_node(pt.under) - + -- return if any of the nodes are not registered if not minetest.registered_nodes[under.name] then return end + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + -- check if pointing at jungletree if under.name ~= "default:jungletree" or minetest.get_node(pt.above).name ~= "air" then diff --git a/mods/farming/compatibility.lua b/mods/farming/compatibility.lua index a875d9bc..b7c906c8 100644 --- a/mods/farming/compatibility.lua +++ b/mods/farming/compatibility.lua @@ -7,9 +7,27 @@ if eth then minetest.register_alias("farming_plus:banana_leaves", "ethereal:bananaleaves") minetest.register_alias("farming_plus:banana", "ethereal:banana") else + minetest.register_node(":ethereal:banana", { + description = "Banana", + drawtype = "torchlike", + tiles = {"banana_single.png"}, + inventory_image = "banana_single.png", + wield_image = "banana_single.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2} + }, + groups = {fleshy = 3, dig_immediate = 3, flammable = 2}, + on_use = minetest.item_eat(2), + sounds = default.node_sound_leaves_defaults(), + }) + minetest.register_alias("farming_plus:banana_sapling", "default:sapling") minetest.register_alias("farming_plus:banana_leaves", "default:leaves") - minetest.register_alias("farming_plus:banana", "default:apple") + minetest.register_alias("farming_plus:banana", "ethereal:banana") end -- Carrot @@ -18,10 +36,10 @@ minetest.register_alias("farming_plus:carrot_1", "farming:carrot_1") minetest.register_alias("farming_plus:carrot_2", "farming:carrot_4") minetest.register_alias("farming_plus:carrot_3", "farming:carrot_6") minetest.register_alias("farming_plus:carrot", "farming:carrot_8") +minetest.register_alias("farming_plus:carrot_item", "farming:carrot") -- Cocoa - -minetest.register_alias("farming_plus:cocoa_sapling", "farming:cocoa_beans") +minetest.register_alias("farming_plus:cocoa_sapling", "farming:cocoa_2") minetest.register_alias("farming_plus:cocoa_leaves", "default:leaves") minetest.register_alias("farming_plus:cocoa", "default:apple") minetest.register_alias("farming_plus:cocoa_bean", "farming:cocoa_beans") @@ -30,13 +48,33 @@ minetest.register_alias("farming_plus:cocoa_bean", "farming:cocoa_beans") minetest.register_alias("farming_plus:orange_1", "farming:tomato_1") minetest.register_alias("farming_plus:orange_2", "farming:tomato_4") minetest.register_alias("farming_plus:orange_3", "farming:tomato_6") -minetest.register_alias("farming_plus:orange", "farming:tomato_8") +--minetest.register_alias("farming_plus:orange", "farming:tomato_8") if eth then minetest.register_alias("farming_plus:orange_item", "ethereal:orange") + minetest.register_alias("farming_plus:orange", "ethereal:orange") minetest.register_alias("farming_plus:orange_seed", "ethereal:orange_tree_sapling") else - minetest.register_alias("farming_plus:orange_item", "default:apple") + minetest.register_node(":ethereal:orange", { + description = "Orange", + drawtype = "plantlike", + tiles = {"farming_orange.png"}, + inventory_image = "farming_orange.png", + wield_image = "farming_orange.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.2, -0.3, -0.2, 0.2, 0.2, 0.2} + }, + groups = {fleshy = 3, dig_immediate = 3, flammable = 2}, + on_use = minetest.item_eat(4), + sounds = default.node_sound_leaves_defaults(), + }) + + minetest.register_alias("farming_plus:orange_item", "ethereal:orange") + minetest.register_alias("farming_plus:orange", "ethereal:orange") minetest.register_alias("farming_plus:orange_seed", "default:sapling") end @@ -49,15 +87,15 @@ minetest.register_alias("farming_plus:potato_seed", "farming:potato") -- Pumpkin minetest.register_alias("farming:pumpkin_seed", "farming:pumpkin_slice") -minetest.register_alias("farming:pumpkin_face", "farming:pumpkin") -minetest.register_alias("farming:pumpkin_face_light", "farming:jackolantern") +minetest.register_alias("farming:pumpkin_face", "farming:jackolantern") +minetest.register_alias("farming:pumpkin_face_light", "farming:jackolantern_on") minetest.register_alias("farming:big_pumpkin", "farming:pumpkin") minetest.register_alias("farming:big_pumpkin_side", "air") minetest.register_alias("farming:big_pumpkin_corner", "air") minetest.register_alias("farming:big_pumpkin_top", "air") -minetest.register_alias("farming:scarecrow", "farming:pumpkin") +minetest.register_alias("farming:scarecrow", "farming:jackolantern") minetest.register_alias("farming:scarecrow_bottom", "default:fence_wood") -minetest.register_alias("farming:scarecrow_light", "farming:jackolantern") +minetest.register_alias("farming:scarecrow_light", "farming:jackolantern_on") minetest.register_alias("farming:pumpkin_flour", "farming:pumpkin_dough") -- Rhubarb @@ -76,8 +114,15 @@ if eth then minetest.register_alias("farming_plus:strawberry_3", "ethereal:strawberry_5") minetest.register_alias("farming_plus:strawberry", "ethereal:strawberry_7") else - minetest.register_alias("farming_plus:strawberry_item", "farming:raspberries") - minetest.register_alias("farming_plus:strawberry_seed", "farming:raspberries") + minetest.register_craftitem(":ethereal:strawberry", { + description = "Strawberry", + inventory_image = "strawberry.png", + wield_image = "strawberry.png", + on_use = minetest.item_eat(1), + }) + + minetest.register_alias("farming_plus:strawberry_item", "ethereal:strawberry") + minetest.register_alias("farming_plus:strawberry_seed", "ethereal:strawberry") minetest.register_alias("farming_plus:strawberry_1", "farming:raspberry_1") minetest.register_alias("farming_plus:strawberry_2", "farming:raspberry_2") minetest.register_alias("farming_plus:strawberry_3", "farming:raspberry_3") @@ -95,3 +140,17 @@ minetest.register_alias("farming_plus:tomato", "farming:tomato_8") -- Weed minetest.register_alias("farming:weed", "default:grass_2") + +-- Classic Bushes compatibility +if minetest.get_modpath("bushes_classic") then + + if eth then + minetest.register_alias("bushes:strawberry", "farming:strawberry") + else + minetest.register_alias("bushes:strawberry", "farming:raspberries") + end + + minetest.register_alias("bushes:blueberry", "farming:blueberries") + minetest.register_alias("bushes:raspberry", "farming:raspberries") + +end \ No newline at end of file diff --git a/mods/farming/corn.lua b/mods/farming/corn.lua index f178a48d..402ec828 100644 --- a/mods/farming/corn.lua +++ b/mods/farming/corn.lua @@ -31,9 +31,21 @@ minetest.register_craft({ }) -- ethanol (thanks to JKMurray for this idea) -minetest.register_craftitem("farming:bottle_ethanol", { +minetest.register_node("farming:bottle_ethanol", { description = S("Bottle of Ethanol"), + drawtype = "plantlike", + tiles = {"farming_bottle_ethanol.png"}, inventory_image = "farming_bottle_ethanol.png", + wield_image = "farming_bottle_ethanol.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), }) minetest.register_craft( { @@ -89,7 +101,7 @@ minetest.register_node("farming:corn_5", table.copy(crop_def)) -- stage 6 crop_def.tiles = {"farming_corn_6.png"} -crop_def.visual_scale = 1.45 +crop_def.visual_scale = 1.9 -- 1.45 minetest.register_node("farming:corn_6", table.copy(crop_def)) -- stage 7 diff --git a/mods/farming/cucumber.lua b/mods/farming/cucumber.lua index 8e292154..eb29347b 100644 --- a/mods/farming/cucumber.lua +++ b/mods/farming/cucumber.lua @@ -48,7 +48,7 @@ crop_def.tiles = {"farming_cucumber_4.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:cucumber'}, rarity = 1}, + {items = {'farming:cucumber 2'}, rarity = 1}, {items = {'farming:cucumber 2'}, rarity = 2}, } } diff --git a/mods/farming/depends.txt b/mods/farming/depends.txt index 8c4c21f4..8a8d2a27 100644 --- a/mods/farming/depends.txt +++ b/mods/farming/depends.txt @@ -1,3 +1,3 @@ default -wool intllib? +lucky_block? \ No newline at end of file diff --git a/mods/farming/farming.conf_example b/mods/farming/farming.conf_example new file mode 100644 index 00000000..696d0079 --- /dev/null +++ b/mods/farming/farming.conf_example @@ -0,0 +1,27 @@ + +--[[ + Farming settings can be changed here and kept inside mod folder + even after the mod has been updated, or you can place inside + world folder for map specific settings. +--]] + +-- true to enable crop/food in-game and on mapgen +farming.carrot = true +farming.potato = true +farming.tomato = true +farming.cucumber = true +farming.corn = true +farming.coffee = true +farming.coffee = true +farming.melon = true +farming.sugar = true +farming.pumpkin = true +farming.cocoa = true +farming.raspberry = true +farming.blueberry = true +farming.rhubarb = true +farming.beans = true +farming.grapes = true +farming.barley = true +farming.hemp = true +farming.donuts = true diff --git a/mods/farming/grapes.lua b/mods/farming/grapes.lua index 7a3bfc5f..9070d0e3 100644 --- a/mods/farming/grapes.lua +++ b/mods/farming/grapes.lua @@ -1,6 +1,60 @@ local S = farming.intllib +-- place trellis +function place_grapes(itemstack, placer, pointed_thing, plantname) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + -- check if pointing at trellis + if under.name ~= "farming:trellis" then + return + end + + -- add the node and remove 1 item from the itemstack + minetest.set_node(pt.under, {name = plantname}) + + minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) + + if not minetest.setting_getbool("creative_mode") then + + itemstack:take_item() + + -- check for refill + if itemstack:get_count() == 0 then + + minetest.after(0.20, + farming.refill_plant, + placer, + "farming:grapes", + placer:get_wield_index() + ) + end + end + + return itemstack +end + -- grapes minetest.register_craftitem("farming:grapes", { description = S("Grapes"), @@ -8,39 +62,8 @@ minetest.register_craftitem("farming:grapes", { on_use = minetest.item_eat(2), on_place = function(itemstack, placer, pointed_thing) - - if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then - return - end - - local nodename = minetest.get_node(pointed_thing.under).name - - if nodename == "farming:trellis" then - minetest.set_node(pointed_thing.under, {name = "farming:grapes_1"}) - - minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0}) - else - return - end - - if not minetest.setting_getbool("creative_mode") then - - itemstack:take_item() - - -- check for refill - if itemstack:get_count() == 0 then - - minetest.after(0.20, - farming.refill_plant, - placer, - "farming:grapes", - placer:get_wield_index() - ) - end - end - - return itemstack - end + return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1") + end, }) -- grapes can be used for violet dye @@ -57,7 +80,7 @@ minetest.register_node("farming:trellis", { drawtype = "plantlike", tiles = {"farming_trellis.png"}, inventory_image = "farming_trellis.png", - visual_scale = 1.45, + visual_scale = 1.9, -- 1.45, paramtype = "light", walkable = false, buildable_to = true, @@ -120,7 +143,7 @@ minetest.register_craft({ local crop_def = { drawtype = "plantlike", tiles = {"farming_grapes_1.png"}, - visual_scale = 1.45, + visual_scale = 1.9, -- 1.45, paramtype = "light", walkable = false, buildable_to = true, diff --git a/mods/farming/hemp.lua b/mods/farming/hemp.lua new file mode 100644 index 00000000..29b6a42d --- /dev/null +++ b/mods/farming/hemp.lua @@ -0,0 +1,213 @@ + +local S = farming.intllib + +-- hemp seeds +minetest.register_node("farming:seed_hemp", { + description = S("Hemp Seed"), + tiles = {"farming_hemp_seed.png"}, + inventory_image = "farming_hemp_seed.png", + wield_image = "farming_hemp_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1") + end, +}) + +-- harvested hemp +minetest.register_craftitem("farming:hemp_leaf", { + description = S("Hemp Leaf"), + inventory_image = "farming_hemp_leaf.png", +}) + +-- hemp oil +minetest.register_node("farming:hemp_oil", { + description = S("Bottle of Hemp Oil"), + drawtype = "plantlike", + tiles = {"farming_hemp_oil.png"}, + inventory_image = "farming_hemp_oil.png", + wield_image = "farming_hemp_oil.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft( { + output = "farming:hemp_oil", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"", "vessels:glass_bottle", ""} + } +}) + +minetest.register_craft( { + output = "farming:hemp_oil", + recipe = { + {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, + {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, + {"farming:seed_hemp", "vessels:glass_bottle", "farming:seed_hemp"} + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:hemp_oil", + burntime = 20, + replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}} +}) + +-- hemp fibre +minetest.register_craftitem("farming:hemp_fibre", { + description = S("Hemp Fibre"), + inventory_image = "farming_hemp_fibre.png", +}) + +minetest.register_craft( { + output = "farming:hemp_fibre 8", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} + }, + replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}} +}) + +minetest.register_craft( { + output = "farming:hemp_fibre 8", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} + }, + replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}} +}) + +-- paper +minetest.register_craft( { + output = "default:paper", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + } +}) + +-- string +minetest.register_craft( { + output = "farming:cotton", + recipe = { + {"farming:hemp_fibre"}, + {"farming:hemp_fibre"}, + {"farming:hemp_fibre"}, + } +}) + +-- hemp rope +minetest.register_node("farming:hemp_rope", { + description = S("Hemp Rope"), + walkable = false, + climbable = true, + sunlight_propagates = true, + paramtype = "light", + tiles = {"farming_hemp_rope.png"}, + wield_image = "farming_hemp_rope.png", + inventory_image = "farming_hemp_rope.png", + drawtype = "plantlike", + groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, +}) + +-- string +minetest.register_craft( { + output = "farming:hemp_rope 6", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + {"farming:cotton", "farming:cotton", "farming:cotton"}, + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + } +}) + +-- hemp definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_hemp_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:hemp_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_hemp_2.png"} +minetest.register_node("farming:hemp_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_hemp_3.png"} +minetest.register_node("farming:hemp_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_hemp_4.png"} +minetest.register_node("farming:hemp_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_hemp_5.png"} +minetest.register_node("farming:hemp_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_hemp_6.png"} +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf'}, rarity = 2}, + {items = {'farming:seed_hemp'}, rarity = 1}, + } +} +minetest.register_node("farming:hemp_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_hemp_7.png"} +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf'}, rarity = 1}, + {items = {'farming:hemp_leaf'}, rarity = 3}, + {items = {'farming:seed_hemp'}, rarity = 1}, + {items = {'farming:seed_hemp'}, rarity = 3}, + } +} +minetest.register_node("farming:hemp_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_hemp_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf 2'}, rarity = 1}, + {items = {'farming:hemp_leaf'}, rarity = 2}, + {items = {'farming:seed_hemp'}, rarity = 1}, + {items = {'farming:seed_hemp'}, rarity = 2}, + } +} +minetest.register_node("farming:hemp_8", table.copy(crop_def)) diff --git a/mods/farming/init.lua b/mods/farming/init.lua index 922be4a7..ab30f60d 100644 --- a/mods/farming/init.lua +++ b/mods/farming/init.lua @@ -1,5 +1,5 @@ --[[ - Minetest Farming Redo Mod 1.22 (4th June 2016) + Farming Redo Mod 1.25 (6th May 2017) by TenPlus1 NEW growing routine by prestidigitator auto-refill by crabman77 @@ -14,38 +14,6 @@ farming.select = { fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} } -farming.DEBUG = false --- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions - -local DEBUG_abm_runs = 0 -local DEBUG_abm_time = 0 -local DEBUG_timer_runs = 0 -local DEBUG_timer_time = 0 - -if farming.DEBUG then - - function farming.DEBUG.reset_times() - DEBUG_abm_runs = 0 - DEBUG_abm_time = 0 - DEBUG_timer_runs = 0 - DEBUG_timer_time = 0 - end - - function farming.DEBUG.report_times() - - local abm_n = DEBUG_abm_runs - local abm_dt = DEBUG_abm_time - local abm_avg = (abm_n > 0 and abm_dt / abm_n) or 0 - local timer_n = DEBUG_timer_runs - local timer_dt = DEBUG_timer_time - local timer_avg = (timer_n > 0 and timer_dt / timer_n) or 0 - local dt = abm_dt + timer_dt - - print("ABM ran for "..abm_dt.."µs over "..abm_n.." runs: "..abm_avg.."µs/run") - print("Timer ran for "..timer_dt.."µs over "..timer_n.." runs: "..timer_avg.."µs/run") - print("Total farming time: "..dt.."µs") - end -end local statistics = dofile(farming.path.."/statistics.lua") @@ -163,7 +131,7 @@ local function plant_name_stage(node) local name - if type(node) == 'table' then + if type(node) == "table" then if node.name then name = node.name @@ -346,30 +314,13 @@ end minetest.after(0, function() - for _, node_def in pairs(minetest.registered_nodes) do + for _, node_def in ipairs(minetest.registered_nodes) do register_plant_node(node_def) end end) local abm_func = farming.handle_growth -if farming.DEBUG then - - local normal_abm_func = abm_func - - abm_func = function(...) - - local t0 = minetest.get_us_time() - local r = { normal_abm_func(...) } - local t1 = minetest.get_us_time() - - DEBUG_abm_runs = DEBUG_abm_runs + 1 - DEBUG_abm_time = DEBUG_abm_time + (t1 - t0) - - return unpack(r) - end -end - -- Just in case a growing type or added node is missed (also catches existing -- nodes added to map before timers were incorporated). @@ -399,8 +350,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name) if stages.plant_name == "farming:cocoa" then - if not minetest.find_node_near(pos, 1, - {"default:jungletree", "moretrees:jungletree_leaves_green"}) then + if not minetest.find_node_near(pos, 1, {"default:jungletree"}) then return true end @@ -465,23 +415,6 @@ function farming.plant_growth_timer(pos, elapsed, node_name) return growth ~= max_growth end -if farming.DEBUG then - - local timer_func = farming.plant_growth_timer; - - farming.plant_growth_timer = function(pos, elapsed, node_name) - - local t0 = minetest.get_us_time() - local r = { timer_func(pos, elapsed, node_name) } - local t1 = minetest.get_us_time() - - DEBUG_timer_runs = DEBUG_timer_runs + 1 - DEBUG_timer_time = DEBUG_timer_time + (t1 - t0) - - return unpack(r) - end -end - -- refill placed plant by crabman (26/08/2015) local can_refill_plant = { ["farming:blueberry_1"] = "farming:blueberries", @@ -502,6 +435,7 @@ local can_refill_plant = { ["farming:rhubarb_1"] = "farming:rhubarb", ["farming:cocoa_1"] = "farming:cocoa_beans", ["farming:barley_1"] = "farming:seed_barley", + ["farming:hemp_1"] = "farming:seed_hemp", } function farming.refill_plant(player, plantname, index) @@ -513,7 +447,7 @@ function farming.refill_plant(player, plantname, index) return end - for i, stack in pairs(inv:get_list("main")) do + for i, stack in ipairs(inv:get_list("main")) do if stack:get_name() == plantname and i ~= index then @@ -538,6 +472,14 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) end local under = minetest.get_node(pt.under) + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + local above = minetest.get_node(pt.above) -- check if pointing at the top of the node @@ -587,7 +529,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) end end --- Function to register plants (for compatibility) +-- Function to register plants (default farming compatibility) farming.register_plant = function(name, def) @@ -623,7 +565,8 @@ farming.register_plant = function(name, def) selection_box = farming.select, on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1") + return farming.place_seed(itemstack, placer, + pointed_thing, mname .. ":" .. pname .. "_1") end, }) @@ -636,15 +579,19 @@ farming.register_plant = function(name, def) -- Register growing steps for i = 1, def.steps do + local base_rarity = 1 + if def.steps ~= 1 then + base_rarity = 8 - (i - 1) * 7 / (def.steps - 1) + end local drop = { items = { - {items = {mname .. ":" .. pname}, rarity = 9 - i}, - {items = {mname .. ":" .. pname}, rarity= 18 - i * 2}, - {items = {mname .. ":seed_" .. pname}, rarity = 9 - i}, - {items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2}, + {items = {mname .. ":" .. pname}, rarity = base_rarity}, + {items = {mname .. ":" .. pname}, rarity = base_rarity * 2}, + {items = {mname .. ":seed_" .. pname}, rarity = base_rarity}, + {items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2}, } } - + local g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, growing = 1} -- Last step doesn't need growing=1 so Abm never has to check these @@ -667,7 +614,7 @@ farming.register_plant = function(name, def) sounds = default.node_sound_leaves_defaults(), }) --- register_plant_node(node_name) + register_plant_node(node_name) end -- Return info @@ -675,29 +622,71 @@ farming.register_plant = function(name, def) return r end --- load crops +-- default settings +farming.carrot = true +farming.potato = true +farming.tomato = true +farming.cucumber = true +farming.corn = true +farming.coffee = true +farming.coffee = true +farming.melon = true +farming.sugar = true +farming.pumpkin = true +farming.cocoa = true +farming.raspberry = true +farming.blueberry = true +farming.rhubarb = true +farming.beans = true +farming.grapes = true +farming.barley = true +farming.hemp = true +farming.donuts = true + + +-- Load new global settings if found inside mod folder +local input = io.open(farming.path.."/farming.conf", "r") +if input then + dofile(farming.path .. "/farming.conf") + input:close() + input = nil +end + +-- load new world-specific settings if found inside world folder +local worldpath = minetest.get_worldpath() +local input = io.open(worldpath.."/farming.conf", "r") +if input then + dofile(worldpath .. "/farming.conf") + input:close() + input = nil +end + + +-- load crops dofile(farming.path.."/soil.lua") dofile(farming.path.."/hoes.lua") dofile(farming.path.."/grass.lua") dofile(farming.path.."/wheat.lua") dofile(farming.path.."/cotton.lua") -dofile(farming.path.."/carrot.lua") -dofile(farming.path.."/potato.lua") -dofile(farming.path.."/tomato.lua") -dofile(farming.path.."/cucumber.lua") -dofile(farming.path.."/corn.lua") -dofile(farming.path.."/coffee.lua") -dofile(farming.path.."/melon.lua") -dofile(farming.path.."/sugar.lua") -dofile(farming.path.."/pumpkin.lua") -dofile(farming.path.."/cocoa.lua") -dofile(farming.path.."/raspberry.lua") -dofile(farming.path.."/blueberry.lua") -dofile(farming.path.."/rhubarb.lua") -dofile(farming.path.."/beanpole.lua") -dofile(farming.path.."/grapes.lua") -dofile(farming.path.."/barley.lua") -dofile(farming.path.."/donut.lua") +if farming.carrot then dofile(farming.path.."/carrot.lua") end +if farming.potato then dofile(farming.path.."/potato.lua") end +if farming.tomato then dofile(farming.path.."/tomato.lua") end +if farming.cucumber then dofile(farming.path.."/cucumber.lua") end +if farming.corn then dofile(farming.path.."/corn.lua") end +if farming.coffee then dofile(farming.path.."/coffee.lua") end +if farming.melon then dofile(farming.path.."/melon.lua") end +if farming.sugar then dofile(farming.path.."/sugar.lua") end +if farming.pumpkin then dofile(farming.path.."/pumpkin.lua") end +if farming.cocoa then dofile(farming.path.."/cocoa.lua") end +if farming.raspberry then dofile(farming.path.."/raspberry.lua") end +if farming.blueberry then dofile(farming.path.."/blueberry.lua") end +if farming.rhubarb then dofile(farming.path.."/rhubarb.lua") end +if farming.beans then dofile(farming.path.."/beanpole.lua") end +if farming.grapes then dofile(farming.path.."/grapes.lua") end +if farming.barley then dofile(farming.path.."/barley.lua") end +if farming.hemp then dofile(farming.path.."/hemp.lua") end +if farming.donuts then dofile(farming.path.."/donut.lua") end dofile(farming.path.."/mapgen.lua") dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility +--dofile(farming.path.."/lucky_block.lua") diff --git a/mods/farming/init.lua_orig b/mods/farming/init.lua_orig deleted file mode 100644 index aee9976f..00000000 --- a/mods/farming/init.lua_orig +++ /dev/null @@ -1,192 +0,0 @@ ---[[ - Minetest Farming Redo Mod 1.14 (11th May 2015) - by TenPlus1 -]] - -farming = {} -farming.mod = "redo" -farming.path = minetest.get_modpath("farming") -farming.hoe_on_use = default.hoe_on_use - -dofile(farming.path.."/soil.lua") -dofile(farming.path.."/hoes.lua") -dofile(farming.path.."/grass.lua") -dofile(farming.path.."/wheat.lua") -dofile(farming.path.."/cotton.lua") -dofile(farming.path.."/carrot.lua") -dofile(farming.path.."/potato.lua") -dofile(farming.path.."/tomato.lua") -dofile(farming.path.."/cucumber.lua") -dofile(farming.path.."/corn.lua") -dofile(farming.path.."/coffee.lua") -dofile(farming.path.."/melon.lua") -dofile(farming.path.."/sugar.lua") -dofile(farming.path.."/pumpkin.lua") -dofile(farming.path.."/cocoa.lua") -dofile(farming.path.."/raspberry.lua") -dofile(farming.path.."/blueberry.lua") -dofile(farming.path.."/rhubarb.lua") -dofile(farming.path.."/beanpole.lua") -dofile(farming.path.."/donut.lua") -dofile(farming.path.."/mapgen.lua") -dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility - --- Place Seeds on Soil - -function farming.place_seed(itemstack, placer, pointed_thing, plantname) - local pt = pointed_thing - - -- check if pointing at a node - if not pt and pt.type ~= "node" then - return - end - - local under = minetest.get_node(pt.under) - local above = minetest.get_node(pt.above) - - -- check if pointing at the top of the node - if pt.above.y ~= pt.under.y+1 then - return - end - - -- return if any of the nodes is not registered - if not minetest.registered_nodes[under.name] - or not minetest.registered_nodes[above.name] then - return - end - - -- can I replace above node, and am I pointing at soil - if not minetest.registered_nodes[above.name].buildable_to - or minetest.get_item_group(under.name, "soil") < 2 - or minetest.get_item_group(above.name, "plant") ~= 0 then -- ADDED this line for multiple seed placement bug - return - end - - -- add the node and remove 1 item from the itemstack - if not minetest.is_protected(pt.above, placer:get_player_name()) then - minetest.add_node(pt.above, {name=plantname}) - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() - end - return itemstack - end -end - --- Single ABM Handles Growing of All Plants - -minetest.register_abm({ - nodenames = {"group:growing"}, - neighbors = {"farming:soil_wet", "default:jungletree"}, - interval = 80, - chance = 2, - - action = function(pos, node) - - -- split plant name (e.g. farming:wheat_1) - local plant = node.name:split("_")[1].."_" - local numb = node.name:split("_")[2] - - -- fully grown ? - if not minetest.registered_nodes[plant..(numb + 1)] then return end - - -- cocoa pod on jungle tree ? - if plant ~= "farming:cocoa_" then - - -- growing on wet soil ? - if minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name ~= "farming:soil_wet" then return end - end - - -- enough light ? - if minetest.get_node_light(pos) < 13 then return end - - -- grow - minetest.set_node(pos, {name=plant..(numb + 1)}) - - end -}) - --- Function to register plants (for compatibility) - -farming.register_plant = function(name, def) - local mname = name:split(":")[1] - local pname = name:split(":")[2] - - -- Check def table - if not def.description then - def.description = "Seed" - end - if not def.inventory_image then - def.inventory_image = "unknown_item.png" - end - if not def.steps then - return nil - end - - -- Register seed - minetest.register_node(":" .. mname .. ":seed_" .. pname, { - description = def.description, - tiles = {def.inventory_image}, - inventory_image = def.inventory_image, - wield_image = def.inventory_image, - drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1}, - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1") - end - }) - - -- Register harvest - minetest.register_craftitem(":" .. mname .. ":" .. pname, { - description = pname:gsub("^%l", string.upper), - inventory_image = mname .. "_" .. pname .. ".png", - }) - - -- Register growing steps - for i=1,def.steps do - local drop = { - items = { - {items = {mname .. ":" .. pname}, rarity = 9 - i}, - {items = {mname .. ":" .. pname}, rarity= 18 - i * 2}, - {items = {mname .. ":seed_" .. pname}, rarity = 9 - i}, - {items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2}, - } - } - - local g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, growing = 1} - -- Last step doesn't need growing=1 so Abm never has to check these - if i == def.steps then - g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1} - end - - minetest.register_node(mname .. ":" .. pname .. "_" .. i, { - drawtype = "plantlike", - waving = 1, - tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"}, - paramtype = "light", - walkable = false, - buildable_to = true, - is_ground_content = true, - drop = drop, - selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, - groups = g, - sounds = default.node_sound_leaves_defaults(), - }) - end - - -- Return info - local r = {seed = mname .. ":seed_" .. pname, harvest = mname .. ":" .. pname} - return r -end - ---[[ Cotton (example, is already registered in cotton.lua) -farming.register_plant("farming:cotton", { - description = "Cotton seed", - inventory_image = "farming_cotton_seed.png", - steps = 8, -}) ---]] diff --git a/mods/farming/license.txt b/mods/farming/license.txt index 5d30c149..fec6f6aa 100644 --- a/mods/farming/license.txt +++ b/mods/farming/license.txt @@ -1,14 +1,21 @@ +The MIT License (MIT) - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 +Copyright (c) 2016 TenPlus1 - Copyright (C) 2004 Sam Hocevar +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: - 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. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. - 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. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/mods/farming/locale/de.txt b/mods/farming/locale/de.txt index 82cee4f1..9b85a046 100644 --- a/mods/farming/locale/de.txt +++ b/mods/farming/locale/de.txt @@ -74,7 +74,7 @@ Baked Potato = Ofenkartoffel #pumpkin.lua Pumpkin = Kürbis Pumpkin Slice = Kürbisscheibe -Jack 'O Lantern = Kürbislaterne +Jack 'O Lantern (punch to turn on and off) = Kürbislaterne (Punch zum Ein- und Ausschalten) Pumpkin Bread = Kürbisbrot Pumpkin Dough = Kürbisteig diff --git a/mods/farming/locale/template.txt b/mods/farming/locale/template.txt index 6d067f58..3f527304 100644 --- a/mods/farming/locale/template.txt +++ b/mods/farming/locale/template.txt @@ -72,7 +72,7 @@ Baked Potato = #pumpkin.lua Pumpkin = Pumpkin Slice = -Jack 'O Lantern = +Jack 'O Lantern (punch to turn on and off) = Pumpkin Bread = Pumpkin Dough = diff --git a/mods/farming/lucky_block.lua b/mods/farming/lucky_block.lua new file mode 100644 index 00000000..94d7d366 --- /dev/null +++ b/mods/farming/lucky_block.lua @@ -0,0 +1,19 @@ + +-- add lucky blocks + +if minetest.get_modpath("lucky_block") then + + lucky_block:add_blocks({ + {"dro", {"farming:corn"}, 5}, + {"dro", {"farming:coffee_cup_hot"}, 1}, + {"dro", {"farming:bread"}, 5}, + {"nod", "farming:jackolantern", 0}, + {"tro", "farming:jackolantern_on"}, + {"nod", "default:river_water_source", 1}, + {"dro", {"farming:trellis", "farming:grapes"}, 5}, + {"dro", {"farming:bottle_ethanol"}, 1}, + {"nod", "farming:melon", 0}, + {"dro", {"farming:donut", "farming:donut_chocolate", "farming:donut_apple"}, 5}, + {"dro", {"farming:hemp_leaf", "farming:hemp_fibre", "farming:seed_hemp"}, 5}, + }) +end diff --git a/mods/farming/mapgen.lua b/mods/farming/mapgen.lua index dcd51a33..3f71d2fd 100644 --- a/mods/farming/mapgen.lua +++ b/mods/farming/mapgen.lua @@ -1,5 +1,11 @@ + -- decoration function -local function register_plant(name, min, max, spawnby, num) +local function register_plant(name, min, max, spawnby, num, enabled) + + if enabled ~= true then + return + end + minetest.register_decoration({ deco_type = "simple", place_on = {"default:dirt_with_grass"}, @@ -20,44 +26,50 @@ local function register_plant(name, min, max, spawnby, num) }) end -function farming.register_mgv6_decorations() - register_plant("potato_3", 15, 40, "", -1) - register_plant("tomato_7", 5, 20, "", -1) - register_plant("carrot_8", 1, 30, "group:water", 1) - register_plant("cucumber_4", 1, 20, "group:water", 1) - register_plant("corn_7", 12, 22, "", -1) - register_plant("corn_8", 10, 20, "", -1) - register_plant("coffee_5", 20, 45, "", -1) - register_plant("melon_8", 1, 20, "group:water", 1) - register_plant("pumpkin_8", 1, 20, "group:water", 1) - register_plant("raspberry_4", 3, 10, "", -1) - register_plant("rhubarb_3", 3, 15, "", -1) - register_plant("blueberry_4", 3, 10, "", -1) - register_plant("beanbush", 18, 35, "", -1) - register_plant("grapebush", 25, 45, "", -1) -end --- v7 maps have a beach so plants growing near water is limited to 6 high -function farming.register_mgv7_decorations() - register_plant("potato_3", 15, 40, "", -1) - register_plant("tomato_7", 5, 20, "", -1) - register_plant("carrot_8", 1, 6, "", -1) - register_plant("cucumber_4", 1, 6, "", -1) - register_plant("corn_7", 12, 22, "", -1) - register_plant("corn_8", 10, 20, "", -1) - register_plant("coffee_5", 20, 45, "", -1) - register_plant("melon_8", 1, 6, "", -1) - register_plant("pumpkin_8", 1, 6, "", -1) - register_plant("raspberry_4", 3, 10, "", -1) - register_plant("rhubarb_3", 3, 15, "", -1) - register_plant("blueberry_4", 3, 10, "", -1) - register_plant("beanbush", 18, 35, "", -1) - register_plant("grapebush", 25, 45, "", -1) -end +-- add crops to mapgen +--register_plant("potato_3", 15, 40, "", -1, farming.potato) +--register_plant("tomato_7", 5, 20, "", -1, farming.tomato) +--register_plant("corn_7", 12, 22, "", -1, farming.corn) +--register_plant("coffee_5", 20, 45, "", -1, farming.coffee) +--register_plant("raspberry_4", 3, 10, "", -1, farming.raspberry) +--register_plant("rhubarb_3", 3, 15, "", -1, farming.rhubarb) +--register_plant("blueberry_4", 3, 10, "", -1, farming.blueberry) +--register_plant("beanbush", 18, 35, "", -1, farming.beans) +--register_plant("grapebush", 25, 45, "", -1, farming.grapes) + --- detect mapgen if minetest.get_mapgen_params().mgname == "v6" then - farming.register_mgv6_decorations() + + --register_plant("carrot_8", 1, 30, "group:water", 1, farming.carrot) + --register_plant("cucumber_4", 1, 20, "group:water", 1, farming.cucumber) + --register_plant("melon_8", 1, 20, "group:water", 1, farming.melon) + --register_plant("pumpkin_8", 1, 20, "group:water", 1, farming.pumpkin) else - farming.register_mgv7_decorations() -end \ No newline at end of file + -- v7 maps have a beach so plants growing near water is limited to 6 high + --register_plant("carrot_8", 1, 6, "", -1, farming.carrot) + --register_plant("cucumber_4", 1, 6, "", -1, farming.cucumber) + --register_plant("melon_8", 1, 6, "", -1, farming.melon) + --register_plant("pumpkin_8", 1, 6, "", -1, farming.pumpkin) +end + +if farming.hemp then +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.06, + spread = {x = 100, y = 100, z = 100}, + seed = 420, + octaves = 3, + persist = 0.6 + }, + y_min = 5, + y_max = 35, + decoration = "farming:hemp_7", + spawn_by = "group:tree", + num_spawn_by = 1, +}) +end diff --git a/mods/farming/melon.lua b/mods/farming/melon.lua index f01ce047..e2f65644 100644 --- a/mods/farming/melon.lua +++ b/mods/farming/melon.lua @@ -41,7 +41,7 @@ local crop_def = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_wood_defaults() + sounds = default.node_sound_leaves_defaults() } -- stage 1 diff --git a/mods/farming/pumpkin.lua b/mods/farming/pumpkin.lua index ebbbd877..8bff7789 100644 --- a/mods/farming/pumpkin.lua +++ b/mods/farming/pumpkin.lua @@ -53,7 +53,7 @@ minetest.register_craft({ -- jack 'o lantern minetest.register_node("farming:jackolantern", { - description = S("Jack 'O Lantern"), + description = S("Jack 'O Lantern (punch to turn on and off)"), tiles = { "farming_pumpkin_top.png", "farming_pumpkin_top.png", @@ -82,7 +82,10 @@ minetest.register_node("farming:jackolantern_on", { }, light_source = default.LIGHT_MAX - 1, paramtype2 = "facedir", - groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2}, + groups = { + choppy = 1, oddly_breakable_by_hand = 1, flammable = 2, + not_in_creative_inventory = 1 + }, sounds = default.node_sound_wood_defaults(), drop = "farming:jackolantern", on_punch = function(pos, node, puncher) diff --git a/mods/farming/textures/banana_single.png b/mods/farming/textures/banana_single.png new file mode 100644 index 00000000..b15ed2fa Binary files /dev/null and b/mods/farming/textures/banana_single.png differ diff --git a/mods/farming/textures/farming_hemp_1.png b/mods/farming/textures/farming_hemp_1.png new file mode 100644 index 00000000..6fb45108 Binary files /dev/null and b/mods/farming/textures/farming_hemp_1.png differ diff --git a/mods/farming/textures/farming_hemp_2.png b/mods/farming/textures/farming_hemp_2.png new file mode 100644 index 00000000..a676173c Binary files /dev/null and b/mods/farming/textures/farming_hemp_2.png differ diff --git a/mods/farming/textures/farming_hemp_3.png b/mods/farming/textures/farming_hemp_3.png new file mode 100644 index 00000000..57136d50 Binary files /dev/null and b/mods/farming/textures/farming_hemp_3.png differ diff --git a/mods/farming/textures/farming_hemp_4.png b/mods/farming/textures/farming_hemp_4.png new file mode 100644 index 00000000..b375cf3d Binary files /dev/null and b/mods/farming/textures/farming_hemp_4.png differ diff --git a/mods/farming/textures/farming_hemp_5.png b/mods/farming/textures/farming_hemp_5.png new file mode 100644 index 00000000..890a3d28 Binary files /dev/null and b/mods/farming/textures/farming_hemp_5.png differ diff --git a/mods/farming/textures/farming_hemp_6.png b/mods/farming/textures/farming_hemp_6.png new file mode 100644 index 00000000..258d4e38 Binary files /dev/null and b/mods/farming/textures/farming_hemp_6.png differ diff --git a/mods/farming/textures/farming_hemp_7.png b/mods/farming/textures/farming_hemp_7.png new file mode 100644 index 00000000..1ce3a8d1 Binary files /dev/null and b/mods/farming/textures/farming_hemp_7.png differ diff --git a/mods/farming/textures/farming_hemp_8.png b/mods/farming/textures/farming_hemp_8.png new file mode 100644 index 00000000..8d2143f3 Binary files /dev/null and b/mods/farming/textures/farming_hemp_8.png differ diff --git a/mods/farming/textures/farming_hemp_fibre.png b/mods/farming/textures/farming_hemp_fibre.png new file mode 100644 index 00000000..fe3c9187 Binary files /dev/null and b/mods/farming/textures/farming_hemp_fibre.png differ diff --git a/mods/farming/textures/farming_hemp_leaf.png b/mods/farming/textures/farming_hemp_leaf.png new file mode 100644 index 00000000..997c8f0c Binary files /dev/null and b/mods/farming/textures/farming_hemp_leaf.png differ diff --git a/mods/farming/textures/farming_hemp_oil.png b/mods/farming/textures/farming_hemp_oil.png new file mode 100644 index 00000000..fa8afe26 Binary files /dev/null and b/mods/farming/textures/farming_hemp_oil.png differ diff --git a/mods/farming/textures/farming_hemp_rope.png b/mods/farming/textures/farming_hemp_rope.png new file mode 100644 index 00000000..03a7082f Binary files /dev/null and b/mods/farming/textures/farming_hemp_rope.png differ diff --git a/mods/farming/textures/farming_hemp_seed.png b/mods/farming/textures/farming_hemp_seed.png new file mode 100644 index 00000000..6be42c86 Binary files /dev/null and b/mods/farming/textures/farming_hemp_seed.png differ diff --git a/mods/farming/textures/farming_orange.png b/mods/farming/textures/farming_orange.png new file mode 100644 index 00000000..8b9ec299 Binary files /dev/null and b/mods/farming/textures/farming_orange.png differ diff --git a/mods/farming/textures/strawberry.png b/mods/farming/textures/strawberry.png new file mode 100644 index 00000000..5b43e6bc Binary files /dev/null and b/mods/farming/textures/strawberry.png differ diff --git a/mods/fire/README.txt b/mods/fire/README.txt index 14022f03..099da1c2 100644 --- a/mods/fire/README.txt +++ b/mods/fire/README.txt @@ -1,36 +1,35 @@ Minetest Game mod: fire ======================= +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2012 Perttu Ahola (celeron55) +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) +Authors of media (textures and sounds) -------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ Everything not listed in here: -Copyright (C) 2012 Perttu Ahola (celeron55) +Copyright (C) 2012 Perttu Ahola (celeron55) (CC BY-SA 3.0) -fire_small.ogg sampled from: - http://www.freesound.org/people/dobroide/sounds/4211/ +Muadtralk (CC BY-SA 3.0) + fire_basic_flame_animated.png -fire_large.ogg sampled from: - http://www.freesound.org/people/Dynamicell/sounds/17548/ +Gambit (CC BY-SA 3.0) + fire_flint_steel.png -fire_basic_flame_animated.png: - Muadtralk +dobroide (CC BY 3.0) +http://www.freesound.org/people/dobroide/sounds/4211/ + fire_small.ogg -fire_flint_steel.png - Gambit (WTFPL) +Dynamicell (CC BY 3.0) +http://www.freesound.org/people/Dynamicell/sounds/17548/ + fire_large.ogg + fire_fire.*.ogg +fire_small.ogg and fire_large.ogg are unused but kept temporarily to not break +other mods that may use them. + +Benboncan (CC BY 3.0) +https://www.freesound.org/people/Benboncan/sounds/66457/ + fire_flint_and_steel.ogg diff --git a/mods/fire/init.lua b/mods/fire/init.lua index 34613da5..f97636b5 100644 --- a/mods/fire/init.lua +++ b/mods/fire/init.lua @@ -1,11 +1,13 @@ --- minetest/fire/init.lua - -- Global namespace for functions fire = {} --- Register flame nodes +-- +-- Items +-- + +-- Flame nodes minetest.register_node("fire:basic_flame", { drawtype = "firelike", @@ -22,7 +24,7 @@ minetest.register_node("fire:basic_flame", { }, inventory_image = "fire_basic_flame.png", paramtype = "light", - light_source = 14, + light_source = 13, walkable = false, buildable_to = true, sunlight_propagates = true, @@ -34,22 +36,14 @@ minetest.register_node("fire:basic_flame", { minetest.remove_node(pos) return end - -- restart timer + -- Restart timer return true end, drop = "", on_construct = function(pos) minetest.get_node_timer(pos):start(math.random(30, 60)) - minetest.after(0, fire.update_sounds_around, pos) end, - - on_destruct = function(pos) - minetest.after(0, fire.update_sounds_around, pos) - end, - - on_blast = function() - end, -- unaffected by explosions }) minetest.register_node("fire:permanent_flame", { @@ -68,16 +62,13 @@ minetest.register_node("fire:permanent_flame", { }, inventory_image = "fire_basic_flame.png", paramtype = "light", - light_source = 14, + light_source = 13, walkable = false, buildable_to = true, sunlight_propagates = true, damage_per_second = 4, groups = {igniter = 2, dig_immediate = 3}, drop = "", - - on_blast = function() - end, }) @@ -86,46 +77,41 @@ minetest.register_node("fire:permanent_flame", { minetest.register_tool("fire:flint_and_steel", { description = "Flint and Steel", inventory_image = "fire_flint_steel.png", + sound = {breaks = "default_tool_breaks"}, + on_use = function(itemstack, user, pointed_thing) - itemstack:add_wear(1000) - local pt = pointed_thing - if pt.type == "node" then - local node_under = minetest.get_node(pt.under).name - local is_coalblock = node_under == "default:coalblock" - local is_tnt = node_under == "tnt:tnt" - local is_gunpowder = node_under == "tnt:gunpowder" - if minetest.get_item_group(node_under, "flammable") >= 1 or - is_coalblock or is_tnt or is_gunpowder then - local flame_pos = pt.above - if is_coalblock then - flame_pos = {x = pt.under.x, y = pt.under.y + 1, z = pt.under.z} - elseif is_tnt or is_gunpowder then - flame_pos = pt.under - end - if minetest.get_node(flame_pos).name == "air" or - is_tnt or is_gunpowder then - local player_name = user:get_player_name() - if not minetest.is_protected(flame_pos, player_name) then - if is_coalblock then - minetest.set_node(flame_pos, - {name = "fire:permanent_flame"}) - elseif is_tnt then - minetest.set_node(flame_pos, - {name = "tnt:tnt_burning"}) - elseif is_gunpowder then - minetest.set_node(flame_pos, - {name = "tnt:gunpowder_burning"}) - else - minetest.set_node(flame_pos, - {name = "fire:basic_flame"}) - end - else - minetest.chat_send_player(player_name, "This area is protected") - end - end + local sound_pos = pointed_thing.above or user:get_pos() + minetest.sound_play( + "fire_flint_and_steel", + {pos = sound_pos, gain = 0.5, max_hear_distance = 8} + ) + local player_name = user:get_player_name() + if pointed_thing.type == "node" then + local node_under = minetest.get_node(pointed_thing.under).name + local nodedef = minetest.registered_nodes[node_under] + if not nodedef then + return + end + if minetest.is_protected(pointed_thing.under, player_name) then + minetest.chat_send_player(player_name, "This area is protected") + return + end + if nodedef.on_ignite then + nodedef.on_ignite(pointed_thing.under, user) + elseif minetest.get_item_group(node_under, "flammable") >= 1 + and minetest.get_node(pointed_thing.above).name == "air" then + minetest.set_node(pointed_thing.above, {name = "fire:basic_flame"}) end end - if not minetest.setting_getbool("creative_mode") then + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(player_name)) then + -- Wear tool + local wdef = itemstack:get_definition() + itemstack:add_wear(1000) + -- Tool break sound + if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then + minetest.sound_play(wdef.sound.breaks, {pos = sound_pos, gain = 0.5}) + end return itemstack end end @@ -149,78 +135,146 @@ minetest.override_item("default:coalblock", { minetest.remove_node(pos) end end, + on_ignite = function(pos, igniter) + local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z} + if minetest.get_node(flame_pos).name == "air" then + minetest.set_node(flame_pos, {name = "fire:permanent_flame"}) + end + end, }) --- Get sound area of position +-- +-- Sound +-- -fire.D = 6 -- size of sound areas +local flame_sound = minetest.settings:get_bool("flame_sound") +if flame_sound == nil then + -- Enable if no setting present + flame_sound = true +end -function fire.get_area_p0p1(pos) - local p0 = { - x = math.floor(pos.x / fire.D) * fire.D, - y = math.floor(pos.y / fire.D) * fire.D, - z = math.floor(pos.z / fire.D) * fire.D, - } - local p1 = { - x = p0.x + fire.D - 1, - y = p0.y + fire.D - 1, - z = p0.z + fire.D - 1 - } - return p0, p1 +if flame_sound then + + local handles = {} + local timer = 0 + + -- Parameters + + local radius = 8 -- Flame node search radius around player + local cycle = 3 -- Cycle time for sound updates + + -- Update sound for player + + function fire.update_player_sound(player) + local player_name = player:get_player_name() + -- Search for flame nodes in radius around player + local ppos = player:getpos() + local areamin = vector.subtract(ppos, radius) + local areamax = vector.add(ppos, radius) + local fpos, num = minetest.find_nodes_in_area( + areamin, + areamax, + {"fire:basic_flame", "fire:permanent_flame"} + ) + -- Total number of flames in radius + local flames = (num["fire:basic_flame"] or 0) + + (num["fire:permanent_flame"] or 0) + -- Stop previous sound + if handles[player_name] then + minetest.sound_stop(handles[player_name]) + handles[player_name] = nil + end + -- If flames + if flames > 0 then + -- Find centre of flame positions + local fposmid = fpos[1] + -- If more than 1 flame + if #fpos > 1 then + local fposmin = areamax + local fposmax = areamin + for i = 1, #fpos do + local fposi = fpos[i] + if fposi.x > fposmax.x then + fposmax.x = fposi.x + end + if fposi.y > fposmax.y then + fposmax.y = fposi.y + end + if fposi.z > fposmax.z then + fposmax.z = fposi.z + end + if fposi.x < fposmin.x then + fposmin.x = fposi.x + end + if fposi.y < fposmin.y then + fposmin.y = fposi.y + end + if fposi.z < fposmin.z then + fposmin.z = fposi.z + end + end + fposmid = vector.divide(vector.add(fposmin, fposmax), 2) + end + -- Play sound + local handle = minetest.sound_play( + "fire_fire", + { + pos = fposmid, + to_player = player_name, + gain = math.min(0.06 * (1 + flames * 0.125), 0.18), + max_hear_distance = 32, + loop = true, -- In case of lag + } + ) + -- Store sound handle for this player + if handle then + handles[player_name] = handle + end + end + end + + -- Cycle for updating players sounds + + minetest.register_globalstep(function(dtime) + timer = timer + dtime + if timer < cycle then + return + end + + timer = 0 + local players = minetest.get_connected_players() + for n = 1, #players do + fire.update_player_sound(players[n]) + end + end) + + -- Stop sound and clear handle on player leave + + minetest.register_on_leaveplayer(function(player) + local player_name = player:get_player_name() + if handles[player_name] then + minetest.sound_stop(handles[player_name]) + handles[player_name] = nil + end + end) end --- Fire sounds table --- key: position hash of low corner of area --- value: {handle=sound handle, name=sound name} -fire.sounds = {} - - --- Update fire sounds in sound area of position +-- Deprecated function kept temporarily to avoid crashes if mod fire nodes call it function fire.update_sounds_around(pos) - local p0, p1 = fire.get_area_p0p1(pos) - local cp = {x = (p0.x + p1.x) / 2, y = (p0.y + p1.y) / 2, z = (p0.z + p1.z) / 2} - local flames_p = minetest.find_nodes_in_area(p0, p1, {"fire:basic_flame"}) - --print("number of flames at "..minetest.pos_to_string(p0).."/" - -- ..minetest.pos_to_string(p1)..": "..#flames_p) - local should_have_sound = (#flames_p > 0) - local wanted_sound = nil - if #flames_p >= 9 then - wanted_sound = {name = "fire_large", gain = 0.7} - elseif #flames_p > 0 then - wanted_sound = {name = "fire_small", gain = 0.9} - end - local p0_hash = minetest.hash_node_position(p0) - local sound = fire.sounds[p0_hash] - if not sound then - if should_have_sound then - fire.sounds[p0_hash] = { - handle = minetest.sound_play(wanted_sound, - {pos = cp, max_hear_distance = 16, loop = true}), - name = wanted_sound.name, - } - end - else - if not wanted_sound then - minetest.sound_stop(sound.handle) - fire.sounds[p0_hash] = nil - elseif sound.name ~= wanted_sound.name then - minetest.sound_stop(sound.handle) - fire.sounds[p0_hash] = { - handle = minetest.sound_play(wanted_sound, - {pos = cp, max_hear_distance = 16, loop = true}), - name = wanted_sound.name, - } - end - end end +-- +-- ABMs +-- + -- Extinguish all flames quickly with water, snow, ice minetest.register_abm({ + label = "Extinguish flame", nodenames = {"fire:basic_flame", "fire:permanent_flame"}, neighbors = {"group:puts_out_fire"}, interval = 3, @@ -229,18 +283,31 @@ minetest.register_abm({ action = function(pos, node, active_object_count, active_object_count_wider) minetest.remove_node(pos) minetest.sound_play("fire_extinguish_flame", - {pos = pos, max_hear_distance = 16, gain = 0.25}) + {pos = pos, max_hear_distance = 16, gain = 0.15}) end, }) --- Enable the following ABMs according to 'disable fire' setting +-- Enable the following ABMs according to 'enable fire' setting -if minetest.setting_getbool("disable_fire") then +local fire_enabled = minetest.settings:get_bool("enable_fire") +if fire_enabled == nil then + -- enable_fire setting not specified, check for disable_fire + local fire_disabled = minetest.settings:get_bool("disable_fire") + if fire_disabled == nil then + -- Neither setting specified, check whether singleplayer + fire_enabled = minetest.is_singleplayer() + else + fire_enabled = not fire_disabled + end +end - -- Remove basic flames only +if not fire_enabled then + + -- Remove basic flames only if fire disabled minetest.register_abm({ + label = "Remove disabled fire", nodenames = {"fire:basic_flame"}, interval = 7, chance = 1, @@ -248,11 +315,12 @@ if minetest.setting_getbool("disable_fire") then action = minetest.remove_node, }) -else +else -- Fire enabled -- Ignite neighboring nodes, add basic flames minetest.register_abm({ + label = "Ignite flame", nodenames = {"group:flammable"}, neighbors = {"group:igniter"}, interval = 7, @@ -270,9 +338,10 @@ else end, }) - -- Remove flammable nodes + -- Remove flammable nodes around basic flame minetest.register_abm({ + label = "Remove flammable nodes", nodenames = {"fire:basic_flame"}, neighbors = "group:flammable", interval = 5, @@ -281,49 +350,16 @@ else action = function(pos, node, active_object_count, active_object_count_wider) local p = minetest.find_node_near(pos, 1, {"group:flammable"}) if p then - -- remove flammable nodes around flame local flammable_node = minetest.get_node(p) local def = minetest.registered_nodes[flammable_node.name] if def.on_burn then def.on_burn(p) else minetest.remove_node(p) - nodeupdate(p) + minetest.check_for_falling(p) end end end, }) end - - --- Rarely ignite things from far - ---[[ Currently disabled to reduce the chance of uncontrollable spreading - fires that disrupt servers. Also for less lua processing load. - -minetest.register_abm({ - nodenames = {"group:igniter"}, - neighbors = {"air"}, - interval = 5, - chance = 10, - action = function(pos, node, active_object_count, active_object_count_wider) - local reg = minetest.registered_nodes[node.name] - if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then - return - end - local d = reg.groups.igniter - local p = minetest.find_node_near(pos, d, {"group:flammable"}) - if p then - -- If there is water or stuff like that around flame, don't ignite - if fire.flame_should_extinguish(p) then - return - end - local p2 = fire.find_pos_for_flame_around(p) - if p2 then - minetest.set_node(p2, {name = "fire:basic_flame"}) - end - end - end, -}) ---]] diff --git a/mods/fire/license.txt b/mods/fire/license.txt new file mode 100644 index 00000000..43f9cd7f --- /dev/null +++ b/mods/fire/license.txt @@ -0,0 +1,84 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures and sounds) +--------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Muadtralk +Copyright (C) 2013-2016 Gambit + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2005 dobroide +Copyright (C) 2006 Dynamicell +Copyright (C) 2009 Benboncan + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ diff --git a/mods/fire/sounds/fire_fire.1.ogg b/mods/fire/sounds/fire_fire.1.ogg new file mode 100644 index 00000000..cbfee4c6 Binary files /dev/null and b/mods/fire/sounds/fire_fire.1.ogg differ diff --git a/mods/fire/sounds/fire_fire.2.ogg b/mods/fire/sounds/fire_fire.2.ogg new file mode 100644 index 00000000..e8d0eb13 Binary files /dev/null and b/mods/fire/sounds/fire_fire.2.ogg differ diff --git a/mods/fire/sounds/fire_fire.3.ogg b/mods/fire/sounds/fire_fire.3.ogg new file mode 100644 index 00000000..5cad3d9b Binary files /dev/null and b/mods/fire/sounds/fire_fire.3.ogg differ diff --git a/mods/fire/sounds/fire_flint_and_steel.ogg b/mods/fire/sounds/fire_flint_and_steel.ogg new file mode 100644 index 00000000..6996e16f Binary files /dev/null and b/mods/fire/sounds/fire_flint_and_steel.ogg differ diff --git a/mods/fire/textures/fire_flint_steel.png b/mods/fire/textures/fire_flint_steel.png index 624f5565..c262ebc0 100644 Binary files a/mods/fire/textures/fire_flint_steel.png and b/mods/fire/textures/fire_flint_steel.png differ diff --git a/mods/flowers/README.txt b/mods/flowers/README.txt index ebd4a21f..2a5e4de3 100644 --- a/mods/flowers/README.txt +++ b/mods/flowers/README.txt @@ -1,23 +1,26 @@ Minetest Game mod: flowers ========================== +See license.txt for license information. -License of source code: ------------------------ -Copyright (C) 2012-2013 Ironzorg, VanessaE +Authors of source code +---------------------- +Originally by Ironzorg (MIT) and VanessaE (MIT) +Various Minetest developers and contributors (MIT) -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Authors of media (textures) +--------------------------- +RHRhino (CC BY-SA 3.0): + flowers_dandelion_white.png + flowers_dandelion_yellow.png + flowers_geranium.png + flowers_rose.png + flowers_tulip.png + flowers_viola.png -License of media (textures and sounds) --------------------------------------- -WTFPL +Gambit (CC BY-SA 3.0): + flowers_mushroom_brown.png + flowers_mushroom_red.png + flowers_waterlily.png -Gambit (WTFPL): - flowers_mushroom_*.png - flowers_waterlily.png - -DanDuncombe (WTFPL): - flowers_spores_*.png +yyt16384 (CC BY-SA 3.0): + flowers_waterlily_bottom.png, derived from Gambit's texture diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index 2d8c93e4..cb5b2193 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -57,12 +57,42 @@ local function add_simple_flower(name, desc, box, f_groups) end flowers.datas = { - {"rose", "Rose", {-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_red = 1}}, - {"tulip", "Orange Tulip", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_orange = 1}}, - {"dandelion_yellow", "Yellow Dandelion", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_yellow = 1}}, - {"geranium", "Blue Geranium", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_blue = 1}}, - {"viola", "Viola", {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5}, {color_violet = 1}}, - {"dandelion_white", "White dandelion", {-0.5, -0.5, -0.5, 0.5, -0.2, 0.5}, {color_white = 1}} + { + "rose", + "Rose", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 5 / 16, 2 / 16}, + {color_red = 1, flammable = 1} + }, + { + "tulip", + "Orange Tulip", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 3 / 16, 2 / 16}, + {color_orange = 1, flammable = 1} + }, + { + "dandelion_yellow", + "Yellow Dandelion", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 4 / 16, 2 / 16}, + {color_yellow = 1, flammable = 1} + }, + { + "geranium", + "Blue Geranium", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 2 / 16, 2 / 16}, + {color_blue = 1, flammable = 1} + }, + { + "viola", + "Viola", + {-5 / 16, -0.5, -5 / 16, 5 / 16, -1 / 16, 5 / 16}, + {color_violet = 1, flammable = 1} + }, + { + "dandelion_white", + "White dandelion", + {-5 / 16, -0.5, -5 / 16, 5 / 16, -2 / 16, 5 / 16}, + {color_white = 1, flammable = 1} + }, } for _,item in pairs(flowers.datas) do @@ -77,11 +107,16 @@ function flowers.flower_spread(pos, node) pos.y = pos.y - 1 local under = minetest.get_node(pos) pos.y = pos.y + 1 - if under.name == "default:desert_sand" then + -- Replace flora with dry shrub in desert sand and silver sand, + -- as this is the only way to generate them. + -- However, preserve grasses in sand dune biomes. + if minetest.get_item_group(under.name, "sand") == 1 and + under.name ~= "default:sand" then minetest.set_node(pos, {name = "default:dry_shrub"}) return - elseif under.name ~= "default:dirt_with_grass" and - under.name ~= "default:dirt_with_dry_grass" then + end + + if minetest.get_item_group(under.name, "soil") == 0 then return end @@ -96,23 +131,26 @@ function flowers.flower_spread(pos, node) return end - local seedling = minetest.find_nodes_in_area_under_air(pos0, pos1, - {"default:dirt_with_grass", "default:dirt_with_dry_grass"}) - if #seedling > 0 then - seedling = seedling[math.random(#seedling)] - seedling.y = seedling.y + 1 - light = minetest.get_node_light(seedling) - if not light or light < 13 then + local soils = minetest.find_nodes_in_area_under_air( + pos0, pos1, "group:soil") + if #soils > 0 then + local seedling = soils[math.random(#soils)] + local seedling_above = + {x = seedling.x, y = seedling.y + 1, z = seedling.z} + light = minetest.get_node_light(seedling_above) + if not light or light < 13 or + -- Desert sand is in the soil group + minetest.get_node(seedling).name == "default:desert_sand" then return end - minetest.set_node(seedling, {name = node.name}) + + minetest.set_node(seedling_above, {name = node.name}) end end minetest.register_abm({ + label = "Flower spread", nodenames = {"group:flora"}, - neighbors = {"default:dirt_with_grass", "default:dirt_with_dry_grass", - "default:desert_sand"}, interval = 13, chance = 96, action = function(...) @@ -135,12 +173,12 @@ minetest.register_node("flowers:mushroom_red", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, attached_node = 1}, + groups = {snappy = 3, attached_node = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), on_use = minetest.item_eat(-5), selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3} + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, } }) @@ -154,12 +192,12 @@ minetest.register_node("flowers:mushroom_brown", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, attached_node = 1}, + groups = {snappy = 3, attached_node = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), on_use = minetest.item_eat(1), selection_box = { type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3} + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, -2 / 16, 3 / 16}, } }) @@ -167,6 +205,7 @@ minetest.register_node("flowers:mushroom_brown", { -- Mushroom spread and death minetest.register_abm({ + label = "Mushroom spread", nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"}, interval = 11, chance = 50, @@ -206,6 +245,8 @@ minetest.register_alias("flowers:mushroom_spores_brown", "flowers:mushroom_brown minetest.register_alias("flowers:mushroom_spores_red", "flowers:mushroom_red") minetest.register_alias("flowers:mushroom_fertile_brown", "flowers:mushroom_brown") minetest.register_alias("flowers:mushroom_fertile_red", "flowers:mushroom_red") +minetest.register_alias("mushroom:brown_natural", "flowers:mushroom_brown") +minetest.register_alias("mushroom:red_natural", "flowers:mushroom_red") -- @@ -217,23 +258,24 @@ minetest.register_node("flowers:waterlily", { drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", - tiles = {"flowers_waterlily.png"}, + tiles = {"flowers_waterlily.png", "flowers_waterlily_bottom.png"}, inventory_image = "flowers_waterlily.png", wield_image = "flowers_waterlily.png", liquids_pointable = true, walkable = false, buildable_to = true, sunlight_propagates = true, - groups = {snappy = 3, flower = 1}, + floodable = true, + groups = {snappy = 3, flower = 1, flammable = 1}, sounds = default.node_sound_leaves_defaults(), node_placement_prediction = "", node_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.46875, 0.5} + fixed = {-0.5, -31 / 64, -0.5, 0.5, -15 / 32, 0.5} }, selection_box = { type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5} + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, -15 / 32, 7 / 16} }, on_place = function(itemstack, placer, pointed_thing) @@ -242,16 +284,21 @@ minetest.register_node("flowers:waterlily", { local def = minetest.registered_nodes[node] local player_name = placer:get_player_name() - if def and def.liquidtype == "source" and minetest.get_item_group(node, "water") > 0 then + if def and def.liquidtype == "source" and + minetest.get_item_group(node, "water") > 0 then if not minetest.is_protected(pos, player_name) then - minetest.set_node(pos, {name = "flowers:waterlily", param2 = math.random(0, 3)}) + minetest.set_node(pos, {name = "flowers:waterlily", + param2 = math.random(0, 3)}) + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(player_name)) then + itemstack:take_item() + end else - minetest.chat_send_player(player_name, "This area is protected") - end - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() - return itemstack + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos, player_name) end end + + return itemstack end }) diff --git a/mods/flowers/license.txt b/mods/flowers/license.txt new file mode 100644 index 00000000..d3011622 --- /dev/null +++ b/mods/flowers/license.txt @@ -0,0 +1,62 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Ironzorg, VanessaE +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 RHRhino +Copyright (C) 2015-2016 Gambit +Copyright (C) 2016 yyt16384 + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/flowers/mapgen.lua b/mods/flowers/mapgen.lua index 59ce97a3..2b960907 100644 --- a/mods/flowers/mapgen.lua +++ b/mods/flowers/mapgen.lua @@ -94,8 +94,8 @@ local function register_flower(seed, name) octaves = 3, persist = 0.6 }, - biomes = {"stone_grassland", "sandstone_grassland", - "deciduous_forest", "coniferous_forest"}, + biomes = {"grassland", "deciduous_forest", "coniferous_forest", + "floatland_grassland", "floatland_coniferous_forest"}, y_min = 1, y_max = 31000, decoration = "flowers:"..name, @@ -110,12 +110,13 @@ local function register_mushroom(name) noise_params = { offset = 0, scale = 0.006, - spread = {x = 200, y = 200, z = 200}, + spread = {x = 250, y = 250, z = 250}, seed = 2, octaves = 3, persist = 0.66 }, - biomes = {"deciduous_forest", "coniferous_forest"}, + biomes = {"deciduous_forest", "coniferous_forest", + "floatland_coniferous_forest"}, y_min = 1, y_max = 31000, decoration = "flowers:"..name, @@ -135,10 +136,10 @@ local function register_waterlily() octaves = 3, persist = 0.7 }, - biomes = {"rainforest_swamp", "savanna_swamp", "deciduous_forest_swamp"}, + biomes = {"rainforest_swamp", "savanna_shore", "deciduous_forest_shore"}, y_min = 0, y_max = 0, - schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts", + schematic = minetest.get_modpath("flowers") .. "/schematics/waterlily.mts", rotation = "random", }) end @@ -162,12 +163,9 @@ end -- Detect mapgen to select functions -- --- Mods using singlenode mapgen can call these functions to enable --- the use of minetest.generate_ores or minetest.generate_decorations - -local mg_params = minetest.get_mapgen_params() -if mg_params.mgname == "v6" then +local mg_name = minetest.get_mapgen_setting("mg_name") +if mg_name == "v6" then flowers.register_mgv6_decorations() -elseif mg_params.mgname ~= "singlenode" then +else flowers.register_decorations() end diff --git a/mods/flowers/schematics/waterlily.mts b/mods/flowers/schematics/waterlily.mts index 876310cc..69e1d8e0 100644 Binary files a/mods/flowers/schematics/waterlily.mts and b/mods/flowers/schematics/waterlily.mts differ diff --git a/mods/flowers/textures/flowers_waterlily.png b/mods/flowers/textures/flowers_waterlily.png index a92d3b9f..305c4458 100644 Binary files a/mods/flowers/textures/flowers_waterlily.png and b/mods/flowers/textures/flowers_waterlily.png differ diff --git a/mods/flowers/textures/flowers_waterlily_bottom.png b/mods/flowers/textures/flowers_waterlily_bottom.png new file mode 100644 index 00000000..3dbeaf40 Binary files /dev/null and b/mods/flowers/textures/flowers_waterlily_bottom.png differ diff --git a/mods/tnt/README.txt b/mods/tnt/README.txt index 46d3fca1..4e74841c 100644 --- a/mods/tnt/README.txt +++ b/mods/tnt/README.txt @@ -1,45 +1,44 @@ -=== TNT-MOD for MINETEST-C55 === -by PilzAdam +Minetest Game mod: tnt +====================== +See license.txt for license information. -Introduction: +Authors of source code +---------------------- +PilzAdam (MIT) +ShadowNinja (MIT) +sofar (sofar@foo-projects.org) (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +BlockMen (CC BY-SA 3.0): +All textures not mentioned below. + +ShadowNinja (CC BY-SA 3.0): +tnt_smoke.png + +Wuzzy (CC BY-SA 3.0): +All gunpowder textures except tnt_gunpowder_inventory.png. + +sofar (sofar@foo-projects.org) (CC BY-SA 3.0): +tnt_blast.png + +Introduction +------------ This mod adds TNT to Minetest. TNT is a tool to help the player in mining. -How to install: -Unzip the archive an place it in minetest-base-directory/mods/minetest/ -if you have a windows client or a linux run-in-place client. If you have -a linux system-wide instalation place it in ~/.minetest/mods/minetest/. -If you want to install this mod only in one world create the folder -worldmods/ in your worlddirectory. -For further information or help see: -http://wiki.minetest.com/wiki/Installing_Mods - How to use the mod: -Craft gunpowder by placing coal and gravel in the crafting area. The -gunpowder can be used to craft TNT or as fuze for TNT. To craft TNT -surround gunpowder with 4 wood in a + shape. +Craft gunpowder by placing coal and gravel in the crafting area. +The gunpowder can be used to craft TNT or as fuse for TNT. +To craft TNT place items like this: +-- wood - gunpowder -- wood - +gunpowder gunpowder gunpowder +-- wood - gunpowder -- wood - + 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! + 1. Hit it with a torch. + 2. Hit a gunpowder fuse that leads to a TNT block with a torch or flint-and-steel. + 3. Activate it with mesecons (fastest way). -License: -WTFPL (see below) - -See also: -http://minetest.net/ - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2004 Sam Hocevar - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. +Be aware of the damage radius of 6 blocks! diff --git a/mods/tnt/depends.txt b/mods/tnt/depends.txt index 70715c7b..5ff216f7 100644 --- a/mods/tnt/depends.txt +++ b/mods/tnt/depends.txt @@ -1,2 +1,3 @@ default fire + diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index 2f51954e..f54b2f1a 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -1,310 +1,455 @@ +tnt = {} + +-- Default to enabled when in singleplayer +local enable_tnt = minetest.settings:get_bool("enable_tnt") +if enable_tnt == nil then + enable_tnt = minetest.is_singleplayer() +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_max = tonumber(minetest.setting_get("tnt_radius_max") or 25) +local tnt_radius = tonumber(minetest.settings:get("tnt_radius") or 3) -local eject_drops = function(pos, stack) - local obj = minetest.add_item(pos, stack) - - if obj == nil then - return +-- 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 - obj:get_luaentity().collect = true - obj:setacceleration({x=0, y=-10, z=0}) - obj:setvelocity({x=math.random(0,6)-3, y=10, z=math.random(0,6)-3}) +end) + +local function rand_pos(center, pos, radius) + local def + local reg_nodes = minetest.registered_nodes + local i = 0 + repeat + -- Give up and use the center if this takes too long + if i > 4 then + pos.x, pos.z = center.x, center.z + break + end + pos.x = center.x + math.random(-radius, radius) + pos.z = center.z + math.random(-radius, radius) + def = reg_nodes[minetest.get_node(pos).name] + i = i + 1 + until def and not def.walkable end -local add_drop = function(drops, pos, item) - if loss_prob[item] ~= nil then - if math.random(1,loss_prob[item]) == 1 then - return +local function eject_drops(drops, pos, radius) + local drop_pos = vector.new(pos) + for _, item in pairs(drops) do + local count = math.min(item:get_count(), item:get_stack_max()) + while count > 0 do + local take = math.max(1,math.min(radius * radius, + count, + item:get_stack_max())) + rand_pos(pos, drop_pos, radius) + local dropitem = ItemStack(item) + dropitem:set_count(take) + local obj = minetest.add_item(drop_pos, dropitem) + if obj then + obj:get_luaentity().collect = true + obj:setacceleration({x = 0, y = -10, z = 0}) + obj:setvelocity({x = math.random(-3, 3), + y = math.random(0, 10), + z = math.random(-3, 3)}) + end + count = count - take end end +end - if drops[item] == nil then - drops[item] = ItemStack(item) +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 - drops[item]:add_item(item) + drop:set_count(drop:get_count() + item:get_count()) + end +end + +local basic_flame_on_construct -- cached value +local function destroy(drops, npos, cid, c_air, c_fire, + on_blast_queue, on_construct_queue, + ignore_protection, ignore_on_blast) + if not ignore_protection and minetest.is_protected(npos, "") then + return cid end - if drops[item]:get_free_space() == 0 then - stack = drops[item] - eject_drops(pos, stack) - drops[item] = nil + local def = cid_data[cid] + + if not def then + return c_air + elseif not ignore_on_blast and def.on_blast then + on_blast_queue[#on_blast_queue + 1] = { + pos = vector.new(npos), + on_blast = def.on_blast + } + return cid + elseif def.flammable then + on_construct_queue[#on_construct_queue + 1] = { + fn = basic_flame_on_construct, + pos = vector.new(npos) + } + return c_fire + else + local node_drops = minetest.get_node_drops(def.name, "") + for _, item in pairs(node_drops) do + add_drop(drops, item) + end + return c_air end - end ---THIS IS WHERE ALL THE DESTROY CODE IS -local destroy = function(drops, pos, last, fast) - if minetest.is_protected(pos, "") then + +local function calc_velocity(pos1, pos2, old_vel, power) + -- Avoid errors caused by a vector of zero length + if vector.equals(pos1, pos2) then + return old_vel + end + + 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) + + -- randomize it a bit + vel = vector.add(vel, { + x = math.random() - 0.5, + y = math.random() - 0.5, + z = math.random() - 0.5, + }) + + -- Limit to terminal velocity + dist = vector.length(vel) + if dist > 250 then + vel = vector.divide(vel, dist / 250) + end + return vel +end + +local function entity_physics(pos, radius, drops) + local objs = minetest.get_objects_inside_radius(pos, radius) + for _, obj in pairs(objs) do + local obj_pos = obj:getpos() + local dist = math.max(1, vector.distance(pos, obj_pos)) + + local damage = (4 / dist) * radius + if obj:is_player() then + -- currently the engine has no method to set + -- player velocity. See #2960 + -- instead, we knock the player back 1.0 node, and slightly upwards + local dir = vector.normalize(vector.subtract(obj_pos, pos)) + local moveoff = vector.multiply(dir, dist + 1.0) + local newpos = vector.add(pos, moveoff) + newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0}) + obj:setpos(newpos) + + obj:set_hp(obj:get_hp() - damage) + else + local do_damage = true + local do_knockback = true + local entity_drops = {} + local luaobj = obj:get_luaentity() + local objdef = minetest.registered_entities[luaobj.name] + + if objdef and objdef.on_blast then + do_damage, do_knockback, entity_drops = objdef.on_blast(luaobj, damage) + end + + if do_knockback then + local obj_vel = obj:getvelocity() + obj:setvelocity(calc_velocity(pos, obj_pos, + obj_vel, radius * 10)) + end + if do_damage then + if not obj:get_armor_groups().immortal then + obj:punch(obj, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, nil) + end + end + for _, item in pairs(entity_drops) do + add_drop(drops, item) + end + end + end +end + +local function add_effects(pos, radius, drops) + minetest.add_particle({ + pos = pos, + velocity = vector.new(), + acceleration = vector.new(), + expirationtime = 0.4, + size = radius * 10, + collisiondetection = false, + vertical = false, + texture = "tnt_boom.png", + }) + minetest.add_particlespawner({ + amount = 64, + time = 0.5, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -10, y = -10, z = -10}, + maxvel = {x = 10, y = 10, z = 10}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 2.5, + minsize = radius * 3, + maxsize = radius * 5, + texture = "tnt_smoke.png", + }) + + -- we just dropped some items. Look at the items entities and pick + -- one of them to use as texture + local texture = "tnt_blast.png" --fallback texture + local most = 0 + for name, stack in pairs(drops) do + local count = stack:get_count() + if count > most then + most = count + local def = minetest.registered_nodes[name] + if def and def.tiles and def.tiles[1] then + texture = def.tiles[1] + end + end + end + + minetest.add_particlespawner({ + amount = 64, + time = 0.1, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -3, y = 0, z = -3}, + maxvel = {x = 3, y = 5, z = 3}, + minacc = {x = 0, y = -10, z = 0}, + maxacc = {x = 0, y = -10, z = 0}, + minexptime = 0.8, + maxexptime = 2.0, + minsize = radius * 0.66, + maxsize = radius * 2, + texture = texture, + collisiondetection = true, + }) +end + +function tnt.burn(pos, nodename) + local name = nodename or minetest.get_node(pos).name + local def = minetest.registered_nodes[name] + if not def then return - end - - local nodename = minetest.get_node(pos).name - if minetest.registered_nodes[nodename].groups.immortal ~= nil then --mm added for immortal - return - end - if nodename ~= "air" then - minetest.remove_node(pos, (fast and 1 or 0)) - if last then - nodeupdate(pos) - end - if minetest.registered_nodes[nodename].groups.flammable ~= nil then - minetest.set_node(pos, {name="fire:basic_flame"}, (fast and 2 or 0)) - return - end - local drop = minetest.get_node_drops(nodename, "") - for _,item in ipairs(drop) do - if type(item) == "string" then - add_drop(drops, pos, item) - else - for i=1,item:get_count() do - add_drop(drops, pos, item:get_name()) - end - end - end + elseif def.on_ignite then + def.on_ignite(pos) + elseif minetest.get_item_group(name, "tnt") > 0 then + minetest.sound_play("tnt_ignite", {pos = pos}) + minetest.set_node(pos, {name = name .. "_burning"}) + minetest.get_node_timer(pos):start(1) end end -boom = function(pos, time) - minetest.after(time, function(pos) - if minetest.get_node(pos).name ~= "tnt:tnt_burning" then - return - end - minetest.sound_play("tnt_explode", {pos=pos, gain=1.5, max_hear_distance=2*64}) - minetest.set_node(pos, {name="tnt:boom"}) - minetest.after(0.5, function(pos) - minetest.remove_node(pos) - end, {x=pos.x, y=pos.y, z=pos.z}) - +local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast) + pos = vector.round(pos) + -- scan for adjacent TNT nodes first, and enlarge the explosion + local vm1 = VoxelManip() + local p1 = vector.subtract(pos, 2) + local p2 = vector.add(pos, 2) + local minp, maxp = vm1:read_from_map(p1, p2) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm1:get_data() + local count = 0 + local c_tnt = minetest.get_content_id("tnt:tnt") + local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning") + local c_tnt_boom = minetest.get_content_id("tnt:boom") + local c_air = minetest.get_content_id("air") - local radius = 2 - local drops = {} - local list = {} - local dr = 0 - local tnts = 1 - local destroyed = 0 - while dr= (pr:next(80, 125) / 100) then + local cid = data[vi] + local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z} + if cid ~= c_air then + data[vi] = destroy(drops, p, cid, c_air, c_fire, + on_blast_queue, on_construct_queue, + ignore_protection, ignore_on_blast) end - for dz=-dr,dr,dr*2 do - for dx=-dr+1,dr-1,1 do - for dy=-dr+1,dr-1,1 do - table.insert(list, {x=dx, y=dy, z=dz}) - end - end + end + vi = vi + 1 + end + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() + vm:update_liquids() + + -- call check_single_for_falling for everything within 1.5x blast radius + for y = -radius * 1.5, radius * 1.5 do + for z = -radius * 1.5, radius * 1.5 do + for x = -radius * 1.5, radius * 1.5 do + local rad = {x = x, y = y, z = z} + local s = vector.add(pos, rad) + local r = vector.length(rad) + if r / radius < 1.4 then + minetest.check_single_for_falling(s) + end + end + end + end + + for _, queued_data in pairs(on_blast_queue) do + local dist = math.max(1, vector.distance(queued_data.pos, pos)) + local intensity = (radius * radius) / (dist * dist) + local node_drops = queued_data.on_blast(queued_data.pos, intensity) + if node_drops then + for _, item in pairs(node_drops) do + add_drop(drops, item) end - for _,p in ipairs(list) do - local np = {x=pos.x+p.x, y=pos.y+p.y, z=pos.z+p.z} - - local node = minetest.get_node(np) - if node.name == "air" then - elseif node.name == "tnt:tnt" or node.name == "tnt:tnt_burning" then - if radius < radius_max then - if radius <= 5 then - radius = radius + 1 - elseif radius <= 10 then - radius = radius + 0.5 - else - radius = radius + 0.3 - end - minetest.remove_node(np, 2) - tnts = tnts + 1 - else - minetest.set_node(np, {name="tnt:tnt_burning"}) - boom(np, 1) - end - elseif node.name == "fire:basic_flame" - --or string.find(node.name, "default:water_") - --or string.find(node.name, "default:lava_") - or node.name == "tnt:boom" - then - - else - if math.abs(p.x)<2 and math.abs(p.y)<2 and math.abs(p.z)<2 then - destroy(drops, np, dr == radius, radius > 7) - destroyed = destroyed + 1 - else - if math.random(1,5) <= 4 then - destroy(drops, np, dr == radius, radius > 7) - destroyed = destroyed + 1 - end - end - end - end end + end - local objects = minetest.get_objects_inside_radius(pos, radius*2) - for _,obj in ipairs(objects) do - --if obj:is_player() or (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item") then - local p = obj:getpos() - local v = obj:getvelocity() - local vec = {x=p.x-pos.x, y=p.y-pos.y, z=p.z-pos.z} - local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5 - local damage = ((radius*20)/dist) - --print("DMG dist="..dist.." damage="..damage) - if obj:is_player() or (obj:get_luaentity() and obj:get_luaentity().name ~= "__builtin:item") then - obj:punch(obj, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=damage}, - }, vec) - end - if v ~= nil then - --obj:setvelocity({x=(p.x - pos.x) + (radius / 4) + v.x, y=(p.y - pos.y) + (radius / 2) + v.y, z=(p.z - pos.z) + (radius / 4) + v.z}) - obj:setvelocity({x=(p.x - pos.x) + (radius / 2) + v.x, y=(p.y - pos.y) + radius + v.y, z=(p.z - pos.z) + (radius / 2) + v.z}) - end - --end - end + for _, queued_data in pairs(on_construct_queue) do + queued_data.fn(queued_data.pos) + end - - print("TNT exploded=" .. tnts .. " radius=" .. radius .. " destroyed="..destroyed) - - for _,stack in pairs(drops) do - eject_drops(pos, stack) - end - local radiusp = radius+1 - minetest.add_particlespawner( - 100, --amount - 0.1, --time - {x=pos.x-radiusp, y=pos.y-radiusp, z=pos.z-radiusp}, --minpos - {x=pos.x+radiusp, y=pos.y+radiusp, z=pos.z+radiusp}, --maxpos - {x=-0, y=-0, z=-0}, --minvel - {x=0, y=0, z=0}, --maxvel - {x=-0.5,y=5,z=-0.5}, --minacc - {x=0.5,y=5,z=0.5}, --maxacc - 0.1, --minexptime - 1, --maxexptime - 8, --minsize - 15, --maxsize - false, --collisiondetection - "tnt_smoke.png" --texture - ) - end, pos) + return drops, radius end -minetest.register_node("tnt:tnt", { - description = "TNT -ONLY USE BELOW -150 METERS ;-) JOIN THEM FOR HUGE BOOM", - tiles = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png"}, - 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"}) - boom(pos, 4) - end - end, - - mesecons = { - effector = { - action_on = function(pos, node) - minetest.set_node(pos, {name="tnt:tnt_burning"}) - boom(pos, 0) - end - }, - }, -}) - -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(), -}) +function tnt.boom(pos, def) + minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) + minetest.set_node(pos, {name = "tnt:boom"}) + local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, + def.ignore_on_blast) + -- append entity drops + local damage_radius = (radius / def.radius) * def.damage_radius + entity_physics(pos, damage_radius, drops) + if not def.disable_drops then + eject_drops(drops, pos, radius) + end + add_effects(pos, radius, drops) + minetest.log("action", "A TNT explosion occurred at " .. minetest.pos_to_string(pos) .. + " with radius " .. radius) +end minetest.register_node("tnt:boom", { - drawtype = "plantlike", - tiles = {"tnt_boom.png"}, - light_source = LIGHT_MAX, + drawtype = "airlike", + light_source = default.LIGHT_MAX, walkable = false, drop = "", - groups = {dig_immediate=3}, + groups = {dig_immediate = 3}, + on_construct = function(pos) + minetest.get_node_timer(pos):start(0.4) + end, + on_timer = function(pos, elapsed) + minetest.remove_node(pos) + end, + -- unaffected by explosions + on_blast = function() end, }) -burn = function(pos) - if minetest.get_node(pos).name == "tnt:tnt" then - minetest.sound_play("tnt_ignite", {pos=pos}) - minetest.set_node(pos, {name="tnt:tnt_burning"}) - boom(pos, 1) - return - end - if minetest.get_node(pos).name ~= "tnt:gunpowder" then - return - end - minetest.sound_play("tnt_gunpowder_burning", {pos=pos, gain=2}) - minetest.set_node(pos, {name="tnt:gunpowder_burning"}) - - minetest.after(1, function(pos) - if minetest.get_node(pos).name ~= "tnt:gunpowder_burning" then - return - end - minetest.after(0.5, function(pos) - minetest.remove_node(pos) - end, {x=pos.x, y=pos.y, z=pos.z}) - for dx=-1,1 do - for dz=-1,1 do - for dy=-1,1 do - pos.x = pos.x+dx - pos.y = pos.y+dy - pos.z = pos.z+dz - - if not (math.abs(dx) == 1 and math.abs(dz) == 1) then - if dy == 0 then - burn({x=pos.x, y=pos.y, z=pos.z}) - else - if math.abs(dx) == 1 or math.abs(dz) == 1 then - burn({x=pos.x, y=pos.y, z=pos.z}) - end - end - end - - pos.x = pos.x-dx - pos.y = pos.y-dy - pos.z = pos.z-dz - end - end - end - end, pos) -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.png",}, + 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}, + groups = {dig_immediate = 2, attached_node = 1, flammable = 5, + connect_to_raillike = minetest.raillike_group("gunpowder")}, sounds = default.node_sound_leaves_defaults(), - + on_punch = function(pos, node, puncher) if puncher:get_wielded_item():get_name() == "default:torch" then - burn(pos) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + minetest.log("action", puncher:get_player_name() .. + " ignites tnt:gunpowder at " .. + minetest.pos_to_string(pos)) end end, + on_blast = function(pos, intensity) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, + on_burn = function(pos) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, + on_ignite = function(pos, igniter) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, }) minetest.register_node("tnt:gunpowder_burning", { @@ -313,46 +458,188 @@ minetest.register_node("tnt:gunpowder_burning", { sunlight_propagates = true, walkable = false, light_source = 5, - tiles = {{name="tnt_gunpowder_burning_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}}}, + 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}, + groups = { + dig_immediate = 2, + attached_node = 1, + connect_to_raillike = minetest.raillike_group("gunpowder") + }, sounds = default.node_sound_leaves_defaults(), -}) - -minetest.register_abm({ - nodenames = {"tnt:tnt", "tnt:gunpowder"}, - neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"}, - interval = 2, - chance = 10, - action = function(pos, node) - if node.name == "tnt:tnt" then - minetest.set_node(pos, {name="tnt:tnt_burning"}) - boom({x=pos.x, y=pos.y, z=pos.z}, 0) - else - burn(pos) + 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 + tnt.burn({ + x = pos.x + dx, + y = pos.y + dy, + z = pos.z + dz, + }) + end end - end + end + end + minetest.remove_node(pos) + end, + -- unaffected by explosions + on_blast = function() end, + on_construct = function(pos) + minetest.sound_play("tnt_gunpowder_burning", {pos = pos, gain = 2}) + minetest.get_node_timer(pos):start(1) + end, }) minetest.register_craft({ - output = "tnt:gunpowder", + output = "tnt:gunpowder 5", 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 enable_tnt then + minetest.register_craft({ + output = "tnt:tnt", + recipe = { + {"group:wood", "tnt:gunpowder", "group:wood"}, + {"tnt:gunpowder", "tnt:gunpowder", "tnt:gunpowder"}, + {"group:wood", "tnt:gunpowder", "group:wood"} + } + }) -if minetest.setting_get("log_mods") then - minetest.log("action", "tnt loaded") + minetest.register_abm({ + label = "TNT ignition", + nodenames = {"group:tnt", "tnt:gunpowder"}, + neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"}, + interval = 4, + chance = 1, + action = function(pos, node) + tnt.burn(pos, node.name) + end, + }) end + +function tnt.register_tnt(def) + local name + if not def.name:find(':') then + name = "tnt:" .. def.name + else + name = def.name + def.name = def.name:match(":([%w_]+)") + end + if not def.tiles then def.tiles = {} end + local tnt_top = def.tiles.top or def.name .. "_top.png" + local tnt_bottom = def.tiles.bottom or def.name .. "_bottom.png" + local tnt_side = def.tiles.side or def.name .. "_side.png" + local tnt_burning = def.tiles.burning or def.name .. "_top_burning_animated.png" + if not def.damage_radius then def.damage_radius = def.radius * 2 end + + if enable_tnt then + minetest.register_node(":" .. name, { + description = def.description, + tiles = {tnt_top, tnt_bottom, tnt_side}, + is_ground_content = false, + groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5}, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + minetest.set_node(pos, {name = name .. "_burning"}) + minetest.log("action", puncher:get_player_name() .. + " ignites " .. node.name .. " at " .. + minetest.pos_to_string(pos)) + end + end, + on_blast = function(pos, intensity) + minetest.after(0.1, function() + tnt.boom(pos, def) + end) + end, + mesecons = {effector = + {action_on = + function(pos) + tnt.boom(pos, def) + end + } + }, + on_burn = function(pos) + minetest.set_node(pos, {name = name .. "_burning"}) + end, + on_ignite = function(pos, igniter) + minetest.set_node(pos, {name = name .. "_burning"}) + end, + }) + end + + minetest.register_node(":" .. name .. "_burning", { + tiles = { + { + name = tnt_burning, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + tnt_bottom, tnt_side + }, + light_source = 5, + drop = "", + sounds = default.node_sound_wood_defaults(), + groups = {falling_node = 1}, + on_timer = function(pos, elapsed) + tnt.boom(pos, def) + end, + -- unaffected by explosions + on_blast = function() end, + on_construct = function(pos) + minetest.sound_play("tnt_ignite", {pos = pos}) + minetest.get_node_timer(pos):start(4) + minetest.check_for_falling(pos) + end, + }) +end + +tnt.register_tnt({ + name = "tnt:tnt", + description = "TNT", + radius = tnt_radius, +}) diff --git a/mods/tnt/license.txt b/mods/tnt/license.txt new file mode 100644 index 00000000..210f2bdc --- /dev/null +++ b/mods/tnt/license.txt @@ -0,0 +1,65 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 PilzAdam +Copyright (C) 2014-2016 ShadowNinja +Copyright (C) 2016 sofar (sofar@foo-projects.org) +Copyright (C) 2014-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2014-2016 ShadowNinja +Copyright (C) 2015-2016 Wuzzy +Copyright (C) 2016 sofar (sofar@foo-projects.org) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/tnt/textures/tnt_blast.png b/mods/tnt/textures/tnt_blast.png new file mode 100644 index 00000000..bbb1096f Binary files /dev/null and b/mods/tnt/textures/tnt_blast.png differ diff --git a/mods/tnt/textures/tnt_gunpowder.png b/mods/tnt/textures/tnt_gunpowder.png deleted file mode 100644 index 52153e92..00000000 Binary files a/mods/tnt/textures/tnt_gunpowder.png and /dev/null differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning.png b/mods/tnt/textures/tnt_gunpowder_burning.png deleted file mode 100644 index fa7d107b..00000000 Binary files a/mods/tnt/textures/tnt_gunpowder_burning.png and /dev/null differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_animated.png deleted file mode 100644 index 5ee24840..00000000 Binary files a/mods/tnt/textures/tnt_gunpowder_burning_animated.png and /dev/null 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 00000000..a901f7bd 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 00000000..bc018065 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 00000000..c860acef 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 00000000..a556072c 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 00000000..916c84ee 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 00000000..cb8b4eac Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_curved.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 00000000..8ab0e3c8 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 00000000..ac997a7a Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_t_junction.png differ diff --git a/mods/tnt/textures/tnt_smoke.png b/mods/tnt/textures/tnt_smoke.png index c3790476..488b50fe 100644 Binary files a/mods/tnt/textures/tnt_smoke.png and b/mods/tnt/textures/tnt_smoke.png differ diff --git a/mods/vessels/README.txt b/mods/vessels/README.txt index c2a802f4..5bb798c8 100644 --- a/mods/vessels/README.txt +++ b/mods/vessels/README.txt @@ -1,50 +1,22 @@ Minetest Game mod: vessels ========================== +See license.txt for license information. -Crafts -------- -Glass bottle (yields 10) +Authors of source code +---------------------- +Originally by Vanessa Ezekowitz (LGPL 2.1) +Modified by Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) - G - G - G - G - - G - +Authors of media (textures) +--------------------------- +All not listed below, Vanessa Ezekowitz (CC BY-SA 3.0) -Drinking Glass (yields 14) +The following textures were modified by Thomas-S (CC BY-SA 3.0): + vessels_drinking_glass.png + vessels_drinking_glass_inv.png + vessels_glass_bottle.png + vessels_steel_bottle.png - G - G - G - G - G G G - -Heavy Steel Bottle (yields 5) - - S - S - S - S - - S - - -License of source code: ------------------------ -Copyright (C) 2012 Vanessa Ezekowitz -Version 2012-09-02 -Modifications by Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -http://www.gnu.org/licenses/lgpl-2.1.html - -License of media (textures and sounds) --------------------------------------- -WTFPL - -Authors of media files ------------------------ -Unless specifically noted, -Copyright (C) 2012 Vanessa Ezekowitz - -The following textures were modified by Thomas-S (License is CC0): - vessels_drinking_glass.png - vessels_drinking_glass_inv.png (Paramat helped to improve this texture) - vessels_glass_bottle.png - vessels_steel_bottle.png +The following texture was created by Wuzzy (CC BY-SA 3.0): + vessels_shelf_slot.png (based on vessels_glass_bottle.png) diff --git a/mods/vessels/init.lua b/mods/vessels/init.lua index e56cc284..688413f2 100644 --- a/mods/vessels/init.lua +++ b/mods/vessels/init.lua @@ -13,6 +13,25 @@ local vessels_shelf_formspec = "listring[current_player;main]" .. default.get_hotbar_bg(0, 2.85) +local function get_vessels_shelf_formspec(inv) + local formspec = vessels_shelf_formspec + local invlist = inv and inv:get_list("vessels") + -- Inventory slots overlay + local vx, vy = 0, 0.3 + for i = 1, 16 do + if i == 9 then + vx = 0 + vy = vy + 1 + end + if not invlist or invlist[i]:is_empty() then + formspec = formspec .. + "image[" .. vx .. "," .. vy .. ";1,1;vessels_shelf_slot.png]" + end + vx = vx + 1 + end + return formspec +end + minetest.register_node("vessels:shelf", { description = "Vessels Shelf", tiles = {"default_wood.png", "default_wood.png", "default_wood.png", @@ -24,7 +43,7 @@ minetest.register_node("vessels:shelf", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", vessels_shelf_formspec) + meta:set_string("formspec", get_vessels_shelf_formspec(nil)) local inv = meta:get_inventory() inv:set_size("vessels", 8 * 2) end, @@ -41,14 +60,20 @@ minetest.register_node("vessels:shelf", { on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) minetest.log("action", player:get_player_name() .. " moves stuff in vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " moves stuff to vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. " takes stuff from vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) end, on_blast = function(pos) local drops = {} @@ -183,3 +208,9 @@ minetest.register_craft( { output = "default:steel_ingot", recipe = "vessels:steel_bottle", }) + +minetest.register_craft({ + type = "fuel", + recipe = "vessels:shelf", + burntime = 30, +}) diff --git a/mods/vessels/license.txt b/mods/vessels/license.txt new file mode 100644 index 00000000..de16a3b0 --- /dev/null +++ b/mods/vessels/license.txt @@ -0,0 +1,52 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2016 Thomas-S + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/vessels/textures/vessels_shelf_slot.png b/mods/vessels/textures/vessels_shelf_slot.png new file mode 100644 index 00000000..ff29082a Binary files /dev/null and b/mods/vessels/textures/vessels_shelf_slot.png differ diff --git a/mods/walls/README.txt b/mods/walls/README.txt new file mode 100644 index 00000000..0389174d --- /dev/null +++ b/mods/walls/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: walls +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Auke Kok (LGPL 2.1) diff --git a/mods/walls/init-fence.lua b/mods/walls/init-fence.lua deleted file mode 100644 index c6a32ec6..00000000 --- a/mods/walls/init-fence.lua +++ /dev/null @@ -1,247 +0,0 @@ - ---[[ - -Walls mod for Minetest - -Copyright (C) 2015 Auke Kok - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. - ---]] - -walls = {} ---[[ ---NEW CODE -walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) - -- inventory node, and pole-type wall start item - minetest.register_node(wall_name, { - description = wall_desc, - drawtype = "nodebox", - node_box = { - type = "connected", - fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}}, - -- connect_bottom = - connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}}, - connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}}, - connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, - connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, - }, - connects_to = { "group:cracky", "group:wall", "group:stone" }, - paramtype = "light", - is_ground_content = false, - tiles = { wall_texture, }, - walkable = true, - groups = { cracky = 3, wall = 1, stone = 2 }, - sounds = wall_sounds, - }) - - -- crafting recipe - minetest.register_craft({ - output = wall_name .. " 6", - recipe = { - { '', '', '' }, - { wall_mat, wall_mat, wall_mat}, - { wall_mat, wall_mat, wall_mat}, - } - }) - -end -]] ---OLD CODE FENCE LIKE -walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) - -- inventory node, and pole-type wall start item - minetest.register_node(wall_name, { - description = wall_desc, - --drawtype = "nodebox", - drawtype = "fencelike", - node_box = { - type = "connected", - fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}}, - -- connect_bottom = - --connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}}, - --connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}}, - --connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, - --connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, - }, - --connects_to = { "group:cracky", "group:wall", "group:stone" }, - paramtype = "light", - is_ground_content = false, - tiles = { wall_texture, }, - walkable = true, - groups = { cracky = 3, wall = 1, stone = 2 }, - sounds = wall_sounds, - }) - - -- crafting recipe - minetest.register_craft({ - output = wall_name .. " 6", - recipe = { - { '', '', '' }, - { wall_mat, wall_mat, wall_mat}, - { wall_mat, wall_mat, wall_mat}, - } - }) - - -- reverse crafting recipe - minetest.register_craft({ - output = wall_mat .. " 6", - recipe = { - { '', '', '' }, - { wall_name, wall_name, wall_name}, - { wall_name, wall_name, wall_name}, - } - }) - -end - - - - - ---CURRENT FENCE CODE REF ---[[ --- Fence registration helper --- -function default.register_fence(name, def) - minetest.register_craft({ - output = name .. " 4", - recipe = { - { def.material, 'group:stick', def.material }, - { def.material, 'group:stick', def.material }, - } - }) - - local fence_texture = "default_fence_overlay.png^" .. def.texture .. - "^default_fence_overlay.png^[makealpha:255,126,126" - -- Allow almost everything to be overridden - local default_fields = { - paramtype = "light", - drawtype = "fencelike", - inventory_image = fence_texture, - wield_image = fence_texture, - tiles = { def.texture }, - 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 = {}, - } - for k, v in pairs(default_fields) do - if not def[k] then - def[k] = v - end - end - - -- Always add to the fence group, even if no group provided - def.groups.fence = 1 - - def.texture = nil - def.material = nil - - minetest.register_node(name, def) -end -]] - -walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png", - "default:cobble", default.node_sound_stone_defaults()) - -walls.register("walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png", - "default:mossycobble", default.node_sound_stone_defaults()) - -walls.register("walls:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png", - "default:desert_cobble", default.node_sound_stone_defaults()) - -walls.register("walls:stone", "Stone Wall", "default_stone.png", - "default:stone", default.node_sound_stone_defaults()) - -walls.register("walls:stonebrick", "Stone Brick Wall", "default_stone_brick.png", - "default:stonebrick", default.node_sound_stone_defaults()) - -walls.register("walls:desert_stone", "Desert Stone Wall", "default_desert_stone.png", - "default:desert_stone", default.node_sound_stone_defaults()) - -walls.register("walls:desert_stonebrick", "Desert Stone Brick Wall", "default_desert_stone_brick.png", - "default:desert_stonebrick", default.node_sound_stone_defaults()) - -walls.register("walls:sandstone", "Sandstone Wall", "default_sandstone.png", - "default:sandstone", default.node_sound_stone_defaults()) - -walls.register("walls:sandstonebrick", "Sandstone Brick Wall", "default_sandstone_brick.png", - "default:sandstonebrick", default.node_sound_stone_defaults()) - -walls.register("walls:obsidianbrick", "Obsidian Brick Wall", "default_obsidian_brick.png", - "default:obsidianbrick", default.node_sound_stone_defaults()) - -walls.register("walls:brick", "Brick Wall", "default_brick.png", - "default:brick", default.node_sound_stone_defaults()) - -walls.register("walls:diamondblock", "Diamond Block Wall", "default_diamond_block.png", - "default:diamondblock", default.node_sound_stone_defaults()) - -walls.register("walls:goldblock", "Gold Block Wall", "default_gold_block.png", - "default:goldblock", default.node_sound_stone_defaults()) - -walls.register("walls:mese", "Mese Block Wall", "default_mese_block.png", - "default:mese", default.node_sound_stone_defaults()) - -walls.register("walls:bronzeblock", "Bronze Block Wall", "default_bronze_block.png", - "default:bronzeblock", default.node_sound_stone_defaults()) - -walls.register("walls:copperblock", "Copper Block Wall", "default_copper_block.png", - "default:copperblock", default.node_sound_stone_defaults()) - -walls.register("walls:steelblock", "Steel Block Wall", "default_steel_block.png", - "default:steelblock", default.node_sound_stone_defaults()) - -walls.register("walls:goldblock", "Gold Block Wall", "default_gold_block.png", - "default:goldblock", default.node_sound_stone_defaults()) - -walls.register("walls:waterflowing", "Water Flowing Wall", "default_water.png", - "default:water_flowing", default.node_sound_stone_defaults()) - -walls.register("walls:nyancat_rainbow", "Nyan Cat Rainbow Wall", "default_nc_rb.png", - "default:nyancat_rainbow", default.node_sound_stone_defaults()) - -walls.register("walls:torch", "Torch Wall", "fire_basic_flame.png", - "default:torch", default.node_sound_stone_defaults()) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mods/walls/init-wall.lua b/mods/walls/init-wall.lua deleted file mode 100644 index 20685634..00000000 --- a/mods/walls/init-wall.lua +++ /dev/null @@ -1,199 +0,0 @@ - ---[[ - -Walls mod for Minetest - -Copyright (C) 2015 Auke Kok - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. - ---]] - -walls = {} - ---NEW CODE -walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) - -- inventory node, and pole-type wall start item - minetest.register_node(wall_name, { - description = wall_desc, - drawtype = "nodebox", - node_box = { - type = "connected", - fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}}, - -- connect_bottom = - connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}}, - connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}}, - connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, - connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, - }, - connects_to = { "group:cracky", "group:wall", "group:stone" }, - paramtype = "light", - is_ground_content = false, - tiles = { wall_texture, }, - walkable = true, - groups = { cracky = 3, wall = 1, stone = 2 }, - sounds = wall_sounds, - }) - - -- crafting recipe - minetest.register_craft({ - output = wall_name .. " 6", - recipe = { - { '', '', '' }, - { wall_mat, wall_mat, wall_mat}, - { wall_mat, wall_mat, wall_mat}, - } - }) - -end - - - - ---CURRENT FENCE CODE REF - --- Fence registration helper --- -function default.register_fence(name, def) - minetest.register_craft({ - output = name .. " 4", - recipe = { - { def.material, 'group:stick', def.material }, - { def.material, 'group:stick', def.material }, - } - }) - - local fence_texture = "default_fence_overlay.png^" .. def.texture .. - "^default_fence_overlay.png^[makealpha:255,126,126" - -- Allow almost everything to be overridden - local default_fields = { - paramtype = "light", - drawtype = "fencelike", - inventory_image = fence_texture, - wield_image = fence_texture, - tiles = { def.texture }, - 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 = {}, - } - for k, v in pairs(default_fields) do - if not def[k] then - def[k] = v - end - end - - -- Always add to the fence group, even if no group provided - def.groups.fence = 1 - - def.texture = nil - def.material = nil - - minetest.register_node(name, def) -end - - -walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png", - "default:cobble", default.node_sound_stone_defaults()) - -walls.register("walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png", - "default:mossycobble", default.node_sound_stone_defaults()) - -walls.register("walls:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png", - "default:desert_cobble", default.node_sound_stone_defaults()) - -walls.register("walls:stone", "Stone Wall", "default_stone.png", - "default:stone", default.node_sound_stone_defaults()) - -walls.register("walls:stonebrick", "Stone Brick Wall", "default_stone_brick.png", - "default:stonebrick", default.node_sound_stone_defaults()) - -walls.register("walls:desert_stone", "Desert Stone Wall", "default_desert_stone.png", - "default:desert_stone", default.node_sound_stone_defaults()) - -walls.register("walls:desert_stonebrick", "Desert Stone Brick Wall", "default_desert_stone_brick.png", - "default:desert_stonebrick", default.node_sound_stone_defaults()) - -walls.register("walls:sandstone", "Sandstone Wall", "default_sandstone.png", - "default:sandstone", default.node_sound_stone_defaults()) - -walls.register("walls:sandstonebrick", "Sandstone Brick Wall", "default_sandstone_brick.png", - "default:sandstonebrick", default.node_sound_stone_defaults()) - -walls.register("walls:obsidianbrick", "Obsidian Brick Wall", "default_obsidian_brick.png", - "default:obsidianbrick", default.node_sound_stone_defaults()) - -walls.register("walls:brick", "Brick Wall", "default_brick.png", - "default:brick", default.node_sound_stone_defaults()) - -walls.register("walls:diamondblock", "Diamond Block Wall", "default_diamond_block.png", - "default:diamondblock", default.node_sound_stone_defaults()) - -walls.register("walls:goldblock", "Gold Block Wall", "default_gold_block.png", - "default:goldblock", default.node_sound_stone_defaults()) - -walls.register("walls:mese", "Mese Block Wall", "default_mese_block.png", - "default:mese", default.node_sound_stone_defaults()) - -walls.register("walls:bronzeblock", "Bronze Block Wall", "default_bronze_block.png", - "default:bronzeblock", default.node_sound_stone_defaults()) - -walls.register("walls:copperblock", "Copper Block Wall", "default_copper_block.png", - "default:copperblock", default.node_sound_stone_defaults()) - -walls.register("walls:steelblock", "Steel Block Wall", "default_steel_block.png", - "default:steelblock", default.node_sound_stone_defaults()) - -walls.register("walls:goldblock", "Gold Block Wall", "default_gold_block.png", - "default:goldblock", default.node_sound_stone_defaults()) - -walls.register("walls:waterflowing", "Water Flowing Wall", "default_water.png", - "default:water_flowing", default.node_sound_stone_defaults()) - -walls.register("walls:nyancat_rainbow", "Nyan Cat Rainbow Wall", "default_nc_rb.png", - "default:nyancat_rainbow", default.node_sound_stone_defaults()) - -walls.register("walls:torch", "Torch Wall", "fire_basic_flame.png", - "default:torch", default.node_sound_stone_defaults()) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mods/walls/init.lua b/mods/walls/init.lua index 549a4104..b91321bb 100644 --- a/mods/walls/init.lua +++ b/mods/walls/init.lua @@ -1,21 +1,5 @@ - ---[[ - -Walls mod for Minetest - -Copyright (C) 2015 Auke Kok - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. - ---]] - walls = {} ---NEW CODE walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) -- inventory node, and pole-type wall start item minetest.register_node(wall_name, { @@ -30,12 +14,12 @@ walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sou connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, }, - connects_to = { "group:cracky", "group:wall", "group:stone"}, + connects_to = { "group:wall", "group:stone" }, paramtype = "light", is_ground_content = false, tiles = { wall_texture, }, walkable = true, - groups = { cracky = 3, wall = 1, stone = 2,not_in_craft_guide=1,oddly_breakable_by_hand = 1 }, + groups = { cracky = 3, wall = 1, stone = 2, oddly_breakable_by_hand = 1, not_in_craft_guide=1}, sounds = wall_sounds, }) @@ -51,55 +35,6 @@ walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sou end - - - ---CURRENT FENCE CODE REF - --- Fence registration helper --- -function default.register_fence(name, def) - minetest.register_craft({ - output = name .. " 4", - recipe = { - { def.material, 'group:stick', def.material }, - { def.material, 'group:stick', def.material }, - } - }) - - local fence_texture = "default_fence_overlay.png^" .. def.texture .. - "^default_fence_overlay.png^[makealpha:255,126,126" - -- Allow almost everything to be overridden - local default_fields = { - paramtype = "light", - drawtype = "fencelike", - inventory_image = fence_texture, - wield_image = fence_texture, - tiles = { def.texture }, - 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 = {}, - } - for k, v in pairs(default_fields) do - if not def[k] then - def[k] = v - end - end - - -- Always add to the fence group, even if no group provided - def.groups.fence = 1 - - def.texture = nil - def.material = nil - - minetest.register_node(name, def) -end - - walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png", "default:cobble", default.node_sound_stone_defaults()) @@ -259,6 +194,5 @@ walls.register("walls:pillar", "Quartz Pillar Wall", "quartz_pillar_side.png", "quartz:pillar", default.node_sound_stone_defaults()) walls.register("walls:chiseled", "Quartz Chisled Wall", "quartz_chiseled.png", - "quartz:chiseled", default.node_sound_stone_defaults()) - + "quartz:chiseled", default.node_sound_stone_defaults()) diff --git a/mods/walls/license.txt b/mods/walls/license.txt new file mode 100644 index 00000000..ccfaf1cd --- /dev/null +++ b/mods/walls/license.txt @@ -0,0 +1,14 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2015 Auke Kok + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html diff --git a/mods/wool/README.txt b/mods/wool/README.txt index f57b6dd3..a66677dd 100644 --- a/mods/wool/README.txt +++ b/mods/wool/README.txt @@ -1,28 +1,16 @@ Minetest Game mod: wool ======================= +See license.txt for license information. -Mostly backward-compatible with jordach's 16-color wool mod. - -License of source code: ------------------------ -Copyright (C) 2012 Perttu Ahola (celeron55) - -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. - -License of media (textures and sounds) --------------------------------------- -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ - -Authors of media files ------------------------ -Cisoun: -- wool_black.png wool_brown.png wool_dark_green.png wool_green.png -- wool_magenta.png wool_pink.png wool_violet.png wool_yellow.png wool_blue.png -- wool_cyan.png wool_dark_grey.png wool_grey.png wool_orange.png wool_red.png -- wool_white.png +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) +Authors of media (textures) +--------------------------- +Cisoun (CC BY-SA 3.0): + wool_black.png wool_brown.png wool_dark_green.png wool_green.png + wool_magenta.png wool_pink.png wool_violet.png wool_yellow.png + wool_blue.png wool_cyan.png wool_dark_grey.png wool_grey.png + wool_orange.png wool_red.png wool_white.png diff --git a/mods/wool/license.txt b/mods/wool/license.txt new file mode 100644 index 00000000..93101636 --- /dev/null +++ b/mods/wool/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Cisoun + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/xpanes/README.txt b/mods/xpanes/README.txt index b89e74a2..bcbc1294 100644 --- a/mods/xpanes/README.txt +++ b/mods/xpanes/README.txt @@ -1,16 +1,21 @@ Minetest Game mod: xpanes ========================= +See license.txt for license information. -License: --------- -Copyright (C) xyz -modified by BlockMen (iron bars) +Authors of source code +---------------------- +Originally by xyz (MIT) +BlockMen (MIT) +sofar (MIT) +Various Minetest developers and contributors (MIT) -Gambit (WTFPL): - xpanes_bar.png +Authors of media (textures) +--------------------------- +xyz (CC BY-SA 3.0): + All textures not mentioned below. -This program is free software. It comes without any warranty, to -the extent permitted by applicable law. You can redistribute it -and/or modify it under the terms of the Do What The Fuck You Want -To Public License, Version 2, as published by Sam Hocevar. See -http://sam.zoy.org/wtfpl/COPYING for more details. +Gambit (CC BY-SA 3.0): + xpanes_bar.png + +paramat (CC BY-SA 3.0): + xpanes_bar_top.png diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua index 9189912e..77278a5c 100644 --- a/mods/xpanes/init.lua +++ b/mods/xpanes/init.lua @@ -1,156 +1,146 @@ -xpanes = {} -local function rshift(x, by) - return math.floor(x / 2 ^ by) +local function is_pane(pos) + return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0 end -local directions = { - {x = 1, y = 0, z = 0}, - {x = 0, y = 0, z = 1}, - {x = -1, y = 0, z = 0}, - {x = 0, y = 0, z = -1}, -} +local function connects_dir(pos, name, dir) + local aside = vector.add(pos, minetest.facedir_to_dir(dir)) + if is_pane(aside) then + return true + end -local function update_pane(pos, name) - if not minetest.get_node(pos).name:find("^xpanes:"..name) then + local connects_to = minetest.registered_nodes[name].connects_to + if not connects_to then + return false + end + local list = minetest.find_nodes_in_area(aside, aside, connects_to) + + if #list > 0 then + return true + end + + return false +end + +local function swap(pos, node, name, param2) + if node.name == name and node.param2 == param2 then return end - local sum = 0 - for i, dir in pairs(directions) do - local node = minetest.get_node(vector.add(pos, dir)) - local def = minetest.registered_nodes[node.name] - local pane_num = def and def.groups.pane or 0 - if pane_num > 0 or not def or (def.walkable ~= false and - def.drawtype ~= "nodebox") then - sum = sum + 2 ^ (i - 1) + + minetest.set_node(pos, {name = name, param2 = param2}) +end + +local function update_pane(pos) + if not is_pane(pos) then + return + end + local node = minetest.get_node(pos) + local name = node.name + if name:sub(-5) == "_flat" then + name = name:sub(1, -6) + end + + local any = node.param2 + local c = {} + local count = 0 + for dir = 0, 3 do + c[dir] = connects_dir(pos, name, dir) + if c[dir] then + any = dir + count = count + 1 end end - if sum == 0 then - sum = 15 - end - minetest.set_node(pos, {name = "xpanes:"..name.."_"..sum}) -end -local function update_nearby(pos, node) - node = node or minetest.get_node(pos) - local name = node.name - if not name or node.name:sub(1, 7) ~= "xpanes:" then - return - end - local underscore_pos = string.find(name, "_[^_]*$") or 0 - local len = name:len() - local num = tonumber(name:sub(underscore_pos+1, len)) - if not num or num < 1 or num > 15 then - name = name:sub(8) + if count == 0 then + swap(pos, node, name .. "_flat", any) + elseif count == 1 then + swap(pos, node, name .. "_flat", (any + 1) % 4) + elseif count == 2 then + if (c[0] and c[2]) or (c[1] and c[3]) then + swap(pos, node, name .. "_flat", (any + 1) % 4) + else + swap(pos, node, name, 0) + end else - name = name:sub(8, underscore_pos - 1) - end - for i, dir in pairs(directions) do - update_pane(vector.add(pos, dir), name) + swap(pos, node, name, 0) end end -minetest.register_on_placenode(update_nearby) -minetest.register_on_dignode(update_nearby) +minetest.register_on_placenode(function(pos, node) + if minetest.get_item_group(node, "pane") then + update_pane(pos) + end + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) -local half_boxes = { - {0, -0.5, -1/32, 0.5, 0.5, 1/32}, - {-1/32, -0.5, 0, 1/32, 0.5, 0.5}, - {-0.5, -0.5, -1/32, 0, 0.5, 1/32}, - {-1/32, -0.5, -0.5, 1/32, 0.5, 0} -} - -local full_boxes = { - {-0.5, -0.5, -1/32, 0.5, 0.5, 1/32}, - {-1/32, -0.5, -0.5, 1/32, 0.5, 0.5} -} - -local sb_half_boxes = { - {0, -0.5, -0.06, 0.5, 0.5, 0.06}, - {-0.06, -0.5, 0, 0.06, 0.5, 0.5}, - {-0.5, -0.5, -0.06, 0, 0.5, 0.06}, - {-0.06, -0.5, -0.5, 0.06, 0.5, 0} -} - -local sb_full_boxes = { - {-0.5, -0.5, -0.06, 0.5, 0.5, 0.06}, - {-0.06, -0.5, -0.5, 0.06, 0.5, 0.5} -} - -local pane_def_fields = { - drawtype = "airlike", - paramtype = "light", - is_ground_content = false, - sunlight_propagates = true, - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - air_equivalent = true, -} +minetest.register_on_dignode(function(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) +xpanes = {} function xpanes.register_pane(name, def) for i = 1, 15 do - local need = {} - local cnt = 0 - for j = 1, 4 do - if rshift(i, j - 1) % 2 == 1 then - need[j] = true - cnt = cnt + 1 - end - end - local take = {} - local take2 = {} - if need[1] == true and need[3] == true then - need[1] = nil - need[3] = nil - table.insert(take, full_boxes[1]) - table.insert(take2, sb_full_boxes[1]) - end - if need[2] == true and need[4] == true then - need[2] = nil - need[4] = nil - table.insert(take, full_boxes[2]) - table.insert(take2, sb_full_boxes[2]) - end - for k in pairs(need) do - table.insert(take, half_boxes[k]) - table.insert(take2, sb_half_boxes[k]) - end - local texture = def.textures[1] - if cnt == 1 then - texture = def.textures[1].."^"..def.textures[2] - end - minetest.register_node(":xpanes:"..name.."_"..i, { - drawtype = "nodebox", - tiles = {def.textures[3], def.textures[3], texture}, - paramtype = "light", - groups = def.groups, - drop = "xpanes:"..name, - sounds = def.sounds, - node_box = { - type = "fixed", - fixed = take - }, - selection_box = { - type = "fixed", - fixed = take2 - } - }) + minetest.register_alias("xpanes:" .. name .. "_" .. i, "xpanes:" .. name .. "_flat") end - for k, v in pairs(pane_def_fields) do - def[k] = def[k] or v - end + local flatgroups = table.copy(def.groups) + flatgroups.pane = 1 + minetest.register_node(":xpanes:" .. name .. "_flat", { + description = def.description, + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + inventory_image = def.inventory_image, + wield_image = def.wield_image, + paramtype2 = "facedir", + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = flatgroups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + selection_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connect_sides = { "left", "right" }, + }) - def.on_construct = function(pos) - update_pane(pos, name) - end - - minetest.register_node(":xpanes:"..name, def) + local groups = table.copy(def.groups) + groups.pane = 1 + groups.not_in_creative_inventory = 1 + minetest.register_node(":xpanes:" .. name, { + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + description = def.description, + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = groups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "connected", + fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}}, + connect_front = {{-1/32, -1/2, -1/2, 1/32, 1/2, -1/32}}, + connect_left = {{-1/2, -1/2, -1/32, -1/32, 1/2, 1/32}}, + connect_back = {{-1/32, -1/2, 1/32, 1/32, 1/2, 1/2}}, + connect_right = {{1/32, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connects_to = {"group:pane", "group:stone", "group:glass", "group:wood", "group:tree"}, + }) minetest.register_craft({ - output = "xpanes:"..name.." 16", + output = "xpanes:" .. name .. "_flat 16", recipe = def.recipe }) end @@ -161,7 +151,7 @@ xpanes.register_pane("pane", { inventory_image = "default_glass.png", wield_image = "default_glass.png", sounds = default.node_sound_glass_defaults(), - groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3, pane=1}, + groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3}, recipe = { {"default:glass", "default:glass", "default:glass"}, {"default:glass", "default:glass", "default:glass"} @@ -170,14 +160,25 @@ xpanes.register_pane("pane", { xpanes.register_pane("bar", { description = "Iron bar", - textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_space.png"}, + textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_bar_top.png"}, inventory_image = "xpanes_bar.png", wield_image = "xpanes_bar.png", - groups = {cracky=2, pane=1}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=2}, + sounds = default.node_sound_metal_defaults(), recipe = { {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} } }) +minetest.register_lbm({ + name = "xpanes:gen2", + nodenames = {"group:pane"}, + action = function(pos, node) + update_pane(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end + end +}) diff --git a/mods/xpanes/license.txt b/mods/xpanes/license.txt new file mode 100644 index 00000000..dff72274 --- /dev/null +++ b/mods/xpanes/license.txt @@ -0,0 +1,64 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 xyz +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2016 Auke Kok +Copyright (C) 2014-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 xyz +Copyright (C) 2013-2016 Gambit +Copyright (C) 2016 paramat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/xpanes/textures/xpanes_bar.png b/mods/xpanes/textures/xpanes_bar.png index 4d17ceb8..3ea62a93 100644 Binary files a/mods/xpanes/textures/xpanes_bar.png and b/mods/xpanes/textures/xpanes_bar.png differ diff --git a/mods/xpanes/textures/xpanes_bar_top.png b/mods/xpanes/textures/xpanes_bar_top.png new file mode 100644 index 00000000..887518aa Binary files /dev/null and b/mods/xpanes/textures/xpanes_bar_top.png differ diff --git a/mods/xpanes/textures/xpanes_grey.png b/mods/xpanes/textures/xpanes_grey.png deleted file mode 100644 index e1c6f76f..00000000 Binary files a/mods/xpanes/textures/xpanes_grey.png and /dev/null differ diff --git a/mods/xpanes/textures/xpanes_white.png b/mods/xpanes/textures/xpanes_white.png index 777bd606..a2f4b636 100644 Binary files a/mods/xpanes/textures/xpanes_white.png and b/mods/xpanes/textures/xpanes_white.png differ diff --git a/mods/alias/alias.lua b/mods/z_extra_mods/alias/alias.lua similarity index 100% rename from mods/alias/alias.lua rename to mods/z_extra_mods/alias/alias.lua diff --git a/mods/alias/esmobs.lua b/mods/z_extra_mods/alias/esmobs.lua similarity index 100% rename from mods/alias/esmobs.lua rename to mods/z_extra_mods/alias/esmobs.lua diff --git a/mods/alias/esorerem.lua b/mods/z_extra_mods/alias/esorerem.lua similarity index 100% rename from mods/alias/esorerem.lua rename to mods/z_extra_mods/alias/esorerem.lua diff --git a/mods/alias/init.lua b/mods/z_extra_mods/alias/init.lua similarity index 100% rename from mods/alias/init.lua rename to mods/z_extra_mods/alias/init.lua diff --git a/mods/alias/license.txt b/mods/z_extra_mods/alias/license.txt similarity index 100% rename from mods/alias/license.txt rename to mods/z_extra_mods/alias/license.txt diff --git a/mods/alias/moreblocksrem.lua b/mods/z_extra_mods/alias/moreblocksrem.lua similarity index 100% rename from mods/alias/moreblocksrem.lua rename to mods/z_extra_mods/alias/moreblocksrem.lua diff --git a/mods/alias/moreorerem.lua b/mods/z_extra_mods/alias/moreorerem.lua similarity index 100% rename from mods/alias/moreorerem.lua rename to mods/z_extra_mods/alias/moreorerem.lua diff --git a/mods/alias/moresnowrem.lua b/mods/z_extra_mods/alias/moresnowrem.lua similarity index 100% rename from mods/alias/moresnowrem.lua rename to mods/z_extra_mods/alias/moresnowrem.lua diff --git a/mods/alias/moretreesrem.lua b/mods/z_extra_mods/alias/moretreesrem.lua similarity index 100% rename from mods/alias/moretreesrem.lua rename to mods/z_extra_mods/alias/moretreesrem.lua diff --git a/mods/alias/pathv6rem.lua b/mods/z_extra_mods/alias/pathv6rem.lua similarity index 100% rename from mods/alias/pathv6rem.lua rename to mods/z_extra_mods/alias/pathv6rem.lua diff --git a/mods/alias/technodrem.lua b/mods/z_extra_mods/alias/technodrem.lua similarity index 100% rename from mods/alias/technodrem.lua rename to mods/z_extra_mods/alias/technodrem.lua diff --git a/mods/alias/textures/default_ladder.png b/mods/z_extra_mods/alias/textures/default_ladder.png similarity index 100% rename from mods/alias/textures/default_ladder.png rename to mods/z_extra_mods/alias/textures/default_ladder.png diff --git a/mods/alias/textures/default_nc_back.png b/mods/z_extra_mods/alias/textures/default_nc_back.png similarity index 100% rename from mods/alias/textures/default_nc_back.png rename to mods/z_extra_mods/alias/textures/default_nc_back.png diff --git a/mods/alias/textures/default_nc_front.png b/mods/z_extra_mods/alias/textures/default_nc_front.png similarity index 100% rename from mods/alias/textures/default_nc_front.png rename to mods/z_extra_mods/alias/textures/default_nc_front.png diff --git a/mods/alias/textures/default_nc_rb.png b/mods/z_extra_mods/alias/textures/default_nc_rb.png similarity index 100% rename from mods/alias/textures/default_nc_rb.png rename to mods/z_extra_mods/alias/textures/default_nc_rb.png diff --git a/mods/alias/textures/default_nc_side.png b/mods/z_extra_mods/alias/textures/default_nc_side.png similarity index 100% rename from mods/alias/textures/default_nc_side.png rename to mods/z_extra_mods/alias/textures/default_nc_side.png diff --git a/mods/alias/textures/flowers_waterlily_bottom.png b/mods/z_extra_mods/alias/textures/flowers_waterlily_bottom.png similarity index 100% rename from mods/alias/textures/flowers_waterlily_bottom.png rename to mods/z_extra_mods/alias/textures/flowers_waterlily_bottom.png diff --git a/mods/alias/villrem.lua b/mods/z_extra_mods/alias/villrem.lua similarity index 100% rename from mods/alias/villrem.lua rename to mods/z_extra_mods/alias/villrem.lua diff --git a/mods/z_extra_mods/bonemeal/README.md b/mods/z_extra_mods/bonemeal/README.md new file mode 100644 index 00000000..ed9e0e90 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/README.md @@ -0,0 +1,26 @@ +Bonemeal mod [bonemeal] + +This mod adds four new items into the game, bones which can be dug from normal +dirt which can be made into bonemeal, mulch which is is crafted using a tree and +8x leaves, and fertiliser which is a mixture of them both. + +Each item can be used on saplings and crops for a chance to grow them quicker as +well as dirt which will generate random grass, flowers or whichever decoration +is registered. + +Mulch has a strength of 1, Bonemeal 2 and Fertiliser 3 which means the stronger +the item, the more chance of growing saplings in low light, making crops sprout +quicker or simply decorate a larger area with grass and flowers. + +The api.txt document shows how to add your own saplings, crops and grasses to +the list by using one of the 3 commands included and the mod.lua file gives you +many examples by using some of the popular mods available. + +https://forum.minetest.net/viewtopic.php?f=9&t=16446 + +Changelog: + +- 0.1 - Initial release +- 0.2 - Added global on_use function for bonemeal growth +- 0.3 - Added strength to on_use global for new items (mulch and fertiliser). +- 0.4 - Added Intllib support and fr.txt file diff --git a/mods/z_extra_mods/bonemeal/api.txt b/mods/z_extra_mods/bonemeal/api.txt new file mode 100644 index 00000000..3140ac57 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/api.txt @@ -0,0 +1,76 @@ + +Bonemeal API +============ + +This guide will show you how to add saplings, crops and dirt types for the +bonemeal mod to use from withhin your own mods. Please make sure that bonemeal +appears in the depends.txt file of your mod so everything work properly. + + +Function Usage +============== + + +Adding Crops +------------ + +bonemeal:add_crop({ nodename_start, growing_steps, seed_name }) + +This command is used to add new crops for bonemeal to work on. + +e.g. + +bonemeal:add_crop({ + {"farming:cotton_", 8, "farming:seed_cotton"}, + {"farming:wheat_", 8, "farming:seed_wheat"}, +}) + + +Adding Saplings +--------------- + +bonemeal:add_sapling({ sapling_node, function, soil_type[sand, dirt, nodename] }) + +This command will add new saplings for bonemeal to grow on sand, soil or a +specified node type. + +bonemeal:add_sapling({ + {"ethereal:palm_sapling", ethereal.grow_palm_tree, "soil"}, + {"ethereal:palm_sapling", ethereal.grow_palm_tree, "sand"}, +}) + + +Adding Dirt Decoration +---------------------- + +bonemeal:add_deco({ dirt_node, {grass_node_list}, {decor_node_list} }) + +This command will add grass and decoration to specific dirt types, use "" to +add an empty node. + +e.g. + +bonemeal:add_deco({"default:dirt_with_dry_grass", {"default:dry_grass_1", ""}, + {"flowers:rose", "flowers:viola"} }) + + +Global ON_USE Function +---------------------- + +bonemeal:on_use(pos, strength) + +This function can be called from other mods to grow plants using alternative +bonemeal items and have the same effect. + + {pos} is the location to apply growing + {strength} is how strong to grow [low of 1 to high of 4] + +Note: Higher strength items require lower light levels, and a strength of 4 +needs no light at all. + + +Final Words +=========== + +I hope this guide helps you add your own plants so you can grow them quickly +with the items included. Please check the mods.lua for more examples. diff --git a/mods/z_extra_mods/bonemeal/depends.txt b/mods/z_extra_mods/bonemeal/depends.txt new file mode 100644 index 00000000..4d286ca7 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/depends.txt @@ -0,0 +1,6 @@ +default +intllib? +farming? +ethereal? +moretrees? +technic_worldgen? diff --git a/mods/z_extra_mods/bonemeal/description.txt b/mods/z_extra_mods/bonemeal/description.txt new file mode 100644 index 00000000..f85f0a20 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/description.txt @@ -0,0 +1 @@ +Adds bone and bonemeal giving the ability to quickly grow plants and saplings. \ No newline at end of file diff --git a/mods/z_extra_mods/bonemeal/init.lua b/mods/z_extra_mods/bonemeal/init.lua new file mode 100644 index 00000000..5241d392 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/init.lua @@ -0,0 +1,482 @@ + +bonemeal = {} + +-- Load support for intllib. +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP .. "/intllib.lua") + + +-- default crops +local crops = { + {"farming:cotton_", 8, "farming:seed_cotton"}, + {"farming:wheat_", 8, "farming:seed_wheat"}, +} + + +-- special pine check for nearby snow +local function pine_grow(pos) + + if minetest.find_node_near(pos, 1, + {"default:snow", "default:snowblock", "default:dirt_with_snow"}) then + + default.grow_new_snowy_pine_tree(pos) + else + default.grow_new_pine_tree(pos) + end +end + + +-- default saplings +local saplings = { + {"default:sapling", default.grow_new_apple_tree, "soil"}, + {"default:junglesapling", default.grow_new_jungle_tree, "soil"}, + {"default:acacia_sapling", default.grow_new_acacia_tree, "soil"}, + {"default:aspen_sapling", default.grow_new_aspen_tree, "soil"}, + {"default:pine_sapling", pine_grow, "soil"}, +} + +-- helper tables ( "" denotes a blank item ) +local green_grass = { + "default:grass_2", "default:grass_3", "default:grass_4", + "default:grass_5", "", "" +} + +local dry_grass = { + "default:dry_grass_2", "default:dry_grass_3", "default:dry_grass_4", + "default:dry_grass_5", "", "" +} + +local flowers = { + "flowers:dandelion_white", "flowers:dandelion_yellow", "flowers:geranium", + "flowers:rose", "flowers:tulip", "flowers:viola", "" +} + +-- add additional bakedclay flowers if enabled +if minetest.get_modpath("bakedclay") then + flowers[7] = "bakedclay:delphinium" + flowers[8] = "bakedclay:thistle" + flowers[9] = "bakedclay:lazarus" + flowers[10] = "bakedclay:mannagrass" + flowers[11] = "" +end + +-- default biomes deco +local deco = { + {"default:dirt_with_dry_grass", dry_grass, flowers}, + {"default:sand", {}, {"default:dry_shrub", "", "", ""} }, + {"default:desert_sand", {}, {"default:dry_shrub", "", "", ""} }, + {"default:silver_sand", {}, {"default:dry_shrub", "", "", ""} }, +} + + +----- local functions + + +-- particles +local function particle_effect(pos) + + minetest.add_particlespawner({ + amount = 4, + time = 0.15, + minpos = pos, + maxpos = pos, + minvel = {x = -1, y = 2, z = -1}, + maxvel = {x = 1, y = 4, z = 1}, + minacc = {x = -1, y = -1, z = -1}, + maxacc = {x = 1, y = 1, z = 1}, + minexptime = 1, + maxexptime = 1, + minsize = 1, + maxsize = 3, + texture = "bonemeal_particle.png", + }) +end + + +-- tree type check +local function grow_tree(pos, object) + + if type(object) == "table" and object.axiom then + -- grow L-system tree + minetest.remove_node(pos) + minetest.spawn_tree(pos, object) + + elseif type(object) == "string" and minetest.registered_nodes[object] then + -- place node + minetest.set_node(pos, {name = object}) + + elseif type(object) == "function" then + -- function + object(pos) + end +end + + +-- sapling check +local function check_sapling(pos, nodename) + + -- what is sapling placed on? + local under = minetest.get_node({ + x = pos.x, + y = pos.y - 1, + z = pos.z + }) + + local can_grow, grow_on + + -- check list for sapling and function + for n = 1, #saplings do + + if saplings[n][1] == nodename then + + grow_on = saplings[n][3] + + -- sapling grows on top of specific node + if grow_on + and grow_on ~= "soil" + and grow_on ~= "sand" + and grow_on == under.name then + can_grow = true + end + + -- sapling grows on top of soil (default) + if can_grow == nil + and (grow_on == nil or grow_on == "soil") + and minetest.get_item_group(under.name, "soil") > 0 then + can_grow = true + end + + -- sapling grows on top of sand + if can_grow == nil + and grow_on == "sand" + and minetest.get_item_group(under.name, "sand") > 0 then + can_grow = true + end + + -- check if we can grow sapling + if can_grow then + particle_effect(pos) + grow_tree(pos, saplings[n][2]) + return + end + end + end +end + + +-- crops check +local function check_crops(pos, nodename, strength) + + local stage = "" + + -- grow registered crops + for n = 1, #crops do + + if string.find(nodename, crops[n][1]) + or nodename == crops[n][3] then + + -- get stage number or set to 0 for seed + stage = tonumber( nodename:split("_")[2] ) or 0 + stage = math.min(stage + strength, crops[n][2]) + + minetest.set_node(pos, {name = crops[n][1] .. stage}) + + particle_effect(pos) + + return + + end + + end + +end + + +-- check soil for specific decoration placement +local function check_soil(pos, nodename, strength) + + -- set radius according to strength + local side = strength - 1 + local tall = math.max(strength - 2, 0) + + -- get area of land with free space above + local dirt = minetest.find_nodes_in_area_under_air( + {x = pos.x - side, y = pos.y - tall, z = pos.z - side}, + {x = pos.x + side, y = pos.y + tall, z = pos.z + side}, + {"group:soil", "group:sand"}) + + -- set default grass and decoration + local grass = green_grass + local decor = flowers + + -- choose grass and decoration to use on dirt patch + for n = 1, #deco do + + -- do we have a grass match? + if nodename == deco[n][1] then + grass = deco[n][2] or {} + decor = deco[n][3] or {} + end + end + + local pos2, nod + + -- loop through soil + for _,n in pairs(dirt) do + + pos2 = n + + pos2.y = pos2.y + 1 + + -- place random decoration (rare) + if math.random(1, 5) == 5 then + nod = decor[math.random(1, #decor)] or "" + if nod ~= "" then + minetest.set_node(pos2, {name = nod}) + end + else + -- place random grass (common) + nod = grass[math.random(1, #grass)] or "" + if nod ~= "" then + minetest.set_node(pos2, {name = nod}) + end + end + + particle_effect(pos2) + end +end + + +-- global functions + + +-- add to sapling list +-- {sapling node, schematic or function name, "soil"|"sand"|specific_node} +--e.g. {"default:sapling", default.grow_new_apple_tree, "soil"} + +function bonemeal:add_sapling(list) + + for n = 1, #list do + table.insert(saplings, list[n]) + end +end + + +-- add to crop list to force grow +-- {crop name start_, growth steps, seed node (if required)} +-- e.g. {"farming:wheat_", 8, "farming:seed_wheat"} +function bonemeal:add_crop(list) + + for n = 1, #list do + table.insert(crops, list[n]) + end +end + + +-- add grass and flower/plant decoration for specific dirt types +-- {dirt_node, {grass_nodes}, {flower_nodes} +-- e.g. {"default:dirt_with_dry_grass", dry_grass, flowers} +function bonemeal:add_deco(list) + + for n = 1, #list do + table.insert(deco, list[n]) + end +end + + +-- global on_use function for bonemeal +function bonemeal:on_use(pos, strength) + + -- get node pointed at + local node = minetest.get_node(pos) + + -- return if nothing there + if node.name == "ignore" then + return + end + + -- make sure strength is between 1 and 4 + strength = strength or 2 + strength = math.max(strength, 1) + strength = math.min(strength, 4) + + -- grow grass and flowers + if minetest.get_item_group(node.name, "soil") > 0 + or minetest.get_item_group(node.name, "sand") > 0 then + check_soil(pos, node.name, strength) + return + end + + -- light check depending on strength (strength of 4 = no light needed) + if (minetest.get_node_light(pos) or 0) < (12 - (strength * 3)) then + return + end + + -- check for tree growth if pointing at sapling + if minetest.get_item_group(node.name, "sapling") > 0 + and math.random(1, (5 - strength)) == 1 then + check_sapling(pos, node.name) + return + end + + -- check for crop growth + check_crops(pos, node.name, strength) +end + + +----- items + + +-- mulch (strength 1) +minetest.register_craftitem("bonemeal:mulch", { + description = S("Mulch"), + inventory_image = "bonemeal_mulch.png", + + on_use = function(itemstack, user, pointed_thing) + + -- did we point at a node? + if pointed_thing.type ~= "node" then + return + end + + -- is area protected? + if minetest.is_protected(pointed_thing.under, user:get_player_name()) then + return + end + + -- take item if not in creative + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + + -- call global on_use function with strength of 1 + bonemeal:on_use(pointed_thing.under, 1) + + return itemstack + end, +}) + +-- bonemeal (strength 2) +minetest.register_craftitem("bonemeal:bonemeal", { + description = S("Bone Meal"), + inventory_image = "bonemeal_item.png", + + on_use = function(itemstack, user, pointed_thing) + + -- did we point at a node? + if pointed_thing.type ~= "node" then + return + end + + -- is area protected? + if minetest.is_protected(pointed_thing.under, user:get_player_name()) then + return + end + + -- take item if not in creative + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + + -- call global on_use function with strength of 2 + bonemeal:on_use(pointed_thing.under, 2) + + return itemstack + end, +}) + + +-- fertiliser (strength 3) +minetest.register_craftitem("bonemeal:fertiliser", { + description = S("Fertiliser"), + inventory_image = "bonemeal_fertiliser.png", + + on_use = function(itemstack, user, pointed_thing) + + -- did we point at a node? + if pointed_thing.type ~= "node" then + return + end + + -- is area protected? + if minetest.is_protected(pointed_thing.under, user:get_player_name()) then + return + end + + -- take item if not in creative + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + + -- call global on_use function with strength of 3 + bonemeal:on_use(pointed_thing.under, 3) + + return itemstack + end, +}) + + +-- bone +minetest.register_craftitem("bonemeal:bone", { + description = S("Bone"), + inventory_image = "bonemeal_bone.png", +}) + + +--- crafting recipes + + +-- bonemeal (from bone) +minetest.register_craft({ + type = "shapeless", + output = "bonemeal:bonemeal 2", + recipe = {"bonemeal:bone"}, +}) + +-- bonemeal (from player bones) +minetest.register_craft({ + type = "shapeless", + output = "bonemeal:bonemeal 4", + recipe = {"bones:bones"}, +}) + +-- mulch +minetest.register_craft({ + type = "shapeless", + output = "bonemeal:mulch 4", + recipe = { + "group:tree", "group:leaves", "group:leaves", + "group:leaves", "group:leaves", "group:leaves", + "group:leaves", "group:leaves", "group:leaves" + }, +}) + +-- fertiliser +minetest.register_craft({ + type = "shapeless", + output = "bonemeal:fertiliser 2", + recipe = {"bonemeal:bonemeal", "bonemeal:mulch"}, +}) + +--[[ +-- add bones to dirt +minetest.override_item("default:dirt", { + drop = { + max_items = 1, + items = { + { + items = {"bonemeal:bone", "default:dirt"}, + rarity = 30, + }, + { + items = {"default:dirt"}, + } + } + }, +}) +]] + +-- add support for other mods +dofile(minetest.get_modpath("bonemeal") .. "/mods.lua") + +print (S("[bonemeal] loaded")) diff --git a/mods/z_extra_mods/bonemeal/intllib.lua b/mods/z_extra_mods/bonemeal/intllib.lua new file mode 100644 index 00000000..6669d720 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/mods/z_extra_mods/bonemeal/license.txt b/mods/z_extra_mods/bonemeal/license.txt new file mode 100644 index 00000000..fec6f6aa --- /dev/null +++ b/mods/z_extra_mods/bonemeal/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 TenPlus1 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/mods/z_extra_mods/bonemeal/locale/fr.txt b/mods/z_extra_mods/bonemeal/locale/fr.txt new file mode 100644 index 00000000..874b106d --- /dev/null +++ b/mods/z_extra_mods/bonemeal/locale/fr.txt @@ -0,0 +1,7 @@ +# init.lua + +Mulch = Paillis +Bone Meal = Poudre d'os +Fertiliser = Engrais +Bone = Os +[bonemeal] loaded = [bonemeal] chargé diff --git a/mods/z_extra_mods/bonemeal/locale/template.txt b/mods/z_extra_mods/bonemeal/locale/template.txt new file mode 100644 index 00000000..f4023ac3 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/locale/template.txt @@ -0,0 +1,7 @@ +# init.lua + +Mulch = +Bone Meal = +Fertiliser = +Bone = +[bonemeal] loaded = diff --git a/mods/z_extra_mods/bonemeal/mod.conf b/mods/z_extra_mods/bonemeal/mod.conf new file mode 100644 index 00000000..fec08dc7 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/mod.conf @@ -0,0 +1 @@ +name = bonemeal \ No newline at end of file diff --git a/mods/z_extra_mods/bonemeal/mods.lua b/mods/z_extra_mods/bonemeal/mods.lua new file mode 100644 index 00000000..4accbe64 --- /dev/null +++ b/mods/z_extra_mods/bonemeal/mods.lua @@ -0,0 +1,116 @@ + + +-- craft bones from animalmaterials into bonemeal +if minetest.get_modpath("animalmaterials") then + + minetest.register_craft({ + type = "shapeless", + output = "bonemeal:bonemeal 2", + recipe = {"animalmaterials:bone"}, + }) +end + + +if farming and farming.mod and farming.mod == "redo" then + + bonemeal:add_crop({ + {"farming:tomato_", 8}, + {"farming:corn_", 8}, + {"farming:melon_", 8}, + {"farming:pumpkin_", 8}, + {"farming:beanpole_", 5}, + {"farming:blueberry_", 4}, + {"farming:raspberry_", 4}, + {"farming:carrot_", 8}, + {"farming:cocoa_", 3}, + {"farming:coffee_", 5}, + {"farming:cucumber_", 4}, + {"farming:potato_", 4}, + {"farming:grapes_", 8}, + {"farming:rhubarb_", 3}, + {"farming:barley_", 7}, + {"farming:hemp_", 8}, + }) +end + + +if minetest.get_modpath("ethereal") then + + bonemeal:add_crop({ + {"ethereal:strawberry_", 8}, + {"ethereal:onion_", 5}, + }) + + bonemeal:add_sapling({ + {"ethereal:palm_sapling", ethereal.grow_palm_tree, "soil"}, + {"ethereal:palm_sapling", ethereal.grow_palm_tree, "sand"}, + {"ethereal:yellow_tree_sapling", ethereal.grow_yellow_tree, "soil"}, + {"ethereal:big_tree_sapling", ethereal.grow_big_tree, "soil"}, + {"ethereal:banana_tree_sapling", ethereal.grow_banana_tree, "soil"}, + {"ethereal:frost_tree_sapling", ethereal.grow_frost_tree, "soil"}, + {"ethereal:mushroom_sapling", ethereal.grow_mushroom_tree, "soil"}, + {"ethereal:willow_sapling", ethereal.grow_willow_tree, "soil"}, + {"ethereal:redwood_sapling", ethereal.grow_redwood_tree, "soil"}, + {"ethereal:orange_tree_sapling", ethereal.grow_orange_tree, "soil"}, + {"ethereal:bamboo_sprout", ethereal.grow_bamboo_tree, "soil"}, + {"ethereal:birch_sapling", ethereal.grow_birch_tree, "soil"}, + }) + + local grass = {"default:grass_3", "default:grass_4", "default:grass_5", ""} + + bonemeal:add_deco({ + {"ethereal:crystal_dirt", {"ethereal:crystalgrass", "", "", "", ""}, {}}, + {"ethereal:fiery_dirt", {"ethereal:dry_shrub", "", "", "", ""}, {}}, + {"ethereal:prairie_dirt", grass, {"flowers:dandelion_white", + "flowers:dandelion_yellow", "flowers:geranium", "flowers:rose", + "flowers:tulip", "flowers:viola", "ethereal:strawberry_7"}}, + {"ethereal:gray_dirt", {}, {"ethereal:snowygrass", "", ""}}, + {"ethereal:cold_dirt", {}, {"ethereal:snowygrass", "", ""}}, + {"ethereal:mushroom_dirt", {}, {"flowers:mushroom_red", "flowers:mushroom_brown", "", "", ""}}, + {"ethereal:jungle_dirt", grass, {"default:junglegrass", "", "", ""}}, + {"ethereal:grove_dirt", grass, {"ethereal:fern", "", "", ""}}, + {"ethereal:bamboo_dirt", grass, {}}, + }) +end + + +if minetest.get_modpath("moretrees") then + + -- special fir check for snow + local function fir_grow(pos) + + if minetest.find_node_near(pos, 1, + {"default:snow", "default:snowblock", "default:dirt_with_snow"}) then + + moretrees.grow_fir_snow(pos) + else + moretrees.grow_fir(pos) + end + end + + bonemeal:add_sapling({ + {"moretrees:beech_sapling", moretrees.spawn_beech_object, "soil"}, + {"moretrees:apple_tree_sapling", moretrees.spawn_apple_tree_object, "soil"}, + {"moretrees:oak_sapling", moretrees.spawn_oak_object, "soil"}, + {"moretrees:sequoia_sapling", moretrees.spawn_sequoia_object, "soil"}, + --{"moretrees:birch_sapling", moretrees.spawn_birch_object, "soil"}, + {"moretrees:birch_sapling", moretrees.grow_birch, "soil"}, + {"moretrees:palm_sapling", moretrees.spawn_palm_object, "soil"}, + {"moretrees:palm_sapling", moretrees.spawn_palm_object, "sand"}, + {"moretrees:date_palm_sapling", moretrees.spawn_date_palm_object, "soil"}, + {"moretrees:date_palm_sapling", moretrees.spawn_date_palm_object, "sand"}, + --{"moretrees:spruce_sapling", moretrees.spawn_spruce_object, "soil"}, + {"moretrees:spruce_sapling", moretrees.grow_spruce, "soil"}, + {"moretrees:cedar_sapling", moretrees.spawn_cedar_object, "soil"}, + {"moretrees:poplar_sapling", moretrees.spawn_poplar_object, "soil"}, + {"moretrees:willow_sapling", moretrees.spawn_willow_object, "soil"}, + {"moretrees:rubber_tree_sapling", moretrees.spawn_rubber_tree_object, "soil"}, + {"moretrees:fir_sapling", fir_grow, "soil"}, + }) + +elseif minetest.get_modpath("technic_worldgen") then + + bonemeal:add_sapling({ + {"moretrees:rubber_tree_sapling", technic.rubber_tree_model, "soil"}, + }) +end diff --git a/mods/z_extra_mods/bonemeal/screenshot.png b/mods/z_extra_mods/bonemeal/screenshot.png new file mode 100644 index 00000000..c4b9fa71 Binary files /dev/null and b/mods/z_extra_mods/bonemeal/screenshot.png differ diff --git a/mods/z_extra_mods/bonemeal/textures/bonemeal_bone.png b/mods/z_extra_mods/bonemeal/textures/bonemeal_bone.png new file mode 100644 index 00000000..d86e7bea Binary files /dev/null and b/mods/z_extra_mods/bonemeal/textures/bonemeal_bone.png differ diff --git a/mods/z_extra_mods/bonemeal/textures/bonemeal_fertiliser.png b/mods/z_extra_mods/bonemeal/textures/bonemeal_fertiliser.png new file mode 100644 index 00000000..b187c9a2 Binary files /dev/null and b/mods/z_extra_mods/bonemeal/textures/bonemeal_fertiliser.png differ diff --git a/mods/z_extra_mods/bonemeal/textures/bonemeal_item.png b/mods/z_extra_mods/bonemeal/textures/bonemeal_item.png new file mode 100644 index 00000000..f1412630 Binary files /dev/null and b/mods/z_extra_mods/bonemeal/textures/bonemeal_item.png differ diff --git a/mods/z_extra_mods/bonemeal/textures/bonemeal_mulch.png b/mods/z_extra_mods/bonemeal/textures/bonemeal_mulch.png new file mode 100644 index 00000000..df00ac21 Binary files /dev/null and b/mods/z_extra_mods/bonemeal/textures/bonemeal_mulch.png differ diff --git a/mods/z_extra_mods/bonemeal/textures/bonemeal_particle.png b/mods/z_extra_mods/bonemeal/textures/bonemeal_particle.png new file mode 100644 index 00000000..71ef90f8 Binary files /dev/null and b/mods/z_extra_mods/bonemeal/textures/bonemeal_particle.png differ diff --git a/mods/z_extra_mods/esm_map/init.lua b/mods/z_extra_mods/esm_map/init.lua new file mode 100644 index 00000000..81670547 --- /dev/null +++ b/mods/z_extra_mods/esm_map/init.lua @@ -0,0 +1,36 @@ +--esm_map +--sorcerykid made simple spawn map of esm +--20160725 +--LGPLv2.1 +local esm_map = {} + +minetest.register_node("esm_map:map_spawn", { + description = "-=Map of ESM Spawn=- Created by sorcerykid", + drawtype = "nodebox", + tiles = {"2sGp19m.png"}, + inventory_image = {"2sGp19m.png"}, + wield_image = {"2sGp19m.png"}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + node_box = { + type = "wallmounted", + wall_top = {-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5}, + wall_bottom = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, + wall_side = {-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5}, + }, + groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3 }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_craft({ + output = "esm_map:map_spawn", + recipe = { + {"wool:white", "wool:white", "wool:white"}, + {"wool:white", "default:diamond", "wool:white"}, + { "", "group:stick", ""}, + } +}) + + diff --git a/mods/z_extra_mods/esm_map/textures/2sGp19m.png b/mods/z_extra_mods/esm_map/textures/2sGp19m.png new file mode 100644 index 00000000..19e43e34 Binary files /dev/null and b/mods/z_extra_mods/esm_map/textures/2sGp19m.png differ diff --git a/mods/z_extra_mods/esm_map/textures/zombie.lua b/mods/z_extra_mods/esm_map/textures/zombie.lua new file mode 100644 index 00000000..5b2dd4e6 --- /dev/null +++ b/mods/z_extra_mods/esm_map/textures/zombie.lua @@ -0,0 +1,132 @@ +--MCmobs v0.4 +--maikerumine +--made for MC like Survival game +--License for code WTFPL and otherwise stated in readmes + +-- intllib +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +--dofile(minetest.get_modpath("mobs").."/api.lua") + + +--################### +--################### ZOMBIE +--################### + + +local zombie = { + type = "monster", + hp_min = 20, + hp_max = 20, + armor = 90, + collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3}, + visual = "mesh", + mesh = "mobs_mc_zombie.b3d", + textures = { + {"mobs_mc_zombie.png"}, + }, + visual_size = {x=3, y=3}, + makes_footstep_sound = true, + sounds = { + random = "zombie1", + death = "zombiedeath", + damage = "zombiehurt1", + distance = 16, + }, + walk_velocity = .8, + run_velocity = 1.6, + damage = 3, + fear_height = 4, + pathfinding = 1, + jump = true, + --jump_height = 3, + group_attack = true, + drops = { + {name = mobs_mc.items.rotten_flesh, + chance = 1, + min = 0, + max = 2,}, + {name = mobs_mc.items.iron_ingot, + -- approximation to 8.5% + chance = 11, + min = 1, + max = 1,}, + {name = mobs_mc.items.carrot, + -- approximation to 8.5% + chance = 11, + min = 1, + max = 1,}, + {name = mobs_mc.items.potato, + -- approximation to 8.5% + chance = 11, + min = 1, + max = 1,}, + }, + animation = { + speed_normal = 25, speed_run = 50, + stand_start = 40, stand_end = 80, + walk_start = 0, walk_end = 40, + run_start = 0, run_end = 40, + }, + lava_damage = 4, + -- TODO: Burn mob only when in direct sunlight + light_damage = 2, + view_range = 16, + attack_type = "dogfight", +} + +mobs:register_mob("mobs_mc:zombie", zombie) + +-- Baby zombie. +-- A smaller and more dangerous variant of the zombie + +local baby_zombie = table.copy(zombie) +baby_zombie.collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.94, 0.25} +baby_zombie.visual_size = {x=0.75, y=0.75} +baby_zombie.walk_velocity = 1.2 +baby_zombie.run_velocity = 2.4 +baby_zombie.light_damage = 0 + +mobs:register_mob("mobs_mc:baby_zombie", baby_zombie) + +-- Husk. +-- Desert variant of the zombie +local husk = table.copy(zombie) +husk.textures = {{"mobs_mc_husk.png"}} +husk.light_damage = 0 +husk.water_damage = 3 +-- TODO: Husks avoid water + +mobs:register_mob("mobs_mc:husk", husk) + +-- Baby husk. +-- A smaller and more dangerous variant of the husk +local baby_husk = table.copy(husk) +baby_husk.collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.94, 0.25} +baby_husk.visual_size = {x=0.75, y=0.75} +baby_husk.walk_velocity = 1.2 +baby_husk.run_velocity = 2.4 + +mobs:register_mob("mobs_mc:baby_husk", baby_husk) + + +-- Spawning + +mobs:register_spawn("mobs_mc:zombie", mobs_mc.spawn.solid, 7, 0, 6000, 4, 31000) +-- Baby zombie is 20 times less likely than regular zombies +mobs:register_spawn("mobs_mc:baby_zombie", mobs_mc.spawn.solid, 7, 0, 60000, 4, 31000) +mobs:register_spawn("mobs_mc:husk", mobs_mc.spawn.desert, 7, 0, 6500, 4, 31000) +mobs:register_spawn("mobs_mc:baby_husk", mobs_mc.spawn.desert, 7, 0, 65000, 4, 31000) + + +-- Compatibility +mobs:alias_mob("mobs:zombie", "mobs_mc:zombie") + +-- Spawn eggs +mobs:register_egg("mobs_mc:husk", S("Husk"), "mobs_mc_spawn_icon_husk.png", 0) +mobs:register_egg("mobs_mc:zombie", S("Zombie"), "mobs_mc_spawn_icon_zombie.png", 0) + +if minetest.settings:get_bool("log_mods") then + minetest.log("action", "MC Zombie loaded") +end diff --git a/mods/nyancat/README.txt b/mods/z_extra_mods/nyancat/README.txt similarity index 100% rename from mods/nyancat/README.txt rename to mods/z_extra_mods/nyancat/README.txt diff --git a/mods/nyancat/depends.txt b/mods/z_extra_mods/nyancat/depends.txt similarity index 100% rename from mods/nyancat/depends.txt rename to mods/z_extra_mods/nyancat/depends.txt diff --git a/mods/nyancat/init.lua b/mods/z_extra_mods/nyancat/init.lua similarity index 100% rename from mods/nyancat/init.lua rename to mods/z_extra_mods/nyancat/init.lua diff --git a/mods/nyancat/textures/nyancat_back.png b/mods/z_extra_mods/nyancat/textures/nyancat_back.png similarity index 100% rename from mods/nyancat/textures/nyancat_back.png rename to mods/z_extra_mods/nyancat/textures/nyancat_back.png diff --git a/mods/nyancat/textures/nyancat_front.png b/mods/z_extra_mods/nyancat/textures/nyancat_front.png similarity index 100% rename from mods/nyancat/textures/nyancat_front.png rename to mods/z_extra_mods/nyancat/textures/nyancat_front.png diff --git a/mods/nyancat/textures/nyancat_rainbow.png b/mods/z_extra_mods/nyancat/textures/nyancat_rainbow.png similarity index 100% rename from mods/nyancat/textures/nyancat_rainbow.png rename to mods/z_extra_mods/nyancat/textures/nyancat_rainbow.png diff --git a/mods/nyancat/textures/nyancat_side.png b/mods/z_extra_mods/nyancat/textures/nyancat_side.png similarity index 100% rename from mods/nyancat/textures/nyancat_side.png rename to mods/z_extra_mods/nyancat/textures/nyancat_side.png