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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
//! `INPCComponent` — generated by `cargo xtask gen-omp` from `Server/Components/NPCs/npcs.hpp`.
//! Implemented by `NPCComponent` in the server's `NPCs`.
//!
//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
//! regenerate. Slots are clang's layout of the header for each ABI, checked
//! against the official binaries by `cargo xtask check-abi --generated`.
#![allow(unused_imports)]
use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
use crate::omp::types::{
Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
UID, Vector2, Vector3, Vector4, WorldTimePoint,
};
use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
use crate::omp::*;
opaque! {
/// Opaque handle for `INPCComponent*`.
pub INPCComponent;
}
/// `NPCComponent_UID` in `Server/Components/NPCs/npcs.hpp`.
pub const NPCS_COMPONENT_UID: UID = 0x3d0e59e87f4e90bc;
impl ComponentInterface for INPCComponent {
const UID: UID = NPCS_COMPONENT_UID;
// `IComponent` is not this interface's first base.
#[cfg(not(target_env = "msvc"))]
const COMPONENT_OFFSET: isize = 4;
#[cfg(target_env = "msvc")]
const COMPONENT_OFFSET: isize = 8;
}
slots! {
/// `IEventDispatcher<NPCEventHandler> & INPCComponent::getEventDispatcher()`
SLOT_GET_EVENT_DISPATCHER: usize = 8, 7;
/// `INPC * INPCComponent::create(StringView)`
SLOT_CREATE: usize = 9, 8;
/// `void INPCComponent::destroy(INPC &)`
SLOT_DESTROY: usize = 10, 9;
/// `int INPCComponent::createPath()`
SLOT_CREATE_PATH: usize = 11, 10;
/// `bool INPCComponent::destroyPath(int)`
SLOT_DESTROY_PATH: usize = 12, 11;
/// `void INPCComponent::destroyAllPaths()`
SLOT_DESTROY_ALL_PATHS: usize = 13, 12;
/// `size_t INPCComponent::getPathCount()`
SLOT_GET_PATH_COUNT: usize = 14, 13;
/// `bool INPCComponent::addPointToPath(int, const Vector3 &, float)`
SLOT_ADD_POINT_TO_PATH: usize = 15, 14;
/// `bool INPCComponent::removePointFromPath(int, size_t)`
SLOT_REMOVE_POINT_FROM_PATH: usize = 16, 15;
/// `bool INPCComponent::clearPath(int)`
SLOT_CLEAR_PATH: usize = 17, 16;
/// `size_t INPCComponent::getPathPointCount(int)`
SLOT_GET_PATH_POINT_COUNT: usize = 18, 17;
/// `bool INPCComponent::getPathPoint(int, size_t, Vector3 &, float &)`
SLOT_GET_PATH_POINT: usize = 19, 18;
/// `bool INPCComponent::hasPathPointInRange(int, const Vector3 &, float)`
SLOT_HAS_PATH_POINT_IN_RANGE: usize = 20, 19;
/// `bool INPCComponent::isValidPath(int)`
SLOT_IS_VALID_PATH: usize = 21, 20;
/// `int INPCComponent::loadRecord(StringView)`
SLOT_LOAD_RECORD: usize = 22, 21;
/// `bool INPCComponent::unloadRecord(int)`
SLOT_UNLOAD_RECORD: usize = 23, 22;
/// `bool INPCComponent::isValidRecord(int)`
SLOT_IS_VALID_RECORD: usize = 24, 23;
/// `size_t INPCComponent::getRecordCount()`
SLOT_GET_RECORD_COUNT: usize = 25, 24;
/// `void INPCComponent::unloadAllRecords()`
SLOT_UNLOAD_ALL_RECORDS: usize = 26, 25;
/// `bool INPCComponent::openNode(int)`
SLOT_OPEN_NODE: usize = 27, 26;
/// `void INPCComponent::closeNode(int)`
SLOT_CLOSE_NODE: usize = 28, 27;
/// `bool INPCComponent::isNodeOpen(int)`
SLOT_IS_NODE_OPEN: usize = 29, 28;
/// `uint8_t INPCComponent::getNodeType(int)`
SLOT_GET_NODE_TYPE: usize = 30, 29;
/// `bool INPCComponent::setNodePoint(int, uint16_t)`
SLOT_SET_NODE_POINT: usize = 31, 30;
/// `bool INPCComponent::getNodePointPosition(int, Vector3 &)`
SLOT_GET_NODE_POINT_POSITION: usize = 32, 31;
/// `int INPCComponent::getNodePointCount(int)`
SLOT_GET_NODE_POINT_COUNT: usize = 33, 32;
/// `bool INPCComponent::getNodeInfo(int, uint32_t &, uint32_t &, uint32_t &)`
SLOT_GET_NODE_INFO: usize = 34, 33;
}
virtual_fns! {
/// `IEventDispatcher<NPCEventHandler> & INPCComponent::getEventDispatcher()`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_event_dispatcher(
component: INPCComponent,
) -> *mut EventDispatcher<NPCHandler> = [0, SLOT_GET_EVENT_DISPATCHER] or std::ptr::null_mut();
/// `INPC * INPCComponent::create(StringView)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_create(
component: INPCComponent,
name: StringView,
) -> *mut INPC = [0, SLOT_CREATE] or std::ptr::null_mut();
/// `void INPCComponent::destroy(INPC &)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
pub fn npcs_destroy(component: INPCComponent, npc: *mut INPC) = [0, SLOT_DESTROY];
/// `int INPCComponent::createPath()`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_create_path(component: INPCComponent) -> i32 = [0, SLOT_CREATE_PATH] or 0;
/// `bool INPCComponent::destroyPath(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_destroy_path(
component: INPCComponent,
path_id: i32,
) -> bool = [0, SLOT_DESTROY_PATH] or false;
/// `void INPCComponent::destroyAllPaths()`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
pub fn npcs_destroy_all_paths(component: INPCComponent) = [0, SLOT_DESTROY_ALL_PATHS];
/// `size_t INPCComponent::getPathCount()`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_path_count(component: INPCComponent) -> usize = [0, SLOT_GET_PATH_COUNT] or 0;
/// `bool INPCComponent::addPointToPath(int, const Vector3 &, float)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_add_point_to_path(
component: INPCComponent,
path_id: i32,
position: &Vector3,
stop_range: f32,
) -> bool = [0, SLOT_ADD_POINT_TO_PATH] or false;
/// `bool INPCComponent::removePointFromPath(int, size_t)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_remove_point_from_path(
component: INPCComponent,
path_id: i32,
point_index: usize,
) -> bool = [0, SLOT_REMOVE_POINT_FROM_PATH] or false;
/// `bool INPCComponent::clearPath(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_clear_path(
component: INPCComponent,
path_id: i32,
) -> bool = [0, SLOT_CLEAR_PATH] or false;
/// `size_t INPCComponent::getPathPointCount(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_path_point_count(
component: INPCComponent,
path_id: i32,
) -> usize = [0, SLOT_GET_PATH_POINT_COUNT] or 0;
/// `bool INPCComponent::getPathPoint(int, size_t, Vector3 &, float &)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_path_point(
component: INPCComponent,
path_id: i32,
point_index: usize,
position: &mut Vector3,
stop_range: &mut f32,
) -> bool = [0, SLOT_GET_PATH_POINT] or false;
/// `bool INPCComponent::hasPathPointInRange(int, const Vector3 &, float)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_has_path_point_in_range(
component: INPCComponent,
path_id: i32,
position: &Vector3,
radius: f32,
) -> bool = [0, SLOT_HAS_PATH_POINT_IN_RANGE] or false;
/// `bool INPCComponent::isValidPath(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_is_valid_path(
component: INPCComponent,
path_id: i32,
) -> bool = [0, SLOT_IS_VALID_PATH] or false;
/// `int INPCComponent::loadRecord(StringView)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_load_record(
component: INPCComponent,
file_path: StringView,
) -> i32 = [0, SLOT_LOAD_RECORD] or 0;
/// `bool INPCComponent::unloadRecord(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_unload_record(
component: INPCComponent,
record_id: i32,
) -> bool = [0, SLOT_UNLOAD_RECORD] or false;
/// `bool INPCComponent::isValidRecord(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_is_valid_record(
component: INPCComponent,
record_id: i32,
) -> bool = [0, SLOT_IS_VALID_RECORD] or false;
/// `size_t INPCComponent::getRecordCount()`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_record_count(component: INPCComponent) -> usize = [0, SLOT_GET_RECORD_COUNT] or 0;
/// `void INPCComponent::unloadAllRecords()`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
pub fn npcs_unload_all_records(component: INPCComponent) = [0, SLOT_UNLOAD_ALL_RECORDS];
/// `bool INPCComponent::openNode(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_open_node(
component: INPCComponent,
node_id: i32,
) -> bool = [0, SLOT_OPEN_NODE] or false;
/// `void INPCComponent::closeNode(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
pub fn npcs_close_node(component: INPCComponent, node_id: i32) = [0, SLOT_CLOSE_NODE];
/// `bool INPCComponent::isNodeOpen(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_is_node_open(
component: INPCComponent,
node_id: i32,
) -> bool = [0, SLOT_IS_NODE_OPEN] or false;
/// `uint8_t INPCComponent::getNodeType(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_node_type(
component: INPCComponent,
node_id: i32,
) -> u8 = [0, SLOT_GET_NODE_TYPE] or 0;
/// `bool INPCComponent::setNodePoint(int, uint16_t)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_set_node_point(
component: INPCComponent,
node_id: i32,
point_id: u16,
) -> bool = [0, SLOT_SET_NODE_POINT] or false;
/// `bool INPCComponent::getNodePointPosition(int, Vector3 &)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_node_point_position(
component: INPCComponent,
node_id: i32,
position: &mut Vector3,
) -> bool = [0, SLOT_GET_NODE_POINT_POSITION] or false;
/// `int INPCComponent::getNodePointCount(int)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_node_point_count(
component: INPCComponent,
node_id: i32,
) -> i32 = [0, SLOT_GET_NODE_POINT_COUNT] or 0;
/// `bool INPCComponent::getNodeInfo(int, uint32_t &, uint32_t &, uint32_t &)`.
///
/// # Safety
/// `component` must be a live `INPCComponent`.
#[must_use]
pub fn npcs_node_info(
component: INPCComponent,
node_id: i32,
vehicle_nodes: &mut u32,
ped_nodes: &mut u32,
navi_nodes: &mut u32,
) -> bool = [0, SLOT_GET_NODE_INFO] or false;
}