Optimize imports
This commit is contained in:
@ -31,10 +31,10 @@ namespace RageCoop.Client
|
||||
internal static Settings Settings = null;
|
||||
internal static Chat MainChat = null;
|
||||
internal static Stopwatch Counter = new Stopwatch();
|
||||
internal static Logger Logger = null;
|
||||
internal static Logger Log = null;
|
||||
internal static ulong Ticked = 0;
|
||||
internal static Vector3 PlayerPosition;
|
||||
internal static Resources Resources = null;
|
||||
internal static Resources MainRes = null;
|
||||
|
||||
public static Ped P;
|
||||
public static float FPS;
|
||||
@ -59,7 +59,7 @@ namespace RageCoop.Client
|
||||
Util.SaveSettings();
|
||||
}
|
||||
|
||||
Logger = new Logger()
|
||||
Log = new Logger()
|
||||
{
|
||||
Writers = new List<StreamWriter> { CoreUtils.OpenWriter(LogPath) },
|
||||
#if DEBUG
|
||||
@ -68,7 +68,7 @@ namespace RageCoop.Client
|
||||
LogLevel = Settings.LogLevel,
|
||||
#endif
|
||||
};
|
||||
Logger.OnFlush += (line, formatted) =>
|
||||
Log.OnFlush += (line, formatted) =>
|
||||
{
|
||||
switch (line.LogLevel)
|
||||
{
|
||||
@ -102,14 +102,14 @@ namespace RageCoop.Client
|
||||
WorldThread.DoQueuedActions();
|
||||
if (IsUnloading)
|
||||
{
|
||||
Logger.Dispose();
|
||||
Log.Dispose();
|
||||
Networking.Peer?.Dispose();
|
||||
ThreadManager.OnUnload();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
}
|
||||
}
|
||||
protected override void OnStart()
|
||||
@ -121,11 +121,11 @@ namespace RageCoop.Client
|
||||
throw new NotSupportedException("Please update your GTA5 to v1.0.1290 or newer!");
|
||||
}
|
||||
|
||||
Resources = new Resources();
|
||||
MainRes = new Resources();
|
||||
|
||||
|
||||
|
||||
Logger.Info(
|
||||
Log.Info(
|
||||
$"Main script initialized");
|
||||
|
||||
BaseScript.OnStart();
|
||||
@ -160,7 +160,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
}
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ namespace RageCoop.Client
|
||||
{
|
||||
P.Health = 1;
|
||||
Game.Player.WantedLevel = 0;
|
||||
Logger.Debug("Player died.");
|
||||
Log.Debug("Player died.");
|
||||
API.Events.InvokePlayerDied();
|
||||
}
|
||||
|
||||
@ -387,14 +387,14 @@ namespace RageCoop.Client
|
||||
Notification.Show("~g~Connected!");
|
||||
});
|
||||
|
||||
Logger.Info(">> Connected <<");
|
||||
Log.Info(">> Connected <<");
|
||||
}
|
||||
|
||||
public static void CleanUp(string reason)
|
||||
{
|
||||
if (reason != "Abort")
|
||||
{
|
||||
Logger.Info($">> Disconnected << reason: {reason}");
|
||||
Log.Info($">> Disconnected << reason: {reason}");
|
||||
API.QueueAction(() => { Notification.Show("~r~Disconnected: " + reason); });
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ namespace RageCoop.Client
|
||||
Call(SET_ENABLE_VEHICLE_SLIPSTREAMING, false);
|
||||
CoopMenu.DisconnectedMenuSetting();
|
||||
LocalPlayerID = default;
|
||||
Resources.Unload();
|
||||
MainRes.Unload();
|
||||
});
|
||||
Memory.RestorePatches();
|
||||
#if CEF
|
||||
|
@ -62,7 +62,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
}
|
||||
};
|
||||
Menu.Add(SimulatedLatencyItem);
|
||||
|
@ -59,7 +59,7 @@ namespace RageCoop.Client.Menus
|
||||
var realUrl = Main.Settings.MasterServer;
|
||||
serverList = null;
|
||||
try { serverList = JsonDeserialize<List<ServerInfo>>(DownloadString(realUrl)); }
|
||||
catch (Exception ex) { Main.Logger.Error(ex); }
|
||||
catch (Exception ex) { Log.Error(ex); }
|
||||
|
||||
// Need to be processed in main thread
|
||||
API.QueueAction(() =>
|
||||
|
@ -33,7 +33,7 @@ namespace RageCoop.Client
|
||||
var packet = new Packets.FileTransferComplete();
|
||||
packet.Deserialize(data);
|
||||
|
||||
Main.Logger.Debug($"Finalizing download:{packet.ID}");
|
||||
Log.Debug($"Finalizing download:{packet.ID}");
|
||||
Complete(packet.ID);
|
||||
|
||||
// Inform the server that the download is completed
|
||||
@ -48,13 +48,13 @@ namespace RageCoop.Client
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(ResourceFolder);
|
||||
Main.Resources.Load(ResourceFolder, _resources.ToArray());
|
||||
MainRes.Load(ResourceFolder, _resources.ToArray());
|
||||
return new Packets.FileTransferResponse { ID = 0, Response = FileResponse.Loaded };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error("Error occurred when loading server resource");
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error("Error occurred when loading server resource");
|
||||
Log.Error(ex);
|
||||
return new Packets.FileTransferResponse { ID = 0, Response = FileResponse.LoadFailed };
|
||||
}
|
||||
});
|
||||
@ -68,13 +68,13 @@ namespace RageCoop.Client
|
||||
public static bool AddFile(int id, string name, long length)
|
||||
{
|
||||
var path = $"{ResourceFolder}\\{name}";
|
||||
Main.Logger.Debug($"Downloading file to {path} , id:{id}");
|
||||
Log.Debug($"Downloading file to {path} , id:{id}");
|
||||
if (!Directory.Exists(Directory.GetParent(path).FullName))
|
||||
Directory.CreateDirectory(Directory.GetParent(path).FullName);
|
||||
|
||||
if (FileAlreadyExists(ResourceFolder, name, length))
|
||||
{
|
||||
Main.Logger.Debug($"File already exists! canceling download:{name}");
|
||||
Log.Debug($"File already exists! canceling download:{name}");
|
||||
DownloadCompleted?.Invoke(null, Path.Combine(ResourceFolder, name));
|
||||
return false;
|
||||
}
|
||||
@ -82,7 +82,7 @@ namespace RageCoop.Client
|
||||
/*
|
||||
if (!name.EndsWith(".zip"))
|
||||
{
|
||||
Main.Logger.Error($"File download blocked! [{name}]");
|
||||
Log.Error($"File download blocked! [{name}]");
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
@ -114,7 +114,6 @@ namespace RageCoop.Client
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
if (new FileInfo(filePath).Length == length) return true;
|
||||
|
||||
// Delete the file because the length is wrong (maybe the file was updated)
|
||||
File.Delete(filePath);
|
||||
}
|
||||
@ -129,7 +128,7 @@ namespace RageCoop.Client
|
||||
if (InProgressDownloads.TryGetValue(id, out var file))
|
||||
file.Stream.Write(chunk, 0, chunk.Length);
|
||||
else
|
||||
Main.Logger.Trace($"Received unhandled file chunk:{id}");
|
||||
Log.Trace($"Received unhandled file chunk:{id}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,12 +138,12 @@ namespace RageCoop.Client
|
||||
{
|
||||
InProgressDownloads.Remove(id);
|
||||
f.Dispose();
|
||||
Main.Logger.Info($"Download finished:{f.FileName}");
|
||||
Log.Info($"Download finished:{f.FileName}");
|
||||
DownloadCompleted?.Invoke(null, Path.Combine(ResourceFolder, f.FileName));
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.Logger.Error($"Download not found! {id}");
|
||||
Log.Error($"Download not found! {id}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace RageCoop.Client
|
||||
if (p.InternalEndPoint != null && p.ExternalEndPoint != null && (p.Connection == null ||
|
||||
p.Connection.Status == NetConnectionStatus.Disconnected))
|
||||
{
|
||||
Main.Logger.Trace(
|
||||
Log.Trace(
|
||||
$"Sending HolePunch message to {p.InternalEndPoint},{p.ExternalEndPoint}. {p.Username}:{p.ID}");
|
||||
var msg = Networking.Peer.CreateMessage();
|
||||
new Packets.HolePunch
|
||||
@ -41,7 +41,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,31 +49,31 @@ namespace RageCoop.Client
|
||||
{
|
||||
if (PlayerList.Players.TryGetValue(p.TargetID, out var player))
|
||||
{
|
||||
Main.Logger.Debug($"{p.TargetID},{player.Username} added to HolePunch target");
|
||||
Log.Debug($"{p.TargetID},{player.Username} added to HolePunch target");
|
||||
player.InternalEndPoint = CoreUtils.StringToEndPoint(p.TargetInternal);
|
||||
player.ExternalEndPoint = CoreUtils.StringToEndPoint(p.TargetExternal);
|
||||
player.ConnectWhenPunched = p.Connect;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.Logger.Warning("No player with specified TargetID found for hole punching:" + p.TargetID);
|
||||
Log.Warning("No player with specified TargetID found for hole punching:" + p.TargetID);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Punched(Packets.HolePunch p, IPEndPoint from)
|
||||
{
|
||||
Main.Logger.Debug($"HolePunch message received from:{from}, status:{p.Status}");
|
||||
Log.Debug($"HolePunch message received from:{from}, status:{p.Status}");
|
||||
if (PlayerList.Players.TryGetValue(p.Puncher, out var puncher))
|
||||
{
|
||||
Main.Logger.Debug("Puncher identified as: " + puncher.Username);
|
||||
Log.Debug("Puncher identified as: " + puncher.Username);
|
||||
puncher.HolePunchStatus = (byte)(p.Status + 1);
|
||||
if (p.Status >= 3)
|
||||
{
|
||||
Main.Logger.Debug("HolePunch sucess: " + from + ", " + puncher.ID);
|
||||
Log.Debug("HolePunch sucess: " + from + ", " + puncher.ID);
|
||||
if (puncher.ConnectWhenPunched && (puncher.Connection == null ||
|
||||
puncher.Connection.Status == NetConnectionStatus.Disconnected))
|
||||
{
|
||||
Main.Logger.Debug("Connecting to peer: " + from);
|
||||
Log.Debug("Connecting to peer: " + from);
|
||||
var msg = Networking.Peer.CreateMessage();
|
||||
new Packets.P2PConnect { ID = Main.LocalPlayerID }.Pack(msg);
|
||||
puncher.Connection = Networking.Peer.Connect(from, msg);
|
||||
|
@ -30,7 +30,7 @@ namespace RageCoop.Client
|
||||
|
||||
static Networking()
|
||||
{
|
||||
Security = new Security(Main.Logger);
|
||||
Security = new Security(Log);
|
||||
}
|
||||
|
||||
public static float Latency => ServerConnection.AverageRoundtripTime / 2;
|
||||
@ -113,7 +113,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
}
|
||||
};
|
||||
API.QueueAction(() => { Notification.Show("~y~Trying to connect..."); });
|
||||
@ -149,7 +149,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error("Cannot connect to server: ", ex);
|
||||
Log.Error("Cannot connect to server: ", ex);
|
||||
API.QueueAction(() => Notification.Show("Cannot connect to server: " + ex.Message));
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ namespace RageCoop.Client
|
||||
};
|
||||
PlayerList.SetPlayer(packet.PedID, packet.Username);
|
||||
|
||||
Main.Logger.Debug($"player connected:{p.Username}");
|
||||
Log.Debug($"player connected:{p.Username}");
|
||||
API.QueueAction(() =>
|
||||
Notification.Show($"~h~{p.Username}~h~ connected."));
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ namespace RageCoop.Client
|
||||
if (PlayerList.Players.TryGetValue(p.ID, out var player))
|
||||
{
|
||||
player.Connection = message.SenderConnection;
|
||||
Main.Logger.Debug($"Direct connection to {player.Username} established");
|
||||
Log.Debug($"Direct connection to {player.Username} established");
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.Logger.Info(
|
||||
Log.Info(
|
||||
$"Unidentified peer connection from {message.SenderEndPoint} was rejected.");
|
||||
message.SenderConnection.Disconnect("eat poop");
|
||||
}
|
||||
@ -104,7 +104,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.Logger.Debug("Did not find a request handler of type: " + realType);
|
||||
Log.Debug("Did not find a request handler of type: " + realType);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -123,8 +123,8 @@ namespace RageCoop.Client
|
||||
Notification.Show($"~r~~h~Packet Error {ex.Message}");
|
||||
return true;
|
||||
});
|
||||
Main.Logger.Error($"[{packetType}] {ex.Message}");
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error($"[{packetType}] {ex.Message}");
|
||||
Log.Error(ex);
|
||||
Peer.Shutdown($"Packet Error [{packetType}]");
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ namespace RageCoop.Client
|
||||
case NetIncomingMessageType.ErrorMessage:
|
||||
case NetIncomingMessageType.WarningMessage:
|
||||
case NetIncomingMessageType.VerboseDebugMessage:
|
||||
Main.Logger.Trace(message.ReadString());
|
||||
Log.Trace(message.ReadString());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ namespace RageCoop.Client
|
||||
{
|
||||
var c = EntityPool.GetPedByID(packet.ID);
|
||||
if (c == null)
|
||||
// Main.Logger.Debug($"Creating character for incoming sync:{packet.ID}");
|
||||
// Log.Debug($"Creating character for incoming sync:{packet.ID}");
|
||||
EntityPool.ThreadSafe.Add(c = new SyncedPed(packet.ID));
|
||||
var flags = packet.Flags;
|
||||
c.ID = packet.ID;
|
||||
@ -360,7 +360,7 @@ namespace RageCoop.Client
|
||||
if (p == null)
|
||||
{
|
||||
if (packet.Flags.HasProjDataFlag(ProjectileDataFlags.Exploded)) return;
|
||||
// Main.Logger.Debug($"Creating new projectile: {(WeaponHash)packet.WeaponHash}");
|
||||
// Log.Debug($"Creating new projectile: {(WeaponHash)packet.WeaponHash}");
|
||||
EntityPool.ThreadSafe.Add(p = new SyncedProjectile(packet.ID));
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace RageCoop.Client
|
||||
var veh = ped.CurrentVehicle?.GetSyncEntity() ??
|
||||
ped.VehicleTryingToEnter?.GetSyncEntity() ?? ped.LastVehicle?.GetSyncEntity();
|
||||
p.VehicleID = veh?.ID ?? 0;
|
||||
if (p.VehicleID == 0) Main.Logger.Error("Invalid vehicle");
|
||||
if (p.VehicleID == 0) Log.Error("Invalid vehicle");
|
||||
if (p.Speed == 5)
|
||||
p.Seat = ped.GetSeatTryingToEnter();
|
||||
else
|
||||
|
@ -58,7 +58,7 @@ namespace RageCoop.Client
|
||||
|
||||
public static void SetPlayer(int id, string username, float latency = 0)
|
||||
{
|
||||
Main.Logger.Debug($"{id},{username},{latency}");
|
||||
Log.Debug($"{id},{username},{latency}");
|
||||
if (Players.TryGetValue(id, out var p))
|
||||
{
|
||||
p.Username = username;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoAotCompile>false</NoAotCompile>
|
||||
<NoAotCompile>true</NoAotCompile>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
<OutputType>Library</OutputType>
|
||||
|
@ -76,7 +76,7 @@ namespace RageCoop.Client.Scripting
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
SetLastResult(ex.ToString());
|
||||
return 0;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ namespace RageCoop.Client.Scripting
|
||||
{
|
||||
var args = new CustomEventReceivedArgs { Hash = p.Hash, Args = p.Args };
|
||||
|
||||
// Main.Logger.Debug($"CustomEvent:\n"+args.Args.DumpWithType());
|
||||
// Log.Debug($"CustomEvent:\n"+args.Args.DumpWithType());
|
||||
|
||||
if (CustomEventHandlers.TryGetValue(p.Hash, out var handlers))
|
||||
handlers.ForEach(x => { x.Invoke(args); });
|
||||
@ -400,7 +400,7 @@ namespace RageCoop.Client.Scripting
|
||||
[Remoting]
|
||||
public static ClientResource GetResource(string name)
|
||||
{
|
||||
if (Main.Resources.LoadedResources.TryGetValue(name, out var resource))
|
||||
if (MainRes.LoadedResources.TryGetValue(name, out var resource))
|
||||
return resource;
|
||||
|
||||
return null;
|
||||
|
@ -34,7 +34,7 @@ namespace RageCoop.Client.Scripting
|
||||
|
||||
public Resources()
|
||||
{
|
||||
Logger = Main.Logger;
|
||||
Logger = Log;
|
||||
}
|
||||
|
||||
private Logger Logger { get; }
|
||||
@ -52,20 +52,18 @@ namespace RageCoop.Client.Scripting
|
||||
Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories).Where(x => x.CanBeIgnored())
|
||||
.ForEach(File.Delete);
|
||||
|
||||
// TODO Core.ScheduleLoad()...
|
||||
// TODO: Core.ScheduleLoad()...
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
// TODO Core.ScheduleUnload()...
|
||||
// TODO: Core.ScheduleUnload()...
|
||||
}
|
||||
|
||||
private ClientResource Unpack(string zipPath, string dataFolderRoot)
|
||||
{
|
||||
var r = new ClientResource
|
||||
{
|
||||
Logger = Logger,
|
||||
Scripts = new List<ClientScript>(),
|
||||
Name = Path.GetFileNameWithoutExtension(zipPath),
|
||||
DataFolder = Path.Combine(dataFolderRoot, Path.GetFileNameWithoutExtension(zipPath)),
|
||||
ScriptsDirectory = Path.Combine(TempPath, Path.GetFileNameWithoutExtension(zipPath))
|
||||
@ -86,7 +84,6 @@ namespace RageCoop.Client.Scripting
|
||||
IsDirectory = true,
|
||||
Name = dir.Substring(scriptsDir.Length + 1).Replace('\\', '/')
|
||||
});
|
||||
var assemblies = new Dictionary<ResourceFile, Assembly>();
|
||||
foreach (var file in Directory.GetFiles(scriptsDir, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
if (Path.GetFileName(file).CanBeIgnored())
|
||||
@ -105,9 +102,8 @@ namespace RageCoop.Client.Scripting
|
||||
}
|
||||
|
||||
var relativeName = file.Substring(scriptsDir.Length + 1).Replace('\\', '/');
|
||||
var rfile = new ResourceFile
|
||||
var rfile = new ClientFile
|
||||
{
|
||||
GetStream = () => { return new FileStream(file, FileMode.Open, FileAccess.Read); },
|
||||
IsDirectory = false,
|
||||
Name = relativeName
|
||||
};
|
||||
|
@ -3,6 +3,7 @@ global using GTA.Native;
|
||||
global using static GTA.Native.Function;
|
||||
global using static GTA.Native.Hash;
|
||||
global using static RageCoop.Client.Shared;
|
||||
global using static RageCoop.Client.Main;
|
||||
global using Console = GTA.Console;
|
||||
global using static RageCoop.Core.Shared;
|
||||
using System.IO;
|
||||
|
@ -175,7 +175,7 @@ namespace RageCoop.Client
|
||||
{
|
||||
if (MainPed.Exists())
|
||||
{
|
||||
// Main.Logger.Debug($"Removing ped {ID}. Reason:CreateCharacter");
|
||||
// Log.Debug($"Removing ped {ID}. Reason:CreateCharacter");
|
||||
MainPed.Kill();
|
||||
MainPed.MarkAsNoLongerNeeded();
|
||||
MainPed.Delete();
|
||||
|
@ -102,11 +102,11 @@ namespace RageCoop.Client
|
||||
var player = GetPedByID(Main.LocalPlayerID);
|
||||
if (player == null)
|
||||
{
|
||||
Main.Logger.Debug($"Creating SyncEntity for player, handle:{p.Handle}");
|
||||
Log.Debug($"Creating SyncEntity for player, handle:{p.Handle}");
|
||||
var c = new SyncedPed(p);
|
||||
Main.LocalPlayerID = c.OwnerID = c.ID;
|
||||
Add(c);
|
||||
Main.Logger.Debug($"Local player ID is:{c.ID}");
|
||||
Log.Debug($"Local player ID is:{c.ID}");
|
||||
PlayerList.SetPlayer(c.ID, Main.Settings.Username);
|
||||
return true;
|
||||
}
|
||||
@ -155,7 +155,7 @@ namespace RageCoop.Client
|
||||
if (p != null)
|
||||
{
|
||||
if (PedsByHandle.ContainsKey(p.Handle)) PedsByHandle.Remove(p.Handle);
|
||||
// Main.Logger.Debug($"Removing ped {c.ID}. Reason:{reason}");
|
||||
// Log.Debug($"Removing ped {c.ID}. Reason:{reason}");
|
||||
p.AttachedBlip?.Delete();
|
||||
p.Kill();
|
||||
p.Model.MarkAsNoLongerNeeded();
|
||||
@ -208,7 +208,7 @@ namespace RageCoop.Client
|
||||
if (veh != null)
|
||||
{
|
||||
if (VehiclesByHandle.ContainsKey(veh.Handle)) VehiclesByHandle.Remove(veh.Handle);
|
||||
// Main.Logger.Debug($"Removing vehicle {v.ID}. Reason:{reason}");
|
||||
// Log.Debug($"Removing vehicle {v.ID}. Reason:{reason}");
|
||||
veh.AttachedBlip?.Delete();
|
||||
veh.Model.MarkAsNoLongerNeeded();
|
||||
veh.MarkAsNoLongerNeeded();
|
||||
@ -255,7 +255,7 @@ namespace RageCoop.Client
|
||||
if (p != null)
|
||||
{
|
||||
if (ProjectilesByHandle.ContainsKey(p.Handle)) ProjectilesByHandle.Remove(p.Handle);
|
||||
Main.Logger.Debug($"Removing projectile {sp.ID}. Reason:{reason}");
|
||||
Log.Debug($"Removing projectile {sp.ID}. Reason:{reason}");
|
||||
p.Explode();
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ namespace RageCoop.Client
|
||||
continue;
|
||||
}
|
||||
|
||||
// Main.Logger.Trace($"Creating SyncEntity for ped, handle:{p.Handle}");
|
||||
// Log.Trace($"Creating SyncEntity for ped, handle:{p.Handle}");
|
||||
c = new SyncedPed((Ped)Entity.FromHandle(p));
|
||||
|
||||
Add(c);
|
||||
@ -441,7 +441,7 @@ namespace RageCoop.Client
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Main.Logger.Debug($"Creating SyncEntity for vehicle, handle:{veh.Handle}");
|
||||
// Log.Debug($"Creating SyncEntity for vehicle, handle:{veh.Handle}");
|
||||
|
||||
Add(new SyncedVehicle(cveh));
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ namespace RageCoop.Client
|
||||
{
|
||||
return;
|
||||
// p = Game.Player.Character;
|
||||
// Main.Logger.Warning("Failed to find owner for bullet");
|
||||
// Log.Warning("Failed to find owner for bullet");
|
||||
}
|
||||
|
||||
var damage = (int)p.GetWeaponDamage(weaponHash);
|
||||
|
@ -40,15 +40,15 @@ namespace RageCoop.Client
|
||||
catch (ThreadInterruptedException) { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error($"Unhandled exception caught in thread {Environment.CurrentManagedThreadId}", ex);
|
||||
Log.Error($"Unhandled exception caught in thread {Environment.CurrentManagedThreadId}", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Main.Logger.Debug($"Thread stopped: " + Environment.CurrentManagedThreadId);
|
||||
Log.Debug($"Thread stopped: " + Environment.CurrentManagedThreadId);
|
||||
}
|
||||
});
|
||||
created.Name = name;
|
||||
Main.Logger.Debug($"Thread created: {name}, id: {created.ManagedThreadId}");
|
||||
Log.Debug($"Thread created: {name}, id: {created.ManagedThreadId}");
|
||||
_threads.Add(created);
|
||||
if (startNow) created.Start();
|
||||
return created;
|
||||
@ -63,7 +63,7 @@ namespace RageCoop.Client
|
||||
{
|
||||
if (thread.IsAlive)
|
||||
{
|
||||
Main.Logger.Debug($"Waiting for thread {thread.ManagedThreadId} to stop");
|
||||
Log.Debug($"Waiting for thread {thread.ManagedThreadId} to stop");
|
||||
// thread.Interrupt(); PlatformNotSupportedException ?
|
||||
thread.Join();
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ namespace RageCoop.Client
|
||||
case WeaponHash.MG:
|
||||
return new string[2] { "weapons@machinegun@mg_str", "reload_aim" };
|
||||
default:
|
||||
Main.Logger.Warning(
|
||||
Log.Warning(
|
||||
$"~r~Reloading failed! Weapon ~g~[{ped.Weapons.Current.Hash}]~r~ could not be found!");
|
||||
return null;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger?.Error(ex);
|
||||
Log?.Error(ex);
|
||||
File.WriteAllText(path, JsonSerialize(settings = new Settings()));
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger?.Error(ex);
|
||||
Log?.Error(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace RageCoop.Client
|
||||
if (File.Exists(WeaponFixDataPath))
|
||||
WeaponFix = JsonDeserialize<WeaponFix>(File.ReadAllText(WeaponFixDataPath));
|
||||
else
|
||||
Main.Logger.Warning("Weapon fix data not found");
|
||||
Log.Warning("Weapon fix data not found");
|
||||
}
|
||||
|
||||
public static void DumpWeaponFix(string path)
|
||||
|
@ -50,7 +50,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
}
|
||||
|
||||
if (!Networking.IsOnServer) return;
|
||||
@ -139,7 +139,7 @@ namespace RageCoop.Client
|
||||
if (c == null || (c.IsLocal && ped.Handle != Game.Player.Character.Handle &&
|
||||
ped.PopulationType != EntityPopulationType.Mission))
|
||||
{
|
||||
Main.Logger.Trace($"Removing ped {ped.Handle}. Reason:RemoveTraffic");
|
||||
Log.Trace($"Removing ped {ped.Handle}. Reason:RemoveTraffic");
|
||||
ped.CurrentVehicle?.Delete();
|
||||
ped.Kill();
|
||||
ped.Delete();
|
||||
@ -154,7 +154,7 @@ namespace RageCoop.Client
|
||||
// Don't delete player's vehicle
|
||||
continue;
|
||||
if (v == null || (v.IsLocal && veh.PopulationType != EntityPopulationType.Mission))
|
||||
// Main.Logger.Debug($"Removing Vehicle {veh.Handle}. Reason:ClearTraffic");
|
||||
// Log.Debug($"Removing Vehicle {veh.Handle}. Reason:ClearTraffic");
|
||||
|
||||
veh.Delete();
|
||||
}
|
||||
@ -181,7 +181,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
QueuedActions.Remove(action);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user