Skip to content

Commit 13a8c3e

Browse files
Fix element getSeeAlsoLinksForItem
1 parent e6215da commit 13a8c3e

File tree

2 files changed

+16
-28
lines changed

2 files changed

+16
-28
lines changed

web/src/pages/Element.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const elementsByCategory = getElementsByCategory();
1111
title: 'Element',
1212
tableOfContents: false,
1313
}}>
14-
<p>In order to perform operations on MTA objects via scripting, pointers to internal classes are exported to scripts as Lua userdata. Each of these classes has a number of exported scripting functions associated with them. Elements that have a physical representation in the game are also known as <a href="/Entity">Entities</a>.</p>
15-
<p>An <strong>element</strong> is a generic class that can represent almost all in-game entities.
14+
<p>In order to perform operations on MTA objects via scripting, pointers to internal classes are exported to scripts as Lua userdata. Each of these classes has a number of exported scripting functions associated with them. Elements that have a physical representation in the game are also known as <a href="/Entity">Entities</a>.
15+
An <strong>element</strong> is a generic class that can represent almost all in-game entities.
1616
The built-in element types are:</p>
1717

1818
<div class="mtaflex">
@@ -46,6 +46,7 @@ const elementsByCategory = getElementsByCategory();
4646

4747
<style>
4848
.mtaflex {
49+
margin-top: 1.5rem;
4950
display: flex;
5051
flex-wrap: wrap;
5152
gap: 2rem;

web/src/utils/general.ts

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -146,35 +146,22 @@ export function getSeeAlsoLinksForItem(theItem: any): SeeAlsoLinkGroup[] {
146146
case 'element':
147147
seeAlso = see_also ?? [];
148148
const elementCategory = getElementCategory(theItem);
149-
if (elementCategory === 'GUI') {
150-
// Show GUI functions, events and other GUI element types
151-
// as well as the Element article
152-
addToSeeAlso = [
153-
`functions:any:${elementCategory}`,
154-
`events:any:${elementCategory}`,
155-
`elements:any:${elementCategory}`,
156-
`article:Element`,
157-
];
158-
} else if (elementCategory === 'General') {
159-
// Also show generic Element functions and events if category is General
160-
addToSeeAlso = [
161-
`functions:any:${niceName}`,
162-
`events:any:${niceName}`,
163-
`elements:any:${niceName}`,
149+
addToSeeAlso = [
150+
`functions:any:${niceName}`,
151+
`events:any:${niceName}`,
152+
`elements:any:${niceName}`,
153+
`functions:any:${elementCategory}`,
154+
`events:any:${elementCategory}`,
155+
`elements:any:${elementCategory}`,
156+
];
157+
if (itemCategoryName === 'Entity') {
158+
// Add generic element function and events for Entities
159+
addToSeeAlso.push(
164160
`functions:any:Element`,
165161
`events:any:Element`,
166-
`article:Element`,
167-
];
168-
}
169-
else {
170-
// Show all functions and events for the element type
171-
// and the Element article
172-
addToSeeAlso = [
173-
`functions:any:${niceName}`,
174-
`events:any:${niceName}`,
175-
`article:Element`,
176-
];
162+
);
177163
}
164+
addToSeeAlso.push(`article:Element`);
178165
break;
179166
default:
180167
throw new Error('Invalid item type passed');

0 commit comments

Comments
 (0)