´remove garbage
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IEntity, IPlayer, IEntityAttachments, IEntityAttachmentPool, IPlayerPool, IVehicle, IVehiclePool, VehicleSeat, EntityType, IObjectPool, IObject } from "../../game";
|
||||
import { IEntity, IPlayer, IEntityAttachments, IEntityAttachmentPool, IPlayerPool, IVehicle, IVehiclePool, VehicleSeat, EntityType } from "../../game";
|
||||
import { parseJson } from "../../util";
|
||||
import game from "../..";
|
||||
|
||||
@@ -190,18 +190,6 @@ class RagePlayerPool implements IPlayerPool {
|
||||
}
|
||||
}
|
||||
|
||||
class RageObject extends RageEntity implements IObject {
|
||||
public object: ObjectMp;
|
||||
public __attachmentData: object;
|
||||
|
||||
constructor(object: ObjectMp) {
|
||||
if (!object) {
|
||||
throw "Object is undefined"
|
||||
}
|
||||
super(object);
|
||||
this.object = object;
|
||||
}
|
||||
}
|
||||
|
||||
class RageVehicle extends RageEntity implements IVehicle {
|
||||
private vehicle: VehicleMp;
|
||||
@@ -240,36 +228,6 @@ class RageVehicle extends RageEntity implements IVehicle {
|
||||
}
|
||||
|
||||
|
||||
class RageObjectPool implements IObjectPool {
|
||||
public attachmentDataMap: Map<ObjectMp, object>;
|
||||
|
||||
|
||||
setData(entity: ObjectMp, attachmentData: object): void {
|
||||
if (!this.attachmentDataMap)
|
||||
this.attachmentDataMap = new Map<ObjectMp, object>();
|
||||
|
||||
this.attachmentDataMap.set(entity, attachmentData);
|
||||
}
|
||||
|
||||
at(id: number): IObject {
|
||||
var object = mp.objects.atRemoteId(Number(id));
|
||||
|
||||
if (!object)
|
||||
return null;
|
||||
|
||||
return new RageObject(object, this.attachmentDataMap.get(object));
|
||||
}
|
||||
|
||||
forEach(fn: (entity: IObject) => void): void {
|
||||
mp.objects.forEach(e => {
|
||||
if (!e) {
|
||||
game.ui.sendChatMessage("forEach - e is null");
|
||||
return;
|
||||
}
|
||||
fn(new RageObject(e, this.attachmentDataMap.get(e)));
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
class RageVehiclePool implements IVehiclePool {
|
||||
at(id: number): IVehicle {
|
||||
@@ -301,6 +259,5 @@ export {
|
||||
RageEntityAttachmentPool,
|
||||
RageVehicle,
|
||||
RageVehiclePool,
|
||||
RageObject,
|
||||
RageObjectPool,
|
||||
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
import { IGame, IUi, IEvents, IPlayerPool, IVehiclePool, IEntityAttachmentPool, IObjectPool } from "../../game";
|
||||
import { IGame, IUi, IEvents, IPlayerPool, IVehiclePool, IEntityAttachmentPool } from "../../game";
|
||||
import RageEvents from "./events";
|
||||
import RageUi from "./ui";
|
||||
import { RagePlayerPool, RageVehiclePool, RageEntityAttachmentPool, RageObjectPool } from "./entities";
|
||||
import { RagePlayerPool, RageVehiclePool, RageEntityAttachmentPool } from "./entities";
|
||||
|
||||
export default class RageGame implements IGame {
|
||||
players: IPlayerPool = new RagePlayerPool();
|
||||
vehicles: IVehiclePool = new RageVehiclePool();
|
||||
attachments: IEntityAttachmentPool = new RageEntityAttachmentPool();
|
||||
objects: IObjectPool = new RageObjectPool();
|
||||
events: IEvents = new RageEvents;
|
||||
ui: IUi = new RageUi;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
players: IPlayerPool;
|
||||
vehicles: IVehiclePool;
|
||||
attachments: IEntityAttachmentPool;
|
||||
objects: IObjectPool;
|
||||
|
||||
disableDefaultEngineBehaviour(): void;
|
||||
}
|
||||
@@ -56,9 +55,6 @@ interface IPlayer extends IEntity {
|
||||
nametagColor: number;
|
||||
}
|
||||
|
||||
interface IObject extends IEntity {
|
||||
__attachmentData: object;
|
||||
}
|
||||
|
||||
interface IEntityAttachments {
|
||||
remoteId: any;
|
||||
@@ -80,9 +76,6 @@ interface IEntityPool<TEntity> {
|
||||
forEach(fn: (entity: TEntity) => void): void;
|
||||
}
|
||||
|
||||
interface IObjectPool extends IEntityPool<IObject> {
|
||||
setData(entity: ObjectMp): void;
|
||||
}
|
||||
|
||||
interface IPlayerPool extends IEntityPool<IPlayer> {
|
||||
local: IPlayer;
|
||||
@@ -159,7 +152,6 @@ export {
|
||||
IBrowser,
|
||||
|
||||
IPlayer,
|
||||
IObject,
|
||||
IEntityAttachments,
|
||||
IEntityAttachmentPool,
|
||||
IVehicle,
|
||||
@@ -167,7 +159,6 @@ export {
|
||||
IEntityPool,
|
||||
IPlayerPool,
|
||||
IVehiclePool,
|
||||
IObjectPool,
|
||||
|
||||
EventName,
|
||||
Key,
|
||||
|
||||
Reference in New Issue
Block a user