Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Remote Interface Documentation

raiguard edited this page Sep 14, 2020 · 3 revisions

The remote interface is named CursorEnhancements.

The current interface version is 1.

HOW-TO:

See the Factorio documentation for instructions on using remote interfaces.

Functions

add_overrides

remote.call("CursorEnhancements", "add_overrides", mod_overrides)

Add cursor scrolling overrides from your mod. This function should be called during on_init and on_configuration_changed, not on_load. Attempting to call this during on_load will cause a crash.

Parameters

version

remote.call("CursorEnhancements", "version")

Get the current remote interface version. This version will be incremented when backward-incompatible changes are made. Check against this version before using the other interface functions.

Returns

  • number: The current interface version.

Concepts

CursorScrollOverrides

Dictionary item_name -> next_item_name. This defines the overrides that your mod is making to the scrolling behavior. The next item can be accessed by scrolling up on the mouse wheel while holding the base item, and vice versa for scrolling down.

Example

{
  ["iron-plate"] = "copper-plate",
  ["ee-infinity-chest"] = "ee-infinity-chest-active-provider"
}

Implementation example

Editor Extensions implements this remote interface like so:

local cursor_enhancements_interface_version = 1
local cursor_enhancements_overrides = {
  -- chests
  ["ee-infinity-chest"] = "ee-infinity-chest-active-provider",
  ["ee-infinity-chest-active-provider"] = "ee-infinity-chest-passive-provider",
  ["ee-infinity-chest-passive-provider"] = "ee-infinity-chest-storage",
  ["ee-infinity-chest-storage"] = "ee-infinity-chest-buffer",
  ["ee-infinity-chest-buffer"] = "ee-infinity-chest-requester",
  ["ee-infinity-chest-requester"] = "ee-aggregate-chest",
  ["ee-aggregate-chest"] = "ee-aggregate-chest-passive-provider",
  -- electric poles
  ["ee-super-electric-pole"] = "ee-super-substation",
  -- trains
  ["ee-super-locomotive"] = "ee-infinity-cargo-wagon",
  ["ee-infinity-cargo-wagon"] = "ee-infinity-fluid-wagon"
}

local function add_cursor_enhancements_overrides()
  -- check if the interface exists, and if we are compatible with the current interface version
  if
    remote.interfaces["CursorEnhancements"]
    and remote.call("CursorEnhancements", "version") == cursor_enhancements_interface_version
  then
    -- add our overrides
    remote.call("CursorEnhancements", "add_overrides", cursor_enhancements_overrides)
  end
end

script.on_init(function()
  add_cursor_enhancements_overrides()
end)

script.on_configuration_changed(function()
  add_cursor_enhancements_overrides()
end)

Clone this wiki locally