Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
xLuxy committed Apr 3, 2024
2 parents c0b9904 + 94fc6e6 commit 28c74ba
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 45 deletions.
15 changes: 13 additions & 2 deletions client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,17 +594,26 @@ declare module "alt-client" {
public setMeta<V extends any, K extends string = string>(key: K, value: shared.InterfaceValueByKey<ICustomBaseObjectMeta, K, V>): void;
}

/** [Documentation](https://docs.altv.mp/articles/virtualentity.html) */
export class VirtualEntityGroup extends BaseObject {
/** Creates a new Virtual Entity Group */
/**
* Creates a new Virtual Entity Group
*
* @param maxEntitiesInStream Max number of entities per player stream. [More info](https://docs.altv.mp/articles/virtualentity.html#what-is-max-number-of-entities-per-player-stream).
*/
public constructor(maxEntitiesInStream: number);

/** Returns all Virtual Entity Group instances */
public static readonly all: readonly VirtualEntityGroup[];

/** Maximum streaming range of the Virtual Entity Group */
/**
* Max number of entities per player stream.
* [More info](https://docs.altv.mp/articles/virtualentity.html#what-is-max-number-of-entities-per-player-stream).
*/
public readonly maxEntitiesInStream: number;
}

/** [Documentation](https://docs.altv.mp/articles/virtualentity.html) */
export class VirtualEntity extends WorldObject {
/** Creates a new Virtual Entity */
public constructor(group: VirtualEntityGroup, position: shared.Vector3, streamingDistance: number, data?: Record<string, any>);
Expand Down Expand Up @@ -3884,6 +3893,8 @@ declare module "alt-client" {

public static readonly count: number;

public static readonly streamedIn: readonly Object[];

public readonly alpha: number;

public readonly textureVariation: number;
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@altv/types-client",
"version": "16.0.12",
"version": "16.0.13",
"description": "This package contains types definitions for alt:V client-side module.",
"types": "index.d.ts",
"files": [
Expand Down
6 changes: 3 additions & 3 deletions docs/articles/create-your-first-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ deps = [

You can access exported functions & more by adding the following in your code:
```js
import * as chat from 'chat';
import * as chat from 'alt:chat';
```

**main** is the main server file.
Expand All @@ -85,13 +85,13 @@ import * as chat from 'chat';

Creating Server-side Code - server.js
We're going to add **chat** as a dependency to our resource.
Then we're going to import 'alt' and 'chat'.
Then we're going to import 'alt-server' and 'alt:chat'.

```js
// alt:V built-in module that provides server-side API.
import * as alt from 'alt-server';
// Your chat resource module.
import * as chat from 'chat';
import * as chat from 'alt:chat';

console.log('==> Your Resource Has Loaded! Horray!');

Expand Down
34 changes: 34 additions & 0 deletions docs/articles/debugging-server-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Debugging server code

alt:V allows you to debug your server-side code just like you would do in [NodeJS](https://nodejs.org/en/learn/getting-started/debugging).

## How?

1. Enable inspector in `resource.toml`.

```toml
type = 'js'
main = 'main.js'

[inspector]
# You can also specify host and port if needed
# (127.0.0.1:9229 by default)
# host = '127.0.0.1'
# port = '9999'
```

2. Add NodeJS interval with 0 delay.

```js
setInterval(() => {}, 0)
```

3. Now you should be able to connect to inspector via Chrome DevTools for example:

1. Open any webpage in Chrome
2. Press f12 to open console
3. Click on NodeJS icon

Video tutorial:

<iframe width="1280" height="720" src="https://www.youtube-nocookie.com/embed/F7mzNho5un8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
29 changes: 0 additions & 29 deletions docs/articles/events/before-player-connect.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Drawing Text 3D & 2D
# Drawing Text 3D & 2D (via game natives)

Used to draw text on your screen or in a 3D space. This only works on **client-side**.
Used to draw text on your screen or in a 3D space. This only works on **client-side**. This implementation uses natives of the game, for an alternative take a look at official [Text Label API](https://docs.altv.mp/articles/textlabel.html) added in [15.0](https://docs.altv.mp/articles/changelogs/15_0.html).

**Client Side**

Expand Down
8 changes: 3 additions & 5 deletions docs/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
href: import-assertions.md
- name: Events
href: events/index.md
items:
- name: beforePlayerConnect
href: events/before-player-connect.md
- name: Player
href: player/index.md
items:
Expand Down Expand Up @@ -41,7 +38,7 @@
- name: Shuffle
href: snippets/shuffle.md
- name: Text Labels
href: snippets/textlabels.md
href: snippets/natives-textlabels.md
- name: Voice
href: snippets/voice.md
- name: Vehicle
Expand All @@ -51,4 +48,5 @@
href: vehicle/train-api.md
- name: Workers
href: workers.md

- name: Debugging server code
href: debugging-server-code.md
13 changes: 11 additions & 2 deletions server/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,17 +723,26 @@ declare module "alt-server" {
public pos: shared.Vector3;
}

/** [Documentation](https://docs.altv.mp/articles/virtualentity.html) */
export class VirtualEntityGroup extends BaseObject {
/** Creates a new Virtual Entity Group */
/**
* Creates a new Virtual Entity Group
*
* @param maxEntitiesInStream Max number of entities per player stream. [More info](https://docs.altv.mp/articles/virtualentity.html#what-is-max-number-of-entities-per-player-stream).
*/
public constructor(maxEntitiesInStream: number);

/** Returns all Virtual Entity Group instances */
public static readonly all: readonly VirtualEntityGroup[];

/** Maximum streaming range inside the Virtual Entity Group */
/**
* Max number of entities per player stream.
* [More info](https://docs.altv.mp/articles/virtualentity.html#what-is-max-number-of-entities-per-player-stream).
*/
public readonly maxEntitiesInStream: number;
}

/** [Documentation](https://docs.altv.mp/articles/virtualentity.html) */
export class VirtualEntity extends WorldObject {
/** Creates a new Virtual Entity */
public constructor(group: VirtualEntityGroup, position: shared.Vector3, streamingDistance: number, data?: Record<string, any>);
Expand Down
2 changes: 1 addition & 1 deletion shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@altv/types-shared",
"version": "16.0.1",
"version": "16.0.2",
"description": "This package contains types definitions for alt:V JS module shared types.",
"types": "index.d.ts",
"files": [
Expand Down

0 comments on commit 28c74ba

Please sign in to comment.