Rename addEggRecipe to registerEggRecipe & add alias

This commit is contained in:
Jordan Irwin 2021-05-05 06:40:29 -07:00
parent a6b5acf195
commit b44525fb8c

17
api.lua
View File

@ -31,10 +31,12 @@
--- Adds a craft recipe for an egg. --- Adds a craft recipe for an egg.
-- --
-- @function asm.addEggRecipe -- Alias: *asm.addEggRecipe*
--
-- @function asm.registerEggRecipe
-- @param name Name of spawnegg that will be created from recipe. -- @param name Name of spawnegg that will be created from recipe.
-- @param ingredients Items used for recipe in addition to `spawneggs:egg`. Can be string or list. -- @param ingredients Items used for recipe in addition to `spawneggs:egg`. Can be string or list.
asm.addEggRecipe = function(name, ingredients) asm.registerEggRecipe = function(name, ingredients)
if type(ingredients) == "string" then if type(ingredients) == "string" then
ingredients = {ingredients,} ingredients = {ingredients,}
end end
@ -47,9 +49,14 @@ asm.addEggRecipe = function(name, ingredients)
}) })
end end
-- Alias for `asm.registerEggRecipe`.
asm.addEggRecipe = asm.registerEggRecipe
--- Registers new egg in game. --- Registers new egg in game.
-- --
-- Alias: *asm.addEgg*
--
-- @function asm.registerEgg -- @function asm.registerEgg
-- @param def `EggDef` table. -- @param def `EggDef` table.
asm.registerEgg = function(def) asm.registerEgg = function(def)
@ -82,16 +89,14 @@ asm.registerEgg = function(def)
}) })
if def.ingredients then if def.ingredients then
asm.addEggRecipe(def.name:lower(), def.ingredients) asm.registerEggRecipe(def.name:lower(), def.ingredients)
end end
-- DEBUG -- DEBUG
asm.log("action", "Registered spawnegg for " .. def.spawn) asm.log("action", "Registered spawnegg for " .. def.spawn)
end end
--- Alias for `asm.registerEgg`. -- Alias for `asm.registerEgg`.
--
-- @function asm.addEgg
asm.addEgg = asm.registerEgg asm.addEgg = asm.registerEgg