diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2017-12-31 11:24:57 +0000 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2017-12-31 11:24:57 +0000 |
commit | 78db062f8b9eafa262467bece031b0f0536887a2 (patch) | |
tree | dd5f0a8cb1093d1478dd71e42684e1e3c2a9043b | |
parent | dd6812afa4b429cc83d20df764037c4fbcee113a (diff) |
api addition, cactus+papyrus growth, coral recipe
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | api.txt | 3 | ||||
-rw-r--r-- | init.lua | 29 |
3 files changed, 29 insertions, 4 deletions
@@ -26,5 +26,6 @@ Changelog: - 0.4 - Added Intllib support and fr.txt file - 0.5 - Added support for default bush and acacia bush saplings - 0.6 - Using newer functions, Minetest 0.4.16 and above needed to run +- 0.7 - Can be used on papyrus and cactus now, added coral recipe, api addition Lucky Blocks: 5 @@ -57,13 +57,14 @@ bonemeal:add_deco({"default:dirt_with_dry_grass", {"default:dry_grass_1", ""}, Global ON_USE Function ---------------------- -bonemeal:on_use(pos, strength) +bonemeal:on_use(pos, strength, node) This function can be called from other mods to grow plants using alternative bonemeal items and have the same effect. {pos} is the location to apply growing {strength} is how strong to grow [low of 1 to high of 4] + {node} is the node at pos, but can be left nil to get_node itself Note: Higher strength items require lower light levels, and a strength of 4 needs no light at all. @@ -294,10 +294,10 @@ end -- global on_use function for bonemeal
-function bonemeal:on_use(pos, strength)
+function bonemeal:on_use(pos, strength, node)
-- get node pointed at
- local node = minetest.get_node(pos)
+ local node = node or minetest.get_node(pos)
-- return if nothing there
if node.name == "ignore" then
@@ -305,10 +305,25 @@ function bonemeal:on_use(pos, strength) end
-- make sure strength is between 1 and 4
- strength = strength or 2
+ strength = strength or 1
strength = math.max(strength, 1)
strength = math.min(strength, 4)
+ -- papyrus and cactus
+ if node.name == "default:papyrus" then
+
+ default.grow_papyrus(pos, node)
+ particle_effect(pos)
+
+ return
+ elseif node.name == "default:cactus" then
+
+ default.grow_cactus(pos, node)
+ particle_effect(pos)
+
+ return
+ end
+
-- grow grass and flowers
if minetest.get_item_group(node.name, "soil") > 0
or minetest.get_item_group(node.name, "sand") > 0 then
@@ -449,6 +464,13 @@ minetest.register_craft({ recipe = {"bones:bones"},
})
+-- bonemeal (from coral skeleton)
+minetest.register_craft({
+ type = "shapeless",
+ output = "bonemeal:bonemeal 2",
+ recipe = {"default:coral_skeleton"},
+})
+
-- mulch
minetest.register_craft({
type = "shapeless",
@@ -487,6 +509,7 @@ minetest.override_item("default:dirt", { -- add support for other mods
local path = minetest.get_modpath("bonemeal")
+
dofile(path .. "/mods.lua")
dofile(path .. "/lucky_block.lua")
|