Nauvis Post Collapse Demo


CURRENTLY WORKING ON VERSION 2.0 https://discord.gg/NTJF88UWhC

Scenarios
4 years ago
1.0 - 1.1
2.06K

g Few commands for better performance

3 months ago
(updated 3 months ago)

This map uses a few things that aren't designed for decorative purposes that kill the performance namely: cars and power poles

Deleting all disconnected power poles (standalone power lines, if it has a light it will stay), there is no downside running it. My power network update time dropped by a factor of 10:
/c
do
local types = {"wall", "unit", "gate", "curved-rail", "straight-rail"}
local surface = game.player.surface
local force = game.player.force
local forces = {}
for k, frc in pairs(game.forces) do
if frc ~= force then
table.insert(forces, k)
end
end
local entities = surface.find_entities_filtered{force = forces, type = types, invert = true}
local networks = {}
for k, entity in pairs(entities) do
local network = entity.electric_network_id
if network then
if not networks[network] then
networks[network] = {has_consumers = false, poles = {}}
end
local net = networks[network]
if not net["has_consumers"] then
if entity.type ~= "electric-pole" then
net["has_consumers"] = true
else
table.insert(net["poles"], entity)
end
end
end
end
local cntNet = 0
local cntPoles = 0
for k,network in pairs(networks) do
if not network.has_consumers then
cntNet = cntNet + 1
for k, pole in ipairs(network.poles) do
cntPoles = cntPoles + 1
pole.destroy()
end
end
end
game.player.print("Removed " .. cntPoles .. " power poles across " .. cntNet .. " disconnected power networks")
end

DON'T RUN IT STRAIGHT AWAY!

Since the cars are there to tell the story, deleting them straight away would ruin the storytelling. It won't delete any cars in areas you haven't explored yet. Run at will as you explore.
WARNING: This will delete also YOUR car, there are no checks to prevent it.
/c
do
local surface = game.player.surface
local force = game.player.force
local entities = surface.find_entities_filtered{name = 'car'}
local cnt = 0
for k, car in pairs(entities) do
local position = car.position
if force.is_chunk_charted(surface, {math.floor(position.x/32), math.floor(position.y/32)}) then
cnt = cnt + 1
car.destroy()
end
end
game.player.print("Removed " .. cnt .. " cars")
end

BONUS
Deletes all ghosts. There is 820 ghosts at the beginning of the game and this will make the bots behave smoother. Run as needed, usually useful when biters destroy a lot of walls in the city you don't care about. WARNING: It WILL destroy YOUR ghosts you want built.
/c
do
local surface = game.player.surface
local entities = surface.find_entities_filtered{type = 'entity-ghost'}
local cnt = 0
for k, ghost in pairs(entities) do
ghost.destroy()
cnt = cnt + 1
end
game.player.print("Removed " .. cnt .. " ghosts")
end

BONUS 2
There are random indestructible nests and worms, this will make them destructible again. Run at the start of the game:
/c
do
local surface = game.player.surface
local types = {"turret", "unit-spawner"}
local enemy = game.forces.enemy
local entities = surface.find_entities_filtered{force = enemy, type = types}
local marked = {}
for k, entity in pairs(entities) do
if not entity.destructible then
if not marked[entity.name] then
marked[entity.name] = 0
end
marked[entity.name] = marked[entity.name] + 1
entity.destructible = true
end
end
for name,cnt in pairs(marked) do
if cnt > 0 then
game.player.print("Set " .. cnt .. " of " .. name .. " to destructible")
end
end
end

New response