mirror of
https://github.com/veden/Rampant.git
synced 2024-12-28 21:08:22 +02:00
Merge branch 'NEECompat'
This commit is contained in:
commit
a534caafcc
@ -217,10 +217,10 @@ function upgrade.attempt(natives)
|
||||
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.22")
|
||||
global.version = constants.VERSION_57
|
||||
end
|
||||
if (global.version < constants.VERSION_66) then
|
||||
if (global.version < constants.VERSION_67) then
|
||||
|
||||
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.31")
|
||||
global.version = constants.VERSION_66
|
||||
game.surfaces[natives.activeSurface].print("Rampant - Version 0.16.32")
|
||||
global.version = constants.VERSION_67
|
||||
end
|
||||
|
||||
return starting ~= global.version, natives
|
||||
|
@ -3,9 +3,14 @@ Version: 0.16.32
|
||||
Date: 7. 19. 2018
|
||||
Improvements:
|
||||
- Raiding AI Toggle - toggles the ai raiding parties from outside your pollution cloud
|
||||
Tweaks:
|
||||
- Lowered base alignment selection threshold from 0.65 to 0.35, causing more variation in the later stages of the game for factions
|
||||
- Lowered upgrade entity selection threshold from 0.65 to 0.35, causing more variation in the later stages of the game for spawners and worms
|
||||
Bugfixes:
|
||||
- Invalid surface index for creative mode blueprinted tiles
|
||||
|
||||
- Invalid surface index for creative mode blueprinted tiles
|
||||
- Surface tile change event wasn't correctly accounting active surface
|
||||
- Normalized evolution requirements so when starting at a higher enemy level they are placed at the correct starting distances
|
||||
- Fixed NEE compatibility
|
||||
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.16.31
|
||||
|
@ -512,7 +512,7 @@ end
|
||||
|
||||
local function onSurfaceTileChange(event)
|
||||
local surfaceIndex = event.surface_index or (event.robot and event.robot.surface and event.robot.surface.index)
|
||||
if event.item and (event.item.name == "landfill") and (surfaceIndex == 1) then
|
||||
if event.item and (event.item.name == "landfill") and (surfaceIndex == natives.activeSurface) then
|
||||
local surface = game.surfaces[natives.activeSurface]
|
||||
local chunks = {}
|
||||
local tiles = event.tiles
|
||||
|
@ -10,6 +10,8 @@ local bobsUnits = require("BobsBaseUtils")
|
||||
|
||||
-- constants
|
||||
|
||||
local MAGIC_MAXIMUM_NUMBER = constants.MAGIC_MAXIMUM_NUMBER
|
||||
|
||||
local TIER_NAMING_SET_10 = constants.TIER_NAMING_SET_10
|
||||
local TIER_NAMING_SET_5 = constants.TIER_NAMING_SET_5
|
||||
|
||||
@ -144,6 +146,39 @@ local mRandom = math.random
|
||||
|
||||
-- module code
|
||||
|
||||
local function normalizeProbabilities(probabilityTable)
|
||||
local result = {}
|
||||
|
||||
for alignment,probabilitySet in pairs(probabilityTable) do
|
||||
local max = 0
|
||||
local min = MAGIC_MAXIMUM_NUMBER
|
||||
|
||||
local alignmentResult = {}
|
||||
result[alignment] = alignmentResult
|
||||
|
||||
for probability, _ in pairs(probabilitySet) do
|
||||
if (probability > max) then
|
||||
max = probability
|
||||
end
|
||||
if (probability < min) then
|
||||
min = probability
|
||||
end
|
||||
end
|
||||
|
||||
-- cap max evo requirement at 0.95
|
||||
for probability, entities in pairs(probabilitySet) do
|
||||
if (max == 0) or (max == min) then
|
||||
alignmentResult[0] = entities
|
||||
else
|
||||
local normalizeProbability = ((probability - min) / (max - min)) * 0.95
|
||||
alignmentResult[normalizeProbability] = entities
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function baseUtils.findNearbyBase(map, chunk, natives)
|
||||
if (chunk == SENTINEL_IMPASSABLE_CHUNK) then
|
||||
return nil
|
||||
@ -185,7 +220,7 @@ local function findEntityUpgrade(baseAlignment, evoIndex, natives, evolutionTabl
|
||||
local entitySet = alignments[roundToFloor(evo, EVOLUTION_INCREMENTS)]
|
||||
if entitySet and (#entitySet > 0) then
|
||||
entity = entitySet[mRandom(#entitySet)]
|
||||
if (mRandom() > 0.65) then
|
||||
if (mRandom() > 0.35) then
|
||||
break
|
||||
end
|
||||
end
|
||||
@ -203,7 +238,7 @@ local function findBaseInitialAlignment(evoIndex, natives, evolutionTable)
|
||||
local entitySet = evolutionTable[roundToFloor(evo, EVOLUTION_INCREMENTS)]
|
||||
if entitySet and (#entitySet > 0) then
|
||||
alignment = entitySet[mRandom(#entitySet)]
|
||||
if (mRandom() > 0.65) then
|
||||
if (mRandom() > 0.35) then
|
||||
break
|
||||
end
|
||||
end
|
||||
@ -242,7 +277,7 @@ function baseUtils.upgradeEntity(entity, surface, baseAlignment, natives, evolut
|
||||
local position = entity.position
|
||||
local entityType = entity.type
|
||||
entity.destroy()
|
||||
|
||||
|
||||
if not baseAlignment or (baseAlignment == BASE_ALIGNMENT_DEADZONE) then
|
||||
return nil
|
||||
end
|
||||
@ -251,7 +286,7 @@ function baseUtils.upgradeEntity(entity, surface, baseAlignment, natives, evolut
|
||||
euclideanDistancePoints(position.x, position.y, 0, 0) * BASE_DISTANCE_TO_EVO_INDEX),
|
||||
EVOLUTION_INCREMENTS)
|
||||
local evoIndex = mMax(distance, roundToFloor(evolutionFactor, EVOLUTION_INCREMENTS))
|
||||
|
||||
|
||||
local spawnerName = findEntityUpgrade(baseAlignment, evoIndex, natives, ((entityType == "unit-spawner") and natives.evolutionTableUnitSpawner) or natives.evolutionTableWorm)
|
||||
if spawnerName then
|
||||
local newPosition = surface.find_non_colliding_position(spawnerName, position, CHUNK_SIZE, 4)
|
||||
@ -616,6 +651,8 @@ function baseUtils.rebuildNativeTables(natives, surface, rg)
|
||||
BASE_ALIGNMENT_SPAWNER,
|
||||
"spawner")
|
||||
|
||||
natives.evolutionTableUnitSpawner = normalizeProbabilities(natives.evolutionTableUnitSpawner)
|
||||
natives.evolutionTableWorm = normalizeProbabilities(natives.evolutionTableWorm)
|
||||
end
|
||||
|
||||
return baseUtils
|
||||
|
@ -21,7 +21,7 @@ constants.VERSION_41 = 41
|
||||
constants.VERSION_44 = 44
|
||||
constants.VERSION_51 = 51
|
||||
constants.VERSION_57 = 57
|
||||
constants.VERSION_66 = 66
|
||||
constants.VERSION_67 = 67
|
||||
|
||||
-- misc
|
||||
|
||||
@ -148,6 +148,11 @@ constants.BASE_ALIGNMENT_DEADZONE = 20
|
||||
constants.BASE_ALIGNMENT_NE = 21
|
||||
constants.BASE_ALIGNMENT_BOBS = 22
|
||||
constants.BASE_ALIGNMENT_SPAWNER = 23
|
||||
constants.BASE_ALIGNMENT_NE_BLUE = 24
|
||||
constants.BASE_ALIGNMENT_NE_RED = 25
|
||||
constants.BASE_ALIGNMENT_NE_YELLOW = 26
|
||||
constants.BASE_ALIGNMENT_NE_GREEN = 27
|
||||
constants.BASE_ALIGNMENT_NE_PINK = 28
|
||||
-- constants.BASE_ALIGNMENT_BURROW = 3
|
||||
|
||||
constants.BASE_PROCESS_INTERVAL = constants.TICKS_A_SECOND * 2
|
||||
@ -212,6 +217,22 @@ end
|
||||
|
||||
if constants.ENABLED_NE_UNITS then
|
||||
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE] = 0.1
|
||||
|
||||
if settings.startup["NE_Blue_Spawners"].value then
|
||||
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_BLUE] = 0.1
|
||||
end
|
||||
if settings.startup["NE_Red_Spawners"].value then
|
||||
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_RED] = 0.1
|
||||
end
|
||||
if settings.startup["NE_Pink_Spawners"].value then
|
||||
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_PINK] = 0.1
|
||||
end
|
||||
if settings.startup["NE_Green_Spawners"].value then
|
||||
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_GREEN] = 0.1
|
||||
end
|
||||
if settings.startup["NE_Yellow_Spawners"].value then
|
||||
constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE_YELLOW] = 0.1
|
||||
end
|
||||
end
|
||||
|
||||
-- ai retreat
|
||||
@ -478,7 +499,6 @@ constants.ENERGY_THIEF_WORM_VARIATIONS = wormVariations
|
||||
constants.ENERGY_THIEF_UNIT_TIERS = unitTiers
|
||||
constants.ENERGY_THIEF_UNIT_VARIATIONS = unitVariations
|
||||
|
||||
|
||||
constants.LASER_NEST_TIERS = nestTiers
|
||||
constants.LASER_NEST_VARIATIONS = nestVariations
|
||||
constants.LASER_WORM_TIERS = wormTiers
|
||||
|
@ -10,6 +10,12 @@ local EVOLUTION_INCREMENTS = constants.EVOLUTION_INCREMENTS
|
||||
local BASE_ALIGNMENT_NE = constants.BASE_ALIGNMENT_NE
|
||||
local ENABLED_BOBS_UNITS = constants.ENABLED_BOBS_UNITS
|
||||
|
||||
local BASE_ALIGNMENT_NE_BLUE = constants.BASE_ALIGNMENT_NE_BLUE
|
||||
local BASE_ALIGNMENT_NE_RED = constants.BASE_ALIGNMENT_NE_RED
|
||||
local BASE_ALIGNMENT_NE_PINK = constants.BASE_ALIGNMENT_NE_PINK
|
||||
local BASE_ALIGNMENT_NE_GREEN = constants.BASE_ALIGNMENT_NE_GREEN
|
||||
local BASE_ALIGNMENT_NE_YELLOW = constants.BASE_ALIGNMENT_NE_YELLOW
|
||||
|
||||
-- imported functions
|
||||
|
||||
local mFloor = math.floor
|
||||
@ -33,6 +39,8 @@ end
|
||||
|
||||
function ne.processNEUnitClass(natives, surface)
|
||||
local position = { x = 0, y = 0 }
|
||||
|
||||
local factionSet = {}
|
||||
|
||||
local entity = surface.create_entity({
|
||||
name = "biter-spawner",
|
||||
@ -40,7 +48,7 @@ function ne.processNEUnitClass(natives, surface)
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0)
|
||||
entity.destroy()
|
||||
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "spitter-spawner",
|
||||
position = position
|
||||
@ -48,6 +56,60 @@ function ne.processNEUnitClass(natives, surface)
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0)
|
||||
entity.destroy()
|
||||
|
||||
|
||||
if settings.startup["NE_Blue_Spawners"].value then
|
||||
entity = surface.create_entity({
|
||||
name = "ne-spawner-blue",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE_BLUE, entity, natives.evolutionTableUnitSpawner, 0.0)
|
||||
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_BLUE
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
if settings.startup["NE_Red_Spawners"].value then
|
||||
entity = surface.create_entity({
|
||||
name = "ne-spawner-red",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE_RED, entity, natives.evolutionTableUnitSpawner, 0.0)
|
||||
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_RED
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
if settings.startup["NE_Green_Spawners"].value then
|
||||
entity = surface.create_entity({
|
||||
name = "ne-spawner-green",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE_GREEN, entity, natives.evolutionTableUnitSpawner, 0.0)
|
||||
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_GREEN
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
|
||||
if settings.startup["NE_Yellow_Spawners"].value then
|
||||
entity = surface.create_entity({
|
||||
name = "ne-spawner-yellow",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE_YELLOW, entity, natives.evolutionTableUnitSpawner, 0.0)
|
||||
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_YELLOW
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
if settings.startup["NE_Pink_Spawners"].value then
|
||||
entity = surface.create_entity({
|
||||
name = "ne-spawner-pink",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE_PINK, entity, natives.evolutionTableUnitSpawner, 0.0)
|
||||
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE_PINK
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
factionSet[#factionSet+1] = BASE_ALIGNMENT_NE
|
||||
|
||||
if ENABLED_BOBS_UNITS then
|
||||
entity = surface.create_entity({
|
||||
name = "bob-biter-spawner",
|
||||
@ -61,79 +123,82 @@ function ne.processNEUnitClass(natives, surface)
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0)
|
||||
entity.destroy()
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-fire-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
for _,alignment in ipairs(factionSet) do
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-fire-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-poison-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-poison-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-piercing-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-piercing-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-electric-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-electric-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "bob-giant-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
entity = surface.create_entity({
|
||||
name = "bob-giant-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "bob-behemoth-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-explosive-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
entity = surface.create_entity({
|
||||
name = "bob-behemoth-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "bob-big-explosive-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "small-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
for _,alignment in ipairs(factionSet) do
|
||||
entity = surface.create_entity({
|
||||
name = "small-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "medium-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
entity = surface.create_entity({
|
||||
name = "medium-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
|
||||
entity = surface.create_entity({
|
||||
name = "big-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
entity = surface.create_entity({
|
||||
name = "big-worm-turret",
|
||||
position = position
|
||||
})
|
||||
fileEntity(alignment, entity, natives.evolutionTableWorm)
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
return ne
|
||||
|
Loading…
Reference in New Issue
Block a user