Hi,
I wonder how I should write a remote/interface function to be consistent with multiplayer...
For example, if I want to write a function that launches the creation of a building by the player who is launching the remote command ?
I cannot use game.local_player to get some infos, because it is only accessible from console...
I cannot use game.player either, only accessible under solo game.
ex: the force of the object that is created must be the force of the player emitting the remote command.
I also need the position of the player to place the building close to the player.
And I wonder if a remote.call on one computer will be sent/replicate to other computer in the game ?...
LuaRemote and multiplayer ?
LuaRemote and multiplayer ?
My mods on the Factorio Mod Portal 

-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: LuaRemote and multiplayer ?
all mod code will run exactly the same on all peers/clients-server
Re: LuaRemote and multiplayer ?
OK, I understand that, so (for example) how would you write a remote interface that create a building close to the player that run the interface command in the console ? And so that creation appears on all clients at the right place ?ratchetfreak wrote:all mod code will run exactly the same on all peers/clients-server
My mods on the Factorio Mod Portal 

-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: LuaRemote and multiplayer ?
like with a gui? the gui event includes the player that clicked the button.
Re: LuaRemote and multiplayer ?
no, I know how to do it with the GUI, I'd like to do it from the interface :ratchetfreak wrote:like with a gui? the gui event includes the player that clicked the button.
http://lua-api.factorio.com/0.12.30/LuaRemote.html
My mods on the Factorio Mod Portal 

-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: LuaRemote and multiplayer ?
That's for mods calling to other mods, if you want them to work on a player then tell them to pass the player to work with.
Re: LuaRemote and multiplayer ?
Yes, I finally end to this same conclusion... Thanks for your help.ratchetfreak wrote:That's for mods calling to other mods, if you want them to work on a player then tell them to pass the player to work with.
My mods on the Factorio Mod Portal 
