Last active
November 9, 2024 17:50
-
-
Save abaines/face20060a0d644dd5e70b9ac6e54943 to your computer and use it in GitHub Desktop.
Factorio space-age: Fix starting map settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local handler = require("event_handler") | |
handler.add_lib(require("freeplay")) | |
if script.active_mods["space-age"] then | |
handler.add_lib(require("space-finish-script")) | |
else | |
handler.add_lib(require("silo-script")) | |
end | |
-- kizrak | |
local red = {255, 0, 0} | |
local green = {0.1, 1, 0.1} | |
local yellow = {1, 1, 0.1} | |
local function allprint(msg,color) | |
log(msg) | |
for i, player in pairs(game.connected_players) do | |
player.print(msg,{color=color}) | |
end | |
end | |
-- " ππ±ββ°β±π°π°π₯π’π€βπΆπ°β»ππ βΊβΆππβͺπ²π³β¨πππππ§¨βπππ₯π¦ββπβ€ π΄ " | |
local function kprint(msg,color,player) | |
if player then | |
log(msg) | |
player.print("βͺ"..msg,{color=color}) | |
else | |
allprint(msg,color) | |
end | |
end | |
local function getParameter(event) | |
if event.parameter then | |
return event.parameter:lower() | |
else | |
return "" | |
end | |
end | |
-- kizrak | |
local sb = serpent.block -- luacheck: ignore 211 | |
local function displayValue(name,value) | |
allprint(name .. " -> " .. value,yellow) | |
end | |
local function displayGameMapSettings(player) | |
allprint("About to list '" .. player.name .. "'",yellow) | |
displayValue("enemy_expansion.min_expansion_cooldown", game.map_settings.enemy_expansion.min_expansion_cooldown) | |
displayValue("enemy_expansion.max_expansion_cooldown", game.map_settings.enemy_expansion.max_expansion_cooldown) | |
displayValue("enemy_evolution.time_factor", game.map_settings.enemy_evolution.time_factor) | |
displayValue("enemy_evolution.destroy_factor", game.map_settings.enemy_evolution.destroy_factor) | |
displayValue("enemy_evolution.pollution_factor", game.map_settings.enemy_evolution.pollution_factor) | |
end | |
local function cheatGameMapSettings(player) | |
allprint("About to cheat '" .. player.name .. "'",red) | |
game.map_settings.enemy_expansion.min_expansion_cooldown = 14400 | |
game.map_settings.enemy_expansion.max_expansion_cooldown = 216000 | |
game.map_settings.enemy_evolution.time_factor = 0 -- 4e-06 | |
game.map_settings.enemy_evolution.destroy_factor = 0.002 | |
game.map_settings.enemy_evolution.pollution_factor = 9e-07 | |
allprint("Finished cheating '" .. player.name .. "'",green) | |
end | |
local function listPlayersAchievements(event_player) | |
local tick = game.tick | |
local half_ticks = tick / 2.0 | |
local function r(number) | |
return tonumber( string.format("%.1f",number) ) | |
end | |
local function t(ticks) | |
local unit_mod = 3600.0 | |
return "" .. r(ticks/unit_mod) .. "m" | |
end | |
local msg = "Achievement Eligibility βΆ ".. t(tick) | |
kprint(msg,green,event_player) | |
for i, player in pairs(game.players) do | |
local name = player.name | |
local online_time = player.online_time | |
local average_time = 100.0 * online_time / tick | |
local afk_time = 100.0 * player.afk_time / tick | |
local x = tick - 2*online_time | |
local color = average_time>50.0 and green or yellow | |
-- " ππ±ββ°β±π°π°π₯π’π€βπΆπ°β»ππ βΊβΆππβͺπ²π³β¨πππππ§¨βπππ₯π¦ββπβ€ π΄ " | |
kprint(" " .. name .. " βΆ " .. t(online_time) .. " β " .. r(average_time) .. "% β§ " .. t(x),color,event_player) | |
end | |
end | |
local function kizrak(event) | |
local player = game.players[event.player_index] | |
local parameter = getParameter(event) | |
if string.find(parameter,"list") then | |
displayGameMapSettings(player) | |
elseif parameter == "cheat" then | |
cheatGameMapSettings(player) | |
elseif string.find(parameter,"player") or string.find(parameter,"achi") then --achievements | |
listPlayersAchievements(player) | |
else | |
allprint("invalid command 3 '" .. player.name .. "'",yellow) | |
end | |
end | |
commands.add_command( | |
"kizrak", | |
"cheat description", | |
kizrak | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://forums.factorio.com/viewtopic.php?t=8777
https://wiki.factorio.com/Prototype/MapSettings
https://lua-api.factorio.com/latest/prototypes/MapSettings.html
https://lua-api.factorio.com/latest/types/EnemyExpansionSettings.html
https://lua-api.factorio.com/latest/types/EnemyEvolutionSettings.html
https://www.reddit.com/r/factorio/comments/gz8356/how_to_stop_biters_expanding_cheaty/
https://lua-api.factorio.com/latest/classes/LuaGameScript.html#print
https://lua-api.factorio.com/latest/concepts.html#PrintSettings
π§‘