Skip to content

Commit bc9bc7d

Browse files
Weapons.astro WIP
1 parent 5063070 commit bc9bc7d

File tree

11 files changed

+154
-7
lines changed

11 files changed

+154
-7
lines changed

assets/images/Weapons/0.webp

862 Bytes
Binary file not shown.

assets/images/Weapons/1.webp

940 Bytes
Binary file not shown.

web/scripts/preprocess.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ import('../mta_highlighting/generate-lua-tmlanguage.js')
4646
.then(() => {
4747
deleteDirRecursive(destDir);
4848
copyDirRecursive(srcDir, destDir);
49-
console.log(`Copied assets from "${srcDir}" to "${destDir}".`);
49+
// console.log(`Copied assets from "${srcDir}" to "${destDir}".`);
5050
});

web/src/pages/reference/ID_Lists/Damage_Types.astro

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ luaTable += `}`;
4242
<p>The following damage types are used by events like <a href="/reference/onPlayerDamage">onPlayerDamage</a> or <a href="/reference/onPlayerWasted">onPlayerWasted</a> for the weapon argument to describe the reason, why a ped has been damaged or died.</p>
4343

4444
<p>When a player was shot by a weapon, the respective weapon ID is the damage type ID. The weapon IDs can be found <a href="/reference/ID_Lists/Weapons">here</a>.</p>
45-
<table>
45+
<table class="damage-types-table">
4646
<thead>
4747
<tr>
4848
<th>ID</th>
@@ -70,3 +70,11 @@ luaTable += `}`;
7070
'reference:ID_Lists',
7171
])} currentId='' />
7272
</StarlightPage>
73+
74+
<style>
75+
.damage-types-table {
76+
display: block;
77+
overflow-x: auto;
78+
white-space: nowrap;
79+
}
80+
</style>

web/src/pages/reference/ID_Lists/Garages.astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const garages: Record<number, Garage> = {
7878
<p>Every openable garage in San Andreas can be opened or closed through the <a href="/reference/setGarageOpen">setGarageOpen</a> function.</p>
7979

8080
<p>The garage IDs and their descriptions are listed below:</p>
81-
<table>
81+
<table class="garages-table">
8282
<thead>
8383
<tr>
8484
<th>ID</th>
@@ -124,4 +124,9 @@ const garages: Record<number, Garage> = {
124124
.warningdot {
125125
color: red;
126126
}
127+
.garages-table {
128+
display: block;
129+
overflow-x: auto;
130+
white-space: nowrap;
131+
}
127132
</style>

web/src/pages/reference/ID_Lists/Interiors.astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ const interiors = {
198198
{Object.entries(interiors).map(([id, interiorsList]) => (
199199
<div class="interior-list">
200200
<h4 id={"id-"+id}>ID {id}</h4>
201-
<table>
201+
<table class="interior-table">
202202
<thead>
203203
<tr>
204204
<th>Interior Name</th>
@@ -233,6 +233,11 @@ const interiors = {
233233
border: 1px solid var(--sl-color-gray-3);
234234
padding: 1rem;
235235
}
236+
.interior-table {
237+
display: block;
238+
overflow-x: auto;
239+
white-space: nowrap;
240+
}
236241
.interior-list h4 {
237242
margin: 0;
238243
}

web/src/pages/reference/ID_Lists/Vehicle_Paintjobs.astro

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ luaTable += `\n}\n`;
4141
Paintjobs can be applied on a vehicle using <a href="/reference/setVehiclePaintjob">setVehiclePaintjob</a>.</p>
4242
<p>To remove a paintjob from a vehicle, apply paintjob number <code>3</code> to it.
4343
</p>
44-
<table>
44+
<table class="paintjobs-table"
4545
<thead>
4646
<tr>
4747
<th>Vehicle</th>
@@ -77,6 +77,11 @@ luaTable += `\n}\n`;
7777
</StarlightPage>
7878

7979
<style>
80+
.paintjobs-table {
81+
display: block;
82+
overflow-x: auto;
83+
white-space: nowrap;
84+
}
8085
.vehicle-image {
8186
width: 80px;
8287
height: auto;

web/src/pages/reference/ID_Lists/Vehicle_Variants.astro

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const luaTable = `local vehicleVariantsByModel = {
143143
<p>To spawn custom variants is to implicitly specify which variants you want in <a href="/reference/createVehicle">createVehicle</a>, or change the variant of an already existing vehicle using <a href="/reference/setVehicleVariant">setVehicleVariant</a>. Also, any invalid variant will show up as the default model with no variation.</p>
144144

145145
<h2>GTA: San Andreas Vehicle Variants List</h2>
146-
<table>
146+
<table class="variants-table">
147147
<thead>
148148
<tr>
149149
<th>Vehicle</th>
@@ -177,3 +177,11 @@ const luaTable = `local vehicleVariantsByModel = {
177177
'reference:ID_Lists',
178178
])} currentId='' />
179179
</StarlightPage>
180+
181+
<style>
182+
.variants-table {
183+
display: block;
184+
overflow-x: auto;
185+
white-space: nowrap;
186+
}
187+
</style>

web/src/pages/reference/ID_Lists/Vending_Machines.astro

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ luaTable += `\n}\n`;
124124
tableOfContents: false,
125125
}}>
126126
<p>List of San Andreas Vending machine locations (each vending machine is an object):</p>
127-
<table>
127+
<table class="vending-table">
128128
<thead>
129129
<tr>
130130
<th>Model ID</th>
@@ -158,3 +158,11 @@ luaTable += `\n}\n`;
158158
'reference:ID_Lists',
159159
])} currentId='' />
160160
</StarlightPage>
161+
162+
<style>
163+
.vending-table {
164+
display: block;
165+
overflow-x: auto;
166+
white-space: nowrap;
167+
}
168+
</style>
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
4+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
5+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
6+
7+
import { Code } from '@astrojs/starlight/components';
8+
9+
import { Image } from 'astro:assets';
10+
import { getAssetImagePath } from '@src/utils/general';
11+
12+
import NoteBox from '@src/components/NoteBox.astro';
13+
14+
const weaponsBySlot = {
15+
0: [
16+
{ id: 0, name: 'Fist', type: 'Hand', modelId: null, sharingSlotAmmo: false, bulletSync: false },
17+
{ id: 1, name: 'Brass Knuckles', type: 'Hand', modelId: 331, sharingSlotAmmo: false, bulletSync: false }
18+
],
19+
}
20+
21+
---
22+
<StarlightPage frontmatter={{
23+
template: 'doc',
24+
title: 'Weapons',
25+
tableOfContents: false,
26+
}}>
27+
<p>Scripting functions that ask for a <strong>Weapon ID</strong> need an integer that refers to the GTASA weapon ID list. They are listed below. Each weapon corresponds to an object model in-game.</p>
28+
29+
<NoteBox type='info'>Weapon <strong>Name</strong> is compatible with functions <a href="/reference/getWeaponNameFromID">getWeaponNameFromID</a> and <a href="/reference/getWeaponIDFromName">getWeaponIDFromName</a>.</NoteBox>
30+
<NoteBox type='info'><strong>Bullet Sync</strong> refers to whether they are triggered by the <a href="/reference/onPlayerWeaponFire">onPlayerWeaponFire</a> event.</NoteBox>
31+
<NoteBox type='info'>For death reasons, especially in event handlers for <a href="/reference/onPlayerWasted">onPlayerWasted</a> or similar, also have a look at the <a href="/reference/ID_Lists/Damage_Types">Damage Types</a>.</NoteBox>
32+
<NoteBox type='info'>GTASA <a href="/reference/ID_Lists/Weapon_skill_levels">Weapon Stats</a> will affect movement, accuracy, damage, and dual wield capability. See <a href="/reference/setPedStat">setPedStat</a> to change these stats. The default MTA server package comes with a resource called "defaultStats" that sets GTASA weapon stats to 999. See the weapon stats link for more info.</NoteBox>
33+
<NoteBox type='info'>Clip size () denotes clip size when the weapon is dual wielded. Weapons without this specification are not dual wield weapons.</NoteBox>
34+
35+
<table class="weapon-table">
36+
<thead>
37+
<tr>
38+
<th>Slot</th>
39+
<th>Type</th>
40+
<th>Image</th>
41+
<th>Name</th>
42+
<th>ID</th>
43+
<th>Model ID</th>
44+
<th>Clip</th>
45+
<th>Sharing slot ammo</th>
46+
<th>Bullet Sync</th>
47+
</tr>
48+
</thead>
49+
<tbody>
50+
{Object.entries(weaponsBySlot).map(([slotId, weapons]) => (
51+
weapons.map((weapon) => (
52+
<tr>
53+
<td>{slotId}</td>
54+
<td>{weapon.type}</td>
55+
<td>
56+
<Image src={getAssetImagePath("Weapons/" + weapon.id + ".webp")} alt={weapon.name}
57+
class="weapon-image" />
58+
</td>
59+
<td>{weapon.name}</td>
60+
<td>{weapon.id}</td>
61+
<td>{weapon.modelId}</td>
62+
<td>{weapon.clipSize || '-'}</td>
63+
<td>{weapon.sharingSlotAmmo}</td>
64+
<td>{weapon.bulletSync ? 'Yes' : 'No'}</td>
65+
</tr>
66+
))
67+
))}
68+
</tbody>
69+
</table>
70+
71+
<section data-pagefind-ignore>
72+
<h5>Lua tables with weapons:</h5>
73+
<Code lang="lua" code={`
74+
local weaponIDs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 22, 23, 24, 25, 26, 27, 28, 29, 32, 30, 31, 33, 34, 35, 36, 37, 38, 16, 17, 18, 39, 41, 42, 43, 10, 11, 12, 13, 14, 15, 44, 45, 46, 40}
75+
local weaponIDsBySlot = {
76+
[0] = {0, 1}, -- hand
77+
[1] = {2, 3, 4, 5, 6, 7, 8, 9}, -- melee
78+
[2] = {22, 23, 24}, -- handguns
79+
[3] = {25, 26, 27}, -- shotguns
80+
[4] = {28, 29, 32}, -- sub-machine guns
81+
[5] = {30, 31}, -- assault rifles
82+
[6] = {33, 34}, -- rifles
83+
[7] = {35, 36, 37, 38}, -- heavy weapons
84+
[8] = {16, 17, 18, 39}, -- projectiles
85+
[9] = {41, 42, 43}, -- special 1
86+
[10] = {10, 11, 12, 13, 14, 15}, -- gifts
87+
[11] = {44, 45, 46}, -- special 2
88+
[12] = {40}, -- satchel detonator
89+
}`} />
90+
</section>
91+
92+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
93+
'reference:ID_Lists',
94+
])} currentId='' />
95+
</StarlightPage>
96+
97+
<style>
98+
.weapon-table {
99+
display: block;
100+
overflow-x: auto;
101+
white-space: nowrap;
102+
}
103+
.weapon-image {
104+
max-width: 50px;
105+
height: auto;
106+
}
107+
</style>

web/src/pages/reference/ID_Lists/index.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
2525
</li>
2626
<li>🥤 <a href="/reference/ID_Lists/Vending_Machines">Vending Machines</a></li>
2727
<li>⛅ <a href="/reference/ID_Lists/Weather">Weather</a></li>
28+
<li>🔫 <a href="/reference/ID_Lists/Weapons">Weapons</a></li>
2829
</ul>
2930

3031
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([

0 commit comments

Comments
 (0)