Attachment Sync: Fehlerbehebung bei Join

This commit is contained in:
hydrant
2020-05-11 15:50:54 +02:00
parent 1242ae575b
commit 04538bddf2
3 changed files with 14 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ class RageEntity implements IEntity {
return this.entity.id;
}
get remoteId(): any {
get remoteId(): number {
return this.entity.remoteId;
}

View File

@@ -42,7 +42,7 @@ interface IBrowser {
interface IEntity {
id: number;
remoteId: any;
remoteId: number;
type: EntityType;
getSharedData<T>(key: string): T;
}

View File

@@ -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 = [];