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
2 days ago
1.1 - 2.0
44.5K
Enemies

g ERM

5 months ago

hey, im start discussion - https://mods.factorio.com/mod/enemyracemanager/discussion/67ef1b05f5328f0d2bf1b96c - with this mod bitters haven't quality

5 months ago

sorry - emr quality have (standart,common,etc - but havent quality from https://mods.factorio.com/mod/entrenched-enemies (rare,epic,etc,,.)

5 months ago

Anyway, if you install the "Quality for Biters!" mod, then the Rampant's biters and nests will be of increased quality

5 months ago

the Rampant's biters and nests will be of increased quality - not ( im test on 100 evo(set from gui) - levels bitters haven't quality

5 months ago

My mod does nothing about "quality". All such effects you should get with other mods, for example, the one I pointed out earlier. In it, both nests and biters are of higher quality, up to and including legendary.
I don't know if you need to start a game with it or if you can put it on an existing save, I only saw the stream

5 months ago

Hey Dimm ( entrenched-enemies modder ), haven't looked at any code yet to see how to make this work, just an FYI my mod simply is increasing the quality level of the nest and when you do that the game automatically spawns all units at the quality level of the nest So it might actually make sense to add a check on the unit spawns you do to pass through whatever the quality level of the nest currently is to mimic default behaviour of the game.

But i don't want to have to burdon you with that requirement so if it is easy to add rampant as an optional dependency ill try and figure it out.

5 months ago

i had a quick look at the source code, you do have a lot of places deleting entities and creating them depending on the task like evolving them or replacing vanilla spawners. Would be a big effort to grab quality and then pass it into all the places you create it.

I currently only activate / do quality replacements on the following events "on_biter_base_built" and "on_chunk_generated" ill have to lean into on_entity_spawned to pickup these custom nests to apply it too and can only hope the same magic will occur and your custom biters will spawn with quality.

5 months ago

well this looks like it will be a joint venture to do it properly in a UPS friendly way, is it possible you can fire off a "script_raised_built" when you make an entity?

https://lua-api.factorio.com/latest/events.html#script_raised_built

im going to add support so that if any mods raise a spawner / turret i will pass it into the quality system for recreation.

5 months ago

the easiest solution i guess would be everywhere you have a create entity to put the var "raise_built: true" inside it,

https://lua-api.factorio.com/latest/classes/LuaSurface.html#create_entity

5 months ago

I'm not sure if this won't lead to an infinite loop: create entity when event is processed -> fire event, especially when multiple mods will process the event
It might be worth trying the option where I preserve the quality of the nests when replacing them first

5 months ago

the inifinite loop is easily avoidable, i think you should do both, if you didn't pass in quality or fire the event i would need to read your code to know how many ticks after chunk spawn you recreate the bases, add a tick delay slightly longer then fetch all bases in that chunk and redo them.

With you firing the events ( no quality pass through ) i could specifically do an on event and check if the event was done by your mod ( make you an optional dependency ) and when you recreate bases i could then recreate them with quality.

With you passing through the quality ( i don't need to do anything not even optional dependency ).

If you ever recreate bases the moment they are made instead of n ticks later and don't fire events it is likely one of us will get an entity that is already null from the other person deleting it ( who knows which one of us it could be random per entity ). we both likely early return if its null and a base exists that was never "fixed" by the other mod which is where the raised_built is useful. firing this event would let you walk away from being n tickets behind and instead do it in the on event right away for base replacing and any other mods with compat issues simply need to leverage the raised_built by both firing it and using it to know when a new base is made by someone else they might need to edit. You would also leverage it with some kind of map to not edit a base at the same location twice and only delete / create if it's not what you wanted.

doing something like this to avoid infinite loops isn't too bad.

global.my_mod_processed_spawners = global.my_mod_processed_spawners or {}

local function get_spawner_key(surface, position)
return surface.name .. "" .. math.floor(position.x) .. "" .. math.floor(position.y)
end

local function on_entity_built(event)
local entity = event.created_entity or event.entity
if entity.valid and entity.type == "unit-spawner" then
local key = get_spawner_key(entity.surface, entity.position)
if global.my_mod_processed_spawners[key] then
return -- Already processed at this location
end
.........
global.my_mod_processed_spawners[key] = true
end

This would be a very basic solve, you likely want to use a TTL on the array so if its over a few minute old it likely doesn't count and is a "brand new" one again.

The one thing im not sure about is if we should use the create & destroy events as part of the entity destroy / create func calls or if we should instead send a "revive" event which would signal "this base didn't come from nowhere i recreated something that existed"

5 months ago

hey - in ERM https://github.com/heyqule/enemy_race_manager/blob/main/Mod-Compatibility.md

Rampant AI (limited, may have interferences)
It works with default settings. However, its AI code only work for "enemy" force. It does not affect custom enemy forces.
It may interfere with ERM custom attack groups.
New enemies placement does not work.

can fixed new enimies?

5 months ago
(updated 5 months ago)

Everything written there applies to the standart Rampant.
Rampant Fixed controls only his own groups. The only exception is the starting peace time. During this period, he cancels any attacks from the Enemy faction.
So, Rampant Fixed cannot interfere with attacks of standard AI and other mods in any way

New response