Add :merge
This commit is contained in:
parent
a9457f7c38
commit
9878331df5
3 changed files with 25 additions and 1 deletions
|
@ -42,6 +42,14 @@ function Item:assign(data)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Deeply merges data with the item
|
||||||
|
--- Shorthand for table.merge(item.prototype, data)
|
||||||
|
--- @param data table The data to merge
|
||||||
|
function Item:merge(data)
|
||||||
|
table.merge(self.prototype, data)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Sets the weight of the item calculated from given count per rocket.
|
--- Sets the weight of the item calculated from given count per rocket.
|
||||||
--- @param count number The amount of items that fit into a rocket
|
--- @param count number The amount of items that fit into a rocket
|
||||||
function Item:itemsPerRocket(count)
|
function Item:itemsPerRocket(count)
|
||||||
|
|
|
@ -42,6 +42,14 @@ function Recipe:assign(data)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Deeply merges data with the recipe
|
||||||
|
--- Shorthand for table.merge(recipe.prototype, data)
|
||||||
|
--- @param data table The data to merge
|
||||||
|
function Recipe:merge(data)
|
||||||
|
table.merge(self.prototype, data)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Adds an ingredient to the recipe
|
--- Adds an ingredient to the recipe
|
||||||
--- @param ingredientName string The name of the ingredient
|
--- @param ingredientName string The name of the ingredient
|
||||||
--- @param amount number The amount of the ingredient (default: 1)
|
--- @param amount number The amount of the ingredient (default: 1)
|
||||||
|
@ -62,7 +70,7 @@ function Recipe:addIngredient(ingredientName, amount)
|
||||||
ingredient.amount_min = nil
|
ingredient.amount_min = nil
|
||||||
ingredient.amount_max = nil
|
ingredient.amount_max = nil
|
||||||
ingredient.probability = nil
|
ingredient.probability = nil
|
||||||
return
|
return self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(self.prototype.ingredients, { name = ingredientName, amount = amount, type = ingredientType })
|
table.insert(self.prototype.ingredients, { name = ingredientName, amount = amount, type = ingredientType })
|
||||||
|
|
|
@ -50,6 +50,14 @@ function Technology:assign(data)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Deeply merges data with the technology
|
||||||
|
--- Shorthand for table.merge(technology.prototype, data)
|
||||||
|
--- @param data table The data to merge
|
||||||
|
function Technology:merge(data)
|
||||||
|
table.merge(self.prototype, data)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Sets the prerequisite for the technology
|
--- Sets the prerequisite for the technology
|
||||||
--- @param prerequisites table The names of the prerequisites
|
--- @param prerequisites table The names of the prerequisites
|
||||||
function Technology:setPrerequisites(prerequisites)
|
function Technology:setPrerequisites(prerequisites)
|
||||||
|
|
Loading…
Add table
Reference in a new issue