Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Upgrade for altv 16 & jsv2 support #457

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Athena.commands.register('noclip', '/noclip', ['admin'], (player: alt.Player) =>
}

if (!isNoClipping && !data.isDead) {
player.setSyncedMeta('NoClipping', true);
player.setStreamSyncedMeta('NoClipping', true);
Athena.player.emit.message(player, `No Clip: ${LocaleController.get(LOCALE_KEYS.LABEL_ON)}`);
player.visible = false;
return;
Expand All @@ -24,7 +24,7 @@ Athena.commands.register('noclip', '/noclip', ['admin'], (player: alt.Player) =>
}

player.spawn(player.pos.x, player.pos.y, player.pos.z, 0);
player.setSyncedMeta('NoClipping', false);
player.setStreamSyncedMeta('NoClipping', false);
Athena.player.emit.message(player, `No Clip: ${LocaleController.get(LOCALE_KEYS.LABEL_OFF)}`);
player.visible = true;
player.health = 199;
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/events/waypointEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ alt.onClient(ATHENA_EVENTS_PLAYER_CLIENT.WAYPOINT, (player: alt.Player, pos: alt
}

player.currentWaypoint = pos;
player.setSyncedMeta(PLAYER_SYNCED_META.WAYPOINT, pos);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.WAYPOINT, pos);
ClientEvents.trigger(ATHENA_EVENTS_PLAYER_CLIENT.WAYPOINT, player, pos);
});
2 changes: 1 addition & 1 deletion src/core/server/player/safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function setDimension(player: alt.Player, value: number) {
}

player.dimension = value;
player.setSyncedMeta(PLAYER_SYNCED_META.DIMENSION, value);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.DIMENSION, value);
}

interface SafeFunctions {
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/player/setter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function account(player: alt.Player, accountData: Account): Promise
const newToken = await Athena.systems.jwt.create(accountData as Account);
alt.emitClient(player, SYSTEM_EVENTS.QUICK_TOKEN_UPDATE, newToken);

player.setSyncedMeta(PLAYER_SYNCED_META.ACCOUNT_ID, accountData.id);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.ACCOUNT_ID, accountData.id);
emit.meta(player, 'permissions', accountData.permissions);

Athena.document.account.bind(player, accountData);
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/player/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ export function syncedMeta(player: alt.Player): void {
return Overrides.syncedMeta(player);
}

player.setSyncedMeta(PLAYER_SYNCED_META.PING, player.ping);
player.setSyncedMeta(PLAYER_SYNCED_META.POSITION, player.pos);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.PING, player.ping);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.POSITION, player.pos);
}

export function playTime(player: alt.Player): void {
Expand Down
8 changes: 4 additions & 4 deletions src/core/server/systems/character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ export async function select(player: alt.Player, character: Character) {
// Synchronization
Athena.player.sync.currencyData(player);

player.setSyncedMeta(PLAYER_SYNCED_META.NAME, data.name);
player.setSyncedMeta(PLAYER_SYNCED_META.PING, player.ping);
player.setSyncedMeta(PLAYER_SYNCED_META.POSITION, player.pos);
player.setSyncedMeta(PLAYER_SYNCED_META.DATABASE_ID, data._id.toString());
player.setStreamSyncedMeta(PLAYER_SYNCED_META.NAME, data.name);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.PING, player.ping);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.POSITION, player.pos);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.DATABASE_ID, data._id.toString());

// Propagation
// Athena.controllers.chat.populateCommands(player);
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/systems/identifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function setPlayerIdentifier(player: alt.Player) {
throw new Error(`Could not set identifier for player: ${player.id}, data was not defined.`);
}

player.setSyncedMeta(PLAYER_SYNCED_META.IDENTIFICATION_ID, identifier);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.IDENTIFICATION_ID, identifier);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/systems/inventory/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let DEFAULT_CONFIG = {
*/
export function set(config: typeof DEFAULT_CONFIG) {
DEFAULT_CONFIG = Object.assign(DEFAULT_CONFIG, config);
alt.setSyncedMeta(GLOBAL_SYNCED.INVENTORY_WEIGHT_ENABLED, DEFAULT_CONFIG.weight.enabled);
alt.setMeta(GLOBAL_SYNCED.INVENTORY_WEIGHT_ENABLED, DEFAULT_CONFIG.weight.enabled);
}

/**
Expand All @@ -48,5 +48,5 @@ export function get(): typeof DEFAULT_CONFIG {
*/
export function disableWeight() {
DEFAULT_CONFIG.weight.enabled = false;
alt.setSyncedMeta(GLOBAL_SYNCED.INVENTORY_WEIGHT_ENABLED, false);
alt.setMeta(GLOBAL_SYNCED.INVENTORY_WEIGHT_ENABLED, false);
}
2 changes: 1 addition & 1 deletion src/core/server/systems/inventory/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BaseItem, StoredItem, Item, DefaultItemBehavior } from '@AthenaShared/i
import { deepCloneArray, deepCloneObject } from '@AthenaShared/utility/deepCopy.js';
import { GLOBAL_SYNCED } from '@AthenaShared/enums/globalSynced.js';

alt.setSyncedMeta(GLOBAL_SYNCED.INVENTORY_WEIGHT_ENABLED, true);
alt.setMeta(GLOBAL_SYNCED.INVENTORY_WEIGHT_ENABLED, true);

export interface ItemQuantityChange {
/**
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/systems/tick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ function handlePing(player: alt.Player): void {
return;
}

player.setSyncedMeta(PLAYER_SYNCED_META.PING, player.ping);
player.setSyncedMeta(PLAYER_SYNCED_META.POSITION, player.pos);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.PING, player.ping);
player.setStreamSyncedMeta(PLAYER_SYNCED_META.POSITION, player.pos);
player.nextPingTime = Date.now() + timeBetweenPings;

// Handles General Saving / Synchronization
Expand Down