Extra touch ups

This commit is contained in:
Cooldude2606 committed 2024-03-05 00:56:01 +00:00
1 parent 3adfcf0a29
commit a66b1af454
7 files changed
+12 -21

No files matched your search

+3
View File
@@ -131,6 +131,9 @@ async function copyPluginTemplates(pluginName, templates) {
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/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
@@ -70,14 +70,6 @@ do -- Assume Factorio Control Stage as Default
}
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
files['**/data.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": [
//%if instance
"module_exports.lua"
"globals.lua"
//%endif
],
"dependencies": {
@@ -1,10 +1,3 @@
local MyModule = require("./control")
//%if instance
--- 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
--- Can contain anything you want to allow other plugins to have access to, this example exposes the control file
-- Access the exports from other modules using require("modules/__plugin_name__")
return require("modules/__plugin_name__/control")
@@ -31,7 +31,7 @@ class InstancePlugin extends BaseInstancePlugin {
async handlePluginExampleEvent(event) {
this.logger.info(JSON.stringify(event));
//%if module
this.sendRcon("/sc ipc___plugin_name__.foo()");
this.sendRcon("/sc __plugin_name__.foo()");
//%endif
}
@@ -33,7 +33,7 @@ export class InstancePlugin extends BaseInstancePlugin {
async onPlayerEvent(event: lib.PlayerEvent) {
this.logger.info(`onPlayerEvent::onPlayerEvent ${JSON.stringify(event)}`);
//%if module
this.sendRcon("/sc ipc___plugin_name__.foo()");
this.sendRcon("/sc __plugin_name__.foo()");
//%endif
}