@open-core/framework 1.0.2-beta.1 → 1.0.4-beta.1
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/README.md +2 -2
- package/dist/client/client-bootstrap.js +11 -14
- package/dist/client/client-core.d.ts +0 -17
- package/dist/client/client-core.js +0 -45
- package/dist/client/controllers/spawner.controller.d.ts +12 -0
- package/dist/client/controllers/spawner.controller.js +51 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/interfaces/appearance.interface.d.ts +19 -0
- package/dist/client/interfaces/appearance.interface.js +2 -0
- package/dist/client/services/appearance.service.d.ts +6 -0
- package/dist/client/services/appearance.service.js +89 -0
- package/dist/client/services/{world/blip.service.d.ts → blip.service.d.ts} +1 -1
- package/dist/client/services/index.d.ts +9 -4
- package/dist/client/services/index.js +9 -8
- package/dist/client/services/{world/marker.service.d.ts → marker.service.d.ts} +1 -1
- package/dist/client/services/{world/ped.service.d.ts → ped.service.d.ts} +1 -1
- package/dist/client/services/spawn.service.d.ts +73 -0
- package/dist/client/services/spawn.service.js +261 -0
- package/dist/client/services/{ui/textui.service.d.ts → textui.service.d.ts} +1 -1
- package/dist/client/services/{world/vehicle.service.d.ts → vehicle.service.d.ts} +1 -1
- package/dist/client/system/processors/export.processor.js +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -6
- package/dist/server/controllers/session.controller.d.ts +9 -0
- package/dist/server/controllers/session.controller.js +70 -0
- package/dist/server/database/adapters/oxmysql.adapter.js +1 -1
- package/dist/server/decorators/index.d.ts +1 -1
- package/dist/server/decorators/index.js +1 -1
- package/dist/server/decorators/onFiveMEvent.d.ts +6 -0
- package/dist/server/decorators/onFiveMEvent.js +14 -0
- package/dist/server/decorators/{coreEvent.d.ts → onFrameworkEvent.d.ts} +2 -2
- package/dist/server/decorators/{coreEvent.js → onFrameworkEvent.js} +3 -3
- package/dist/server/entities/player.js +1 -1
- package/dist/server/helpers/resolve-method.d.ts +5 -0
- package/dist/server/helpers/resolve-method.js +18 -0
- package/dist/server/index.js +2 -0
- package/dist/server/loaders/playerSession.loader.js +13 -4
- package/dist/server/system/metadata-server.keys.d.ts +1 -0
- package/dist/server/system/metadata-server.keys.js +1 -0
- package/dist/server/system/processors/coreEvent.processor.d.ts +1 -1
- package/dist/server/system/processors/coreEvent.processor.js +6 -3
- package/dist/server/system/processors/export.processor.d.ts +1 -1
- package/dist/server/system/processors/export.processor.js +7 -3
- package/dist/server/system/processors/fivemEvent.processor.d.ts +7 -0
- package/dist/server/system/processors/fivemEvent.processor.js +40 -0
- package/dist/server/system/processors/netEvent.processor.d.ts +1 -1
- package/dist/server/system/processors/netEvent.processor.js +7 -5
- package/dist/server/system/processors.register.js +2 -0
- package/dist/server/system/schema-generator.js +12 -6
- package/dist/server/templates/admin/admin.controller-template.d.ts +1 -1
- package/dist/server/templates/auth/auth-provider.contract.d.ts +2 -2
- package/dist/server/types/core-events.d.ts +5 -0
- package/package.json +11 -1
- package/dist/client/loaders/exports.loader.d.ts +0 -1
- package/dist/client/loaders/exports.loader.js +0 -13
- package/dist/client/services/core/index.d.ts +0 -1
- package/dist/client/services/core/index.js +0 -17
- package/dist/client/services/core/spawn.service.d.ts +0 -20
- package/dist/client/services/core/spawn.service.js +0 -143
- package/dist/client/services/streaming/index.d.ts +0 -1
- package/dist/client/services/streaming/index.js +0 -17
- package/dist/client/services/ui/index.d.ts +0 -3
- package/dist/client/services/ui/index.js +0 -19
- package/dist/client/services/world/index.d.ts +0 -4
- package/dist/client/services/world/index.js +0 -20
- /package/dist/client/services/{world/blip.service.js → blip.service.js} +0 -0
- /package/dist/client/services/{world/marker.service.js → marker.service.js} +0 -0
- /package/dist/client/services/{ui/notification.service.d.ts → notification.service.d.ts} +0 -0
- /package/dist/client/services/{ui/notification.service.js → notification.service.js} +0 -0
- /package/dist/client/services/{world/ped.service.js → ped.service.js} +0 -0
- /package/dist/client/services/{ui/progress.service.d.ts → progress.service.d.ts} +0 -0
- /package/dist/client/services/{ui/progress.service.js → progress.service.js} +0 -0
- /package/dist/client/services/{streaming/streaming.service.d.ts → streaming.service.d.ts} +0 -0
- /package/dist/client/services/{streaming/streaming.service.js → streaming.service.js} +0 -0
- /package/dist/client/services/{ui/textui.service.js → textui.service.js} +0 -0
- /package/dist/client/services/{world/vehicle.service.js → vehicle.service.js} +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# OpenCore Framework
|
|
1
|
+
# OpenCore Framework - Unstable beta ❗
|
|
2
2
|
|
|
3
3
|
> **The robust TypeScript Engine for FiveM.**
|
|
4
4
|
> Built on strong OOP principles, Layered Architecture, and Security-first design.
|
|
5
5
|
> _Stop writing scripts; start engineering gameplay._
|
|
6
6
|
|
|
7
7
|
[](https://opensource.org/licenses/MPL-2.0)
|
|
8
|
-
[](https://github.com/newcore-network/opencore)
|
|
9
9
|

|
|
10
10
|

|
|
11
11
|

|
|
@@ -5,33 +5,30 @@ const metadata_scanner_1 = require("../system/metadata.scanner");
|
|
|
5
5
|
const client_container_1 = require("./client-container");
|
|
6
6
|
const decorators_1 = require("./decorators");
|
|
7
7
|
const player_loader_1 = require("./player/player.loader");
|
|
8
|
+
const services_1 = require("./services");
|
|
8
9
|
const processors_register_1 = require("./system/processors.register");
|
|
9
10
|
const ui_bridge_1 = require("./ui-bridge");
|
|
10
11
|
// Services
|
|
11
|
-
const
|
|
12
|
-
const ui_1 = require("./services/ui");
|
|
13
|
-
const world_1 = require("./services/world");
|
|
14
|
-
const streaming_1 = require("./services/streaming");
|
|
15
|
-
const bootServices = [core_1.Spawner];
|
|
12
|
+
const bootServices = [services_1.SpawnService];
|
|
16
13
|
/**
|
|
17
14
|
* Basic setup for client, for configs, decorators, containers... etc
|
|
18
15
|
*/
|
|
19
16
|
function setSingletons() {
|
|
20
17
|
// Core services
|
|
21
|
-
client_container_1.di.registerSingleton(
|
|
18
|
+
client_container_1.di.registerSingleton(services_1.SpawnService, services_1.SpawnService);
|
|
22
19
|
// NUI
|
|
23
20
|
client_container_1.di.registerSingleton(ui_bridge_1.NuiBridge, ui_bridge_1.NuiBridge);
|
|
24
21
|
// UI services
|
|
25
|
-
client_container_1.di.registerSingleton(
|
|
26
|
-
client_container_1.di.registerSingleton(
|
|
27
|
-
client_container_1.di.registerSingleton(
|
|
22
|
+
client_container_1.di.registerSingleton(services_1.NotificationService, services_1.NotificationService);
|
|
23
|
+
client_container_1.di.registerSingleton(services_1.TextUIService, services_1.TextUIService);
|
|
24
|
+
client_container_1.di.registerSingleton(services_1.ProgressService, services_1.ProgressService);
|
|
28
25
|
// World services
|
|
29
|
-
client_container_1.di.registerSingleton(
|
|
30
|
-
client_container_1.di.registerSingleton(
|
|
31
|
-
client_container_1.di.registerSingleton(
|
|
32
|
-
client_container_1.di.registerSingleton(
|
|
26
|
+
client_container_1.di.registerSingleton(services_1.MarkerService, services_1.MarkerService);
|
|
27
|
+
client_container_1.di.registerSingleton(services_1.BlipService, services_1.BlipService);
|
|
28
|
+
client_container_1.di.registerSingleton(services_1.VehicleService, services_1.VehicleService);
|
|
29
|
+
client_container_1.di.registerSingleton(services_1.PedService, services_1.PedService);
|
|
33
30
|
// Streaming services
|
|
34
|
-
client_container_1.di.registerSingleton(
|
|
31
|
+
client_container_1.di.registerSingleton(services_1.StreamingService, services_1.StreamingService);
|
|
35
32
|
}
|
|
36
33
|
async function bootstraper() {
|
|
37
34
|
for (const Service of bootServices) {
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
import { NuiBridge } from './ui-bridge';
|
|
2
|
-
import { Spawner } from './services/core';
|
|
3
|
-
import { NotificationService, TextUIService, ProgressService } from './services/ui';
|
|
4
|
-
import { MarkerService, BlipService, VehicleService, PedService } from './services/world';
|
|
5
|
-
import { StreamingService } from './services/streaming';
|
|
6
1
|
export declare function init(): Promise<void>;
|
|
7
|
-
export declare const services: {
|
|
8
|
-
readonly spawner: Spawner;
|
|
9
|
-
readonly nui: NuiBridge<Record<string, any>, Record<string, any>>;
|
|
10
|
-
readonly notifications: NotificationService;
|
|
11
|
-
readonly textUI: TextUIService;
|
|
12
|
-
readonly progress: ProgressService;
|
|
13
|
-
readonly markers: MarkerService;
|
|
14
|
-
readonly blips: BlipService;
|
|
15
|
-
readonly vehicles: VehicleService;
|
|
16
|
-
readonly peds: PedService;
|
|
17
|
-
readonly streaming: StreamingService;
|
|
18
|
-
};
|
|
@@ -1,52 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.services = void 0;
|
|
4
3
|
exports.init = init;
|
|
5
4
|
const client_bootstrap_1 = require("./client-bootstrap");
|
|
6
|
-
const client_container_1 = require("./client-container");
|
|
7
|
-
const ui_bridge_1 = require("./ui-bridge");
|
|
8
|
-
// Services
|
|
9
|
-
const core_1 = require("./services/core");
|
|
10
|
-
const ui_1 = require("./services/ui");
|
|
11
|
-
const world_1 = require("./services/world");
|
|
12
|
-
const streaming_1 = require("./services/streaming");
|
|
13
5
|
async function init() {
|
|
14
6
|
await (0, client_bootstrap_1.initClientCore)();
|
|
15
7
|
}
|
|
16
|
-
exports.services = {
|
|
17
|
-
// Core
|
|
18
|
-
get spawner() {
|
|
19
|
-
return client_container_1.di.resolve(core_1.Spawner);
|
|
20
|
-
},
|
|
21
|
-
// NUI
|
|
22
|
-
get nui() {
|
|
23
|
-
return client_container_1.di.resolve(ui_bridge_1.NuiBridge);
|
|
24
|
-
},
|
|
25
|
-
// UI
|
|
26
|
-
get notifications() {
|
|
27
|
-
return client_container_1.di.resolve(ui_1.NotificationService);
|
|
28
|
-
},
|
|
29
|
-
get textUI() {
|
|
30
|
-
return client_container_1.di.resolve(ui_1.TextUIService);
|
|
31
|
-
},
|
|
32
|
-
get progress() {
|
|
33
|
-
return client_container_1.di.resolve(ui_1.ProgressService);
|
|
34
|
-
},
|
|
35
|
-
// World
|
|
36
|
-
get markers() {
|
|
37
|
-
return client_container_1.di.resolve(world_1.MarkerService);
|
|
38
|
-
},
|
|
39
|
-
get blips() {
|
|
40
|
-
return client_container_1.di.resolve(world_1.BlipService);
|
|
41
|
-
},
|
|
42
|
-
get vehicles() {
|
|
43
|
-
return client_container_1.di.resolve(world_1.VehicleService);
|
|
44
|
-
},
|
|
45
|
-
get peds() {
|
|
46
|
-
return client_container_1.di.resolve(world_1.PedService);
|
|
47
|
-
},
|
|
48
|
-
// Streaming
|
|
49
|
-
get streaming() {
|
|
50
|
-
return client_container_1.di.resolve(streaming_1.StreamingService);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Vector3 } from '../../utils';
|
|
2
|
+
import { SpawnService } from '../services';
|
|
3
|
+
export declare class SpawnerController {
|
|
4
|
+
private readonly spawnService;
|
|
5
|
+
constructor(spawnService: SpawnService);
|
|
6
|
+
handleSpawn(data: {
|
|
7
|
+
position: Vector3;
|
|
8
|
+
model: string;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
handleRespawn(position: Vector3, heading?: number): Promise<void>;
|
|
11
|
+
handleTeleport(position: Vector3, heading?: number): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SpawnerController = void 0;
|
|
13
|
+
const decorators_1 = require("../decorators");
|
|
14
|
+
const services_1 = require("../services");
|
|
15
|
+
let SpawnerController = class SpawnerController {
|
|
16
|
+
constructor(spawnService) {
|
|
17
|
+
this.spawnService = spawnService;
|
|
18
|
+
}
|
|
19
|
+
async handleSpawn(data) {
|
|
20
|
+
await this.spawnService.spawn(data.position, data.model);
|
|
21
|
+
}
|
|
22
|
+
async handleRespawn(position, heading = 0.0) {
|
|
23
|
+
await this.spawnService.respawn(position, heading);
|
|
24
|
+
}
|
|
25
|
+
async handleTeleport(position, heading) {
|
|
26
|
+
await this.spawnService.teleportTo(position, heading);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.SpawnerController = SpawnerController;
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, decorators_1.OnNet)('opencore:spawner:spawn'),
|
|
32
|
+
__metadata("design:type", Function),
|
|
33
|
+
__metadata("design:paramtypes", [Object]),
|
|
34
|
+
__metadata("design:returntype", Promise)
|
|
35
|
+
], SpawnerController.prototype, "handleSpawn", null);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, decorators_1.OnNet)('opencore:spawner:respawn'),
|
|
38
|
+
__metadata("design:type", Function),
|
|
39
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
40
|
+
__metadata("design:returntype", Promise)
|
|
41
|
+
], SpawnerController.prototype, "handleRespawn", null);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, decorators_1.OnNet)('opencore:spawner:teleport'),
|
|
44
|
+
__metadata("design:type", Function),
|
|
45
|
+
__metadata("design:paramtypes", [Object, Number]),
|
|
46
|
+
__metadata("design:returntype", Promise)
|
|
47
|
+
], SpawnerController.prototype, "handleTeleport", null);
|
|
48
|
+
exports.SpawnerController = SpawnerController = __decorate([
|
|
49
|
+
(0, decorators_1.Controller)(),
|
|
50
|
+
__metadata("design:paramtypes", [services_1.SpawnService])
|
|
51
|
+
], SpawnerController);
|
package/dist/client/index.d.ts
CHANGED
package/dist/client/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface PlayerAppearance {
|
|
2
|
+
components?: Record<number, {
|
|
3
|
+
drawable: number;
|
|
4
|
+
texture: number;
|
|
5
|
+
}>;
|
|
6
|
+
props?: Record<number, {
|
|
7
|
+
drawable: number;
|
|
8
|
+
texture: number;
|
|
9
|
+
}>;
|
|
10
|
+
faceFeatures?: Record<number, number>;
|
|
11
|
+
headBlend?: {
|
|
12
|
+
shapeFirst: number;
|
|
13
|
+
shapeSecond: number;
|
|
14
|
+
shapeMix: number;
|
|
15
|
+
skinFirst: number;
|
|
16
|
+
skinSecond: number;
|
|
17
|
+
skinMix: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PlayerAppearance } from '../interfaces/appearance.interface';
|
|
2
|
+
export declare class AppearanceService {
|
|
3
|
+
applyAppearance(ped: number, appearance: PlayerAppearance): Promise<void>;
|
|
4
|
+
getAppearance(ped: number): Promise<PlayerAppearance>;
|
|
5
|
+
validateAppearance(appearance: Partial<PlayerAppearance>): boolean;
|
|
6
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AppearanceService = void 0;
|
|
10
|
+
const tsyringe_1 = require("tsyringe");
|
|
11
|
+
let AppearanceService = class AppearanceService {
|
|
12
|
+
async applyAppearance(ped, appearance) {
|
|
13
|
+
if (appearance.components) {
|
|
14
|
+
for (const [componentId, data] of Object.entries(appearance.components)) {
|
|
15
|
+
SetPedComponentVariation(ped, parseInt(componentId), data.drawable, data.texture, 2);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (appearance.props) {
|
|
19
|
+
for (const [propId, data] of Object.entries(appearance.props)) {
|
|
20
|
+
if (data.drawable === -1) {
|
|
21
|
+
ClearPedProp(ped, parseInt(propId));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
SetPedPropIndex(ped, parseInt(propId), data.drawable, data.texture, true);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (appearance.faceFeatures) {
|
|
29
|
+
for (const [index, value] of Object.entries(appearance.faceFeatures)) {
|
|
30
|
+
SetPedFaceFeature(ped, parseInt(index), value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (appearance.headBlend) {
|
|
34
|
+
const { shapeFirst, shapeSecond, shapeMix, skinFirst, skinSecond, skinMix } = appearance.headBlend;
|
|
35
|
+
SetPedHeadBlendData(ped, shapeFirst, shapeSecond, 0, skinFirst, skinSecond, 0, shapeMix, skinMix, 0, false);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async getAppearance(ped) {
|
|
39
|
+
const appearance = {
|
|
40
|
+
components: {},
|
|
41
|
+
props: {},
|
|
42
|
+
faceFeatures: {},
|
|
43
|
+
};
|
|
44
|
+
// Components (0–11)
|
|
45
|
+
for (let i = 0; i <= 11; i++) {
|
|
46
|
+
const drawable = GetPedDrawableVariation(ped, i);
|
|
47
|
+
const texture = GetPedTextureVariation(ped, i);
|
|
48
|
+
if (drawable !== -1) {
|
|
49
|
+
appearance.components[i] = { drawable, texture };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Props (0–7)
|
|
53
|
+
for (let i = 0; i <= 7; i++) {
|
|
54
|
+
const drawable = GetPedPropIndex(ped, i);
|
|
55
|
+
const texture = GetPedPropTextureIndex(ped, i);
|
|
56
|
+
if (drawable !== -1) {
|
|
57
|
+
appearance.props[i] = { drawable, texture };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return appearance;
|
|
61
|
+
}
|
|
62
|
+
validateAppearance(appearance) {
|
|
63
|
+
if (!appearance)
|
|
64
|
+
return false;
|
|
65
|
+
if (appearance.components) {
|
|
66
|
+
for (const [id, data] of Object.entries(appearance.components)) {
|
|
67
|
+
const componentId = parseInt(id);
|
|
68
|
+
if (isNaN(componentId) || componentId < 0 || componentId > 11)
|
|
69
|
+
return false;
|
|
70
|
+
if (data.drawable === undefined || data.texture === undefined)
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (appearance.props) {
|
|
75
|
+
for (const [id, data] of Object.entries(appearance.props)) {
|
|
76
|
+
const propId = parseInt(id);
|
|
77
|
+
if (isNaN(propId) || propId < 0 || propId > 7)
|
|
78
|
+
return false;
|
|
79
|
+
if (data.drawable === undefined || data.texture === undefined)
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.AppearanceService = AppearanceService;
|
|
87
|
+
exports.AppearanceService = AppearanceService = __decorate([
|
|
88
|
+
(0, tsyringe_1.injectable)()
|
|
89
|
+
], AppearanceService);
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
1
|
+
export * from './spawn.service';
|
|
2
|
+
export * from './blip.service';
|
|
3
|
+
export * from './vehicle.service';
|
|
4
|
+
export * from './ped.service';
|
|
5
|
+
export * from './streaming.service';
|
|
6
|
+
export * from './notification.service';
|
|
7
|
+
export * from './progress.service';
|
|
8
|
+
export * from './marker.service';
|
|
9
|
+
export * from './textui.service';
|
|
@@ -14,11 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
|
|
24
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./spawn.service"), exports);
|
|
18
|
+
__exportStar(require("./blip.service"), exports);
|
|
19
|
+
__exportStar(require("./vehicle.service"), exports);
|
|
20
|
+
__exportStar(require("./ped.service"), exports);
|
|
21
|
+
__exportStar(require("./streaming.service"), exports);
|
|
22
|
+
__exportStar(require("./notification.service"), exports);
|
|
23
|
+
__exportStar(require("./progress.service"), exports);
|
|
24
|
+
__exportStar(require("./marker.service"), exports);
|
|
25
|
+
__exportStar(require("./textui.service"), exports);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Vector3 } from '../../utils';
|
|
2
|
+
import { AppearanceService } from './appearance.service';
|
|
3
|
+
import { PlayerAppearance } from '../interfaces/appearance.interface';
|
|
4
|
+
interface SpawnOptions {
|
|
5
|
+
/** Optional: Apply complete character appearance (RP clothing, face, props, tattoos...) */
|
|
6
|
+
appearance?: PlayerAppearance;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Handles all player spawning logic on the client.
|
|
10
|
+
*
|
|
11
|
+
* This service manages the complete lifecycle of a player spawn:
|
|
12
|
+
* - Waiting for the network session
|
|
13
|
+
* - Loading and applying the player model
|
|
14
|
+
* - Ensuring collision and world data is ready
|
|
15
|
+
* - Resurrecting the player cleanly
|
|
16
|
+
* - Applying default ped components for freemode models
|
|
17
|
+
* - Fading the screen in/out during transitions
|
|
18
|
+
*
|
|
19
|
+
* The service is designed to be robust, predictable, and safe for any gamemode.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SpawnService {
|
|
22
|
+
private appearanceService;
|
|
23
|
+
private spawned;
|
|
24
|
+
private spawning;
|
|
25
|
+
constructor(appearanceService: AppearanceService);
|
|
26
|
+
init(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Performs the first spawn of the player.
|
|
29
|
+
*
|
|
30
|
+
* This method handles:
|
|
31
|
+
* - Fade out
|
|
32
|
+
* - Closing loading screens
|
|
33
|
+
* - Setting the player model
|
|
34
|
+
* - Ensuring the ped exists
|
|
35
|
+
* - Ensuring collision is loaded
|
|
36
|
+
* - Resurrecting the player
|
|
37
|
+
* - Preparing the ped for gameplay
|
|
38
|
+
* - Placing the player at the desired position
|
|
39
|
+
* - Fade in
|
|
40
|
+
*
|
|
41
|
+
* It should only be called once when the player joins.
|
|
42
|
+
*/
|
|
43
|
+
spawn(position: Vector3, model: string, heading?: number, options?: SpawnOptions): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Teleports the player instantly to a new position.
|
|
46
|
+
* Does not change the model or resurrect the player.
|
|
47
|
+
* Safe for gameplay use.
|
|
48
|
+
*/
|
|
49
|
+
teleportTo(position: Vector3, heading?: number): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Respawns the player after death or a gameplay event.
|
|
52
|
+
* Restores health, resurrects the player, loads collision,
|
|
53
|
+
* prepares the ped and teleports them to the desired location.
|
|
54
|
+
*/
|
|
55
|
+
respawn(position: Vector3, heading?: number): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Returns whether the player has completed their first spawn.
|
|
58
|
+
*/
|
|
59
|
+
isSpawned(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Allows other systems to wait until the player is fully spawned.
|
|
62
|
+
*/
|
|
63
|
+
waitUntilSpawned(): Promise<void>;
|
|
64
|
+
private ensureNetworkReady;
|
|
65
|
+
private closeLoadingScreens;
|
|
66
|
+
private setPlayerModel;
|
|
67
|
+
private ensurePed;
|
|
68
|
+
private ensureCollisionAt;
|
|
69
|
+
private setupPedForGameplay;
|
|
70
|
+
private placePed;
|
|
71
|
+
private applyAppearanceIfNeeded;
|
|
72
|
+
}
|
|
73
|
+
export {};
|