Skip to content

Commit

Permalink
-added neon enum , added playerVehicle, added methods to tuningVehicle
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaiwoknats committed Nov 26, 2023
1 parent 6cfe4cb commit ac74ada
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/Entities/AtlasPlayerVehicle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using AltV.Net;
namespace AltV.Atlas.Vehicles.Entities;

public class AtlasPlayerVehicle( ICore core, IntPtr nativePointer, uint id ) : AtlasTuningVehicle( core, nativePointer, id )

Check warning on line 4 in src/Entities/AtlasPlayerVehicle.cs

View workflow job for this annotation

GitHub Actions / create_nuget

Missing XML comment for publicly visible type or member 'AtlasPlayerVehicle'

Check warning on line 4 in src/Entities/AtlasPlayerVehicle.cs

View workflow job for this annotation

GitHub Actions / create_nuget

Missing XML comment for publicly visible type or member 'AtlasPlayerVehicle.AtlasPlayerVehicle(ICore, nint, uint)'
{
/// <summary>
/// The id of the vehicle owner
/// </summary>
public uint OwnerId { get; set; }
}
72 changes: 68 additions & 4 deletions src/Entities/AtlasTuningVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void SetSecondaryMaterial( EColorMaterial material )
/// <summary>
/// Sets the vehicle PrimaryColorRgb from a string
/// </summary>
/// <param name="rgb"></param>
/// <param name="rgb">The rgb color as a string</param>
public void SetPrimaryRgb( string rgb )
{
if( !rgb.TryParseRgb( out var color ) )
Expand All @@ -76,7 +76,7 @@ public void SetPrimaryRgb( string rgb )
/// <summary>
/// Sets the vehicle SecondaryColorRgb from a string
/// </summary>
/// <param name="rgb"></param>
/// <param name="rgb">The rgb color as a string</param>
public void SetSecondaryRgb( string rgb )
{
if( !rgb.TryParseRgb( out var color ) )
Expand All @@ -88,7 +88,7 @@ public void SetSecondaryRgb( string rgb )
/// <summary>
/// Sets the vehicle PearlColor from a EGtaColor
/// </summary>
/// <param name="color"></param>
/// <param name="color">The EGtaColor to apply</param>
public void SetPearlColor( EGtaColor color ) => PearlColor = ( byte ) color;

/// <summary>
Expand Down Expand Up @@ -151,10 +151,74 @@ public bool RemoveMod( VehicleModType vehicleModType )
/// <summary>
/// Removes all given vehicleMods
/// </summary>
/// <param name="vehicleMods"></param>
/// <param name="vehicleMods">The list of mods to be removed</param>
/// <returns>Returns a list of tuples with the given mod and the SetMod result</returns>
public IEnumerable<( VehicleMod mod, bool result )> RemoveMods( IEnumerable<VehicleMod> vehicleMods )
{
return ( from vehicleMod in vehicleMods.ToList( ) let result = RemoveMod( vehicleMod.ModType ) select ( vehicleMod, result ) ).ToList( );
}

/// <summary>
/// Set the vehicle NeonColor
/// </summary>
/// <param name="rgb">The rgb color as a string</param>
public void SetNeonColorRgb( string rgb )
{
if( !rgb.TryParseRgb( out var color ) )
return;

NeonColor = color;
}

/// <summary>
/// Sets a specific neon style
/// </summary>
/// <param name="neonStyle">The neonStyle to apply</param>
public void SetNeonStyle( ENeonStyle neonStyle )
{
Vehicle.SetNeonActive(
( neonStyle & ENeonStyle.Left ) != 0,
( neonStyle & ENeonStyle.Right ) != 0,
( neonStyle & ENeonStyle.Top ) != 0,
( neonStyle & ENeonStyle.Back ) != 0
);
}

/// <summary>
/// Sets a rgb tireSmoke color
/// </summary>
/// <param name="rgb">The rgb color as a string</param>
public void SetTireSmokeRgb( string rgb )
{
if( !rgb.TryParseRgb( out var color ) )
return;

TireSmokeColor = color;
}

/// <summary>
/// Sets the vehicle headlightColor
/// </summary>
/// <param name="headlightColor">The headlightColor to apply</param>
public void SetHeadlightColor( EHeadlightColor headlightColor )
{
HeadlightColor = ( byte ) headlightColor;
}

/// <summary>
/// Sets the vehicle wheelColor
/// </summary>
/// <param name="color">The color to apply</param>
public void SetWheelColor( EGtaColor color ) => WheelColor = ( byte ) color;

/// <summary>
/// Sets the vehicle wheel type and variation
/// </summary>
/// <param name="wheelType">The wheelType to apply</param>
/// <param name="variation">The wheelVariation to apply</param>
public void SetWheels( EWheelType wheelType, byte variation )
{
SetWheels( ( byte ) wheelType, variation );
}

}
25 changes: 25 additions & 0 deletions src/Enums/ENeonStyle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace AltV.Atlas.Vehicles.Enums;

[Flags]
public enum ENeonStyle
{
None = 0,
Left = 1,
Right = 2,
Top = 4,
Back = 8,

LeftRight = Left | Right,
LeftTop = Left | Top,
LeftBack = Left | Back,
RightTop = Right | Top,
RightBack = Right | Back,
TopBack = Top | Back,

LeftRightTop = Left | Right | Top,
LeftRightBack = Left | Right | Back,
LeftTopBack = Left | Top | Back,
RightTopBack = Right | Top | Back,

LeftRightTopBack = Left | Right | Top | Back
}

0 comments on commit ac74ada

Please sign in to comment.