Skip to content
Permalink
Browse files

Store registered plant on namespace

Handy for when modders want to use these definitions to extend or add to the mod
  • Loading branch information
bas080 authored and rubenwardy committed Oct 11, 2016
1 parent 6fdfd25 commit 78311a27a1f9245e7cdb377eb04b724871105230
Showing with 7 additions and 0 deletions.
  1. +3 −0 game_api.txt
  2. +4 −0 mods/farming/api.lua
@@ -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


@@ -1,6 +1,8 @@

-- Wear out hoes, place soil
-- TODO Ignore group:flower
farming.registered_plants = {}

This comment has been minimized.

Copy link
@bas080

bas080 Oct 13, 2016

Author Contributor

It indeed does not

This comment has been minimized.

Copy link
@sofar

sofar Oct 13, 2016

Member

The declaration of farming.registered_plants should just move to above the comments here. This can be done on merge by @paramat, really.

This comment has been minimized.

Copy link
@sofar

sofar Oct 13, 2016

Member

Ah, didn't see it was already merged.

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}

0 comments on commit 78311a2

Please sign in to comment.
You can’t perform that action at this time.