I'd like to request a command that can clone a force and all it's properties and settings under a different name
by this i mean, make a perfect copy of a force, with all the same base starting recipes and technologies, but none of the newly unlocked stuff, and under a different name, namely want it to put into my mod so i and others can play it PvP-style, since there will be multiple forces, all with different tech trees, and recipes
I'd make it myself, but i'm really unsure how tbh
clone a force under a new name
- StormyStrife
- Manual Inserter
- Posts: 4
- Joined: Mon May 11, 2020 12:38 am
- Contact:
clone a force under a new name
I normally draw, so modding is out of my depth quite a bit. I'm super dense at learning programming and that's frustrating.
I made the dumbest factorio mod ever made: Memebots.
I made the dumbest factorio mod ever made: Memebots.
Re: clone a force under a new name
https://lua-api.factorio.com/latest/Lua ... eate_force
https://lua-api.factorio.com/latest/LuaForce.html
https://lua-api.factorio.com/latest/Lua ... chnologies
game.player.force.technologies["steel-processing"].researched = true
https://lua-api.factorio.com/latest/Lua ... pe.enabled
(not tested)
https://lua-api.factorio.com/latest/LuaForce.html
https://lua-api.factorio.com/latest/Lua ... chnologies
game.player.force.technologies["steel-processing"].researched = true
https://lua-api.factorio.com/latest/Lua ... pe.enabled
(not tested)
Code: Select all
/c
local old_force = game.player.force
local new_force = game.create_force("new-force")
game.player.force = new_force
local old_technologies = old_force.technologies
local new_technologies = new_force.technologies
for tech_name, tech in pairs (old_technologies) do
new_technologies[tech_name].researched = tech.researched
end