Ability to read spawner current chances
Posted: Wed Jan 08, 2020 10:44 am
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
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