@nativewrappers/common-game 0.0.120 → 0.0.121

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.
@@ -3,6 +3,8 @@ export declare class GlobalData {
3
3
  static GameName: string;
4
4
  static GameBuild: number;
5
5
  static IS_SERVER: boolean;
6
+ static IS_REDM: boolean;
7
+ static IS_FIVEM: boolean;
6
8
  static IS_CLIENT: boolean;
7
9
  static NetworkTick: number | null;
8
10
  static NetworkedTicks: any[];
@@ -8,6 +8,8 @@ class GlobalData {
8
8
  static GameName = GetGameName();
9
9
  static GameBuild = GetGameBuildNumber();
10
10
  static IS_SERVER = IsDuplicityVersion();
11
+ static IS_REDM = GetGameName() === "redm";
12
+ static IS_FIVEM = GetGameName() === "fivem";
11
13
  static IS_CLIENT = !GlobalData.IS_SERVER;
12
14
  static NetworkTick = null;
13
15
  static NetworkedTicks = [];
@@ -4,6 +4,7 @@ import { Vector3 } from "../common/utils/Vector";
4
4
  import type { CommonBaseEntityBoneCollection } from "./CommonBaseEntityBoneCollection";
5
5
  import type { StateBagChangeHandler } from "../cfx/StateBagChangeHandler";
6
6
  import { CommonModel } from "../CommonModel";
7
+ import type { CommonBaseEntityBone } from "./CommonBaseEntityBone";
7
8
  export declare abstract class CommonBaseEntity {
8
9
  protected handle: number;
9
10
  protected stateBagCookies: number[];
@@ -63,4 +64,5 @@ export declare abstract class CommonBaseEntity {
63
64
  set Velocity(velocity: Vector3);
64
65
  exists(): boolean;
65
66
  delete(): void;
67
+ attachToBone(entityBone: CommonBaseEntityBone, position: Vector3, rotation: Vector3, collisions?: boolean, unk9?: boolean, useSoftPinning?: boolean, rotationOrder?: number): void;
66
68
  }
@@ -173,6 +173,41 @@ class CommonBaseEntity {
173
173
  RemoveStateBagChangeHandler(cookie);
174
174
  }
175
175
  }
176
+ /*
177
+ * Attaches an entity to another entity via a bone
178
+ * @example
179
+ * ```typescript
180
+ * const ply = Game.PlayerPed;
181
+ * const bag = await World.createProp(new Model('ba_prop_battle_bag_01b'), ply.Position, true, true, true);
182
+ * bag.attachToBone(
183
+ * ply.Bones.getBone(64113),
184
+ * new Vector3(0.12, -0.25, 0.0),
185
+ * new Vector3(105.0, 50.0, 190.0)
186
+ * )
187
+ * ```
188
+ */
189
+ attachToBone(entityBone, position, rotation, collisions = false, unk9 = true, useSoftPinning = true, rotationOrder = 1) {
190
+ if (this.handle === entityBone.Owner.Handle) {
191
+ throw new Error("You cannot attach an entity to the same entity this will result in a crash!");
192
+ }
193
+ AttachEntityToEntity(
194
+ this.handle,
195
+ entityBone.Owner.Handle,
196
+ entityBone.Index,
197
+ position.x,
198
+ position.y,
199
+ position.z,
200
+ rotation.x,
201
+ rotation.y,
202
+ rotation.z,
203
+ unk9,
204
+ useSoftPinning,
205
+ collisions,
206
+ IsEntityAPed(entityBone.Owner.Handle),
207
+ rotationOrder,
208
+ true
209
+ );
210
+ }
176
211
  }
177
212
  export {
178
213
  CommonBaseEntity
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.120",
11
+ "version": "0.0.121",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"