Reformat code

This commit is contained in:
Simon Brodtmann 2025-07-05 22:32:57 +02:00
parent 3051414d98
commit 4354438098
29 changed files with 1870 additions and 1865 deletions

View file

@ -260,7 +260,6 @@ return function(mod_name)
------------------------------------------------------------------------------------
-- Are tiles from Alien Biomes available? (Returns true or false)
common.AB_tiles = function()
local ret = false
if game then
@ -379,7 +378,8 @@ common.show("storage[tab]", storage[tab] or "nil")
common.clean_global_compounds_table = function(entity_name)
local f_name = "clean_table"
common.writeDebug("Entered function %s(%s)", { f_name, entity_name or "nil" })
common.writeDebug("Entries in common.compound_entities[%s]: %s", {entity_name, table_size(storage.compound_entities[entity_name])})
common.writeDebug("Entries in common.compound_entities[%s]: %s",
{ entity_name, table_size(storage.compound_entities[entity_name]) })
local entity_table = storage.compound_entities[entity_name]
common.show("entity_table", entity_table and entity_table.tab)
@ -415,7 +415,8 @@ common.show("Pruned list size", table_size(entity_table))
common.restore_missing_entities = function(entity_name)
local f_name = "restore_missing_entities"
common.writeDebug("Entered function %s(%s)", { f_name, entity_name or "nil" })
common.writeDebug("storage.compound_entities[%s]: %s entries", {entity_name, table_size(storage.compound_entities[entity_name])})
common.writeDebug("storage.compound_entities[%s]: %s entries",
{ entity_name, table_size(storage.compound_entities[entity_name]) })
local check = storage.compound_entities[entity_name]
local entity_table = check and storage[check.tab] or {}
@ -651,12 +652,16 @@ common.writeDebug("\"Easy gardens\": Compiling list of poles they can connect to
ret = {}
local poles = prototypes.get_entity_filtered({
{ filter = "type", type = "electric-pole" },
{filter = "name", name = {
{
filter = "name",
name = {
-- Poles named here will be ignored!
"bi-rail-power-hidden-pole",
"bi-musk-mat-hidden-pole",
"bi-bio-garden-hidden-pole"
}, invert = "true", mode = "and"
},
invert = "true",
mode = "and"
}
})
for p, pole in pairs(poles) do
@ -733,7 +738,6 @@ common.writeDebug("Connected pole %g to neighbour %s (%g): %s",
-- added to the table yet if the pole has just been built. In this
-- case, we pass on the new pole explicitly!)
common.connect_power_rail = function(base, new_pole)
local pole = storage.bi_power_rail_table[base.unit_number].pole or new_pole
if pole and pole.valid then
-- Remove all copper wires from new pole
@ -751,7 +755,8 @@ common.writeDebug("Looking for rails in %s direction", {direction})
rail_direction = defines.rail_direction[side],
rail_connection_direction = defines.rail_connection_direction[direction]
}
common.writeDebug("Rail %s of %s (%s): %s (%s)", {direction, base.name, base.unit_number, (neighbour and neighbour.name or "nil"), (neighbour and neighbour.unit_number or "nil")})
common.writeDebug("Rail %s of %s (%s): %s (%s)",
{ direction, base.name, base.unit_number, (neighbour and neighbour.name or "nil"), (neighbour and neighbour.unit_number or "nil") })
-- Only make a connection if found rail is a powered rail
-- (We'll know it's the right type if we find it in our table!)
@ -774,7 +779,8 @@ common.writeDebug("Rail %s of %s (%s): %s (%s)", {direction, base.name, base.uni
pole.connect_neighbour(connector[1])
common.writeDebug("Connected " .. pole.name .. " (" .. pole.unit_number ..
") to " .. connector[1].name .. " (" .. connector[1].unit_number .. ")")
common.writeDebug("Connected %s (%g) to %s (%g)", {pole.name, pole.unit_number, connector[1].name, connector[1].unit_number})
common.writeDebug("Connected %s (%g) to %s (%g)",
{ pole.name, pole.unit_number, connector[1].name, connector[1].unit_number })
end
common.writeDebug("Stored %s (%g) in global table", { base.name, base.unit_number })
end
@ -794,7 +800,6 @@ common.writeDebug("Rail %s of %s (%s): %s (%s)", {direction, base.name, base.uni
common.BI_add_icons = function()
for tab_name, tab in pairs(data.raw) do
for proto_type_name, proto_type in pairs(data.raw[tab_name] or {}) do
if proto_type.BI_add_icon then
proto_type.icons = {
{