Skip to content

Commit c192152

Browse files
committed
Resolve conflict
1 parent b424588 commit c192152

21 files changed

+523
-40
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"yaml.schemas": {
33
"schemas/function.yaml": "/functions/**/*",
44
"schemas/element.yaml": "/elements/**/*",
5-
// "schemas/event.yaml": "/events/**/*",
5+
"schemas/event.yaml": "/events/**/*",
66
}
77
}

assets/element_tree.webp

13.3 KB
Binary file not shown.

events/.gitkeep

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
local vehicle = createVehicle (411, 0, 0, 3)
2+
setTimer (setElementInterior, 1000, 1, vehicle, 10)
3+
4+
addEventHandler ("onClientElementInteriorChange", vehicle, function (oldInterior, newInterior)
5+
outputChatBox (inspect (source).."'s interior changed from "..oldInterior.." to "..newInterior)
6+
end)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
local vehicle = createVehicle(411, 0, 0, 3)
2+
setTimer(setElementInterior, 1000, 1, vehicle, 10)
3+
4+
addEventHandler("onElementInteriorChange", vehicle, function(oldInterior, newInterior)
5+
outputChatBox(inspect(source).."'s interior changed from "..oldInterior.." to "..newInterior)
6+
end)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: onClientElementInteriorChange
2+
type: client
3+
description: >
4+
This event is triggered when the interior of an element is changed using setElementInterior.
5+
parameters:
6+
- name: oldInterior
7+
type: int
8+
description: An int representing the interior the element was in before.
9+
- name: newInterior
10+
type: int
11+
description: An int representing the interior the element is in now.
12+
source_element:
13+
type: element
14+
description: The source of this event is the element that changed its interior.
15+
examples:
16+
- path: examples/onClientElementInteriorChange.lua
17+
description: >
18+
Demonstrates how to detect and respond to an element's interior change.
19+
Includes vehicle creation and an event handler that reports the interior transition.
20+
notes: []
21+
preview_images: []
22+
version: {}
23+
issues: []
24+
see_also: []
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: onElementInteriorChange
2+
type: server
3+
description: >
4+
This event is triggered when the interior of an element is changed using setElementInterior.
5+
parameters:
6+
- name: oldInterior
7+
type: int
8+
description: An int representing the interior the element was in before.
9+
- name: newInterior
10+
type: int
11+
description: An int representing the interior the element is in now.
12+
source_element:
13+
type: element
14+
description: The source of this event is the element that changed its interior.
15+
examples:
16+
- path: examples/onElementInteriorChange.lua
17+
description: >
18+
Demonstrates how to detect and respond to an element's interior change.
19+
Includes vehicle creation and an event handler that reports the interior transition.
20+
notes: []
21+
preview_images: []
22+
version: {}
23+
issues: []
24+
see_also: []

schemas/common-defs.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
$schema: https://json-schema.org/draft/2020-12/schema
2+
$id: common-defs.yaml
3+
title: Common definitions
4+
type: object
5+
$defs:
6+
notes:
7+
type: array
8+
description: List of noteworthy pieces of information for the item.
9+
items:
10+
type: string
11+
12+
meta:
13+
type: array
14+
description: A list of meta properties about the item and it's documentation.
15+
items:
16+
type: object
17+
properties:
18+
needs_checking:
19+
type: string
20+
description: Describe why the item needs checking by another person. What's problematic?
21+
22+
preview_images:
23+
type: array
24+
description: A list of picture assets demonstrating the item.
25+
items:
26+
type: object
27+
required:
28+
- path
29+
properties:
30+
path:
31+
type: string
32+
description: A relative or repository-absolute path to an asset file.
33+
description:
34+
type: string
35+
description: Brief summary of the content in the picture.
36+
37+
version:
38+
type: object
39+
description: Version information when the item got added/deprecated/removed.
40+
properties:
41+
added:
42+
type: string
43+
description: Version when this item was added to MTA.
44+
removed:
45+
type: string
46+
description: Version when this item was removed from MTA.
47+
deprecated:
48+
type: string
49+
description: Version when this item was deprecated in MTA.
50+
replacement:
51+
type: string
52+
description: An optional replacement for this item.
53+
54+
issues:
55+
type: array
56+
description: A list of related issues for this item.
57+
items:
58+
type: object
59+
required:
60+
- id
61+
- description
62+
properties:
63+
id:
64+
type: integer
65+
description: Numeric identifier of the GitHub issue.
66+
description:
67+
type: string
68+
description: Description or summary for this GitHub issue.
69+
70+
examples:
71+
type: array
72+
description: A list of source code examples demonstrating the item.
73+
items:
74+
type: object
75+
required:
76+
- path
77+
properties:
78+
path:
79+
type: string
80+
description: A relative or repository-absolute path to an example source file.
81+
description:
82+
type: string
83+
description: Description for this source code example.
84+
append:
85+
type: boolean
86+
default: false
87+
description: If set to true, this example will be appended to the previous example.
88+
89+
see_also:
90+
type: array
91+
description: |
92+
A list of other categories for further reading.
93+
Every function/event/element will implicitly display it's own category in *See Also*, unless you
94+
introduce this property, then you have to be explicit about it.
95+
items:
96+
type: string
97+
pattern: "^(category):"
98+
uniqueItems: true

schemas/element.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$schema: https://json-schema.org/draft/2020-12/schema
2-
$id: /schemas/element
2+
$id: element.yaml
33
title: Element schema
44
type: object
55
required:
@@ -13,12 +13,4 @@ properties:
1313
type: string
1414
description: Description of the element.
1515
see_also:
16-
type: array
17-
description: |
18-
A list of other categories for further reading.
19-
Every element will implicitly display it's own category in *See Also*, unless you
20-
introduce this property, then you have to be explicit about it.
21-
items:
22-
type: string
23-
pattern: "^(category):"
24-
uniqueItems: true
16+
$ref: 'common-defs.yaml#/$defs/see_also'

schemas/event.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
$schema: https://json-schema.org/draft/2020-12/schema
2+
$id: event.yaml
3+
title: Event schema
4+
type: object
5+
required:
6+
- name
7+
- type
8+
- description
9+
- source_element
10+
properties:
11+
name:
12+
type: string
13+
description: Exact name of the event.
14+
type:
15+
type: string
16+
description: Type of the event ("client" or "server").
17+
enum:
18+
- client
19+
- server
20+
description:
21+
type: string
22+
description: Description of the event.
23+
parameters:
24+
$ref: '#/$defs/parameters'
25+
source_element:
26+
$ref: '#/$defs/source_element'
27+
notes:
28+
$ref: 'common-defs.yaml#/$defs/notes'
29+
preview_images:
30+
$ref: 'common-defs.yaml#/$defs/preview_images'
31+
version:
32+
$ref: 'common-defs.yaml#/$defs/version'
33+
issues:
34+
$ref: 'common-defs.yaml#/$defs/issues'
35+
examples:
36+
$ref: 'common-defs.yaml#/$defs/examples'
37+
see_also:
38+
$ref: 'common-defs.yaml#/$defs/see_also'
39+
40+
$defs:
41+
source_element:
42+
type: object
43+
properties:
44+
type:
45+
type: string
46+
description: Type of the source element (e.g., "player", "object").
47+
description:
48+
type: string
49+
description: Description of the source element in the event's context.
50+
parameters:
51+
type: array
52+
description: A list of parameters passed to the event handler function.
53+
items:
54+
type: object
55+
required:
56+
- name
57+
- type
58+
- description
59+
properties:
60+
name:
61+
type: string
62+
description: Name of the function parameter.
63+
type:
64+
type: string
65+
description: Type of the function parameter.
66+
description:
67+
type: string
68+
description: Describe the usage, contraints and other useful information about the parameter.

tools/validate.cmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
@echo off
22

33
for /r "functions" %%f in (*.yaml) do (
4-
.\tools\yajsv.exe -s schemas/function.yaml "%%f"
4+
.\tools\yajsv.exe -s schemas/function.yaml -r schemas/common-defs.yaml "%%f"
55
)
66

77
for /r "elements" %%f in (*.yaml) do (
8-
.\tools\yajsv.exe -s schemas/element.yaml "%%f"
8+
.\tools\yajsv.exe -s schemas/element.yaml -r schemas/common-defs.yaml "%%f"
99
)
1010

11-
@REM for /r "events" %%f in (*.yaml) do (
12-
@REM .\tools\yajsv.exe -s schemas/events.yaml "%%f"
13-
@REM )
11+
for /r "events" %%f in (*.yaml) do (
12+
.\tools\yajsv.exe -s schemas/event.yaml -r schemas/common-defs.yaml "%%f"
13+
)

tools/validate.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22

3-
find 'functions/' -name '*.yaml' -type f -print0 | xargs -0 -I {} tools/yajsv -s schemas/function.yaml {}
4-
find 'elements/' -name '*.yaml' -type f -print0 | xargs -0 -I {} tools/yajsv -s schemas/element.yaml {}
5-
# find 'events/' -name '*.yaml' -type f -print0 | xargs -0 -I {} tools/yajsv -s schemas/event.yaml {}
3+
find 'functions/' -name '*.yaml' -type f -print0 | xargs -0 -I {} tools/yajsv -s schemas/function.yaml -r schemas/common-defs.yaml {}
4+
find 'elements/' -name '*.yaml' -type f -print0 | xargs -0 -I {} tools/yajsv -s schemas/element.yaml -r schemas/common-defs.yaml {}
5+
find 'events/' -name '*.yaml' -type f -print0 | xargs -0 -I {} tools/yajsv -s schemas/event.yaml -r schemas/common-defs.yaml {}

web/astro.config.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ export default defineConfig({
7575
{
7676
label: 'Elements',
7777
items: [
78-
{label: 'Element types', link: 'Element', badge:{
79-
text: 'New',
80-
variant: 'tip',
81-
}},
78+
{label: 'Element types', link: 'Element'},
8279
{label: 'Element tree', link: 'Element_tree'},
8380
]
8481
},

web/src/content.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,14 @@ export const collections = {
2222
}
2323
})
2424
}),
25+
events: defineCollection({
26+
loader: glob({
27+
pattern: "**/*.yaml",
28+
base: "../events",
29+
generateId: ({ entry }) => {
30+
// Extract the file name without the folder
31+
return ((entry.split('/') || []).pop() || '').replace(/\.yaml$/, '');
32+
}
33+
})
34+
}),
2535
};

web/src/overrides/Pagination.astro

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ import IconLinkCard from '@src/components/IconLinkCard.astro';
1717
iconColor="var(--sl-color-blue)"
1818
title="Events"
1919
titleColor="var(--sl-color-blue)"
20-
description="List of all client-side, server-side and shared events"
20+
description="List of all client-side and server-side events"
2121
href="/Scripting_Events" />
2222

2323
<IconLinkCard
2424
icon="seti:plan"
2525
title="Elements"
26-
description="List of MTA:SA elements"
27-
href="/Element_tree" />
26+
description="List of all element types and their properties"
27+
href="/Element" />
28+
2829

2930
<IconLinkCard
3031
icon="discord"
@@ -38,10 +39,9 @@ import IconLinkCard from '@src/components/IconLinkCard.astro';
3839
description="Engage with the community in the old-fashioned way."
3940
href="https://forum.multitheftauto.com/" />
4041

42+
<IconLinkCard
43+
icon="github"
44+
title="GitHub Repository"
45+
description="Contribute to the Wiki project or report issues."
46+
href="https://github.com/multitheftauto/wiki.multitheftauto.com" />
4147
</CardGrid>
42-
43-
<IconLinkCard
44-
icon="github"
45-
title="GitHub Repository"
46-
description="Contribute to the Wiki project or report issues."
47-
href="https://github.com/multitheftauto/wiki.multitheftauto.com" />
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getEventsByTypeByCategory } from '@src/utils/events';
4+
5+
const eventsByTypeByCategory = getEventsByTypeByCategory();
6+
const theseEvents = eventsByTypeByCategory.client;
37
---
48
<StarlightPage frontmatter={{
59
template: 'doc',
6-
title: 'Client evebts',
10+
title: 'Client events',
711
tableOfContents: false,
812
}}>
9-
<p>This page lists all <strong>client-side</strong> functions available in the <a href="/lua-api">Lua API</a> organized by category.</p>
13+
<p>This page lists all <strong>client-side</strong> events available in the <a href="/lua-api">Lua API</a> organized by category.</p>
1014

11-
TODO
15+
{Object.entries(theseEvents).map(([category, events]) => (
16+
<section>
17+
<details>
18+
<summary>{category} events</summary>
19+
<ul>
20+
{events.map(event => (
21+
<li><a href={`/${event.id}`}>{event.id}</a></li>
22+
))}
23+
</ul>
24+
</details>
25+
</section>
26+
))}
1227
</StarlightPage>

0 commit comments

Comments
 (0)