diff --git a/PHI-CL/data/b/sa.lua b/PHI-CL/data/b/sa.lua index 1caefa3..a9b1da2 100644 --- a/PHI-CL/data/b/sa.lua +++ b/PHI-CL/data/b/sa.lua @@ -1,21 +1,96 @@ -if settings.startup['PHI-SA'].value and (not settings.startup['PHI-SA-SPOIL'].value) or (settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value == 'VP') then - local function spoil_handle(i) - i.spoil_ticks = nil - i.spoil_result = nil - i.spoil_to_trigger_result = nil - end +local function spoil_handle(i) + i.spoil_ticks = nil + i.spoil_result = nil + i.spoil_to_trigger_result = nil +end + +local function spoil_freeze_handle(i) + local item = table.deepcopy(i) + item.name = 'frozen-' .. i.name + item.order = item.order .. '-f' + item.icons = {{icon = item.icon, icon_size = 64, icon_mipmaps = 4}, {icon = data.raw['item']['ice'].icon, tint = {r = 1, g = 1, b = 1, a = 0.5}, icon_size = 64, icon_mipmaps = 4}} + item.icon = nil + item.icon_size = nil + item.icon_mipmaps = nil + item.spoil_ticks = math.floor(i.spoil_ticks * settings.startup['PHI-SA-SPOIL-FREEZE-RATIO'].value / 10) + item.spoil_result = i.name + item.spoil_to_trigger_result = nil + item.localised_name = {'item-name.' .. i.name} + data:extend({item}) + + data:extend({{ + type = 'recipe', + name = item.name, + energy_required = 2, + enabled = false, + category = 'cryogenics', + ingredients = {{type = 'item', name = i.name, amount = 1}, {type = 'fluid', name = 'fluoroketone-cold', amount = 2, ignored_by_stats = 2}}, + results = {{type = 'item', name = item.name, amount = 1}, {type = 'fluid', name = 'fluoroketone-hot', amount = 2, ignored_by_stats=2, ignored_by_productivity = 2}}, + allow_productivity = false, + main_product = item.name, + localised_name = {'item-name.' .. i.name} + }}) + + data:extend({{ + type = 'recipe', + name = 'unfreeze-' .. i.name, + energy_required = 2, + enabled = false, + category = 'cryogenics', + ingredients = {{type = 'item', name = item.name, amount = 1}}, + results = {{type = 'item', name = i.name, amount = 1}}, + allow_productivity = false, + main_product = i.name, + localised_name = {'item-name.' .. i.name} + }}) + + table.insert(data.raw.technology['cryogenic-plant'].effects, {type = 'unlock-recipe', recipe = item.name}) + table.insert(data.raw.technology['cryogenic-plant'].effects, {type = 'unlock-recipe', recipe = 'unfreeze-' .. i.name}) +end + +-- SA A 11 SPACE_AGE ITEM +-- SA A 22 SPACE_AGE RECIPE,RESEARCH_EFFECT +-- SA C 6 SPACE_AGE CAPSULE +-- SA C 4 SPACE_AGE ITEM +-- SA C 1 SPACE_AGE TOOL +if settings.startup['PHI-SA'].value then + local spoil_set = (not settings.startup['PHI-SA-SPOIL'].value) or (settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value == 'VP') + local spoil_freeze_set = settings.startup['PHI-SA-SPOIL'].value and settings.startup['PHI-SA-SPOIL-FREEZE'].value and settings.startup['PHI-SA-SPOIL-FREEZE'].value > 0 for _, v in pairs({'nutrients', 'captive-biter-spawner', 'biter-egg', 'pentapod-egg'}) do - spoil_handle(data.raw['item'][v]) + if spoil_set then + spoil_handle(data.raw['item'][v]) + end + + if spoil_freeze_set then + spoil_freeze_handle(data.raw['item'][v]) + end end for _, v in pairs({'raw-fish', 'yumako-mash', 'yumako', 'jelly', 'jellynut', 'bioflux'}) do - spoil_handle(data.raw['capsule'][v]) + if spoil_set then + spoil_handle(data.raw['capsule'][v]) + end + + if spoil_freeze_set then + spoil_freeze_handle(data.raw['capsule'][v]) + end end - spoil_handle(data.raw.tool['agricultural-science-pack']) + if spoil_set then + spoil_handle(data.raw['tool']['agricultural-science-pack']) + end + if spoil_freeze_set then + spoil_freeze_handle(data.raw['tool']['agricultural-science-pack']) + end +end + +-- SA A 1 SPACE_AGE RECIPE +-- SA A 1 SPACE_AGE RESEARCH_EFFECT +-- SA C 3 SPACE_AGE TIPS_AND_TRICKS +if settings.startup['PHI-SA'].value and (not settings.startup['PHI-SA-SPOIL'].value) or (settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value == 'VP') then data:extend({{ type = 'recipe', name = 'spoilage-from-nutrients', @@ -34,66 +109,11 @@ if settings.startup['PHI-SA'].value and (not settings.startup['PHI-SA-SPOIL'].va table.insert(data.raw.technology['agriculture'].effects, {type = 'unlock-recipe', recipe = 'spoilage-from-nutrients'}) for _, v in pairs({'spoilables', 'spoilables-result', 'spoilables-research'}) do - data.raw['tips-and-tricks-item'][v] = nil + data.raw['tips-and-tricks-item'][v].hidden = true + data.raw['tips-and-tricks-item'][v].hidden_in_factoriopedia = true end end -if settings.startup['PHI-SA'].value and settings.startup['PHI-SA-SPOIL'].value and settings.startup['PHI-SA-SPOIL-FREEZE'].value then - local function spoil_handle(i) - local item = table.deepcopy(i) - item.name = 'frozen-' .. i.name - item.order = item.order .. '-f' - item.icons = {{icon = item.icon, icon_size = 64, icon_mipmaps = 4}, {icon = data.raw['item']['ice'].icon, tint = {r = 1, g = 1, b = 1, a = 0.5}, icon_size = 64, icon_mipmaps = 4}} - item.icon = nil - item.icon_size = nil - item.icon_mipmaps = nil - item.spoil_ticks = math.floor(i.spoil_ticks * settings.startup['PHI-SA-SPOIL-FREEZE-RATIO'].value / 10) - item.spoil_result = i.name - item.spoil_to_trigger_result = nil - item.localised_name = {'item-name.' .. i.name} - data:extend({item}) - - data:extend({{ - type = 'recipe', - name = item.name, - energy_required = 2, - enabled = false, - category = 'cryogenics', - ingredients = {{type = 'item', name = i.name, amount = 1}, {type = 'fluid', name = 'fluoroketone-cold', amount = 2, ignored_by_stats = 2}}, - results = {{type = 'item', name = item.name, amount = 1}, {type = 'fluid', name = 'fluoroketone-hot', amount = 2, ignored_by_stats=2, ignored_by_productivity = 2}}, - allow_productivity = false, - main_product = item.name, - localised_name = {'item-name.' .. i.name} - }}) - - data:extend({{ - type = 'recipe', - name = 'unfreeze-' .. i.name, - energy_required = 2, - enabled = false, - category = 'cryogenics', - ingredients = {{type = 'item', name = item.name, amount = 1}}, - results = {{type = 'item', name = i.name, amount = 1}}, - allow_productivity = false, - main_product = i.name, - localised_name = {'item-name.' .. i.name} - }}) - - table.insert(data.raw.technology['cryogenic-plant'].effects, {type = 'unlock-recipe', recipe = item.name}) - table.insert(data.raw.technology['cryogenic-plant'].effects, {type = 'unlock-recipe', recipe = 'unfreeze-' .. i.name}) - end - - for _, v in pairs({'nutrients', 'captive-biter-spawner', 'biter-egg', 'pentapod-egg'}) do - spoil_handle(data.raw['item'][v]) - end - - for _, v in pairs({'raw-fish', 'yumako-mash', 'yumako', 'jelly', 'jellynut', 'bioflux'}) do - spoil_handle(data.raw['capsule'][v]) - end - - spoil_handle(data.raw.tool['agricultural-science-pack']) -end - if settings.startup['PHI-SA'].value and settings.startup['PHI-SA-QUALITY'].value then for _, v in pairs(data.raw.module) do if v.category and v.category == 'quality' then