Optional field "title" for EggDef

master
Jordan Irwin 2021-05-05 15:12:39 -07:00
parent bd79e310b8
commit 8579eac823
2 changed files with 23 additions and 9 deletions

16
api.lua
View File

@ -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`.

View File

@ -139,16 +139,24 @@
<h3>Fields:</h3>
<ul>
<li><span class="parameter">name</span>
Human readable name.
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Name of the egg. Will be appended to "spawneggs:".
</li>
<li><span class="parameter">title (<em>optional</em>)</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Description displayed for item.
</li>
<li><span class="parameter">inventory_image</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Image displayed in inventory.
</li>
<li><span class="parameter">spawn</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
Entity that will be spawned from egg.
</li>
<li><span class="parameter">ingredients</span>
Ingredients to us, in addition to <code>spawneggs:egg</code>, to register craft recipe (optional).
<li><span class="parameter">ingredients (<em>optional</em>)</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
Ingredients to use, in addition to <code>spawneggs:egg</code>, to register craft recipe. Can be a <a href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a> or <a href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a>.
</li>
</ul>
@ -164,7 +172,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/AntumDeluge/LDoc">LDoc 1.4.6-antum-2</a></i>
<i style="float:right;">Last updated 2021-05-05 06:41:02 </i>
<i style="float:right;">Last updated 2021-05-05 15:11:46 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>