samp_sdk/omp/generated/npcs.rs
1//! `INPCComponent` — generated by `cargo xtask gen-omp` from `Server/Components/NPCs/npcs.hpp`.
2//! Implemented by `NPCComponent` in the server's `NPCs`.
3//!
4//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
5//! regenerate. Slots are clang's layout of the header for each ABI, checked
6//! against the official binaries by `cargo xtask check-abi --generated`.
7
8#![allow(unused_imports)]
9
10use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
11use crate::omp::types::{
12 Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
13 UID, Vector2, Vector3, Vector4, WorldTimePoint,
14};
15use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
16use crate::omp::*;
17
18opaque! {
19 /// Opaque handle for `INPCComponent*`.
20 pub INPCComponent;
21}
22
23/// `NPCComponent_UID` in `Server/Components/NPCs/npcs.hpp`.
24pub const NPCS_COMPONENT_UID: UID = 0x3d0e59e87f4e90bc;
25
26impl ComponentInterface for INPCComponent {
27 const UID: UID = NPCS_COMPONENT_UID;
28 // `IComponent` is not this interface's first base.
29 #[cfg(not(target_env = "msvc"))]
30 const COMPONENT_OFFSET: isize = 4;
31 #[cfg(target_env = "msvc")]
32 const COMPONENT_OFFSET: isize = 8;
33}
34
35slots! {
36 /// `IEventDispatcher<NPCEventHandler> & INPCComponent::getEventDispatcher()`
37 SLOT_GET_EVENT_DISPATCHER: usize = 8, 7;
38 /// `INPC * INPCComponent::create(StringView)`
39 SLOT_CREATE: usize = 9, 8;
40 /// `void INPCComponent::destroy(INPC &)`
41 SLOT_DESTROY: usize = 10, 9;
42 /// `int INPCComponent::createPath()`
43 SLOT_CREATE_PATH: usize = 11, 10;
44 /// `bool INPCComponent::destroyPath(int)`
45 SLOT_DESTROY_PATH: usize = 12, 11;
46 /// `void INPCComponent::destroyAllPaths()`
47 SLOT_DESTROY_ALL_PATHS: usize = 13, 12;
48 /// `size_t INPCComponent::getPathCount()`
49 SLOT_GET_PATH_COUNT: usize = 14, 13;
50 /// `bool INPCComponent::addPointToPath(int, const Vector3 &, float)`
51 SLOT_ADD_POINT_TO_PATH: usize = 15, 14;
52 /// `bool INPCComponent::removePointFromPath(int, size_t)`
53 SLOT_REMOVE_POINT_FROM_PATH: usize = 16, 15;
54 /// `bool INPCComponent::clearPath(int)`
55 SLOT_CLEAR_PATH: usize = 17, 16;
56 /// `size_t INPCComponent::getPathPointCount(int)`
57 SLOT_GET_PATH_POINT_COUNT: usize = 18, 17;
58 /// `bool INPCComponent::getPathPoint(int, size_t, Vector3 &, float &)`
59 SLOT_GET_PATH_POINT: usize = 19, 18;
60 /// `bool INPCComponent::hasPathPointInRange(int, const Vector3 &, float)`
61 SLOT_HAS_PATH_POINT_IN_RANGE: usize = 20, 19;
62 /// `bool INPCComponent::isValidPath(int)`
63 SLOT_IS_VALID_PATH: usize = 21, 20;
64 /// `int INPCComponent::loadRecord(StringView)`
65 SLOT_LOAD_RECORD: usize = 22, 21;
66 /// `bool INPCComponent::unloadRecord(int)`
67 SLOT_UNLOAD_RECORD: usize = 23, 22;
68 /// `bool INPCComponent::isValidRecord(int)`
69 SLOT_IS_VALID_RECORD: usize = 24, 23;
70 /// `size_t INPCComponent::getRecordCount()`
71 SLOT_GET_RECORD_COUNT: usize = 25, 24;
72 /// `void INPCComponent::unloadAllRecords()`
73 SLOT_UNLOAD_ALL_RECORDS: usize = 26, 25;
74 /// `bool INPCComponent::openNode(int)`
75 SLOT_OPEN_NODE: usize = 27, 26;
76 /// `void INPCComponent::closeNode(int)`
77 SLOT_CLOSE_NODE: usize = 28, 27;
78 /// `bool INPCComponent::isNodeOpen(int)`
79 SLOT_IS_NODE_OPEN: usize = 29, 28;
80 /// `uint8_t INPCComponent::getNodeType(int)`
81 SLOT_GET_NODE_TYPE: usize = 30, 29;
82 /// `bool INPCComponent::setNodePoint(int, uint16_t)`
83 SLOT_SET_NODE_POINT: usize = 31, 30;
84 /// `bool INPCComponent::getNodePointPosition(int, Vector3 &)`
85 SLOT_GET_NODE_POINT_POSITION: usize = 32, 31;
86 /// `int INPCComponent::getNodePointCount(int)`
87 SLOT_GET_NODE_POINT_COUNT: usize = 33, 32;
88 /// `bool INPCComponent::getNodeInfo(int, uint32_t &, uint32_t &, uint32_t &)`
89 SLOT_GET_NODE_INFO: usize = 34, 33;
90}
91
92virtual_fns! {
93 /// `IEventDispatcher<NPCEventHandler> & INPCComponent::getEventDispatcher()`.
94 ///
95 /// # Safety
96 /// `component` must be a live `INPCComponent`.
97 #[must_use]
98 pub fn npcs_event_dispatcher(
99 component: INPCComponent,
100 ) -> *mut EventDispatcher<NPCHandler> = [0, SLOT_GET_EVENT_DISPATCHER] or std::ptr::null_mut();
101
102 /// `INPC * INPCComponent::create(StringView)`.
103 ///
104 /// # Safety
105 /// `component` must be a live `INPCComponent`.
106 #[must_use]
107 pub fn npcs_create(
108 component: INPCComponent,
109 name: StringView,
110 ) -> *mut INPC = [0, SLOT_CREATE] or std::ptr::null_mut();
111
112 /// `void INPCComponent::destroy(INPC &)`.
113 ///
114 /// # Safety
115 /// `component` must be a live `INPCComponent`.
116 pub fn npcs_destroy(component: INPCComponent, npc: *mut INPC) = [0, SLOT_DESTROY];
117
118 /// `int INPCComponent::createPath()`.
119 ///
120 /// # Safety
121 /// `component` must be a live `INPCComponent`.
122 #[must_use]
123 pub fn npcs_create_path(component: INPCComponent) -> i32 = [0, SLOT_CREATE_PATH] or 0;
124
125 /// `bool INPCComponent::destroyPath(int)`.
126 ///
127 /// # Safety
128 /// `component` must be a live `INPCComponent`.
129 #[must_use]
130 pub fn npcs_destroy_path(
131 component: INPCComponent,
132 path_id: i32,
133 ) -> bool = [0, SLOT_DESTROY_PATH] or false;
134
135 /// `void INPCComponent::destroyAllPaths()`.
136 ///
137 /// # Safety
138 /// `component` must be a live `INPCComponent`.
139 pub fn npcs_destroy_all_paths(component: INPCComponent) = [0, SLOT_DESTROY_ALL_PATHS];
140
141 /// `size_t INPCComponent::getPathCount()`.
142 ///
143 /// # Safety
144 /// `component` must be a live `INPCComponent`.
145 #[must_use]
146 pub fn npcs_path_count(component: INPCComponent) -> usize = [0, SLOT_GET_PATH_COUNT] or 0;
147
148 /// `bool INPCComponent::addPointToPath(int, const Vector3 &, float)`.
149 ///
150 /// # Safety
151 /// `component` must be a live `INPCComponent`.
152 #[must_use]
153 pub fn npcs_add_point_to_path(
154 component: INPCComponent,
155 path_id: i32,
156 position: &Vector3,
157 stop_range: f32,
158 ) -> bool = [0, SLOT_ADD_POINT_TO_PATH] or false;
159
160 /// `bool INPCComponent::removePointFromPath(int, size_t)`.
161 ///
162 /// # Safety
163 /// `component` must be a live `INPCComponent`.
164 #[must_use]
165 pub fn npcs_remove_point_from_path(
166 component: INPCComponent,
167 path_id: i32,
168 point_index: usize,
169 ) -> bool = [0, SLOT_REMOVE_POINT_FROM_PATH] or false;
170
171 /// `bool INPCComponent::clearPath(int)`.
172 ///
173 /// # Safety
174 /// `component` must be a live `INPCComponent`.
175 #[must_use]
176 pub fn npcs_clear_path(
177 component: INPCComponent,
178 path_id: i32,
179 ) -> bool = [0, SLOT_CLEAR_PATH] or false;
180
181 /// `size_t INPCComponent::getPathPointCount(int)`.
182 ///
183 /// # Safety
184 /// `component` must be a live `INPCComponent`.
185 #[must_use]
186 pub fn npcs_path_point_count(
187 component: INPCComponent,
188 path_id: i32,
189 ) -> usize = [0, SLOT_GET_PATH_POINT_COUNT] or 0;
190
191 /// `bool INPCComponent::getPathPoint(int, size_t, Vector3 &, float &)`.
192 ///
193 /// # Safety
194 /// `component` must be a live `INPCComponent`.
195 #[must_use]
196 pub fn npcs_path_point(
197 component: INPCComponent,
198 path_id: i32,
199 point_index: usize,
200 position: &mut Vector3,
201 stop_range: &mut f32,
202 ) -> bool = [0, SLOT_GET_PATH_POINT] or false;
203
204 /// `bool INPCComponent::hasPathPointInRange(int, const Vector3 &, float)`.
205 ///
206 /// # Safety
207 /// `component` must be a live `INPCComponent`.
208 #[must_use]
209 pub fn npcs_has_path_point_in_range(
210 component: INPCComponent,
211 path_id: i32,
212 position: &Vector3,
213 radius: f32,
214 ) -> bool = [0, SLOT_HAS_PATH_POINT_IN_RANGE] or false;
215
216 /// `bool INPCComponent::isValidPath(int)`.
217 ///
218 /// # Safety
219 /// `component` must be a live `INPCComponent`.
220 #[must_use]
221 pub fn npcs_is_valid_path(
222 component: INPCComponent,
223 path_id: i32,
224 ) -> bool = [0, SLOT_IS_VALID_PATH] or false;
225
226 /// `int INPCComponent::loadRecord(StringView)`.
227 ///
228 /// # Safety
229 /// `component` must be a live `INPCComponent`.
230 #[must_use]
231 pub fn npcs_load_record(
232 component: INPCComponent,
233 file_path: StringView,
234 ) -> i32 = [0, SLOT_LOAD_RECORD] or 0;
235
236 /// `bool INPCComponent::unloadRecord(int)`.
237 ///
238 /// # Safety
239 /// `component` must be a live `INPCComponent`.
240 #[must_use]
241 pub fn npcs_unload_record(
242 component: INPCComponent,
243 record_id: i32,
244 ) -> bool = [0, SLOT_UNLOAD_RECORD] or false;
245
246 /// `bool INPCComponent::isValidRecord(int)`.
247 ///
248 /// # Safety
249 /// `component` must be a live `INPCComponent`.
250 #[must_use]
251 pub fn npcs_is_valid_record(
252 component: INPCComponent,
253 record_id: i32,
254 ) -> bool = [0, SLOT_IS_VALID_RECORD] or false;
255
256 /// `size_t INPCComponent::getRecordCount()`.
257 ///
258 /// # Safety
259 /// `component` must be a live `INPCComponent`.
260 #[must_use]
261 pub fn npcs_record_count(component: INPCComponent) -> usize = [0, SLOT_GET_RECORD_COUNT] or 0;
262
263 /// `void INPCComponent::unloadAllRecords()`.
264 ///
265 /// # Safety
266 /// `component` must be a live `INPCComponent`.
267 pub fn npcs_unload_all_records(component: INPCComponent) = [0, SLOT_UNLOAD_ALL_RECORDS];
268
269 /// `bool INPCComponent::openNode(int)`.
270 ///
271 /// # Safety
272 /// `component` must be a live `INPCComponent`.
273 #[must_use]
274 pub fn npcs_open_node(
275 component: INPCComponent,
276 node_id: i32,
277 ) -> bool = [0, SLOT_OPEN_NODE] or false;
278
279 /// `void INPCComponent::closeNode(int)`.
280 ///
281 /// # Safety
282 /// `component` must be a live `INPCComponent`.
283 pub fn npcs_close_node(component: INPCComponent, node_id: i32) = [0, SLOT_CLOSE_NODE];
284
285 /// `bool INPCComponent::isNodeOpen(int)`.
286 ///
287 /// # Safety
288 /// `component` must be a live `INPCComponent`.
289 #[must_use]
290 pub fn npcs_is_node_open(
291 component: INPCComponent,
292 node_id: i32,
293 ) -> bool = [0, SLOT_IS_NODE_OPEN] or false;
294
295 /// `uint8_t INPCComponent::getNodeType(int)`.
296 ///
297 /// # Safety
298 /// `component` must be a live `INPCComponent`.
299 #[must_use]
300 pub fn npcs_node_type(
301 component: INPCComponent,
302 node_id: i32,
303 ) -> u8 = [0, SLOT_GET_NODE_TYPE] or 0;
304
305 /// `bool INPCComponent::setNodePoint(int, uint16_t)`.
306 ///
307 /// # Safety
308 /// `component` must be a live `INPCComponent`.
309 #[must_use]
310 pub fn npcs_set_node_point(
311 component: INPCComponent,
312 node_id: i32,
313 point_id: u16,
314 ) -> bool = [0, SLOT_SET_NODE_POINT] or false;
315
316 /// `bool INPCComponent::getNodePointPosition(int, Vector3 &)`.
317 ///
318 /// # Safety
319 /// `component` must be a live `INPCComponent`.
320 #[must_use]
321 pub fn npcs_node_point_position(
322 component: INPCComponent,
323 node_id: i32,
324 position: &mut Vector3,
325 ) -> bool = [0, SLOT_GET_NODE_POINT_POSITION] or false;
326
327 /// `int INPCComponent::getNodePointCount(int)`.
328 ///
329 /// # Safety
330 /// `component` must be a live `INPCComponent`.
331 #[must_use]
332 pub fn npcs_node_point_count(
333 component: INPCComponent,
334 node_id: i32,
335 ) -> i32 = [0, SLOT_GET_NODE_POINT_COUNT] or 0;
336
337 /// `bool INPCComponent::getNodeInfo(int, uint32_t &, uint32_t &, uint32_t &)`.
338 ///
339 /// # Safety
340 /// `component` must be a live `INPCComponent`.
341 #[must_use]
342 pub fn npcs_node_info(
343 component: INPCComponent,
344 node_id: i32,
345 vehicle_nodes: &mut u32,
346 ped_nodes: &mut u32,
347 navi_nodes: &mut u32,
348 ) -> bool = [0, SLOT_GET_NODE_INFO] or false;
349}