class Crafting { constructor() { } init() { this.recipes = []; this.recipes.push({ id: 1, duration: 1000, ingredients: [{ name: "Scrap Metal", amount: 2 }, { name: "Hydrogen", amount: 1 }], results: [{ name: "Spare Part", type: "sparepart", amount: 1 }] }); // this.recipes.push({ // id: 2, // duration: 2000, // ingredients: [{ name: "Hydrogen", amount: 100 }], // results: [{ name: "Fuel", type: "fuel", amount: 1 }] // }); } getAllRecipes() { return this.recipes; } getRecipe(recipeId) { return this.recipes.find((recipe) => recipe.id == recipeId); } enableRecipe(recipeName) { this.recipes.push({ id: 2, duration: 2000, ingredients: [{ name: "Hydrogen", amount: 100 }], results: [{ name: "Fuel", type: "fuel", amount: 1 }] }); game.playerHud.crafting.buildRecipes(); } }