diff --git a/molehills/depends.txt b/molehills/depends.txt new file mode 100644 index 0000000..bde0bdf --- /dev/null +++ b/molehills/depends.txt @@ -0,0 +1,2 @@ +default +plants_lib \ No newline at end of file diff --git a/molehills/init.lua b/molehills/init.lua new file mode 100644 index 0000000..c80e7cc --- /dev/null +++ b/molehills/init.lua @@ -0,0 +1,110 @@ +----------------------------------------------------------------------------------------------- +local title = "Mole Hills" +local version = "0.0.3" +local mname = "molehills" +----------------------------------------------------------------------------------------------- +-- Idea by Sokomine +-- Code & textures by Mossmanikin + +abstract_molehills = {} + +dofile(minetest.get_modpath("molehills").."/molehills_settings.txt") + +----------------------------------------------------------------------------------------------- +-- NoDe +----------------------------------------------------------------------------------------------- +minetest.register_node("molehills:molehill",{ + drawtype = "nodebox", + description = "Mole Hill", + inventory_image = "molehills_side.png", + tiles = { + "molehills_dirt.png",--"molehill_top.png", + "molehills_dirt.png",--"molehill_top.png", + "molehills_dirt.png"--"molehill_side.png" + }, + paramtype = "light", + node_box = { + type = "fixed", + fixed = { +-- { left, bottom, front, right, top, back} + {-2/16, -3/16, -1/16, 2/16, -2/16, 1/16}, + {-1/16, -3/16, -2/16, 1/16, -2/16, 2/16}, +-- { left, bottom, front, right, top, back} + {-4/16, -4/16, -2/16, 4/16, -3/16, 2/16}, + {-2/16, -4/16, -4/16, 2/16, -3/16, 4/16}, + {-3/16, -4/16, -3/16, 3/16, -3/16, 3/16}, +-- { left, bottom, front, right, top, back} + {-5/16, -5/16, -2/16, 5/16, -4/16, 2/16}, + {-2/16, -5/16, -5/16, 2/16, -4/16, 5/16}, + {-4/16, -5/16, -4/16, 4/16, -4/16, 4/16}, +-- { left, bottom, front, right, top, back} + {-6/16, -6/16, -2/16, 6/16, -5/16, 2/16}, + {-2/16, -6/16, -6/16, 2/16, -5/16, 6/16}, + {-5/16, -6/16, -4/16, 5/16, -5/16, 4/16}, + {-4/16, -6/16, -5/16, 4/16, -5/16, 5/16}, +-- { left, bottom, front, right, top, back} + {-7/16, -7/16, -3/16, 7/16, -6/16, 3/16}, + {-3/16, -7/16, -7/16, 3/16, -6/16, 7/16}, + {-6/16, -7/16, -4/16, 6/16, -6/16, 4/16}, + {-4/16, -7/16, -6/16, 4/16, -6/16, 6/16}, + {-5/16, -7/16, -5/16, 5/16, -6/16, 5/16}, +-- { left, bottom, front, right, top, back} +--[[b]] {-1/2 , -1/2 , -3/16, 1/2 , -7/16, 3/16}, -- left to right +--[[o]] {-3/16, -1/2 , -1/2 , 3/16, -7/16, 1/2 }, -- front to back +--[[t]] {-7/16, -1/2 , -5/16, 7/16, -7/16, 5/16}, +--[[t]] {-5/16, -1/2 , -7/16, 5/16, -7/16, 7/16}, +--[[m]] {-6/16, -1/2 , -6/16, 6/16, -7/16, 6/16}, -- mid + }, + }, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 2/16, 1/2}, + }, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- CRaFTiNG +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- molehills --> dirt + output = "default:dirt", + recipe = { + {"molehills:molehill","molehills:molehill"}, + {"molehills:molehill","molehills:molehill"}, + } +}) + +----------------------------------------------------------------------------------------------- +-- GeNeRaTiNG +----------------------------------------------------------------------------------------------- +abstract_molehills.place_molehill = function(pos) + local right_here = {x=pos.x , y=pos.y+1, z=pos.z } + if minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }).name ~= "air" + and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }).name ~= "air" + and minetest.get_node({x=pos.x , y=pos.y, z=pos.z+1}).name ~= "air" + and minetest.get_node({x=pos.x , y=pos.y, z=pos.z-1}).name ~= "air" + and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1}).name ~= "air" + and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1}).name ~= "air" + and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1}).name ~= "air" + and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1}).name ~= "air" then + minetest.add_node(right_here, {name="molehills:molehill"}) + end +end + +plantslib:register_generate_plant({ + surface = {"default:dirt_with_grass"}, + max_count = Molehills_Max_Count, + rarity = Molehills_Rarity, + min_elevation = 1, + max_elevation = 40, + avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"--[[,"air"]]}, + avoid_radius = 4, + plantlife_limit = -0.3, + }, + "abstract_molehills.place_molehill" +) + +----------------------------------------------------------------------------------------------- +print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...") +----------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/molehills/molehills_settings.txt b/molehills/molehills_settings.txt new file mode 100644 index 0000000..2079574 --- /dev/null +++ b/molehills/molehills_settings.txt @@ -0,0 +1,6 @@ +-- Settings for generation of stuff (at map-generation time) + +Molehills_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes + +Molehills_Rarity = 87 -- larger values make molehills more rare (100 means chance of 0 %) + diff --git a/molehills/textures/molehills_dirt.png b/molehills/textures/molehills_dirt.png new file mode 100644 index 0000000..79ffa85 Binary files /dev/null and b/molehills/textures/molehills_dirt.png differ diff --git a/molehills/textures/molehills_side.png b/molehills/textures/molehills_side.png new file mode 100644 index 0000000..c82e72a Binary files /dev/null and b/molehills/textures/molehills_side.png differ diff --git a/molehills/textures/old & unused/molehill_side.png b/molehills/textures/old & unused/molehill_side.png new file mode 100644 index 0000000..dd7fed9 Binary files /dev/null and b/molehills/textures/old & unused/molehill_side.png differ diff --git a/molehills/textures/old & unused/molehill_top.png b/molehills/textures/old & unused/molehill_top.png new file mode 100644 index 0000000..fa6a5dd Binary files /dev/null and b/molehills/textures/old & unused/molehill_top.png differ