@open-core/framework 1.0.5-beta.1 → 1.0.5
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/dist/adapters/contracts/IEngineEvents.d.ts +5 -2
- package/dist/adapters/contracts/IEngineEvents.js +7 -0
- package/dist/adapters/contracts/IExports.d.ts +2 -2
- package/dist/adapters/contracts/IPlatformContext.d.ts +43 -0
- package/dist/adapters/contracts/IPlatformContext.js +8 -0
- package/dist/adapters/contracts/client/IClientLocalPlayerBridge.d.ts +25 -0
- package/dist/adapters/contracts/client/IClientLocalPlayerBridge.js +8 -0
- package/dist/adapters/contracts/client/IClientLogConsole.d.ts +13 -0
- package/dist/adapters/contracts/client/IClientLogConsole.js +2 -0
- package/dist/adapters/contracts/client/IClientPlatformBridge.d.ts +195 -0
- package/dist/adapters/contracts/client/IClientPlatformBridge.js +282 -0
- package/dist/adapters/contracts/client/IClientRuntimeBridge.d.ts +18 -0
- package/dist/adapters/contracts/client/IClientRuntimeBridge.js +14 -0
- package/dist/adapters/contracts/client/IGtaPedAppearanceBridge.d.ts +26 -0
- package/dist/adapters/contracts/client/IGtaPedAppearanceBridge.js +2 -0
- package/dist/adapters/contracts/client/camera/IClientCameraPort.d.ts +107 -0
- package/dist/adapters/contracts/client/camera/IClientCameraPort.js +8 -0
- package/dist/adapters/contracts/client/camera/index.d.ts +1 -0
- package/dist/adapters/contracts/client/camera/index.js +1 -0
- package/dist/adapters/contracts/client/index.d.ts +11 -0
- package/dist/adapters/contracts/client/index.js +11 -0
- package/dist/adapters/contracts/client/ped/IClientPedPort.d.ts +62 -0
- package/dist/adapters/contracts/client/ped/IClientPedPort.js +5 -0
- package/dist/adapters/contracts/client/ped/index.d.ts +1 -0
- package/dist/adapters/contracts/client/ped/index.js +1 -0
- package/dist/adapters/contracts/client/progress/IClientProgressPort.d.ts +53 -0
- package/dist/adapters/contracts/client/progress/IClientProgressPort.js +8 -0
- package/dist/adapters/contracts/client/progress/index.d.ts +1 -0
- package/dist/adapters/contracts/client/progress/index.js +1 -0
- package/dist/adapters/contracts/client/spawn/IClientSpawnBridge.d.ts +6 -0
- package/dist/adapters/contracts/client/spawn/IClientSpawnBridge.js +6 -0
- package/dist/adapters/contracts/client/spawn/IClientSpawnPort.d.ts +19 -0
- package/dist/adapters/contracts/client/spawn/IClientSpawnPort.js +2 -0
- package/dist/adapters/contracts/client/spawn/index.d.ts +4 -0
- package/dist/adapters/contracts/client/spawn/index.js +4 -0
- package/dist/adapters/contracts/client/spawn/types.d.ts +17 -0
- package/dist/adapters/contracts/client/ui/IClientBlipBridge.d.ts +25 -0
- package/dist/adapters/contracts/client/ui/IClientBlipBridge.js +2 -0
- package/dist/adapters/contracts/client/ui/IClientMarkerBridge.d.ts +31 -0
- package/dist/adapters/contracts/client/ui/IClientMarkerBridge.js +2 -0
- package/dist/adapters/contracts/client/ui/IClientNotificationBridge.d.ts +21 -0
- package/dist/adapters/contracts/client/ui/IClientNotificationBridge.js +2 -0
- package/dist/adapters/contracts/client/ui/index.d.ts +4 -0
- package/dist/adapters/contracts/client/ui/index.js +4 -0
- package/dist/adapters/contracts/client/ui/webview/IClientWebViewBridge.d.ts +14 -0
- package/dist/adapters/contracts/client/ui/webview/IClientWebViewBridge.js +2 -0
- package/dist/adapters/contracts/client/ui/webview/index.d.ts +2 -0
- package/dist/adapters/contracts/client/ui/webview/index.js +2 -0
- package/dist/adapters/contracts/client/ui/webview/types.d.ts +27 -0
- package/dist/adapters/contracts/client/ui/webview/types.js +0 -0
- package/dist/adapters/contracts/client/vehicle/IClientVehiclePort.d.ts +166 -0
- package/dist/adapters/contracts/client/vehicle/IClientVehiclePort.js +8 -0
- package/dist/adapters/contracts/client/vehicle/index.d.ts +1 -0
- package/dist/adapters/contracts/client/vehicle/index.js +1 -0
- package/dist/adapters/contracts/index.d.ts +4 -2
- package/dist/adapters/contracts/index.js +4 -3
- package/dist/adapters/contracts/runtime/index.d.ts +1 -0
- package/dist/adapters/contracts/runtime/index.js +1 -0
- package/dist/adapters/contracts/runtime/runtime-events.d.ts +9 -0
- package/dist/adapters/contracts/runtime/runtime-events.js +7 -0
- package/dist/adapters/contracts/server/IEntityServer.d.ts +4 -28
- package/dist/adapters/contracts/server/IEntityServer.js +0 -26
- package/dist/adapters/contracts/server/IPlayerServer.d.ts +7 -26
- package/dist/adapters/contracts/server/IPlayerServer.js +0 -26
- package/dist/adapters/contracts/server/index.d.ts +10 -0
- package/dist/adapters/contracts/server/index.js +10 -0
- package/dist/adapters/contracts/server/npc-lifecycle/INpcLifecycleServer.d.ts +5 -0
- package/dist/adapters/contracts/server/npc-lifecycle/INpcLifecycleServer.js +2 -0
- package/dist/adapters/contracts/server/npc-lifecycle/index.d.ts +2 -0
- package/dist/adapters/contracts/server/npc-lifecycle/index.js +2 -0
- package/dist/adapters/contracts/server/npc-lifecycle/types.d.ts +17 -0
- package/dist/adapters/contracts/server/npc-lifecycle/types.js +0 -0
- package/dist/adapters/contracts/server/player-appearance/IPlayerAppearanceLifecycleServer.d.ts +11 -0
- package/dist/adapters/contracts/server/player-appearance/IPlayerAppearanceLifecycleServer.js +2 -0
- package/dist/adapters/contracts/server/player-appearance/index.d.ts +1 -0
- package/dist/adapters/contracts/server/player-appearance/index.js +1 -0
- package/dist/adapters/contracts/server/player-lifecycle/IPlayerLifecycleServer.d.ts +6 -0
- package/dist/adapters/contracts/server/player-lifecycle/IPlayerLifecycleServer.js +2 -0
- package/dist/adapters/contracts/server/player-lifecycle/index.d.ts +2 -0
- package/dist/adapters/contracts/server/player-lifecycle/index.js +2 -0
- package/dist/adapters/contracts/server/player-lifecycle/types.d.ts +17 -0
- package/dist/adapters/contracts/server/player-lifecycle/types.js +0 -0
- package/dist/adapters/contracts/server/player-state/IPlayerStateSyncServer.d.ts +6 -0
- package/dist/adapters/contracts/server/player-state/IPlayerStateSyncServer.js +2 -0
- package/dist/adapters/contracts/server/player-state/index.d.ts +1 -0
- package/dist/adapters/contracts/server/player-state/index.js +1 -0
- package/dist/adapters/contracts/server/vehicle-lifecycle/IVehicleLifecycleServer.d.ts +5 -0
- package/dist/adapters/contracts/server/vehicle-lifecycle/IVehicleLifecycleServer.js +2 -0
- package/dist/adapters/contracts/server/vehicle-lifecycle/index.d.ts +2 -0
- package/dist/adapters/contracts/server/vehicle-lifecycle/index.js +2 -0
- package/dist/adapters/contracts/server/vehicle-lifecycle/types.d.ts +16 -0
- package/dist/adapters/contracts/server/vehicle-lifecycle/types.js +0 -0
- package/dist/adapters/contracts/transport/events.api.d.ts +3 -3
- package/dist/adapters/contracts/transport/index.d.ts +4 -0
- package/dist/adapters/contracts/transport/index.js +4 -0
- package/dist/adapters/contracts/transport/rpc.api.d.ts +3 -3
- package/dist/adapters/index.d.ts +3 -14
- package/dist/adapters/index.js +3 -20
- package/dist/adapters/node/node-capabilities.d.ts +11 -11
- package/dist/adapters/node/node-capabilities.js +15 -27
- package/dist/adapters/node/node-engine-events.d.ts +1 -1
- package/dist/adapters/node/node-engine-events.js +2 -1
- package/dist/adapters/node/node-entity-server.d.ts +2 -2
- package/dist/adapters/node/node-entity-server.js +2 -2
- package/dist/adapters/node/node-ped-appearance-client.d.ts +2 -2
- package/dist/adapters/node/node-ped-appearance-client.js +2 -2
- package/dist/adapters/node/node-platform.js +4 -4
- package/dist/adapters/node/node-player-server.d.ts +3 -2
- package/dist/adapters/node/node-player-server.js +8 -2
- package/dist/adapters/node/transport/node.events.d.ts +4 -4
- package/dist/adapters/node/transport/node.rpc.d.ts +3 -3
- package/dist/adapters/node/transport/node.rpc.js +1 -1
- package/dist/adapters/register-capabilities.d.ts +1 -1
- package/dist/adapters/register-capabilities.js +1 -3
- package/dist/adapters/register-client-capabilities.d.ts +3 -2
- package/dist/adapters/register-client-capabilities.js +16 -41
- package/dist/contracts/client.d.ts +5 -0
- package/dist/contracts/client.js +5 -0
- package/dist/contracts/server.d.ts +19 -0
- package/dist/contracts/server.js +19 -0
- package/dist/contracts.d.ts +5 -0
- package/dist/contracts.js +5 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/kernel/logger/client-log-console.d.ts +4 -0
- package/dist/kernel/logger/client-log-console.js +43 -0
- package/dist/kernel/logger/core-logger.d.ts +3 -1
- package/dist/kernel/logger/core-logger.js +4 -2
- package/dist/kernel/logger/index.d.ts +3 -1
- package/dist/kernel/logger/index.js +2 -1
- package/dist/kernel/logger/logger.types.d.ts +1 -0
- package/dist/kernel/logger/logger.types.js +35 -0
- package/dist/kernel/logger/transports/buffered.transport.js +4 -4
- package/dist/kernel/logger/transports/console.transport.js +2 -2
- package/dist/kernel/logger/transports/dev-transport.factory.js +1 -1
- package/dist/kernel/logger/transports/simple-console.transport.js +15 -10
- package/dist/kernel-public.d.ts +1 -0
- package/dist/kernel-public.js +1 -0
- package/dist/runtime/client/adapter/client-adapter.d.ts +25 -0
- package/dist/runtime/client/adapter/client-adapter.js +11 -0
- package/dist/runtime/client/adapter/index.d.ts +20 -0
- package/dist/runtime/client/adapter/index.js +20 -0
- package/dist/runtime/client/adapter/local-player-bridge.d.ts +1 -0
- package/dist/runtime/client/adapter/local-player-bridge.js +1 -0
- package/dist/runtime/client/adapter/node-blip-bridge.d.ts +9 -0
- package/dist/runtime/client/adapter/node-blip-bridge.js +34 -0
- package/dist/runtime/client/adapter/node-camera-port.d.ts +19 -0
- package/dist/runtime/client/adapter/node-camera-port.js +31 -0
- package/dist/runtime/client/adapter/node-client-adapter.d.ts +5 -0
- package/dist/runtime/client/adapter/node-client-adapter.js +64 -0
- package/dist/runtime/client/adapter/node-local-player-bridge.d.ts +11 -0
- package/dist/runtime/client/adapter/node-local-player-bridge.js +27 -0
- package/dist/runtime/client/adapter/node-log-console.d.ts +11 -0
- package/dist/runtime/client/adapter/node-log-console.js +48 -0
- package/dist/runtime/client/adapter/node-marker-bridge.d.ts +10 -0
- package/dist/runtime/client/adapter/node-marker-bridge.js +35 -0
- package/dist/runtime/client/adapter/node-notification-bridge.d.ts +5 -0
- package/dist/{adapters/fivem/fivem-hasher.js → runtime/client/adapter/node-notification-bridge.js} +7 -11
- package/dist/runtime/client/adapter/node-ped-port.d.ts +20 -0
- package/dist/runtime/client/adapter/node-ped-port.js +38 -0
- package/dist/runtime/client/adapter/node-platform-bridge.d.ts +3 -0
- package/dist/{adapters/fivem/fivem-tick.js → runtime/client/adapter/node-platform-bridge.js} +5 -10
- package/dist/runtime/client/adapter/node-progress-port.d.ts +8 -0
- package/dist/runtime/client/adapter/node-progress-port.js +27 -0
- package/dist/runtime/client/adapter/node-runtime-bridge.d.ts +22 -0
- package/dist/runtime/client/adapter/node-runtime-bridge.js +58 -0
- package/dist/runtime/client/adapter/node-spawn-bridge.d.ts +8 -0
- package/dist/runtime/client/adapter/node-spawn-bridge.js +22 -0
- package/dist/runtime/client/adapter/node-vehicle-port.d.ts +31 -0
- package/dist/runtime/client/adapter/node-vehicle-port.js +73 -0
- package/dist/runtime/client/adapter/node-webview-bridge.d.ts +16 -0
- package/dist/runtime/client/adapter/node-webview-bridge.js +45 -0
- package/dist/runtime/client/adapter/platform-bridge.d.ts +1 -0
- package/dist/runtime/client/adapter/platform-bridge.js +1 -0
- package/dist/runtime/client/adapter/registry.d.ts +9 -0
- package/dist/runtime/client/adapter/registry.js +85 -0
- package/dist/runtime/client/adapter/runtime-bridge.d.ts +1 -0
- package/dist/runtime/client/adapter/runtime-bridge.js +1 -0
- package/dist/runtime/client/api.d.ts +2 -1
- package/dist/runtime/client/api.js +2 -1
- package/dist/runtime/client/client-bootstrap.js +51 -44
- package/dist/runtime/client/client-core.d.ts +2 -0
- package/dist/runtime/client/client-core.js +9 -0
- package/dist/runtime/client/client-runtime.d.ts +3 -0
- package/dist/runtime/client/client-runtime.js +3 -0
- package/dist/runtime/client/controllers/appearance.controller.d.ts +3 -1
- package/dist/runtime/client/controllers/appearance.controller.js +17 -6
- package/dist/runtime/client/controllers/spawner.controller.js +6 -3
- package/dist/runtime/client/decorators/controller.js +2 -10
- package/dist/runtime/client/decorators/onView.d.ts +3 -3
- package/dist/runtime/client/decorators/onView.js +3 -3
- package/dist/runtime/client/index.d.ts +1 -0
- package/dist/runtime/client/index.js +1 -0
- package/dist/runtime/client/library/create-client-library.js +9 -1
- package/dist/runtime/client/services/appearance.service.d.ts +2 -2
- package/dist/runtime/client/services/appearance.service.js +7 -4
- package/dist/runtime/client/services/blip.service.d.ts +6 -93
- package/dist/runtime/client/services/blip.service.js +58 -153
- package/dist/runtime/client/services/camera-effects.registry.d.ts +3 -0
- package/dist/runtime/client/services/camera-effects.registry.js +20 -7
- package/dist/runtime/client/services/camera.d.ts +4 -106
- package/dist/runtime/client/services/camera.js +36 -98
- package/dist/runtime/client/services/cinematic.d.ts +5 -1
- package/dist/runtime/client/services/cinematic.js +45 -30
- package/dist/runtime/client/services/index.d.ts +1 -0
- package/dist/runtime/client/services/index.js +1 -0
- package/dist/runtime/client/services/marker.service.d.ts +12 -63
- package/dist/runtime/client/services/marker.service.js +62 -97
- package/dist/runtime/client/services/notification.service.d.ts +6 -57
- package/dist/runtime/client/services/notification.service.js +43 -81
- package/dist/runtime/client/services/ped.service.d.ts +6 -148
- package/dist/runtime/client/services/ped.service.js +42 -221
- package/dist/runtime/client/services/progress.service.d.ts +4 -75
- package/dist/runtime/client/services/progress.service.js +20 -178
- package/dist/runtime/client/services/session-bridge.service.d.ts +15 -0
- package/dist/runtime/client/services/session-bridge.service.js +62 -0
- package/dist/runtime/client/services/spawn.service.d.ts +4 -56
- package/dist/runtime/client/services/spawn.service.js +29 -191
- package/dist/runtime/client/services/streaming.service.d.ts +5 -126
- package/dist/runtime/client/services/streaming.service.js +72 -217
- package/dist/runtime/client/services/textui.service.d.ts +5 -45
- package/dist/runtime/client/services/textui.service.js +55 -88
- package/dist/runtime/client/services/vehicle-client.service.d.ts +12 -149
- package/dist/runtime/client/services/vehicle-client.service.js +128 -374
- package/dist/runtime/client/services/vehicle.service.d.ts +4 -147
- package/dist/runtime/client/services/vehicle.service.js +33 -239
- package/dist/runtime/client/system/processors/export.processor.d.ts +3 -0
- package/dist/runtime/client/system/processors/export.processor.js +16 -3
- package/dist/runtime/client/system/processors/gameEvent.processor.d.ts +3 -0
- package/dist/runtime/client/system/processors/gameEvent.processor.js +16 -3
- package/dist/runtime/client/system/processors/interval.processor.d.ts +3 -0
- package/dist/runtime/client/system/processors/interval.processor.js +17 -4
- package/dist/runtime/client/system/processors/key.processor.d.ts +3 -0
- package/dist/runtime/client/system/processors/key.processor.js +18 -5
- package/dist/runtime/client/system/processors/localEvent.processor.d.ts +3 -0
- package/dist/runtime/client/system/processors/localEvent.processor.js +16 -3
- package/dist/runtime/client/system/processors/netEvent.processor.d.ts +3 -0
- package/dist/runtime/client/system/processors/netEvent.processor.js +16 -3
- package/dist/runtime/client/system/processors/onRpc.processor.js +1 -1
- package/dist/runtime/client/system/processors/resourceLifecycle.processor.d.ts +5 -0
- package/dist/runtime/client/system/processors/resourceLifecycle.processor.js +26 -7
- package/dist/runtime/client/system/processors/tick.processor.d.ts +3 -0
- package/dist/runtime/client/system/processors/tick.processor.js +16 -3
- package/dist/runtime/client/system/processors/view.processor.d.ts +3 -0
- package/dist/runtime/client/system/processors/view.processor.js +21 -10
- package/dist/runtime/client/system/processors.register.d.ts +1 -0
- package/dist/runtime/client/system/processors.register.js +8 -0
- package/dist/runtime/client/ui-bridge.d.ts +2 -114
- package/dist/runtime/client/ui-bridge.js +2 -194
- package/dist/runtime/client/webview-bridge.d.ts +34 -0
- package/dist/runtime/client/webview-bridge.js +103 -0
- package/dist/runtime/client/webview.service.d.ts +15 -0
- package/dist/runtime/client/webview.service.js +103 -0
- package/dist/runtime/server/adapter/index.d.ts +5 -0
- package/dist/runtime/server/adapter/index.js +5 -0
- package/dist/runtime/server/adapter/node-npc-lifecycle-server.d.ts +12 -0
- package/dist/runtime/server/adapter/node-npc-lifecycle-server.js +52 -0
- package/dist/runtime/server/adapter/node-player-appearance-lifecycle-server.d.ts +22 -0
- package/dist/runtime/server/adapter/node-player-appearance-lifecycle-server.js +95 -0
- package/dist/runtime/server/adapter/node-player-lifecycle-server.d.ts +11 -0
- package/dist/runtime/server/adapter/node-player-lifecycle-server.js +56 -0
- package/dist/runtime/server/adapter/node-player-state-sync-server.d.ts +12 -0
- package/dist/runtime/server/adapter/node-player-state-sync-server.js +49 -0
- package/dist/runtime/server/adapter/node-server-adapter.d.ts +5 -0
- package/dist/runtime/server/adapter/node-server-adapter.js +67 -0
- package/dist/runtime/server/adapter/node-vehicle-lifecycle-server.d.ts +13 -0
- package/dist/runtime/server/adapter/node-vehicle-lifecycle-server.js +58 -0
- package/dist/runtime/server/adapter/player-adapter.d.ts +28 -0
- package/dist/runtime/server/adapter/player-adapter.js +28 -0
- package/dist/runtime/server/adapter/registry.d.ts +26 -0
- package/dist/runtime/server/adapter/registry.js +101 -0
- package/dist/runtime/server/adapter/serialization.d.ts +6 -0
- package/dist/runtime/server/adapter/serialization.js +9 -0
- package/dist/runtime/server/adapter/server-adapter.d.ts +28 -0
- package/dist/runtime/server/adapter/server-adapter.js +14 -0
- package/dist/runtime/server/api.d.ts +2 -1
- package/dist/runtime/server/api.js +2 -1
- package/dist/runtime/server/apis/appearance.api.d.ts +5 -3
- package/dist/runtime/server/apis/appearance.api.js +20 -7
- package/dist/runtime/server/apis/chat.api.js +6 -5
- package/dist/runtime/server/apis/npcs.api.d.ts +3 -4
- package/dist/runtime/server/apis/npcs.api.js +28 -57
- package/dist/runtime/server/apis/parallel-compute.api.js +1 -0
- package/dist/runtime/server/apis/vehicle-modification.api.d.ts +3 -1
- package/dist/runtime/server/apis/vehicle-modification.api.js +13 -6
- package/dist/runtime/server/apis/vehicles.api.d.ts +12 -6
- package/dist/runtime/server/apis/vehicles.api.js +55 -40
- package/dist/runtime/server/bootstrap.js +28 -19
- package/dist/runtime/server/controllers/channel.controller.js +2 -1
- package/dist/runtime/server/controllers/command-export.controller.js +5 -3
- package/dist/runtime/server/controllers/player-export.controller.js +5 -4
- package/dist/runtime/server/controllers/remote-command-execution.controller.js +2 -1
- package/dist/runtime/server/controllers/session.controller.js +3 -2
- package/dist/runtime/server/controllers/vehicle.controller.d.ts +3 -1
- package/dist/runtime/server/controllers/vehicle.controller.js +13 -7
- package/dist/runtime/server/core.d.ts +2 -0
- package/dist/runtime/server/core.js +9 -1
- package/dist/runtime/server/decorators/command.d.ts +2 -0
- package/dist/runtime/server/decorators/command.js +3 -1
- package/dist/runtime/server/decorators/onRuntimeEvent.d.ts +2 -1
- package/dist/runtime/server/entities/npc.d.ts +3 -1
- package/dist/runtime/server/entities/npc.js +3 -3
- package/dist/runtime/server/entities/player.d.ts +9 -12
- package/dist/runtime/server/entities/player.js +49 -31
- package/dist/runtime/server/entities/vehicle.js +2 -2
- package/dist/runtime/server/error-handler.js +13 -2
- package/dist/runtime/server/helpers/command-validation.helper.js +21 -8
- package/dist/runtime/server/helpers/function-helper.d.ts +1 -0
- package/dist/runtime/server/helpers/function-helper.js +15 -8
- package/dist/runtime/server/implementations/local/channel.local.d.ts +1 -1
- package/dist/runtime/server/implementations/local/channel.local.js +3 -2
- package/dist/runtime/server/implementations/local/player.local.d.ts +7 -3
- package/dist/runtime/server/implementations/local/player.local.js +23 -11
- package/dist/runtime/server/implementations/remote/channel.remote.d.ts +2 -1
- package/dist/runtime/server/implementations/remote/channel.remote.js +5 -2
- package/dist/runtime/server/implementations/remote/command.remote.d.ts +3 -1
- package/dist/runtime/server/implementations/remote/command.remote.js +9 -4
- package/dist/runtime/server/implementations/remote/player.remote.d.ts +7 -10
- package/dist/runtime/server/implementations/remote/player.remote.js +24 -29
- package/dist/runtime/server/library/create-server-library.js +17 -2
- package/dist/runtime/server/ports/channel.api-port.d.ts +1 -1
- package/dist/runtime/server/runtime.d.ts +3 -0
- package/dist/runtime/server/runtime.js +1 -15
- package/dist/runtime/server/services/appearance.service.d.ts +0 -95
- package/dist/runtime/server/services/appearance.service.js +15 -192
- package/dist/runtime/server/services/parallel/worker-pool.d.ts +1 -1
- package/dist/runtime/server/services/parallel/worker-pool.js +38 -6
- package/dist/runtime/server/services/parallel/worker.js +1 -0
- package/dist/runtime/server/services/services.register.js +56 -24
- package/dist/runtime/server/system/processors/netEvent.processor.js +1 -1
- package/dist/runtime/server/system/processors/onRpc.processor.js +1 -1
- package/dist/runtime/server/system/processors/runtimeEvent.processor.d.ts +2 -1
- package/dist/runtime/server/system/processors/runtimeEvent.processor.js +1 -1
- package/dist/runtime/server/system/schema-generator.d.ts +1 -1
- package/dist/runtime/server/system/schema-generator.js +6 -3
- package/dist/runtime/server/types/core-exports.types.d.ts +5 -0
- package/dist/runtime/shared/helpers/process-tuple-schema.d.ts +2 -0
- package/dist/runtime/shared/helpers/process-tuple-schema.js +32 -0
- package/dist/runtime/shared/types/system-types.d.ts +55 -0
- package/dist/runtime/shared/types/system-types.js +54 -0
- package/package.json +41 -13
- package/dist/adapters/cfx/cfx-capabilities.d.ts +0 -16
- package/dist/adapters/cfx/cfx-capabilities.js +0 -70
- package/dist/adapters/cfx/cfx-platform.d.ts +0 -2
- package/dist/adapters/cfx/cfx-platform.js +0 -85
- package/dist/adapters/cfx/index.d.ts +0 -3
- package/dist/adapters/cfx/index.js +0 -3
- package/dist/adapters/cfx/runtime-profile.d.ts +0 -3
- package/dist/adapters/cfx/runtime-profile.js +0 -37
- package/dist/adapters/contracts/IPlatformCapabilities.d.ts +0 -79
- package/dist/adapters/contracts/IPlatformCapabilities.js +0 -27
- package/dist/adapters/contracts/client/IPedAppearanceClient.d.ts +0 -206
- package/dist/adapters/contracts/client/IPedAppearanceClient.js +0 -12
- package/dist/adapters/fivem/fivem-capabilities.d.ts +0 -18
- package/dist/adapters/fivem/fivem-capabilities.js +0 -61
- package/dist/adapters/fivem/fivem-engine-events.d.ts +0 -5
- package/dist/adapters/fivem/fivem-engine-events.js +0 -24
- package/dist/adapters/fivem/fivem-entity-server.d.ts +0 -26
- package/dist/adapters/fivem/fivem-entity-server.js +0 -87
- package/dist/adapters/fivem/fivem-exports.d.ts +0 -5
- package/dist/adapters/fivem/fivem-exports.js +0 -9
- package/dist/adapters/fivem/fivem-hasher.d.ts +0 -7
- package/dist/adapters/fivem/fivem-net-transport.d.ts +0 -1
- package/dist/adapters/fivem/fivem-ped-appearance-client.d.ts +0 -34
- package/dist/adapters/fivem/fivem-ped-appearance-client.js +0 -79
- package/dist/adapters/fivem/fivem-ped-appearance-server.d.ts +0 -14
- package/dist/adapters/fivem/fivem-ped-appearance-server.js +0 -22
- package/dist/adapters/fivem/fivem-ped-server.d.ts +0 -9
- package/dist/adapters/fivem/fivem-ped-server.js +0 -30
- package/dist/adapters/fivem/fivem-platform.d.ts +0 -5
- package/dist/adapters/fivem/fivem-platform.js +0 -74
- package/dist/adapters/fivem/fivem-player-server.d.ts +0 -24
- package/dist/adapters/fivem/fivem-player-server.js +0 -83
- package/dist/adapters/fivem/fivem-playerinfo.d.ts +0 -6
- package/dist/adapters/fivem/fivem-playerinfo.js +0 -10
- package/dist/adapters/fivem/fivem-resourceinfo.d.ts +0 -5
- package/dist/adapters/fivem/fivem-resourceinfo.js +0 -24
- package/dist/adapters/fivem/fivem-tick.d.ts +0 -7
- package/dist/adapters/fivem/fivem-vehicle-server.d.ts +0 -15
- package/dist/adapters/fivem/fivem-vehicle-server.js +0 -44
- package/dist/adapters/fivem/index.d.ts +0 -14
- package/dist/adapters/fivem/index.js +0 -16
- package/dist/adapters/fivem/transport/adapter.d.ts +0 -8
- package/dist/adapters/fivem/transport/adapter.js +0 -8
- package/dist/adapters/fivem/transport/fivem.events.d.ts +0 -8
- package/dist/adapters/fivem/transport/fivem.events.js +0 -36
- package/dist/adapters/fivem/transport/fivem.rpc.d.ts +0 -28
- package/dist/adapters/fivem/transport/fivem.rpc.js +0 -183
- package/dist/runtime/client/controllers/player-sync.controller.d.ts +0 -11
- package/dist/runtime/client/controllers/player-sync.controller.js +0 -51
- package/dist/runtime/client/player/player.d.ts +0 -262
- package/dist/runtime/client/player/player.js +0 -474
- package/dist/runtime/client/player/player.loader.d.ts +0 -1
- package/dist/runtime/client/player/player.loader.js +0 -18
- package/dist/runtime/server/helpers/process-tuple-schema.d.ts +0 -20
- package/dist/runtime/server/helpers/process-tuple-schema.js +0 -56
- /package/dist/adapters/{fivem/fivem-net-transport.js → contracts/client/spawn/types.js} +0 -0
|
@@ -4,105 +4,67 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
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;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from 'tsyringe';
|
|
14
|
+
import { IClientNotificationBridge, } from '../../../adapters/contracts/client/ui/IClientNotificationBridge';
|
|
15
|
+
import { IClientLocalPlayerBridge } from '../adapter/local-player-bridge';
|
|
11
16
|
let NotificationService = class NotificationService {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
notifications;
|
|
18
|
+
localPlayer;
|
|
19
|
+
constructor(notifications, localPlayer) {
|
|
20
|
+
this.notifications = notifications;
|
|
21
|
+
this.localPlayer = localPlayer;
|
|
22
|
+
}
|
|
18
23
|
show(message, blink = false) {
|
|
19
|
-
|
|
20
|
-
AddTextComponentString(message);
|
|
21
|
-
DrawNotification(blink, true);
|
|
24
|
+
this.notifications.show({ kind: 'feed', message, blink, saveToBrief: true });
|
|
22
25
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Show a notification with a type indicator using throbber icons.
|
|
25
|
-
*
|
|
26
|
-
* @param message - The message to display
|
|
27
|
-
* @param type - The notification type
|
|
28
|
-
*/
|
|
29
26
|
showWithType(message, type = 'info') {
|
|
30
|
-
|
|
31
|
-
info: 1,
|
|
32
|
-
success: 2,
|
|
33
|
-
warning: 3,
|
|
34
|
-
error: 4,
|
|
35
|
-
};
|
|
36
|
-
BeginTextCommandThefeedPost('STRING');
|
|
37
|
-
AddTextComponentString(message);
|
|
38
|
-
EndTextCommandThefeedPostMessagetext('CHAR_SOCIAL_CLUB', 'CHAR_SOCIAL_CLUB', true, iconMap[type], '', message);
|
|
27
|
+
this.notifications.show({ kind: 'typed', message, type });
|
|
39
28
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Show an advanced notification with picture/icon.
|
|
42
|
-
*
|
|
43
|
-
* @param options - Advanced notification options
|
|
44
|
-
*/
|
|
45
29
|
showAdvanced(options) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
this.notifications.show({
|
|
31
|
+
kind: 'advanced',
|
|
32
|
+
title: options.title,
|
|
33
|
+
subtitle: options.subtitle,
|
|
34
|
+
message: options.message,
|
|
35
|
+
flash: options.flash,
|
|
36
|
+
saveToBrief: options.saveToBrief,
|
|
37
|
+
backgroundColor: options.backgroundColor,
|
|
38
|
+
});
|
|
54
39
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Show a help notification (appears at top-left).
|
|
57
|
-
*
|
|
58
|
-
* @param message - The help message
|
|
59
|
-
* @param duration - How long to show in milliseconds (-1 for indefinite)
|
|
60
|
-
* @param beep - Play a beep sound
|
|
61
|
-
* @param looped - Keep showing until cleared
|
|
62
|
-
*/
|
|
63
40
|
showHelp(message, duration = 5000, beep = true, looped = false) {
|
|
64
|
-
|
|
65
|
-
AddTextComponentSubstringPlayerName(message);
|
|
66
|
-
EndTextCommandDisplayHelp(0, looped, beep, duration);
|
|
41
|
+
this.notifications.show({ kind: 'help', message, duration, beep, looped });
|
|
67
42
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Clear all help messages.
|
|
70
|
-
*/
|
|
71
43
|
clearHelp() {
|
|
72
|
-
|
|
44
|
+
this.notifications.clear('help');
|
|
73
45
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Show a subtitle (centered at bottom of screen).
|
|
76
|
-
*
|
|
77
|
-
* @param message - The subtitle text
|
|
78
|
-
* @param duration - Duration in milliseconds
|
|
79
|
-
*/
|
|
80
46
|
showSubtitle(message, duration = 2500) {
|
|
81
|
-
|
|
82
|
-
AddTextComponentSubstringPlayerName(message);
|
|
83
|
-
EndTextCommandPrint(duration, true);
|
|
47
|
+
this.notifications.show({ kind: 'subtitle', message, duration });
|
|
84
48
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Clear the current subtitle.
|
|
87
|
-
*/
|
|
88
49
|
clearSubtitle() {
|
|
89
|
-
|
|
50
|
+
this.notifications.clear('subtitle');
|
|
90
51
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Show a floating help text above the player's head.
|
|
93
|
-
*
|
|
94
|
-
* @param message - The message to display
|
|
95
|
-
*/
|
|
96
52
|
showFloatingHelp(message) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
53
|
+
this.notifications.show({
|
|
54
|
+
kind: 'floating',
|
|
55
|
+
message,
|
|
56
|
+
worldPosition: this.localPlayer.getPosition(),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
showRaw(definition) {
|
|
60
|
+
this.notifications.show(definition);
|
|
103
61
|
}
|
|
104
62
|
};
|
|
105
63
|
NotificationService = __decorate([
|
|
106
|
-
injectable()
|
|
64
|
+
injectable(),
|
|
65
|
+
__param(0, inject(IClientNotificationBridge)),
|
|
66
|
+
__param(1, inject(IClientLocalPlayerBridge)),
|
|
67
|
+
__metadata("design:paramtypes", [IClientNotificationBridge,
|
|
68
|
+
IClientLocalPlayerBridge])
|
|
107
69
|
], NotificationService);
|
|
108
70
|
export { NotificationService };
|
|
@@ -1,182 +1,40 @@
|
|
|
1
1
|
import { Vector3 } from '../../../kernel/utils/vector3';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** Spawn position */
|
|
6
|
-
position: Vector3;
|
|
7
|
-
/** Heading/rotation */
|
|
8
|
-
heading?: number;
|
|
9
|
-
/** Network the ped */
|
|
10
|
-
networked?: boolean;
|
|
11
|
-
/** Make the ped a mission entity */
|
|
12
|
-
missionEntity?: boolean;
|
|
13
|
-
/** Relationship group */
|
|
14
|
-
relationshipGroup?: string;
|
|
15
|
-
/** Whether to block non-temporary events */
|
|
16
|
-
blockEvents?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface PedAnimationOptions {
|
|
19
|
-
/** Animation dictionary */
|
|
20
|
-
dict: string;
|
|
21
|
-
/** Animation name */
|
|
22
|
-
anim: string;
|
|
23
|
-
/** Blend in speed */
|
|
24
|
-
blendInSpeed?: number;
|
|
25
|
-
/** Blend out speed */
|
|
26
|
-
blendOutSpeed?: number;
|
|
27
|
-
/** Duration (-1 for looped) */
|
|
28
|
-
duration?: number;
|
|
29
|
-
/** Animation flags */
|
|
30
|
-
flags?: number;
|
|
31
|
-
/** Playback rate */
|
|
32
|
-
playbackRate?: number;
|
|
33
|
-
}
|
|
2
|
+
import { type ClientPedAnimationOptions as PedAnimationOptions, type ClientPedSpawnOptions as PedSpawnOptions, IClientPedPort } from '../../../adapters/contracts/client/ped/IClientPedPort';
|
|
3
|
+
import { IClientLocalPlayerBridge } from '../adapter/local-player-bridge';
|
|
4
|
+
export type { PedSpawnOptions, PedAnimationOptions };
|
|
34
5
|
export interface ManagedPed {
|
|
35
6
|
id: string;
|
|
36
7
|
handle: number;
|
|
37
8
|
model: string;
|
|
38
9
|
position: Vector3;
|
|
39
10
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Service for ped (NPC) operations and management.
|
|
42
|
-
*/
|
|
43
11
|
export declare class PedService {
|
|
12
|
+
private readonly pedsPort;
|
|
13
|
+
private readonly localPlayer;
|
|
44
14
|
private peds;
|
|
45
15
|
private idCounter;
|
|
46
|
-
|
|
47
|
-
* Spawn a ped at a position.
|
|
48
|
-
*
|
|
49
|
-
* @param options - Spawn options
|
|
50
|
-
* @returns The ped ID and handle
|
|
51
|
-
*/
|
|
16
|
+
constructor(pedsPort: IClientPedPort, localPlayer: IClientLocalPlayerBridge);
|
|
52
17
|
spawn(options: PedSpawnOptions): Promise<{
|
|
53
18
|
id: string;
|
|
54
19
|
handle: number;
|
|
55
20
|
}>;
|
|
56
|
-
/**
|
|
57
|
-
* Delete a ped by ID.
|
|
58
|
-
*
|
|
59
|
-
* @param id - The ped ID
|
|
60
|
-
*/
|
|
61
21
|
delete(id: string): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Delete a ped by handle.
|
|
64
|
-
*
|
|
65
|
-
* @param handle - The ped handle
|
|
66
|
-
*/
|
|
67
22
|
deleteByHandle(handle: number): void;
|
|
68
|
-
/**
|
|
69
|
-
* Delete all managed peds.
|
|
70
|
-
*/
|
|
71
23
|
deleteAll(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Play an animation on a ped.
|
|
74
|
-
*
|
|
75
|
-
* @param handle - Ped handle
|
|
76
|
-
* @param options - Animation options
|
|
77
|
-
*/
|
|
78
24
|
playAnimation(handle: number, options: PedAnimationOptions): Promise<void>;
|
|
79
|
-
/**
|
|
80
|
-
* Stop all animations on a ped.
|
|
81
|
-
*
|
|
82
|
-
* @param handle - Ped handle
|
|
83
|
-
*/
|
|
84
25
|
stopAnimation(handle: number): void;
|
|
85
|
-
/**
|
|
86
|
-
* Stop animation immediately on a ped.
|
|
87
|
-
*
|
|
88
|
-
* @param handle - Ped handle
|
|
89
|
-
*/
|
|
90
26
|
stopAnimationImmediately(handle: number): void;
|
|
91
|
-
/**
|
|
92
|
-
* Freeze a ped in place.
|
|
93
|
-
*
|
|
94
|
-
* @param handle - Ped handle
|
|
95
|
-
* @param freeze - Whether to freeze
|
|
96
|
-
*/
|
|
97
27
|
freeze(handle: number, freeze: boolean): void;
|
|
98
|
-
/**
|
|
99
|
-
* Set ped invincibility.
|
|
100
|
-
*
|
|
101
|
-
* @param handle - Ped handle
|
|
102
|
-
* @param invincible - Whether invincible
|
|
103
|
-
*/
|
|
104
28
|
setInvincible(handle: number, invincible: boolean): void;
|
|
105
|
-
/**
|
|
106
|
-
* Give a weapon to a ped.
|
|
107
|
-
*
|
|
108
|
-
* @param handle - Ped handle
|
|
109
|
-
* @param weapon - Weapon name/hash
|
|
110
|
-
* @param ammo - Ammo count
|
|
111
|
-
* @param hidden - Whether to hide the weapon
|
|
112
|
-
* @param forceInHand - Whether to force weapon in hand
|
|
113
|
-
*/
|
|
114
29
|
giveWeapon(handle: number, weapon: string, ammo?: number, hidden?: boolean, forceInHand?: boolean): void;
|
|
115
|
-
/**
|
|
116
|
-
* Remove all weapons from a ped.
|
|
117
|
-
*
|
|
118
|
-
* @param handle - Ped handle
|
|
119
|
-
*/
|
|
120
30
|
removeAllWeapons(handle: number): void;
|
|
121
|
-
/**
|
|
122
|
-
* Get the closest ped to the player.
|
|
123
|
-
*
|
|
124
|
-
* @param radius - Search radius
|
|
125
|
-
* @param excludePlayer - Exclude the player ped
|
|
126
|
-
* @returns Ped handle or null
|
|
127
|
-
*/
|
|
128
31
|
getClosest(radius?: number, excludePlayer?: boolean): number | null;
|
|
129
|
-
/**
|
|
130
|
-
* Get all peds in a radius.
|
|
131
|
-
*
|
|
132
|
-
* @param position - Center position
|
|
133
|
-
* @param radius - Search radius
|
|
134
|
-
* @param excludePlayer - Exclude the player ped
|
|
135
|
-
* @returns Array of ped handles
|
|
136
|
-
*/
|
|
137
32
|
getNearby(position: Vector3, radius: number, excludePlayer?: boolean): number[];
|
|
138
|
-
/**
|
|
139
|
-
* Make ped look at entity.
|
|
140
|
-
*
|
|
141
|
-
* @param handle - Ped handle
|
|
142
|
-
* @param entity - Entity to look at
|
|
143
|
-
* @param duration - Duration in ms (-1 for infinite)
|
|
144
|
-
*/
|
|
145
33
|
lookAtEntity(handle: number, entity: number, duration?: number): void;
|
|
146
|
-
/**
|
|
147
|
-
* Make ped look at position.
|
|
148
|
-
*
|
|
149
|
-
* @param handle - Ped handle
|
|
150
|
-
* @param position - Position to look at
|
|
151
|
-
* @param duration - Duration in ms (-1 for infinite)
|
|
152
|
-
*/
|
|
153
34
|
lookAtCoords(handle: number, position: Vector3, duration?: number): void;
|
|
154
|
-
/**
|
|
155
|
-
* Make ped walk to position.
|
|
156
|
-
*
|
|
157
|
-
* @param handle - Ped handle
|
|
158
|
-
* @param position - Target position
|
|
159
|
-
* @param speed - Walking speed (1.0 = walk, 2.0 = run)
|
|
160
|
-
*/
|
|
161
35
|
walkTo(handle: number, position: Vector3, speed?: number): void;
|
|
162
|
-
/**
|
|
163
|
-
* Set ped combat attributes.
|
|
164
|
-
*
|
|
165
|
-
* @param handle - Ped handle
|
|
166
|
-
* @param canFight - Whether the ped can fight
|
|
167
|
-
* @param canUseCover - Whether the ped can use cover
|
|
168
|
-
*/
|
|
169
36
|
setCombatAttributes(handle: number, canFight: boolean, canUseCover?: boolean): void;
|
|
170
|
-
/**
|
|
171
|
-
* Get a managed ped by ID.
|
|
172
|
-
*/
|
|
173
37
|
get(id: string): ManagedPed | undefined;
|
|
174
|
-
/**
|
|
175
|
-
* Get all managed peds.
|
|
176
|
-
*/
|
|
177
38
|
getAll(): ManagedPed[];
|
|
178
|
-
/**
|
|
179
|
-
* Check if a managed ped still exists.
|
|
180
|
-
*/
|
|
181
39
|
exists(id: string): boolean;
|
|
182
40
|
}
|
|
@@ -4,77 +4,42 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
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;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from 'tsyringe';
|
|
14
|
+
import { IClientPedPort, } from '../../../adapters/contracts/client/ped/IClientPedPort';
|
|
15
|
+
import { IClientLocalPlayerBridge } from '../adapter/local-player-bridge';
|
|
11
16
|
let PedService = class PedService {
|
|
17
|
+
pedsPort;
|
|
18
|
+
localPlayer;
|
|
12
19
|
peds = new Map();
|
|
13
20
|
idCounter = 0;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @returns The ped ID and handle
|
|
19
|
-
*/
|
|
21
|
+
constructor(pedsPort, localPlayer) {
|
|
22
|
+
this.pedsPort = pedsPort;
|
|
23
|
+
this.localPlayer = localPlayer;
|
|
24
|
+
}
|
|
20
25
|
async spawn(options) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
// Load the model
|
|
24
|
-
if (!IsModelInCdimage(modelHash) || !IsModelValid(modelHash)) {
|
|
25
|
-
throw new Error(`Invalid ped model: ${model}`);
|
|
26
|
-
}
|
|
27
|
-
RequestModel(modelHash);
|
|
28
|
-
while (!HasModelLoaded(modelHash)) {
|
|
29
|
-
await new Promise((r) => setTimeout(r, 0));
|
|
30
|
-
}
|
|
31
|
-
// Create the ped
|
|
32
|
-
const ped = CreatePed(4, modelHash, position.x, position.y, position.z, heading, networked, true);
|
|
33
|
-
SetModelAsNoLongerNeeded(modelHash);
|
|
34
|
-
if (!ped || ped === 0) {
|
|
26
|
+
const ped = await this.pedsPort.spawn(options);
|
|
27
|
+
if (!ped || ped === 0)
|
|
35
28
|
throw new Error('Failed to create ped');
|
|
36
|
-
}
|
|
37
|
-
// Configure the ped
|
|
38
|
-
if (missionEntity) {
|
|
39
|
-
SetEntityAsMissionEntity(ped, true, true);
|
|
40
|
-
}
|
|
41
|
-
if (blockEvents) {
|
|
42
|
-
SetBlockingOfNonTemporaryEvents(ped, true);
|
|
43
|
-
}
|
|
44
|
-
// Set default relationship (neutral)
|
|
45
|
-
SetPedRelationshipGroupHash(ped, GetHashKey('CIVMALE'));
|
|
46
|
-
// Register in our map
|
|
47
29
|
const id = `ped_${++this.idCounter}`;
|
|
48
|
-
this.peds.set(id, { id, handle: ped, model, position });
|
|
30
|
+
this.peds.set(id, { id, handle: ped, model: options.model, position: options.position });
|
|
49
31
|
return { id, handle: ped };
|
|
50
32
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Delete a ped by ID.
|
|
53
|
-
*
|
|
54
|
-
* @param id - The ped ID
|
|
55
|
-
*/
|
|
56
33
|
delete(id) {
|
|
57
34
|
const ped = this.peds.get(id);
|
|
58
35
|
if (!ped)
|
|
59
36
|
return false;
|
|
60
|
-
|
|
61
|
-
SetEntityAsMissionEntity(ped.handle, true, true);
|
|
62
|
-
DeletePed(ped.handle);
|
|
63
|
-
}
|
|
37
|
+
this.pedsPort.delete(ped.handle);
|
|
64
38
|
this.peds.delete(id);
|
|
65
39
|
return true;
|
|
66
40
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Delete a ped by handle.
|
|
69
|
-
*
|
|
70
|
-
* @param handle - The ped handle
|
|
71
|
-
*/
|
|
72
41
|
deleteByHandle(handle) {
|
|
73
|
-
|
|
74
|
-
SetEntityAsMissionEntity(handle, true, true);
|
|
75
|
-
DeletePed(handle);
|
|
76
|
-
}
|
|
77
|
-
// Remove from our map if tracked
|
|
42
|
+
this.pedsPort.delete(handle);
|
|
78
43
|
for (const [id, ped] of this.peds) {
|
|
79
44
|
if (ped.handle === handle) {
|
|
80
45
|
this.peds.delete(id);
|
|
@@ -82,217 +47,73 @@ let PedService = class PedService {
|
|
|
82
47
|
}
|
|
83
48
|
}
|
|
84
49
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Delete all managed peds.
|
|
87
|
-
*/
|
|
88
50
|
deleteAll() {
|
|
89
51
|
for (const ped of this.peds.values()) {
|
|
90
|
-
|
|
91
|
-
SetEntityAsMissionEntity(ped.handle, true, true);
|
|
92
|
-
DeletePed(ped.handle);
|
|
93
|
-
}
|
|
52
|
+
this.pedsPort.delete(ped.handle);
|
|
94
53
|
}
|
|
95
54
|
this.peds.clear();
|
|
96
55
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Play an animation on a ped.
|
|
99
|
-
*
|
|
100
|
-
* @param handle - Ped handle
|
|
101
|
-
* @param options - Animation options
|
|
102
|
-
*/
|
|
103
56
|
async playAnimation(handle, options) {
|
|
104
|
-
|
|
105
|
-
if (!DoesEntityExist(handle))
|
|
106
|
-
return;
|
|
107
|
-
// Load anim dict
|
|
108
|
-
RequestAnimDict(dict);
|
|
109
|
-
while (!HasAnimDictLoaded(dict)) {
|
|
110
|
-
await new Promise((r) => setTimeout(r, 0));
|
|
111
|
-
}
|
|
112
|
-
TaskPlayAnim(handle, dict, anim, blendInSpeed, blendOutSpeed, duration, flags, playbackRate, false, false, false);
|
|
57
|
+
await this.pedsPort.playAnimation(handle, options);
|
|
113
58
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Stop all animations on a ped.
|
|
116
|
-
*
|
|
117
|
-
* @param handle - Ped handle
|
|
118
|
-
*/
|
|
119
59
|
stopAnimation(handle) {
|
|
120
|
-
|
|
121
|
-
return;
|
|
122
|
-
ClearPedTasks(handle);
|
|
60
|
+
this.pedsPort.stopAnimation(handle);
|
|
123
61
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Stop animation immediately on a ped.
|
|
126
|
-
*
|
|
127
|
-
* @param handle - Ped handle
|
|
128
|
-
*/
|
|
129
62
|
stopAnimationImmediately(handle) {
|
|
130
|
-
|
|
131
|
-
return;
|
|
132
|
-
ClearPedTasksImmediately(handle);
|
|
63
|
+
this.pedsPort.stopAnimationImmediately(handle);
|
|
133
64
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Freeze a ped in place.
|
|
136
|
-
*
|
|
137
|
-
* @param handle - Ped handle
|
|
138
|
-
* @param freeze - Whether to freeze
|
|
139
|
-
*/
|
|
140
65
|
freeze(handle, freeze) {
|
|
141
|
-
|
|
142
|
-
return;
|
|
143
|
-
FreezeEntityPosition(handle, freeze);
|
|
66
|
+
this.pedsPort.freeze(handle, freeze);
|
|
144
67
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Set ped invincibility.
|
|
147
|
-
*
|
|
148
|
-
* @param handle - Ped handle
|
|
149
|
-
* @param invincible - Whether invincible
|
|
150
|
-
*/
|
|
151
68
|
setInvincible(handle, invincible) {
|
|
152
|
-
|
|
153
|
-
return;
|
|
154
|
-
SetEntityInvincible(handle, invincible);
|
|
69
|
+
this.pedsPort.setInvincible(handle, invincible);
|
|
155
70
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Give a weapon to a ped.
|
|
158
|
-
*
|
|
159
|
-
* @param handle - Ped handle
|
|
160
|
-
* @param weapon - Weapon name/hash
|
|
161
|
-
* @param ammo - Ammo count
|
|
162
|
-
* @param hidden - Whether to hide the weapon
|
|
163
|
-
* @param forceInHand - Whether to force weapon in hand
|
|
164
|
-
*/
|
|
165
71
|
giveWeapon(handle, weapon, ammo = 100, hidden = false, forceInHand = true) {
|
|
166
|
-
|
|
167
|
-
return;
|
|
168
|
-
const weaponHash = GetHashKey(weapon);
|
|
169
|
-
GiveWeaponToPed(handle, weaponHash, ammo, hidden, forceInHand);
|
|
72
|
+
this.pedsPort.giveWeapon(handle, weapon, ammo, hidden, forceInHand);
|
|
170
73
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Remove all weapons from a ped.
|
|
173
|
-
*
|
|
174
|
-
* @param handle - Ped handle
|
|
175
|
-
*/
|
|
176
74
|
removeAllWeapons(handle) {
|
|
177
|
-
|
|
178
|
-
return;
|
|
179
|
-
RemoveAllPedWeapons(handle, true);
|
|
75
|
+
this.pedsPort.removeAllWeapons(handle);
|
|
180
76
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Get the closest ped to the player.
|
|
183
|
-
*
|
|
184
|
-
* @param radius - Search radius
|
|
185
|
-
* @param excludePlayer - Exclude the player ped
|
|
186
|
-
* @returns Ped handle or null
|
|
187
|
-
*/
|
|
188
77
|
getClosest(radius = 10.0, excludePlayer = true) {
|
|
189
|
-
const playerPed =
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
if (!found || handle === 0)
|
|
78
|
+
const playerPed = this.localPlayer.getHandle();
|
|
79
|
+
const handle = this.pedsPort.getClosest(radius, excludePlayer);
|
|
80
|
+
if (!handle)
|
|
193
81
|
return null;
|
|
194
82
|
if (excludePlayer && handle === playerPed)
|
|
195
83
|
return null;
|
|
196
84
|
return handle;
|
|
197
85
|
}
|
|
198
|
-
/**
|
|
199
|
-
* Get all peds in a radius.
|
|
200
|
-
*
|
|
201
|
-
* @param position - Center position
|
|
202
|
-
* @param radius - Search radius
|
|
203
|
-
* @param excludePlayer - Exclude the player ped
|
|
204
|
-
* @returns Array of ped handles
|
|
205
|
-
*/
|
|
206
86
|
getNearby(position, radius, excludePlayer = true) {
|
|
207
|
-
|
|
208
|
-
const playerPed = PlayerPedId();
|
|
209
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
210
|
-
const [handle, _] = FindFirstPed(0);
|
|
211
|
-
const ped = handle;
|
|
212
|
-
do {
|
|
213
|
-
if (!DoesEntityExist(ped))
|
|
214
|
-
continue;
|
|
215
|
-
if (excludePlayer && ped === playerPed)
|
|
216
|
-
continue;
|
|
217
|
-
const [ex, ey, ez] = GetEntityCoords(ped, true);
|
|
218
|
-
const dist = Math.sqrt((ex - position.x) ** 2 + (ey - position.y) ** 2 + (ez - position.z) ** 2);
|
|
219
|
-
if (dist <= radius) {
|
|
220
|
-
peds.push(ped);
|
|
221
|
-
}
|
|
222
|
-
} while (FindNextPed(handle, ped));
|
|
223
|
-
EndFindPed(handle);
|
|
224
|
-
return peds;
|
|
87
|
+
return this.pedsPort.getNearby(position, radius, excludePlayer ? this.localPlayer.getHandle() : undefined);
|
|
225
88
|
}
|
|
226
|
-
/**
|
|
227
|
-
* Make ped look at entity.
|
|
228
|
-
*
|
|
229
|
-
* @param handle - Ped handle
|
|
230
|
-
* @param entity - Entity to look at
|
|
231
|
-
* @param duration - Duration in ms (-1 for infinite)
|
|
232
|
-
*/
|
|
233
89
|
lookAtEntity(handle, entity, duration = -1) {
|
|
234
|
-
|
|
235
|
-
return;
|
|
236
|
-
TaskLookAtEntity(handle, entity, duration, 2048, 3);
|
|
90
|
+
this.pedsPort.lookAtEntity(handle, entity, duration);
|
|
237
91
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Make ped look at position.
|
|
240
|
-
*
|
|
241
|
-
* @param handle - Ped handle
|
|
242
|
-
* @param position - Position to look at
|
|
243
|
-
* @param duration - Duration in ms (-1 for infinite)
|
|
244
|
-
*/
|
|
245
92
|
lookAtCoords(handle, position, duration = -1) {
|
|
246
|
-
|
|
247
|
-
return;
|
|
248
|
-
TaskLookAtCoord(handle, position.x, position.y, position.z, duration, 2048, 3);
|
|
93
|
+
this.pedsPort.lookAtCoords(handle, position, duration);
|
|
249
94
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Make ped walk to position.
|
|
252
|
-
*
|
|
253
|
-
* @param handle - Ped handle
|
|
254
|
-
* @param position - Target position
|
|
255
|
-
* @param speed - Walking speed (1.0 = walk, 2.0 = run)
|
|
256
|
-
*/
|
|
257
95
|
walkTo(handle, position, speed = 1.0) {
|
|
258
|
-
|
|
259
|
-
return;
|
|
260
|
-
TaskGoStraightToCoord(handle, position.x, position.y, position.z, speed, -1, 0.0, 0.0);
|
|
96
|
+
this.pedsPort.walkTo(handle, position, speed);
|
|
261
97
|
}
|
|
262
|
-
/**
|
|
263
|
-
* Set ped combat attributes.
|
|
264
|
-
*
|
|
265
|
-
* @param handle - Ped handle
|
|
266
|
-
* @param canFight - Whether the ped can fight
|
|
267
|
-
* @param canUseCover - Whether the ped can use cover
|
|
268
|
-
*/
|
|
269
98
|
setCombatAttributes(handle, canFight, canUseCover = true) {
|
|
270
|
-
|
|
271
|
-
return;
|
|
272
|
-
SetPedCombatAttributes(handle, 46, canFight); // Can fight
|
|
273
|
-
SetPedCombatAttributes(handle, 0, canUseCover); // Can use cover
|
|
99
|
+
this.pedsPort.setCombatAttributes(handle, canFight, canUseCover);
|
|
274
100
|
}
|
|
275
|
-
/**
|
|
276
|
-
* Get a managed ped by ID.
|
|
277
|
-
*/
|
|
278
101
|
get(id) {
|
|
279
102
|
return this.peds.get(id);
|
|
280
103
|
}
|
|
281
|
-
/**
|
|
282
|
-
* Get all managed peds.
|
|
283
|
-
*/
|
|
284
104
|
getAll() {
|
|
285
105
|
return Array.from(this.peds.values());
|
|
286
106
|
}
|
|
287
|
-
/**
|
|
288
|
-
* Check if a managed ped still exists.
|
|
289
|
-
*/
|
|
290
107
|
exists(id) {
|
|
291
108
|
const ped = this.peds.get(id);
|
|
292
|
-
return ped ?
|
|
109
|
+
return ped ? this.pedsPort.exists(ped.handle) : false;
|
|
293
110
|
}
|
|
294
111
|
};
|
|
295
112
|
PedService = __decorate([
|
|
296
|
-
injectable()
|
|
113
|
+
injectable(),
|
|
114
|
+
__param(0, inject(IClientPedPort)),
|
|
115
|
+
__param(1, inject(IClientLocalPlayerBridge)),
|
|
116
|
+
__metadata("design:paramtypes", [IClientPedPort,
|
|
117
|
+
IClientLocalPlayerBridge])
|
|
297
118
|
], PedService);
|
|
298
119
|
export { PedService };
|