Don't ping subspace_storage mod if master connection is down

The system for preventing items being sent without a connection to the
master and (and thus voiding the items) is to only do so if a ping from
the plugin has been received in the last 5 seconds of in-game time.
Don't send pings without being fully connected to the master to make
sure this system actually activates during connection downtime.
This commit is contained in:
Hornwitser committed 2021-09-11 04:18:17 +02:00
1 parent ddd1bde1b4
commit 3b659116db
1 file changed
+3
+3
View File
@@ -27,6 +27,9 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
async onStart() {
this.pingId = setInterval(() => {
if (!this.slave.connected) {
return; // Only ping if we are actually connected to the master.
}
this.sendRcon(
"/sc __subspace_storage__ global.ticksSinceMasterPinged = 0", true
).catch(err => this.unexpectedError(err));