se fixes, updates

This commit is contained in:
Brevven 2021-08-05 13:39:09 -07:00
parent bc823ac823
commit 2147e2db0d
5 changed files with 20 additions and 10 deletions

View file

@ -34,7 +34,7 @@ end
-- Add a prerequisite to a given technology
function util.add_prerequisite(technology_name, prerequisite)
technology = data.raw.technology[technology_name]
local technology = data.raw.technology[technology_name]
if technology and data.raw.technology[prerequisite] then
if technology.prerequisites then
table.insert(technology.prerequisites, prerequisite)
@ -46,7 +46,7 @@ end
-- Remove a prerequisite from a given technology
function util.remove_prerequisite(technology_name, prerequisite)
technology = data.raw.technology[technology_name]
local technology = data.raw.technology[technology_name]
local index = -1
if technology and data.raw.technology[prerequisite] then
for i, prereq in pairs(technology.prerequisites) do
@ -63,7 +63,7 @@ end
-- Add an effect to a given technology
function util.add_effect(technology_name, effect)
technology = data.raw.technology[technology_name]
local technology = data.raw.technology[technology_name]
if technology then
table.insert(technology.effects, effect)
end
@ -71,7 +71,7 @@ end
-- Set technology ingredients
function util.set_tech_recipe(technology_name, ingredients)
technology = data.raw.technology[technology_name]
local technology = data.raw.technology[technology_name]
if technology then
technology.unit.ingredients = ingredients
end
@ -363,7 +363,7 @@ end
function add_to_ingredient(recipe, it, amount)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, ingredient in pairs(recipe.ingredients) do
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == it then
ingredient.amount = ingredient.amount + amount
return