rock-mod 0.15.0 → 0.16.0

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.
@@ -46,5 +46,6 @@ export declare class AltVPlayer extends AltVEntity<Player> implements IPlayer {
46
46
  kick(reason?: string): void;
47
47
  playAnimation(dictionary: string, name: string, speed: number, flag: number): void;
48
48
  stopAnimation(): void;
49
+ removeFromVehicle(): void;
49
50
  }
50
51
  export {};
@@ -148,5 +148,8 @@ class AltVPlayer extends AltVEntity_1.AltVEntity {
148
148
  stopAnimation() {
149
149
  this.mpEntity.clearTasks();
150
150
  }
151
+ removeFromVehicle() {
152
+ throw new Error("Not implemented (removeFromVehicle)");
153
+ }
151
154
  }
152
155
  exports.AltVPlayer = AltVPlayer;
@@ -1,14 +1,12 @@
1
1
  import { type IWorldObjectCreateOptions, type IWorldObjectsManager } from "../worldObject";
2
2
  import { type IColshape } from "./IColshape";
3
- import { type IVector2D } from "../../../../shared/common/utils";
4
3
  import { type ICircleColshape } from "./ICircleColshape";
5
4
  import { type ICuboidColshape } from "./ICuboidColshape";
6
5
  import { type ICylinderColshape } from "./ICylinderColshape";
7
6
  import { type IRectangleColshape } from "./IRectangleColshape";
8
7
  import { type ISphereColshape } from "./ISphereColshape";
9
8
  import { type IPlayer } from "../player";
10
- export interface ICircleColshapeCreateOptions extends Omit<IWorldObjectCreateOptions, "position"> {
11
- position: IVector2D;
9
+ export interface ICircleColshapeCreateOptions extends IWorldObjectCreateOptions {
12
10
  range: number;
13
11
  }
14
12
  export interface ICuboidColshapeCreateOptions extends IWorldObjectCreateOptions {
@@ -59,4 +59,5 @@ export interface IPlayer extends IEntity {
59
59
  kick(reason?: string): void;
60
60
  playAnimation(dictionary: string, name: string, speed: number, flag: number): void;
61
61
  stopAnimation(): void;
62
+ removeFromVehicle(): void;
62
63
  }
@@ -55,4 +55,5 @@ export declare class MockPlayer extends MockEntity implements IPlayer {
55
55
  kick(): void;
56
56
  playAnimation(): void;
57
57
  stopAnimation(): void;
58
+ removeFromVehicle(): void;
58
59
  }
@@ -137,5 +137,8 @@ class MockPlayer extends MockEntity_1.MockEntity {
137
137
  stopAnimation() {
138
138
  throw new Error("Not implemented: stopAnimation");
139
139
  }
140
+ removeFromVehicle() {
141
+ throw new Error("Not implemented removeFromVehicle");
142
+ }
140
143
  }
141
144
  exports.MockPlayer = MockPlayer;
@@ -1,5 +1,7 @@
1
1
  import { type IRageWorldObjectOptions, RageWorldObject } from "../worldObject/RageWorldObject";
2
+ import { type IVector3D } from "../../../../shared";
2
3
  export interface IRageColshapeOptions extends IRageWorldObjectOptions<ColshapeMp> {
4
+ position: IVector3D;
3
5
  }
4
6
  export declare abstract class RageColshape extends RageWorldObject<ColshapeMp> {
5
7
  protected constructor(options: IRageColshapeOptions);
@@ -35,7 +35,7 @@ class RageColshapesManager extends RageWorldObjectsManager_1.RageWorldObjectsMan
35
35
  const { x, y } = position;
36
36
  const mpEntity = mp.colshapes.newCircle(x, y, range, dimension);
37
37
  mpEntity.isExists = () => mp.colshapes.exists(mpEntity);
38
- const colshape = new RageCircleColshape_1.RageCircleColshape({ mpEntity });
38
+ const colshape = new RageCircleColshape_1.RageCircleColshape({ mpEntity, position });
39
39
  this.registerBaseObject(colshape);
40
40
  return colshape;
41
41
  }
@@ -44,7 +44,7 @@ class RageColshapesManager extends RageWorldObjectsManager_1.RageWorldObjectsMan
44
44
  const { x, y, z } = position;
45
45
  const mpEntity = mp.colshapes.newCuboid(x, y, z, width, depth, height, dimension);
46
46
  mpEntity.isExists = () => mp.colshapes.exists(mpEntity);
47
- const colshape = new RageCuboidColshape_1.RageCuboidColshape({ mpEntity });
47
+ const colshape = new RageCuboidColshape_1.RageCuboidColshape({ mpEntity, position });
48
48
  this.registerBaseObject(colshape);
49
49
  return colshape;
50
50
  }
@@ -53,7 +53,7 @@ class RageColshapesManager extends RageWorldObjectsManager_1.RageWorldObjectsMan
53
53
  const { x, y, z } = position;
54
54
  const mpEntity = mp.colshapes.newTube(x, y, z, height, range, dimension);
55
55
  mpEntity.isExists = () => mp.colshapes.exists(mpEntity);
56
- const colshape = new RageCylinderColshape_1.RageCylinderColshape({ mpEntity });
56
+ const colshape = new RageCylinderColshape_1.RageCylinderColshape({ mpEntity, position });
57
57
  this.registerBaseObject(colshape);
58
58
  return colshape;
59
59
  }
@@ -62,7 +62,7 @@ class RageColshapesManager extends RageWorldObjectsManager_1.RageWorldObjectsMan
62
62
  const { x, y } = position;
63
63
  const mpEntity = mp.colshapes.newRectangle(x, y, width, height, dimension);
64
64
  mpEntity.isExists = () => mp.colshapes.exists(mpEntity);
65
- const colshape = new RageRectangleColshape_1.RageRectangleColshape({ mpEntity });
65
+ const colshape = new RageRectangleColshape_1.RageRectangleColshape({ mpEntity, position });
66
66
  this.registerBaseObject(colshape);
67
67
  return colshape;
68
68
  }
@@ -71,7 +71,7 @@ class RageColshapesManager extends RageWorldObjectsManager_1.RageWorldObjectsMan
71
71
  const { x, y, z } = position;
72
72
  const mpEntity = mp.colshapes.newSphere(x, y, z, range, dimension);
73
73
  mpEntity.isExists = () => mp.colshapes.exists(mpEntity);
74
- const colshape = new RageSphereColshape_1.RageSphereColshape({ mpEntity });
74
+ const colshape = new RageSphereColshape_1.RageSphereColshape({ mpEntity, position });
75
75
  this.registerBaseObject(colshape);
76
76
  return colshape;
77
77
  }
@@ -44,5 +44,6 @@ export declare class RagePlayer extends RageEntity<PlayerMp> implements IPlayer
44
44
  kick(reason?: string): void;
45
45
  playAnimation(dictionary: string, name: string, speed: number, flag: number): void;
46
46
  stopAnimation(): void;
47
+ removeFromVehicle(): void;
47
48
  }
48
49
  export {};
@@ -131,5 +131,8 @@ class RagePlayer extends RageEntity_1.RageEntity {
131
131
  stopAnimation() {
132
132
  return this.mpEntity.stopAnimation();
133
133
  }
134
+ removeFromVehicle() {
135
+ return this.mpEntity.removeFromVehicle();
136
+ }
134
137
  }
135
138
  exports.RagePlayer = RagePlayer;
@@ -1,9 +1,11 @@
1
1
  import { type IWorldObject } from "../../common/worldObject/IWorldObject";
2
2
  import { type IRageBaseObjectOptions, RageBaseObject } from "../baseObject/RageBaseObject";
3
- import { Vector3D } from "../../../../shared/common/utils/math/Vectors";
3
+ import { type IVector3D, Vector3D } from "../../../../shared/common/utils/math/Vectors";
4
4
  export interface IRageWorldObjectOptions<T extends EntityMp> extends IRageBaseObjectOptions<T> {
5
+ position?: IVector3D;
5
6
  }
6
7
  export declare abstract class RageWorldObject<T extends EntityMp> extends RageBaseObject<T> implements IWorldObject {
8
+ private _position?;
7
9
  get position(): Vector3D;
8
10
  get dimension(): number;
9
11
  protected constructor(options: IRageWorldObjectOptions<T>);
@@ -4,8 +4,9 @@ exports.RageWorldObject = void 0;
4
4
  const RageBaseObject_1 = require("../baseObject/RageBaseObject");
5
5
  const Vectors_1 = require("../../../../shared/common/utils/math/Vectors");
6
6
  class RageWorldObject extends RageBaseObject_1.RageBaseObject {
7
+ _position;
7
8
  get position() {
8
- const { x, y, z } = this.mpEntity.position;
9
+ const { x, y, z } = this.mpEntity.position ?? this._position;
9
10
  return new Vectors_1.Vector3D(x, y, z);
10
11
  }
11
12
  get dimension() {
@@ -13,8 +14,12 @@ class RageWorldObject extends RageBaseObject_1.RageBaseObject {
13
14
  }
14
15
  constructor(options) {
15
16
  super(options);
17
+ if (options.position)
18
+ this._position = options.position;
16
19
  }
17
20
  setPosition(value) {
21
+ if (this._position)
22
+ this._position = value;
18
23
  this.mpEntity.position = new mp.Vector3(value);
19
24
  }
20
25
  setDimension(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rock-mod",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Rock-Mod is a powerful framework designed for creating and managing mods for Grand Theft Auto (GTA) games.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",