Adding create() function for recipes - creates but does not add (see updated listing in book chapter 16)

This commit is contained in:
walterhiggins 2014-10-25 11:22:43 +01:00
parent 062886d8e6
commit 6b6c8f6dfe

View file

@ -3,6 +3,9 @@ var cmRecipe = cm.api.inventory.recipes.CraftingRecipe;
var cmRecipeRow = cm.api.inventory.recipes.RecipeRow; var cmRecipeRow = cm.api.inventory.recipes.RecipeRow;
function addRecipe( recipe ){ function addRecipe( recipe ){
return server.addRecipe( createRecipe( recipe ) );
}
function createRecipe( recipe ){
if (!recipe){ if (!recipe){
return null; return null;
} }
@ -32,5 +35,6 @@ function addRecipe( recipe ){
function removeRecipe( recipe ){ function removeRecipe( recipe ){
server.removeRecipe( recipe ); server.removeRecipe( recipe );
} }
exports.create = createRecipe;
exports.add = addRecipe; exports.add = addRecipe;
exports.remove = removeRecipe; exports.remove = removeRecipe;