mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Extra touch ups
This commit is contained in:
7 files changed
+12
-21
No files matched your search
@@ -131,6 +131,9 @@ async function copyPluginTemplates(pluginName, templates) {
|
|||||||
files.set("module/module.json", path.join(commonPath, "module/module.json"));
|
files.set("module/module.json", path.join(commonPath, "module/module.json"));
|
||||||
files.set("module/control.lua", path.join(commonPath, "module/control.lua"));
|
files.set("module/control.lua", path.join(commonPath, "module/control.lua"));
|
||||||
files.set("module/module_exports.lua", path.join(commonPath, "module/module_exports.lua"));
|
files.set("module/module_exports.lua", path.join(commonPath, "module/module_exports.lua"));
|
||||||
|
if (templates.includes("instance")) {
|
||||||
|
files.set("module/globals.lua", path.join(commonPath, "module/globals.lua"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Files for the control tool
|
// Files for the control tool
|
||||||
|
|||||||
@@ -70,14 +70,6 @@ do -- Assume Factorio Control Stage as Default
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- RedMew and ExpGaming overrides
|
|
||||||
globals = {
|
|
||||||
'math', 'table', 'package',
|
|
||||||
'print', 'require', 'unpack', 'inspect', 'loadstring', 'ServerCommands', 'Debug',
|
|
||||||
'_C', '_DEBUG', '_CHEATS', '_DUMP_ENV', '_LIFECYCLE', '_STAGE',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
do -- Set default prototype files
|
do -- Set default prototype files
|
||||||
files['**/data.lua'].std = STD_DATA
|
files['**/data.lua'].std = STD_DATA
|
||||||
files['**/data-updates.lua'].std = STD_DATA
|
files['**/data-updates.lua'].std = STD_DATA
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
--- Expose any globals here, typically just your control file if you want to access it through rcon or commands
|
||||||
|
-- luacheck: globals __plugin_name__
|
||||||
|
__plugin_name__ = require("modules/__plugin_name__/control")
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
],
|
],
|
||||||
"require": [
|
"require": [
|
||||||
//%if instance
|
//%if instance
|
||||||
"module_exports.lua"
|
"globals.lua"
|
||||||
//%endif
|
//%endif
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
local MyModule = require("./control")
|
--- Can contain anything you want to allow other plugins to have access to, this example exposes the control file
|
||||||
//%if instance
|
-- Access the exports from other modules using require("modules/__plugin_name__")
|
||||||
|
return require("modules/__plugin_name__/control")
|
||||||
--- Can contain anything you plan to use with send_rcon including functions, modules, or data
|
|
||||||
-- luacheck: globals ipc___plugin_name__
|
|
||||||
ipc___plugin_name__ = MyModule
|
|
||||||
//%endif
|
|
||||||
|
|
||||||
--- Can contain anything you want to allow other plugins to have access to, this example exposes the whole module
|
|
||||||
return MyModule
|
|
||||||
@@ -31,7 +31,7 @@ class InstancePlugin extends BaseInstancePlugin {
|
|||||||
async handlePluginExampleEvent(event) {
|
async handlePluginExampleEvent(event) {
|
||||||
this.logger.info(JSON.stringify(event));
|
this.logger.info(JSON.stringify(event));
|
||||||
//%if module
|
//%if module
|
||||||
this.sendRcon("/sc ipc___plugin_name__.foo()");
|
this.sendRcon("/sc __plugin_name__.foo()");
|
||||||
//%endif
|
//%endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export class InstancePlugin extends BaseInstancePlugin {
|
|||||||
async onPlayerEvent(event: lib.PlayerEvent) {
|
async onPlayerEvent(event: lib.PlayerEvent) {
|
||||||
this.logger.info(`onPlayerEvent::onPlayerEvent ${JSON.stringify(event)}`);
|
this.logger.info(`onPlayerEvent::onPlayerEvent ${JSON.stringify(event)}`);
|
||||||
//%if module
|
//%if module
|
||||||
this.sendRcon("/sc ipc___plugin_name__.foo()");
|
this.sendRcon("/sc __plugin_name__.foo()");
|
||||||
//%endif
|
//%endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user