Skip to content

Commit 45b33e7

Browse files
ID Lists: add Damage Types and Garages
1 parent b78e2ac commit 45b33e7

File tree

6 files changed

+443
-433
lines changed

6 files changed

+443
-433
lines changed

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

Lines changed: 0 additions & 97 deletions
This file was deleted.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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+
const boneMap: { [id: number]: string } = {
13+
0: "BONE_ROOT",
14+
1: "BONE_PELVIS1",
15+
2: "BONE_PELVIS",
16+
3: "BONE_SPINE1",
17+
4: "BONE_UPPERTORSO",
18+
5: "BONE_NECK",
19+
6: "BONE_HEAD2",
20+
7: "BONE_HEAD1",
21+
8: "BONE_HEAD",
22+
21: "BONE_RIGHTUPPERTORSO",
23+
22: "BONE_RIGHTSHOULDER",
24+
23: "BONE_RIGHTELBOW",
25+
24: "BONE_RIGHTWRIST",
26+
25: "BONE_RIGHTHAND",
27+
26: "BONE_RIGHTTHUMB",
28+
31: "BONE_LEFTUPPERTORSO",
29+
32: "BONE_LEFTSHOULDER",
30+
33: "BONE_LEFTELBOW",
31+
34: "BONE_LEFTWRIST",
32+
35: "BONE_LEFTHAND",
33+
36: "BONE_LEFTTHUMB",
34+
41: "BONE_LEFTHIP",
35+
42: "BONE_LEFTKNEE",
36+
43: "BONE_LEFTANKLE",
37+
44: "BONE_LEFTFOOT",
38+
51: "BONE_RIGHTHIP",
39+
52: "BONE_RIGHTKNEE",
40+
53: "BONE_RIGHTANKLE",
41+
54: "BONE_RIGHTFOOT",
42+
201: "BONE_BELLY",
43+
301: "BONE_RIGHTBREAST",
44+
302: "BONE_LEFTBREAST",
45+
};
46+
47+
let luaTable = `local boneIDs = {\n`;
48+
Object.entries(boneMap).forEach(([id], index) => {
49+
luaTable += `${id}`;
50+
if ((index + 1) % 8 === 0) {
51+
luaTable += `\n`;
52+
} else {
53+
luaTable += `, `;
54+
}
55+
});
56+
luaTable += `}`;
57+
58+
let luaTableNames = `local boneNames = {\n`;
59+
Object.entries(boneMap).forEach(([id, name]) => {
60+
luaTableNames += `[${id}] = "${name}",\n`;
61+
});
62+
luaTableNames += `}`;
63+
64+
65+
---
66+
<StarlightPage frontmatter={{
67+
template: 'doc',
68+
title: 'Bone IDs',
69+
tableOfContents: false,
70+
}}>
71+
<p>List of all ped <strong>Bone IDs</strong> that can be used with functions such as <a href="/reference/getElementBonePosition">getElementBonePosition</a>.</p>
72+
73+
<div class="bonesbox">
74+
<ul>
75+
{Object.entries(boneMap).map(([id, name]) => (
76+
<li>
77+
<strong>{id}</strong> - <code>{name}</code>
78+
</li>
79+
))}
80+
</ul>
81+
82+
<Image class="bonesimage" src={getAssetImagePath("Bones/bone_ids.webp")} alt="Labeled Bone IDs" width="150"/>
83+
</div>
84+
85+
<h4>Lua tables of these Bone IDs:</h4>
86+
87+
<Code lang="lua" code={luaTable}/>
88+
<Code lang="lua" code={luaTableNames}/>
89+
90+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
91+
'reference:ID_Lists',
92+
])} currentId='' />
93+
</StarlightPage>
94+
95+
<style>
96+
.bonesbox {
97+
margin-top: 2rem;
98+
display: flex;
99+
align-items: flex-start;
100+
flex-direction: row;
101+
gap: 2rem;
102+
}
103+
.bonesimage {
104+
max-width: 100%;
105+
height: auto;
106+
object-fit: contain;
107+
}
108+
109+
.bonesbox ul {
110+
list-style-type: none;
111+
padding: 0;
112+
}
113+
114+
.bonesbox li {
115+
margin-bottom: 0.5rem;
116+
}
117+
</style>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
const damageTypesById: Record<number, { type: string; info?: string }> = {
10+
19: { type: "Rocket", info: "Actual damage type when damaged from a rocket launcher" },
11+
37: { type: "Burnt", info: "This is used by a damage by fire, even when the fire is created by a rocket explosion or a molotov" },
12+
49: { type: "Rammed" },
13+
50: { type: "Ranover", info: "This is also called when damaged because of helicopter blades" },
14+
51: { type: "Explosion", info: "This may sometimes also be used at an indirect damage through an exploding rocket" },
15+
52: { type: "Driveby", info: "This is NOT used for a driveby kill with e.g. the 'realdriveby' resource" },
16+
53: { type: "Drowned" },
17+
54: { type: "Fall" },
18+
55: { type: "Unknown", info: "No known information about this damage type" },
19+
56: { type: "Melee", info: "Seems to be never called (?); for an actual melee damage, the fist weapon ID (0) is used" },
20+
57: { type: "Weapon", info: "Seems to be never called (?)" },
21+
59: { type: "Tank Grenade" },
22+
63: { type: "Blown", info: "Actual damage type when dying in a vehicle explosion" }
23+
};
24+
25+
26+
let luaTable = `local damageTypes = {\n`;
27+
Object.entries(damageTypesById).forEach(([id, { type, info }], index) => {
28+
luaTable += `\t[${id}] = "${type}"`;
29+
if (info) {
30+
luaTable += `, -- ${info}`;
31+
}
32+
luaTable += `\n`;
33+
});
34+
luaTable += `}`;
35+
36+
---
37+
<StarlightPage frontmatter={{
38+
template: 'doc',
39+
title: 'Damage Types',
40+
tableOfContents: false,
41+
}}>
42+
<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>
43+
44+
<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>
46+
<thead>
47+
<tr>
48+
<th>ID</th>
49+
<th>Damage Type</th>
50+
<th>Additional Info</th>
51+
</tr>
52+
</thead>
53+
<tbody>
54+
{Object.entries(damageTypesById).map(([id, { type, info }]) => (
55+
<tr>
56+
<td>{id}</td>
57+
<td>{type}</td>
58+
<td>{info || ''}</td>
59+
</tr>
60+
))}
61+
</tbody>
62+
</table>
63+
<h4>Damage types in a Lua table: :</h4>
64+
65+
<Code lang="lua" code={luaTable}/>
66+
67+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
68+
'reference:ID_Lists',
69+
])} currentId='' />
70+
</StarlightPage>

0 commit comments

Comments
 (0)