@nativewrappers/fivem 0.0.12 → 0.0.14

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/client/Tasks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AnimationFlags, DrivingStyle, FiringPattern, LeaveVehicleFlags, VehicleSeat } from './enums';
2
- import { Entity, Ped, Vehicle } from './models';
2
+ import { Ped, Vehicle } from './models';
3
3
  import { BaseEntity } from './models/BaseEntity';
4
4
  import { TaskSequence } from './TaskSequence';
5
5
  import { Vector3 } from './utils';
@@ -32,7 +32,7 @@ export declare class Tasks {
32
32
  guardCurrentPosition(): void;
33
33
  handsUp(duration: number): void;
34
34
  landPlane(startPosition: Vector3, touchdownPosition: Vector3, plane?: Vehicle | null): void;
35
- lookAt(targetOrPosition: Entity | Vector3, duration?: number): void;
35
+ lookAt(targetOrPosition: BaseEntity | Vector3, duration?: number): void;
36
36
  parachuteTo(position: Vector3): void;
37
37
  parkVehicle(vehicle: Vehicle, position: Vector3, heading: number, radius?: number, keepEngineOn?: boolean): void;
38
38
  performSequence(sequence: TaskSequence): void;
@@ -46,7 +46,7 @@ export declare class Tasks {
46
46
  standStill(duration: number): void;
47
47
  startScenario(name: string, position: Vector3, heading?: number, duration?: number, sittingScenario?: boolean, teleport?: boolean): void;
48
48
  swapWeapon(): void;
49
- turnTo(targetOrPosition: Entity | Vector3, duration?: number): void;
49
+ turnTo(targetOrPosition: BaseEntity | Vector3, duration?: number): void;
50
50
  useParachute(): void;
51
51
  useMobilePhone(duration?: number): void;
52
52
  putAwayParachute(): void;
package/client/Tasks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DrivingStyle, FiringPattern, VehicleSeat, } from './enums';
2
- import { Entity, Ped } from './models';
2
+ import { Ped } from './models';
3
3
  import { BaseEntity } from './models/BaseEntity';
4
4
  import { Vector3 } from './utils';
5
5
  import { LoadAnimDict } from './utils/Animations';
@@ -122,7 +122,7 @@ export class Tasks {
122
122
  }
123
123
  }
124
124
  lookAt(targetOrPosition, duration = -1) {
125
- if (targetOrPosition instanceof Entity)
125
+ if (targetOrPosition instanceof BaseEntity)
126
126
  TaskLookAtEntity(this.ped.Handle, targetOrPosition.Handle, duration, 0, 2);
127
127
  else
128
128
  TaskLookAtCoord(this.ped.Handle, targetOrPosition.x, targetOrPosition.y, targetOrPosition.z, duration, 0, 2);
@@ -177,7 +177,7 @@ export class Tasks {
177
177
  TaskSwapWeapon(this.ped.Handle, false);
178
178
  }
179
179
  turnTo(targetOrPosition, duration = -1) {
180
- if (targetOrPosition instanceof Entity)
180
+ if (targetOrPosition instanceof BaseEntity)
181
181
  TaskTurnPedToFaceEntity(this.ped.Handle, targetOrPosition.Handle, duration);
182
182
  else
183
183
  TaskTurnPedToFaceCoord(this.ped.Handle, targetOrPosition.x, targetOrPosition.y, targetOrPosition.z, duration);
@@ -4,16 +4,11 @@ import { ForceType } from '../enums';
4
4
  import { MaterialHash, WeaponHash } from '../hashes';
5
5
  import { Model } from '../Model';
6
6
  import { Quaternion, Vector3 } from '../utils';
7
- import { EntityBoneCollection, Ped, Prop, Vehicle } from './';
7
+ import { EntityBoneCollection } from './';
8
8
  import { EntityBone } from './EntityBone';
9
9
  import { StateBagChangeHandler } from '../cfx';
10
- import { Entity, Player } from '..';
11
10
  import { ClassTypes } from '../enums/ClassTypes';
12
11
  export declare class BaseEntity {
13
- /**
14
- * @deprecated you should use class specific fromHandle instead of this wrapper
15
- */
16
- static fromHandle(handle: number): Ped | Vehicle | Prop | null;
17
12
  static fromNetworkId(networkId: number): BaseEntity | null;
18
13
  protected handle: number;
19
14
  protected bones: EntityBoneCollection | undefined;
@@ -41,7 +36,6 @@ export declare class BaseEntity {
41
36
  listenForStateChange(keyFilter: string | null, handler: StateBagChangeHandler): number;
42
37
  removeStateListener(tgtCookie: number): void;
43
38
  get Owner(): number;
44
- isPlayerOwner(player: Player): boolean;
45
39
  get Speed(): number;
46
40
  getSpeedVector(isRelative?: boolean): Vector3;
47
41
  get ForwardVector(): Vector3;
@@ -124,10 +118,10 @@ export declare class BaseEntity {
124
118
  get Bones(): EntityBoneCollection;
125
119
  get AttachedBlip(): Blip | null;
126
120
  attachBlip(): Blip;
127
- setNoCollision(entity: Entity, toggle: boolean): void;
128
- hasClearLosToEntity(entity: Entity, traceType?: number): boolean;
129
- hasClearLosToEntityInFront(entity: Entity): boolean;
130
- hasBeenDamagedBy(entity: Entity): boolean;
121
+ setNoCollision(entity: BaseEntity, toggle: boolean): void;
122
+ hasClearLosToEntity(entity: BaseEntity, traceType?: number): boolean;
123
+ hasClearLosToEntityInFront(entity: BaseEntity): boolean;
124
+ hasBeenDamagedBy(entity: BaseEntity): boolean;
131
125
  hasBeenDamagedByWeapon(weapon: WeaponHash): boolean;
132
126
  hasBeenDamagedByAnyWeapon(): boolean;
133
127
  hasBeenDamagedByAnyMeleeWeapon(): boolean;
@@ -135,8 +129,8 @@ export declare class BaseEntity {
135
129
  isInArea(minBounds: Vector3, maxBounds: Vector3): boolean;
136
130
  isInAngledArea(origin: Vector3, edge: Vector3, angle: number): boolean;
137
131
  isInRangeOf(position: Vector3, range: number): boolean;
138
- isNearEntity(entity: Entity, bounds: Vector3): boolean;
139
- isTouching(entity: Entity): boolean;
132
+ isNearEntity(entity: BaseEntity, bounds: Vector3): boolean;
133
+ isTouching(entity: BaseEntity): boolean;
140
134
  isTouchingModel(model: Model): boolean;
141
135
  /**
142
136
  * @param offset: the amount to offset from the entity
@@ -144,12 +138,12 @@ export declare class BaseEntity {
144
138
  */
145
139
  getOffsetPosition(offset: Vector3): Vector3;
146
140
  getPositionOffset(worldCoords: Vector3): Vector3;
147
- attachTo(entity: Entity, position: Vector3, rotation: Vector3, collisions?: boolean, unk9?: boolean, useSoftPinning?: boolean, rotationOrder?: number): void;
141
+ attachTo(entity: BaseEntity, position: Vector3, rotation: Vector3, collisions?: boolean, unk9?: boolean, useSoftPinning?: boolean, rotationOrder?: number): void;
148
142
  attachToBone(entityBone: EntityBone, position: Vector3, rotation: Vector3, collisions?: boolean, unk9?: boolean, useSoftPinning?: boolean, rotationOrder?: number): void;
149
143
  detach(): void;
150
144
  isAttached(): boolean;
151
- isAttachedTo(entity: Entity): boolean;
152
- getEntityAttachedTo(): Ped | Vehicle | Prop | null;
145
+ isAttachedTo(entity: BaseEntity): boolean;
146
+ getEntityAttachedTo(): BaseEntity;
153
147
  applyForce(direction: Vector3, rotation: Vector3, forceType?: ForceType): void;
154
148
  applyForceRelative(direction: Vector3, rotation: Vector3, forceType?: ForceType): void;
155
149
  /**
@@ -1,28 +1,11 @@
1
1
  import { Blip } from '../Blip';
2
2
  import { ForceType } from '../enums';
3
- import { Game } from '../Game';
4
3
  import { Model } from '../Model';
5
4
  import { Quaternion, Vector3 } from '../utils';
6
- import { EntityBoneCollection, Ped, Prop, Vehicle } from './';
5
+ import { EntityBoneCollection } from './';
7
6
  import cfx from '../cfx';
8
- import { Entity } from '..';
9
7
  import { ClassTypes } from '../enums/ClassTypes';
10
8
  export class BaseEntity {
11
- /**
12
- * @deprecated you should use class specific fromHandle instead of this wrapper
13
- */
14
- static fromHandle(handle) {
15
- switch (GetEntityType(handle)) {
16
- case 1:
17
- return new Ped(handle);
18
- case 2:
19
- return new Vehicle(handle);
20
- case 3:
21
- return new Prop(handle);
22
- default:
23
- return null;
24
- }
25
- }
26
9
  static fromNetworkId(networkId) {
27
10
  return new BaseEntity(NetworkGetEntityFromNetworkId(networkId));
28
11
  }
@@ -97,9 +80,9 @@ export class BaseEntity {
97
80
  get Owner() {
98
81
  return NetworkGetEntityOwner(this.handle);
99
82
  }
100
- isPlayerOwner(player) {
101
- return this.Owner === player.Handle;
102
- }
83
+ // public isPlayerOwner(player: Player): boolean {
84
+ // return this.Owner === player.Handle;
85
+ // }
103
86
  get Speed() {
104
87
  return GetEntitySpeed(this.handle);
105
88
  }
@@ -418,7 +401,7 @@ export class BaseEntity {
418
401
  return IsEntityAttachedToEntity(this.handle, entity.Handle);
419
402
  }
420
403
  getEntityAttachedTo() {
421
- return Entity.fromHandle(GetEntityAttachedTo(this.handle));
404
+ return new BaseEntity(GetEntityAttachedTo(this.handle));
422
405
  }
423
406
  applyForce(direction, rotation, forceType = ForceType.MaxForceRot2) {
424
407
  ApplyForceToEntity(this.handle, Number(forceType), direction.x, direction.y, direction.z, rotation.x, rotation.y, rotation.z, 0, false, true, true, false, true);
@@ -442,12 +425,10 @@ export class BaseEntity {
442
425
  return DoesEntityExist(this.handle);
443
426
  }
444
427
  delete() {
445
- if (this.handle !== Game.PlayerPed.Handle) {
446
- this.IsMissionEntity = true;
447
- DeleteEntity(this.handle);
448
- for (const cookie of this.stateBagCookies) {
449
- RemoveStateBagChangeHandler(cookie);
450
- }
428
+ this.IsMissionEntity = true;
429
+ DeleteEntity(this.handle);
430
+ for (const cookie of this.stateBagCookies) {
431
+ RemoveStateBagChangeHandler(cookie);
451
432
  }
452
433
  }
453
434
  /**
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Remco Troost <d0p3t>",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "version": "0.0.12",
7
+ "version": "0.0.14",
8
8
  "publishConfig": {
9
9
  "directory": "lib"
10
10
  },
@@ -13,9 +13,6 @@
13
13
  "./server": "./server/index.js",
14
14
  "./client": "./client/index.js"
15
15
  },
16
- "sideEffects": [
17
- "./client/src/models/**"
18
- ],
19
16
  "repository": {
20
17
  "type": "git",
21
18
  "url": "https://github.com/nativewrappers/fivem.git"