mirror of
https://github.com/veden/Rampant.git
synced 2025-03-17 20:58:35 +02:00
changed argument to entityUpgrade to base instead of alignment
This commit is contained in:
parent
ca72e200cb
commit
9ea16e6a82
@ -674,7 +674,7 @@ local function onEnemyBaseBuild(event)
|
||||
registerEnemyBaseStructure(map, entity, event.tick, base)
|
||||
|
||||
upgradeEntity(entity,
|
||||
base.alignment,
|
||||
base,
|
||||
map,
|
||||
nil,
|
||||
true,
|
||||
@ -846,7 +846,7 @@ local function onEntitySpawned(event)
|
||||
registerEnemyBaseStructure(map, entity, event.tick, base)
|
||||
|
||||
upgradeEntity(entity,
|
||||
base.alignment,
|
||||
base,
|
||||
map,
|
||||
disPos,
|
||||
true,
|
||||
|
@ -254,12 +254,13 @@ function baseUtils.recycleBases(map)
|
||||
end
|
||||
end
|
||||
|
||||
function baseUtils.upgradeEntity(entity, baseAlignment, map, disPos, evolve, register)
|
||||
function baseUtils.upgradeEntity(entity, base, map, disPos, evolve, register)
|
||||
local position = entity.position
|
||||
local currentEvo = entity.prototype.build_base_evolution_requirement or 0
|
||||
|
||||
local distance = mMin(1, euclideanDistancePoints(position.x, position.y, 0, 0) * BASE_DISTANCE_TO_EVO_INDEX)
|
||||
local evoIndex = mMax(distance, map.evolutionLevel)
|
||||
local baseAlignment = base.alignment
|
||||
|
||||
local pickedBaseAlignment
|
||||
if (#baseAlignment == 2) then
|
||||
@ -282,7 +283,8 @@ function baseUtils.upgradeEntity(entity, baseAlignment, map, disPos, evolve, reg
|
||||
local entityData = {
|
||||
["name"] = spawnerName,
|
||||
["position"] = disPos,
|
||||
["register"] = register
|
||||
["register"] = register,
|
||||
["base"] = base
|
||||
}
|
||||
map.pendingUpgrades[entity] = entityData
|
||||
return spawnerName
|
||||
@ -400,7 +402,7 @@ function baseUtils.processBase(chunk, map, tick, base)
|
||||
local cost = (universe.costLookup[entity.name] or MAGIC_MAXIMUM_NUMBER)
|
||||
if (base.points >= cost) then
|
||||
local newEntity = baseUtils.upgradeEntity(entity,
|
||||
base.alignment,
|
||||
base,
|
||||
map)
|
||||
if newEntity then
|
||||
if universe.printBaseUpgrades then
|
||||
|
@ -154,7 +154,7 @@ function chunkProcessor.processPendingUpgrades(map, tick)
|
||||
end
|
||||
local createdEntity = surface.create_entity(query)
|
||||
if createdEntity and createdEntity.valid then
|
||||
registerEnemyBaseStructure(map, createdEntity, tick)
|
||||
registerEnemyBaseStructure(map, createdEntity, tick, entityData.base)
|
||||
end
|
||||
else
|
||||
map.pendingUpgradeIterator = next(pendingUpgrades, entity)
|
||||
|
@ -235,7 +235,6 @@ function chunkUtils.initialScan(chunk, map, tick)
|
||||
if not base then
|
||||
base = createBase(map, chunk, tick)
|
||||
end
|
||||
local alignment = base.alignment
|
||||
|
||||
local unitList = surface.find_entities_filtered(universe.filteredEntitiesUnitQuery)
|
||||
for i=1,#unitList do
|
||||
@ -250,7 +249,7 @@ function chunkUtils.initialScan(chunk, map, tick)
|
||||
|
||||
chunkUtils.registerEnemyBaseStructure(map, enemyBuilding, tick, base)
|
||||
if not buildingHiveTypeLookup[enemyBuilding.name] then
|
||||
upgradeEntity(enemyBuilding, alignment, map, nil, true)
|
||||
upgradeEntity(enemyBuilding, base, map, nil, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user