1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-26 20:54:12 +02:00

FACTO-1: Fixed hives producing excess entities an a area

This commit is contained in:
Aaron Veden 2022-01-16 15:27:52 -08:00
parent 40afcf3f37
commit 981293c8e7
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
3 changed files with 18 additions and 22 deletions

View File

@ -10,6 +10,7 @@ Date: 29. 12. 2021
- Removed chance of hive outside resoure chunks on settler structure creation
- Separated mod setting into printing settlers building and ai spending points
Bugfixes:
- Fixed Hives spawning excessive amounts of entities
- Fixed chunkPack nil in processNests (Thanks Skallywaggz for the report)
- Fixed random generator seed overflow (Thanks NeveHanter for the report)
- Fixed removing chunks could index outside processQueueLength (Thanks thecheat789 for the report)

View File

@ -24,11 +24,13 @@ local chunkProcessor = {}
local chunkUtils = require("ChunkUtils")
local queryUtils = require("QueryUtils")
local mapUtils = require("MapUtils")
local constants = require("Constants")
-- local constants = require("Constants")
-- constants
local CHUNK_SIZE = constants.CHUNK_SIZE
-- local CHUNK_SIZE = constants.CHUNK_SIZE
-- local HALF_CHUNK_SIZE = constants.HALF_CHUNK_SIZE
-- local QUARTER_CHUNK_SIZE = constants.QUARTER_CHUNK_SIZE
-- imported functions
@ -179,28 +181,19 @@ function chunkProcessor.processPendingUpgrades(universe, tick)
local query = universe.ppuUpgradeEntityQuery
local position = entityData.position or entity.position
query.name = entityData.name
local foundPosition
if universe.NEW_ENEMIES then
foundPosition = surface.find_non_colliding_position(universe.buildingSpaceLookup[entityData.name],
position,
CHUNK_SIZE,
1,
true)
else
foundPosition = surface.find_non_colliding_position(entityData.name,
position,
CHUNK_SIZE,
1,
true)
end
setPositionInQuery(query, foundPosition or position)
unregisterEnemyBaseStructure(entityData.map, entity, nil, true)
entity.destroy()
local foundPosition = surface.find_non_colliding_position(universe.buildingSpaceLookup[entityData.name],
position,
2,
1,
true)
setPositionInQuery(query, foundPosition or position)
local createdEntity = surface.create_entity(query)
if createdEntity and createdEntity.valid then
registerEnemyBaseStructure(entityData.map, createdEntity, tick, entityData.base, true)
if remote.interfaces["kr-creep"] then
remote.call("kr-creep", "spawn_creep_at_position", surface, position)
remote.call("kr-creep", "spawn_creep_at_position", surface, foundPosition or position)
end
end
else

View File

@ -70,8 +70,8 @@ local function generateCollisionBox(scale, entityType)
end
local scales = {
["trap"] = {},
["utility"] = {},
-- ["trap"] = {},
-- ["utility"] = {},
["spitter-spawner"] = {
[1] = 0.70, [2] = 0.83, [3] = 0.96, [4] = 1.09, [5] = 1.22,
[6] = 1.35, [7] = 1.48, [8] = 1.61, [9] = 1.74, [10] = 1.87
@ -96,7 +96,8 @@ for si=1,#subTypes do
local st = subTypes[si]
if scales[st] then
for t=1,10 do
local scale = scales[st][t]
-- local scale = scales[st][t]
local scale = scales["biter-spawner"][t]
data:extend(
{
@ -114,7 +115,8 @@ for si=1,#subTypes do
corpse = nil,
timeout = 1,
trigger_radius = 0,
collision_box = generateCollisionBox(scale, st),
-- collision_box = generateCollisionBox(scale, st),
collision_box = generateCollisionBox(scale, "biter-spawner"),
selection_box = nil,
picture_safe =