connected-spaces-platform.web 6.14.0 → 6.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,7 +103,6 @@ export declare namespace Common {
103
103
  enum ESequenceUpdateType {
104
104
  Create = 0,
105
105
  Update = 1,
106
- Rename = 2,
107
106
  Delete = 3,
108
107
  Invalid = 4
109
108
  }
@@ -421,7 +420,11 @@ export declare namespace Multiplayer {
421
420
  ON_OBJECT_MESSAGE = 14,
422
421
  ON_OBJECT_PATCH = 15,
423
422
  ON_REQUEST_TO_SEND_OBJECT = 16,
424
- ON_REQUEST_TO_DISCONNECT = 17
423
+ ON_REQUEST_TO_DISCONNECT = 17,
424
+ SEND_SCOPE_LEADER_HEARTBEAT = 18,
425
+ ASSUME_SCOPE_LEADERSHIP = 19,
426
+ ON_ELECTED_SCOPE_LEADER = 20,
427
+ ON_VACATED_AS_SCOPE_LEADER = 21
425
428
  }
426
429
  }
427
430
  export declare namespace Multiplayer {
@@ -5911,6 +5914,8 @@ export declare namespace Systems {
5911
5914
  set scopeId(value: string);
5912
5915
  get scopeLeaderUserId(): string;
5913
5916
  set scopeLeaderUserId(value: string);
5917
+ get scopeClientId(): bigint;
5918
+ set scopeClientId(value: bigint);
5914
5919
  get electionInProgress(): boolean;
5915
5920
  set electionInProgress(value: boolean);
5916
5921
  }
@@ -6734,6 +6739,16 @@ export declare namespace Multiplayer {
6734
6739
  * @param callback - The callback to execute.
6735
6740
  */
6736
6741
  setScriptLeaderReadyCallback(callback: (arg1: boolean) => void): void;
6742
+ /**
6743
+ * @description Binds the provided callback to receive events when a new scope leader has been elected.
6744
+ * @param callback - Fired when a new scope leader is elected.
6745
+ */
6746
+ setOnElectedScopeLeaderCallback(callback: (scopeId: string, userId: string) => void): void;
6747
+ /**
6748
+ * @description Binds the provided callback to receive events when a scope leader has been vacated.
6749
+ * @param callback - Fired when a scope leader is vacated.
6750
+ */
6751
+ setOnVacatedAsScopeLeaderCallback(callback: (scopeId: string, userId: string) => void): void;
6737
6752
  /**
6738
6753
  * @description Sets the script owner for the given entity to the current client
6739
6754
  * @param entity - A pointer to the entity
@@ -6745,6 +6760,7 @@ export declare namespace Multiplayer {
6745
6760
  enableLeaderElection(): void;
6746
6761
  /**
6747
6762
  * @description Disable Leader Election feature.
6763
+ @pre SpaceSystem::EnterSpace should be called first for this to take affect.
6748
6764
  */
6749
6765
  disableLeaderElection(): void;
6750
6766
  /**
@@ -6754,6 +6770,7 @@ export declare namespace Multiplayer {
6754
6770
  isLeaderElectionEnabled(): boolean;
6755
6771
  /**
6756
6772
  * @description Debug helper to get the id of the currently elected script leader.
6773
+ * This should be updated when we fully support scopes. We will need to pass in the scopeId we want the leader for.
6757
6774
  * @return The id of the leader.
6758
6775
  */
6759
6776
  getLeaderId(): bigint;
@@ -2077,7 +2077,6 @@ export var Common;
2077
2077
  (function (ESequenceUpdateType) {
2078
2078
  ESequenceUpdateType[ESequenceUpdateType["Create"] = 0] = "Create";
2079
2079
  ESequenceUpdateType[ESequenceUpdateType["Update"] = 1] = "Update";
2080
- ESequenceUpdateType[ESequenceUpdateType["Rename"] = 2] = "Rename";
2081
2080
  ESequenceUpdateType[ESequenceUpdateType["Delete"] = 3] = "Delete";
2082
2081
  ESequenceUpdateType[ESequenceUpdateType["Invalid"] = 4] = "Invalid";
2083
2082
  })(ESequenceUpdateType = Common.ESequenceUpdateType || (Common.ESequenceUpdateType = {}));
@@ -2415,6 +2414,10 @@ export var Systems;
2415
2414
  MultiplayerHubMethod[MultiplayerHubMethod["ON_OBJECT_PATCH"] = 15] = "ON_OBJECT_PATCH";
2416
2415
  MultiplayerHubMethod[MultiplayerHubMethod["ON_REQUEST_TO_SEND_OBJECT"] = 16] = "ON_REQUEST_TO_SEND_OBJECT";
2417
2416
  MultiplayerHubMethod[MultiplayerHubMethod["ON_REQUEST_TO_DISCONNECT"] = 17] = "ON_REQUEST_TO_DISCONNECT";
2417
+ MultiplayerHubMethod[MultiplayerHubMethod["SEND_SCOPE_LEADER_HEARTBEAT"] = 18] = "SEND_SCOPE_LEADER_HEARTBEAT";
2418
+ MultiplayerHubMethod[MultiplayerHubMethod["ASSUME_SCOPE_LEADERSHIP"] = 19] = "ASSUME_SCOPE_LEADERSHIP";
2419
+ MultiplayerHubMethod[MultiplayerHubMethod["ON_ELECTED_SCOPE_LEADER"] = 20] = "ON_ELECTED_SCOPE_LEADER";
2420
+ MultiplayerHubMethod[MultiplayerHubMethod["ON_VACATED_AS_SCOPE_LEADER"] = 21] = "ON_VACATED_AS_SCOPE_LEADER";
2418
2421
  })(MultiplayerHubMethod = Multiplayer.MultiplayerHubMethod || (Multiplayer.MultiplayerHubMethod = {}));
2419
2422
  })(Multiplayer || (Multiplayer = {}));
2420
2423
  (function (Multiplayer) {
@@ -14901,6 +14904,16 @@ export class CSPFoundation {
14901
14904
  set scopeLeaderUserId(value) {
14902
14905
  Module.ccall("csp_systems_ScopeLeader__Set_ScopeLeaderUserId", "void", ["number", "string"], [this.pointer, value]);
14903
14906
  }
14907
+ get scopeClientId() {
14908
+ let _result = Module.ccall("csp_systems_ScopeLeader__Get_ScopeClientId", "bigint", ["number"], [this.pointer]);
14909
+ const _unfixedValue = _result;
14910
+ let _fixedValue = _unfixedValue < 0 ? _unfixedValue + 2n ** 64n : _unfixedValue;
14911
+ _result = _fixedValue;
14912
+ return _result;
14913
+ }
14914
+ set scopeClientId(value) {
14915
+ Module.ccall("csp_systems_ScopeLeader__Set_ScopeClientId", "void", ["number", "bigint"], [this.pointer, value]);
14916
+ }
14904
14917
  get electionInProgress() {
14905
14918
  let _result = Module.ccall("csp_systems_ScopeLeader__Get_ElectionInProgress", "boolean", ["number"], [this.pointer]);
14906
14919
  return _result;
@@ -17100,6 +17113,48 @@ export class CSPFoundation {
17100
17113
  var _callbackPtr = Module.addFunction(_callback, "vii");
17101
17114
  Module.ccall("csp_multiplayer_OnlineRealtimeEngine_SetScriptLeaderReadyCallback_void_CallbackHandler", "void", ["number", "number", "number"], [this.pointer, _callbackPtr, 0]);
17102
17115
  }
17116
+ /**
17117
+ * @description Binds the provided callback to receive events when a new scope leader has been elected.
17118
+ * @param callback - Fired when a new scope leader is elected.
17119
+ */
17120
+ setOnElectedScopeLeaderCallback(callback) {
17121
+ var _callback = (_stateObject__, scopeId, userId) => {
17122
+ {
17123
+ const _stringValue = Module.UTF8ToString(scopeId);
17124
+ free(scopeId);
17125
+ scopeId = _stringValue;
17126
+ }
17127
+ {
17128
+ const _stringValue = Module.UTF8ToString(userId);
17129
+ free(userId);
17130
+ userId = _stringValue;
17131
+ }
17132
+ callback(scopeId, userId);
17133
+ };
17134
+ var _callbackPtr = Module.addFunction(_callback, "viii");
17135
+ Module.ccall("csp_multiplayer_OnlineRealtimeEngine_SetOnElectedScopeLeaderCallback_void_ScopeLeaderCallback", "void", ["number", "number", "number"], [this.pointer, _callbackPtr, 0]);
17136
+ }
17137
+ /**
17138
+ * @description Binds the provided callback to receive events when a scope leader has been vacated.
17139
+ * @param callback - Fired when a scope leader is vacated.
17140
+ */
17141
+ setOnVacatedAsScopeLeaderCallback(callback) {
17142
+ var _callback = (_stateObject__, scopeId, userId) => {
17143
+ {
17144
+ const _stringValue = Module.UTF8ToString(scopeId);
17145
+ free(scopeId);
17146
+ scopeId = _stringValue;
17147
+ }
17148
+ {
17149
+ const _stringValue = Module.UTF8ToString(userId);
17150
+ free(userId);
17151
+ userId = _stringValue;
17152
+ }
17153
+ callback(scopeId, userId);
17154
+ };
17155
+ var _callbackPtr = Module.addFunction(_callback, "viii");
17156
+ Module.ccall("csp_multiplayer_OnlineRealtimeEngine_SetOnVacatedAsScopeLeaderCallback_void_ScopeLeaderCallback", "void", ["number", "number", "number"], [this.pointer, _callbackPtr, 0]);
17157
+ }
17103
17158
  /**
17104
17159
  * @description Sets the script owner for the given entity to the current client
17105
17160
  * @param entity - A pointer to the entity
@@ -17115,6 +17170,7 @@ export class CSPFoundation {
17115
17170
  }
17116
17171
  /**
17117
17172
  * @description Disable Leader Election feature.
17173
+ @pre SpaceSystem::EnterSpace should be called first for this to take affect.
17118
17174
  */
17119
17175
  disableLeaderElection() {
17120
17176
  Module.ccall("csp_multiplayer_OnlineRealtimeEngine_DisableLeaderElection_void", "void", ["number"], [this.pointer]);
@@ -17129,6 +17185,7 @@ export class CSPFoundation {
17129
17185
  }
17130
17186
  /**
17131
17187
  * @description Debug helper to get the id of the currently elected script leader.
17188
+ * This should be updated when we fully support scopes. We will need to pass in the scopeId we want the leader for.
17132
17189
  * @return The id of the leader.
17133
17190
  */
17134
17191
  getLeaderId() {