1
0
mirror of https://github.com/veden/Rampant.git synced 2025-03-17 20:58:35 +02:00

adds /rampantSetAIState command

adds /rampantSetAIState command

sets the player's current surface to the state index passed to the command
This commit is contained in:
Dagothur 2021-04-30 12:04:59 -04:00
parent d874784f81
commit 1754af50d4
2 changed files with 27 additions and 1 deletions

View File

@ -1101,3 +1101,29 @@ remote.add_interface("rampantTests",
scanChunkPaths = tests.scanChunkPaths
}
)
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
else
map.state = target
game.print(map.surface.name .. " is now in " .. constants.stateEnglish[map.state])
end
end
end
commands.add_command('rampantSetAIState', "", rampantSetAIState)

View File

@ -413,7 +413,7 @@ function aiPlanning.temperamentPlanner(map)
game.print("aN:" .. map.activeNests .. ", aRN:" .. map.activeRaidNests .. ", dPB:" .. map.destroyPlayerBuildings ..
", lEU:" .. map.lostEnemyUnits .. ", lEB:" .. map.lostEnemyBuilding .. ", rL:" .. map.rocketLaunched .. ", bEB:" .. map.builtEnemyBuilding ..
", iCB:" .. map.ionCannonBlasts .. ", aB:" .. map.artilleryBlasts)
game.print("temp: " .. map.temperament .. ", tempScore:" .. map.temperamentScore .. ", points:" .. map.points .. ", state:" .. constants.stateEnglish[map.state] .. ", surface:" .. map.surface.index)
game.print("temp: " .. map.temperament .. ", tempScore:" .. map.temperamentScore .. ", points:" .. map.points .. ", state:" .. constants.stateEnglish[map.state] .. ", surface:" .. map.surface.index .. " [" .. map.surface.name .. "]")
game.print("aS:" .. universe.squadCount .. ", aB:" .. universe.builderCount .. ", atkSize:" .. universe.attackWaveSize .. ", stlSize:" .. universe.settlerWaveSize .. ", formGroup:" .. universe.formSquadThreshold)
end
end