-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefs.ts
More file actions
211 lines (195 loc) · 4.4 KB
/
Defs.ts
File metadata and controls
211 lines (195 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
import {
attn,
channel,
content,
effect,
flags,
hull,
modelFlags,
moveType,
solid,
waterlevel,
} from '../../shared/Defs.ts';
export {
attn,
channel,
content,
effect,
flags,
hull,
modelFlags,
moveType,
solid,
waterlevel,
};
/**
* Range values.
*/
export enum range {
RANGE_MELEE = 0,
RANGE_NEAR = 1,
RANGE_MID = 2,
RANGE_FAR = 3,
}
/**
* Deadflag values.
*/
export enum dead {
DEAD_NO = 0,
DEAD_DYING = 1,
DEAD_DEAD = 2,
DEAD_RESPAWNABLE = 3,
}
/**
* Takedamage values.
*/
export enum damage {
DAMAGE_NO = 0,
DAMAGE_YES = 1,
DAMAGE_AIM = 2,
}
/**
* Player items and weapons.
*/
export enum items {
IT_AXE = 4096,
IT_SHOTGUN = 1,
IT_SUPER_SHOTGUN = 2,
IT_NAILGUN = 4,
IT_SUPER_NAILGUN = 8,
IT_GRENADE_LAUNCHER = 16,
IT_ROCKET_LAUNCHER = 32,
IT_LIGHTNING = 64,
IT_KEY1 = 131072,
IT_KEY2 = 262144,
IT_INVISIBILITY = 524288,
IT_INVULNERABILITY = 1048576,
IT_SUIT = 2097152,
IT_QUAD = 4194304,
IT_SHELLS = 256,
IT_NAILS = 512,
IT_ROCKETS = 1024,
IT_CELLS = 2048,
IT_ARMOR1 = 8192,
IT_ARMOR2 = 16384,
IT_ARMOR3 = 32768,
IT_SUPERHEALTH = 65536,
IT_SIGIL1 = 1 << 26,
IT_SIGIL2 = 1 << 27,
IT_SIGIL3 = 1 << 28,
IT_SIGIL4 = 1 << 29,
}
const itemValues = Object.values(items).filter((value): value is items => typeof value === 'number');
/** All items combined into a single bitmask. */
export const allItems = itemValues.reduce((accumulator, value) => accumulator | value, 0);
export const deathType = Object.freeze({
NONE: null,
FALLING: 'falling',
} as const);
/**
* Worldspawn worldtype values.
*/
export enum worldType {
MEDIEVAL = 0,
RUNES = 1,
BASE = 2,
}
/**
* Temporary entity types used for client-side transient effects.
*/
export enum tentType {
TE_SPIKE = 0,
TE_SUPERSPIKE = 1,
TE_GUNSHOT = 2,
TE_EXPLOSION = 3,
TE_TAREXPLOSION = 4,
TE_LIGHTNING1 = 5,
TE_LIGHTNING2 = 6,
TE_WIZSPIKE = 7,
TE_KNIGHTSPIKE = 8,
TE_LIGHTNING3 = 9,
TE_LAVASPLASH = 10,
TE_TELEPORT = 11,
}
/**
* Indexed palette colors used by gore and HUD effects.
*/
export const colors = Object.freeze({
DUST: 0,
BLOOD: 73,
FIRE: 75,
SPARK: 225,
HUD_AMMO_NORMAL: 240,
HUD_AMMO_WARNING: 250,
HUD_CSHIFT_BONUSFLASH: 192,
HUD_CSHIFT_DAMAGE: 193,
HUD_CSHIFT_SECRET: 128,
HUD_CSHIFT_POWERUP_QUAD: 208,
HUD_CSHIFT_POWERUP_INVULN: 250,
HUD_CSHIFT_POWERUP_SUIT: 192,
HUD_CSHIFT_POWERUP_INVIS: 15,
HUD_RANKING_TEXT: 240,
HUD_RANKING_BACKGROUND: 16,
});
/**
* Spawnflag bit values.
*/
export enum spawnflags {
SPAWNFLAG_NOT_EASY = 256,
SPAWNFLAG_NOT_MEDIUM = 512,
SPAWNFLAG_NOT_HARD = 1024,
SPAWNFLAG_NOT_DEATHMATCH = 2048,
}
/**
* Decal identifiers.
*/
export enum decals {
DECAL_BULLETHOLE = 1,
DECAL_AXEHIT = 2,
}
/**
* Client event opcodes emitted by the game code.
* Custom client events should use opcodes above 100 to avoid conflicts with built-in events.
*/
export enum clientEvent {
/** brief HUD bonus flash (void) */
BONUS_FLASH = 1,
/** HUD damage flash (void) @deprecated use DAMAGE_RECEIVED instead */
DAMAGE_FLASH = 2,
/** stats updated (slot: string, value: number, sourceEdict?: ServerEdict|number) */
STATS_UPDATED = 3,
/** stats initialized (slot: string, value: number) */
STATS_INIT = 4,
/** notify item pick up (itemEntity: object|null, itemNames: string[], netname: string|null, pickupItems: number) */
ITEM_PICKED = 5,
/** change the active weapon (weapon: number) */
WEAPON_SELECTED = 6,
/** report a player kill (victimEdictId: number|null, attackerEdictId: number|null, weapon: number, items: number) */
OBITUARY = 7,
/** start intermission (message: string|null, origin: Vector, angles: Vector) */
INTERMISSION_START = 8,
/** place a decal (origin: Vector, normal: Vector, texture: decals) */
EMIT_DECAL = 9,
/** arbitrary HUD message (message: string, color: Vector, duration: number) */
HUD_MESSAGE = 10,
/** damage received (damageReceived: number, armorLost: number, attackOrigin: Vector) */
DAMAGE_RECEIVED = 11,
/** test hook; arbitrary arguments (any...) */
TEST_EVENT = 254,
}
/**
* Return the client event bus topic for a client event opcode.
* @returns The client event topic string.
*/
export function clientEventName(eventId: number): string {
return `client.event-received.${eventId}`;
}
/**
* Content shift slots used by the client HUD.
*/
export enum contentShift {
damage = 0,
bonus = 1,
powerup = 2,
info = 3,
}