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

FACTO-44: Fixing up hive proxy entities not be upgraded or destroyed

This commit is contained in:
Aaron Veden 2022-01-14 21:01:00 -08:00
parent ae43875a21
commit 85fa3095f8
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
5 changed files with 107 additions and 58 deletions

View File

@ -596,6 +596,20 @@ function upgrade.attempt(universe)
end
end
for _,map in pairs(universe.maps) do
if (map.surface.valid) then
local entities = map.surface.find_entities_filtered({type="land-mine"})
for i=1,#entities do
local entity = entities[i]
if entity.valid and string.find(entity.name, "entity-proxy-") then
entity.destroy()
end
end
end
end
universe.proxyEntityLookup = {}
game.print("Rampant - Version 2.2.0")
end

View File

@ -7,7 +7,7 @@ Date: 29. 12. 2021
- Set maximum value on enemy seed to 4294967295
- Slightly increased spacing between enemy structures
- License has changed to GPLv3
- Reduced new enemy hive frequency outside resoure chunks by 10x
- Removed chance of hive outside resoure chunks on settler structure creation
- Separated mod setting into printing settlers building and ai spending points
Bugfixes:
- Fixed chunkPack nil in processNests (Thanks Skallywaggz for the report)
@ -15,6 +15,7 @@ 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
Optimizations:
- Added early stopping to removeProcessQueueChunk

View File

@ -232,7 +232,7 @@ 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)
makeHive = makeHive or (not makeHive and (map.random() < 0.0005))
print(originalEntity.unit_number, makeHive)
return initialEntityUpgrade(baseAlignment, tier, maxTier, map, (makeHive and "hive"))
else
return entityUpgrade(baseAlignment, tier, maxTier, originalEntity, map)
@ -310,6 +310,11 @@ function baseUtils.upgradeEntity(entity, base, map, disPos, evolve, register)
map.universe.pendingUpgrades[entity.unit_number] = entityData
return spawnerName
end
if entity.valid then
if map.universe.proxyEntityLookup[entity.name] then
entity.destroy()
end
end
return nil
end
@ -561,6 +566,8 @@ function baseUtils.rebuildNativeTables(universe, rg)
universe.costLookup = costLookup
local buildingHiveTypeLookup = {}
universe.buildingHiveTypeLookup = buildingHiveTypeLookup
local proxyEntityLookup = {}
universe.proxyEntityLookup = proxyEntityLookup
for i=1,10 do
evoToTierMapping[#evoToTierMapping+1] = (((i - 1) * 0.1) ^ 0.5) - 0.05
@ -626,7 +633,8 @@ function baseUtils.rebuildNativeTables(universe, rg)
for v=1,universe.ENEMY_VARIATIONS do
local entry = faction.type .. "-" .. building.name .. "-v" .. v .. "-t" .. t .. "-rampant"
enemyAlignmentLookup[entry] = faction.type
local proxyEntity = "entity-proxy-" .. building.type .. "-t" .. (t+2) .. "-rampant"
local proxyEntity = "entity-proxy-" .. building.type .. "-t" .. t .. "-rampant"
proxyEntityLookup[proxyEntity] = true
buildingSpaceLookup[entry] = proxyEntity
costLookup[entry] = HIVE_BUILDINGS_COST[building.type]
buildingHiveTypeLookup[entry] = building.type

View File

@ -249,7 +249,7 @@ local unitSpawnerAttributeNumeric = {
["spawningCooldownStart"] = { 1080, 1075, 1070, 1065, 1060, 1055, 1050, 1045, 1040, 1035 },
["spawningCooldownEnd"] = { 350, 345, 340, 335, 330, 325, 320, 315, 310, 305 },
["unitsToSpawn"] = { 11, 11, 12, 12, 13, 13, 14, 14, 15, 15 },
["scale"] = { 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.4, 1.6, 1.8 },
["cooldown"] = { 50, 50, 45, 45, 40, 40, 35, 35, 30, 30 },
["unitsOwned"] = { 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 },
["physicalDecrease"] = { 1, 2, 3, 4, 6, 6, 8, 10, 12, 14 },
["physicalPercent"] = { 15, 15, 17, 17, 18, 18, 19, 19, 20, 20 },
@ -258,7 +258,7 @@ local unitSpawnerAttributeNumeric = {
["fireDecrease"] = { 3, 3, 4, 4, 4, 4, 4, 4, 5, 5 },
["firePercent"] = { 40, 40, 42, 42, 43, 43, 44, 44, 45, 45 },
["evolutionRequirement"] = { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 },
["cooldown"] = { 50, 50, 45, 45, 40, 40, 35, 35, 30, 30 }
["scale"] = { 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4 }
}
local hiveAttributeNumeric = {
@ -271,7 +271,7 @@ local hiveAttributeNumeric = {
["spawningCooldownEnd"] = { 1785, 1780, 1775, 1770, 1765, 1760, 1755, 1750, 1745, 1740 },
-- ["spawningCooldownEnd"] = { 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 },
["unitsToSpawn"] = { 3000, 3000, 300, 3000, 3000, 3000, 3000, 3000, 3000, 3000 },
["scale"] = { 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1 },
["scale"] = { 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9 },
["unitsOwned"] = { 7, 7, 8, 8, 9, 9, 10, 10, 11, 11 },
["physicalDecrease"] = { 1, 2, 3, 4, 6, 6, 8, 10, 12, 14 },
["physicalPercent"] = { 15, 15, 17, 17, 18, 18, 19, 19, 20, 20 },
@ -290,7 +290,7 @@ local wormAttributeNumeric = {
["range"] = { 25, 27, 31, 33, 35, 36, 37, 38, 39, 40 },
["cooldown"] = { 70, 70, 68, 66, 64, 62, 60, 58, 56, 54 },
["damage"] = { 12, 22.5, 33.75, 45, 67.5, 82.5, 97.5, 112.5, 127.5, 142.5 },
["scale"] = { 0.25, 0.40, 0.60, 0.8, 0.9, 1, 1.2, 1.4, 1.6, 1.8 },
["scale"] = { 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 1.05, 1.15, 1.25, 1.35 },
["radius"] = { 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.3, 2.5, 3.0 },
["stickerDamagePerTick"] = { 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5 },
["particleVerticalAcceleration"] = { 0.01, 0.01, 0.02, 0.02, 0.03, 0.03, 0.04, 0.04, 0.05, 0.05 },
@ -694,7 +694,7 @@ local function generateApperance(unit)
local tier = unit.effectiveLevel
if unit.scale then
local scaleValue = unit.scale[tier]
local scale = gaussianRandomRangeRG(scaleValue, scaleValue * 0.24, scaleValue * 0.40, scaleValue * 1.50, xorRandom)
local scale = gaussianRandomRangeRG(scaleValue, scaleValue * 0.24, scaleValue * 0.50, scaleValue * 1.30, xorRandom)
unit.scale = scale
end
if unit.tint then

View File

@ -50,65 +50,91 @@ data:extend({
})
})
local function generateCollisionBox(scale, entityType)
if entityType == "turret" then
return {
{-1.1 * scale, -1.0 * scale},
{1.1 * scale, 1.0 * scale}
}
elseif (entityType == "biter-spawner") or (entityType == "spitter-spawner") then
return {
{-3 * scale, -2 * scale},
{2 * scale, 2 * scale}
}
elseif entityType == "hive" then
return {
{-3 * scale, -2 * scale},
{2 * scale, 2 * scale}
}
end
end
local scales = {
[1] = 0.9,
[2] = 1.1,
[3] = 1.2,
[4] = 1.3,
[5] = 1.4,
[6] = 1.5,
[7] = 1.6,
[8] = 1.8,
[9] = 2.0,
[10] = 2.1,
[11] = 2.2,
[12] = 2.3
["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
},
["biter-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
},
["hive"] = {
[1] = 1.35, [2] = 1.48, [3] = 1.61, [4] = 1.74, [5] = 1.87,
[6] = 2.0, [7] = 2.13, [8] = 2.26, [9] = 2.39, [10] = 2.52
},
["turret"] = {
[1] = 0.635, [2] = 0.765, [3] = 0.895, [4] = 1.025, [5] = 1.155,
[6] = 1.285, [7] = 1.415, [8] = 1.545, [9] = 1.675, [10] = 1.805
}
}
local subTypes = constants.HIVE_BUILDINGS_TYPES
for t=1,12 do
local scale = scales[t] * 1.2
for si=1,#subTypes do
local st = subTypes[si]
if scales[st] then
for t=1,10 do
local scale = scales[st][t]
for si=1,#subTypes do
local st = subTypes[si]
data:extend(
{
data:extend(
{
type = "land-mine",
name = "entity-proxy-" .. st .. "-t" .. t .. "-rampant",
icon = "__base__/graphics/icons/steel-chest.png",
icon_size = 32,
flags = {},
build_base_evolution_requirement = 0.08 * (t-1),
order = "s-e-w-f",
collision_mask = {"player-layer", "object-layer", "water-tile", "train-layer"},
minable = nil,
max_health = 100,
corpse = nil,
timeout = 1,
trigger_radius = 0,
collision_box = {{-3 * scale, -2 * scale}, {2 * scale, 2 * scale}},
selection_box = nil,
{
type = "land-mine",
name = "entity-proxy-" .. st .. "-t" .. t .. "-rampant",
icon = "__base__/graphics/icons/steel-chest.png",
icon_size = 32,
flags = {},
build_base_evolution_requirement = 0.08 * (t-1),
order = "s-e-w-f",
collision_mask = {"player-layer", "object-layer", "water-tile", "train-layer"},
minable = nil,
max_health = 100,
corpse = nil,
timeout = 1,
trigger_radius = 0,
collision_box = generateCollisionBox(scale, st),
selection_box = nil,
picture_safe =
{
filename = "__core__/graphics/empty.png",
priority = "extra-high",
width = 1,
height = 1
},
picture_set =
{
filename = "__core__/graphics/empty.png",
priority = "extra-high",
width = 1,
height = 1
}
picture_safe =
{
filename = "__core__/graphics/empty.png",
priority = "extra-high",
width = 1,
height = 1
},
picture_set =
{
filename = "__core__/graphics/empty.png",
priority = "extra-high",
width = 1,
height = 1
}
}
}
}
)
)
end
end
end