[SOLVED] Method to remove a force

Place to get help with not working mods / modding interface.
Post Reply
xcompwiz
Burner Inserter
Burner Inserter
Posts: 15
Joined: Fri May 27, 2016 8:18 pm
Contact:

[SOLVED] Method to remove a force

Post 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
Last edited by xcompwiz on Fri May 27, 2016 10:35 pm, edited 2 times in total.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13229
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Method to remove a force

Post 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
If you want to get ahold of me I'm almost always on Discord.

xcompwiz
Burner Inserter
Burner Inserter
Posts: 15
Joined: Fri May 27, 2016 8:18 pm
Contact:

Re: Method to remove a force

Post 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

Post Reply

Return to “Modding help”