From a8bafd455e3074f8e9d56fbd3a64e77c8bd3f851 Mon Sep 17 00:00:00 2001 From: Mossmanikin Date: Fri, 1 Nov 2013 21:42:30 +0100 Subject: [PATCH] Mole hills --- molehills/depends.txt | 2 + molehills/init.lua | 110 ++++++++++++++++++ molehills/molehills_settings.txt | 6 + molehills/textures/molehills_dirt.png | Bin 0 -> 806 bytes molehills/textures/molehills_side.png | Bin 0 -> 395 bytes .../textures/old & unused/molehill_side.png | Bin 0 -> 214 bytes .../textures/old & unused/molehill_top.png | Bin 0 -> 281 bytes 7 files changed, 118 insertions(+) create mode 100644 molehills/depends.txt create mode 100644 molehills/init.lua create mode 100644 molehills/molehills_settings.txt create mode 100644 molehills/textures/molehills_dirt.png create mode 100644 molehills/textures/molehills_side.png create mode 100644 molehills/textures/old & unused/molehill_side.png create mode 100644 molehills/textures/old & unused/molehill_top.png 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 0000000000000000000000000000000000000000..79ffa8557c0c3d157e40331b96b57fb92493bdde GIT binary patch literal 806 zcmV+>1KIqEP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qRNAp5A0007&NklzMb|=Lm+`zB;VN=bI^Ks@&7;>W<1(-jG>Vw$r_m~9upari9(CcCGl<$XRI&%K zaw&|w8j`3j&w*RRuR*nh23fl>r)Cz-%*=!k4=h`IPq~2 z<7GR?ENIC4ZoMd=hAvRa9KtnoDhX|wcS*3?RJ@Octwn;dCwS8|v}o_tJD`u=b= z5O8Ys^KmIOsZlkThQaWV8w0~8t-hib!>+AG{3r?J2FwE|Y7Ml2t_)3rCX7ZQC0Uk(nx_KJAJ5rDko);Sz>OqqfxfbMnD_B#cTG!`uP+$gU=Fw$ kY4A=^$a+2{cY@me1NKOysQ5~JGynhq07*qoM6N<$f?57<%m4rY literal 0 HcmV?d00001 diff --git a/molehills/textures/molehills_side.png b/molehills/textures/molehills_side.png new file mode 100644 index 0000000000000000000000000000000000000000..c82e72a9b8e3d16032afb54721e07016e465619c GIT binary patch literal 395 zcmV;60d)R}P)N2bPDNB8 zb~7$DE-^7j^FlWO009R{L_t(IPwkRRPr^VHg}ZfSG#WsGl(aYvQ~R(j4Q-izQ~RMfluI_aHmKICiBeq&jEr4F;hNTfau?Q@O#gYr-cDJOmUkLvII>fKgq|Kvk}uE{-7<{>eZ5l@b&J|Nal;J<@Wcp+)F$y{pBc5|ysWHUEqgTuq|Kvf-{E{-7<{%a>)VeB_ z#YMeY%}<2(y;Xd3yhCy~|3#$_M=S#Fyt{2$I{64oLUdwmXct4ggoL%t@3MxwGt?jW zFl>!3F)W-L^n|rxw&c54{0FQgGc@BeA6)v;-kJXQQ{kD4m2oBlYj%D}m9qY5$M|XW WTANL?X37BF#Ng@b=d#Wzp$Pyv24++M literal 0 HcmV?d00001