From a15260481673bb26085175aafdc3021a29ecd3b9 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 6 Feb 2017 19:25:15 +0100 Subject: [PATCH] Add grass path --- mods/mcl_core/nodes.lua | 18 ++++++++++++ .../textures/mcl_core_grass_path_side.png | Bin 0 -> 1596 bytes .../textures/mcl_core_grass_path_top.png | Bin 0 -> 1442 bytes mods/mcl_core/tools.lua | 26 ++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 mods/mcl_core/textures/mcl_core_grass_path_side.png create mode 100644 mods/mcl_core/textures/mcl_core_grass_path_top.png diff --git a/mods/mcl_core/nodes.lua b/mods/mcl_core/nodes.lua index 64bbee560f..be19b1b4a1 100644 --- a/mods/mcl_core/nodes.lua +++ b/mods/mcl_core/nodes.lua @@ -262,6 +262,24 @@ minetest.register_node("mcl_core:dirt_with_grass", { }), }) +minetest.register_node("mcl_core:grass_path", { + tiles = {"mcl_core_grass_path_top.png", "mcl_core_grass_path_side.png"}, + description = "Grass Path", + drop = "mcl_core:dirt", + is_ground_content = true, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + -- 15/16 of the normal height + {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, + } + }, + groups = { crumbly=3, not_in_creative_inventory=1, soil=2, soil_sapling=1 }, + sounds = mcl_core.node_sound_dirt_defaults(), +}) + -- TODO: Add particles minetest.register_node("mcl_core:mycelium", { description = "Mycelium", diff --git a/mods/mcl_core/textures/mcl_core_grass_path_side.png b/mods/mcl_core/textures/mcl_core_grass_path_side.png new file mode 100644 index 0000000000000000000000000000000000000000..488a8d764294ae7ffe73c6ae601576af8641ecfb GIT binary patch literal 1596 zcmV-C2E+M@P)rz-Q9FX0a zkeshaB|BLz8JEJ(EU&l+9sRE6!K{bc*HWvCtB&@w^_cvXX>jv^163&Fbb=>O?$=wNJ}2CL;$L%#I2y;Di|ywbx^ zf&my>cljQPJrSG*2(Xp<=qkS_B-ttF+yQ`5$k9TT94|$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}weXW# z*%=x?-x0jWLXd5WMIDJk2X=OSzI{HNao;|#K~T%(h;scQ1y3poB)DYYn&pFsDtt)j zI2OVy;XZ+rc3wT?RCQV`pis*`-G{Hg%;6qPK$x`NCfNAaotcW>EGo!PAquhFmJ{*D zeOe&%{RaD+T|;r&6wYE%YtiQGsKd88gC)+a9~i2yd_dZLcfj$uDWf}ewanthfWann z_S1H2KArEn`v_B5aL)>p0pGwLt6Z75+)@c1FTaua*ohHbzG`Ef^}piUCk35NXnL_ztP>sxg%?@-{tSQz~RNNgmw<+%&mjt5;H-uF4*Y zHOK9T4B6GP%9=?Vx_U4-D~xIg>Lg;`2>ns6cpI|*-alERgQ9?)j=;AB!Iu)k=b@S= z@JJCQSdBgm1rcxiVr_oBB2#a#ND}q6CL+nokQXwh&P-!~MijMrNuRPSV^>B5uOIAG zL`Ct=#UV>YS*MZZ8!atfxGe+Px}_Nw*Pq1Y&uT!QQ2@yKRoys?1)36q0d>j9_T*+O zvIJ#)bMeNHb3I$BQ5*_c%nU*;pWpQv&oHT9E9g1{Y7ni?rG780%v8C5u<7}OB>>C{ zrLj(nM()x@nw@(xVHLy?9sFT^hai?wGyZ2x5W`6q#Y`Y6A_8v2hU!)MC!g~2gbNox znQBmRWf;*L74M%C_AQjkREg7WzirC?T+o>lRb313hm2m9&|aiRKtKJJx8n5-A=r@| z%y*uF$T-POY*B9YU91qvlrKn2wKnDU_gnJa4|YvgX#`2I#c=V=#4aOe*#?s@D{{W$J#Sj1h literal 0 HcmV?d00001 diff --git a/mods/mcl_core/tools.lua b/mods/mcl_core/tools.lua index 545ea4dc7d..514c03b3bd 100644 --- a/mods/mcl_core/tools.lua +++ b/mods/mcl_core/tools.lua @@ -105,6 +105,27 @@ minetest.register_tool("mcl_core:pick_diamond", { }, }) +local make_grass_path = function(itemstack, placer, pointed_thing) + if minetest.get_node(pointed_thing.under).name == "mcl_core:dirt_with_grass" and pointed_thing.above.y == pointed_thing.under.y then + local above = table.copy(pointed_thing.under) + above.y = above.y + 1 + if minetest.get_node(above).name == "air" then + if not minetest.setting_getbool("creative_mode") then + -- Add wear, as if digging a level 0 crumbly node + local def = minetest.registered_items[itemstack:get_name()] + local base_uses = def.tool_capabilities.groupcaps.crumbly.uses + local maxlevel = def.tool_capabilities.groupcaps.crumbly.maxlevel + local uses = base_uses * math.pow(3, maxlevel) + local wear = math.ceil(65535 / uses) + itemstack:add_wear(wear) + end + minetest.sound_play({name="default_dirt_footstep", gain=1.1}, {pos = above}) + minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"}) + end + end + return itemstack +end + -- Shovels minetest.register_tool("mcl_core:shovel_wood", { description = "Wooden Shovel", @@ -119,6 +140,7 @@ minetest.register_tool("mcl_core:shovel_wood", { }, damage_groups = {fleshy=2}, }, + on_place = make_grass_path, }) minetest.register_tool("mcl_core:shovel_stone", { description = "Stone Shovel", @@ -133,6 +155,7 @@ minetest.register_tool("mcl_core:shovel_stone", { }, damage_groups = {fleshy=3}, }, + on_place = make_grass_path, }) minetest.register_tool("mcl_core:shovel_steel", { description = "Iron Shovel", @@ -147,6 +170,7 @@ minetest.register_tool("mcl_core:shovel_steel", { }, damage_groups = {fleshy=4}, }, + on_place = make_grass_path, }) minetest.register_tool("mcl_core:shovel_gold", { description = "Golden Shovel", @@ -161,6 +185,7 @@ minetest.register_tool("mcl_core:shovel_gold", { }, damage_groups = {fleshy=2}, }, + on_place = make_grass_path, }) minetest.register_tool("mcl_core:shovel_diamond", { description = "Diamond Shovel", @@ -175,6 +200,7 @@ minetest.register_tool("mcl_core:shovel_diamond", { }, damage_groups = {fleshy=5}, }, + on_place = make_grass_path, }) -- Axes