mirror of
https://github.com/veden/Rampant.git
synced 2025-03-17 20:58:35 +02:00
see changelog
This commit is contained in:
parent
339e3384d0
commit
0183b78fd1
@ -336,10 +336,10 @@ function upgrade.attempt(universe)
|
||||
universe.safeEntities = {}
|
||||
|
||||
universe.aiPointsScaler = settings.global["rampant--aiPointsScaler"].value
|
||||
|
||||
|
||||
universe.aiPointsPrintGainsToChat = settings.global["rampant--aiPointsPrintGainsToChat"].value
|
||||
universe.aiPointsPrintSpendingToChat = settings.global["rampant--aiPointsPrintSpendingToChat"].value
|
||||
|
||||
|
||||
universe.aiNocturnalMode = settings.global["rampant--permanentNocturnal"].value
|
||||
|
||||
universe.mapIterator = nil
|
||||
|
@ -3,6 +3,8 @@ Version: 1.0.10
|
||||
Date: 29. 04. 2021
|
||||
Contributions:
|
||||
- Astorin removed old unused ru.cfg locale
|
||||
- Dagothur added a mod setting to print ai point gains to chat
|
||||
- Dagothur added a mod setting to print ai point usage to chat
|
||||
Improvements:
|
||||
- Increased ai baseline point accumulation based on temperament
|
||||
Tweaks:
|
||||
|
38
control.lua
38
control.lua
@ -133,9 +133,9 @@ local function onIonCannonFired(event)
|
||||
map.ionCannonBlasts = map.ionCannonBlasts + 1
|
||||
map.points = map.points + 4000
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. 4000 .. ". [Ion Cannon] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. 4000 .. ". [Ion Cannon] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
|
||||
|
||||
local chunk = getChunkByPosition(map, event.position)
|
||||
if (chunk ~= -1) then
|
||||
rallyUnits(chunk, map, event.tick)
|
||||
@ -239,7 +239,7 @@ local function onModSettingsChange(event)
|
||||
|
||||
universe.aiPointsPrintGainsToChat = settings.global["rampant--aiPointsPrintGainsToChat"].value
|
||||
universe.aiPointsPrintSpendingToChat = settings.global["rampant--aiPointsPrintSpendingToChat"].value
|
||||
|
||||
|
||||
universe.enabledMigration = universe.expansion and settings.global["rampant--enableMigration"].value
|
||||
universe.peacefulAIToggle = settings.global["rampant--peacefulAIToggle"].value
|
||||
universe.printAIStateChanges = settings.global["rampant--printAIStateChanges"].value
|
||||
@ -518,10 +518,10 @@ local function onDeath(event)
|
||||
else
|
||||
map.points = map.points + RECOVER_WORM_COST
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. RECOVER_WORM_COST .. ". [Worm Lost] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. RECOVER_WORM_COST .. ". [Worm Lost] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
unregisterEnemyBaseStructure(map, entity, event.damage_type)
|
||||
|
||||
if (chunk ~= -1) then
|
||||
@ -763,7 +763,7 @@ local function onRocketLaunch(event)
|
||||
map.rocketLaunched = map.rocketLaunched + 1
|
||||
map.points = map.points + 5000
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. 5000 .. ". [Rocket Launch] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. 5000 .. ". [Rocket Launch] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -836,7 +836,7 @@ local function onUnitGroupCreated(event)
|
||||
group.destroy()
|
||||
map.points = map.points + AI_SQUAD_COST
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
return
|
||||
end
|
||||
@ -860,7 +860,7 @@ local function onUnitGroupCreated(event)
|
||||
if not (surface.darkness > 0.65) then
|
||||
map.points = map.points + AI_SQUAD_COST
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
group.destroy()
|
||||
return
|
||||
@ -874,7 +874,7 @@ local function onUnitGroupCreated(event)
|
||||
group.destroy()
|
||||
map.points = map.points + AI_SQUAD_COST
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
return
|
||||
end
|
||||
@ -922,7 +922,7 @@ local function onGroupFinishedGathering(event)
|
||||
group.destroy()
|
||||
map.points = map.points + AI_SQUAD_COST
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -935,7 +935,7 @@ local function onGroupFinishedGathering(event)
|
||||
group.destroy()
|
||||
map.points = map.points + AI_SQUAD_COST
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. AI_SQUAD_COST .. ". [Squad Refund] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
return
|
||||
end
|
||||
@ -990,9 +990,9 @@ local function onBuilderArrived(event)
|
||||
local targetPosition = universe.position
|
||||
targetPosition.x = builder.position.x
|
||||
targetPosition.y = builder.position.y
|
||||
|
||||
|
||||
--local map = universe.maps[event.surface.index] -- crashes
|
||||
if universe.aiPointsPrintSpendingToChat then
|
||||
if universe.aiPointsPrintSpendingToChat then
|
||||
--game.print(map.surface.name .. ": Settled: [gps=" .. targetPosition.x .. "," .. targetPosition.y .."]") -- crashes
|
||||
game.print("Settled: [gps=" .. targetPosition.x .. "," .. targetPosition.y .."]")
|
||||
end
|
||||
@ -1135,17 +1135,17 @@ remote.add_interface("rampantTests",
|
||||
function rampantSetAIState(event)
|
||||
local surfaceIndex = game.players[event.player_index].surface.index
|
||||
local map = universe.maps[surfaceIndex]
|
||||
|
||||
|
||||
game.print(map.surface.name .. " is in " .. constants.stateEnglish[map.state])
|
||||
|
||||
|
||||
if event.parameter then
|
||||
local target = tonumber(event.parameter)
|
||||
|
||||
|
||||
if (target == nil) then
|
||||
game.print("invalid param")
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if (target ~= constants.AI_STATE_PEACEFUL and target ~= constants.AI_STATE_AGGRESSIVE and target ~= constants.AI_STATE_RAIDING and target ~= constants.AI_STATE_MIGRATING and target ~= constants.AI_STATE_SIEGE and target ~= constants.AI_STATE_ONSLAUGHT) then
|
||||
game.print(target .. " is not a valid state")
|
||||
return
|
||||
@ -1156,4 +1156,4 @@ function rampantSetAIState(event)
|
||||
end
|
||||
end
|
||||
|
||||
commands.add_command('rampantSetAIState', "", rampantSetAIState)
|
||||
commands.add_command('rampantSetAIState', "", rampantSetAIState)
|
||||
|
@ -231,7 +231,7 @@ function aiAttackWave.formSettlers(map, chunk)
|
||||
squad.kamikaze = mRandom() < calculateKamikazeThreshold(foundUnits, universe)
|
||||
universe.builderCount = universe.builderCount + 1
|
||||
map.points = map.points - AI_SETTLER_COST
|
||||
if universe.aiPointsPrintSpendingToChat then
|
||||
if universe.aiPointsPrintSpendingToChat then
|
||||
game.print(map.surface.name .. ": Points: -" .. AI_SETTLER_COST .. ". [Settler] Total: " .. string.format("%.2f", map.points) .. " [gps=" .. squadPosition.x .. "," .. squadPosition.y .. "]")
|
||||
end
|
||||
map.groupNumberToSquad[squad.groupNumber] = squad
|
||||
@ -282,7 +282,7 @@ function aiAttackWave.formVengenceSquad(map, chunk)
|
||||
map.groupNumberToSquad[squad.groupNumber] = squad
|
||||
universe.squadCount = universe.squadCount + 1
|
||||
map.points = map.points - AI_VENGENCE_SQUAD_COST
|
||||
if universe.aiPointsPrintSpendingToChat then
|
||||
if universe.aiPointsPrintSpendingToChat then
|
||||
game.print(map.surface.name .. ": Points: -" .. AI_VENGENCE_SQUAD_COST .. ". [Vengence] Total: " .. string.format("%.2f", map.points) .. " [gps=" .. squadPosition.x .. "," .. squadPosition.y .. "]")
|
||||
end
|
||||
else
|
||||
@ -338,7 +338,7 @@ function aiAttackWave.formSquads(map, chunk, tick)
|
||||
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
||||
AGGRESSIVE_CAN_ATTACK_WAIT_MAX_DURATION)
|
||||
end
|
||||
if universe.aiPointsPrintSpendingToChat then
|
||||
if universe.aiPointsPrintSpendingToChat then
|
||||
game.print(map.surface.name .. ": Points: -" .. AI_SQUAD_COST .. ". [Squad] Total: " .. string.format("%.2f", map.points) .. " [gps=" .. squadPosition.x .. "," .. squadPosition.y .. "]")
|
||||
end
|
||||
else
|
||||
|
@ -287,7 +287,7 @@ end
|
||||
function getTimeStringFromTick(tick)
|
||||
|
||||
local tickToSeconds = tick / 60
|
||||
|
||||
|
||||
local days = math.floor(tickToSeconds / 86400)
|
||||
local hours = math.floor((tickToSeconds % 86400) / 3600)
|
||||
local minutes = math.floor((tickToSeconds % 3600) / 60)
|
||||
|
@ -364,13 +364,13 @@ function baseUtils.processBase(chunk, map, tick, base)
|
||||
end
|
||||
|
||||
-- if (base.deathEvents > 1000) then
|
||||
if (upgradeRoll > 0.95) then
|
||||
if (base.points >= BASE_UPGRADE) then
|
||||
if upgradeBase(map, base) then
|
||||
base.points = base.points - BASE_UPGRADE
|
||||
end
|
||||
-- if (upgradeRoll > 0.95) then
|
||||
if (base.points >= BASE_UPGRADE) then
|
||||
if upgradeBase(map, base) then
|
||||
base.points = base.points - BASE_UPGRADE
|
||||
end
|
||||
end
|
||||
-- end
|
||||
-- base.damagedBy = {}
|
||||
-- base.deathEvents = 0
|
||||
-- end
|
||||
|
@ -550,12 +550,12 @@ function chunkUtils.accountPlayerEntity(entity, map, addObject, creditNatives)
|
||||
if (map.state == AI_STATE_ONSLAUGHT) then
|
||||
map.points = map.points + entityValue
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. math.floor(entityValue) .. ". [Structure Kill] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. math.floor(entityValue) .. ". [Structure Kill] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
else
|
||||
map.points = map.points + (entityValue * 0.12)
|
||||
if universe.aiPointsPrintGainsToChat then
|
||||
game.print(map.surface.name .. ": Points: +" .. math.floor(entityValue * 0.12) .. ". [Structure Kill] Total: " .. string.format("%.2f", map.points))
|
||||
game.print(map.surface.name .. ": Points: +" .. math.floor(entityValue * 0.12) .. ". [Structure Kill] Total: " .. string.format("%.2f", map.points))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
12
settings.lua
12
settings.lua
@ -499,16 +499,16 @@ data:extend({
|
||||
order = "m[total]-b[ai]1",
|
||||
per_user = false
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
type = "bool-setting",
|
||||
name = "rampant--aiPointsPrintSpendingToChat",
|
||||
description = "rampant--aiPointsPrintSpendingToChat",
|
||||
setting_type = "runtime-global",
|
||||
default_value = false,
|
||||
order = "m[total]-b[ai]2",
|
||||
order = "m[total]-c[ai]z",
|
||||
per_user = false
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
type = "bool-setting",
|
||||
@ -516,10 +516,10 @@ data:extend({
|
||||
description = "rampant--aiPointsPrintGainsToChat",
|
||||
setting_type = "runtime-global",
|
||||
default_value = false,
|
||||
order = "m[total]-b[ai]3",
|
||||
order = "m[total]-c[ai]z",
|
||||
per_user = false
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
type = "double-setting",
|
||||
name = "rampant--temperamentRateModifier",
|
||||
@ -530,7 +530,7 @@ data:extend({
|
||||
order = "m[total]-b[ai]",
|
||||
per_user = false
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
type = "bool-setting",
|
||||
name = "rampant--removeBloodParticles",
|
||||
|
Loading…
x
Reference in New Issue
Block a user