From 9ff8f8038ef30c7a62a7b95e09c3254df9862c40 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Mon, 18 Mar 2013 22:27:15 +0100 Subject: [PATCH] Add grass --- mods/default/README.txt | 3 +- mods/default/init.lua | 100 ++++++++++++++++++++++ mods/default/mapgen.lua | 8 +- mods/default/textures/default_grass_1.png | Bin 0 -> 206 bytes mods/default/textures/default_grass_2.png | Bin 0 -> 252 bytes mods/default/textures/default_grass_3.png | Bin 0 -> 282 bytes mods/default/textures/default_grass_4.png | Bin 0 -> 303 bytes mods/default/textures/default_grass_5.png | Bin 0 -> 326 bytes 8 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 mods/default/textures/default_grass_1.png create mode 100644 mods/default/textures/default_grass_2.png create mode 100644 mods/default/textures/default_grass_3.png create mode 100644 mods/default/textures/default_grass_4.png create mode 100644 mods/default/textures/default_grass_5.png diff --git a/mods/default/README.txt b/mods/default/README.txt index ce82282b..4520dda5 100644 --- a/mods/default/README.txt +++ b/mods/default/README.txt @@ -71,11 +71,12 @@ RealBadAngel's animated water (WTFPL): default_water_source_animated.png default_water_flowing_animated.png -VanessaE: +VanessaE (WTFPL): default_nc_back.png default_nc_front.png default_nc_rb.png default_nc_side.png + default_grass_*.png Calinou's improved default textures (CC BY-SA): default_brick.png diff --git a/mods/default/init.lua b/mods/default/init.lua index 02369df2..cb56181a 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -697,6 +697,12 @@ minetest.register_craft({ burntime = 10, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:grass_1", + burntime = 2, +}) + -- -- Node definitions -- @@ -983,6 +989,10 @@ minetest.register_node("default:junglegrass", { walkable = false, groups = {snappy=3,flammable=2,attached_node=1}, sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, }) minetest.register_node("default:leaves", { @@ -1753,6 +1763,96 @@ minetest.register_node("default:dry_shrub", { }, }) +minetest.register_node("default:grass_1", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_1.png"}, + -- use a bigger inventory image + inventory_image = "default_grass_3.png", + wield_image = "default_grass_3.png", + paramtype = "light", + walkable = false, + groups = {snappy=3,flammable=3,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, + on_place = function(itemstack, placer, pointed_thing) + -- place a random grass node + local stack = ItemStack("default:grass_"..math.random(1,5)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count())) + end, +}) + +minetest.register_node("default:grass_2", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_2.png"}, + inventory_image = "default_grass_2.png", + wield_image = "default_grass_2.png", + paramtype = "light", + walkable = false, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, +}) +minetest.register_node("default:grass_3", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_3.png"}, + inventory_image = "default_grass_3.png", + wield_image = "default_grass_3.png", + paramtype = "light", + walkable = false, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, +}) + +minetest.register_node("default:grass_4", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_4.png"}, + inventory_image = "default_grass_4.png", + wield_image = "default_grass_4.png", + paramtype = "light", + walkable = false, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, +}) + +minetest.register_node("default:grass_5", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_5.png"}, + inventory_image = "default_grass_5.png", + wield_image = "default_grass_5.png", + paramtype = "light", + walkable = false, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, +}) + -- -- Crafting items -- diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua index 8955caeb..a5e61585 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -262,7 +262,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local x1 = minp.x + math.floor((divx+1)*divlen) local z1 = minp.z + math.floor((divz+1)*divlen) -- Determine grass amount from perlin noise - local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 0) + local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9) -- Find random positions for grass based on this random local pr = PseudoRandom(seed+1) for i=0,grass_amount do @@ -284,13 +284,13 @@ minetest.register_on_generated(function(minp, maxp, seed) if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].buildable_to then nn = minetest.env:get_node({x=x,y=ground_y,z=z}).name - -- If desert sand, make dry shrub + -- If desert sand, add dry shrub if nn == "default:desert_sand" then minetest.env:set_node(p,{name="default:dry_shrub"}) - -- If grass, make junglegrass + -- If dirt with grass, add grass elseif nn == "default:dirt_with_grass" then - minetest.env:set_node(p,{name="default:junglegrass"}) + minetest.env:set_node(p,{name="default:grass_"..pr:next(1, 5)}) end end end diff --git a/mods/default/textures/default_grass_1.png b/mods/default/textures/default_grass_1.png new file mode 100644 index 0000000000000000000000000000000000000000..b03df7c444e479fe1ba6fb901fc4eb599baecea6 GIT binary patch literal 206 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv3GfMV1=98jG7gEdj>)oaSqkns z3Ld$NUWJN2B}%@f%6{d_{uL@SD!2a!s$(n(@(X5gcy=QV$l)yTh%9Dc;1&j9Muu5) zB!GhKC7!;n?01=kM8)_$`8qv-LI$2Ljv*Y^lM@z*CnP3hBqXo~`S9@c@x0;b;bY|G r(Ry>nhli2#9M2t{m^nPW+!hRuvsuC%z4HzO^)h(6`njxgN@xNA(fTqq literal 0 HcmV?d00001 diff --git a/mods/default/textures/default_grass_2.png b/mods/default/textures/default_grass_2.png new file mode 100644 index 0000000000000000000000000000000000000000..e3dfd278258f44fe6419b075cbf460ec0a553ec6 GIT binary patch literal 252 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!aez;Vs{;dreS(ZbqO4=GtW%1d zOS-&kro3C0f_sjFN3No0zM@y5qIZ#!Pl=Lmsj^?WvVVn&LewcnpmxTRAirP+hi5m^ zfE>;OkH}&M25w;xW@MN(M*=9wUgGKN%6^wwNK{PZaJIt|ppd_(i(`ny<+HtxLJbBS z%-gq!WwZYMpUrywpJN-dXBpF*rxAyCQV@PXfJl)r@LKSE;OkH}&M25w;xW@MN(M*=9wUgGKN%6^wwNK{O6?=2fipir)-i(`ny<*mI3nGPFp zIK^j2oi#f1?|=4k+jn;Q8XO1ar~MZaUUcyQ_m%1LTXikEB=2lVDYy9)G54XT(C)XD z6OYZ=8daov`$nTs<=$r+!R2?_Rv$VxdHqrDP{%Db(~=(7hV53%dm)_MJtd{}7t@;OkH}&M25w;xW@MN(M*=9wUgGKN%6^wwNK{NtdEd%iK%pj27sn8Z%TxUt1&=6j zbhmPCL5jz85xfstBat`GE1BuTr4i>>XI*|F>5g%m~U1D}}=?@C^z zIC^|y=;GMdYC!K6HcSJ!G;jhoNqZ{_%o sYjK|gZ)dqon6m2mvJX3!{d&fKyqJ}DxlhnMplcXBUHx3vIVCg!09FrVAOHXW literal 0 HcmV?d00001 diff --git a/mods/default/textures/default_grass_5.png b/mods/default/textures/default_grass_5.png new file mode 100644 index 0000000000000000000000000000000000000000..865604c5fde3cfdc1a65f55ece8ce60487f6a8ea GIT binary patch literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!aez;Vs{;dreS(ZbqO4=GtW%1d zOS-&kro3C0f_sjFN3No0zM@y5qIZ#!Pl=Lmsj^?WvVVn&LewcnpmxTRAirP+hi5m^ zfE>;OkH}&M25w;xW@MN(M*=9wUgGKN%6^wwNK{O@`r6agK%tqQE{-7*mqYs(gzdrZrw~*fl8cfzSIO*53ij_7P&J^bDzxBweS?gMmv*l%uwBubLOIdo< z{`2NG6g%;}x#RTc`#r_%*o_&*!KciU-^ngo6Ekh5t6smkY~M`BZ^zFTm2m17ZCSJW zu4L|x6}Jm-DIZuF$Eozb?4;$BfJ=Hu|GYdkeRARx>3t<@JeK|XTYraNLWpfuEmPoG Qpd%SPUHx3vIVCg!043XTg8%>k literal 0 HcmV?d00001