Multiplayer Migration

Place to get help with not working mods / modding interface.
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2179
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Multiplayer Migration

Post by Ranakastrasz »

I am unsure how to manage recipie migration, specifically in Multiplayer. It gives an error when you load, using the default one.
game.player.force.resetrecipes()
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Degraine
Filter Inserter
Filter Inserter
Posts: 282
Joined: Wed Aug 13, 2014 10:49 am
Contact:

Re: Multiplayer Migration

Post by Degraine »

Because there's more than one player force in multiplayer, you need to adjust your code to allow for that. Eg:

Code: Select all

for i, player in ipairs(game.players) do
	player.force.resetrecipes()
	player.force.resettechnologies()
end
This will iterate through every player and perform those two actions. Handily, it also works in single-player.
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: Multiplayer Migration

Post by L0771 »

but the force is the same for all players, maybe if it is for one player work just as well
Post Reply

Return to “Modding help”