Skip to content

Commit

Permalink
feat: added some omp wrapper player functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dockfries committed Sep 21, 2022
1 parent 954f677 commit f79662d
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/controllers/gamemode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ import {
import {
AddServerRule,
AllowNickNameCharacter,
ChatTextReplacementToggled,
ClearBanList,
EditPlayerClass,
GetAvailableClasses,
GetPlayerClass,
GetWeaponSlot,
IsBanned,
IsNickNameCharacterAllowed,
IsValidNickName,
IsValidServerRule,
RemoveServerRule,
SetServerRule,
ToggleChatTextReplacement,
} from "omp-wrapper";
import { defaultCharset } from "./settings";

Expand Down Expand Up @@ -248,4 +252,8 @@ export abstract class BaseGameMode extends AbstractGM {
public static removeServerRule = RemoveServerRule;
public static getWeaponSlot = GetWeaponSlot;
public static getAvailableClasses = GetAvailableClasses;
public static getPlayerClass = GetPlayerClass;
public static editPlayerClass = EditPlayerClass;
public static toggleChatTextReplacement = ToggleChatTextReplacement;
public static chatTextReplacementToggled = ChatTextReplacementToggled;
}
101 changes: 98 additions & 3 deletions src/controllers/player/basePlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from "@/enums";
import { BaseVehicle } from "../vehicle";
import { TBasePos } from "@/types";
import { GetPlayerWeather } from "omp-wrapper";
import * as ow from "omp-wrapper";
import { getAnimateDurationByLibName } from "@/utils/animateUtils";

export abstract class BasePlayer {
Expand Down Expand Up @@ -293,9 +293,8 @@ export abstract class BasePlayer {
}
playerFunc.SetPlayerWeather(this.id, weather);
}
// omp-wrapper
public getWeather(): number {
return GetPlayerWeather(this.id);
return ow.GetPlayerWeather(this.id);
}
public setTime(hour: number, minute: number): void | number {
if (hour < 0 || hour > 23) {
Expand Down Expand Up @@ -758,4 +757,100 @@ export abstract class BasePlayer {
public cancelEdit() {
playerFunc.CancelEdit(this.id);
}
public toggleWidescreen(set: boolean): number {
return ow.TogglePlayerWidescreen(this.id, set);
}
public isPlayerWidescreenToggled(): boolean {
return ow.IsPlayerWidescreenToggled(this.id);
}
public getSpawnInfo() {
return ow.GetSpawnInfo(this.id);
}
public getSkillLevel(skill: WeaponSkillsEnum): number {
return ow.GetPlayerSkillLevel(this.id, skill);
}
public isCheckpointActive(): boolean {
return ow.IsPlayerCheckpointActive(this.id);
}
public getCheckpoint() {
return ow.GetPlayerCheckpoint(this.id);
}
public isRaceCheckpointActive(): boolean {
return ow.IsPlayerRaceCheckpointActive(this.id);
}
public getRaceCheckpoint() {
return ow.GetPlayerRaceCheckpoint(this.id);
}
public getWorldBounds() {
ow.GetPlayerWorldBounds(this.id);
}
public isInModShop(): boolean {
return ow.IsPlayerInModShop(this.id);
}
public getSirenState(): number {
return ow.GetPlayerSirenState(this.id);
}
public getLandingGearState(): number {
return ow.GetPlayerLandingGearState(this.id);
}
public getHydraReactorAngle(): number {
return ow.GetPlayerHydraReactorAngle(this.id);
}
public getTrainSpeed(): number {
return ow.GetPlayerTrainSpeed(this.id);
}
public getZAim(): number {
return ow.GetPlayerZAim(this.id);
}
public getSurfingOffsets() {
return ow.GetPlayerSurfingOffsets(this.id);
}
public getRotationQuat() {
return ow.GetPlayerRotationQuat(this.id);
}
public getDialogID(): number {
return ow.GetPlayerDialogID(this.id);
}
public getSpectateID(): number {
return ow.GetPlayerSpectateID(this.id);
}
public getSpectateType(): SpectateModesEnum {
return ow.GetPlayerSpectateType(this.id);
}
public getRawIp(): string {
return ow.GetPlayerRawIp(this.id);
}
public setGravity(gravity: number): number {
return ow.SetPlayerGravity(this.id, gravity);
}
public getGravity(): number {
return ow.GetPlayerGravity(this.id);
}
public setAdmin(admin: boolean) {
return ow.SetPlayerAdmin(this.id, admin);
}
public isSpawned(): boolean {
return ow.IsPlayerSpawned(this.id);
}
public isControllable(): boolean {
return ow.IsPlayerControllable(this.id);
}
public isCameraTargetEnabled(): boolean {
return ow.IsPlayerCameraTargetEnabled(this.id);
}
public toggleGhostMode(toggle: boolean) {
return ow.TogglePlayerGhostMode(this.id, toggle);
}
public getGhostMode(): boolean {
return ow.GetPlayerGhostMode(this.id);
}
public getBuildingsRemoved(): number {
return ow.GetPlayerBuildingsRemoved(this.id);
}
public getAttachedObject(index: number) {
return ow.GetPlayerAttachedObject(this.id, index);
}
public removeWeapon(weaponid: number): number {
return ow.RemovePlayerWeapon(this.id, weaponid);
}
}

0 comments on commit f79662d

Please sign in to comment.