´remove garbage

This commit is contained in:
kookroach
2021-04-04 21:53:51 +02:00
parent 8b21742d64
commit fa81b7fc79
3 changed files with 4 additions and 57 deletions

View File

@@ -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 { parseJson } from "../../util";
import game from "../.."; 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 { class RageVehicle extends RageEntity implements IVehicle {
private vehicle: VehicleMp; 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 { class RageVehiclePool implements IVehiclePool {
at(id: number): IVehicle { at(id: number): IVehicle {
@@ -301,6 +259,5 @@ export {
RageEntityAttachmentPool, RageEntityAttachmentPool,
RageVehicle, RageVehicle,
RageVehiclePool, RageVehiclePool,
RageObject,
RageObjectPool,
} }

View File

@@ -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 RageEvents from "./events";
import RageUi from "./ui"; import RageUi from "./ui";
import { RagePlayerPool, RageVehiclePool, RageEntityAttachmentPool, RageObjectPool } from "./entities"; import { RagePlayerPool, RageVehiclePool, RageEntityAttachmentPool } from "./entities";
export default class RageGame implements IGame { export default class RageGame implements IGame {
players: IPlayerPool = new RagePlayerPool(); players: IPlayerPool = new RagePlayerPool();
vehicles: IVehiclePool = new RageVehiclePool(); vehicles: IVehiclePool = new RageVehiclePool();
attachments: IEntityAttachmentPool = new RageEntityAttachmentPool(); attachments: IEntityAttachmentPool = new RageEntityAttachmentPool();
objects: IObjectPool = new RageObjectPool();
events: IEvents = new RageEvents; events: IEvents = new RageEvents;
ui: IUi = new RageUi; ui: IUi = new RageUi;

View File

@@ -6,7 +6,6 @@
players: IPlayerPool; players: IPlayerPool;
vehicles: IVehiclePool; vehicles: IVehiclePool;
attachments: IEntityAttachmentPool; attachments: IEntityAttachmentPool;
objects: IObjectPool;
disableDefaultEngineBehaviour(): void; disableDefaultEngineBehaviour(): void;
} }
@@ -56,9 +55,6 @@ interface IPlayer extends IEntity {
nametagColor: number; nametagColor: number;
} }
interface IObject extends IEntity {
__attachmentData: object;
}
interface IEntityAttachments { interface IEntityAttachments {
remoteId: any; remoteId: any;
@@ -80,9 +76,6 @@ interface IEntityPool<TEntity> {
forEach(fn: (entity: TEntity) => void): void; forEach(fn: (entity: TEntity) => void): void;
} }
interface IObjectPool extends IEntityPool<IObject> {
setData(entity: ObjectMp): void;
}
interface IPlayerPool extends IEntityPool<IPlayer> { interface IPlayerPool extends IEntityPool<IPlayer> {
local: IPlayer; local: IPlayer;
@@ -159,7 +152,6 @@ export {
IBrowser, IBrowser,
IPlayer, IPlayer,
IObject,
IEntityAttachments, IEntityAttachments,
IEntityAttachmentPool, IEntityAttachmentPool,
IVehicle, IVehicle,
@@ -167,7 +159,6 @@ export {
IEntityPool, IEntityPool,
IPlayerPool, IPlayerPool,
IVehiclePool, IVehiclePool,
IObjectPool,
EventName, EventName,
Key, Key,