mirror of
https://github.com/veden/Rampant.git
synced 2025-03-17 20:58:35 +02:00
FACTO-44: Hive entity initialization not respecting proxy type
This commit is contained in:
parent
85fa3095f8
commit
40afcf3f37
@ -15,7 +15,9 @@ Date: 29. 12. 2021
|
||||
- Fixed removing chunks could index outside processQueueLength (Thanks thecheat789 for the report)
|
||||
- Fixed processMap and processStaticMap could index outside processQueueLength
|
||||
- Fixed base alignments could be blank when removing factions (Thanks kind_killer for the report)
|
||||
- Fixed hive proxy entities would not be destroyed or upgraded correctly
|
||||
- Fixed hive proxy entities would occasionally not be destroyed or upgraded correctly
|
||||
- Fixed hive proxy entities not respecting initial proxy type when determining initial upgrades
|
||||
- Fixed hive entities being initialized from turrets
|
||||
Optimizations:
|
||||
- Added early stopping to removeProcessQueueChunk
|
||||
|
||||
|
@ -134,7 +134,7 @@ local function findBaseMutation(map, targetEvolution)
|
||||
return alignments[#alignments]
|
||||
end
|
||||
|
||||
local function initialEntityUpgrade(baseAlignment, tier, maxTier, map, useHiveType)
|
||||
local function initialEntityUpgrade(baseAlignment, tier, maxTier, map, useHiveType, entityType)
|
||||
local evolutionTable = map.universe.buildingEvolveLookup
|
||||
local entity
|
||||
|
||||
@ -165,16 +165,22 @@ local function initialEntityUpgrade(baseAlignment, tier, maxTier, map, useHiveTy
|
||||
end
|
||||
end
|
||||
if not entity then
|
||||
local roll = map.random()
|
||||
|
||||
for ui=1,#upgrades do
|
||||
local upgrade = upgrades[ui]
|
||||
|
||||
roll = roll - upgrade[1]
|
||||
|
||||
if (roll <= 0) then
|
||||
if upgrade[3] == entityType then
|
||||
entity = upgrade[2][map.random(#upgrade[2])]
|
||||
break
|
||||
end
|
||||
end
|
||||
if not entity then
|
||||
local mapTypes = FACTION_MUTATION_MAPPING[entityType]
|
||||
for i=1, #mapTypes do
|
||||
local mappedType = mapTypes[i]
|
||||
for ui=1,#upgrades do
|
||||
local upgrade = upgrades[ui]
|
||||
if upgrade[3] == mappedType then
|
||||
return upgrade[2][map.random(#upgrade[2])]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -231,9 +237,19 @@ local function findEntityUpgrade(baseAlignment, currentEvo, evoIndex, originalEn
|
||||
|
||||
if evolve then
|
||||
local chunk = getChunkByPosition(map, originalEntity.position)
|
||||
local makeHive = (chunk ~= -1) and (getResourceGenerator(map, chunk) > 0) and (map.random() < 0.2)
|
||||
print(originalEntity.unit_number, makeHive)
|
||||
return initialEntityUpgrade(baseAlignment, tier, maxTier, map, (makeHive and "hive"))
|
||||
local entityType = map.universe.buildingHiveTypeLookup[originalEntity.name]
|
||||
if not entityType then
|
||||
if map.random() < 0.5 then
|
||||
entityType = "biter-spawner"
|
||||
else
|
||||
entityType = "spitter-spawner"
|
||||
end
|
||||
end
|
||||
local makeHive = (chunk ~= -1) and
|
||||
(getResourceGenerator(map, chunk) > 0) and
|
||||
((entityType == "biter-spawner") or (entityType == "spitter-spawner"))
|
||||
and (map.random() < 0.2)
|
||||
return initialEntityUpgrade(baseAlignment, tier, maxTier, map, (makeHive and "hive"), entityType)
|
||||
else
|
||||
return entityUpgrade(baseAlignment, tier, maxTier, originalEntity, map)
|
||||
end
|
||||
@ -573,6 +589,13 @@ function baseUtils.rebuildNativeTables(universe, rg)
|
||||
evoToTierMapping[#evoToTierMapping+1] = (((i - 1) * 0.1) ^ 0.5) - 0.05
|
||||
end
|
||||
|
||||
buildingHiveTypeLookup["biter-spawner"] = "biter-spawner"
|
||||
buildingHiveTypeLookup["spitter-spawner"] = "spitter-spawner"
|
||||
buildingHiveTypeLookup["small-worm-turret"] = "turret"
|
||||
buildingHiveTypeLookup["medium-worm-turret"] = "turret"
|
||||
buildingHiveTypeLookup["big-worm-turret"] = "turret"
|
||||
buildingHiveTypeLookup["behemoth-worm-turret"] = "turret"
|
||||
|
||||
for i=1,#FACTION_SET do
|
||||
local faction = FACTION_SET[i]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user