@specter-automation/test 1.0.111 → 1.0.112
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.
|
@@ -265,16 +265,27 @@ class ActorLocator extends specter_locator_1.SpecterLocator {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
// If a client world is provided but neither playerId nor playerIndex is specified,
|
|
268
|
-
// query the client world for its local PlayerId.
|
|
268
|
+
// query the client world silently for its local PlayerId.
|
|
269
269
|
if (targetWorld && targetPlayerId === undefined && targetPlayerIndex === undefined) {
|
|
270
270
|
try {
|
|
271
|
-
const idResponse = await targetWorld.evaluate("GetPlayerId", {}, undefined);
|
|
272
|
-
if (idResponse?.data?.playerId !== undefined) {
|
|
271
|
+
const idResponse = await targetWorld.evaluate("GetPlayerId", {}, undefined, undefined, true);
|
|
272
|
+
if (idResponse?.data?.playerId !== undefined && idResponse.data.playerId > 0) {
|
|
273
273
|
targetPlayerId = idResponse.data.playerId;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
catch {
|
|
277
|
-
// If GetPlayerId fails or isn't available yet, proceed
|
|
277
|
+
// If GetPlayerId fails or isn't available yet, proceed with fallback below
|
|
278
|
+
}
|
|
279
|
+
// Fallback: if playerId couldn't be resolved, infer playerIndex from client port (port 8081 -> index 1)
|
|
280
|
+
if (targetPlayerId === undefined) {
|
|
281
|
+
const transport = targetWorld.transport;
|
|
282
|
+
const portStr = transport?.port;
|
|
283
|
+
if (portStr) {
|
|
284
|
+
const portNum = parseInt(portStr, 10);
|
|
285
|
+
if (portNum > 8080 && portNum <= 8100) {
|
|
286
|
+
targetPlayerIndex = portNum - 8080;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
278
289
|
}
|
|
279
290
|
}
|
|
280
291
|
const payload = {};
|
|
@@ -276,7 +276,7 @@ export declare class SpecterWorld {
|
|
|
276
276
|
* @param payload The data payload to send
|
|
277
277
|
* @param context Optional string to distinguish identical commands in the UI (e.g., "Attacker" or "Player 1")
|
|
278
278
|
*/
|
|
279
|
-
evaluate(commandName: string, payload?: any, context?: string, targetLocator?: string): Promise<any>;
|
|
279
|
+
evaluate(commandName: string, payload?: any, context?: string, targetLocator?: string, bHideStep?: boolean): Promise<any>;
|
|
280
280
|
setTimeDilation(speed: number): Promise<void>;
|
|
281
281
|
spawnActor(assetPath: string, options?: SpawnOptions): Promise<ActorLocator>;
|
|
282
282
|
actor<T extends RegisteredActorClasses | (string & {})>(selector: T): ActorLocator<T>;
|
|
@@ -466,7 +466,13 @@ class SpecterWorld {
|
|
|
466
466
|
* @param payload The data payload to send
|
|
467
467
|
* @param context Optional string to distinguish identical commands in the UI (e.g., "Attacker" or "Player 1")
|
|
468
468
|
*/
|
|
469
|
-
async evaluate(commandName, payload = {}, context, targetLocator) {
|
|
469
|
+
async evaluate(commandName, payload = {}, context, targetLocator, bHideStep = false) {
|
|
470
|
+
if (bHideStep) {
|
|
471
|
+
return await this.transport.sendCommand({
|
|
472
|
+
command: commandName,
|
|
473
|
+
payload: payload
|
|
474
|
+
});
|
|
475
|
+
}
|
|
470
476
|
const formattedCommand = commandName.charAt(0).toLowerCase() + commandName.slice(1);
|
|
471
477
|
const portTag = this.transport.friendlyPortTag;
|
|
472
478
|
// Format the title based on whether context was provided
|