Skip to content

Commit

Permalink
add helpful traits to the types, structs and enums
Browse files Browse the repository at this point in the history
  • Loading branch information
Sreyas-Sreelal committed May 20, 2024
1 parent 0eeeac8 commit 9351c68
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 42 deletions.
3 changes: 2 additions & 1 deletion omp-gdk/src/scripting/checkpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use functions::load_functions;

/// Types Of Race Checkpoints
#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum RaceCheckpointType {
/// Normal, must have nextPosition, else it shows as RACE_FINISH
Normal = 0,
Expand Down Expand Up @@ -52,6 +52,7 @@ impl PlayerRaceCheckPointData {
}

/// Player checkpoint information
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct PlayerCheckPointData {
/// position of checkpoint
pub center_pos: Vector3,
Expand Down
2 changes: 1 addition & 1 deletion omp-gdk/src/scripting/classes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use functions::{

/// Player Class Information
#[repr(C)]
#[derive(Default)]
#[derive(Clone, Copy, Debug, Default)]
pub struct PlayerClass {
/// The class's team
team: u8,
Expand Down
4 changes: 2 additions & 2 deletions omp-gdk/src/scripting/dialogs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub use functions::load_functions;
/// Type of Dialog Styles
/// <https://www.open.mp/docs/scripting/resources/dialogstyles>
#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum DialogStyle {
MsgBox = 0,
Input,
Expand All @@ -18,7 +18,7 @@ pub enum DialogStyle {

/// Type of Dialog Response
#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum DialogResponse {
/// right button
Right = 0,
Expand Down
2 changes: 1 addition & 1 deletion omp-gdk/src/scripting/gangzones/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{players::Player, types::colour::Colour, types::vector::Vector2};

/// GangZone dimensions
#[repr(C)]
#[derive(Default)]
#[derive(Default, Clone, Copy, Debug, PartialEq)]
pub struct GangZonePos {
/// west (x) and south (y) side of a gangzone
pub min: Vector2,
Expand Down
2 changes: 1 addition & 1 deletion omp-gdk/src/scripting/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub use functions::load_functions;

/// Model Download Type
#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ModelDownloadType {
/// None
NONE = 0,
Expand Down
15 changes: 8 additions & 7 deletions omp-gdk/src/scripting/objects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,15 +485,15 @@ impl PlayerObject {
}

#[repr(C)]
#[derive(Default)]
#[derive(Default, Clone, Copy, Debug)]
pub struct ObjectMoveData {
targetPos: Vector3,
targetRot: Vector3,
speed: f32,
}

#[repr(C)]
#[derive(Default, PartialEq)]
#[derive(Default, PartialEq, Clone, Copy, Debug)]
pub enum ObjectAttachmentType {
#[default]
None,
Expand All @@ -503,7 +503,7 @@ pub enum ObjectAttachmentType {
}

#[repr(C)]
#[derive(Default)]
#[derive(Default, Clone, Copy, Debug)]
pub struct ObjectAttachmentData {
attachment_type: ObjectAttachmentType,
syncRotation: bool,
Expand All @@ -513,15 +513,15 @@ pub struct ObjectAttachmentData {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ObjectMaterialTextAlign {
Left,
Center,
Right,
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ObjectMaterialSize {
Size32x32 = 10,
Size64x32 = 20,
Expand All @@ -540,7 +540,7 @@ pub enum ObjectMaterialSize {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ObjectMaterialType {
None,
Default,
Expand Down Expand Up @@ -595,14 +595,15 @@ impl ObjectMaterialData {
}

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

#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct ObjectAttachmentSlotData {
model: isize,
bone: isize,
Expand Down
40 changes: 23 additions & 17 deletions omp-gdk/src/scripting/players/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ impl Player {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum MapIconStyle {
Local,
Global,
Expand All @@ -1221,23 +1221,23 @@ pub enum MapIconStyle {
}

#[repr(u8)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum ClientVersion {
Samp037,
Samp03dl,
Openmp,
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerCameraCutType {
Cut,
Move,
}

/// The player's name status returned when updating their name
#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerNameStatus {
/// The name has successfully been updated
Updated,
Expand All @@ -1248,15 +1248,15 @@ pub enum PlayerNameStatus {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerAnimationSyncType {
NoSync,
Sync,
SyncOthers,
}

#[repr(C)]
#[derive(Default, Clone, Copy)]
#[derive(Default, Clone, Copy, Debug)]
pub struct WeaponSlotData {
id: PlayerWeapon,
ammo: u32,
Expand All @@ -1269,12 +1269,13 @@ impl WeaponSlotData {
}

#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct PlayerAnimationData {
ID: u16,
flags: u16,
}
#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerFightingStyle {
Normal = 4,
Boxing = 5,
Expand All @@ -1285,7 +1286,7 @@ pub enum PlayerFightingStyle {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerState {
None = 0,
OnFoot = 1,
Expand All @@ -1300,7 +1301,7 @@ pub enum PlayerState {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerWeaponSkill {
Pistol,
SilencedPistol,
Expand All @@ -1316,7 +1317,7 @@ pub enum PlayerWeaponSkill {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerSpecialAction {
None,
Duck,
Expand All @@ -1341,20 +1342,23 @@ pub enum PlayerSpecialAction {
}

#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct PlayerSurfingData {
surftype: isize,
ID: isize,
offset: Vector3,
}

#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct PlayerKeyData {
pub keys: u32,
pub upDown: i16,
pub leftRight: i16,
}

#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct PlayerBulletData {
origin: Vector3,
hitPos: Vector3,
Expand All @@ -1364,7 +1368,7 @@ pub struct PlayerBulletData {
hitID: u16,
}
#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerBulletHitType {
None,
Player = 1,
Expand All @@ -1374,29 +1378,31 @@ pub enum PlayerBulletHitType {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum SpectateType {
None,
Vehicle,
Player,
}

#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct PlayerSpectateData {
spectating: bool,
spectateID: isize,
spectate_type: SpectateType,
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerSpectateMode {
Normal = 1,
Fixed,
Side,
}

#[repr(C)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct PlayerAimData {
camFrontVector: Vector3,
camPos: Vector3,
Expand All @@ -1408,7 +1414,7 @@ pub struct PlayerAimData {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerWeaponState {
Unknown = -1,
NoBullets,
Expand All @@ -1418,7 +1424,7 @@ pub enum PlayerWeaponState {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum BodyPart {
Torso = 3,
Groin,
Expand All @@ -1430,15 +1436,15 @@ pub enum BodyPart {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum PlayerClickSource {
Scoreboard,
}

pub type WeaponSlots = StaticArray<WeaponSlotData, 13>;

#[repr(u8)]
#[derive(PartialEq, Copy, Clone, Default)]
#[derive(PartialEq, Copy, Clone, Default, Debug)]
pub enum PlayerWeapon {
#[default]
Fist,
Expand Down
5 changes: 3 additions & 2 deletions omp-gdk/src/scripting/textdraws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,17 @@ impl PlayerTextDraw {
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug, Default)]
pub enum TextDrawAlignmentTypes {
#[default]
Default,
Left,
Center,
Right,
}

#[repr(C)]
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum TextDrawStyle {
FontBeckettRegular = 0,
FontAharoniBold,
Expand Down
2 changes: 1 addition & 1 deletion omp-gdk/src/scripting/textlabels/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl PlayerTextLabel {
}

#[repr(C)]
#[derive(Default)]
#[derive(Default, PartialEq, Clone, Copy, Debug)]
pub struct TextLabelAttachmentData {
playerID: isize,
vehicleID: isize,
Expand Down
7 changes: 4 additions & 3 deletions omp-gdk/src/scripting/vehicles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,21 +461,22 @@ impl Default for VehicleParams {
}

#[repr(C)]
#[derive(Default, PartialEq, Clone, Copy, Debug)]
pub struct UnoccupiedVehicleUpdate {
seat: u8,
position: Vector3,
velocity: Vector3,
}

#[derive(Default)]
#[derive(Default, PartialEq, Clone, Copy, Debug)]
pub struct VehicleDamageStatusData {
pub panels: isize,
pub doors: isize,
pub lights: isize,
pub tires: isize,
}

#[derive(Default)]
#[derive(Default, PartialEq, Clone, Copy, Debug)]
pub struct VehicleSpawnData {
pub respawnDelay: isize,
pub modelID: isize,
Expand All @@ -487,7 +488,7 @@ pub struct VehicleSpawnData {
pub interior: isize,
}

#[derive(Default)]
#[derive(Default, PartialEq, Clone, Copy, Debug)]
pub struct VehicleMatrix {
pub right: Vector3,
pub up: Vector3,
Expand Down
Loading

0 comments on commit 9351c68

Please sign in to comment.