Page 1 of 1

[SOLVED] Method to remove a force

Posted: Fri May 27, 2016 8:28 pm
by xcompwiz
This is my first post, so I apologize if I didn't pick quite the right location for it.

Greetings! I'm starting to cut my teeth on Factorio modding. It's something I've been tempted to do a few times but up until now haven't touched on much. I have played with the in-game live scripting, which is fun. The fact that the data is all controllable through Lua is fun, and I've always really liked Lua.

My actual question for this post is: Is there a means by which to remove a force once created?
game.create_force("forcename") will happily create a force, no issues. However, there isn't a "remove_force" or equivalent that I can find. Setting game.forces["testforce"] to nil doesn't accomplish anything at all (which I think for the best, really).
An alternative would be an assessment of the harm of leaving lose forces about. Particularly, if I give every player their own force and then an offline player is removed, are the extra forces going to make much of an impact?

Cheers!
-XComp

Re: Method to remove a force

Posted: Fri May 27, 2016 10:15 pm
by Rseding91
You remove a force by merging it into an existing one using game.merge_forces: http://lua-api.factorio.com/0.12.34/Lua ... rge_forces

Re: Method to remove a force

Posted: Fri May 27, 2016 10:34 pm
by xcompwiz
Of course! That makes perfect sense. :D Thanks!

Thanks for the super quick support. I've been where you are in other contexts, so I send much support and respect to you.
And I absolutely love Factorio. :D