From 78311a27a1f9245e7cdb377eb04b724871105230 Mon Sep 17 00:00:00 2001 From: bas080 Date: Sat, 7 May 2016 11:50:59 +0200 Subject: [PATCH] Store registered plant on namespace Handy for when modders want to use these definitions to extend or add to the mod --- game_api.txt | 3 +++ mods/farming/api.lua | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/game_api.txt b/game_api.txt index a148136d..a20ecd4f 100644 --- a/game_api.txt +++ b/game_api.txt @@ -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 diff --git a/mods/farming/api.lua b/mods/farming/api.lua index 901f7245..71c5a67c 100644 --- a/mods/farming/api.lua +++ b/mods/farming/api.lua @@ -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} -- 2.25.1