mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 23:33:13 +09:00
Add IPC to templates and handle helper function server
This commit is contained in:
11 files changed
+78
-19
No files matched your search
@@ -14,7 +14,10 @@ MyModule.events[clusterio_api.events.on_server_startup] = function(event)
|
||||
end
|
||||
|
||||
MyModule.events[defines.events.on_player_crafted_item] = function(event)
|
||||
game.print(game.table_to_json(event))
|
||||
game.print(game.table_to_json(event))// [instance] //
|
||||
clusterio_api.send_json("// plugin_name //-plugin_example_ipc", {
|
||||
tick = game.tick, player_name = game.get_player(event.player_index).name
|
||||
})// [] //
|
||||
end
|
||||
|
||||
MyModule.on_nth_tick[300] = function()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"control.lua"
|
||||
],
|
||||
"require": [
|
||||
|
||||
// [instance] //"module_exports.lua"// [] //
|
||||
],
|
||||
"dependencies": [
|
||||
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
local MyModule = require("./control")// [instance] //
|
||||
|
||||
return require("./control")
|
||||
-- Can contain anything you plan to use with send_rcon from functions, modules, or data
|
||||
ipc_// plugin_name // = MyModule// [] //
|
||||
|
||||
-- Can contain anything you want to allow other plugins to have access to, this example exposes the whole module
|
||||
return MyModule
|
||||
Reference in new issue
Block a user