Reformat code

This commit is contained in:
Simon Brodtmann 2025-07-07 23:09:46 +02:00
parent 7134f437e5
commit bac183d1c1
9 changed files with 2438 additions and 2435 deletions

View file

@ -244,14 +244,12 @@ BioInd.show("Need to check these tables in global", compound_entity_tables)
if BioInd.UseMuskForce and not game.forces[BioInd.MuskForceName] then if BioInd.UseMuskForce and not game.forces[BioInd.MuskForceName] then
Create_dummy_force() Create_dummy_force()
end end
end end
-------------------------------------------------------------------- --------------------------------------------------------------------
local function On_Load() local function On_Load()
log("Entered On_Load!") log("Entered On_Load!")
end end
@ -390,7 +388,8 @@ local function On_Built(event)
-- remove anything from it for real. -- remove anything from it for real.
local hidden_entities = util.table.deepcopy(base_entry.hidden) local hidden_entities = util.table.deepcopy(base_entry.hidden)
BioInd.writeDebug("%s (%s) is a compound entity. Need to create %s", {base.name, base.unit_number, hidden_entities}) BioInd.writeDebug("%s (%s) is a compound entity. Need to create %s",
{ base.name, base.unit_number, hidden_entities })
BioInd.show("hidden_entities", hidden_entities) BioInd.show("hidden_entities", hidden_entities)
local new_base local new_base
local new_base_name = base_entry.new_base_name local new_base_name = base_entry.new_base_name
@ -520,7 +519,8 @@ BioInd.show("entity.unit_number", entity.unit_number)
BioInd.show("compound_entity", compound_entity) BioInd.show("compound_entity", compound_entity)
BioInd.show("base_entry", base_entry) BioInd.show("base_entry", base_entry)
BioInd.show("compound_entity.tab", compound_entity and compound_entity.tab or "nil") BioInd.show("compound_entity.tab", compound_entity and compound_entity.tab or "nil")
BioInd.writeDebug("storage[%s]: %s", {compound_entity and compound_entity.tab or "nil", compound_entity and storage[compound_entity.tab] or "nil"}) BioInd.writeDebug("storage[%s]: %s",
{ compound_entity and compound_entity.tab or "nil", compound_entity and storage[compound_entity.tab] or "nil" })
-- Found a compound entity from our list! -- Found a compound entity from our list!
if base_entry then if base_entry then
@ -633,7 +633,6 @@ BioInd.writeDebug("Entered function %s(%s)", {f_name, event})
entity.name == storage.compound_entities["bi-arboretum"].hidden.radar.name or entity.name == storage.compound_entities["bi-arboretum"].hidden.radar.name or
entity.name == "bi-power-to-rail-pole" or entity.name == "bi-power-to-rail-pole" or
entity.name == "seedling" then entity.name == "seedling" then
BioInd.writeDebug("Divert to On_Pre_Remove!") BioInd.writeDebug("Divert to On_Pre_Remove!")
On_Pre_Remove(event) On_Pre_Remove(event)
else else
@ -706,7 +705,6 @@ BioInd.writeDebug("Removing Musk floor tile from tables!")
end end
end end
end end
end end
end end
@ -787,7 +785,6 @@ BioInd.show("Got force from tile data", t.force or "false")
-- Fertilizer/Advanced fertilizer has been used. Check if the tile was valid -- Fertilizer/Advanced fertilizer has been used. Check if the tile was valid
-- (no Musk floor, no wooden floor, no concrete etc.) -- (no Musk floor, no wooden floor, no concrete etc.)
elseif item and (item.name == "fertilizer" or item.name == "bi-adv-fertilizer") then elseif item and (item.name == "fertilizer" or item.name == "bi-adv-fertilizer") then
local restore_tiles = {} local restore_tiles = {}
local products, remove_this local products, remove_this
@ -852,7 +849,6 @@ BioInd.show("restore_tiles", restore_tiles)
BioInd.writeDebug("%s has been built -- nothing to do!", { tile.name }) BioInd.writeDebug("%s has been built -- nothing to do!", { tile.name })
end end
end end
end end

View file

@ -1,4 +1,3 @@
BioInd.writeDebug("Entered control_arboretum.lua") BioInd.writeDebug("Entered control_arboretum.lua")
---Arboretum Stuff ---Arboretum Stuff

View file

@ -1,4 +1,3 @@
-- All tree Growing stuff -- All tree Growing stuff
local Event = require('__kry_stdlib__/stdlib/event/event').set_protected_mode(true) local Event = require('__kry_stdlib__/stdlib/event/event').set_protected_mode(true)
@ -322,7 +321,6 @@ function seed_planted_arboretum(event, entity)
plant_seed(event, 2000, 6000, false) plant_seed(event, 2000, 6000, false)
end end
function summ_weight(tabl) function summ_weight(tabl)
local summ = 0 local summ = 0
for i, tree_weights in pairs(tabl or {}) do for i, tree_weights in pairs(tabl or {}) do
@ -524,7 +522,6 @@ local function Grow_tree_last_stage(last_stage_table)
--- Convert growing tree to fully grown tree --- Convert growing tree to fully grown tree
if (key == "fertilizer" or growth_chance <= fertility) then if (key == "fertilizer" or growth_chance <= fertility) then
-- Grow the new tree -- Grow the new tree
BioInd.writeDebug("Final Tree Name: %s", { final_tree }) BioInd.writeDebug("Final Tree Name: %s", { final_tree })
surface.create_entity({ surface.create_entity({
@ -590,7 +587,6 @@ BioInd.writeDebug("Entered function Grow_tree_stage(%s, %s)", {stage_table, stag
} }
if can_be_placed then if can_be_placed then
if next_stage_tree_name == final_tree then if next_stage_tree_name == final_tree then
BioInd.writeDebug("Tree reached final stage, don't insert") BioInd.writeDebug("Tree reached final stage, don't insert")
surface.create_entity({ surface.create_entity({
@ -613,7 +609,6 @@ BioInd.writeDebug("Entered function Grow_tree_stage(%s, %s)", {stage_table, stag
plant_tree(storage.bi["tree_growing_stage_" .. next_stage], tree_data, true) plant_tree(storage.bi["tree_growing_stage_" .. next_stage], tree_data, true)
end end
end end
else else
BioInd.writeDebug("Did not find that tree I was looking for...") BioInd.writeDebug("Did not find that tree I was looking for...")
end end

View file

@ -20,7 +20,6 @@ BI.Settings.BI_Game_Tweaks_Emissions_Multiplier = settings.startup["BI_Game_Twea
---- Game Tweaks ---- Tree ---- Game Tweaks ---- Tree
if BI.Settings.BI_Game_Tweaks_Tree then if BI.Settings.BI_Game_Tweaks_Tree then
local new_results = { local new_results = {
{ {
type = "item", type = "item",
@ -32,8 +31,11 @@ if BI.Settings.BI_Game_Tweaks_Tree then
for tree_name, tree in pairs(data.raw["tree"] or {}) do for tree_name, tree in pairs(data.raw["tree"] or {}) do
if tree.minable and not ignore_trees[tree_name] then if tree.minable and not ignore_trees[tree_name] then
BioInd.writeDebug("Tree name: %s\tminable.result: %s\tminable.count: %s", {tree.name, (tree.minable and tree.minable.result or "nil"), (tree.minable and tree.minable.count or "nil")}, "line") BioInd.writeDebug("Tree name: %s\tminable.result: %s\tminable.count: %s",
BioInd.writeDebug("Tree name: %s\tminable.results: %s", {tree.name, (tree.minable and tree.minable.results or "nil")}, "line") { tree.name, (tree.minable and tree.minable.result or "nil"), (tree.minable and tree.minable.count or "nil") },
"line")
BioInd.writeDebug("Tree name: %s\tminable.results: %s",
{ tree.name, (tree.minable and tree.minable.results or "nil") }, "line")
--CHECK FOR SINGLE RESULTS --CHECK FOR SINGLE RESULTS
-- mining.result may be set although mining.results exists (mining.result -- mining.result may be set although mining.results exists (mining.result
-- will be ignored in that case; happens, for example with IR2's rubber -- will be ignored in that case; happens, for example with IR2's rubber
@ -138,7 +140,6 @@ BioInd.show("Checking character", char_name)
ignore = false ignore = false
BioInd.show("Found whitelisted character name", char_name) BioInd.show("Found whitelisted character name", char_name)
for b, b_pattern in ipairs(blacklist) do for b, b_pattern in ipairs(blacklist) do
if char_name == b_pattern or char_name:match(b_pattern) then if char_name == b_pattern or char_name:match(b_pattern) then
BioInd.writeDebug("%s is on the ignore list!", char_name) BioInd.writeDebug("%s is on the ignore list!", char_name)
-- Mark character as found -- Mark character as found
@ -201,7 +202,8 @@ if BI.Settings.BI_Game_Tweaks_Bot then
can_insert = true can_insert = true
for r, resistance in pairs(bot.resistances) do for r, resistance in pairs(bot.resistances) do
if resistance.type == "fire" and resistance.percent ~= 100 then if resistance.type == "fire" and resistance.percent ~= 100 then
BioInd.writeDebug("Change resistance against \"fire\" from %s to 100 %% for %s", {resistance.percent or "nil", bot.name}) BioInd.writeDebug("Change resistance against \"fire\" from %s to 100 %% for %s",
{ resistance.percent or "nil", bot.name })
bot.resistances[r] = { type = "fire", percent = 100 } bot.resistances[r] = { type = "fire", percent = 100 }
can_insert = false can_insert = false
break break
@ -325,8 +327,10 @@ if mods["Krastorio2"] then
if recipe.mod == "Bio_Industries_2" then if recipe.mod == "Bio_Industries_2" then
krastorio.recipes.multiplyIngredients(recipe.name, update, 4) krastorio.recipes.multiplyIngredients(recipe.name, update, 4)
krastorio.recipes.multiplyProducts(recipe.name, update, 4) krastorio.recipes.multiplyProducts(recipe.name, update, 4)
BioInd.writeDebug("Changed ingredients for %s: %s", {recipe and recipe.name or "nil", recipe and recipe.ingredients or "nil"}) BioInd.writeDebug("Changed ingredients for %s: %s",
BioInd.writeDebug("Changed results for %s: %s", {recipe and recipe.name or "nil", recipe and recipe.results or "nil"}) { recipe and recipe.name or "nil", recipe and recipe.ingredients or "nil" })
BioInd.writeDebug("Changed results for %s: %s",
{ recipe and recipe.name or "nil", recipe and recipe.results or "nil" })
end end
end end
end end
@ -404,7 +408,6 @@ if mods["space-exploration"] then
end end
if not mods["Natural_Evolution_Buildings"] then if not mods["Natural_Evolution_Buildings"] then
local ammo_tweaks = { local ammo_tweaks = {
["bi-dart-magazine-basic"] = 400, ["bi-dart-magazine-basic"] = 400,
["bi-dart-magazine-standard"] = 400, ["bi-dart-magazine-standard"] = 400,
@ -422,7 +425,8 @@ end
if BI.Settings.Bio_Cannon then if BI.Settings.Bio_Cannon then
local default_target_masks = data.raw["utility-constants"].default.default_trigger_target_mask_by_type local default_target_masks = data.raw["utility-constants"].default.default_trigger_target_mask_by_type
default_target_masks["unit-spawner"] = default_target_masks["unit-spawner"] or {"common"} -- everything should have "common", unless there is specific reason not to default_target_masks["unit-spawner"] = default_target_masks["unit-spawner"] or
{ "common" } -- everything should have "common", unless there is specific reason not to
table.insert(default_target_masks["unit-spawner"], "Bio_Cannon_Ammo") table.insert(default_target_masks["unit-spawner"], "Bio_Cannon_Ammo")
for w, worm in pairs(data.raw.turret) do for w, worm in pairs(data.raw.turret) do

View file

@ -156,7 +156,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-wooden-pole-huge", { thxbob.lib.recipe.add_new_ingredient("bi-wooden-pole-huge", {
type = "item", type = "item",
name = "tinned-copper-cable", name = "tinned-copper-cable",
amount = 15} amount = 15
}
) )
end end
@ -166,7 +167,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-bio-solar-farm", { thxbob.lib.recipe.add_new_ingredient("bi-bio-solar-farm", {
type = "item", type = "item",
name = "solar-panel-large", name = "solar-panel-large",
amount = 30} amount = 30
}
) )
end end
@ -176,7 +178,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-large-substation", { thxbob.lib.recipe.add_new_ingredient("bi-large-substation", {
type = "item", type = "item",
name = "substation-3", name = "substation-3",
amount = 6} amount = 6
}
) )
end end
@ -185,7 +188,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-large-substation", { thxbob.lib.recipe.add_new_ingredient("bi-large-substation", {
type = "item", type = "item",
name = "electrum-alloy", name = "electrum-alloy",
amount = 10} amount = 10
}
) )
end end
@ -195,7 +199,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-bio-accumulator", { thxbob.lib.recipe.add_new_ingredient("bi-bio-accumulator", {
type = "item", type = "item",
name = "large-accumulator", name = "large-accumulator",
amount = 30} amount = 30
}
) )
end end
@ -204,7 +209,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-bio-accumulator", { thxbob.lib.recipe.add_new_ingredient("bi-bio-accumulator", {
type = "item", type = "item",
name = "aluminium-plate", name = "aluminium-plate",
amount = 50} amount = 50
}
) )
end end
@ -214,7 +220,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-solar-mat", { thxbob.lib.recipe.add_new_ingredient("bi-solar-mat", {
type = "item", type = "item",
name = "aluminium-plate", name = "aluminium-plate",
amount = 1} amount = 1
}
) )
end end
@ -223,7 +230,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-solar-mat", { thxbob.lib.recipe.add_new_ingredient("bi-solar-mat", {
type = "item", type = "item",
name = "silicon-wafer", name = "silicon-wafer",
amount = 4} amount = 4
}
) )
end end
@ -233,7 +241,8 @@ if BI.Settings.BI_Solar_Additions then
thxbob.lib.recipe.add_new_ingredient("bi-solar-boiler-hidden-panel", { thxbob.lib.recipe.add_new_ingredient("bi-solar-boiler-hidden-panel", {
type = "item", type = "item",
name = "angels-electric-boiler", name = "angels-electric-boiler",
amount = 1} amount = 1
}
) )
end end
end end
@ -294,7 +303,8 @@ if data.raw.item["alien-artifact"] then
thxbob.lib.recipe.add_new_ingredient("bi-adv-fertilizer-1", { thxbob.lib.recipe.add_new_ingredient("bi-adv-fertilizer-1", {
type = "item", type = "item",
name = "alien-artifact", name = "alien-artifact",
amount = 5} amount = 5
}
) )
thxbob.lib.tech.add_recipe_unlock("bi-tech-advanced-biotechnology", "bi-adv-fertilizer-1") thxbob.lib.tech.add_recipe_unlock("bi-tech-advanced-biotechnology", "bi-adv-fertilizer-1")
end end
@ -307,7 +317,8 @@ if mods["Natural_Evolution_Buildings"] then
thxbob.lib.recipe.add_new_ingredient("bi-adv-fertilizer-1", { thxbob.lib.recipe.add_new_ingredient("bi-adv-fertilizer-1", {
type = "fluid", type = "fluid",
name = "NE_enhanced-nutrient-solution", name = "NE_enhanced-nutrient-solution",
amount = 50} amount = 50
}
) )
end end
@ -540,7 +551,6 @@ if BI.Settings.BI_Game_Tweaks_Disassemble then
}) do }) do
thxbob.lib.tech.add_recipe_unlock(tech, recipe) thxbob.lib.tech.add_recipe_unlock(tech, recipe)
end end
end end
--- Enable Productivity in Recipes --- Enable Productivity in Recipes

View file

@ -96,7 +96,6 @@ if not mods["Natural_Evolution_Buildings"] then
require("prototypes.Bio_Cannon.projectiles-item") require("prototypes.Bio_Cannon.projectiles-item")
require("prototypes.Bio_Cannon.projectiles-recipe") require("prototypes.Bio_Cannon.projectiles-recipe")
require("prototypes.Bio_Cannon.projectiles-entity") require("prototypes.Bio_Cannon.projectiles-entity")
end end
---- Add Bio Fuel & Plastic, etc. ---- Add Bio Fuel & Plastic, etc.