Skip to content

Commit

Permalink
see readme
Browse files Browse the repository at this point in the history
  • Loading branch information
veden committed Apr 30, 2017
1 parent dae6da6 commit 26c3ceb
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 52 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Configure Options not in game menu:

# Version History

0.15.3 -
- Improvement: Added configuration for safe buildings. This will be improved after a bug fix in factorio

0.15.2 -
- Improvement: Created in game options for
- Max biter wave size
Expand Down
51 changes: 4 additions & 47 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,13 @@ local gaussianRandomRange = mathUtils.gaussianRandomRange

--[[
Causes buildings to regenerate and become untargetable after they are destroyed by biters
Currently doesn't work **** IGNORE ****
--]]
config.safeBuildings = false
config.safeBuildings = settings.startup["rampant-safeBuildings"].value
config.safeEntities = {}
config.safeEntityName = {}
config.safeEntities["curved-rail"] = true
config.safeEntities["straight-rail"] = true
--config.safeEntities["electric-pole"] = true
config.safeEntityName["big-electric-pole"] = true

-- --[[
-- turns off homing projectiles for worms and spitters
-- --]]
-- config.useDumbProjectiles = true

-- --[[
-- ONLY FOR USE WITH NATURAL EVOLUTION ENEMIES
-- use the NE unit launchers with medium and big worms.
-- if set to false this will still allow the dumb projectiles but without the unit spawning
-- A side effect of the dumb projectiles cause the units to be spawned as if two shots were fired
-- --]]
-- config.useNEUnitLaunchers = true

-- --[[
-- the attackWaveGenerationUse* options are used to score chunks with biter nests that will generate a Rampant attack wave.
-- Pollution, the vanilla pollution mechanic (shown on the minimap).
-- Player Proximity, if a player moves near a biter nest there is a chance for the nest to spawn attack waves (not shown on the minimap).
-- switching all to false will turn off Rampant biter waves
-- DOES NOT affect vanilla biters waves
-- --]]
-- config.attackWaveGenerationUsePollution = true
-- config.attackWaveGenerationUsePlayerProximity = true

-- --[[
-- attackWaveGenerationThreshold is the score that the attackWaveGenerationUse* has to reach in order for an attack wave to spawn.
-- increasing this will reduce the radius of attack wave generation.
-- DOES NOT affect vanilla biters waves
-- scaling linearly with evolution factor
-- starts 20 @ 0.0 evolution
-- ends 0 @ 100.0 evolution
-- default max is 20
-- default min is 0
-- --]]
-- config.attackWaveGenerationThresholdMax = 20
-- config.attackWaveGenerationThresholdMin = 0

-- --[[
-- attackWaveMaxSize is the largest size that can be initially spawned by Rampant
-- --]]
-- config.attackWaveMaxSize = 150
config.safeEntities["curved-rail"] = settings.startup["rampant-safeBuildings-curvedRail"].value
config.safeEntities["straight-rail"] = settings.startup["rampant-safeBuildings-straightRail"].value
config.safeEntityName["big-electric-pole"] = settings.startup["rampant-safeBuildings-bigElectricPole"].value

--[[
attackWaveScaling is used to calculate the attack wave size from the evolutionFactor
Expand Down
25 changes: 22 additions & 3 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ local BONUS_RALLY_CHANCE = constants.BONUS_RALLY_CHANCE

local RETREAT_MOVEMENT_PHEROMONE_LEVEL = constants.RETREAT_MOVEMENT_PHEROMONE_LEVEL

local CHUNK_SIZE = constants.CHUNK_SIZE

-- imported functions

local getChunkByPosition = mapUtils.getChunkByPosition
Expand Down Expand Up @@ -279,14 +281,31 @@ local function onDeath(event)
end
elseif (entity.force.name == "player") then
local creditNatives = false
local entityPosition = entity.position
if (event.force ~= nil) and (event.force.name == "enemy") then
creditNatives = true
local entityPosition = entity.position
local victoryChunk = getChunkByPosition(regionMap, entityPosition.x, entityPosition.y)
victoryScent(victoryChunk, entity.type)
end
if config.safeBuildings and (config.safeEntities[entity.type] or config.safeEntityName[entity.name]) then
makeImmortalEntity(surface, entity)
if creditNatives and config.safeBuildings and (config.safeEntities[entity.type] or config.safeEntityName[entity.name]) then
-- 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
else
addRemoveEntity(regionMap, entity, natives, false, creditNatives)
end
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name" : "Rampant",
"factorio_version" : "0.15",
"version" : "0.15.2",
"version" : "0.15.3",
"title" : "Rampant AI",
"author" : "Veden",
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",
Expand Down
2 changes: 2 additions & 0 deletions libs/EntityUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ local PLAYER_BASE_GENERATOR = constants.PLAYER_BASE_GENERATOR

local ENEMY_BASE_PHEROMONE_GENERATOR_AMOUNT = constants.ENEMY_BASE_PHEROMONE_GENERATOR_AMOUNT

local CHUNK_SIZE = constants.CHUNK_SIZE

-- imported functions

local getChunkByIndex = mapUtils.getChunkByIndex
Expand Down
14 changes: 14 additions & 0 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ rampant-attackWaveGenerationUsePlayerProximity=Use Player Proximity as attack tr
rampant-attackWaveGenerationThresholdMax=Starting chunk attack threshold
rampant-attackWaveGenerationThresholdMin=Ending chunk attack threshold
rampant-attackWaveMaxSize=Max biter group size that can be directly formed
rampant-safeBuildings=Make buildings safe from biters
rampant-safeBuildings-curvedRail=Make curved rails safe from biters
rampant-safeBuildings-straightRail=Make straight rails safe from biters
rampant-safeBuildings-bigElectricPole=Make big electric poles safe from biters
rampant-safeBuildings-railChainSignals=Make rail chain signals safe from biters
rampant-safeBuildings-railSignals=Make rail signals safe from biters
rampant-safeBuildings-trainStops=Make train stops safe from biters

[mod-setting-description]
rampant-useDumbProjectiles=Turns off homing projectiles for worms and spitters
Expand All @@ -37,3 +44,10 @@ rampant-attackWaveGenerationUsePlayerProximity=Include player pheromones amount
rampant-attackWaveGenerationThresholdMax=The score that a chunk must reach in order for an attack wave to spawn. DOES NOT affect vanilla biters waves. Scaling linearly with evolution factor (starting threshold @ 0.0 evolution)
rampant-attackWaveGenerationThresholdMin=The score that a chunk must reach in order for an attack wave to spawn. DOES NOT affect vanilla biters waves. Scaling linearly with evolution factor (ending threshold @ 100.0 evolution)
rampant-attackWaveMaxSize=If you wish to change how the attack wave scales with evolution you will need to modify the config.lua in the zip file.
rampant-safeBuildings=This needs to be toggle for the safe building toggles to work. Understand this can cause weird behavior due to the fact that this is a stopgap until a bug is fixed in factorio.
rampant-safeBuildings-curvedRail=Make curved rails safe from biters
rampant-safeBuildings-straightRail=Make straight rails safe from biters
rampant-safeBuildings-bigElectricPole=Make big electric poles safe from biters
rampant-safeBuildings-railChainSignals=Make rail chain signals safe from biters
rampant-safeBuildings-railSignals=Make rail signals safe from biters
rampant-safeBuildings-trainStops=Make train stops safe from biters
65 changes: 64 additions & 1 deletion settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,70 @@ data:extend({
default_value = 150,
order = "d[modifier]-a[wave]",
per_user = false
}
},

{
type = "bool-setting",
name = "rampant-safeBuildings",
setting_type = "startup",
default_value = false,
order = "e[modifier]-a[safe]",
per_user = false
},

{
type = "bool-setting",
name = "rampant-safeBuildings-curvedRail",
setting_type = "startup",
default_value = false,
order = "e[modifier]-b[safe]",
per_user = false
},


{
type = "bool-setting",
name = "rampant-safeBuildings-straightRail",
setting_type = "startup",
default_value = false,
order = "e[modifier]-c[safe]",
per_user = false
},

{
type = "bool-setting",
name = "rampant-safeBuildings-bigElectricPole",
setting_type = "startup",
default_value = false,
order = "e[modifier]-d[safe]",
per_user = false
},

{
type = "bool-setting",
name = "rampant-safeBuildings-railSignals",
setting_type = "startup",
default_value = false,
order = "e[modifier]-e[safe]",
per_user = false
},

{
type = "bool-setting",
name = "rampant-safeBuildings-railChainSignals",
setting_type = "startup",
default_value = false,
order = "e[modifier]-f[safe]",
per_user = false
},

{
type = "bool-setting",
name = "rampant-safeBuildings-trainStops",
setting_type = "startup",
default_value = false,
order = "e[modifier]-g[safe]",
per_user = false
}

})

0 comments on commit 26c3ceb

Please sign in to comment.