Skip to content

Commit

Permalink
Warpが死んでいたのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
TORISOUP committed Aug 17, 2024
1 parent 71d02e7 commit f7d4dc0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
10 changes: 8 additions & 2 deletions Inferno/ExtensionMethods/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using GTA.Math;
using System;
using System.Linq;
using System.Threading.Tasks;
using Inferno.ChaosMode.WeaponProvider;

namespace Inferno
Expand Down Expand Up @@ -37,6 +38,7 @@ public static bool IsPlayerVehicle(this Vehicle vehicle)
{
return false;
}

return vehicle == Game.Player.Character.CurrentVehicle;
}

Expand Down Expand Up @@ -98,7 +100,7 @@ public static Vector3 ApplyVector(this Quaternion q, Vector3 v)
y * -q.Z + z * q.Y - w * q.X + x * q.W,
z * -q.X + x * q.Z - w * q.Y + y * q.W,
x * -q.Y + y * q.X - w * q.Z + z * q.W
);
);
}

public static Quaternion ToQuaternion(this Vector3 forward)
Expand Down Expand Up @@ -135,6 +137,7 @@ public static Quaternion ToQuaternion(this Vector3 forward, Vector3 up)
quaternion.Z = (m01 - m10) * num;
return quaternion;
}

if ((m00 >= m11) && (m00 >= m22))
{
var num7 = (float)Math.Sqrt(((1f + m00) - m11) - m22);
Expand All @@ -145,6 +148,7 @@ public static Quaternion ToQuaternion(this Vector3 forward, Vector3 up)
quaternion.W = (m12 - m21) * num4;
return quaternion;
}

if (m11 > m22)
{
var num6 = (float)Math.Sqrt(((1f + m11) - m00) - m22);
Expand All @@ -155,6 +159,7 @@ public static Quaternion ToQuaternion(this Vector3 forward, Vector3 up)
quaternion.W = (m20 - m02) * num3;
return quaternion;
}

var num5 = (float)Math.Sqrt(((1f + m22) - m00) - m11);
var num2 = 0.5f / num5;
quaternion.X = (m20 + m02) * num2;
Expand Down Expand Up @@ -198,5 +203,6 @@ public static bool IsProjectileWeapon(this Weapon weapon)
}

#endregion

}
}
}
4 changes: 2 additions & 2 deletions Inferno/InfernoScripts/Parupunte/Scripts/KetsuWarp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private IEnumerable<object> IdleCoroutine()
foreach (var w in WaitForSeconds(10))
{
var blip = GTA.World.GetActiveBlips()
.FirstOrDefault(x => x.Exists() && (int)x.Color == 84 && x.Type == 4);
.FirstOrDefault(x => x.Exists() && x.Sprite == BlipSprite.Waypoint);

if (blip != null)
{
Expand Down Expand Up @@ -59,7 +59,7 @@ private IEnumerable<object> MoveToCoroutine()

while (target.IsSafeExist())
{
var targetBlip = GTA.World.GetActiveBlips().FirstOrDefault(x => x.Exists() && (int)x.Color == 84 && x.Type == 4);
var targetBlip = GTA.World.GetActiveBlips().FirstOrDefault(x => x.Exists() && x.Sprite == BlipSprite.Waypoint);
if (targetBlip == null || !targetBlip.Exists())
{
if (target.IsSafeExist())
Expand Down
13 changes: 10 additions & 3 deletions Inferno/InfernoScripts/Player/Warp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ protected override void Setup()

.Subscribe(_ =>
{
var blip = GTA.World.GetActiveBlips().FirstOrDefault(x => x.Exists());
var blip = GTA.World.GetActiveBlips().FirstOrDefault(x => x.Exists() && x.Sprite == BlipSprite.Waypoint);
if (blip == null) return;
var targetHeight = GTA.World.GetGroundHeight(blip.Position);
//地面ピッタリだと地面に埋まるので少し上空を指定する
var targetPos = new Vector3(blip.Position.X, blip.Position.Y, targetHeight + 3);
var targetPos = new Vector3(blip.Position.X, blip.Position.Y, targetHeight + 0.1f );

var tryPos = GTA.World.GetSafeCoordForPed(targetPos);
if (tryPos != Vector3.Zero)
{
targetPos = tryPos;
}

var targetEntity = default(Entity);

if (PlayerPed.IsInVehicle())
Expand All @@ -33,8 +39,9 @@ protected override void Setup()
}

targetEntity.Position = targetPos;
targetEntity.ApplyForce(new Vector3(0, 0, 10));
targetEntity.ApplyForce(new Vector3(0, 0, 1));
});
}

}
}
6 changes: 3 additions & 3 deletions Inferno/Utilities/InfernoUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public static async void Forget(this Task task)
{
await task;
}
catch (Exception e)
catch (Exception)
{

// ignore
}
}
}
}
}

0 comments on commit f7d4dc0

Please sign in to comment.