Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove stdlib #49

Merged
merged 13 commits into from
May 28, 2024
Merged
6 changes: 2 additions & 4 deletions cached-configs/run.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local Table = require('__stdlib__/stdlib/utils/table')

local function merge(table, value)
for k, v in pairs(value) do
if type(v) == 'table' and k ~= 'prerequisites' and k ~= 'ingredients' then
Expand Down Expand Up @@ -68,8 +66,8 @@ for _, cache_file_info in pairs(pypp_registered_cache_files) do
union_of_all_subsets[mod] = 1
end
end
union_of_all_subsets = Table.keys(union_of_all_subsets)
local recognized_enabled_mods = Table.filter(union_of_all_subsets, function(potential_mod) return mods[potential_mod] end)
union_of_all_subsets = table.keys(union_of_all_subsets)
local recognized_enabled_mods = table.filter(union_of_all_subsets, function(potential_mod) return mods[potential_mod] end)
table.sort(recognized_enabled_mods)

if #recognized_enabled_mods == 0 then
Expand Down
21 changes: 8 additions & 13 deletions data-final-fixes.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
local dev_mode = settings.startup['pypp-dev-mode'].value
local create_cache_mode = settings.startup['pypp-create-cache'].value

require('__stdlib__/stdlib/data/data').Util.create_data_globals()

local table = require('__stdlib__/stdlib/utils/table')
local config = require 'prototypes.config'

for _, module in pairs(data.raw.module) do
Expand All @@ -16,7 +12,7 @@ for _, module in pairs(data.raw.module) do
end

if not table.is_empty(remove_recipe) then
local limit = table.array_to_dictionary(module.limitation, true)
local limit = table.invert(module.limitation)

for r, _ in pairs(remove_recipe) do
limit[r] = nil
Expand All @@ -34,7 +30,7 @@ for _, module in pairs(data.raw.module) do
end

if not table.is_empty(remove_recipe) then
local limit = table.array_to_dictionary(module.limitation_blacklist, true)
local limit = table.invert(module.limitation_blacklist)

for r, _ in pairs(remove_recipe) do
limit[r] = nil
Expand Down Expand Up @@ -197,7 +193,7 @@ local function create_tmp_tech(recipe, original_tech, add_dependency)
}
}

RECIPE(recipe):set_enabled(false)
RECIPE(recipe).enabled = false

if original_tech then
RECIPE(recipe):remove_unlock(original_tech)
Expand All @@ -217,11 +213,10 @@ if mods['PyBlock'] then
end

if mods.pycoalprocessing and not mods['extended-descriptions'] then
local FUN = require('__pycoalprocessing__/prototypes/functions/functions')
for _, recipe in pairs(data.raw.module['productivity-module'].limitation or {}) do
for _, recipe in pairs(data.raw.module['productivity-module'].limitation or {}) do
recipe = data.raw.recipe[recipe]
if recipe then
FUN.add_to_description('recipe', recipe, {'recipe-description.affected-by-productivity'})
py.add_to_description('recipe', recipe, {'recipe-description.affected-by-productivity'})
end
end
end
Expand Down Expand Up @@ -261,7 +256,7 @@ if dev_mode then
end

log('AUTOTECH START')
local at = require('prototypes.functions.auto_tech').create()
local at = require 'prototypes.functions.auto_tech'.create()
at:run()
if create_cache_mode then
at:create_cachefile_code()
Expand All @@ -274,7 +269,7 @@ end
----------------------------------------------------
-- THIRD PARTY COMPATIBILITY
----------------------------------------------------
require('prototypes/functions/compatibility')
require 'prototypes/functions/compatibility'

----------------------------------------------------
-- TECHNOLOGY CHANGES
Expand Down Expand Up @@ -342,7 +337,7 @@ end

-- YAFC
if type(data.data_crawler) == 'string' and string.sub(data.data_crawler, 1, 5) == 'yafc ' then
require('prototypes/yafc')
require 'prototypes/yafc'
end

-- force mining drill speed to not increase with speed modules
Expand Down
9 changes: 3 additions & 6 deletions data-updates.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
local py_utils = require('prototypes.functions.utils')
require('__stdlib__/stdlib/data/data').Util.create_data_globals()

local function set_underground_recipe(underground, belt, prev_underground, prev_belt)
local dist = data.raw['underground-belt'][underground].max_distance + 1
local prev_dist = 0

if prev_underground then
prev_dist = data.raw['underground-belt'][prev_underground].max_distance + 1
local recipe_data = data.raw.recipe[belt].normal or data.raw.recipe[belt]
local belt_count = py_utils.standardize_products(recipe_data.results, nil, recipe_data.result, recipe_data.result_count)[1].amount
local recipe = data.raw.recipe[belt]:standardize()
local belt_count = recipe.ingredients[1].amount
local fluid = false

for _, ing in pairs(py_utils.standardize_products(recipe_data.ingredients)) do
for _, ing in pairs(recipe.ingredients) do
if ing.name ~= prev_belt then
RECIPE(underground):remove_ingredient(ing.name)
:add_ingredient{ type = ing.type, name = ing.name, amount = ing.amount * prev_dist / belt_count}
Expand Down
Binary file added empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion info.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"description": "Post-processing steps for Pyanodons modpack. Overhauls the technology tree to make sure prerequisites are set based on unlocked recipes.",
"dependencies": [
"base >= 1.1.0",
"stdlib >= 1.4.0",
"? pycoalprocessing",
"? pyindustry",
"? pyfusionenergy",
Expand Down
3 changes: 3 additions & 0 deletions lib.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if py then return py end
require 'lib.lib'
return py
Loading
Loading