Skip to content

Commit

Permalink
fix(mono): fix breakage accidentally introduced in citizenfx#2740
Browse files Browse the repository at this point in the history
  • Loading branch information
AvarianKnight committed Oct 22, 2024
1 parent 498bcf4 commit 48405f1
Showing 1 changed file with 46 additions and 10 deletions.
56 changes: 46 additions & 10 deletions code/client/clrcore/External/Tasks.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;

#if MONO_V2
using CitizenFX.Core;
Expand Down Expand Up @@ -77,6 +78,16 @@ public enum LeaveVehicleFlags
LeaveDoorOpen = 256,
BailOut = 4096
}

public enum LookPriority
{
VeryLow = 0,
Low = 1,
Medium = 2,
High = 3,
VeryHigh = 4
}

[Flags]
public enum LookFlags
{
Expand Down Expand Up @@ -301,25 +312,50 @@ public void LeaveVehicle(Vehicle vehicle, LeaveVehicleFlags flags)
API.TaskLeaveVehicle(_ped.Handle, vehicle.Handle, (int)flags);
}

/// <summary>
/// Looks at the specified <see cref="Entity"/>.
/// </summary>
/// <param name="target"></param>
/// <param name="duration">Must be greater than 0 for the ped to actually move their head.</param>
/// <param name="flag"></param>
/// <param name="lookPriority"></param>
public void LookAt(Entity target, int duration = 1, LookFlags flag = LookFlags.None, LookPriority lookPriority = LookPriority.Medium)
{
API.TaskLookAtEntity(_ped.Handle, target.Handle, duration, (int)flag, (int)lookPriority);
}

/// <summary>
/// Looks at the specified <see cref="Entity"/>.
/// Looks at the specified <see cref="Entity"/>
/// </summary>
/// <param name="target"></param>
/// <param name="duration">Must be greater than 0 for the ped to actually move their head.</param>
/// <param name="flag"></param>
public void LookAt(Entity target, int duration = 1, LookFlags flag = LookFlags.FastTurnRate)
{
API.TaskLookAtEntity(_ped.Handle, target.Handle, duration, 0, (int)flag);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void LookAt(Entity target, int duration = 1)
{
API.TaskLookAtEntity(_ped.Handle, target.Handle, duration, (int)LookFlags.None, (int)LookPriority.Medium);
}

/// <summary>
/// Looks at the specified <see cref="Vector3"/> position.
/// </summary>
/// <param name="position"></param>
/// <param name="duration">Must be greater than 0 for the ped to actually move their head.</param>
/// <param name="flag"></param>
/// <param name="lookPriority"></param>
public void LookAt(Vector3 position, int duration = 1, LookFlags flag = LookFlags.None, LookPriority lookPriority = LookPriority.Medium)
{
API.TaskLookAtCoord(_ped.Handle, position.X, position.Y, position.Z, duration, (int)flag, (int)lookPriority);
}

/// <summary>
/// Looks at the specified <see cref="Vector3"/> position.
/// Looks at the specified <see cref="Vector3"/>
/// </summary>
/// <param name="position"></param>
/// <param name="duration">Must be greater than 0 for the ped to actually move their head.</param>
/// <param name="flag"></param>
public void LookAt(Vector3 position, int duration = 1, LookFlags flag = LookFlags.FastTurnRate)
[EditorBrowsable(EditorBrowsableState.Never)]
public void LookAt(Vector3 position, int duration = 1)
{
API.TaskLookAtCoord(_ped.Handle, position.X, position.Y, position.Z, duration, 0, (int)flag);
API.TaskLookAtCoord(_ped.Handle, position.X, position.Y, position.Z, duration, (int)LookFlags.None, (int)LookPriority.Medium);
}

public void ParachuteTo(Vector3 position)
Expand Down

0 comments on commit 48405f1

Please sign in to comment.