Rampant, fixed


Based on Rampant 1.1.1 (new AI and enemies). - New types of enemies - Works on SA planets, can control biters, demolishers, Gleba units - Can mutate existing nests - Can attack from afar - Improved search for a passage in the defense - Some new mechanics

Content
10 days ago
1.1 - 2.1
64.9K
Enemies

g I added a function

10 days ago
(updated 10 days ago)

So... I used the admin-button turn everything into vanilla nests and with console I turned the evo 0 because me and my friends were not having fun and we all wanted a full reset.

But we still wanted rampart enemies to spawn, just... Later. So anyways, pressed the button played for hours, did not realize it turns off rampart fully.

Not finding a command to fix it, I entered your GUI_Elements.lua file and pasted the reverse of what that button did:

´´´local function reEnableNewEnemiesNests()
local universe = storage.universe
if not universe then
return "storage.universe not found"
end

universe.NEW_ENEMIES = true

local basesFixed = 0
if universe.bases then
    for _, base in pairs(universe.bases) do
        if base then
            base.thisIsRampantEnemy = true
            basesFixed = basesFixed + 1
        end
    end
end

local totalConverted = 0
if universe.maps then
    for _, map in pairs(universe.maps) do
        local surface = map.surface
        if surface and surface.valid then
            local buildings = surface.find_entities_filtered({force = "enemy", type = {"turret", "unit-spawner"}})
            for i = 1, #buildings do
                local building = buildings[i]
                if building.valid and constants.IS_VANILLA_ENTITY(building.name) then
                    local chunk = mapUtilsG.getChunkByPosition(map, building.position)
                        if chunk ~= -1 then
                            local base = chunkPropertyUtilsG.getChunkBase(map, chunk)
                                if base and base.alignment then
                                local newEntity = baseUtilsG.upgradeEntity(building, base.alignment, map, nil, true)
                                if newEntity then
                                totalConverted = totalConverted + 1
                            end
                        end
                    end
                end
            end
        end
    end
end

local msg = "Rampant: NEW_ENEMIES re-enabled, " .. basesFixed .. " bases flagged, " .. totalConverted .. " vanilla nests converted back to modded"
game.print(msg)
return msg

end´´´

I would like to know if there are like... Any bugs I introduced like this? And additionally maybe add a reverse-reverse button yourself in the future if my code holds strong? <3

LG Futur Planet

9 days ago

Overall, this code should work. I would just note that it affects all nests—even those from mods. As a result, there won't be any modded biters left.

I should also note that you can restore the Rampant biters without an extra button: simply remove the mod, load/save the game, then reinstall the mod and load the save.

9 days ago

Oh... Shit you are right. Well thanks for explaining.

New response