Ability to read spawner current chances

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
randomdude
Inserter
Inserter
Posts: 43
Joined: Mon Mar 12, 2018 9:01 am
Contact:

Ability to read spawner current chances

Post by randomdude »

Right now, there is no way to manually create biter units based on the current evolution weights for a given spawner.

In biter battles units are manually spawned when the units around a nest are not enough to match the desired group size.

Right now it does a heavy find_entities_filtered filtered by type=unit and calculates the distribution by hand. There are ways to improve it by using other methods like LuaForce.get_entity_count, or reading the prototype distributions and maybe interpolating (linearly?) between them to get the actual distribution, but maybe it would be easier if those values were exposed.

Or even better, add a function to spawners to create_unit, similar to create_entity, that handles internally the chance of each unit type and position of the newly created unit, so none of this needs to be done by the script or exposed

Post Reply

Return to “Modding interface requests”