evtl fix taxifahrer fehler

This commit is contained in:
hydrant
2020-08-02 15:51:23 +02:00
parent ecd33789d1
commit 71e91e9275
2 changed files with 29 additions and 1 deletions

View File

@@ -6,10 +6,18 @@ class RageEntity implements IEntity {
private entity: EntityMp;
get id(): number {
if (!this.entity) {
return null;
}
return this.entity.id;
}
get remoteId(): number {
if (!this.entity) {
return null;
}
return this.entity.remoteId;
}
@@ -18,6 +26,10 @@ class RageEntity implements IEntity {
}
get type(): EntityType {
if (!this.entity) {
return null;
}
switch (this.entity.type) {
case 'vehicle': return EntityType.Vehicle;
case 'player': return EntityType.Player;
@@ -26,6 +38,10 @@ class RageEntity implements IEntity {
}
getSharedData<T>(key: string): T {
if (!this.entity) {
return null;
}
var data = this.entity.getVariable(key);
if (typeof data !== 'undefined') {
return parseJson<T>(<string>data);
@@ -45,11 +61,19 @@ class RagePlayer extends RageEntity implements IPlayer {
}
get vehicle(): IVehicle {
if (!this.player) {
return null;
}
var veh: VehicleMp = this.player.vehicle;
return veh ? new RageVehicle(veh) : null;
}
get inVehicle(): boolean {
if (!this.player) {
return false;
}
return this.player.isInAnyVehicle(false);
}