diff --git a/packages/core/src/controllers/netstats/index.ts b/packages/core/src/controllers/netstats/index.ts index 612237f..6f9d0ef 100644 --- a/packages/core/src/controllers/netstats/index.ts +++ b/packages/core/src/controllers/netstats/index.ts @@ -8,36 +8,34 @@ export class NetStats { static getNetworkStats(): string { return f.GetNetworkStats(); } - static getPlayerNetworkStats
(player: P): string { + static getPlayerNetworkStats(player: Player): string { return f.GetPlayerNetworkStats(player.id); } - static getBytesReceived
(player: P): number { + static getBytesReceived(player: Player): number { return f.NetStats_BytesReceived(player.id); } - static getBytesSent
(player: P): number { + static getBytesSent(player: Player): number { return f.NetStats_BytesSent(player.id); } - static getConnectionStatus
( - player: P - ): ConnectionStatusEnum { + static getConnectionStatus(player: Player): ConnectionStatusEnum { return f.NetStats_ConnectionStatus(player.id); } - static getConnectedTime
(player: P): number { + static getConnectedTime(player: Player): number { return f.NetStats_GetConnectedTime(player.id); } - static getIpPort
(player: P): string { + static getIpPort(player: Player): string { return f.NetStats_GetIpPort(player.id); } - static getMessagesReceived
(player: P): number { + static getMessagesReceived(player: Player): number { return f.NetStats_MessagesReceived(player.id); } - static getMessagesRecvPerSecond
(player: P): number { + static getMessagesRecvPerSecond(player: Player): number { return f.NetStats_MessagesRecvPerSecond(player.id); } - static getMessagesSent
(player: P): number { + static getMessagesSent(player: Player): number { return f.NetStats_MessagesSent(player.id); } - static getPacketLossPercent
(player: P): number { + static getPacketLossPercent(player: Player): number { return f.NetStats_PacketLossPercent(player.id); } } diff --git a/packages/core/src/controllers/vehicle/entity.ts b/packages/core/src/controllers/vehicle/entity.ts index 0bdce62..d9e5546 100644 --- a/packages/core/src/controllers/vehicle/entity.ts +++ b/packages/core/src/controllers/vehicle/entity.ts @@ -2,7 +2,7 @@ import type { CarModTypeEnum, VehicleModelInfoEnum } from "core/enums"; import { LimitsEnum } from "core/enums"; import type { TPos } from "core/types"; import type { IVehicle } from "core/interfaces"; -import type { Player } from "../player"; +import { Player } from "../player"; import { isValidPaintJob, isValidVehComponent } from "core/utils/vehicleUtils"; import * as v from "core/wrapper/native/functions"; @@ -143,19 +143,19 @@ export class Vehicle { if (this.id === -1) return 0; return v.SetVehicleHealth(this.id, health); } - isPlayerIn
(player: P): boolean { + isPlayerIn(player: Player): boolean { if (this.id === -1) return false; return v.IsPlayerInVehicle(player.id, this.id); } - putPlayerIn
(player: P, seatid: number): number { + putPlayerIn(player: Player, seatId: number): number { if (this.id === -1) return 0; - if (seatid < 0) return 0; - if (seatid > 4) { + if (seatId < 0) return 0; + if (seatId > 4) { logger.warn( "[Vehicle]: If the seat is invalid or is taken, will cause a crash when they EXIT the vehicle." ); } - return v.PutPlayerInVehicle(player.id, this.id, seatid); + return v.PutPlayerInVehicle(player.id, this.id, seatId); } getZAngle(): number { if (this.id === -1) return 0; @@ -216,14 +216,14 @@ export class Vehicle { return v.GetVehicleModel(this.id); } static getModelInfo( - vehiclemodel: number, - infotype: VehicleModelInfoEnum + vehicleModel: number, + infoType: VehicleModelInfoEnum ): TPos { - return v.GetVehicleModelInfo(vehiclemodel, infotype); + return v.GetVehicleModelInfo(vehicleModel, infoType); } - getModelInfo(infotype: VehicleModelInfoEnum): void | TPos { + getModelInfo(infoType: VehicleModelInfoEnum): void | TPos { if (this.id === -1) return; - return Vehicle.getModelInfo(this.getModel(), infotype); + return Vehicle.getModelInfo(this.getModel(), infoType); } getRotationQuat() { if (this.id === -1) return; @@ -234,38 +234,38 @@ export class Vehicle { if (this.id === -1) return 0; return v.SetVehicleToRespawn(this.id); } - isStreamedIn
(forplayer: P): boolean { + isStreamedIn(forPlayer: Player): boolean { if (this.id === -1) return false; - return v.IsVehicleStreamedIn(this.id, forplayer.id); + return v.IsVehicleStreamedIn(this.id, forPlayer.id); } setParamsCarDoors( driver: boolean, passenger: boolean, - backleft: boolean, - backright: boolean + backLeft: boolean, + backRight: boolean ): number { if (this.id === -1) return 0; return v.SetVehicleParamsCarDoors( this.id, driver, passenger, - backleft, - backright + backLeft, + backRight ); } setParamsCarWindows( driver: boolean, passenger: boolean, - backleft: boolean, - backright: boolean + backLeft: boolean, + backRight: boolean ) { if (this.id === -1) return 0; return v.SetVehicleParamsCarWindows( this.id, driver, passenger, - backleft, - backright + backLeft, + backRight ); } getParamsCarDoors() { @@ -307,17 +307,17 @@ export class Vehicle { if (this.id === -1) return -2; return v.GetVehicleParamsSirenState(this.id); } - setParamsForPlayer
(
- player: P,
+ setParamsForPlayer(
+ player: Player,
objective: boolean,
- doorslocked: boolean
+ doorsLocked: boolean
): number {
if (this.id === -1) return 0;
return v.SetVehicleParamsForPlayer(
this.id,
player.id,
objective,
- doorslocked
+ doorsLocked
);
}
isTrailerAttached(): boolean {
@@ -331,7 +331,7 @@ export class Vehicle {
v.ChangeVehiclePaintjob(this.id, paintjobId);
return 1;
}
- attachTrailer (players: Map (players: Map (forplayer: P): boolean {
+ isStreamedIn(forPlayer: Player): boolean {
if (this.id === -1) return false;
- return s.IsDynamicActorStreamedIn(this.id, forplayer.id);
+ return s.IsDynamicActorStreamedIn(this.id, forPlayer.id);
}
getVirtualWorld(): void | number {
if (this.id === -1)
@@ -199,21 +199,15 @@ export class DynamicActor {
);
return s.SetDynamicActorInvulnerable(this.id, invulnerable);
}
- getPlayerTarget (
- player: P,
- actors: Map (
- player: P,
- actors: Map (player: P, recheck = false): boolean {
+ isPlayerIn(player: Player, recheck = false): boolean {
if (this.id === -1) return false;
return s.IsPlayerInDynamicArea(player.id, this.id, recheck);
}
- static isPlayerInAny (player: P, recheck = false): boolean {
+ static isPlayerInAny(player: Player, recheck = false): boolean {
return s.IsPlayerInAnyDynamicArea(player.id, recheck);
}
isAnyPlayerIn(recheck = false): boolean {
@@ -277,15 +277,12 @@ export class DynamicArea {
static isAnyPlayerInAny(recheck = false): boolean {
return s.IsAnyPlayerInAnyDynamicArea(recheck);
}
- static getPlayerAreas (
- player: P,
- areas: Map (player: P) {
+ static getPlayerAreasNumber(player: Player) {
return s.GetPlayerNumberDynamicAreas(player.id);
}
isPointIn(x: number, y: number, z: number): boolean {
@@ -316,31 +313,27 @@ export class DynamicArea {
): boolean {
return s.IsLineInAnyDynamicArea(x1, y1, z1, x2, y2, z2);
}
- static getForPoint(
- x: number,
- y: number,
- z: number,
- areas: Map (
- player: P,
+ attachToPlayer(
+ player: Player,
offsetX = 0.0,
offsetY = 0.0,
offsetZ = 0.0
@@ -390,8 +383,8 @@ export class DynamicArea {
offsetZ
);
}
- attachToVehicle (player: P, toggle: boolean): void | this {
+ togglePlayer(player: Player, toggle: boolean): void | this {
if (this.id === -1)
return logger.warn(
"[StreamerCheckpoint]: Unable to toggle the player before create"
@@ -117,18 +117,17 @@ export class DynamicCheckpoint {
TogglePlayerDynamicCP(player.id, this.id, toggle);
return this;
}
- static togglePlayerAll (player: P, toggle: boolean): number {
+ static togglePlayerAll(player: Player, toggle: boolean): number {
return TogglePlayerAllDynamicCPs(player.id, toggle);
}
- isPlayerIn (player: P): boolean {
+ isPlayerIn(player: Player): boolean {
if (this.id === -1) return false;
return IsPlayerInDynamicCP(player.id, this.id);
}
- static getPlayerVisible (
- player: P,
- checkpoints: Map (player: P): void | number {
+ attachCamera(player: Player): void | number {
if (this.id === -1 || player.id === -1)
return logger.warn(
"[StreamerObject]: Cannot attachCamera before both are created"
@@ -184,8 +184,8 @@ export class DynamicObject {
return s.AttachCameraToDynamicObject(player.id, this.id);
}
- attachToObject (
- player: P,
+ attachToPlayer(
+ player: Player,
offsetX: number,
offsetY: number,
offsetZ: number,
@@ -236,8 +236,8 @@ export class DynamicObject {
);
}
- attachToVehicle (player: P): void | number {
+ edit(player: Player): void | number {
if (this.id === -1)
return logger.warn("[StreamerObject]: Unable to edit before create");
player.endObjectEditing();
@@ -367,13 +367,10 @@ export class DynamicObject {
);
}
- getPlayerCameraTarget (
- player: P,
- objMap: Map (player: P, toggle: boolean): void | this {
+ togglePlayer(player: Player, toggle: boolean): void | this {
if (this.id === -1)
return logger.warn(
"[StreamerRaceCP]: Unable to toggle the player before create"
@@ -121,18 +121,17 @@ export class DynamicRaceCP {
TogglePlayerDynamicRaceCP(player.id, this.id, toggle);
return this;
}
- static togglePlayerAll (player: P, toggle: boolean): number {
+ static togglePlayerAll(player: Player, toggle: boolean): number {
return TogglePlayerAllDynamicRaceCPs(player.id, toggle);
}
- isPlayerIn (player: P): boolean {
+ isPlayerIn(player: Player): boolean {
if (this.id === -1) return false;
return IsPlayerInDynamicRaceCP(player.id, this.id);
}
- static getPlayerVisible (
- player: P,
- checkpoints: Map