I, Robot

by Pi-C

You are Compilatron. Just a graphic change.

Tweaks
11 months ago
0.17 - 1.1
4.40K

i [Implemented] add remote interface to toggle multiple character support

2 years ago

I see in the data-final-fixes.lua that you check for 3 mods that support multiple characters and don't replace the default character if one of them is installed. Now I'm playing around with a mod where I want the I, Robot character too but not as default. You could add this mod to your list of mods but maybe next month I give up and the mod goes away. So it might be pointless work for you to add it.

Wouldn't it be better to define a remote interface in I, Robot consisting of one simple function:

enable_multi_character() : don't replace default character but provide an additional character choice

Then any mod that wants to use the I, Robot character can call this and you never have to extend your list of mods with multi character support.

2 years ago

Remote interfaces work in control stage only, that's too late! What I could do is providing a global table where mods that require "I, Robot" as an additional character can register in data-updates.lua.

2 years ago

Maybe look at Deadlocks beltboxes and loader as example. It provides a public interface where mods can register their belts so matching beltboxes and loaders are created and for items so matching stacks are created. And that is most definetly in the data stage.

2 years ago
(updated 2 years ago)

Basically, that is the same thing I just described: Deadlock's mod defines some functions that are stored in a global table. If that table is present, you can call those functions with the data needed to create the new stack items and recipes. The difference is that you don't want me to create something in "I, Robot", but you just want to announce that your mod is there and that I should not overwrite the default character. So you'd register your mod by adding it's name to a global table provided by mine.

In Factorio, "remote interface" is a technical term that, indeed, describes something which only works in the control stage (see here).

2 years ago

Wouldn't it be better to define a remote interface in I, Robot consisting of one simple function:

enable_multi_character() : don't replace default character but provide an additional character choice

Implemented in 1.1.2. I've used the function name you suggested. You should add the following to data-updates.lua of your mod:

if IROBOT and IROBOT.enable_multi_character then
  IROBOT.enable_multi_character(your_mod_name)
end

The argument "your_mod_name" is optional, currently it's just used for logging (keeping track of what mods called this function).

2 years ago

thanks.

New response