omp-gdk 2.1.0

Rust SDK for developing open.mp gamemodes
Documentation
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
pub mod events;
pub mod functions;

use std::ffi::c_void;

use crate::{
    players::Player,
    runtime::queue_api_call,
    types::{colour::Colour, vector::Vector3},
    vehicles::Vehicle,
};

pub use functions::load_functions;

pub struct Object {
    handle: *const c_void,
}

impl Object {
    pub fn get_handle(&self) -> *const c_void {
        self.handle
    }

    pub fn new(handle: *const c_void) -> Self {
        Self { handle }
    }

    /// Creates an object at specified coordinates in the game world.
    pub fn create(
        modelid: i32,
        position: Vector3,
        rotation: Vector3,
        draw_distance: f32,
    ) -> Option<Object> {
        let mut _id = 0;
        functions::Object_Create(
            modelid,
            position.x,
            position.y,
            position.z,
            rotation.x,
            rotation.y,
            rotation.z,
            draw_distance,
            &mut _id,
        )
    }

    /// Destroys (removes) an object that was created using create method.
    pub fn destroy(&self) {
        self.defer_api_call(Box::new(move |object| {
            functions::Object_Destroy(&object);
        }));
    }

    /// Attach an object to a vehicle.
    pub fn attach_to_vehicle(&self, vehicle: &Vehicle, offset: Vector3, rotation: Vector3) -> bool {
        functions::Object_AttachToVehicle(
            self, vehicle, offset.x, offset.y, offset.z, rotation.x, rotation.y, rotation.z,
        )
    }

    /// Attach an object to an object.
    pub fn attach_to_object(
        &self,
        obj_attached_to: &Object,
        offset: Vector3,
        rotation: Vector3,
        sync_rotation: bool,
    ) -> bool {
        functions::Object_AttachToObject(
            self,
            obj_attached_to,
            offset.x,
            offset.y,
            offset.z,
            rotation.x,
            rotation.y,
            rotation.z,
            sync_rotation,
        )
    }

    /// Attach a player object to a player.
    pub fn attach_to_player(&self, player: &Player, offset: Vector3, rotation: Vector3) -> bool {
        functions::Object_AttachToPlayer(
            self, player, offset.x, offset.y, offset.z, rotation.x, rotation.y, rotation.z,
        )
    }

    ///  Set the position of an object.
    pub fn set_pos(&self, position: Vector3) -> bool {
        functions::Object_SetPos(self, position.x, position.y, position.z)
    }

    ///  Locate an object.
    pub fn get_pos(&self) -> Vector3 {
        let mut pos = Vector3::default();
        functions::Object_GetPos(self, &mut pos.x, &mut pos.y, &mut pos.z);
        pos
    }

    /// Set the rotation of an object.
    pub fn set_rotation(&self, rotation: Vector3) -> bool {
        functions::Object_SetRot(self, rotation.x, rotation.y, rotation.z)
    }

    /// Get the rotation of an object.
    pub fn get_rotation(&self) -> Vector3 {
        let mut rotation = Vector3::default();
        functions::Object_GetRot(self, &mut rotation.x, &mut rotation.y, &mut rotation.z);
        rotation
    }

    /// Get the model ID of an object
    pub fn get_model(&self) -> i32 {
        functions::Object_GetModel(self)
    }

    /// Disable collisions between players' cameras and the specified object.
    pub fn set_no_camera_collision(&self) -> bool {
        functions::Object_SetNoCameraCollision(self)
    }

    /// Move an object to a new position with a set speed. Players/vehicles will 'surf' the object as it moves.
    pub fn move_object(&self, data: ObjectMoveData) -> i32 {
        self.defer_api_call(Box::new(move |object| {
            functions::Object_Move(
                &object,
                data.targetPos.x,
                data.targetPos.y,
                data.targetPos.z,
                data.speed,
                data.targetRot.x,
                data.targetRot.y,
                data.targetRot.z,
            );
        }));

        if data.speed <= 0.0 {
            return 0; // avoid division by zero or negative time
        }

        let distance = (data.targetPos - self.get_pos()).length();
        let time_ms = (distance / data.speed) * 1000.0;
        time_ms as i32
    }

    /// Stop an object from moving.
    pub fn stop(&self) -> bool {
        functions::Object_Stop(self)
    }

    /// Check if the object is moving.
    pub fn is_moving(&self) -> bool {
        functions::Object_IsMoving(self)
    }

    /// Replace the texture of an object with the texture from another model in the game.
    pub fn set_material(
        &self,
        material_index: i32,
        model_id: i32,
        texture_library: &str,
        texture_name: &str,
        material_colour: Colour,
    ) -> bool {
        functions::Object_SetMaterial(
            self,
            material_index,
            model_id,
            texture_library,
            texture_name,
            material_colour.argb(),
        )
    }

    /// Replace the texture of an object with text.
    pub fn set_material_text(
        &self,
        text: &str,
        material_index: i32,
        material_size: ObjectMaterialSize,
        fontface: &str,
        fontsize: i32,
        bold: bool,
        font_colour: Colour,
        background_colour: Colour,
        textalignment: ObjectMaterialTextAlign,
    ) -> bool {
        functions::Object_SetMaterialText(
            self,
            text,
            material_index,
            material_size as i32,
            fontface,
            fontsize,
            bold,
            font_colour.argb(),
            background_colour.argb(),
            textalignment as i32,
        )
    }

    /// Allows camera collisions with newly created objects to be disabled by default.
    pub fn set_objects_default_camera_collision(disable: bool) -> bool {
        functions::Object_SetDefaultCameraCollision(disable)
    }

    /// Get the draw distance of an object.
    pub fn get_draw_distance(&self) -> f32 {
        functions::Object_GetDrawDistance(self)
    }

    /// Get the move speed of an object.
    pub fn get_move_speed(&self) -> f32 {
        functions::Object_GetMoveSpeed(self)
    }

    /// Get the move data of an object.
    pub fn get_move_data(&self) -> ObjectMoveData {
        let mut data = ObjectMoveData {
            speed: functions::Object_GetMoveSpeed(self),
            ..Default::default()
        };

        functions::Object_GetMovingTargetPos(
            self,
            &mut data.targetPos.x,
            &mut data.targetPos.y,
            &mut data.targetPos.z,
        );
        functions::Object_GetMovingTargetPos(
            self,
            &mut data.targetRot.x,
            &mut data.targetRot.y,
            &mut data.targetRot.z,
        );
        data
    }

    /// Get the attachment data of an object.
    pub fn get_attached_data(&self) -> ObjectAttachmentData {
        let mut data = ObjectAttachmentData::default();
        let (mut pid, mut oid, mut vid): (i32, i32, i32) = (-1, -1, -1);

        functions::Object_GetAttachedData(self, &mut pid, &mut oid, &mut vid);
        if pid != 65535 {
            data.ID = pid;
            data.attachment_type = ObjectAttachmentType::Player;
        } else if oid != 65535 {
            data.ID = oid;
            data.attachment_type = ObjectAttachmentType::Object;
        } else if vid != 65535 {
            data.ID = vid;
            data.attachment_type = ObjectAttachmentType::Vehicle;
        } else {
            data.attachment_type = ObjectAttachmentType::None;
        }

        data.syncRotation = functions::Object_GetSyncRotation(self);
        functions::Object_GetAttachedOffset(
            self,
            &mut data.offset.x,
            &mut data.offset.y,
            &mut data.offset.z,
            &mut data.rotation.x,
            &mut data.rotation.y,
            &mut data.rotation.z,
        );
        data
    }

    /// Checks if a slot of object material is used.
    pub fn is_material_slot_used(&self, material_index: i32) -> bool {
        functions::Object_IsMaterialSlotUsed(self, material_index)
    }

    /// Get object's material data
    pub fn get_material_data(&self, material_index: i32) -> ObjectMaterialData {
        let (
            mut modelid,
            mut texture_library,
            mut texture_name,
            mut material_colour,
            mut text,
            mut material_size,
            mut font_face,
            mut font_size,
            mut bold,
            mut font_colour,
            mut background_colour,
            mut text_alignment,
        ): (
            i32,
            String,
            String,
            i32,
            String,
            i32,
            String,
            i32,
            bool,
            i32,
            i32,
            i32,
        ) = Default::default();

        functions::Object_GetMaterial(
            self,
            material_index,
            &mut modelid,
            &mut texture_library,
            16,
            &mut texture_name,
            16,
            &mut material_colour,
        );

        functions::Object_GetMaterialText(
            self,
            material_index,
            &mut text,
            16,
            &mut material_size,
            &mut font_face,
            16,
            &mut font_size,
            &mut bold,
            &mut font_colour,
            &mut background_colour,
            &mut text_alignment,
        );

        ObjectMaterialData::new(
            modelid,
            texture_library,
            texture_name,
            Colour::from_argb(material_colour as u32),
            text,
            material_size,
            font_face,
            font_size,
            bold,
            Colour::from_argb(font_colour as u32),
            Colour::from_argb(background_colour as u32),
            text_alignment,
        )
    }

    /// Check if collisions between players' cameras and the specified object is disabled.
    pub fn is_no_camera_collision(&self) -> bool {
        functions::Object_IsObjectNoCameraCollision(self)
    }

    /// Get object's id
    pub fn get_id(&self) -> i32 {
        functions::Object_GetID(self)
    }

    /// Get Object from an id
    pub fn from_id(id: i32) -> Option<Object> {
        functions::Object_FromID(id)
    }

    fn defer_api_call(&self, callback: Box<dyn FnOnce(Self)>) {
        let object_id = self.get_id();
        queue_api_call(Box::new(move || {
            let object = match Self::from_id(object_id) {
                Some(object) => object,
                None => {
                    log::error!("object with id={object_id} not found");
                    return;
                }
            };
            callback(object);
        }));
    }
}

pub struct PlayerObject {
    handle: *const c_void,
    pub player: Player,
}

impl PlayerObject {
    pub fn get_handle(&self) -> *const c_void {
        self.handle
    }

    pub fn new(handle: *const c_void, player: Player) -> Self {
        Self { handle, player }
    }

    /// Attach a player object to a vehicle.
    pub fn attach_player_object_to_vehicle(
        &self,
        vehicle: &Vehicle,
        offset: Vector3,
        rotation: Vector3,
    ) -> bool {
        functions::PlayerObject_AttachToVehicle(
            &self.player,
            self,
            vehicle,
            offset.x,
            offset.y,
            offset.z,
            rotation.x,
            rotation.y,
            rotation.z,
        )
    }
    /// Attach PlayerObject to another player
    pub fn attach_player_object_to_player(
        &self,
        player_attached_to: &Player,
        offset: Vector3,
        rotation: Vector3,
    ) -> bool {
        functions::PlayerObject_AttachToPlayer(
            &self.player,
            self,
            player_attached_to,
            offset.x,
            offset.y,
            offset.z,
            rotation.x,
            rotation.y,
            rotation.z,
        )
    }
    /// You can use this function to attach player-objects to other player-objects.
    pub fn attach_player_object_to_object(
        &self,
        attached_to: &PlayerObject,
        offset: Vector3,
        rotation: Vector3,
    ) -> bool {
        functions::PlayerObject_AttachToObject(
            &self.player,
            self,
            attached_to,
            offset.x,
            offset.y,
            offset.z,
            rotation.x,
            rotation.y,
            rotation.z,
        )
    }
    /// Sets the position of a player-object to the specified coordinates.
    pub fn set_player_object_pos(&self, position: Vector3) -> bool {
        functions::PlayerObject_SetPos(&self.player, self, position.x, position.y, position.z)
    }
    /// Get the position of a player object (CreatePlayerObject).
    pub fn get_player_object_pos(&self) -> Vector3 {
        let mut position = Vector3::default();
        functions::PlayerObject_GetPos(
            &self.player,
            self,
            &mut position.x,
            &mut position.y,
            &mut position.z,
        );
        position
    }
    /// Set the rotation of an object on the X, Y and Z axis.
    pub fn set_player_object_rotation(&self, rotation: Vector3) -> bool {
        functions::PlayerObject_SetRot(&self.player, self, rotation.x, rotation.y, rotation.z)
    }
    /// Use this function to get the object's current rotation.
    pub fn get_player_object_rotation(&self) -> Vector3 {
        let mut rotation = Vector3::default();
        functions::PlayerObject_GetRot(
            &self.player,
            self,
            &mut rotation.x,
            &mut rotation.y,
            &mut rotation.z,
        );
        rotation
    }
    /// Retrieve the model ID of a player-object.
    pub fn get_player_object_model(&self) -> i32 {
        functions::PlayerObject_GetModel(&self.player, self)
    }
    /// Toggles a player object camera collision.
    pub fn set_player_object_no_camera_collision(&self) -> bool {
        functions::PlayerObject_SetNoCameraCollision(&self.player, self)
    }
    /// Move a player object with a set speed.
    pub fn move_player_object(&self, data: ObjectMoveData) -> i32 {
        functions::PlayerObject_Move(
            &self.player,
            self,
            data.targetPos.x,
            data.targetPos.y,
            data.targetPos.z,
            data.speed,
            data.targetRot.x,
            data.targetRot.y,
            data.targetRot.z,
        )
    }
    /// Stop a moving player-object after MovePlayerObject has been used.
    pub fn stop_player_object(&self) -> bool {
        functions::PlayerObject_Stop(&self.player, self)
    }
    /// Checks if the given player objectid is moving.
    pub fn is_player_object_moving(&self) -> bool {
        functions::PlayerObject_IsMoving(&self.player, self)
    }

    /// Replace the texture of a player-object with the texture from another model in the game.
    pub fn set_player_object_material(
        &self,
        material_index: i32,
        model_id: i32,
        texture_library: &str,
        texture_name: &str,
        material_colour: Colour,
    ) -> bool {
        functions::PlayerObject_SetMaterial(
            &self.player,
            self,
            material_index,
            model_id,
            texture_library,
            texture_name,
            material_colour.argb(),
        )
    }
    /// Replace the texture of a player object with text.
    pub fn set_player_object_material_text(
        &self,
        text: &str,
        material_index: i32,
        material_size: i32,
        fontface: &str,
        fontsize: i32,
        bold: bool,
        font_colour: Colour,
        background_colour: Colour,
        textalignment: ObjectMaterialTextAlign,
    ) -> bool {
        functions::PlayerObject_SetMaterialText(
            &self.player,
            self,
            text,
            material_index,
            material_size,
            fontface,
            fontsize,
            bold,
            font_colour.argb(),
            background_colour.argb(),
            textalignment as i32,
        )
    }
    /// Get the draw distance of a player-object.
    pub fn get_player_object_draw_distance(&self) -> f32 {
        functions::PlayerObject_GetDrawDistance(&self.player, self)
    }
    /// Get the move speed of a player-object.
    pub fn get_player_object_move_speed(&self) -> f32 {
        functions::PlayerObject_GetMoveSpeed(&self.player, self)
    }
    pub fn get_player_object_moving_data(&self) -> ObjectMoveData {
        let mut data = ObjectMoveData {
            speed: functions::PlayerObject_GetMoveSpeed(&self.player, self),
            ..Default::default()
        };
        functions::PlayerObject_GetMovingTargetPos(
            &self.player,
            self,
            &mut data.targetPos.x,
            &mut data.targetPos.y,
            &mut data.targetPos.z,
        );
        functions::PlayerObject_GetMovingTargetRot(
            &self.player,
            self,
            &mut data.targetRot.x,
            &mut data.targetRot.y,
            &mut data.targetRot.z,
        );
        data
    }
    /// Get the attachment data of a player-object.
    pub fn get_player_object_attached_data(&self) -> ObjectAttachmentData {
        let mut data = ObjectAttachmentData::default();
        let (mut pid, mut oid, mut vid): (i32, i32, i32) = (-1, -1, -1);

        functions::PlayerObject_GetAttachedData(&self.player, self, &mut pid, &mut oid, &mut vid);
        if pid != 65535 {
            data.ID = pid;
            data.attachment_type = ObjectAttachmentType::Player;
        } else if oid != 65535 {
            data.ID = oid;
            data.attachment_type = ObjectAttachmentType::Object;
        } else if vid != 65535 {
            data.ID = vid;
            data.attachment_type = ObjectAttachmentType::Vehicle;
        } else {
            data.attachment_type = ObjectAttachmentType::None;
        }

        data.syncRotation = functions::PlayerObject_GetSyncRotation(&self.player, self);
        functions::PlayerObject_GetAttachedOffset(
            &self.player,
            self,
            &mut data.offset.x,
            &mut data.offset.y,
            &mut data.offset.z,
            &mut data.rotation.x,
            &mut data.rotation.y,
            &mut data.rotation.z,
        );
        data
    }
    /// Checks if a slot of player-object material is used.
    pub fn is_player_object_material_slot_used(&self, material_index: i32) -> bool {
        functions::PlayerObject_IsMaterialSlotUsed(&self.player, self, material_index)
    }
    pub fn get_player_object_material_data(&self, material_index: i32) -> ObjectMaterialData {
        let (
            mut modelid,
            mut texture_library,
            mut texture_name,
            mut material_colour,
            mut text,
            mut material_size,
            mut font_face,
            mut font_size,
            mut bold,
            mut font_colour,
            mut background_colour,
            mut text_alignment,
        ): (
            i32,
            String,
            String,
            i32,
            String,
            i32,
            String,
            i32,
            bool,
            i32,
            i32,
            i32,
        ) = Default::default();

        functions::PlayerObject_GetMaterial(
            &self.player,
            self,
            material_index,
            &mut modelid,
            &mut texture_library,
            16,
            &mut texture_name,
            16,
            &mut material_colour,
        );

        functions::PlayerObject_GetMaterialText(
            &self.player,
            self,
            material_index,
            &mut text,
            16,
            &mut material_size,
            &mut font_face,
            16,
            &mut font_size,
            &mut bold,
            &mut font_colour,
            &mut background_colour,
            &mut text_alignment,
        );

        ObjectMaterialData::new(
            modelid,
            texture_library,
            texture_name,
            Colour::from_argb(material_colour as u32),
            text,
            material_size,
            font_face,
            font_size,
            bold,
            Colour::from_argb(font_colour as u32),
            Colour::from_argb(background_colour as u32),
            text_alignment,
        )
    }
    /// Check if collisions between players' cameras and the specified player object is disabled.
    pub fn is_player_object_no_camera_collision(&self) -> bool {
        functions::PlayerObject_IsNoCameraCollision(&self.player, self)
    }

    /// Get player object's id
    pub fn get_id(&self) -> i32 {
        functions::PlayerObject_GetID(&self.player, self)
    }
}

/// Object moving information
#[repr(C)]
#[derive(Default, Clone, Copy, Debug)]
pub struct ObjectMoveData {
    /// The position the object moving to.
    pub targetPos: Vector3,
    /// The final rotation of the object.
    pub targetRot: Vector3,
    /// The speed at which to move the object (units per second).
    pub speed: f32,
}

/// The type of attachment attached to Object
#[repr(C)]
#[derive(Default, PartialEq, Clone, Copy, Debug)]
pub enum ObjectAttachmentType {
    #[default]
    None,
    Vehicle,
    Object,
    Player,
}

/// Data information of attachment
#[repr(C)]
#[derive(Default, Clone, Copy, Debug)]
pub struct ObjectAttachmentData {
    /// Type of attachement
    pub attachment_type: ObjectAttachmentType,
    /// the sync rotation of the object
    pub syncRotation: bool,
    /// ID of the object (use from_id methods to create an instance of these)
    pub ID: i32,
    /// Attachement offset
    pub offset: Vector3,
    /// Attachement rotation
    pub rotation: Vector3,
}

/// Alignment of Object material text
#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ObjectMaterialTextAlign {
    Left,
    Center,
    Right,
}

/// Size of Object material
#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ObjectMaterialSize {
    Size32x32 = 10,
    Size64x32 = 20,
    Size64x64 = 30,
    Size128x32 = 40,
    Size128x64 = 50,
    Size128x128 = 60,
    Size256x32 = 70,
    Size256x64 = 80,
    Size256x128 = 90,
    Size256x256 = 100,
    Size512x64 = 110,
    Size512x128 = 120,
    Size512x256 = 130,
    Size512x512 = 140,
}

/// Kind of Object Material
#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ObjectMaterialType {
    None,
    Default,
    Text,
}

/// Object Material Data
#[derive(PartialEq, Clone, Debug)]
pub struct ObjectMaterialData {
    pub modelid: i32,
    pub textureLibrary: String,
    pub textureName: String,
    pub materialColour: Colour,
    pub text: String,
    pub materialSize: i32,
    pub fontFace: String,
    pub fontSize: i32,
    pub bold: bool,
    pub fontColour: Colour,
    pub backgroundColour: Colour,
    pub textAlignment: i32,
}

impl ObjectMaterialData {
    pub fn new(
        modelid: i32,
        textureLibrary: String,
        textureName: String,
        materialColour: Colour,
        text: String,
        materialSize: i32,
        fontFace: String,
        fontSize: i32,
        bold: bool,
        fontColour: Colour,
        backgroundColour: Colour,
        textAlignment: i32,
    ) -> Self {
        Self {
            modelid,
            textureLibrary,
            textureName,
            materialColour,
            text,
            materialSize,
            fontFace,
            fontSize,
            bold,
            fontColour,
            backgroundColour,
            textAlignment,
        }
    }
}

#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ObjectEditResponse {
    Cancel,
    Final,
    Update,
}

#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct ObjectAttachmentSlotData {
    pub model: i32,
    pub bone: i32,
    pub offset: Vector3,
    pub rotation: Vector3,
    pub scale: Vector3,
    pub colour1: Colour,
    pub colour2: Colour,
}