diff --git a/mods/riesenpilz/rest/ 😿 "b/mods/riesenpilz/\n/ 😿" old mode 100755 new mode 100644 similarity index 100% rename from mods/riesenpilz/rest/ 😿 rename to "mods/riesenpilz/\n/ 😿" diff --git "a/mods/riesenpilz/\n/caverealms_fungi.png" "b/mods/riesenpilz/\n/caverealms_fungi.png" new file mode 100644 index 00000000..27853088 Binary files /dev/null and "b/mods/riesenpilz/\n/caverealms_fungi.png" differ diff --git "a/mods/riesenpilz/\n/caverealms_mycena.png" "b/mods/riesenpilz/\n/caverealms_mycena.png" new file mode 100644 index 00000000..7ab3ad88 Binary files /dev/null and "b/mods/riesenpilz/\n/caverealms_mycena.png" differ diff --git a/mods/riesenpilz/rest/frying.mp3 "b/mods/riesenpilz/\n/frying.mp3" old mode 100755 new mode 100644 similarity index 100% rename from mods/riesenpilz/rest/frying.mp3 rename to "mods/riesenpilz/\n/frying.mp3" diff --git a/mods/riesenpilz/rest/info.txt "b/mods/riesenpilz/\n/info.txt" old mode 100755 new mode 100644 similarity index 100% rename from mods/riesenpilz/rest/info.txt rename to "mods/riesenpilz/\n/info.txt" diff --git "a/mods/riesenpilz/\n/mush45_b.png" "b/mods/riesenpilz/\n/mush45_b.png" new file mode 100644 index 00000000..cd5bca36 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_b.png" differ diff --git "a/mods/riesenpilz/\n/mush45_b0.png" "b/mods/riesenpilz/\n/mush45_b0.png" new file mode 100644 index 00000000..91b7ec99 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_b0.png" differ diff --git "a/mods/riesenpilz/\n/mush45_b1.png" "b/mods/riesenpilz/\n/mush45_b1.png" new file mode 100644 index 00000000..2c5c1355 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_b1.png" differ diff --git "a/mods/riesenpilz/\n/mush45_b2.png" "b/mods/riesenpilz/\n/mush45_b2.png" new file mode 100644 index 00000000..0c266bf1 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_b2.png" differ diff --git "a/mods/riesenpilz/\n/mush45_bm.png" "b/mods/riesenpilz/\n/mush45_bm.png" new file mode 100644 index 00000000..d4e8d2ed Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_bm.png" differ diff --git "a/mods/riesenpilz/\n/mush45_bm2.png" "b/mods/riesenpilz/\n/mush45_bm2.png" new file mode 100644 index 00000000..b1bbbda6 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_bm2.png" differ diff --git "a/mods/riesenpilz/\n/mush45_bm3.png" "b/mods/riesenpilz/\n/mush45_bm3.png" new file mode 100644 index 00000000..0a8596d6 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_bm3.png" differ diff --git "a/mods/riesenpilz/\n/mush45_bm4.png" "b/mods/riesenpilz/\n/mush45_bm4.png" new file mode 100644 index 00000000..830285bb Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_bm4.png" differ diff --git "a/mods/riesenpilz/\n/mush45_r.png" "b/mods/riesenpilz/\n/mush45_r.png" new file mode 100644 index 00000000..96345d9f Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_r.png" differ diff --git "a/mods/riesenpilz/\n/mush45_r0.png" "b/mods/riesenpilz/\n/mush45_r0.png" new file mode 100644 index 00000000..03b39b74 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_r0.png" differ diff --git "a/mods/riesenpilz/\n/mush45_rm.png" "b/mods/riesenpilz/\n/mush45_rm.png" new file mode 100644 index 00000000..bc02d656 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_rm.png" differ diff --git "a/mods/riesenpilz/\n/mush45_rm2.png" "b/mods/riesenpilz/\n/mush45_rm2.png" new file mode 100644 index 00000000..648195ea Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_rm2.png" differ diff --git "a/mods/riesenpilz/\n/mush45_rm3.png" "b/mods/riesenpilz/\n/mush45_rm3.png" new file mode 100644 index 00000000..60f2d279 Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_rm3.png" differ diff --git "a/mods/riesenpilz/\n/mush45_rm4.png" "b/mods/riesenpilz/\n/mush45_rm4.png" new file mode 100644 index 00000000..b222b06b Binary files /dev/null and "b/mods/riesenpilz/\n/mush45_rm4.png" differ diff --git "a/mods/riesenpilz/\n/mushrooms_mushroom_brown.png" "b/mods/riesenpilz/\n/mushrooms_mushroom_brown.png" new file mode 100644 index 00000000..ca5ac55b Binary files /dev/null and "b/mods/riesenpilz/\n/mushrooms_mushroom_brown.png" differ diff --git "a/mods/riesenpilz/\n/mushrooms_mushroom_red.png" "b/mods/riesenpilz/\n/mushrooms_mushroom_red.png" new file mode 100644 index 00000000..c814cde1 Binary files /dev/null and "b/mods/riesenpilz/\n/mushrooms_mushroom_red.png" differ diff --git a/mods/riesenpilz/rest/old_mapgen.lua "b/mods/riesenpilz/\n/old_mapgen.lua" old mode 100755 new mode 100644 similarity index 100% rename from mods/riesenpilz/rest/old_mapgen.lua rename to "mods/riesenpilz/\n/old_mapgen.lua" diff --git "a/mods/riesenpilz/\n/riesenpilz_head.png" "b/mods/riesenpilz/\n/riesenpilz_head.png" new file mode 100644 index 00000000..a5f7b0d6 Binary files /dev/null and "b/mods/riesenpilz/\n/riesenpilz_head.png" differ diff --git a/mods/riesenpilz/rest/smallhead.1.ogg "b/mods/riesenpilz/\n/smallhead.1.ogg" old mode 100755 new mode 100644 similarity index 100% rename from mods/riesenpilz/rest/smallhead.1.ogg rename to "mods/riesenpilz/\n/smallhead.1.ogg" diff --git a/mods/riesenpilz/LICENSE.txt b/mods/riesenpilz/LICENSE.txt index 7acfd3c8..2f906c29 100755 --- a/mods/riesenpilz/LICENSE.txt +++ b/mods/riesenpilz/LICENSE.txt @@ -2,3 +2,5 @@ — glowshroom and lavashroom from bas080's plants mod (WTFPL) — parasol mushroom from a mod called mushrooms (WTFPL) — "45" mushrooms from r01922090's mush45 mod (WTFPL) + +rest also WTFPL diff --git a/mods/riesenpilz/README.md b/mods/riesenpilz/README.md index 8bc39dba..b852403f 100755 --- a/mods/riesenpilz/README.md +++ b/mods/riesenpilz/README.md @@ -1,4 +1,6 @@ -[Mod] riesenpilz [riesenpilz] +[Mod] mushrooms [riesenpilz] + +This mod adds mushrooms to minetest. The growing tool can make them giant. **Depends:** see [depends.txt](https://raw.githubusercontent.com/HybridDog/riesenpilz/master/depends.txt) **License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/riesenpilz/master/LICENSE.txt) @@ -11,4 +13,6 @@ If you got ideas or found bugs, please tell them to me. TODO: — add more giant mushrooms -— finish supporting the mushrooms mod +— finish supporting the mushrooms mod +— add lava suit +— eating must become possible diff --git a/mods/riesenpilz/depends.txt b/mods/riesenpilz/depends.txt index 724b1a69..6687d7c0 100755 --- a/mods/riesenpilz/depends.txt +++ b/mods/riesenpilz/depends.txt @@ -1,3 +1,4 @@ default vector_extras +fence_registration? watershed? diff --git a/mods/riesenpilz/init.lua b/mods/riesenpilz/init.lua index e023575d..118268a6 100755 --- a/mods/riesenpilz/init.lua +++ b/mods/riesenpilz/init.lua @@ -2,11 +2,12 @@ local load_time_start = os.clock() local MAX_SIZE = 3 riesenpilz = {} -dofile(minetest.get_modpath("riesenpilz").."/settings.lua") -dofile(minetest.get_modpath("riesenpilz").."/functions.lua") +local modpath = minetest.get_modpath("riesenpilz").."/" +dofile(modpath.."settings.lua") +dofile(modpath.."functions.lua") ---Growing Functions +-- Growing Functions local function r_area(manip, width, height, pos) local emerged_pos1, emerged_pos2 = manip:read_from_map( @@ -19,13 +20,14 @@ end local function set_vm_data(manip, nodes, pos, t1, name) manip:set_data(nodes) manip:write_to_map() - riesenpilz.inform("a "..name.." mushroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1) + riesenpilz.inform("a giant "..name.." mushroom grew at "..vector.pos_to_string(pos), 3, t1) local t1 = os.clock() manip:update_map() riesenpilz.inform("map updated", 3, t1) end +-- contents become added later local c function riesenpilz.red(pos, nodes, area, w) @@ -143,7 +145,7 @@ local function riesenpilz_minecraft_fliegenpilz(pos) manip:set_param2_data(param2s) manip:write_to_map() manip:update_map() - riesenpilz.inform("a fly agaric grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1) + riesenpilz.inform("a fly agaric grew at "..vector.pos_to_string(pos), 3, t1) end @@ -280,7 +282,7 @@ function riesenpilz.parasol(pos, nodes, area, w, h) nodes[i] = c.stem end - local w = w or math.random(MAX_SIZE+1,MAX_SIZE+2) + local w = w or MAX_SIZE+math.random(2) local bhead1 = w-1 local bhead2 = math.random(1,w-2) @@ -313,7 +315,7 @@ end local function riesenpilz_parasol(pos) local t1 = os.clock() - local w = math.random(MAX_SIZE+1,MAX_SIZE+2) + local w = MAX_SIZE+math.random(2) local h = 6+math.random(MAX_SIZE) local manip = minetest.get_voxel_manip() @@ -326,6 +328,86 @@ local function riesenpilz_parasol(pos) end +function riesenpilz.red45(pos, nodes, area, h1, h2) + local walkspace = h1 or math.random(2,MAX_SIZE) + local toph = h2 or math.random(MAX_SIZE) + local h = walkspace+toph+4 + + -- stem + for i in area:iterp(pos, {x=pos.x, y=pos.y+h, z=pos.z}) do + nodes[i] = c.stem_red + end + + for i = -1,1,2 do + for l = 0, 1 do + if math.random(2) == 1 then + nodes[area:index(pos.x+i, pos.y, pos.z-l*i)] = c.stem_red + if math.random(2) == 1 then + nodes[area:index(pos.x+i, pos.y+1, pos.z-l*i)] = c.stem_red + end + end + if math.random(2) == 1 then + nodes[area:index(pos.x+l*i, pos.y, pos.z+i)] = c.stem_red + if math.random(2) == 1 then + nodes[area:index(pos.x+l*i, pos.y+1, pos.z+i)] = c.stem_red + end + end + nodes[area:index(pos.x+i, pos.y+walkspace+2, pos.z-l*i)] = c.head_red + nodes[area:index(pos.x+l*i, pos.y+walkspace+2, pos.z+i)] = c.head_red + end + nodes[area:index(pos.x, pos.y+walkspace+3, pos.z+i)] = c.head_red + nodes[area:index(pos.x+i, pos.y+walkspace+3, pos.z)] = c.head_red + for j = -1,1,2 do + nodes[area:index(pos.x+j, pos.y+walkspace+1, pos.z+i)] = c.head_red + nodes[area:index(pos.x+j*3, pos.y+walkspace+1, pos.z+i*3)] = c.head_red + for z = 1,2 do + for x = 1,2 do + for y = h-toph, h-1 do + nodes[area:index(pos.x+x*j, pos.y+y, pos.z+z*i)] = c.head_red + end + if z ~= 2 + or x ~= 2 + or math.random(4) ~= 2 then + nodes[area:index(pos.x+x*j, pos.y+h, pos.z+z*i)] = c.head_red + end + local z = z+1 + x = x+1 + nodes[area:index(pos.x+x*j, pos.y+walkspace+2, pos.z+z*i)] = c.head_red + if z ~= 3 + or x ~= 3 + or math.random(2) == 1 then + nodes[area:index(pos.x+x*j, pos.y+walkspace+3, pos.z+z*i)] = c.head_red + end + end + end + end + end + + -- top + for z = -1,1 do + for x = -1,1 do + nodes[area:index(pos.x+x, pos.y+h+1, pos.z+z)] = c.head_red + end + end +end + +local function riesenpilz_red45(pos) + local t1 = os.clock() + + local h1 = math.random(2,MAX_SIZE) + local h2 = math.random(MAX_SIZE) + local h = h1+h2+5 + + local manip = minetest.get_voxel_manip() + local area = r_area(manip, 3, h, pos) + local nodes = manip:get_data() + + riesenpilz.red45(pos, nodes, area, h1, h2) + + set_vm_data(manip, nodes, pos, t1, "red45") +end + + function riesenpilz.apple(pos, nodes, area) local size = 5 local a = size*2 @@ -371,40 +453,45 @@ local function riesenpilz_apple(pos) manip:set_data(nodes) manip:write_to_map() - riesenpilz.inform("an apple grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1) + riesenpilz.inform("an apple grew at "..vector.pos_to_string(pos), 3, t1) manip:update_map() end ---3D apple [3apple] +-- 3D apple [3apple] -minetest.override_item("default:apple", { - drawtype = "nodebox", - tiles = {"3apple_apple_top.png","3apple_apple_bottom.png","3apple_apple.png"}, - node_box = { - type = "fixed", - fixed = { - {-3/16, -7/16, -3/16, 3/16, 1/16, 3/16}, - {-4/16, -6/16, -3/16, 4/16, 0, 3/16}, - {-3/16, -6/16, -4/16, 3/16, 0, 4/16}, - {-1/32, 1/16, -1/32, 1/32, 4/16, 1/32}, - {-1/16, 1.6/16, 0, 1/16, 1.8/16, 1/16}, - {-2/16, 1.4/16, 1/16, 1/16, 1.6/16, 2/16}, - {-2/16, 1.2/16, 2/16, 0, 1.4/16, 3/16}, - {-1.5/16, 1/16, .5/16, 0.5/16, 1.2/16, 2.5/16}, - } - }, -}) +if riesenpilz.change_apple then + minetest.override_item("default:apple", { + drawtype = "nodebox", + tiles = {"3apple_apple_top.png", "3apple_apple_bottom.png", "3apple_apple.png"}, + node_box = { + type = "fixed", + fixed = { + {-3/16, -7/16, -3/16, 3/16, 1/16, 3/16}, + {-4/16, -6/16, -3/16, 4/16, 0, 3/16}, + {-3/16, -6/16, -4/16, 3/16, 0, 4/16}, + {-1/32, 1/16, -1/32, 1/32, 4/16, 1/32}, + {-1/16, 1.6/16, 0, 1/16, 1.8/16, 1/16}, + {-2/16, 1.4/16, 1/16, 1/16, 1.6/16, 2/16}, + {-2/16, 1.2/16, 2/16, 0, 1.4/16, 3/16}, + {-1.5/16, 1/16, .5/16, 0.5/16, 1.2/16, 2.5/16}, + } + }, + }) +end ---Mushroom Nodes +-- Mushroom Nodes -local mushrooms_list = { - ["brown"] = { +local abm_allowed = true +local disallowed_ps = {} + +for name,i in pairs({ + brown = { description = "brown mushroom", box = { {-0.15, -0.2, -0.15, 0.15, -0.1, 0.15}, @@ -420,7 +507,7 @@ local mushrooms_list = { chance = 18, }, }, - ["red"] = { + red = { description = "red mushroom", box = { {-1/16, -8/16, -1/16, 1/16, -6/16, 1/16}, @@ -438,7 +525,7 @@ local mushrooms_list = { chance = 30, }, }, - ["fly_agaric"] = { + fly_agaric = { description = "fly agaric", box = { {-0.05, -0.5, -0.05, 0.05, 1/20, 0.05}, @@ -454,7 +541,7 @@ local mushrooms_list = { chance = 30, }, }, - ["lavashroom"] = { + lavashroom = { description = "Lavashroom", box = { {-1/16, -8/16, -1/16, 1/16, -6/16, 1/16}, @@ -471,16 +558,16 @@ local mushrooms_list = { chance = 60, }, }, - ["glowshroom"] = { + glowshroom = { description = "Glowshroom", box = { - {-1/16, -8/16, -1/16, 1/16, -1/16, 1/16}, - {-2/16, -3/16, -2/16, 2/16, -2/16, 2/16}, - {-3/16, -5/16, -3/16, 3/16, -3/16, 3/16}, + {-1/16, -8/16, -1/16, 1/16, -1/16, 1/16}, + {-2/16, -3/16, -2/16, 2/16, -2/16, 2/16}, + {-3/16, -5/16, -3/16, 3/16, -3/16, 3/16}, {-3/16, -7/16, -3/16, -2/16, -5/16, -2/16}, - {3/16, -7/16, -3/16, 2/16, -5/16, -2/16}, - {-3/16, -7/16, 3/16, -2/16, -5/16, 2/16}, - {3/16, -7/16, 3/16, 2/16, -5/16, 2/16} + {3/16, -7/16, -3/16, 2/16, -5/16, -2/16}, + {-3/16, -7/16, 3/16, -2/16, -5/16, 2/16}, + {3/16, -7/16, 3/16, 2/16, -5/16, 2/16} }, growing = { r = 3, @@ -491,7 +578,7 @@ local mushrooms_list = { chance = 320, }, }, - ["nether_shroom"] = { + nether_shroom = { description = "Nether mushroom", box = { {-1/16, -8/16, -1/16, 1/16, -2/16, 1/16}, @@ -504,7 +591,7 @@ local mushrooms_list = { }, burntime = 6, }, - ["parasol"] = { + parasol = { description = "white parasol mushroom", box = { {-1/16, -8/16, -1/16, 1/16, 0, 1/16}, @@ -522,15 +609,15 @@ local mushrooms_list = { chance = 36, }, }, - ["red45"] = { + red45 = { description = "45 red mushroom", box = { - {-1/16, -0.5, -1/16, 1/16, 1/8, 1/16}, - {-3/16, 1/8, -3/16, 3/16, 1/4, 3/16}, + {-1/16, -0.5, -1/16, 1/16, 1/8, 1/16}, + {-3/16, 1/8, -3/16, 3/16, 1/4, 3/16}, {-5/16, -1/4, -5/16, -1/16, 1/8, -1/16}, - {1/16, -1/4, -5/16, 5/16, 1/8, -1/16}, - {-5/16, -1/4, 1/16, -1/16, 1/8, 5/16}, - {1/16, -1/4, 1/16, 5/16, 1/8, 5/16} + {1/16, -1/4, -5/16, 5/16, 1/8, -1/16}, + {-5/16, -1/4, 1/16, -1/16, 1/8, 5/16}, + {1/16, -1/4, 1/16, 5/16, 1/8, 5/16} }, growing = { r = {min=3, max=4}, @@ -541,14 +628,14 @@ local mushrooms_list = { chance = 180, }, }, - ["brown45"] = { + brown45 = { description = "45 brown mushroom", box = { {-1/16, -0.5, -1/16, 1/16, 1/16, 1/16}, - {-3/8, 1/8, -7/16, 3/8, 1/4, 7/16}, - {-7/16, 1/8, -3/8, 7/16, 1/4, 3/8}, - {-3/8, 1/4, -3/8, 3/8, 5/16, 3/8}, - {-3/8, 1/16, -3/8, 3/8, 1/8, 3/8} + {-3/8, 1/8, -7/16, 3/8, 1/4, 7/16}, + {-7/16, 1/8, -3/8, 7/16, 1/4, 3/8}, + {-3/8, 1/4, -3/8, 3/8, 5/16, 3/8}, + {-3/8, 1/16, -3/8, 3/8, 1/8, 3/8} }, growing = { r = {min=2, max=3}, @@ -559,11 +646,7 @@ local mushrooms_list = { chance = 20, }, }, -} - -local abm_allowed = true -local disallowed_ps = {} -for name,i in pairs(mushrooms_list) do +}) do local burntime = i.burntime or 1 local box = { type = "fixed", @@ -737,10 +820,19 @@ end) ---Mushroom Nodes +-- Big Mushroom Nodes -local pilznode_list = { +local head_sounds = default.node_sound_wood_defaults({ + footstep = {name="riesenpilz_head", gain=0.1}, + place = {name="default_place_node", gain=0.5}, + dig = {name="riesenpilz_head", gain=0.2}, + dug = {name="riesenpilz_stem", gain=0.1} +}) +local add_fence = minetest.register_fence +local node_groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80, bouncy=10} + +for _,i in pairs({ { typ = "stem", description = "white", @@ -750,11 +842,18 @@ local pilznode_list = { typ = "stem", name = "brown", textures = {"stem_top.png", "stem_top.png", "stem_brown.png"}, + fence = false, }, { typ = "stem", name = "blue", textures = {"stem_top.png","stem_top.png","stem_blue.png"}, + fence = false, + }, + { + typ = "stem", + name = "red", + textures = {"stem_red45_top.png","stem_red45_top.png","stem_red45.png"}, }, { name = "lamellas", @@ -784,14 +883,15 @@ local pilznode_list = { typ = "head", name = "brown", textures = {"brown_top.png", "lamellas.png", "brown_top.png"}, - sapling = "brown" + sapling = "brown", }, { typ = "head", name = "brown_full", description = "full brown", textures = "brown_top.png", - sapling = "brown" + sapling = "brown", + fence = false, }, { typ = "head", @@ -825,16 +925,7 @@ local pilznode_list = { textures = {"head_brown_bright.png", "head_white.png", "head_brown_bright.png"}, sapling = "parasol" }, -} - -local head_sounds = default.node_sound_wood_defaults({ - footstep = {name="riesenpilz_head", gain=0.1}, - place = {name="default_place_node", gain=0.5}, - dig = {name="riesenpilz_head", gain=0.2}, - dug = {name="riesenpilz_stem", gain=0.1} -}) - -for _,i in pairs(pilznode_list) do +}) do -- fill missing stuff local textures = i.textures i.description = i.description or i.name @@ -870,10 +961,15 @@ for _,i in pairs(pilznode_list) do minetest.register_node(nodename, { description = desctiption, tiles = textures, - groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80}, + groups = node_groups, drop = drop, sounds = sounds, }) + + if add_fence + and i.fence ~= false then + add_fence({fence_of = nodename}) + end end minetest.register_node("riesenpilz:head_red_side", { @@ -881,7 +977,7 @@ minetest.register_node("riesenpilz:head_red_side", { tiles = {"riesenpilz_head.png", "riesenpilz_lamellas.png", "riesenpilz_head.png", "riesenpilz_head.png", "riesenpilz_head.png", "riesenpilz_lamellas.png"}, paramtype2 = "facedir", - groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80}, + groups = node_groups, drop = {max_items = 1, items = {{items = {"riesenpilz:fly_agaric"},rarity = 20,}, {items = {"riesenpilz:head_red"},rarity = 1,}}}, @@ -892,7 +988,9 @@ minetest.register_node("riesenpilz:head_red_side", { minetest.register_node("riesenpilz:ground", { description = "dirt with rotten grass", - tiles = {"riesenpilz_ground_top.png","default_dirt.png","default_dirt.png^riesenpilz_ground_side.png"}, + tiles = {"riesenpilz_ground_top.png","default_dirt.png", + {name="default_dirt.png^riesenpilz_ground_side.png", tileable_vertical = false} + }, groups = {crumbly=3}, sounds = default.node_sound_dirt_defaults(), drop = 'default:dirt' @@ -923,6 +1021,8 @@ c = { head_binge = minetest.get_content_id("riesenpilz:head_binge"), head_brown_bright = minetest.get_content_id("riesenpilz:head_brown_bright"), + stem_red = minetest.get_content_id("riesenpilz:stem_red"), + red = minetest.get_content_id("default:copperblock"), brown = minetest.get_content_id("default:desert_stone"), tree = minetest.get_content_id("default:tree"), @@ -930,7 +1030,7 @@ c = { ---Growing +-- Growing minetest.register_tool("riesenpilz:growingtool", { @@ -938,31 +1038,61 @@ minetest.register_tool("riesenpilz:growingtool", { inventory_image = "riesenpilz_growingtool.png", }) -minetest.register_on_punchnode(function(pos, node, puncher) - if puncher:get_wielded_item():get_name() == "riesenpilz:growingtool" then - local name = node.name - if name == "riesenpilz:red" then - riesenpilz_hybridpilz(pos) - elseif name == "riesenpilz:fly_agaric" then - riesenpilz_minecraft_fliegenpilz(pos) - elseif name == "riesenpilz:brown" then - riesenpilz_brauner_minecraftpilz(pos) - elseif name == "riesenpilz:lavashroom" then - riesenpilz_lavashroom(pos) - elseif name == "riesenpilz:glowshroom" then - riesenpilz_glowshroom(pos) - elseif name == "riesenpilz:parasol" then - riesenpilz_parasol(pos) - elseif name == "default:apple" then - riesenpilz_apple(pos) - end +minetest.register_on_punchnode(function(pos, node, player) + if player:get_wielded_item():get_name() ~= "riesenpilz:growingtool" + or minetest.is_protected(pos, player:get_player_name()) then + return + end + + local name = node.name + if name == "riesenpilz:red" then + riesenpilz_hybridpilz(pos) + elseif name == "riesenpilz:fly_agaric" then + riesenpilz_minecraft_fliegenpilz(pos) + elseif name == "riesenpilz:brown" then + riesenpilz_brauner_minecraftpilz(pos) + elseif name == "riesenpilz:lavashroom" then + riesenpilz_lavashroom(pos) + elseif name == "riesenpilz:glowshroom" then + riesenpilz_glowshroom(pos) + elseif name == "riesenpilz:parasol" then + riesenpilz_parasol(pos) + elseif name == "riesenpilz:red45" then + riesenpilz_red45(pos) + elseif name == "default:apple" then + riesenpilz_apple(pos) end end) +-- Food + + +minetest.register_craftitem("riesenpilz:mush45_meal", { + description = "Mushroom Meal", + inventory_image = "riesenpilz_mush45_meal.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + output = "riesenpilz:mush45_meal 4", + recipe = { + {"riesenpilz:brown45", "riesenpilz:red45"}, + {"riesenpilz:red45", "riesenpilz:brown45"}, + } +}) + + + if riesenpilz.enable_mapgen then - dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua") + dofile(modpath.."mapgen.lua") end -riesenpilz.inform("loaded", 1, load_time_start) +local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100 +local msg = "[riesenpilz] loaded after ca. "..time +if time > 0.05 then + minetest.log("warning", msg) +else + minetest.log("info", msg) +end diff --git a/mods/riesenpilz/mapgen.lua b/mods/riesenpilz/mapgen.lua index 21434087..9a638535 100755 --- a/mods/riesenpilz/mapgen.lua +++ b/mods/riesenpilz/mapgen.lua @@ -1,3 +1,5 @@ +local minetest = minetest --Should make things a bit faster. + local c local function define_contents() c = { @@ -74,15 +76,25 @@ local function say_info(info) minetest.chat_send_all(info) end -local riesenpilz_rarity = riesenpilz.mapgen_rarity -local riesenpilz_size = riesenpilz.mapgen_size -local smooth_trans_size = riesenpilz.smooth_trans_size +-- perlin noise "hills" are not peaks but looking like sinus curve +local function upper_rarity(rarity) + return math.sign(rarity)*math.sin(math.abs(rarity)*math.pi/2) +end -local nosmooth_rarity = 1-riesenpilz_rarity/50 -local perlin_scale = riesenpilz_size*100/riesenpilz_rarity -local smooth_rarity_max = nosmooth_rarity+smooth_trans_size*2/perlin_scale -local smooth_rarity_min = nosmooth_rarity-smooth_trans_size/perlin_scale -local smooth_rarity_dif = smooth_rarity_max-smooth_rarity_min +local rarity = riesenpilz.mapgen_rarity +local riesenpilz_size = riesenpilz.mapgen_size + +local nosmooth_rarity = 1-rarity/50 +local perlin_scale = riesenpilz_size*100/rarity +local smooth_rarity_max, smooth_rarity_min, smooth_rarity_dif +local smooth = riesenpilz.smooth +if smooth then + local smooth_trans_size = riesenpilz.smooth_trans_size + smooth_rarity_max = upper_rarity(nosmooth_rarity+smooth_trans_size*2/perlin_scale) + smooth_rarity_min = upper_rarity(nosmooth_rarity-smooth_trans_size/perlin_scale) + smooth_rarity_dif = smooth_rarity_max-smooth_rarity_min +end +nosmooth_rarity = upper_rarity(nosmooth_rarity) --local USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:cactus","default:papyrus"} @@ -94,8 +106,7 @@ minetest.register_on_generated(function(minp, maxp, seed) end local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal - local env = minetest.env --Should make things a bit faster. - local perlin1 = env:get_perlin(51,3, 0.5, perlin_scale) --Get map specific perlin + local perlin1 = minetest.get_perlin(51,3, 0.5, perlin_scale) --Get map specific perlin if not riesenpilz.always_generate then local biome_allowed @@ -115,23 +126,6 @@ minetest.register_on_generated(function(minp, maxp, seed) end end - --[[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53) - and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53) - and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) then - - if not riesenpilz.always_generate - and not ( perlin1:get2d( {x=x0, y=z0} ) > nosmooth_rarity ) --top left - and not ( perlin1:get2d( { x = x0 + ( (x1-x0)/2), y=z0 } ) > nosmooth_rarity )--top middle - and not (perlin1:get2d({x=x1, y=z1}) > nosmooth_rarity) --bottom right - and not (perlin1:get2d({x=x1, y=z0+((z1-z0)/2)}) > nosmooth_rarity) --right middle - and not (perlin1:get2d({x=x0, y=z1}) > nosmooth_rarity) --bottom left - and not (perlin1:get2d({x=x1, y=z0}) > nosmooth_rarity) --top right - and not (perlin1:get2d({x=x0+((x1-x0)/2), y=z1}) > nosmooth_rarity) --left middle - and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > nosmooth_rarity) --middle - and not (perlin1:get2d({x=x0, y=z1+((z1-z0)/2)}) > nosmooth_rarity) then --bottom middle - return - end]] - local t1 = os.clock() riesenpilz.inform("tries to generate a giant mushroom biome at: x=["..minp.x.."; "..maxp.x.."]; y=["..minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]", 2) @@ -145,6 +139,9 @@ minetest.register_on_generated(function(minp, maxp, seed) local tab = {} pr = PseudoRandom(seed+68) + local heightmap = minetest.get_mapgen_object("heightmap") + local hmi = 1 + local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") data = vm:get_data() area = VoxelArea:new{MinEdge=emin, MaxEdge=emax} @@ -158,14 +155,6 @@ minetest.register_on_generated(function(minp, maxp, seed) end end end - --[[remove usual stuff - local trees = env:find_nodes_in_area(minp, maxp, USUAL_STUFF) - for i,v in pairs(trees) do - env:remove_node(v) - end]] - - - local smooth = riesenpilz.smooth for j=0,divs do for i=0,divs do @@ -185,31 +174,43 @@ minetest.register_on_generated(function(minp, maxp, seed) ) then in_biome = true end - elseif (not smooth) - and test > nosmooth_rarity then + elseif test > nosmooth_rarity then in_biome = true end if in_biome then - local ground_y = nil --Definition des Bodens: --- for y=maxp.y,0,-1 do - for y=maxp.y,1,-1 do - local p_pos = area:index(x, y, z) - local d_p_pos = data[p_pos] - for _,nam in pairs(c.USUAL_STUFF) do --remove usual stuff - if d_p_pos == nam then - data[p_pos] = c.air - p_pos = nil - break - end - end - if p_pos --else search ground_y - and find_ground(d_p_pos, c.GROUND) then - ground_y = y + local ymin = math.max(heightmap[hmi]-5, minp.y) -- -1 + + -- skip the air part + local ground + for y = math.min(heightmap[hmi]+20, maxp.y),ymin,-1 do + if data[area:index(x, y, z)] ~= c.air then + ground = y break end end + + local ground_y + if ground then + for y = ground,ymin,-1 do + local p_pos = area:index(x, y, z) + local d_p_pos = data[p_pos] + for _,nam in pairs(c.USUAL_STUFF) do --remove usual stuff + if d_p_pos == nam then + data[p_pos] = c.air + p_pos = nil + break + end + end + if p_pos --else search ground_y + and find_ground(d_p_pos, c.GROUND) then + ground_y = y + break + end + end + end + if ground_y then data[area:index(x, ground_y, z)] = c.ground for i = -1,-5,-1 do @@ -220,6 +221,7 @@ minetest.register_on_generated(function(minp, maxp, seed) break end end + local bigtype local boden = {x=x,y=ground_y+1,z=z} if pr:next(1,15) == 1 then data[area:index(x, ground_y+1, z)] = c.dry_shrub @@ -231,28 +233,32 @@ minetest.register_on_generated(function(minp, maxp, seed) riesenpilz_circle(c.riesenpilz_red, boden, pr:next(4,5), 3) elseif pr:next(1,100) == 1 then riesenpilz_circle(c.riesenpilz_fly_agaric, boden, 4, 3) + elseif pr:next(1,340) == 10 then + bigtype = 2 + elseif pr:next(1,380) == 1 then + bigtype = 1 + elseif pr:next(1,390) == 20 then + bigtype = 3 + elseif pr:next(1,800) == 7 then + bigtype = 5 elseif pr:next(1,4000) == 1 then riesenpilz_circle(c.riesenpilz_lavashroom, boden, pr:next(5,6), 3) elseif pr:next(1,5000) == 1 then riesenpilz_circle(c.riesenpilz_glowshroom, boden, 3, 3) - elseif pr:next(1,380) == 1 then - tab[num] = {1, boden} - num = num+1 - elseif pr:next(1,340) == 10 then - tab[num] = {2, boden} - num = num+1 - elseif pr:next(1,390) == 20 then - tab[num] = {3, boden} - num = num+1 - elseif pr:next(1,6000) == 2 and pr:next(1,200) == 15 then - tab[num] = {4, boden} - num = num+1 - elseif pr:next(1,800) == 7 then - tab[num] = {5, boden} + elseif pr:next(1,6000) == 2 then + if pr:next(1,200) == 15 then + bigtype = 4 + elseif pr:next(1,2000) == 54 then + bigtype = 6 + end + end + if bigtype then + tab[num] = {bigtype, boden} num = num+1 end end end + hmi = hmi+1 end end riesenpilz.inform("ground finished", 2, t1) @@ -276,6 +282,8 @@ minetest.register_on_generated(function(minp, maxp, seed) riesenpilz.lavashroom(p, data, area) elseif m == 5 then riesenpilz.parasol(p, data, area) + elseif m == 6 then + riesenpilz.red45(p, data, area) end end riesenpilz.inform("giant shrooms generated", 2, t2) @@ -289,49 +297,9 @@ minetest.register_on_generated(function(minp, maxp, seed) vm:set_lighting({day=0, night=0}) vm:calc_lighting() vm:write_to_map() + data = nil + area = nil riesenpilz.inform("data set", 2, t2) riesenpilz.inform("done", 1, t1) end) ---[[ if maxp.y < -10 then - local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal - local env = minetest.env --Should make things a bit faster. - local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin - - --[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53) - and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53) - and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) then] - if not ( perlin1:get2d( {x=x0, y=z0} ) > 0.53 ) --top left - and not ( perlin1:get2d( { x = x0 + ( (x1-x0)/2), y=z0 } ) > 0.53 )--top middle - and not (perlin1:get2d({x=x1, y=z1}) > 0.53) --bottom right - and not (perlin1:get2d({x=x1, y=z0+((z1-z0)/2)}) > 0.53) --right middle - and not (perlin1:get2d({x=x0, y=z1}) > 0.53) --bottom left - and not (perlin1:get2d({x=x1, y=z0}) > 0.53) --top right - and not (perlin1:get2d({x=x0+((x1-x0)/2), y=z1}) > 0.53) --left middle - and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) --middle - and not (perlin1:get2d({x=x0, y=z1+((z1-z0)/2)}) > 0.53) then --bottom middle - print("abortriesenpilz") - return - end - local divs = (maxp.x-minp.x); - local pr = PseudoRandom(seed+68) - - for j=0,divs do - for i=0,divs do - local x,z = x0+i,z0+j - - for y=minp.y,maxp.y,1 do - local pos = {x=x, y=y, z=z} - - if env:get_node(pos).name == "air" - and env:get_node({x=x, y=y-1, z=z}).name == "default:stone" - and pr:next(1,40) == 33 - and env:find_node_near(pos, 4, "group:igniter") - and not env:find_node_near(pos, 3, "group:igniter") then - env:add_node(pos, {name="riesenpilz:lavashroom"}) - end - end - end - end - end -end)]] diff --git a/mods/riesenpilz/rest/caverealms_fungi.png b/mods/riesenpilz/rest/caverealms_fungi.png deleted file mode 100755 index fde8cbfd..00000000 Binary files a/mods/riesenpilz/rest/caverealms_fungi.png and /dev/null differ diff --git a/mods/riesenpilz/rest/caverealms_mycena.png b/mods/riesenpilz/rest/caverealms_mycena.png deleted file mode 100755 index ad755f03..00000000 Binary files a/mods/riesenpilz/rest/caverealms_mycena.png and /dev/null differ diff --git a/mods/riesenpilz/rest/cutting.ogg b/mods/riesenpilz/rest/cutting.ogg deleted file mode 100755 index 1f328a49..00000000 Binary files a/mods/riesenpilz/rest/cutting.ogg and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_b.png b/mods/riesenpilz/rest/mush45_b.png deleted file mode 100755 index c8deea06..00000000 Binary files a/mods/riesenpilz/rest/mush45_b.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_b0.png b/mods/riesenpilz/rest/mush45_b0.png deleted file mode 100755 index 156f3bae..00000000 Binary files a/mods/riesenpilz/rest/mush45_b0.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_b1.png b/mods/riesenpilz/rest/mush45_b1.png deleted file mode 100755 index fa9dc5e1..00000000 Binary files a/mods/riesenpilz/rest/mush45_b1.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_b2.png b/mods/riesenpilz/rest/mush45_b2.png deleted file mode 100755 index 69d17835..00000000 Binary files a/mods/riesenpilz/rest/mush45_b2.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_bm.png b/mods/riesenpilz/rest/mush45_bm.png deleted file mode 100755 index 1b2f9bf5..00000000 Binary files a/mods/riesenpilz/rest/mush45_bm.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_bm2.png b/mods/riesenpilz/rest/mush45_bm2.png deleted file mode 100755 index e8f9336b..00000000 Binary files a/mods/riesenpilz/rest/mush45_bm2.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_bm3.png b/mods/riesenpilz/rest/mush45_bm3.png deleted file mode 100755 index 26184b02..00000000 Binary files a/mods/riesenpilz/rest/mush45_bm3.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_bm4.png b/mods/riesenpilz/rest/mush45_bm4.png deleted file mode 100755 index 7872bec5..00000000 Binary files a/mods/riesenpilz/rest/mush45_bm4.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_r.png b/mods/riesenpilz/rest/mush45_r.png deleted file mode 100755 index f01a7210..00000000 Binary files a/mods/riesenpilz/rest/mush45_r.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_r0.png b/mods/riesenpilz/rest/mush45_r0.png deleted file mode 100755 index e4f9ba80..00000000 Binary files a/mods/riesenpilz/rest/mush45_r0.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_r1.png b/mods/riesenpilz/rest/mush45_r1.png deleted file mode 100755 index 158ae725..00000000 Binary files a/mods/riesenpilz/rest/mush45_r1.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_r2.png b/mods/riesenpilz/rest/mush45_r2.png deleted file mode 100755 index 9c039fca..00000000 Binary files a/mods/riesenpilz/rest/mush45_r2.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_rm.png b/mods/riesenpilz/rest/mush45_rm.png deleted file mode 100755 index e590b587..00000000 Binary files a/mods/riesenpilz/rest/mush45_rm.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_rm2.png b/mods/riesenpilz/rest/mush45_rm2.png deleted file mode 100755 index 7ddbc4a5..00000000 Binary files a/mods/riesenpilz/rest/mush45_rm2.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_rm3.png b/mods/riesenpilz/rest/mush45_rm3.png deleted file mode 100755 index ca86e356..00000000 Binary files a/mods/riesenpilz/rest/mush45_rm3.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mush45_rm4.png b/mods/riesenpilz/rest/mush45_rm4.png deleted file mode 100755 index c6873dd4..00000000 Binary files a/mods/riesenpilz/rest/mush45_rm4.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mushrooms_mushroom_brown.png b/mods/riesenpilz/rest/mushrooms_mushroom_brown.png deleted file mode 100755 index 1c3953c7..00000000 Binary files a/mods/riesenpilz/rest/mushrooms_mushroom_brown.png and /dev/null differ diff --git a/mods/riesenpilz/rest/mushrooms_mushroom_red.png b/mods/riesenpilz/rest/mushrooms_mushroom_red.png deleted file mode 100755 index 8bcc663a..00000000 Binary files a/mods/riesenpilz/rest/mushrooms_mushroom_red.png and /dev/null differ diff --git a/mods/riesenpilz/rest/riesenpilz_head.png b/mods/riesenpilz/rest/riesenpilz_head.png deleted file mode 100755 index 5ecdc36c..00000000 Binary files a/mods/riesenpilz/rest/riesenpilz_head.png and /dev/null differ diff --git a/mods/riesenpilz/settings.lua b/mods/riesenpilz/settings.lua index 1c2494fc..6cd0e45b 100755 --- a/mods/riesenpilz/settings.lua +++ b/mods/riesenpilz/settings.lua @@ -21,7 +21,10 @@ riesenpilz.smooth_trans_size = 2 riesenpilz.info = true --informs the players too -riesenpilz.inform_all = minetest.is_singleplayer() +riesenpilz.inform_all = false--minetest.is_singleplayer() --1: 2: 3: riesenpilz.max_spam = 2 + +--3d apple +riesenpilz.change_apple = true diff --git a/mods/riesenpilz/textures/riesenpilz_brown_side.png b/mods/riesenpilz/textures/riesenpilz_brown_side.png old mode 100755 new mode 100644 index 167d124b..46ed181b Binary files a/mods/riesenpilz/textures/riesenpilz_brown_side.png and b/mods/riesenpilz/textures/riesenpilz_brown_side.png differ diff --git a/mods/riesenpilz/textures/riesenpilz_brown_top.png b/mods/riesenpilz/textures/riesenpilz_brown_top.png old mode 100755 new mode 100644 index a567fb6c..1b4ae44b Binary files a/mods/riesenpilz/textures/riesenpilz_brown_top.png and b/mods/riesenpilz/textures/riesenpilz_brown_top.png differ diff --git a/mods/riesenpilz/textures/riesenpilz_red_top.png b/mods/riesenpilz/textures/riesenpilz_red_top.png old mode 100755 new mode 100644 index 385340fd..c0eb0638 Binary files a/mods/riesenpilz/textures/riesenpilz_red_top.png and b/mods/riesenpilz/textures/riesenpilz_red_top.png differ diff --git a/mods/riesenpilz/textures/riesenpilz_stem_red45.png b/mods/riesenpilz/textures/riesenpilz_stem_red45.png new file mode 100644 index 00000000..c05ba793 Binary files /dev/null and b/mods/riesenpilz/textures/riesenpilz_stem_red45.png differ diff --git a/mods/riesenpilz/textures/riesenpilz_stem_red45_top.png b/mods/riesenpilz/textures/riesenpilz_stem_red45_top.png new file mode 100644 index 00000000..a4b2a35c Binary files /dev/null and b/mods/riesenpilz/textures/riesenpilz_stem_red45_top.png differ