Attachment Sync: Fehlerbehebung bei Join
This commit is contained in:
@@ -8,7 +8,7 @@ class RageEntity implements IEntity {
|
||||
return this.entity.id;
|
||||
}
|
||||
|
||||
get remoteId(): any {
|
||||
get remoteId(): number {
|
||||
return this.entity.remoteId;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class RageEntityAttachmentPool implements IEntityAttachmentPool {
|
||||
for (let i of this.attachmentPool.keys()) {
|
||||
let pool = this.attachmentPool[i];
|
||||
for (let obj of pool.__attachmentObjects) {
|
||||
if (entity == obj) { return pool;}
|
||||
if (entity == obj) { return pool; }
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -42,7 +42,7 @@ interface IBrowser {
|
||||
|
||||
interface IEntity {
|
||||
id: number;
|
||||
remoteId: any;
|
||||
remoteId: number;
|
||||
type: EntityType;
|
||||
getSharedData<T>(key: string): T;
|
||||
}
|
||||
|
||||
@@ -242,6 +242,11 @@ export default function attachmentManager(game: IGame) {
|
||||
function InitAttachmentsOnJoin() {
|
||||
game.players.forEach(_player => {
|
||||
let player = mp.players.at(_player.remoteId);
|
||||
|
||||
if (!player) {
|
||||
return;
|
||||
}
|
||||
|
||||
let e = game.attachments.get(_player);
|
||||
if (e == null) {
|
||||
let __attachments = [];
|
||||
@@ -259,6 +264,11 @@ export default function attachmentManager(game: IGame) {
|
||||
|
||||
game.vehicles.forEach(_veh => {
|
||||
let vehicle = mp.vehicles.at(_veh.remoteId);
|
||||
|
||||
if (!vehicle) {
|
||||
return;
|
||||
}
|
||||
|
||||
let e = game.attachments.get(_veh);
|
||||
if (e == null) {
|
||||
let __attachments = [];
|
||||
|
||||
Reference in New Issue
Block a user