mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Port Research Sync plugin
Rewriwe the researchSync plugin into plugins/research_sync.
This commit is contained in:
1 parent
737c9924b9
commit
9dac57b36b
13 files changed
+570
-615
No files matched your search
@@ -0,0 +1,80 @@
|
||||
const link = require("lib/link");
|
||||
|
||||
|
||||
// schema used for syncing technologies to and from the master
|
||||
const technologies = {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "array",
|
||||
minItems: 4,
|
||||
maxItems: 4,
|
||||
items: [
|
||||
{ type: "string" },
|
||||
{ type: "integer" },
|
||||
{ type: ["null", "number"] },
|
||||
{ type: "boolean" },
|
||||
]
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
name: "research_sync",
|
||||
title: "Research Sync",
|
||||
description: "Synchronises technology research progress between instances.",
|
||||
version: "2.0.0-alpha",
|
||||
instanceEntrypoint: "instance",
|
||||
masterEntrypoint: "master",
|
||||
|
||||
messages: {
|
||||
contribution: new link.Event({
|
||||
type: "research_sync:contribution",
|
||||
links: ["instance-slave", "slave-master"],
|
||||
forwardTo: "master",
|
||||
eventProperties: {
|
||||
"name": { type: "string" },
|
||||
"level": { type: "integer" },
|
||||
"contribution": { type: "number" },
|
||||
},
|
||||
}),
|
||||
progress: new link.Event({
|
||||
type: "research_sync:progress",
|
||||
links: ["master-slave", "slave-instance"],
|
||||
broadcastTo: "instance",
|
||||
eventProperties: {
|
||||
"technologies": {
|
||||
type: "array",
|
||||
items: {
|
||||
additionalProperties: false,
|
||||
required: ["name", "level", "progress"],
|
||||
properties: {
|
||||
"name": { type: "string" },
|
||||
"level": { type: "integer" },
|
||||
"progress": { type: "number" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
finished: new link.Event({
|
||||
type: "research_sync:finished",
|
||||
links: ["instance-slave", "slave-master", "master-slave", "slave-instance"],
|
||||
forwardTo: "master",
|
||||
broadcastTo: "instance",
|
||||
eventProperties: {
|
||||
"name": { type: "string" },
|
||||
"level": { type: "integer" },
|
||||
},
|
||||
}),
|
||||
syncTechnologies: new link.Request({
|
||||
type: "research_sync:sync_technologies",
|
||||
links: ["instance-slave", "slave-master"],
|
||||
forwardTo: "master",
|
||||
requestProperties: {
|
||||
"technologies": technologies,
|
||||
},
|
||||
responseProperties: {
|
||||
"technologies": technologies,
|
||||
},
|
||||
}),
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user