1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-28 03:29:34 +02:00

first draft ready

This commit is contained in:
Aaron Veden 2018-01-25 23:55:09 -08:00
parent e3f43edc09
commit 871ae59efe
13 changed files with 184 additions and 34 deletions

View File

@ -256,6 +256,8 @@ local function onModSettingsChange(event)
upgrade.compareTable(natives, "aiNocturnalMode", settings.global["rampant-permanentNocturnal"].value)
upgrade.compareTable(natives, "aiPointsScaler", settings.global["rampant-aiPointsScaler"].value)
upgrade.compareTable(natives, "newEnemies", settings.startup["rampant-newEnemies"].value)
upgrade.compareTable(natives, "enemySeed", settings.startup["rampant-enemySeed"].value)
-- RE-ENABLE WHEN COMPLETE
@ -278,7 +280,9 @@ local function onConfigChanged()
upgraded, natives = upgrade.attempt(natives)
if upgraded and onModSettingsChange(nil) then
rebuildMap()
rebuildNativeTables(natives, game.surfaces[1], game.create_random_generator(natives.enemySeed))
if natives.newEnemies then
rebuildNativeTables(natives, game.surfaces[1], game.create_random_generator(natives.enemySeed))
end
-- clear pending chunks, will be added when loop runs below
global.pendingChunks = {}
@ -333,7 +337,9 @@ local function onTick(event)
surface,
gameRef.connected_players)
recycleBases(natives, tick)
if natives.newEnemies then
recycleBases(natives, tick)
end
end
if (tick == map.squadTick) then
map.squadTick = map.squadTick + INTERVAL_SQUAD
@ -445,13 +451,17 @@ local function onEnemyBaseBuild(event)
if entity.valid and (surface.index == 1) then
local chunk = getChunkByPosition(map, entity.position)
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
local evolutionFactor = entity.force.enemy.evolution_factor
local base = getChunkBase(map, chunk)
if not base then
base = createBase(map, natives, evolutionFactor, chunk, surface)
local evolutionFactor = entity.force.evolution_factor
if natives.newEnemies then
local base = getChunkBase(map, chunk)
if not base then
base = createBase(map, natives, evolutionFactor, chunk, surface, event.tick)
end
entity = upgradeEntity(entity, surface, base.alignment, natives, evolutionFactor)
end
if entity then
event.entity = registerEnemyBaseStructure(map, entity, natives, evolutionFactor, surface, event.tick)
end
entity = upgradeEntity(entity, surface, base.alignment, natives, evolutionFactor)
event.entity = registerEnemyBaseStructure(map, entity, natives, evolutionFactor, surface, event.tick)
end
end
end

View File

@ -19,7 +19,7 @@ if settings.startup["rampant-removeBloodParticles"].value then
explosions["blood-explosion-huge"]["created_effect"] = nil
end
if not settings.startup["rampant-newEnemies"].value and settings.startup["rampant-useDumbProjectiles"].value then
if settings.startup["rampant-useDumbProjectiles"].value then
vanillaUpdates.useDumbProjectiles()
if bobsDetected() then
require("prototypes/utils/AttackBobs")

View File

@ -1,6 +1,6 @@
local acidBall = require("prototypes/utils/AttackBall")
if not settings.startup["rampant-newEnemies"].value and settings.startup["rampant-useDumbProjectiles"].value then
if settings.startup["rampant-useDumbProjectiles"].value then
acidBall.generateLegacy()
end

View File

@ -167,16 +167,20 @@ end
local function findBaseInitialAlignment(evoIndex, natives, evolutionTable)
local evoTop = roundToFloor(gaussianRandomRange(evoIndex, evoIndex * 0.2, 0, evoIndex), EVOLUTION_INCREMENTS)
local evoTop = roundToFloor(gaussianRandomRange(evoIndex, evoIndex * 0.3, 0, evoIndex), EVOLUTION_INCREMENTS)
local alignment
for evo=evoTop, 0, -EVOLUTION_INCREMENTS do
local entitySet = evolutionTable[roundToFloor(evo, EVOLUTION_INCREMENTS)]
if entitySet and (#entitySet > 0) then
return entitySet[mRandom(#entitySet)]
alignment = entitySet[mRandom(#entitySet)]
if (mRandom() > 0.5) then
break
end
end
end
return nil
return alignment
end
function baseUtils.recycleBases(natives, tick)
@ -221,7 +225,7 @@ function baseUtils.upgradeEntity(entity, surface, baseAlignment, natives, evolut
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, 1)
local newPosition = surface.find_non_colliding_position(spawnerName, position, CHUNK_SIZE, 4)
if newPosition then
entity = surface.create_entity({name = spawnerName, position = newPosition})
end

View File

@ -279,7 +279,7 @@ function chunkUtils.initialScan(chunk, natives, surface, map, tick, evolutionFac
pass = CHUNK_ALL_DIRECTIONS
end
if (#nests > 0) or (#worms > 0) then
if natives.newEnemies and ((#nests > 0) or (#worms > 0)) then
local base = findNearbyBase(map, chunk, natives)
if base then
setChunkBase(map, chunk, base)
@ -401,7 +401,7 @@ function chunkUtils.registerEnemyBaseStructure(map, entity, natives, evolutionFa
if ((entityType == "unit-spawner") or (entityType == "turret")) and (entity.force.name == "enemy") then
local chunk = getChunkByPosition(map, entity.position)
local base
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and natives.newEnemies then
base = findNearbyBase(map, chunk, natives)
if not base then
base = createBase(map, natives, evolutionFactor, chunk, surface, tick)

View File

@ -99,6 +99,8 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
roll = mRandom()
map.processRoll = roll
end
local newEnemies = natives.newEnemies
local squads = canAttack(natives, surface) and (0.11 <= roll) and (roll <= 0.35) and (natives.points >= AI_SQUAD_COST)
@ -117,9 +119,11 @@ function mapProcessor.processMap(map, surface, natives, tick, evolutionFactor)
squads = (natives.points >= AI_SQUAD_COST) -- and (#natives.squads < natives.maxSquads)
end
local base = chunkToBase[chunk]
if base and ((tick - base.tick) > BASE_PROCESS_INTERVAL) then
processBase(map, surface, natives, tick, base, evolutionFactor)
if newEnemies then
local base = chunkToBase[chunk]
if base and ((tick - base.tick) > BASE_PROCESS_INTERVAL) then
processBase(map, surface, natives, tick, base, evolutionFactor)
end
end
scents(map, chunk)

View File

@ -80,7 +80,7 @@
(copyDirectory "prototypes" modFolder)))
(define (run)
(copyFiles modFolder)
;;(copyFiles modFolder)
;;(copyFiles zipModFolder)
;;(makeZip modFolder)
(makeZip modFolder)
(system*/exit-code "/data/games/factorio/bin/x64/factorio")))

View File

@ -813,7 +813,7 @@ buildUnitSpawner(
}
},
{
type = "resistance",

View File

@ -40,7 +40,7 @@ buildUnitSpawner(
explosion = "blood-explosion-small"
},
attack = {
damageType = "fire"
damageType = "acid"
},
resistances = {},
@ -524,6 +524,37 @@ buildUnitSpawner(
[9] = 90,
[10] = 90
}
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
}
},
@ -564,7 +595,7 @@ buildUnitSpawner(
explosion = "blood-explosion-small"
},
attack = {
damageType = "fire",
damageType = "acid",
softSmokeName = "fire-soft-smoke-rampant"
},
resistances = {},
@ -789,6 +820,37 @@ buildUnitSpawner(
[10] = 90
}
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "attack",
@ -1070,7 +1132,38 @@ buildUnitSpawner(
[9] = 90,
[10] = 90
}
}
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
}
},
probabilityTable = {
@ -1109,7 +1202,7 @@ buildWorm(
attributes = {},
attack = {
damageType = "fire",
damageType = "acid",
softSmokeName = "fire-soft-smoke-rampant"
},
resistances = {},
@ -1328,6 +1421,37 @@ buildWorm(
}
},
{
type = "resistance",
name = "acid",
decrease = {
[1] = 7,
[2] = 7,
[3] = 10,
[4] = 10,
[5] = 13,
[6] = 13,
[7] = 16,
[8] = 16,
[9] = 19,
[10] = 23
},
percent = {
[1] = 65,
[2] = 65,
[3] = 70,
[4] = 75,
[5] = 75,
[6] = 80,
[7] = 85,
[8] = 85,
[9] = 90,
[10] = 90
}
},
{
type = "attack",
name = "range",

View File

@ -47,7 +47,8 @@ buildUnitSpawner(
explosion = "blood-explosion-small"
},
attack = {
damageType = "fire",
damageType = "acid",
fireDamagePerTickType = "acid",
softSmokeName = softSmoke,
smokeWithGlowName = smokeGlow,
smokeWithoutGlowName = smokeWithoutGlow,
@ -66,7 +67,7 @@ buildUnitSpawner(
tint = { r = 1, g = 1, b = 1, a = 0.35 },
shift = math3d.vector2.mul({-0.078125, -1.8125}, 0.1),
},
stickerDamagePerTickType = "fire"
stickerDamagePerTickType = "acid"
},
resistances = {},
@ -705,7 +706,8 @@ buildWorm(
attributes = {},
attack = {
damageType = "fire",
damageType = "acid",
fireDamagePerTickType = "acid",
softSmokeName = softSmoke,
smokeWithGlowName = smokeGlow,
smokeWithoutGlowName = smokeWithoutGlow,
@ -724,7 +726,7 @@ buildWorm(
tint = { r = 1, g = 1, b = 1, a = 0.35 },
shift = math3d.vector2.mul({-0.078125, -1.8125}, 0.1),
},
stickerDamagePerTickType = "fire"
stickerDamagePerTickType = "acid"
},
resistances = {},

View File

@ -237,7 +237,7 @@ end
local function generateApperance(unit, tier)
local scaleValue = unit.scales[tier]
local scale = gaussianRandomRangeRG(scaleValue, scaleValue * 0.12, scaleValue * 0.60, scaleValue * 1.40, xorRandom) + (0.05 * tier)
local scale = gaussianRandomRangeRG(scaleValue, scaleValue * 0.12, scaleValue * 0.60, scaleValue * 1.40, xorRandom)
unit.scale = scale
unit.attributes.scale = scale

View File

@ -21,7 +21,9 @@ function attackFlame.createAttackFlame(attributes)
local spawnEntityName = makeSpreadEffect({
name = attributes.name,
smokeWithoutGlowName = attributes.smokeWithoutGlowName
smokeWithoutGlowName = attributes.smokeWithoutGlowName,
fireDamagePerTick = attributes.fireDamagePerTick,
fireDamagePerTickType = attributes.fireDamagePerTickType,
})
local fireName = makeFire({
name = attributes.name,
@ -29,6 +31,8 @@ function attackFlame.createAttackFlame(attributes)
smokeWithGlowName = attributes.smokeWithGlowName,
smokeAddingFuelName = attributes.smokeAddingFuelName,
spawnEntityName = spawnEntityName,
fireDamagePerTick = attributes.fireDamagePerTick,
fireDamagePerTickType = attributes.fireDamagePerTickType,
damageMaxMultipler = attributes.damageMaxMultipler,
multiplerIncrease = attributes.multiplerIncrease,
multiplerDecrease = attributes.multiplerDecrease
@ -39,7 +43,9 @@ function attackFlame.createAttackFlame(attributes)
stickerAnimation = attributes.stickerAnimation,
stickerDuration = attributes.stickerDuration,
stickerDamagePerTick = attributes.stickerDamagePerTick,
stickerDamagePerTick2 = attributes.stickerDamagePerTick2,
stickerDamagePerTickType = attributes.stickerDamagePerTickType,
stickerDamagePerTickType2 = attributes.stickerDamagePerTickType2,
stickerMovementModifier = attributes.stickerMovementModifier,
fireSpreadRadius = attributes.fireSpreadRadius
})

View File

@ -29,7 +29,7 @@ function fireUtils.makeSpreadEffect(attributes)
name = name,
flags = {"placeable-off-grid", "not-on-map"},
damage_per_tick = attributes.damagePerTick or { amount = 45/60, type = "fire" },
damage_per_tick = { amount = attributes.fireDamagePerTick or 45/60, type = attributes.fireDamagePerTickType or "fire" },
spawn_entity = name,
maximum_spread_count = 100,
@ -117,7 +117,7 @@ function fireUtils.makeFire(attributes)
name = name,
flags = {"placeable-off-grid", "not-on-map"},
color = attributes.fireTint,
damage_per_tick = attributes.damagePerTick or { amount = 45/60, type = "fire" },
damage_per_tick = { amount = attributes.fireDamagePerTick or 45/60, type = attributes.fireDamagePerTickType or "fire" },
maximum_damage_multiplier = attributes.damageMaxMultipler or 6,
damage_multiplier_increase_per_added_fuel = attributes.mutliplerIncrease or 1,