1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-30 04:30:52 +02:00

removing conditional requires everywhere

This commit is contained in:
Aaron Veden 2018-04-14 16:02:40 -07:00
parent bf74de8051
commit 868eb2f3d7
19 changed files with 13880 additions and 13761 deletions

View File

@ -304,9 +304,6 @@ local function onConfigChanged()
upgraded, natives = upgrade.attempt(natives)
if upgraded and onModSettingsChange(nil) then
rebuildMap()
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 = {}
@ -324,6 +321,9 @@ local function onConfigChanged()
processPendingChunks(natives, map, surface, pendingChunks, tick, game.forces.enemy.evolution_factor, true)
end
if natives.newEnemies then
rebuildNativeTables(natives, game.surfaces[1], game.create_random_generator(natives.enemySeed))
end
end
script.on_nth_tick(INTERVAL_PROCESS,

View File

@ -1,22 +1,40 @@
local vanillaBuildings = require("prototypes/buildings/UpdatesVanilla")
if settings.startup["rampant-newEnemies"].value then
require("prototypes/Neutral")
require("prototypes/Acid")
require("prototypes/Physical")
require("prototypes/Suicide")
require("prototypes/Fire")
require("prototypes/Electric")
require("prototypes/Nuclear")
require("prototypes/Inferno")
require("prototypes/Fast")
require("prototypes/Troll")
local neutral = require("prototypes/Neutral")
local acid = require("prototypes/Acid")
local physical = require("prototypes/Physical")
local suicide = require("prototypes/Suicide")
local fire = require("prototypes/Fire")
local electric = require("prototypes/Electric")
local nuclear = require("prototypes/Nuclear")
local inferno = require("prototypes/Inferno")
local fast = require("prototypes/Fast")
local troll = require("prototypes/Troll")
-- require("prototypes/Decaying")
-- require("prototypes/Poison")
-- require("prototypes/Undying")
require("prototypes/Spawner")
require("prototypes/Wasp")
require("prototypes/Laser")
local spawner = require("prototypes/Spawner")
local wasp = require("prototypes/Wasp")
local laser = require("prototypes/Laser")
if settings.startup["rampant-newEnemies"].value then
neutral.addFaction()
acid.addFaction()
physical.addFaction()
suicide.addFaction()
fire.addFaction()
electric.addFaction()
nuclear.addFaction()
inferno.addFaction()
fast.addFaction()
troll.addFaction()
-- require("prototypes/Decaying")
-- require("prototypes/Poison")
-- require("prototypes/Undying")
spawner.addFaction()
wasp.addFaction()
laser.addFaction()
for _, unitSpawner in pairs(data.raw["unit-spawner"]) do
if (unitSpawner.name ~= "biter-spawner") then

View File

@ -3,6 +3,9 @@ local bobsUpdates = require("prototypes/utils/UpdatesBobs")
local NEUpdates = require("prototypes/utils/UpdatesNE")
local constants = require("libs/Constants")
local attackBobs = require("prototypes/utils/AttackBobs")
local attackNE = require("prototypes/utils/AttackNE")
if settings.startup["rampant-removeBloodParticles"].value then
local explosions = data.raw["explosion"]
@ -16,14 +19,13 @@ if settings.startup["rampant-useDumbProjectiles"].value then
local option = settings.startup["bobmods-enemies-enableartifacts"]
if option then
require("prototypes/utils/AttackBobs")
attackBobs.addAttacks()
bobsUpdates.useDumbProjectiles()
end
option = settings.startup["NE_Difficulty"]
if option then
require("prototypes/utils/AttackNE")
attackNE.addAttacks()
NEUpdates.useDumbProjectiles()
if settings.startup["rampant-useNEUnitLaunchers"].value then
NEUpdates.useNEUnitLaunchers()

View File

@ -369,6 +369,8 @@ end
function chunkUtils.analyzeChunk(chunk, natives, surface, map)
local playerObjects = chunkUtils.scorePlayerBuildings(surface, map, natives)
setPlayerBaseGenerator(map, chunk, playerObjects)
local resources = surface.count_entities_filtered(map.countResourcesQuery) * RESOURCE_NORMALIZER
setResourceGenerator(map, chunk, resources)
end
function chunkUtils.createChunk(topX, topY)

View File

@ -8,6 +8,8 @@ local constants = require("Constants")
-- constants
local acid = {}
local ACID_UNIT_TIERS = constants.ACID_UNIT_TIERS
local ACID_UNIT_VARIATIONS = constants.ACID_UNIT_VARIATIONS
@ -36,6 +38,8 @@ local biterLoot = makeUnitAlienLootTable("green")
local spawnerLoot = makeSpawnerAlienLootTable("green")
local wormLoot = makeWormAlienLootTable("green")
function acid.addFaction()
-- acid biters
buildUnitSpawner(
{
@ -1537,3 +1541,6 @@ buildWorm(
ACID_WORM_VARIATIONS,
ACID_WORM_TIERS
)
end
return acid

View File

@ -9,6 +9,8 @@ local constants = require("Constants")
-- constants
local electric = {}
local ELECTRIC_UNIT_TIERS = constants.ELECTRIC_UNIT_TIERS
local ELECTRIC_UNIT_VARIATIONS = constants.ELECTRIC_UNIT_VARIATIONS
@ -33,6 +35,8 @@ local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function electric.addFaction()
local biterLoot = makeUnitAlienLootTable("blue")
local spawnerLoot = makeSpawnerAlienLootTable("blue")
local wormLoot = makeWormAlienLootTable("blue")
@ -1041,3 +1045,6 @@ buildWorm(
ELECTRIC_WORM_VARIATIONS,
ELECTRIC_WORM_TIERS
)
end
return electric

View File

@ -8,6 +8,8 @@ local constants = require("Constants")
-- constants
local fast = {}
local FAST_UNIT_TIERS = constants.FAST_UNIT_TIERS
local FAST_UNIT_VARIATIONS = constants.FAST_UNIT_VARIATIONS
@ -35,7 +37,7 @@ local biterLoot = makeUnitAlienLootTable("purple")
local spawnerLoot = makeSpawnerAlienLootTable("purple")
local wormLoot = makeWormAlienLootTable("purple")
function fast.addFaction()
-- fast biters
buildUnitSpawner(
@ -1363,3 +1365,6 @@ buildWorm(
FAST_WORM_VARIATIONS,
FAST_WORM_TIERS
)
end
return fast

View File

@ -8,6 +8,8 @@ local constants = require("Constants")
-- constants
local fire = {}
local FIRE_UNIT_TIERS = constants.FIRE_UNIT_TIERS
local FIRE_UNIT_VARIATIONS = constants.FIRE_UNIT_VARIATIONS
@ -35,7 +37,7 @@ local biterLoot = makeUnitAlienLootTable("red")
local spawnerLoot = makeSpawnerAlienLootTable("red")
local wormLoot = makeWormAlienLootTable("red")
function fire.addFaction()
-- fire biters
buildUnitSpawner(
@ -1552,3 +1554,7 @@ buildWorm(
FIRE_WORM_VARIATIONS,
FIRE_WORM_TIERS
)
end
return fire

View File

@ -9,6 +9,8 @@ local math3d = require("math3d")
-- constants
local inferno = {}
local INFERNO_UNIT_TIERS = constants.INFERNO_UNIT_TIERS
local INFERNO_UNIT_VARIATIONS = constants.INFERNO_UNIT_VARIATIONS
@ -38,6 +40,7 @@ local biterLoot = makeUnitAlienLootTable("orange")
local spawnerLoot = makeSpawnerAlienLootTable("orange")
local wormLoot = makeWormAlienLootTable("orange")
function inferno.addFaction()
-- inferno spitters
@ -1159,3 +1162,6 @@ buildWorm(
INFERNO_WORM_VARIATIONS,
INFERNO_WORM_TIERS
)
end
return inferno

View File

@ -20,6 +20,8 @@ local LASER_WORM_VARIATIONS = constants.LASER_WORM_VARIATIONS
-- imported functions
local laser = {}
local buildUnitSpawner = swarmUtils.buildUnitSpawner
local buildWorm = swarmUtils.buildWorm
local createAttackBall = acidBall.createAttackBall
@ -39,6 +41,7 @@ local biterLoot = makeUnitAlienLootTable("blue")
local spawnerLoot = makeSpawnerAlienLootTable("blue")
local wormLoot = makeWormAlienLootTable("blue")
function laser.addFaction()
local laserBubble = makeBubble({
name = "laser-worm",
@ -1626,3 +1629,6 @@ buildWorm(
LASER_WORM_VARIATIONS,
LASER_WORM_TIERS
)
end
return laser

View File

@ -8,6 +8,8 @@ local constants = require("Constants")
-- constants
local neutral = {}
local NEUTRAL_UNIT_TIERS = constants.NEUTRAL_UNIT_TIERS
local NEUTRAL_UNIT_VARIATIONS = constants.NEUTRAL_UNIT_VARIATIONS
@ -33,6 +35,8 @@ local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function neutral.addFaction()
local biterLoot = makeUnitAlienLootTable(nil)
local spawnerLoot = makeSpawnerAlienLootTable(nil)
local wormLoot = makeWormAlienLootTable(nil)
@ -1319,3 +1323,7 @@ buildWorm(
NEUTRAL_WORM_VARIATIONS,
NEUTRAL_WORM_TIERS
)
end
return neutral

View File

@ -10,6 +10,8 @@ local constants = require("Constants")
-- constants
local nuclear = {}
local NUCLEAR_UNIT_TIERS = constants.NUCLEAR_UNIT_TIERS
local NUCLEAR_UNIT_VARIATIONS = constants.NUCLEAR_UNIT_VARIATIONS
@ -35,6 +37,9 @@ local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function nuclear.addFaction()
local biterLoot = makeUnitAlienLootTable("yellow")
local spawnerLoot = makeSpawnerAlienLootTable("yellow")
local wormLoot = makeWormAlienLootTable("yellow")
@ -931,3 +936,6 @@ buildWorm(
NUCLEAR_WORM_VARIATIONS,
NUCLEAR_WORM_TIERS
)
end
return nuclear

View File

@ -8,6 +8,8 @@ local constants = require("Constants")
-- constants
local physical = {}
local PHYSICAL_UNIT_TIERS = constants.PHYSICAL_UNIT_TIERS
local PHYSICAL_UNIT_VARIATIONS = constants.PHYSICAL_UNIT_VARIATIONS
@ -31,6 +33,8 @@ local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function physical.addFaction()
local biterLoot = makeUnitAlienLootTable("red")
local spawnerLoot = makeSpawnerAlienLootTable("red")
local wormLoot = makeWormAlienLootTable("red")
@ -861,3 +865,6 @@ buildWorm(
PHYSICAL_WORM_VARIATIONS,
PHYSICAL_WORM_TIERS
)
end
return physical

View File

@ -9,6 +9,8 @@ local constants = require("Constants")
-- constants
local spawner = {}
local SPAWNER_UNIT_TIERS = constants.SPAWNER_UNIT_TIERS
local SPAWNER_UNIT_VARIATIONS = constants.SPAWNER_UNIT_VARIATIONS
@ -37,6 +39,8 @@ local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function spawner.addFaction()
local biterLoot = makeUnitAlienLootTable("green")
local spawnerLoot = makeSpawnerAlienLootTable("green")
local wormLoot = makeWormAlienLootTable("green")
@ -1750,3 +1754,6 @@ buildWorm(
SPAWNER_WORM_VARIATIONS,
SPAWNER_WORM_TIERS
)
end
return spawner

View File

@ -9,6 +9,8 @@ local constants = require("Constants")
-- constants
local suicide = {}
local SUICIDE_UNIT_TIERS = constants.SUICIDE_UNIT_TIERS
local SUICIDE_UNIT_VARIATIONS = constants.SUICIDE_UNIT_VARIATIONS
@ -34,6 +36,8 @@ local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function suicide.addFaction()
local biterLoot = makeUnitAlienLootTable("yellow")
local spawnerLoot = makeSpawnerAlienLootTable("yellow")
local wormLoot = makeWormAlienLootTable("yellow")
@ -953,3 +957,6 @@ buildWorm(
SUICIDE_WORM_VARIATIONS,
SUICIDE_WORM_TIERS
)
end
return suicide

View File

@ -8,6 +8,8 @@ local constants = require("Constants")
-- constants
local troll = {}
local TROLL_UNIT_TIERS = constants.TROLL_UNIT_TIERS
local TROLL_UNIT_VARIATIONS = constants.TROLL_UNIT_VARIATIONS
@ -32,6 +34,8 @@ local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function troll.addFaction()
local biterLoot = makeUnitAlienLootTable("green")
local spawnerLoot = makeSpawnerAlienLootTable("green")
local wormLoot = makeWormAlienLootTable("green")
@ -1378,3 +1382,6 @@ buildWorm(
TROLL_WORM_VARIATIONS,
TROLL_WORM_TIERS
)
end
return troll

View File

@ -9,6 +9,8 @@ local constants = require("Constants")
-- constants
local wasp = {}
local WASP_UNIT_TIERS = constants.WASP_UNIT_TIERS
local WASP_UNIT_VARIATIONS = constants.WASP_UNIT_VARIATIONS
@ -36,6 +38,8 @@ local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable
local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable
local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable
function wasp.addFaction()
local biterLoot = makeUnitAlienLootTable("purple")
local spawnerLoot = makeSpawnerAlienLootTable("purple")
local wormLoot = makeWormAlienLootTable("purple")
@ -1399,3 +1403,6 @@ buildWorm(
WASP_WORM_VARIATIONS,
WASP_WORM_TIERS
)
end
return wasp

View File

@ -1,5 +1,7 @@
-- bobs replacement attacks
local attacks = {}
-- import
local fireUtils = require("FireUtils")
@ -27,6 +29,7 @@ local smokeGlow = "the-glow-smoke-rampant"
local smokeWithoutGlow = "the-without-glow-smoke-rampant"
local smokeFuel = "the-adding-fuel-rampant"
function attacks.addAttacks()
local multipler = (FORCE_OLD_PROJECTILES and 1) or 2.7
@ -772,3 +775,4 @@ if not FORCE_OLD_PROJECTILES then
}
)
end
end

View File

@ -1,5 +1,7 @@
-- import
local attacks = {}
local attackBall = require("AttackBall")
local FORCE_OLD_PROJECTILES = settings.startup["rampant-forceOldProjectiles"].value
@ -9,6 +11,8 @@ local FORCE_OLD_PROJECTILES = settings.startup["rampant-forceOldProjectiles"].va
local softSmoke = "the-soft-smoke-rampant"
local createAttackBall = attackBall.createAttackBall
function attacks.addAttacks()
local multipler = (FORCE_OLD_PROJECTILES and 1) or 2.7
createAttackBall(
@ -236,3 +240,4 @@ if not FORCE_OLD_PROJECTILES then
}
)
end
end