Macromanaged Turrets v1.1.4 Remote Inteface API configure_logistic_turret(turret, config) -- Configure a type of logistic turret change_request_slot(turret, ammo, count) -- Change a turret's request change_circuit_mode(turret, mode, wires) -- Change a turret's circuit mode change_custom_label(turret, player, label) -- Change a turret's custom label for a player get_default_configuration(turret) -- Get the default configuration of a type of logistic turret get_request_slot(turret) -- Get a turret's request get_circuit_mode(turret) -- Get a turret's circuit mode get_custom_label(turret, player) -- Get a turret's custom label(s) remote_control(force, enable) -- Check if the logistic turret remote is enabled for a force, or enable it for a force reset_mod() -- Resets most settings and may fix certain problems mod_info() -- Displays information about the mod in the player's console configure_logistic_turret(turret, config) - Configure a type of logistic turret - This mod will only work with turrets that have been configured as logistic turrets - Only needs to be called once, ideally during on_init - Parameters: - turret :: string; the name of a turret prototype - config :: true or "empty" or a table: - true: configure a turret without a default request - "empty": equivalent to true - table: configure a turret with a default request; takes two fields: - ammo :: string; the name of an ammo prototype - count :: int; the amount of ammo to request - Return value: - If the configuration was successful and included a default request: - config :: table; the turret's new default request - If the configuration was successful but did not include a default request: - "empty" :: string - If the configuration was unsuccessful: - nil - Example: remote.call("Macromanaged_Turrets", "configure_logistic_turret", "gun-turret", true) change_request_slot(turret, ammo, count) - Change a turret's request - Works just as if the turret was edited by using the in-game GUI - Parameters: - turret :: LuaEntity; a turret entity - ammo (optional, default: "empty") :: string; the name of an ammo prototype or "empty" - count (optional, default: one full stack) :: int; the amount of ammo to request - Return value: - If the request slot was successfully changed: - count :: int; the amount of ammo the turret is now requesting - If the request slot was successfully cleared: - true :: boolean - If the operation was unsuccessful: - false :: boolean - Example: remote.call("Macromanaged_Turrets", "change_request_slot", game.player.selected, "piercing-rounds-magazine", 10) change_circuit_mode(turret, mode, wires) - Change a turret's circuit mode - Works just as if the turret was edited by using the in-game GUI - Parameters: - turret :: LuaEntity; a turret entity - mode (optional; default: "off") :: string; one of three strings: - "off": configure the turret to not interact with a circuit network - "output": configure the turret to transmit its inventory to the circuit network ("send contents" mode) - "input": configure the turret to change its request slot based on the circuit network signals it is receiving ("set requests" mode) - wires (optional) :: table; a table with two fields: - red (optional, default: false) :: true or false; configure the turret to interact with red wires - green (optional, default: false) :: true or false; configure the turret to interact with green wires - Return value: - If the operation was successful: - true :: boolean - If the operation was unsuccessful: - false :: boolean - Example: remote.call("Macromanaged_Turrets", "change_circuit_mode", game.player.selected, "output", {red = true}) change_custom_label(turret, player, label) - Change a turret's custom label for a player - Works just as if the turret was edited by using the in-game GUI - Parameters: - turret :: LuaEntity; a turret entity - player :: LuaPlayer or int or string; a player object, index, or name - label (optional, default: nil) :: string; the custom label to assign to the turret - Return value: - If the custom label was successfully changed: - label :: string; the label to assigned to the turret - If the custom label was successfully cleared: - true :: boolean - If the operation was unsuccessful: - false :: boolean - Example: remote.call("Macromanaged_Turrets", "change_custom_label", game.player.selected, , game.player, "Example Custom Label") get_default_configuration(turret) - Get the default configuration of a type of logistic turret - Parameters: - turret (optional) :: string; the name of a turret prototype - Return value: - If a turret was specified: - If the turret does not have a default request: - "empty" :: string - If the turret has a default request: - request :: table; a table with two fields: - ammo :: string; the name of an ammo prototype - count :: int; the amount of ammo to request - If the turret has not been configured: - nil - If a turret was not specified: - config :: table; a table containing the default configurations of all logistic turrets, indexed by name - Example: remote.call("Macromanaged_Turrets", "get_default_configuration", "gun-turret") get_request_slot(turret) - Get a turret's request - Parameters: - turret :: LuaEntity; a turret entity - Return value: - If the turret is currently requesting ammo: - request :: table; a table with two fields: - name :: string; the name of an ammo prototype - count :: int; the amount of ammo the turret is requesting - If the turret is not currently requesting ammo: - nil - Example: remote.call("Macromanaged_Turrets", "get_request_slot", game.player.selected) get_circuit_mode(turret) - Get a turret's circuit mode - Parameters: - turret :: LuaEntity; a turret entity - Return value: - circuitry :: table; a table with two fields: - mode :: string; one of three strings: - "off": the turret is not configured to interact with a circuit network - "output": the turret is transmitting its inventory to the circuit network ("send contents" mode) - "input": the turret is changing its request slot based on the circuit network signals it is receiving ("set requests" mode) - wires :: table; a table with two fields: - red :: true or false; whether or not the turret is configured to interact with red wires - green :: true or false; whether or not the turret is configured to interact with green wires - Example: remote.call("Macromanaged_Turrets", "get_circuit_mode", game.player.selected) get_custom_label(turret, player) - Get a turret's custom label(s) - Parameters: - turret :: LuaEntity; a turret entity - player (optional) :: LuaPlayer or int or string; a player object, index, or name - Return value: - If a player was specified and that player has assigned a custom label to the turret: - label :: string; the turret's custom label - If a player was specified and that player has not assigned a custom label to the turret: - nil - If a player was not specified: - labels :: table; a table containing all custom labels assigned to the turret, indexed by player_index - Example: remote.call("Macromanaged_Turrets", "get_custom_label", game.player.selected, game.player) remote_control(force, enable) - Check if the logistic turret remote is enabled for a force, or enable it for a force - Once the logistic turret remote has been enabled for a force, the effects cannot be undone - Parameters: - force :: LuaForce or string; a force object or name - enable (optional, default: false) :: true or false; whether or not to enable the logistic turret remote without needing to research it - Return value: - If the logistic turret remote is enabled: - true :: boolean - If the logistic turret remote is not enabled: - false :: boolean - If the force doesn't exist: - nil - Example: remote.call("Macromanaged_Turrets", "remote_control", game.forces["player"]) reset_mod() - Resets most settings and may fix certain problems - Can only be called from the in-game console - Example: remote.call("Macromanaged_Turrets", "reset_mod") mod_info() - Displays information about the mod in the player's console - Can only be called from the in-game console - Return value: - info :: table; a table containing the same information displayed to the player - Example: remote.call("Macromanaged_Turrets", "mod_info")