Delay vehicle repair
This commit is contained in:
@ -9,6 +9,8 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace RageCoop.Client
|
namespace RageCoop.Client
|
||||||
{
|
{
|
||||||
@ -391,6 +393,13 @@ namespace RageCoop.Client
|
|||||||
lock (QueuedActions) { QueuedActions.Clear(); }
|
lock (QueuedActions) { QueuedActions.Clear(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Delay(Action a, int time)
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(time);
|
||||||
|
QueueAction(a);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,13 @@ namespace RageCoop.Client
|
|||||||
{
|
{
|
||||||
if (MainVehicle.IsDead)
|
if (MainVehicle.IsDead)
|
||||||
{
|
{
|
||||||
MainVehicle.Repair();
|
Main.Delay(() =>
|
||||||
|
{
|
||||||
|
if (MainVehicle.IsDead && !IsDead)
|
||||||
|
{
|
||||||
|
MainVehicle.Repair();
|
||||||
|
}
|
||||||
|
},1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MainVehicle.IsOnFire)
|
if (MainVehicle.IsOnFire)
|
||||||
@ -341,13 +347,7 @@ namespace RageCoop.Client
|
|||||||
{
|
{
|
||||||
var current = MainVehicle.Position;
|
var current = MainVehicle.Position;
|
||||||
var predicted = Position+Velocity*(SyncParameters.PositioinPredictionDefault+0.001f*LastSyncedStopWatch.ElapsedMilliseconds);
|
var predicted = Position+Velocity*(SyncParameters.PositioinPredictionDefault+0.001f*LastSyncedStopWatch.ElapsedMilliseconds);
|
||||||
if (current.DistanceTo(Main.PlayerPosition)>50)
|
if (current.DistanceTo(Position)<5)
|
||||||
{
|
|
||||||
MainVehicle.Position=predicted;
|
|
||||||
MainVehicle.Velocity=Velocity;
|
|
||||||
MainVehicle.Quaternion=Quaternion;
|
|
||||||
}
|
|
||||||
else if (current.DistanceTo(Position)<5)
|
|
||||||
{
|
{
|
||||||
MainVehicle.Velocity = Velocity+5*(predicted - current);
|
MainVehicle.Velocity = Velocity+5*(predicted - current);
|
||||||
if (IsFlipped)
|
if (IsFlipped)
|
||||||
|
@ -269,6 +269,7 @@ namespace RageCoop.Client
|
|||||||
Function.Call(Hash.SET_VEHICLE_FLIGHT_NOZZLE_POSITION, plane, ratio);
|
Function.Call(Hash.SET_VEHICLE_FLIGHT_NOZZLE_POSITION, plane, ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user