1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 23:10:17 +01:00

Store registered plant on namespace

Handy for when modders want to use these definitions to extend or add to the mod
This commit is contained in:
bas080 2016-05-07 11:50:59 +02:00 committed by rubenwardy
parent 6fdfd2554c
commit 78311a27a1
2 changed files with 7 additions and 0 deletions

View File

@ -183,6 +183,9 @@ The farming API allows you to easily register plants and hoes.
`farming.register_plant(name, Plant definition)`
* Register a new growing plant, see [#Plant definition]
`farming.registered_plants[name] = definition`
* Table of registered plants, indexed by plant name
### Hoe Definition

View File

@ -1,6 +1,8 @@
-- Wear out hoes, place soil
-- TODO Ignore group:flower
farming.registered_plants = {}
farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
local pt = pointed_thing
-- check if pointing at a node
@ -263,6 +265,8 @@ farming.register_plant = function(name, def)
def.fertility = {}
end
farming.registered_plants[pname] = def
-- Register seed
local lbm_nodes = {mname .. ":seed_" .. pname}
local g = {seed = 1, snappy = 3, attached_node = 1}