Skip to content

Commit

Permalink
Update nugets. Improve event. add pedtaskfactory. clean up code.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDutchDev committed Nov 25, 2023
1 parent e877d25 commit b74f81e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/AltV.Atlas.Peds.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/altv-atlas/Peds.git</RepositoryUrl>
Expand All @@ -21,8 +21,8 @@
</ItemGroup>

<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
<PackageReference Include="AltV.Atlas.Peds.Shared" Version="1.0.0" />
<PackageReference Include="AltV.Atlas.Shared" Version="1.0.0" />
<PackageReference Include="AltV.Atlas.Peds.Shared" Version="1.1.1" />
<PackageReference Include="AltV.Atlas.Shared" Version="1.1.0" />
</ItemGroup>

<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
Expand Down
3 changes: 2 additions & 1 deletion src/Base/AtlasPed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void OnPedDead( IPed ped, IEntity killer, uint weapon )
if( !ped.Equals( this ) )
return;

OnDeath?.Invoke( killer, weapon );
OnDeath?.Invoke( this, killer, weapon );
}

private void OnNetworkOwnerChange( IEntity target, IPlayer? oldNetOwner, IPlayer? newNetOwner )
Expand All @@ -115,6 +115,7 @@ private void OnNetworkOwnerChange( IEntity target, IPlayer? oldNetOwner, IPlayer

OnNetOwnerChange?.Invoke( oldNetOwner, newNetOwner );
}

/// <summary>
/// Give the ped a specific task
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions src/Delegates/PedDeadDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using AltV.Net.Elements.Entities;
using AltV.Atlas.Peds.Interfaces;
using AltV.Net.Elements.Entities;

namespace AltV.Atlas.Peds.Delegates;

/// <summary>
/// Ped dead delegate
/// </summary>
public delegate void PedDeadDelegate( IEntity killer, uint weapon );
public delegate void PedDeadDelegate( IAtlasServerPed ped, IEntity killer, uint weapon );
2 changes: 2 additions & 0 deletions src/PedModule.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AltV.Atlas.Peds.Base;
using AltV.Atlas.Peds.Factories;
using AltV.Atlas.Peds.Interfaces;
using AltV.Atlas.Peds.Shared.Factories;
using AltV.Atlas.Peds.Shared.Interfaces;
using AltV.Net;
using AltV.Net.Async.Elements.Entities;
Expand All @@ -24,6 +25,7 @@ public static IServiceCollection RegisterPedModule( this IServiceCollection serv
serviceCollection.AddTransient<IAtlasServerPed, AtlasPed>( );
serviceCollection.AddTransient<AtlasPedFactory>( );
serviceCollection.AddTransient<IPed, AsyncPed>( );
serviceCollection.AddTransient<PedTaskFactory>( );

serviceCollection.AddTransient<IEntityFactory<IPed>, AltPedFactory>( );

Expand Down
2 changes: 1 addition & 1 deletion src/PedTasks/PedTaskFollowPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ namespace AltV.Atlas.Peds.PedTasks;
/// Task to make the ped follow a player
/// </summary>
/// <param name="targetId">The remote ID of the player</param>
public class PedTaskFollowPlayer( uint targetId ) : PedTaskFollowPlayerBase( targetId ), IPedTask
public class PedTaskFollowPlayer( uint targetId ) : PedTaskFollowPlayerBase( targetId )
{
}
8 changes: 4 additions & 4 deletions src/PedTasks/PedTaskMoveToTargetPosition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace AltV.Atlas.Peds.PedTasks;

public class PedTaskMoveToTargetPosition( Position targetPosition ) : PedTaskMoveToTargetPositionBase
/// <summary>
/// A task to make the ped move(walk) to a given position
/// </summary>
public class PedTaskMoveToTargetPosition : PedTaskMoveToTargetPositionBase
{
public Guid Id { get; set; } = Guid.Parse( "721ADE18-64A0-4B12-9FF6-09793DDC8C72" );

private Position TargetPosition { get; set; } = targetPosition;
}
2 changes: 1 addition & 1 deletion src/PedTasks/PedTaskWander.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ namespace AltV.Atlas.Peds.PedTasks;
/// <param name="minLength">Minimum length to walk</param>
/// <param name="timeBetweenWalks">Waiting time between walks</param>
public class PedTaskWander( Vector3 position, uint radius, uint minLength, uint timeBetweenWalks )
: PedTaskWanderBase( position, radius, minLength, timeBetweenWalks ), IPedTask
: PedTaskWanderBase( position, radius, minLength, timeBetweenWalks )
{
}

0 comments on commit b74f81e

Please sign in to comment.