mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 07:24:53 +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
@@ -44,7 +44,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
|
||||
).catch(err => this.unexpectedError(err));
|
||||
}, 5000);
|
||||
|
||||
let items = await this.instance.sendTo(new GetStorageRequest(), "controller");
|
||||
let items = await this.instance.sendTo("controller", new GetStorageRequest());
|
||||
// TODO Diff with dump of invdata produce minimal command to sync
|
||||
let itemsJson = libLuaTools.escapeString(JSON.stringify(items));
|
||||
await this.sendRcon(`/sc __subspace_storage__ UpdateInvData("${itemsJson}", true)`, true);
|
||||
@@ -71,7 +71,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
this.instance.sendTo(new PlaceEvent(items), "controller");
|
||||
this.instance.sendTo("controller", new PlaceEvent(items));
|
||||
|
||||
if (this.instance.config.get("subspace_storage.log_item_transfers")) {
|
||||
this.logger.verbose("Exported the following to controller:");
|
||||
@@ -82,7 +82,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
|
||||
// request items --------------------------------------------------------------
|
||||
async requestItems(requestItems) {
|
||||
// Request the items all at once
|
||||
let items = await this.instance.sendTo(new RemoveRequest(requestItems), "controller");
|
||||
let items = await this.instance.sendTo("controller", new RemoveRequest(requestItems));
|
||||
|
||||
if (!items.length) {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user