From b74f81ed78ef2dad912521e66e28d7c3db388358 Mon Sep 17 00:00:00 2001
From: Niels <7136117+TheDutchDev@users.noreply.github.com>
Date: Sat, 25 Nov 2023 10:20:49 +0100
Subject: [PATCH] Update nugets. Improve event. add pedtaskfactory. clean up
code.
---
src/AltV.Atlas.Peds.csproj | 6 +++---
src/Base/AtlasPed.cs | 3 ++-
src/Delegates/PedDeadDelegate.cs | 5 +++--
src/PedModule.cs | 2 ++
src/PedTasks/PedTaskFollowPlayer.cs | 2 +-
src/PedTasks/PedTaskMoveToTargetPosition.cs | 8 ++++----
src/PedTasks/PedTaskWander.cs | 2 +-
7 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/AltV.Atlas.Peds.csproj b/src/AltV.Atlas.Peds.csproj
index 0c3c4b2..8062f49 100644
--- a/src/AltV.Atlas.Peds.csproj
+++ b/src/AltV.Atlas.Peds.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 2.0.0
+ 2.1.0
GPL-3.0-or-later
README.md
https://github.com/altv-atlas/Peds.git
@@ -21,8 +21,8 @@
-
-
+
+
diff --git a/src/Base/AtlasPed.cs b/src/Base/AtlasPed.cs
index ab6a66e..ad32423 100644
--- a/src/Base/AtlasPed.cs
+++ b/src/Base/AtlasPed.cs
@@ -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 )
@@ -115,6 +115,7 @@ private void OnNetworkOwnerChange( IEntity target, IPlayer? oldNetOwner, IPlayer
OnNetOwnerChange?.Invoke( oldNetOwner, newNetOwner );
}
+
///
/// Give the ped a specific task
///
diff --git a/src/Delegates/PedDeadDelegate.cs b/src/Delegates/PedDeadDelegate.cs
index 75909ad..147f239 100644
--- a/src/Delegates/PedDeadDelegate.cs
+++ b/src/Delegates/PedDeadDelegate.cs
@@ -1,8 +1,9 @@
-using AltV.Net.Elements.Entities;
+using AltV.Atlas.Peds.Interfaces;
+using AltV.Net.Elements.Entities;
namespace AltV.Atlas.Peds.Delegates;
///
/// Ped dead delegate
///
-public delegate void PedDeadDelegate( IEntity killer, uint weapon );
\ No newline at end of file
+public delegate void PedDeadDelegate( IAtlasServerPed ped, IEntity killer, uint weapon );
\ No newline at end of file
diff --git a/src/PedModule.cs b/src/PedModule.cs
index 10d57b4..f66f1e8 100644
--- a/src/PedModule.cs
+++ b/src/PedModule.cs
@@ -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;
@@ -24,6 +25,7 @@ public static IServiceCollection RegisterPedModule( this IServiceCollection serv
serviceCollection.AddTransient( );
serviceCollection.AddTransient( );
serviceCollection.AddTransient( );
+ serviceCollection.AddTransient( );
serviceCollection.AddTransient, AltPedFactory>( );
diff --git a/src/PedTasks/PedTaskFollowPlayer.cs b/src/PedTasks/PedTaskFollowPlayer.cs
index 4d38190..f5dc9b9 100644
--- a/src/PedTasks/PedTaskFollowPlayer.cs
+++ b/src/PedTasks/PedTaskFollowPlayer.cs
@@ -9,6 +9,6 @@ namespace AltV.Atlas.Peds.PedTasks;
/// Task to make the ped follow a player
///
/// The remote ID of the player
-public class PedTaskFollowPlayer( uint targetId ) : PedTaskFollowPlayerBase( targetId ), IPedTask
+public class PedTaskFollowPlayer( uint targetId ) : PedTaskFollowPlayerBase( targetId )
{
}
\ No newline at end of file
diff --git a/src/PedTasks/PedTaskMoveToTargetPosition.cs b/src/PedTasks/PedTaskMoveToTargetPosition.cs
index bb71862..c10c36f 100644
--- a/src/PedTasks/PedTaskMoveToTargetPosition.cs
+++ b/src/PedTasks/PedTaskMoveToTargetPosition.cs
@@ -7,9 +7,9 @@
namespace AltV.Atlas.Peds.PedTasks;
-public class PedTaskMoveToTargetPosition( Position targetPosition ) : PedTaskMoveToTargetPositionBase
+///
+/// A task to make the ped move(walk) to a given position
+///
+public class PedTaskMoveToTargetPosition : PedTaskMoveToTargetPositionBase
{
- public Guid Id { get; set; } = Guid.Parse( "721ADE18-64A0-4B12-9FF6-09793DDC8C72" );
-
- private Position TargetPosition { get; set; } = targetPosition;
}
\ No newline at end of file
diff --git a/src/PedTasks/PedTaskWander.cs b/src/PedTasks/PedTaskWander.cs
index a69fc55..732b942 100644
--- a/src/PedTasks/PedTaskWander.cs
+++ b/src/PedTasks/PedTaskWander.cs
@@ -15,6 +15,6 @@ namespace AltV.Atlas.Peds.PedTasks;
/// Minimum length to walk
/// Waiting time between walks
public class PedTaskWander( Vector3 position, uint radius, uint minLength, uint timeBetweenWalks )
- : PedTaskWanderBase( position, radius, minLength, timeBetweenWalks ), IPedTask
+ : PedTaskWanderBase( position, radius, minLength, timeBetweenWalks )
{
}
\ No newline at end of file