mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Reverse argument order for sendTo
It makes more sense to put the address first then have the large structure to send as the second argument to sendTo. The opposite order was originally chosen to be similar to that of sendto in BSD sockets.
This commit is contained in:
1 parent
183d2921a8
commit
295cc7543a
24 files changed
+87
-74
No files matched your search
@@ -303,7 +303,7 @@ class Instance extends libLink.Link {
|
||||
name,
|
||||
stats,
|
||||
};
|
||||
this.sendTo(new libData.InstancePlayerUpdateEvent("join", name, undefined, stats), "controller");
|
||||
this.sendTo("controller", new libData.InstancePlayerUpdateEvent("join", name, undefined, stats));
|
||||
libPlugin.invokeHook(this.plugins, "onPlayerEvent", event);
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ class Instance extends libLink.Link {
|
||||
reason,
|
||||
stats,
|
||||
};
|
||||
this.sendTo(new libData.InstancePlayerUpdateEvent("leave", name, reason, stats), "controller");
|
||||
this.sendTo("controller", new libData.InstancePlayerUpdateEvent("leave", name, reason, stats));
|
||||
libPlugin.invokeHook(this.plugins, "onPlayerEvent", event);
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
||||
name,
|
||||
stats: stats.toJSON(),
|
||||
};
|
||||
this.sendTo(new libData.InstancePlayerUpdateEvent("import", name, undefined, stats), "controller");
|
||||
this.sendTo("controller", new libData.InstancePlayerUpdateEvent("import", name, undefined, stats));
|
||||
libPlugin.invokeHook(this.plugins, "onPlayerEvent", event);
|
||||
count += 1;
|
||||
}
|
||||
@@ -405,10 +405,13 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
||||
}
|
||||
|
||||
async sendSaveListUpdate() {
|
||||
this.sendTo(new libData.InstanceSaveListUpdateEvent(
|
||||
this.id,
|
||||
await Instance.listSaves(this.path("saves"), this._loadedSave),
|
||||
), "controller");
|
||||
this.sendTo(
|
||||
"controller",
|
||||
new libData.InstanceSaveListUpdateEvent(
|
||||
this.id,
|
||||
await Instance.listSaves(this.path("saves"), this._loadedSave),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
async _autosave(name) {
|
||||
@@ -436,12 +439,12 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
||||
notifyStatus(status) {
|
||||
this._status = status;
|
||||
this.sendTo(
|
||||
"controller",
|
||||
new libData.InstanceStatusChangedEvent(
|
||||
this.id,
|
||||
status,
|
||||
this.server && this.server.gamePort || this.config.get("factorio.game_port") || null,
|
||||
),
|
||||
"controller"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -622,9 +625,9 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
||||
const modPackId = this.config.get("factorio.mod_pack");
|
||||
let modPack;
|
||||
if (modPackId === null) {
|
||||
modPack = await this.sendTo(new libData.ModPackGetDefaultRequest(), "controller");
|
||||
modPack = await this.sendTo("controller", new libData.ModPackGetDefaultRequest());
|
||||
} else {
|
||||
modPack = await this.sendTo(new libData.ModPackGetRequest(modPackId), "controller");
|
||||
modPack = await this.sendTo("controller", new libData.ModPackGetRequest(modPackId));
|
||||
}
|
||||
this.activeModPack = modPack;
|
||||
|
||||
|
||||
Reference in new issue
Block a user