Skip to content

Commit a121ad1

Browse files
Functions listing and pages WIP
1 parent 1cd31ed commit a121ad1

15 files changed

+245
-40
lines changed

web/astro.config.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,22 @@ export default defineConfig({
3737
label: 'Reference',
3838
items: [
3939
{
40-
slug: 'Lua_API',
40+
slug: 'lua-api',
4141
},
4242
{
4343
label: 'Functions',
4444
items: [
45-
{slug: 'Client_Scripting_Functions'},
46-
{slug: 'Server_Scripting_Functions'},
47-
{slug: 'Shared_Scripting_Functions'},
45+
{label: 'All functions', link: '/functions'},
46+
{label: 'Shared functions', link: 'Shared_Scripting_Functions'},
47+
{label: 'Client functions', link: 'Client_Scripting_Functions'},
48+
{label: 'Server functions', link: 'Server_Scripting_Functions'},
4849
]
4950
},
5051
{
5152
label: 'Events',
5253
items: [
53-
{slug: 'Client_Scripting_Events'},
54-
{slug: 'Server_Scripting_Events'},
54+
// {slug: 'Client_Scripting_Events'},
55+
// {slug: 'Server_Scripting_Events'},
5556
]
5657
},
5758
{

web/src/content.config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ import { glob } from 'astro/loaders';
66
export const collections = {
77
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
88
elements: defineCollection({
9-
loader: glob({ pattern: "**/*.yaml", base: "../elements" }),
9+
loader: glob({
10+
pattern: "**/*.yaml",
11+
base: "../elements",
12+
generateId: ({ entry }) => entry.replace(/\.yaml$/, '')
13+
}),
14+
}),
15+
functions: defineCollection({
16+
loader: glob({
17+
pattern: "**/*.yaml",
18+
base: "../functions",
19+
generateId: ({ entry }) => {
20+
// Extract the file name without the folder
21+
return ((entry.split('/') || []).pop() || '').replace(/\.yaml$/, '');
22+
}
23+
})
1024
}),
1125
};

web/src/content/docs/reference/events/client.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

web/src/content/docs/reference/events/server.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

web/src/content/docs/reference/functions/client.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

web/src/content/docs/reference/functions/server.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

web/src/content/docs/reference/functions/shared.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

web/src/content/docs/reference/lua.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
title: Lua API
3-
slug: Lua_API
3+
slug: lua-api
44
---
55

6-
...
6+
The MTA **Lua API** is an extensive ecosystem built on an extended version of [Lua 5.1](https://www.lua.org/manual/5.1/), offering a wide array of functions and systems to enhance and customize gameplay. Whether you're creating game modes, modifying existing ones, or adding new features, the **Lua API** gives you full control over the game environment.
7+
8+
This API includes a powerful [event system](/events), a robust [element system](/Element) for interacting with in-game objects, and a vast collection of [functions](/functions) to manage game logic, networking, and more. With its flexibility and ease of use, the Lua API empowers developers to bring their unique ideas to life, making Multi Theft Auto a versatile platform for creating multiplayer experiences.
9+
10+
Explore this wiki to discover all the functions, event handlers, and tools available to help you make the most out of the Lua API in your MTA projects!

web/src/pages/404.astro

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
33
---
4-
<StarlightPage frontmatter={{ template: 'splash', title: 'Page not found (404)', hero: { title: 'Page not found', tagline: 'Check the URL or try using the search bar.' } }} />
4+
<StarlightPage frontmatter={{
5+
template: 'splash',
6+
title: 'Page not found (404)',
7+
hero: {
8+
title: 'Page not found',
9+
tagline: 'Check the URL or try using the search bar.'
10+
}
11+
}} />
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getFunctionsByTypeByCategory } from '@src/utils/functions';
4+
5+
const functionsByTypeByCategory = getFunctionsByTypeByCategory();
6+
const theseFunctions = functionsByTypeByCategory.client;
7+
---
8+
<StarlightPage frontmatter={{
9+
template: 'doc',
10+
title: 'Client functions',
11+
}}>
12+
13+
<p>This page lists all <strong>client-side</strong> functions available in the <a href="/lua-api">Lua API</a> organized by category.</p>
14+
15+
{Object.entries(theseFunctions).map(([category, funcs]) => (
16+
<section>
17+
<details>
18+
<summary>{category} functions</summary>
19+
<ul>
20+
{funcs.map(func => (
21+
<li><a href={`/${func.id}`}>{func.id}</a></li>
22+
))}
23+
</ul>
24+
</details>
25+
</section>
26+
))}
27+
</StarlightPage>

0 commit comments

Comments
 (0)