[Rseding91] Major faulty remote interface

This subforum contains all the issues which we already resolved.
User avatar
y.petremann
Filter Inserter
Filter Inserter
Posts: 421
Joined: Mon Mar 17, 2014 4:24 pm
Contact:

[Rseding91] Major faulty remote interface

Post by y.petremann »

I was trying to create a permission mod that use custom events and remote interfaces and then ... it didn't works, so here what I've found :
If you call a remote inteface from a script, arguments are wrong :

Code: Select all

require("defines")
function print_all(message)
  for _, player in pairs(game.players) do
    player.print(message)
  end
end
local event = script.generate_event_name()

remote.add_interface("test", {
  function1 = function(a,b,c)
    print_all(serpent.line({a,b,c}))
    game.raise_event(event, {player=player, permission=permission})
  end,
  function2 = function(a,b,c)
    print_all(serpent.line({a,b,c}))
  end
})
script.on_event(event, function(event)
  remote.call("test", "function2", "a","b","c")
end)
script.on_event(defines.events.on_player_created, function(event)
  remote.call("test", "function1", "a","b","c")
end)
Then when ingame, type:

Code: Select all

/c remote.call("test", "function1", "a","b","c")
The result is that you get interface name and interface function name as parameter when call from script, and not via chat, and so this break all script interaction
Rseding91
Factorio Staff
Factorio Staff
Posts: 14345
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Major faulty remote interface

Post by Rseding91 »

Which version of the game are you running?
If you want to get ahold of me I'm almost always on Discord.
User avatar
y.petremann
Filter Inserter
Filter Inserter
Posts: 421
Joined: Mon Mar 17, 2014 4:24 pm
Contact:

Re: Major faulty remote interface

Post by y.petremann »

Rseding91 wrote:Which version of the game are you running?
linux 64bit 0.12.30
Rseding91
Factorio Staff
Factorio Staff
Posts: 14345
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Major faulty remote interface

Post by Rseding91 »

Have you tested it between mods instead of in the same mod?
If you want to get ahold of me I'm almost always on Discord.
User avatar
y.petremann
Filter Inserter
Filter Inserter
Posts: 421
Joined: Mon Mar 17, 2014 4:24 pm
Contact:

Re: Major faulty remote interface

Post by y.petremann »

Rseding91 wrote:Have you tested it between mods instead of in the same mod?
no

For me that not a problem, the idea I got is that if no permission mod is present, then diplomacy would provide a simplier one, but did remote calls should be different between mods or inside a mod ?
Rseding91
Factorio Staff
Factorio Staff
Posts: 14345
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Major faulty remote interface

Post by Rseding91 »

y.petremann wrote:
Rseding91 wrote:Have you tested it between mods instead of in the same mod?
no

For me that not a problem, the idea I got is that if no permission mod is present, then diplomacy would provide a simplier one, but did remote calls should be different between mods or inside a mod ?
Inner mod remote calls are simply function calls compared to mod <> mod calls which have to stack copy between the mods.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5286
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Major faulty remote interface

Post by Klonan »

Thansk for the report

Im not 100% in the technical knowledge,
But you're saying remote.calls don't work within a single mod,
Which you shouldn't need to do, as a remote.call is only for other mod interactions...

If this isnt the case let me know,
But for now im moving it to 'not a bug'
User avatar
y.petremann
Filter Inserter
Filter Inserter
Posts: 421
Joined: Mon Mar 17, 2014 4:24 pm
Contact:

Re: Major faulty remote interface

Post by y.petremann »

Klonan wrote:Thansk for the report

Im not 100% in the technical knowledge,
But you're saying remote.calls don't work within a single mod,
Which you shouldn't need to do, as a remote.call is only for other mod interactions...

If this isnt the case let me know,
But for now im moving it to 'not a bug'
The thing is we have two way :
  1. Remote call works and return something diferent whereas it is used. Like now, harder to use, need hacking to work fine
  2. Remote call works the same way whereas it is used. Like needed, easier to use, no need to hack
If that simply function calls, then simply process the argument to be in the correct place when used inside the same mod.

For me the idea is like this :
Imagine somebody create a "permission" api via remote interface. So to work a mod need to have a mod that implement that api, if the api is not present it could use a self registered version that could be replaced later if a true one is loaded.

Scripts are executed in some order, and in that case you always need that permission api to be loaded before all script that need it, but what to do if there is no permission api : use that fallback api, what to do if that another mod that is the permission api : you need to register all permission api mods as dependent mods (even thoses you don't know), what to do if it's still not loaded : use the fallback api and when the true api is loaded, it reads previous fallback api data to register in itself.

The problem is that if you need to do that you must ship a separate permission api fallback mod with the mod that need it ...
Rseding91
Factorio Staff
Factorio Staff
Posts: 14345
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] Major faulty remote interface

Post by Rseding91 »

Fixed for the next version:

Image
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”