From 8579eac82359a0910eb539b3b3bba4e5038bd29a Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Wed, 5 May 2021 15:12:39 -0700 Subject: [PATCH] Optional field "title" for EggDef --- api.lua | 16 +++++++++++----- docs/api.html | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/api.lua b/api.lua index 2219883..8772116 100644 --- a/api.lua +++ b/api.lua @@ -78,8 +78,13 @@ asm.registerEgg = function(def) img = def.inventory_image end + local title = def.title + if not title then + title = formatTitle(def.name) + end + core.register_craftitem(":spawneggs:" .. def.name:lower(), { - description = formatTitle(def.name), + description = title, inventory_image = img, on_place = function(itemstack, placer, target) @@ -116,7 +121,8 @@ asm.addEgg = asm.registerEgg --- Egg definition table. -- -- @table EggDef --- @field name Human readable name. --- @field inventory_image Image displayed in inventory. --- @field spawn Entity that will be spawned from egg. --- @field ingredients Ingredients to us, in addition to `spawneggs:egg`, to register craft recipe (optional). +-- @tfield string name Name of the egg. Will be appended to "spawneggs:". +-- @tfield[opt] string title Description displayed for item. +-- @tfield string inventory_image Image displayed in inventory. +-- @tfield string spawn Entity that will be spawned from egg. +-- @tfield[opt] table ingredients Ingredients to use, in addition to `spawneggs:egg`, to register craft recipe. Can be a `table` or `string`. diff --git a/docs/api.html b/docs/api.html index d0f28e5..bc4c3f0 100644 --- a/docs/api.html +++ b/docs/api.html @@ -139,16 +139,24 @@

Fields:

@@ -164,7 +172,7 @@
generated by LDoc 1.4.6-antum-2 -Last updated 2021-05-05 06:41:02 +Last updated 2021-05-05 15:11:46