@nativewrappers/redm 0.0.44 → 0.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Controls.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { KeyHash } from "./enums/Keys";
2
+ export declare class Controls {
3
+ static IsInputJustPressed(hash: KeyHash): boolean;
4
+ static IsInputPressed(hash: KeyHash): boolean;
5
+ static IsDisabledInputPressed(hash: KeyHash): boolean;
6
+ static DisableControl(hash: KeyHash): void;
7
+ }
package/Controls.js ADDED
@@ -0,0 +1,14 @@
1
+ export class Controls {
2
+ static IsInputJustPressed(hash) {
3
+ return IsControlJustPressed(0, hash);
4
+ }
5
+ static IsInputPressed(hash) {
6
+ return IsControlPressed(0, hash);
7
+ }
8
+ static IsDisabledInputPressed(hash) {
9
+ return IsDisabledControlPressed(0, hash);
10
+ }
11
+ static DisableControl(hash) {
12
+ DisableControlAction(0, hash, false);
13
+ }
14
+ }
@@ -1,6 +1,7 @@
1
1
  export declare class BaseEntity {
2
2
  private handle;
3
3
  constructor(entHandle: number);
4
+ replaceHandle(newHandle: number): void;
4
5
  get Handle(): number;
5
6
  set Health(amount: number);
6
7
  get Health(): number;
@@ -3,6 +3,27 @@ export class BaseEntity {
3
3
  constructor(entHandle) {
4
4
  this.handle = entHandle;
5
5
  }
6
+ // Replaces the current handle for the entity used on, this hsould be used sparringly, mainly
7
+ // in situations where you're going to reuse an entity over and over and don't want to make a
8
+ // new entity every time.
9
+ //
10
+ // **WARNING**: This does no checks, if you provide it an invalid entity it will use it
11
+ //
12
+ // ```ts
13
+ // const REUSABLE_ENTITY = new Entity(entityHandle);
14
+ //
15
+ // onNet("entityHandler", (entNetId: number) => {
16
+ // // if no net entity we should ignore
17
+ // if (!NetworkDoesEntityExistWithNetworkId(entNetId)) return;
18
+ //
19
+ // // Reuse our entity so we don't have to initialize a new one
20
+ // REUSABLE_ENTITY.replaceHandle(NetworkGetEntityFromNetworkId(entNetId));
21
+ // // Do something with REUSABLE_ENTITY entity
22
+ // })
23
+ // ```
24
+ replaceHandle(newHandle) {
25
+ this.handle = newHandle;
26
+ }
6
27
  get Handle() {
7
28
  return this.handle;
8
29
  }
package/entities/Ped.d.ts CHANGED
@@ -164,4 +164,5 @@ export declare class Ped extends BaseEntity {
164
164
  * @param mult - the multiplier?
165
165
  */
166
166
  applyDamagePack(damagePack: string, damage: number, mult: number): void;
167
+ get CurrentVehicle(): Vehicle | null;
167
168
  }
package/entities/Ped.js CHANGED
@@ -331,4 +331,10 @@ export class Ped extends BaseEntity {
331
331
  applyDamagePack(damagePack, damage, mult) {
332
332
  ApplyPedDamagePack(this.Handle, damagePack, damage, mult);
333
333
  }
334
+ get CurrentVehicle() {
335
+ const veh = GetVehiclePedIsIn(this.Handle, false);
336
+ if (veh === 0)
337
+ return null;
338
+ return new Vehicle(veh);
339
+ }
334
340
  }