From ab1a79b13c5739d73083236ca29869b60ff3b380 Mon Sep 17 00:00:00 2001 From: random-geek <35757396+random-geek@users.noreply.github.com> Date: Tue, 9 Oct 2018 12:54:22 -0700 Subject: [PATCH] Add blueberry bushes --- game_api.txt | 5 +- mods/default/README.txt | 7 ++ mods/default/craftitems.lua | 6 ++ mods/default/mapgen.lua | 23 +++++ mods/default/nodes.lua | 82 ++++++++++++++++++ mods/default/schematics/blueberry_bush.mts | Bin 0 -> 80 bytes mods/default/textures/default_blueberries.png | Bin 0 -> 166 bytes .../default_blueberry_bush_leaves.png | Bin 0 -> 813 bytes .../default_blueberry_bush_sapling.png | Bin 0 -> 204 bytes .../textures/default_blueberry_overlay.png | Bin 0 -> 165 bytes mods/default/trees.lua | 13 +++ mods/dye/init.lua | 8 ++ schematic_tables.txt | 20 ++++- 13 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 mods/default/schematics/blueberry_bush.mts create mode 100644 mods/default/textures/default_blueberries.png create mode 100644 mods/default/textures/default_blueberry_bush_leaves.png create mode 100644 mods/default/textures/default_blueberry_bush_sapling.png create mode 100644 mods/default/textures/default_blueberry_overlay.png diff --git a/game_api.txt b/game_api.txt index 27d5b339..47df8e7f 100644 --- a/game_api.txt +++ b/game_api.txt @@ -927,10 +927,13 @@ Trees * `default.grow_acacia_bush(pos)` * Grows an acaia bush at pos - + * `default.grow_pine_bush(pos)` * Grows a pine bush at pos + * `default.grow_blueberry_bush(pos)` + * Grows a blueberry bush at pos + Carts ----- diff --git a/mods/default/README.txt b/mods/default/README.txt index 474ef0ec..3d33e31c 100644 --- a/mods/default/README.txt +++ b/mods/default/README.txt @@ -230,6 +230,10 @@ Mossmanikin (CC BY-SA 3.0): default_fern_*.png random-geek (CC BY-SA 3.0): + default_blueberries.png + default_blueberry_overlay.png + default_blueberry_bush_leaves.png, derived from default_bush_leaves (by paramat) + default_blueberry_bush_sapling.png default_dirt.png -- Derived from a texture by Neuromancer (CC BY-SA 3.0) @@ -359,3 +363,6 @@ sofar (CC BY-SA 3.0): TumeniNodes (CC BY-SA 3.0): pine_bush.mts + +random-geek (CC BY-SA 3.0): + blueberry_bush.mts diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua index 6c079349..3e3852ce 100644 --- a/mods/default/craftitems.lua +++ b/mods/default/craftitems.lua @@ -341,3 +341,9 @@ minetest.register_craftitem("default:flint", { description = "Flint", inventory_image = "default_flint.png" }) + +minetest.register_craftitem("default:blueberries", { + description = "Blueberries", + inventory_image = "default_blueberries.png", + on_use = minetest.item_eat(2), +}) diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua index 7e1cf7df..d53467d3 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -1964,6 +1964,29 @@ function default.register_decorations() flags = "place_center_x, place_center_z", }) + -- Blueberry bush + + minetest.register_decoration({ + name = "default:blueberry_bush", + deco_type = "schematic", + place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 697, + octaves = 3, + persist = 0.7, + }, + biomes = {"grassland", "snowy_grassland"}, + y_max = 31000, + y_min = 1, + place_offset_y = 1, + schematic = minetest.get_modpath("default") .. "/schematics/blueberry_bush.mts", + flags = "place_center_x, place_center_z", + }) + -- Acacia bush minetest.register_decoration({ diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 9aa3606f..c8020127 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -165,6 +165,9 @@ default:acacia_bush_sapling default:pine_bush_stem default:pine_bush_needles default:pine_bush_sapling +default:blueberry_bush_leaves_with_berries +default:blueberry_bush_leaves +default:blueberry_bush_sapling default:sand_with_kelp @@ -1614,6 +1617,85 @@ minetest.register_node("default:bush_sapling", { end, }) +minetest.register_node("default:blueberry_bush_leaves_with_berries", { + description = "Blueberry Bush Leaves with Berries", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_blueberry_bush_leaves.png^default_blueberry_overlay.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1, dig_immediate = 3}, + drop = "default:blueberries", + sounds = default.node_sound_leaves_defaults(), + node_dig_prediction = "default:blueberry_bush_leaves", + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + minetest.set_node(pos, {name = "default:blueberry_bush_leaves"}) + minetest.get_node_timer(pos):start(math.random(300, 1500)) + end, +}) + +minetest.register_node("default:blueberry_bush_leaves", { + description = "Blueberry Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_blueberry_bush_leaves.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:blueberry_bush_sapling"}, rarity = 5}, + {items = {"default:blueberry_bush_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + on_timer = function(pos, elapsed) + if minetest.get_node_light(pos) < 11 then + minetest.get_node_timer(pos):start(200) + else + minetest.set_node(pos, {name = "default:blueberry_bush_leaves_with_berries"}) + end + end, + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:blueberry_bush_sapling", { + description = "Blueberry Bush Sapling", + drawtype = "plantlike", + tiles = {"default_blueberry_bush_sapling.png"}, + inventory_image = "default_blueberry_bush_sapling.png", + wield_image = "default_blueberry_bush_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(300, 1500)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:blueberry_bush_sapling", + -- minp, maxp to be checked, relative to sapling pos + {x = -1, y = 0, z = -1}, + {x = 1, y = 1, z = 1}, + -- maximum interval of interior volume check + 2) + + return itemstack + end, +}) + minetest.register_node("default:acacia_bush_stem", { description = "Acacia Bush Stem", drawtype = "plantlike", diff --git a/mods/default/schematics/blueberry_bush.mts b/mods/default/schematics/blueberry_bush.mts new file mode 100644 index 0000000000000000000000000000000000000000..cf4d8ef84af1d3cec7e274013bf59dc56173cf6f GIT binary patch literal 80 zcmeYb3HD`RVPIxpWMHlb5?U##X^EvdC00o}rKw4&MMahINu|XZ@j0o9WvRvS<(VZJ g@gU*M)Z&Uc$q5eZzkdGu`M)tjUXO{vU>S1-0OD*Mv;Y7A literal 0 HcmV?d00001 diff --git a/mods/default/textures/default_blueberries.png b/mods/default/textures/default_blueberries.png new file mode 100644 index 0000000000000000000000000000000000000000..1dbb0d64fd3a6eb38944c124c3ce257bb23559bb GIT binary patch literal 166 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ1=6x2A*xc@rn25Hs)-Q> zwc)nE+*^)m0VNnqg8YIR9G=}s19I#=T^vI=t|uofkl3KurvfLW{@qfkrWSy85}S Ib4q9e0RCbv761SM literal 0 HcmV?d00001 diff --git a/mods/default/textures/default_blueberry_bush_leaves.png b/mods/default/textures/default_blueberry_bush_leaves.png new file mode 100644 index 0000000000000000000000000000000000000000..2cd112c8c3a8792bb5d63652bd723b21e414229b GIT binary patch literal 813 zcmV+|1JeA7P){ zO^aJ~6o;Slzb{GV#w3mtYa6E(?Nsb&Ww7)GanVkxx)|KpS%~5X5b-0-sfAKB*L!d7|F{Sl3Oyg-{LcA3j~qVKpnfjXu#>X? zaEU*^GEzU9Y3z^j5{ImiGyJV2^`n_`0E)9N_pXe{du0JI%WI;i&X%Y)e0KX8(@7JH zttoLQXJy@0fOKR5$a`g3UK5>PRW;i!%g;Z=JiX|Ubu9IBnfA6kaYu%%V>xgpAWCuo zvW{hEBVvA4_3CF4&pZpp#7fvo>34;3ZaHxOSX4>^C)XqH+0#z>bwvfBIJlkR5B%c})~ibuOCQY<*^duayK z+wvrB1>*R^6Y~YqRv@>wEndNJ^1T`EewQ=9s!C;&Y{$y^i$-Oiu(J^%7e3yv{jSh% ziY%{*ZnrFhc1o${67P=jLql)NlgD33)z);fr4Qka!h}Mkj1x4 zT)Sk%Z;UkU1hTU3>h2)JOn-m%LO@XQICLTapj`8K>djpLxt&rv=z{eDs8)Se)?NMj zlU?q21v&Y~llowgq84h4KH>oFpY)dH_`5|mn+bC#e0G1$i2X6< z@0KTNCy;W@qt@^+Mwq6)xLU;>8Pbs@yjhT+J{{sVgz)~D-j*j`;^0o3Z#R7z^oI)U zrQZG~BDzzOg)^uhW;)hM$b-KoX8zmqMUK5TtFOFMWEf8nUAtst=3uN|!w_CAJc6&X zH0fezBjWWBs+g&g0DpXu01zB;$vT#W_jv?gyD9RpwPyBM5e9JM$AqBlQazoh;~896 rC|6t--tzhH?u>Ld;|UGmVQc>fv>b8Yj%znL00000NkvXXu0mjfAjXiM literal 0 HcmV?d00001 diff --git a/mods/default/textures/default_blueberry_bush_sapling.png b/mods/default/textures/default_blueberry_bush_sapling.png new file mode 100644 index 0000000000000000000000000000000000000000..5d7393f7b2a69abe041cd7912df8ae681058674b GIT binary patch literal 204 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ1=22#O2(o5QDJ&6MIwbc zmZ5!;k0-Nm0wowrg8YIR9G=}s196hP-CYEal|aXmRfK}f|RbD9aq+hb1{5?81=r_NyEP3Ssw$3Z2Usd*(+#IfGc240=zr%pX! pO54D>oUL)H)f-_5+P$@O1TaS?83{1OT?eHi`fM literal 0 HcmV?d00001 diff --git a/mods/default/textures/default_blueberry_overlay.png b/mods/default/textures/default_blueberry_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..de9de623497f7a0488c1e278d5e7913182451baa GIT binary patch literal 165 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|t_2M9RHd@*bhdtcx8gZa zkg+7lFPOpM*^M-iiUNviolet dye + +minetest.register_craft({ + type = "shapeless", + output = "dye:violet 2", + recipe = {"default:blueberries"}, +}) + -- Mix recipes local dye_recipes = { diff --git a/schematic_tables.txt b/schematic_tables.txt index ee25b822..261dcf19 100644 --- a/schematic_tables.txt +++ b/schematic_tables.txt @@ -9,7 +9,7 @@ The following tables are for pasting into mods that contain a function to convert the Lua tables into .mts files. Such mods often have two functions to process two formats of the 'data' table: -The standard table format is described in the 'Schematic specifier' section of +The standard table format is described in the 'Schematic specifier' section of the lua_api.txt file in the Minetest Engine. The 'data' table appears as a sequence of vertical slices through the structure the schematic describes. @@ -2146,6 +2146,24 @@ mts_save("bush", { }) +-- Blueberry bush + +local L = {name = "default:blueberry_bush_leaves_with_berries", prob = 255, force_place = true} +local M = {name = "default:blueberry_bush_leaves_with_berries", prob = 223} +local N = {name = "default:blueberry_bush_leaves_with_berries", prob = 95} + +mts_save("blueberry_bush", { + size = {x = 3, y = 1, z = 3}, + data = { + N, M, N, + + M, L, M, + + N, M, N, + }, +}) + + -- Acacia bush local L = {name = "default:acacia_bush_leaves", prob = 255} -- 2.25.1