refactor, move to updates

This commit is contained in:
Brevven 2021-07-27 22:51:52 -07:00
parent b21b54e319
commit 30de78fd3e
6 changed files with 130 additions and 68 deletions

View file

@ -24,7 +24,7 @@ copy: link
mkdir -p ../$(v)
cp -rf * ../$(v)
rm -f ../$(v).zip
cd ..; zip -9 -r -y $(v).zip $(v) -x "*.xcf" -x "*.git*" -x "*.bak"
cd ..; zip -9 -r -y $(v).zip $(v) -x "*.xcf" -x "*.git*" -x "*.bak" -x "*.blend*"
install: lint-changelog copy
cp -f ../$(v).zip ../../mods/

View file

@ -2,6 +2,7 @@
Version: 0.12.4
Date: 2021-07-26
Changes:
- SE: Experimental alloys data recipe
- Minor refactor
---------------------------------------------------------------------------------------------------
Version: 0.12.3

View file

@ -1,4 +1,6 @@
-- WARNING - this file will be overwritten, edit bzlib/data-util.lua
-- WARNING WARNING WARNING
-- This file will be overwritten in mod zipfiles, edit bzlib/data-util.lua
-- WARNING WARNING WARNING
local me = require("me")
local util = {}
@ -351,4 +353,54 @@ function util.add_crafting_category(entity_type, entity, category)
end
end
function util.add_to_ingredient(recipe, ingredient, amount)
if data.raw.recipe[recipe] then
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount)
add_to_ingredient(data.raw.recipe[recipe].normal, ingredient, amount)
add_to_ingredient(data.raw.recipe[recipe].expensive, ingredient, amount)
end
end
function add_to_ingredient(recipe, it, amount)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == it then
ingredient.amount = ingredient.amount + amount
return
end
if ingredient[1] == it then
ingredient[2] = ingredients[2] + amount
return
end
end
end
end
function util.add_to_product(recipe, product, amount)
if data.raw.recipe[recipe] then
add_to_product(data.raw.recipe[recipe], product, amount)
add_to_product(data.raw.recipe[recipe].normal, product, amount)
add_to_product(data.raw.recipe[recipe].expensive, product, amount)
end
end
function add_to_product(recipe, product, amount)
if recipe ~= nil and recipe.results ~= nil then
if recipe.result == product then
recipe.result_count = recipe.result_count + amount
return
end
for i, result in pairs(recipe.results) do
if result.name == product then
result.amount = result.amount + amount
return
end
if result[1] == product then
result[2] = result[2] + amount
return
end
end
end
end
return util

View file

@ -1,25 +1,8 @@
-- Additions for Space Exploration mod.
local util = require("__bztitanium__.data-util");
if data.raw.recipe["se-space-pipe"] then
-- Space Exploration space stuff
util.me.steel_to_titanium("se-space-pipe")
util.me.steel_to_titanium("se-space-transport-belt")
util.me.steel_to_titanium("se-space-underground-belt")
util.me.steel_to_titanium("se-space-splitter")
util.me.steel_to_titanium("se-space-rail")
util.me.add_titanium_ingredient(1, "se-space-platform-scaffold")
-- Space Exploration alternative LDS
util.me.steel_to_titanium("se-low-density-structure-beryllium")
-- Space Exploration buildings
util.me.add_titanium_ingredient(20, "se-condenser-turbine")
-- A couple more deeper tech thematic items to use titanium in.
util.me.add_titanium_ingredient(2, "se-lattice-pressure-vessel")
util.me.add_titanium_ingredient(2, "se-aeroframe-bulkhead")
-- Organization
data.raw.item["titanium-plate"].subgroup = "plates"

View file

@ -1,50 +1,2 @@
-- Titanium recipe & tech changes
-- These are in "final" for compatibility with other mods such as Space Exploration, AAI and Krastorio 2
local util = require("__bztitanium__.data-util");
util.me.steel_to_titanium("low-density-structure")
if mods["modmashsplintergold"] then
util.me.steel_to_titanium("low-density-structure-with-gold")
end
if not mods["bobrevamp"] then
util.me.add_titanium_prerequisite("low-density-structure")
end
if (not mods["bobplates"]) then
util.me.steel_to_titanium("flying-robot-frame")
util.me.add_titanium_prerequisite("robotics")
end
if (mods["bobrevamp"] and not mods["bobplates"] and not mods["angelssmelting"]) then
util.me.steel_to_titanium("flying-robot-frame-2")
util.me.steel_to_titanium("flying-robot-frame-3")
util.me.steel_to_titanium("flying-robot-frame-4")
end
-- Memory storage changes
if data.raw.item["memory-unit"] then
util.me.steel_to_titanium("memory-unit")
end
-- Underwater pipes changes
if data.raw.item["underwater-pipe"] then
if data.raw.technology["underwater-pipes"] then
local index = -1
for i, elem in pairs(data.raw.technology["underwater-pipes"].prerequisites) do
if elem == "steel-processing" then
index = i
end
end
if index > -1 then
table.remove(data.raw.technology["underwater-pipes"].prerequisites, index)
end
end
util.me.add_titanium_prerequisite("underwater-pipes")
util.me.steel_to_titanium("underwater-pipe")
end

View file

@ -19,6 +19,56 @@ if (not mods["bobplates"]) then
end
end
util.me.steel_to_titanium("low-density-structure")
if mods["modmashsplintergold"] then
util.me.steel_to_titanium("low-density-structure-with-gold")
end
if not mods["bobrevamp"] then
util.me.add_titanium_prerequisite("low-density-structure")
end
if (not mods["bobplates"]) then
util.me.steel_to_titanium("flying-robot-frame")
util.me.add_titanium_prerequisite("robotics")
end
if (mods["bobrevamp"] and not mods["bobplates"] and not mods["angelssmelting"]) then
util.me.steel_to_titanium("flying-robot-frame-2")
util.me.steel_to_titanium("flying-robot-frame-3")
util.me.steel_to_titanium("flying-robot-frame-4")
end
if data.raw.recipe["se-space-pipe"] then
-- Space Exploration space stuff
util.me.steel_to_titanium("se-space-pipe")
util.me.steel_to_titanium("se-space-transport-belt")
util.me.steel_to_titanium("se-space-underground-belt")
util.me.steel_to_titanium("se-space-splitter")
util.me.steel_to_titanium("se-space-rail")
util.me.add_titanium_ingredient(1, "se-space-platform-scaffold")
-- Space Exploration alternative LDS
util.me.steel_to_titanium("se-low-density-structure-beryllium")
-- Space Exploration buildings
util.me.add_titanium_ingredient(20, "se-condenser-turbine")
-- A couple more deeper tech thematic items to use titanium in.
util.me.add_titanium_ingredient(2, "se-lattice-pressure-vessel")
util.me.add_titanium_ingredient(2, "se-aeroframe-bulkhead")
util.add_ingredient("se-experimental-alloys-data", "titanium-plate", 1)
util.add_to_product("se-experimental-alloys-data", "se-experimental-alloys-data", 1)
util.add_to_product("se-experimental-alloys-data", "se-scrap", 1)
util.add_to_ingredient("se-experimental-alloys-data", "se-empty-data", 1)
end
-- Also add titanium to some nuclear steam-handling stuff
util.me.add_titanium_ingredient(20, "steam-turbine")
@ -52,3 +102,27 @@ end
-- Useful Equipment
util.replace_ingredient("craft-assistent", "iron-plate", "titanium-plate")
util.replace_ingredient("artificial-organ", "iron-plate", "titanium-plate")
-- Memory storage changes
if data.raw.item["memory-unit"] then
util.me.steel_to_titanium("memory-unit")
end
-- Underwater pipes changes
if data.raw.item["underwater-pipe"] then
if data.raw.technology["underwater-pipes"] then
local index = -1
for i, elem in pairs(data.raw.technology["underwater-pipes"].prerequisites) do
if elem == "steel-processing" then
index = i
end
end
if index > -1 then
table.remove(data.raw.technology["underwater-pipes"].prerequisites, index)
end
end
util.me.add_titanium_prerequisite("underwater-pipes")
util.me.steel_to_titanium("underwater-pipe")
end