Migrate towers

This commit is contained in:
numzero 2024-07-17 23:23:13 +03:00
parent 1f97804bbb
commit dfc9ae95aa
2 changed files with 22 additions and 1 deletions

View File

@ -123,4 +123,25 @@ local function find_reactors()
return reactors
end
local function find_towers()
local towers = {}
for name, surface in pairs(game.surfaces) do
for _, entity in ipairs(surface.find_entities_filtered{name=TOWER_ENTITY_NAME}) do
local p = entity.position
local subs = get_subs(surface.find_entities({{p.x-1.5, p.y-1.5}, {p.x+1.5, p.y+1.5}}), {
entity = TOWER_ENTITY_NAME,
steam = STEAM_ENTITY_NAME,
})
local tower = {
id = entity.unit_number,
entity = entity,
steam = subs.steam,
}
towers[tower.id] = tower
end
end
return towers
end
global.reactors = find_reactors()
global.towers = find_towers()

View File

@ -2,7 +2,7 @@ Forked from RealisticReactors due to bugs.
#### Migration from RealisticReactors
Migration from RealisticReactors is partially supported. Reactors should work, however intermediate states (starting or stopping) may not work as expected. Cooling towers should work, though visuals may glitch. Other buildings werent tested yet.
Migration from RealisticReactors is partially supported. Reactors and cooling towers should work, however intermediate states (starting or stopping) may not work as expected.
#### Original description