LuaRemote and multiplayer ?

Place to get help with not working mods / modding interface.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

LuaRemote and multiplayer ?

Post by binbinhfr »

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 ?...
My mods on the Factorio Mod Portal :geek:
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: LuaRemote and multiplayer ?

Post by ratchetfreak »

all mod code will run exactly the same on all peers/clients-server
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: LuaRemote and multiplayer ?

Post by binbinhfr »

ratchetfreak wrote:all mod code will run exactly the same on all peers/clients-server
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 ?
My mods on the Factorio Mod Portal :geek:
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: LuaRemote and multiplayer ?

Post by ratchetfreak »

like with a gui? the gui event includes the player that clicked the button.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: LuaRemote and multiplayer ?

Post by binbinhfr »

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

Re: LuaRemote and multiplayer ?

Post by ratchetfreak »

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.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: LuaRemote and multiplayer ?

Post by binbinhfr »

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.
Yes, I finally end to this same conclusion... Thanks for your help.
My mods on the Factorio Mod Portal :geek:
Post Reply

Return to “Modding help”