diff --git a/server/js/compatibility/classes/voiceChannel.js b/server/js/compatibility/classes/voiceChannel.js
index b9eb6ef67..8be786654 100644
--- a/server/js/compatibility/classes/voiceChannel.js
+++ b/server/js/compatibility/classes/voiceChannel.js
@@ -4,13 +4,18 @@
requireBinding("shared/entity.js");
+const { BaseObject } = requireBinding("server/compatibility/classes/baseObject.js");
+
+const { extendAltEntityClass } = requireBinding("shared/compatibility/utils/classes.js");
+
class VoiceChannel extends alt.VoiceChannel {
constructor(...args) {
// NOTE (xLuxy): This prevents the infinite loop caused by alt.*.create
if (!args.length) return super();
const [spatial, maxDistance] = args;
- return alt.VoiceChannel.create({ spatial, maxDistance });
+ const instance = alt.VoiceChannel.create({ spatial, maxDistance });
+ return extendAltEntityClass(instance, BaseObject);
}
isPlayerInChannel(player) {
diff --git a/server/js/compatibility/core.js b/server/js/compatibility/core.js
new file mode 100644
index 000000000..06504ac3f
--- /dev/null
+++ b/server/js/compatibility/core.js
@@ -0,0 +1,67 @@
+///
+///
+///
+// import * as alt from "@altv/server";
+
+function setSyncedMeta(key, value) {
+ alt.syncedMeta[key] = value;
+}
+
+function deleteSyncedMeta(key) {
+ delete alt.syncedMeta[key];
+}
+
+cppBindings.registerCompatibilityExport("setSyncedMeta", alt.setSyncedMeta);
+cppBindings.registerCompatibilityExport("deleteSyncedMeta", alt.deleteSyncedMeta);
+
+// Resource
+cppBindings.registerCompatibilityExport("startResource", alt.Resource.start);
+cppBindings.registerCompatibilityExport("stopResource", alt.Resource.stop);
+cppBindings.registerCompatibilityExport("restartResource", alt.Resource.restart);
+
+// Model
+cppBindings.registerCompatibilityExport("getVehicleModelInfoByHash", alt.VehicleModelInfo.get);
+cppBindings.registerCompatibilityExport("getPedModelInfoByHash", alt.PedModelInfo.get);
+cppBindings.registerCompatibilityExport("getWeaponModelInfoByHash", alt.WeaponModelInfo.get);
+
+// TODO (xLuxy): Missing from v2
+// cppBindings.registerCompatibilityExport("getAmmoHashForWeaponHash", alt.we);
+
+cppBindings.registerCompatibilityExport("getServerConfig", () => alt.serverConfig);
+
+// Streaming
+cppBindings.registerCompatibilityExport("getMaxStreamingPeds", () => alt.Streaming.maxStreamingPeds);
+cppBindings.registerCompatibilityExport("setMaxStreamingPeds", (val) => (alt.Streaming.maxStreamingPeds = val));
+
+cppBindings.registerCompatibilityExport("getMaxStreamingObjects", () => alt.Streaming.maxStreamingObjects);
+cppBindings.registerCompatibilityExport("getMaxStreamingObjects", (val) => (alt.Streaming.maxStreamingObjects = val));
+
+cppBindings.registerCompatibilityExport("getMaxStreamingVehicles", () => alt.Streaming.maxStreamingVehicles);
+cppBindings.registerCompatibilityExport("setMaxStreamingVehicles", (val) => (alt.Streaming.maxStreamingVehicles = val));
+
+cppBindings.registerCompatibilityExport("getStreamerThreadCount", () => alt.Streaming.streamerThreadCount);
+cppBindings.registerCompatibilityExport("setStreamerThreadCount", (val) => (alt.Streaming.streamerThreadCount = val));
+
+cppBindings.registerCompatibilityExport("getStreamingTickRate", () => alt.Streaming.streamingTickRate);
+cppBindings.registerCompatibilityExport("setStreamingTickRate", (val) => (alt.Streaming.streamingTickRate = val));
+
+cppBindings.registerCompatibilityExport("getStreamingDistance", () => alt.Streaming.streamingDistance);
+cppBindings.registerCompatibilityExport("setStreamingDistance", (val) => (alt.Streaming.streamingDistance = val));
+
+cppBindings.registerCompatibilityExport("getMigrationThreadCount", () => alt.Streaming.migrationThreadCount);
+cppBindings.registerCompatibilityExport("setMigrationThreadCount", (val) => (alt.Streaming.migrationThreadCount = val));
+
+cppBindings.registerCompatibilityExport("getSyncSendThreadCount", () => alt.Streaming.syncSendThreadCount);
+cppBindings.registerCompatibilityExport("setSyncSendThreadCount", (val) => (alt.Streaming.syncSendThreadCount = val));
+
+cppBindings.registerCompatibilityExport("getSyncReceiveThreadCount", () => alt.Streaming.syncReceiveThreadCount);
+cppBindings.registerCompatibilityExport("setSyncReceiveThreadCount", (val) => (alt.Streaming.syncReceiveThreadCount = val));
+
+cppBindings.registerCompatibilityExport("getMigrationTickRate", () => alt.Streaming.migrationTickRate);
+cppBindings.registerCompatibilityExport("setMigrationTickRate", (val) => (alt.Streaming.migrationTickRate = val));
+
+cppBindings.registerCompatibilityExport("getColShapeTickRate", () => alt.Streaming.colShapeTickRate);
+cppBindings.registerCompatibilityExport("setColShapeTickRate", (val) => (alt.Streaming.colShapeTickRate = val));
+
+cppBindings.registerCompatibilityExport("getMigrationDistance", () => alt.Streaming.migrationDistance);
+cppBindings.registerCompatibilityExport("setMigrationDistance", (val) => (alt.Streaming.migrationDistance = val));
diff --git a/server/js/compatibility/events.js b/server/js/compatibility/events.js
new file mode 100644
index 000000000..0a85de7c1
--- /dev/null
+++ b/server/js/compatibility/events.js
@@ -0,0 +1,54 @@
+///
+///
+///
+// import * as alt from "@altv/shared";
+
+/** @type {typeof import("../../../shared/js/compatibility/utils/events.js")} */
+const { getEventTypeFromName, getEventArgumentConverter, isCustomEvent } = requireBinding("shared/compatibility/utils/events.js");
+
+function emitClient(player, eventName, ...args) {
+ if (!(player instanceof alt.Player) || !Array.isArray(player)) return;
+
+ if (Array.isArray(player)) {
+ alt.Events.emitPlayers(player, eventName, ...args);
+ return;
+ }
+
+ player.emit(eventName, ...args);
+}
+
+function emitClientRaw(player, eventName, ...args) {
+ if (!(player instanceof alt.Player) || !Array.isArray(player)) return;
+
+ if (Array.isArray(player)) {
+ alt.Events.emitPlayersRaw(player, eventName, ...args);
+ return;
+ }
+
+ player.emitRaw(eventName, ...args);
+}
+
+function emitClientUnreliable(player, eventName, ...args) {
+ if (!(player instanceof alt.Player) || !Array.isArray(player)) return;
+
+ if (Array.isArray(player)) {
+ alt.Events.emitPlayersUnreliable(player, eventName, ...args);
+ return;
+ }
+
+ player.emitUnreliable(eventName, ...args);
+}
+
+cppBindings.registerCompatibilityExport("emitClient", emitClient);
+cppBindings.registerCompatibilityExport("emitClientRaw", emitClientRaw);
+cppBindings.registerCompatibilityExport("emitClientUnreliable", emitClientUnreliable);
+
+cppBindings.registerCompatibilityExport("emitAllClients", alt.Events.emitAllPlayers);
+cppBindings.registerCompatibilityExport("emitAllClientsRaw", alt.Events.emitAllPlayersRaw);
+cppBindings.registerCompatibilityExport("emitAllClientsUnreliable", alt.Events.emitAllPlayersUnreliableRaw);
+
+// TODO (xLuxy)
+// export function offClient(eventName: string, listener: (player: Player, ...args: any[]) => void): void;
+// export function offClient(listener: (eventName: string, ...args: any[]) => void): void;
+// export function onClient(listener: (eventName: string, player: Player, ...args: any[]) => void): void;
+// export function onceClient(listener: (eventName: string, player: Player, ...args: any[]) => void): void;
diff --git a/shared/js/compatibility/events.js b/shared/js/compatibility/events.js
index 9339a6b0b..b0cbf9704 100644
--- a/shared/js/compatibility/events.js
+++ b/shared/js/compatibility/events.js
@@ -6,7 +6,7 @@
/** @type {typeof import("./utils/events.js")} */
const { getEventTypeFromName, getEventArgumentConverter, isCustomEvent } = requireBinding("shared/compatibility/utils/events.js");
-const eventMap = new Map();
+export const eventMap = new Map();
/**
*
@@ -113,54 +113,7 @@ alt.Events.onEvent(async (ctx) => {
}
});
-function emitClient(player, eventName, ...args) {
- if (!(player instanceof alt.Player) || !Array.isArray(player)) return;
-
- if (Array.isArray(player)) {
- alt.Events.emitPlayers(player, eventName, ...args);
- return;
- }
-
- player.emit(eventName, ...args);
-}
-
-function emitClientRaw(player, eventName, ...args) {
- if (!(player instanceof alt.Player) || !Array.isArray(player)) return;
-
- if (Array.isArray(player)) {
- alt.Events.emitPlayersRaw(player, eventName, ...args);
- return;
- }
-
- player.emitRaw(eventName, ...args);
-}
-
-function emitClientUnreliable(player, eventName, ...args) {
- if (!(player instanceof alt.Player) || !Array.isArray(player)) return;
-
- if (Array.isArray(player)) {
- alt.Events.emitPlayersUnreliable(player, eventName, ...args);
- return;
- }
-
- player.emitUnreliable(eventName, ...args);
-}
-
cppBindings.registerCompatibilityExport("on", on);
cppBindings.registerCompatibilityExport("once", once);
cppBindings.registerCompatibilityExport("off", off);
cppBindings.registerCompatibilityExport("getEventListeners", getEventListeners);
-
-cppBindings.registerCompatibilityExport("emitClient", emitClient);
-cppBindings.registerCompatibilityExport("emitClientRaw", emitClientRaw);
-cppBindings.registerCompatibilityExport("emitClientUnreliable", emitClientUnreliable);
-
-cppBindings.registerCompatibilityExport("emitAllClients", alt.Events.emitAllPlayers);
-cppBindings.registerCompatibilityExport("emitAllClientsRaw", alt.Events.emitAllPlayersRaw);
-cppBindings.registerCompatibilityExport("emitAllClientsUnreliable", alt.Events.emitAllPlayersUnreliableRaw);
-
-// TODO (xLuxy)
-// export function offClient(eventName: string, listener: (player: Player, ...args: any[]) => void): void;
-// export function offClient(listener: (eventName: string, ...args: any[]) => void): void;
-// export function onClient(listener: (eventName: string, player: Player, ...args: any[]) => void): void;
-// export function onceClient(listener: (eventName: string, player: Player, ...args: any[]) => void): void;