Skip to content

Commit

Permalink
add: more type definitions (#74)
Browse files Browse the repository at this point in the history
this commit also include some prettier formats (the past commit was not formatted correctly)
  • Loading branch information
ghosty2004 authored Apr 12, 2024
1 parent 8b40e8e commit 26dec95
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 17 deletions.
29 changes: 26 additions & 3 deletions packages/client/game/graphics.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1241,18 +1241,41 @@ declare interface GameGraphics extends GameGraphicsLegacy {

/**
* This function allows you to disable the state of an artificial lightId (granular control over lights instead of e.g. setBlackout turning all on/off)
*
*
* @param lightId The lightId (valid 0 through 16) to change the state of
* @param disable true to disable; false to enable (defaults to false)
*/
setLightsState(lightId: number, disable: boolean): void
setLightsState(lightId: number, disable: boolean): void;

/**
* @param layer Only layer 4 works
*/
set2dLayer(layer: number): void
set2dLayer(layer: number): void;

unk: GameGraphicsUnk;

/**
* This function will create a texture swap in the world
*
* @param oldTextureDict The old texture dictionary
* @param oldTextureName The old texture name
* @param newTextureDict The new texture dictionary
* @param newTextureName The new texture name
*/
createWorldTextureSwap(oldTextureDict: string, oldTextureName: string, newTextureDict: string, newTextureName: string): void;

/**
* This function will remove the specified texture swap from the world
*
* @param oldTextureDict The old texture dictionary
* @param oldTextureName The old texture name
*/
removeWorldTextureSwap(oldTextureDict: string, oldTextureName: string): void;

/**
* This function will reset all texture swaps in the world
*/
resetWorldTextureSwaps(): void;
}

declare interface GameGraphicsMp extends GameGraphics {}
84 changes: 70 additions & 14 deletions packages/client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ declare class EntityMp {
resetAlpha(): void;
/**
* - If you are applying alpha to an ObjectMp, use mp.game.entity.setAlpha
* @param alphaLevel
* @param alphaLevel
*/
setAlpha(alphaLevel: number): void;
setAlwaysPrerender(toggle: boolean): void;
Expand Down Expand Up @@ -882,6 +882,11 @@ declare interface GuiCursorMp {
* Show or hide the cursor on your screen
*/
show(freezeControls: boolean, state: boolean): void;

/**
* Registers a custom cursor icon
*/
registerCustomIcon(type: string, packageFilePath: string, offsetX: number, offsetY: number): void;
}

declare interface UserMp {
Expand Down Expand Up @@ -1005,7 +1010,12 @@ declare interface RaycastingMp {
/**
* Same as testPointToPoint but async
*/
testPointToPointAsync(startPos: Vector3, endPos: Vector3, ignoreEntity?: EntityMp | EntityMp[], flags?: number | number[]): Promise<RaycastResult>;
testPointToPointAsync(
startPos: Vector3,
endPos: Vector3,
ignoreEntity?: EntityMp | EntityMp[],
flags?: number | number[]
): Promise<RaycastResult>;

/**
* Raycast from point to point, where the ray has a radius.
Expand Down Expand Up @@ -1059,17 +1069,32 @@ declare interface BrowserMp {
executeCached(code: string): void;

/**
* Available on 11_test_1102_eXzHpHrWd2UfgUhdau6PDVJ88GG5aQY3 branch
*/
* Available on 11_test_1102_eXzHpHrWd2UfgUhdau6PDVJ88GG5aQY3 branch
*/
headlessTextureDict: string;
headlessTextureName: string;
headlessTextureHeightScale: number;
inputEnabled: boolean;

/**
* Send mouse move event
*/
sendMouseMoveEvent(x: number, y: number): void;

/**
* Send mouse click event
*/
sendMouseClickEvent(buttonType: number, x: number, y: number, isUp: boolean): void;

/**
* Property used to gets the mouse input state
*/
mouseInputEnabled: boolean;
}

declare interface BrowserMpPool extends EntityMpPool<BrowserMp> {
'new'(url: string): BrowserMp;
newHeadless(url: string, width: number, height: number): BrowserMp;
newHeadless(url: string, width: number, height: number, forceFlip?: boolean): BrowserMp;
}

declare interface CheckpointMp extends EntityMp {
Expand Down Expand Up @@ -1153,6 +1178,8 @@ declare interface IClientEvents {
playerExitColshape: (shape: ColshapeMp) => void;
explosion: (sourcePlayer: PlayerMp, type: RageEnums.Explosions, position: Vector3) => boolean;
projectile: (sourcePlayer: PlayerMp, weaponHash: number, ammoType: number, position: Vector3, direction: Vector3) => boolean;
uncaughtException: (exception: any) => void;
unhandledRejection: (promise: Promise<any>, error: any) => void;
}

declare class EventMp {
Expand Down Expand Up @@ -2130,7 +2157,16 @@ declare interface PedMpBase extends EntityMp {
taskSmartFleeCoord(x: number, y: number, z: number, distance: number, time: number, preferPavements: boolean, quitIfOutOfRange: boolean): void;
taskStandGuard(x: number, y: number, z: number, heading: number, scenarioName: string): void;
taskStandStill(time: number): void;
taskStartScenarioAtPosition(scenarioName: string, x: number, y: number, z: number, heading: number, duration: number, sittingScenario: boolean, teleport: boolean): void;
taskStartScenarioAtPosition(
scenarioName: string,
x: number,
y: number,
z: number,
heading: number,
duration: number,
sittingScenario: boolean,
teleport: boolean
): void;
taskStartScenarioInPlace(scenarioName: string, unkDelay: number, playEnterAnim: boolean): void;
taskStayInCover(): void;
taskStealthKill(target: Handle, killType: Hash, p3: number, p4: boolean): void;
Expand Down Expand Up @@ -2282,14 +2318,13 @@ declare interface PedMp extends PedMpBase {
* @returns boolean
*/
isPositionFrozen: boolean;

}

declare interface PedMpPool extends EntityMpPool<PedMp> {
'new'(model: RageEnums.Hashes.Ped | Hash, position: Vector3, heading: number, dimension?: number): PedMp;
}

declare interface PickupMp extends EntityMp { }
declare interface PickupMp extends EntityMp {}

declare interface PickupMpPool extends EntityMpPool<PickupMp> {
'new'(...args: any[]): PickupMp;
Expand Down Expand Up @@ -2461,11 +2496,30 @@ declare interface PlayerMp extends PedMpBase {
resetVoiceFx(fxHandle: VoiceHandle): void;
setVoiceFxChorus(fxHandle: VoiceHandle, { fWetDryMix, fDepth, fFeedback, fFrequency, lWaveform, fDelay, lPhase }: VoiceFxChorus): void;
setVoiceFxCompressor(fxHandle: VoiceHandle, { fGain, fAttack, fRelease, fThreshold, fRatio, fPredelay }: VoiceFxCompressor): void;
setVoiceFxDistortion(fxHandle: VoiceHandle, { fGain, fEdge, fPostEQCenterFrequency, fPostEQBandwidth, fPreLowpassCutoff }: VoiceFxDistortion): void;
setVoiceFxDistortion(
fxHandle: VoiceHandle,
{ fGain, fEdge, fPostEQCenterFrequency, fPostEQBandwidth, fPreLowpassCutoff }: VoiceFxDistortion
): void;
setVoiceFxEcho(fxHandle: VoiceHandle, { fWetDryMix, fFeedback, fLeftDelay, fRightDelay, lPanDelay }: VoiceFxEcho): void;
setVoiceFxFlanger(fxHandle: VoiceHandle, { fWetDryMix, fDepth, fFeedback, fFrequency, lWaveform, fDelay, lPhase }: VoiceFxFlanger): void;
setVoiceFxGargle(fxHandle: VoiceHandle, { dwRateHz, dwWaveShape }: VoiceFxGargle): void;
setVoiceFxI3DL2Reverb(fxHandle: VoiceHandle, { lRoom, lRoomHF, flRoomRolloffFactor, flDecayTime, flDecayHFRatio, lReflections, flReflectionsDelay, lReverb, flReverbDelay, flDiffusion, flDensity, flHFReference }: VoiceFxI3DL2Reverb): void;
setVoiceFxI3DL2Reverb(
fxHandle: VoiceHandle,
{
lRoom,
lRoomHF,
flRoomRolloffFactor,
flDecayTime,
flDecayHFRatio,
lReflections,
flReflectionsDelay,
lReverb,
flReverbDelay,
flDiffusion,
flDensity,
flHFReference
}: VoiceFxI3DL2Reverb
): void;
setVoiceFxParamEq(fxHandle: VoiceHandle, { fCenter, fBandwidth, fGain }: VoiceFxParamEq): void;
setVoiceFxReverb(fxHandle: VoiceHandle, { fInGain, fReverbMix, fReverbTime, fHighFreqRTRatio }: VoiceFxReverb): void;
setVoiceFxVolume(fxHandle: VoiceHandle, { fTarget, fCurrent, fTime, lCurve }: VoiceFxVolume): void;
Expand Down Expand Up @@ -2843,9 +2897,9 @@ declare interface VehicleMp extends EntityMp {
wheelCount: number;

/**
* @params wheelId
* @returns number
*/
* @params wheelId
* @returns number
*/
getWheelCamber(wheelId: number): number;

/**
Expand Down Expand Up @@ -2981,7 +3035,7 @@ declare interface VehicleMp extends EntityMp {
setSuspensionHeight(height: number): void;

/**
*
*
* Available on 11_test_1102_eXzHpHrWd2UfgUhdau6PDVJ88GG5aQY3 branch
*/

Expand Down Expand Up @@ -3408,6 +3462,8 @@ declare interface VehicleMp extends EntityMp {
toggleMod(modType: number, toggle: boolean): void;
trackVisibility(): void;
wasCounterActivated(p0: any): boolean;
setLiveryTexture(textureDict: string, textureName: string): void;
setNumberPlateTexture(textureDict: string, textureName: string, textureDictNormal: string, textureNameNormal: string): void;
}

declare interface VehicleMpPool extends EntityMpPool<VehicleMp> {
Expand Down

0 comments on commit 26dec95

Please sign in to comment.