Fix object selectin/deselection, deprecated http option

This commit is contained in:
Casper Warden
2023-11-22 11:51:20 +00:00
parent adc9d54190
commit 302bf3302f
7 changed files with 50 additions and 20 deletions

View File

@@ -201,20 +201,28 @@ export class RegionCommands extends CommandsBase
SessionID: this.circuit.sessionID
};
deselectObject.ObjectData = [];
const idMap: { [key: number]: GameObject } = {};
const uuidMap: { [key: string]: GameObject } = {};
let skipped = 0;
for (const obj of objects)
{
const localID = obj.ID;
if (!idMap[localID])
if (!(obj instanceof GameObject))
{
idMap[localID] = obj;
skipped++;
continue;
}
const uuidStr = obj.FullID.toString();
if (!uuidMap[uuidStr])
{
uuidMap[uuidStr] = obj;
deselectObject.ObjectData.push({
ObjectLocalID: obj.ID
});
}
}
// Create a map of our expected UUIDs
if (skipped > 0)
{
console.log('Skipped ' + String(skipped) + ' bad objects during deselection');
}
const sequenceID = this.circuit.sendMessage(deselectObject, PacketFlags.Reliable);
return this.circuit.waitForAck(sequenceID, 10000);
@@ -286,8 +294,14 @@ export class RegionCommands extends CommandsBase
};
selectObject.ObjectData = [];
const uuidMap: { [key: string]: GameObject } = {};
let skipped = 0;
for (const obj of objects)
{
if (!(obj instanceof GameObject))
{
skipped++;
continue;
}
const uuidStr = obj.FullID.toString();
if (!uuidMap[uuidStr])
{
@@ -297,6 +311,10 @@ export class RegionCommands extends CommandsBase
});
}
}
if (skipped > 0)
{
console.log('Skipped ' + String(skipped) + ' bad objects during deselection');
}
// Create a map of our expected UUIDs
this.circuit.sendMessage(selectObject, PacketFlags.Reliable);