2016-08-20 04:52:27 +02:00
|
|
|
-- imports
|
|
|
|
|
2016-08-27 08:44:17 +02:00
|
|
|
local entityUtils = require("libs/EntityUtils")
|
2017-01-20 07:58:36 +02:00
|
|
|
local mapUtils = require("libs/MapUtils")
|
2016-08-07 05:38:47 +02:00
|
|
|
local unitGroupUtils = require("libs/UnitGroupUtils")
|
2016-08-05 06:47:51 +02:00
|
|
|
local chunkProcessor = require("libs/ChunkProcessor")
|
|
|
|
local mapProcessor = require("libs/MapProcessor")
|
2016-08-04 00:22:20 +02:00
|
|
|
local constants = require("libs/Constants")
|
2016-08-05 06:47:51 +02:00
|
|
|
local pheromoneUtils = require("libs/PheromoneUtils")
|
2016-08-18 07:55:08 +02:00
|
|
|
local aiDefense = require("libs/AIDefense")
|
|
|
|
local aiAttack = require("libs/AIAttack")
|
2016-08-19 04:02:13 +02:00
|
|
|
local aiBuilding = require("libs/AIBuilding")
|
2016-10-15 02:00:18 +02:00
|
|
|
local aiPlanning = require("libs/AIPlanning")
|
|
|
|
local mathUtils = require("libs/MathUtils")
|
2017-05-06 11:03:28 +02:00
|
|
|
local interop = require("libs/Interop")
|
2016-08-22 00:59:17 +02:00
|
|
|
local tests = require("tests")
|
2016-08-04 00:22:20 +02:00
|
|
|
|
2016-10-15 02:00:18 +02:00
|
|
|
-- constants
|
|
|
|
|
|
|
|
local INTERVAL_LOGIC = constants.INTERVAL_LOGIC
|
|
|
|
local INTERVAL_PROCESS = constants.INTERVAL_PROCESS
|
|
|
|
|
2017-01-20 07:58:36 +02:00
|
|
|
local MAX_RALLY_CRIES = constants.MAX_RALLY_CRIES
|
|
|
|
|
|
|
|
local MOVEMENT_PHEROMONE = constants.MOVEMENT_PHEROMONE
|
|
|
|
|
|
|
|
local BASE_RALLY_CHANCE = constants.BASE_RALLY_CHANCE
|
|
|
|
local BONUS_RALLY_CHANCE = constants.BONUS_RALLY_CHANCE
|
|
|
|
|
|
|
|
local RETREAT_MOVEMENT_PHEROMONE_LEVEL = constants.RETREAT_MOVEMENT_PHEROMONE_LEVEL
|
|
|
|
|
2017-05-01 00:51:07 +02:00
|
|
|
local CHUNK_SIZE = constants.CHUNK_SIZE
|
|
|
|
|
2016-08-20 04:52:27 +02:00
|
|
|
-- imported functions
|
|
|
|
|
2017-01-20 07:58:36 +02:00
|
|
|
local getChunkByPosition = mapUtils.getChunkByPosition
|
|
|
|
|
2016-08-20 04:52:27 +02:00
|
|
|
local processPendingChunks = chunkProcessor.processPendingChunks
|
|
|
|
|
|
|
|
local processMap = mapProcessor.processMap
|
2016-10-15 02:00:18 +02:00
|
|
|
local processPlayers = mapProcessor.processPlayers
|
2016-08-29 02:05:28 +02:00
|
|
|
local scanMap = mapProcessor.scanMap
|
2016-08-20 04:52:27 +02:00
|
|
|
|
2016-10-15 02:00:18 +02:00
|
|
|
local planning = aiPlanning.planning
|
2016-08-20 04:52:27 +02:00
|
|
|
|
2017-01-20 07:58:36 +02:00
|
|
|
local rallyUnits = aiBuilding.rallyUnits
|
|
|
|
|
2016-08-20 04:52:27 +02:00
|
|
|
local deathScent = pheromoneUtils.deathScent
|
2017-04-22 01:14:04 +02:00
|
|
|
local victoryScent = pheromoneUtils.victoryScent
|
2016-08-20 04:52:27 +02:00
|
|
|
|
|
|
|
local regroupSquads = unitGroupUtils.regroupSquads
|
|
|
|
local convertUnitGroupToSquad = unitGroupUtils.convertUnitGroupToSquad
|
|
|
|
|
2016-08-28 22:48:19 +02:00
|
|
|
local squadAttack = aiAttack.squadAttack
|
2016-08-20 04:52:27 +02:00
|
|
|
local squadBeginAttack = aiAttack.squadBeginAttack
|
|
|
|
|
|
|
|
local retreatUnits = aiDefense.retreatUnits
|
|
|
|
|
2016-08-27 08:44:17 +02:00
|
|
|
local addRemoveEntity = entityUtils.addRemoveEntity
|
2017-05-06 11:03:28 +02:00
|
|
|
--local makeImmortalEntity = entityUtils.makeImmortalEntity
|
2016-08-20 04:52:27 +02:00
|
|
|
|
2016-10-15 02:00:18 +02:00
|
|
|
local roundToNearest = mathUtils.roundToNearest
|
|
|
|
|
2016-08-25 02:05:20 +02:00
|
|
|
-- local references to global
|
|
|
|
|
|
|
|
local regionMap
|
|
|
|
local natives
|
|
|
|
local pendingChunks
|
|
|
|
|
2016-07-30 00:44:31 +02:00
|
|
|
-- hook functions
|
|
|
|
|
2016-09-13 00:33:00 +02:00
|
|
|
local function onLoad()
|
2016-08-25 02:05:20 +02:00
|
|
|
regionMap = global.regionMap
|
|
|
|
natives = global.natives
|
|
|
|
pendingChunks = global.pendingChunks
|
2016-07-30 00:44:31 +02:00
|
|
|
end
|
|
|
|
|
2016-09-13 00:33:00 +02:00
|
|
|
local function onChunkGenerated(event)
|
|
|
|
-- queue generated chunk for delayed processing, queuing is required because some mods (RSO) mess with chunk as they
|
|
|
|
-- are generated, which messes up the scoring.
|
|
|
|
if (event.surface.index == 1) then
|
|
|
|
pendingChunks[#pendingChunks+1] = event
|
|
|
|
end
|
2016-08-25 02:05:20 +02:00
|
|
|
end
|
|
|
|
|
2017-05-06 11:03:28 +02:00
|
|
|
local function onModSettingsChange(event)
|
|
|
|
|
|
|
|
if event and (string.sub(event.setting, 1, 7) ~= "rampant") then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
natives.safeBuildings = settings.global["rampant-safeBuildings"].value
|
|
|
|
|
|
|
|
natives.safeEntities["curved-rail"] = settings.global["rampant-safeBuildings-curvedRail"].value
|
|
|
|
natives.safeEntities["straight-rail"] = settings.global["rampant-safeBuildings-straightRail"].value
|
|
|
|
natives.safeEntities["rail-signal"] = settings.global["rampant-safeBuildings-railSignals"].value
|
|
|
|
natives.safeEntities["rail-chain-signal"] = settings.global["rampant-safeBuildings-railChainSignals"].value
|
|
|
|
natives.safeEntities["train-stop"] = settings.global["rampant-safeBuildings-trainStops"].value
|
|
|
|
|
|
|
|
natives.safeEntityName["big-electric-pole"] = settings.global["rampant-safeBuildings-bigElectricPole"].value
|
|
|
|
|
|
|
|
natives.attackUsePlayer = settings.global["rampant-attackWaveGenerationUsePlayerProximity"].value
|
|
|
|
natives.attackUsePollution = settings.global["rampant-attackWaveGenerationUsePollution"].value
|
|
|
|
|
|
|
|
natives.attackThresholdMin = settings.global["rampant-attackWaveGenerationThresholdMin"].value
|
|
|
|
natives.attackThresholdMax = settings.global["rampant-attackWaveGenerationThresholdMax"].value
|
|
|
|
natives.attackThresholdRange = natives.attackThresholdMax - natives.attackThresholdMin
|
|
|
|
natives.attackWaveMaxSize = settings.global["rampant-attackWaveMaxSize"].value
|
|
|
|
natives.attackPlayerThreshold = settings.global["rampant-attackPlayerThreshold"].value
|
2017-05-14 00:32:16 +02:00
|
|
|
natives.aiNocturnalMode = settings.global["rampant-permanentNocturnal"].value
|
2017-05-14 05:23:25 +02:00
|
|
|
natives.aiPointsScaler = settings.global["rampant-aiPointsScaler"].value
|
2017-05-06 11:03:28 +02:00
|
|
|
end
|
|
|
|
|
2016-09-13 00:33:00 +02:00
|
|
|
local function onConfigChanged()
|
2016-08-25 02:05:20 +02:00
|
|
|
if (global.version == nil) then
|
2016-08-29 02:05:28 +02:00
|
|
|
|
|
|
|
-- removed in version 9
|
|
|
|
-- regionMap.pQ = {{}} -- processing queue
|
|
|
|
-- regionMap.pI = 1 -- insertion location for chunk processing
|
|
|
|
-- regionMap.pP = 1 -- index for the chunk set to process
|
|
|
|
-- regionMap.pR = -1 -- current processing roll
|
2016-08-25 02:05:20 +02:00
|
|
|
natives.squads = {}
|
|
|
|
natives.scouts = {}
|
|
|
|
natives.tunnels = {}
|
|
|
|
natives.points = 0
|
|
|
|
pendingChunks = {}
|
2017-04-17 04:46:36 +02:00
|
|
|
|
2016-08-27 08:44:17 +02:00
|
|
|
global.version = constants.VERSION_5
|
|
|
|
end
|
2016-08-28 22:48:19 +02:00
|
|
|
if (global.version < constants.VERSION_9) then
|
2016-09-14 20:16:00 +02:00
|
|
|
|
2016-08-29 02:05:28 +02:00
|
|
|
-- remove version 5 references
|
|
|
|
regionMap.pQ = nil
|
|
|
|
regionMap.pI = nil
|
|
|
|
regionMap.pP = nil
|
|
|
|
regionMap.pR = nil
|
2017-04-17 04:46:36 +02:00
|
|
|
|
2016-09-14 20:16:00 +02:00
|
|
|
global.version = constants.VERSION_9
|
|
|
|
end
|
|
|
|
if (global.version < constants.VERSION_10) then
|
|
|
|
for _,squad in pairs(natives.squads) do
|
|
|
|
squad.frenzy = false
|
|
|
|
squad.frenzyPosition = {x=0,y=0}
|
|
|
|
squad.rabid = false
|
|
|
|
end
|
|
|
|
|
|
|
|
global.version = constants.VERSION_10
|
2016-08-26 00:20:06 +02:00
|
|
|
end
|
2016-10-15 02:00:18 +02:00
|
|
|
if (global.version < constants.VERSION_11) then
|
|
|
|
natives.state = constants.AI_STATE_AGGRESSIVE
|
|
|
|
natives.temperament = 0
|
|
|
|
-- needs to be on inner logic tick loop interval
|
|
|
|
natives.stateTick = roundToNearest(game.tick + INTERVAL_LOGIC, INTERVAL_LOGIC)
|
|
|
|
natives.temperamentTick = roundToNearest(game.tick + INTERVAL_LOGIC, INTERVAL_LOGIC)
|
2016-11-04 09:26:19 +02:00
|
|
|
|
2016-11-04 01:51:35 +02:00
|
|
|
global.version = constants.VERSION_11
|
|
|
|
end
|
|
|
|
if (global.version < constants.VERSION_12) then
|
|
|
|
for _,squad in pairs(natives.squads) do
|
|
|
|
squad.status = constants.SQUAD_GUARDING
|
|
|
|
squad.kamikaze = false
|
|
|
|
end
|
|
|
|
|
|
|
|
-- reset ai build points due to error in earning points
|
|
|
|
natives.points = 0
|
2016-10-15 02:00:18 +02:00
|
|
|
|
2017-04-16 08:04:22 +02:00
|
|
|
global.version = constants.VERSION_12
|
|
|
|
end
|
|
|
|
if (global.version < constants.VERSION_13) then
|
|
|
|
-- switched over to tick event
|
|
|
|
regionMap.logicTick = roundToNearest(game.tick + INTERVAL_LOGIC, INTERVAL_LOGIC)
|
|
|
|
regionMap.processTick = roundToNearest(game.tick + INTERVAL_PROCESS, INTERVAL_PROCESS)
|
|
|
|
|
|
|
|
-- used to rate limit the number of rally cries during a period of time
|
|
|
|
natives.rallyCries = MAX_RALLY_CRIES
|
|
|
|
|
|
|
|
global.version = constants.VERSION_13
|
|
|
|
end
|
|
|
|
if (global.version < constants.VERSION_14) then
|
2017-04-17 04:46:36 +02:00
|
|
|
game.map_settings.unit_group.member_disown_distance = 5
|
|
|
|
game.map_settings.unit_group.max_member_speedup_when_behind = 1.1
|
|
|
|
game.map_settings.unit_group.max_member_slowdown_when_ahead = 1.0
|
|
|
|
game.map_settings.unit_group.max_group_slowdown_factor = 0.9
|
|
|
|
|
|
|
|
game.surfaces[1].print("Rampant - Version 0.14.11")
|
|
|
|
global.version = constants.VERSION_14
|
|
|
|
end
|
2017-04-22 01:14:04 +02:00
|
|
|
if (global.version < constants.VERSION_16) then
|
2017-04-17 04:46:36 +02:00
|
|
|
|
2017-04-22 01:14:04 +02:00
|
|
|
natives.lastShakeMessage = 0
|
|
|
|
--remove version 14 retreat limit, it has been made redundant
|
|
|
|
natives.retreats = nil
|
|
|
|
|
|
|
|
game.map_settings.unit_group.max_group_radius = 20
|
|
|
|
|
2017-04-25 06:08:41 +02:00
|
|
|
game.surfaces[1].print("Rampant - Version 0.14.13")
|
|
|
|
global.version = constants.VERSION_16
|
|
|
|
end
|
2017-05-06 11:03:28 +02:00
|
|
|
if (global.version < constants.VERSION_18) then
|
|
|
|
|
|
|
|
natives.safeEntities = {}
|
|
|
|
natives.safeEntityName = {}
|
2017-05-14 00:32:16 +02:00
|
|
|
|
|
|
|
game.surfaces[1].print("Rampant - Version 0.15.5")
|
|
|
|
global.version = constants.VERSION_18
|
|
|
|
end
|
|
|
|
if (global.version < constants.VERSION_19) then
|
|
|
|
|
2017-05-06 11:03:28 +02:00
|
|
|
onModSettingsChange(nil)
|
2017-04-25 06:08:41 +02:00
|
|
|
|
2016-10-15 02:00:18 +02:00
|
|
|
-- clear old regionMap processing Queue
|
|
|
|
-- prevents queue adding duplicate chunks
|
|
|
|
-- chunks are by key, so should overwrite old
|
|
|
|
regionMap.processQueue = {}
|
|
|
|
regionMap.processPointer = 1
|
|
|
|
regionMap.scanPointer = 1
|
|
|
|
-- clear pending chunks, will be added when loop runs below
|
2017-04-16 08:04:22 +02:00
|
|
|
pendingChunks = {}
|
|
|
|
|
2016-10-15 02:00:18 +02:00
|
|
|
-- queue all current chunks that wont be generated during play
|
|
|
|
local surface = game.surfaces[1]
|
|
|
|
for chunk in surface.get_chunks() do
|
|
|
|
onChunkGenerated({ surface = surface,
|
|
|
|
area = { left_top = { x = chunk.x * 32,
|
|
|
|
y = chunk.y * 32 }}})
|
|
|
|
end
|
2017-04-17 04:46:36 +02:00
|
|
|
|
2017-05-14 00:32:16 +02:00
|
|
|
game.surfaces[1].print("Rampant - Version 0.15.6")
|
|
|
|
global.version = constants.VERSION_19
|
2017-01-20 07:58:36 +02:00
|
|
|
end
|
2016-07-30 00:44:31 +02:00
|
|
|
end
|
|
|
|
|
2016-11-04 01:51:35 +02:00
|
|
|
local function onTick(event)
|
|
|
|
local tick = event.tick
|
2017-01-20 07:58:36 +02:00
|
|
|
if (tick == regionMap.processTick) then
|
|
|
|
regionMap.processTick = regionMap.processTick + INTERVAL_PROCESS
|
2016-09-13 00:33:00 +02:00
|
|
|
local surface = game.surfaces[1]
|
2017-04-25 06:08:41 +02:00
|
|
|
local evolutionFactor = game.forces.enemy.evolution_factor
|
2016-10-15 02:00:18 +02:00
|
|
|
local players = game.players
|
|
|
|
|
|
|
|
processPendingChunks(regionMap, surface, pendingChunks)
|
2017-04-22 01:33:17 +02:00
|
|
|
scanMap(regionMap, surface, natives, evolutionFactor)
|
2016-10-15 02:00:18 +02:00
|
|
|
|
2017-01-20 07:58:36 +02:00
|
|
|
if (tick == regionMap.logicTick) then
|
|
|
|
regionMap.logicTick = regionMap.logicTick + INTERVAL_LOGIC
|
|
|
|
|
|
|
|
natives.rallyCries = MAX_RALLY_CRIES
|
|
|
|
|
2017-04-22 01:33:17 +02:00
|
|
|
planning(natives, evolutionFactor, tick, surface)
|
2016-10-15 02:00:18 +02:00
|
|
|
|
2017-01-20 07:58:36 +02:00
|
|
|
regroupSquads(natives, evolutionFactor)
|
2016-10-15 02:00:18 +02:00
|
|
|
|
|
|
|
processPlayers(players, regionMap, surface, natives, evolutionFactor, tick)
|
|
|
|
|
|
|
|
squadBeginAttack(natives, players, evolutionFactor)
|
|
|
|
squadAttack(regionMap, surface, natives)
|
|
|
|
end
|
2016-09-13 00:33:00 +02:00
|
|
|
|
2016-10-15 02:00:18 +02:00
|
|
|
processMap(regionMap, surface, natives, evolutionFactor)
|
2016-08-20 20:24:22 +02:00
|
|
|
end
|
2016-08-05 06:47:51 +02:00
|
|
|
end
|
|
|
|
|
2016-09-13 00:33:00 +02:00
|
|
|
local function onBuild(event)
|
2016-11-04 01:51:35 +02:00
|
|
|
addRemoveEntity(regionMap, event.created_entity, natives, true, false)
|
2016-08-18 07:55:08 +02:00
|
|
|
end
|
|
|
|
|
2016-09-13 00:33:00 +02:00
|
|
|
local function onPickUp(event)
|
2016-11-04 01:51:35 +02:00
|
|
|
addRemoveEntity(regionMap, event.entity, natives, false, false)
|
2016-08-18 07:55:08 +02:00
|
|
|
end
|
|
|
|
|
2016-09-13 00:33:00 +02:00
|
|
|
local function onDeath(event)
|
2016-08-05 06:47:51 +02:00
|
|
|
local entity = event.entity
|
2016-08-27 08:44:17 +02:00
|
|
|
local surface = entity.surface
|
|
|
|
if (surface.index == 1) then
|
2016-08-25 01:30:45 +02:00
|
|
|
if (entity.force.name == "enemy") then
|
|
|
|
if (entity.type == "unit") then
|
|
|
|
local entityPosition = entity.position
|
2017-01-20 07:58:36 +02:00
|
|
|
local deathChunk = getChunkByPosition(regionMap, entityPosition.x, entityPosition.y)
|
|
|
|
|
|
|
|
if (deathChunk ~= nil) then
|
|
|
|
-- drop death pheromone where unit died
|
|
|
|
deathScent(deathChunk)
|
|
|
|
|
|
|
|
if ((event.force ~= nil) and (event.force.name == "player")) then
|
2017-04-25 06:08:41 +02:00
|
|
|
local evolutionFactor = game.forces.enemy.evolution_factor
|
2017-01-20 07:58:36 +02:00
|
|
|
|
|
|
|
if (deathChunk[MOVEMENT_PHEROMONE] < -(evolutionFactor * RETREAT_MOVEMENT_PHEROMONE_LEVEL)) then
|
2017-04-22 01:14:04 +02:00
|
|
|
retreatUnits(deathChunk,
|
|
|
|
convertUnitGroupToSquad(natives,
|
|
|
|
entity.unit_group),
|
|
|
|
regionMap,
|
|
|
|
surface,
|
|
|
|
natives,
|
|
|
|
event.tick)
|
2017-01-20 07:58:36 +02:00
|
|
|
local rallyThreshold = BASE_RALLY_CHANCE + (evolutionFactor * BONUS_RALLY_CHANCE)
|
|
|
|
if (natives.rallyCries >= 0) and (math.random() < rallyThreshold) then
|
|
|
|
natives.rallyCries = natives.rallyCries - 1
|
|
|
|
rallyUnits(deathChunk,
|
|
|
|
regionMap,
|
|
|
|
surface,
|
|
|
|
natives,
|
|
|
|
evolutionFactor)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-08-25 01:30:45 +02:00
|
|
|
end
|
|
|
|
|
2017-01-20 07:58:36 +02:00
|
|
|
-- removeScout(entity, natives)
|
2017-04-16 08:04:22 +02:00
|
|
|
elseif (entity.type == "unit-spawner") or (entity.type == "turret") then
|
2016-11-04 01:51:35 +02:00
|
|
|
addRemoveEntity(regionMap, entity, natives, false, false)
|
2016-08-18 07:55:08 +02:00
|
|
|
end
|
2016-08-25 01:30:45 +02:00
|
|
|
elseif (entity.force.name == "player") then
|
2016-11-04 01:51:35 +02:00
|
|
|
local creditNatives = false
|
2017-05-01 00:51:07 +02:00
|
|
|
local entityPosition = entity.position
|
2016-11-04 01:51:35 +02:00
|
|
|
if (event.force ~= nil) and (event.force.name == "enemy") then
|
|
|
|
creditNatives = true
|
2017-04-22 01:14:04 +02:00
|
|
|
local victoryChunk = getChunkByPosition(regionMap, entityPosition.x, entityPosition.y)
|
|
|
|
victoryScent(victoryChunk, entity.type)
|
2016-11-04 01:51:35 +02:00
|
|
|
end
|
2017-05-06 11:03:28 +02:00
|
|
|
if creditNatives and natives.safeBuildings and (natives.safeEntities[entity.type] or natives.safeEntityName[entity.name]) then
|
2017-05-01 00:51:07 +02:00
|
|
|
-- makeImmortalEntity(surface, entity)
|
|
|
|
|
|
|
|
-- patch (Needs to be removed)
|
|
|
|
local repairPosition = entityPosition
|
|
|
|
local repairName = entity.name
|
|
|
|
local repairForce = entity.force
|
|
|
|
local repairDirection = entity.direction
|
|
|
|
entity.destroy()
|
|
|
|
surface.create_entity({position=repairPosition,
|
|
|
|
name=repairName,
|
|
|
|
direction=repairDirection,
|
|
|
|
force=repairForce})
|
|
|
|
-- forces enemy to disperse
|
|
|
|
local enemies = surface.find_enemy_units({repairPosition.x, repairPosition.y}, CHUNK_SIZE)
|
|
|
|
for i=1, #enemies do
|
|
|
|
enemies[i].set_command({type=defines.command.wander,
|
|
|
|
distraction=defines.distraction.by_enemy})
|
|
|
|
end
|
2017-04-17 04:46:36 +02:00
|
|
|
else
|
|
|
|
addRemoveEntity(regionMap, entity, natives, false, creditNatives)
|
|
|
|
end
|
2016-08-09 04:54:41 +02:00
|
|
|
end
|
2016-08-03 17:54:21 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-13 01:23:26 +02:00
|
|
|
local function onSurfaceTileChange(event)
|
2016-08-21 23:48:55 +02:00
|
|
|
-- local player = game.players[event.player_index]
|
|
|
|
-- if (player.surface.index==1) then
|
2016-11-04 09:26:19 +02:00
|
|
|
-- aiBuilding.fillTunnel(global.regionMap, player.surface, global.natives, event.positions)
|
2016-08-21 23:48:55 +02:00
|
|
|
-- end
|
2016-08-21 02:28:35 +02:00
|
|
|
end
|
|
|
|
|
2016-09-13 00:33:00 +02:00
|
|
|
local function onInit()
|
|
|
|
global.regionMap = {}
|
|
|
|
global.pendingChunks = {}
|
|
|
|
global.natives = {}
|
|
|
|
|
|
|
|
regionMap = global.regionMap
|
|
|
|
natives = global.natives
|
|
|
|
pendingChunks = global.pendingChunks
|
|
|
|
|
|
|
|
onConfigChanged()
|
|
|
|
end
|
|
|
|
|
2016-08-04 02:22:27 +02:00
|
|
|
-- hooks
|
|
|
|
|
2016-07-30 00:44:31 +02:00
|
|
|
script.on_init(onInit)
|
|
|
|
script.on_load(onLoad)
|
2017-05-06 11:03:28 +02:00
|
|
|
script.on_event(defines.events.on_runtime_mod_setting_changed,
|
|
|
|
onModSettingsChange)
|
2016-08-25 02:05:20 +02:00
|
|
|
script.on_configuration_changed(onConfigChanged)
|
2016-07-30 00:44:31 +02:00
|
|
|
|
2016-09-13 01:23:26 +02:00
|
|
|
script.on_event(defines.events.on_player_built_tile, onSurfaceTileChange)
|
2016-08-21 02:28:35 +02:00
|
|
|
|
2016-08-18 07:55:08 +02:00
|
|
|
script.on_event({defines.events.on_preplayer_mined_item,
|
|
|
|
defines.events.on_robot_pre_mined},
|
2016-11-04 09:26:19 +02:00
|
|
|
onPickUp)
|
2016-08-18 07:55:08 +02:00
|
|
|
script.on_event({defines.events.on_built_entity,
|
|
|
|
defines.events.on_robot_built_entity},
|
2016-11-04 09:26:19 +02:00
|
|
|
onBuild)
|
2016-09-09 12:02:50 +02:00
|
|
|
|
|
|
|
script.on_event(defines.events.on_entity_died, onDeath)
|
2016-08-20 04:52:27 +02:00
|
|
|
script.on_event(defines.events.on_tick, onTick)
|
2016-07-30 00:44:31 +02:00
|
|
|
script.on_event(defines.events.on_chunk_generated, onChunkGenerated)
|
|
|
|
|
2017-05-06 11:03:28 +02:00
|
|
|
remote.add_interface("rampantTests", {
|
2016-10-15 02:00:18 +02:00
|
|
|
test1 = tests.test1,
|
|
|
|
test2 = tests.test2,
|
|
|
|
test3 = tests.test3,
|
|
|
|
test4 = tests.test4,
|
|
|
|
test5 = tests.test5,
|
|
|
|
test6 = tests.test6,
|
|
|
|
test7 = tests.test7,
|
|
|
|
test8 = tests.test8,
|
|
|
|
test9 = tests.test9,
|
|
|
|
test10 = tests.test10,
|
2017-05-06 11:03:28 +02:00
|
|
|
test11 = tests.test11
|
2016-10-15 02:00:18 +02:00
|
|
|
})
|
2017-05-06 11:03:28 +02:00
|
|
|
|
|
|
|
remote.add_interface("rampant", interop)
|