Removed slider for NPCs. Small bug fixes and changes
This commit is contained in:
@ -228,11 +228,10 @@ namespace CoopClient
|
||||
/// <summary>
|
||||
/// ?
|
||||
/// </summary>
|
||||
public static void Configure(string playerName, bool shareNpcsWithPlayers, int streamedNpcs, bool disableTrafficSharing, bool debug = false)
|
||||
public static void Configure(string playerName, bool shareNpcsWithPlayers, bool disableTrafficSharing, bool debug = false)
|
||||
{
|
||||
Main.MainSettings.Username = playerName;
|
||||
Main.ShareNpcsWithPlayers = shareNpcsWithPlayers;
|
||||
Main.MainSettings.StreamedNPCs = streamedNpcs;
|
||||
Main.DisableTraffic = disableTrafficSharing;
|
||||
#if DEBUG
|
||||
Main.UseDebug = debug;
|
||||
|
@ -418,17 +418,16 @@ namespace CoopClient.Entities
|
||||
{
|
||||
if (MainVehicle == null || !MainVehicle.Exists() || MainVehicle.Model.Hash != CurrentVehicleModelHash)
|
||||
{
|
||||
Vehicle targetVehicle = World.GetClosestVehicle(Position, 7f, new Model[] { CurrentVehicleModelHash });
|
||||
|
||||
bool vehFound = false;
|
||||
|
||||
List<Vehicle> vehs = World.GetNearbyVehicles(Character, 7f, new Model[] { CurrentVehicleModelHash }).OrderBy(v => (v.Position - Character.Position).Length()).Take(3).ToList();
|
||||
|
||||
foreach (Vehicle veh in vehs)
|
||||
if (targetVehicle != null)
|
||||
{
|
||||
if (veh.IsSeatFree((VehicleSeat)VehicleSeatIndex))
|
||||
if (targetVehicle.IsSeatFree((VehicleSeat)VehicleSeatIndex))
|
||||
{
|
||||
MainVehicle = veh;
|
||||
MainVehicle = targetVehicle;
|
||||
vehFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,7 +441,7 @@ namespace CoopClient.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
MainVehicle = World.CreateVehicle(vehicleModel, VehiclePosition, VehicleRotation.Z);
|
||||
MainVehicle = World.CreateVehicle(vehicleModel, VehiclePosition, VehicleRotation.W);
|
||||
vehicleModel.MarkAsNoLongerNeeded();
|
||||
}
|
||||
}
|
||||
|
@ -37,14 +37,14 @@ namespace CoopClient.Entities
|
||||
{
|
||||
if ((tickCount - npc.Value.LastUpdateReceived) > 3000)
|
||||
{
|
||||
if (npc.Value.Character != null && npc.Value.Character.Exists() && npc.Value.Health > 0)
|
||||
if (npc.Value.Character != null && npc.Value.Character.Exists() && !npc.Value.Character.IsDead)
|
||||
{
|
||||
npc.Value.Character.Kill();
|
||||
npc.Value.Character.MarkAsNoLongerNeeded();
|
||||
npc.Value.Character.Delete();
|
||||
}
|
||||
|
||||
if (npc.Value.MainVehicle != null && npc.Value.MainVehicle.Exists() && npc.Value.MainVehicle.IsSeatFree(VehicleSeat.Driver) && npc.Value.MainVehicle.PassengerCount == 0)
|
||||
if (npc.Value.MainVehicle != null && npc.Value.MainVehicle.Exists() && !npc.Value.MainVehicle.IsDead && npc.Value.MainVehicle.IsSeatFree(VehicleSeat.Driver) && npc.Value.MainVehicle.PassengerCount == 0)
|
||||
{
|
||||
npc.Value.MainVehicle.MarkAsNoLongerNeeded();
|
||||
npc.Value.MainVehicle.Delete();
|
||||
@ -66,9 +66,8 @@ namespace CoopClient.Entities
|
||||
{
|
||||
// Send all npcs from the current player
|
||||
foreach (Ped ped in World.GetNearbyPeds(Game.Player.Character.Position, 150f)
|
||||
.Where(p => p.Handle != Game.Player.Character.Handle && !p.IsDead && p.RelationshipGroup != Main.RelationshipGroup)
|
||||
.OrderBy(p => (p.Position - Game.Player.Character.Position).Length())
|
||||
.Take((Main.MainSettings.StreamedNPCs > 30 || Main.MainSettings.StreamedNPCs < 0) ? 0 : Main.MainSettings.StreamedNPCs))
|
||||
.Where(p => p.Handle != Game.Player.Character.Handle && p.RelationshipGroup != Main.RelationshipGroup)
|
||||
.OrderBy(p => (p.Position - Game.Player.Character.Position).Length()))
|
||||
{
|
||||
Main.MainNetworking.SendNpcData(ped);
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ namespace CoopClient.Menus.Sub
|
||||
};
|
||||
|
||||
private readonly NativeCheckboxItem DisableTraffic = new NativeCheckboxItem("Disable Traffic (NPCs/Vehicles)", "Local traffic only", Main.DisableTraffic);
|
||||
private readonly NativeCheckboxItem ShareNpcsItem = new NativeCheckboxItem("Share NPCs", "30 NPCs = 1mb / 9 seconds (UPLOAD)", Main.ShareNpcsWithPlayers) { Enabled = false };
|
||||
private readonly NativeSliderItem StreamedNPCsItem = new NativeSliderItem($"Streamed NPCs ({Main.MainSettings.StreamedNPCs})", 30, Main.MainSettings.StreamedNPCs > 30 ? 30 : Main.MainSettings.StreamedNPCs);
|
||||
private readonly NativeCheckboxItem ShareNPCsItem = new NativeCheckboxItem("Share NPCs", "~y~WARNING:~s~ High network traffic! (Every 5 seconds = 1mb or more)", Main.ShareNpcsWithPlayers) { Enabled = false };
|
||||
private readonly NativeCheckboxItem FlipMenuItem = new NativeCheckboxItem("Flip menu", Main.MainSettings.FlipMenu);
|
||||
#if DEBUG
|
||||
private readonly NativeCheckboxItem UseDebugItem = new NativeCheckboxItem("Debug", Main.UseDebug);
|
||||
@ -28,8 +27,7 @@ namespace CoopClient.Menus.Sub
|
||||
public Settings()
|
||||
{
|
||||
DisableTraffic.CheckboxChanged += DisableTrafficCheckboxChanged;
|
||||
ShareNpcsItem.CheckboxChanged += (item, check) => { Main.ShareNpcsWithPlayers = ShareNpcsItem.Checked; };
|
||||
StreamedNPCsItem.ValueChanged += StreamedNpcsValueChanged;
|
||||
ShareNPCsItem.CheckboxChanged += (item, check) => { Main.ShareNpcsWithPlayers = ShareNPCsItem.Checked; };
|
||||
FlipMenuItem.CheckboxChanged += FlipMenuCheckboxChanged;
|
||||
#if DEBUG
|
||||
UseDebugItem.CheckboxChanged += UseDebugCheckboxChanged;
|
||||
@ -37,8 +35,7 @@ namespace CoopClient.Menus.Sub
|
||||
#endif
|
||||
|
||||
MainMenu.Add(DisableTraffic);
|
||||
MainMenu.Add(ShareNpcsItem);
|
||||
MainMenu.Add(StreamedNPCsItem);
|
||||
MainMenu.Add(ShareNPCsItem);
|
||||
MainMenu.Add(FlipMenuItem);
|
||||
#if DEBUG
|
||||
MainMenu.Add(UseDebugItem);
|
||||
@ -52,26 +49,19 @@ namespace CoopClient.Menus.Sub
|
||||
|
||||
if (DisableTraffic.Checked)
|
||||
{
|
||||
if (ShareNpcsItem.Checked)
|
||||
if (ShareNPCsItem.Checked)
|
||||
{
|
||||
ShareNpcsItem.Checked = false;
|
||||
ShareNPCsItem.Checked = false;
|
||||
}
|
||||
|
||||
ShareNpcsItem.Enabled = false;
|
||||
ShareNPCsItem.Enabled = false;
|
||||
}
|
||||
else if (Main.NpcsAllowed && !ShareNpcsItem.Enabled)
|
||||
else if (Main.NpcsAllowed && !ShareNPCsItem.Enabled)
|
||||
{
|
||||
ShareNpcsItem.Enabled = true;
|
||||
ShareNPCsItem.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal void StreamedNpcsValueChanged(object a, System.EventArgs b)
|
||||
{
|
||||
Main.MainSettings.StreamedNPCs = StreamedNPCsItem.Value;
|
||||
Util.SaveSettings();
|
||||
StreamedNPCsItem.Title = string.Format("Streamed NPCs ({0})", Main.MainSettings.StreamedNPCs);
|
||||
}
|
||||
|
||||
internal void FlipMenuCheckboxChanged(object a, System.EventArgs b)
|
||||
{
|
||||
#if !NON_INTERACTIVE
|
||||
|
@ -21,9 +21,5 @@
|
||||
/// Don't use it!
|
||||
/// </summary>
|
||||
public bool FlipMenu { get; set; } = false;
|
||||
/// <summary>
|
||||
/// Don't use it!
|
||||
/// </summary>
|
||||
public int StreamedNPCs { get; set; } = 15;
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ namespace CoopClient
|
||||
Function.Call((Hash)0xF796359A959DF65D, false); //Display distant vehicles
|
||||
Function.Call(Hash.DISABLE_VEHICLE_DISTANTLIGHTS, true);
|
||||
|
||||
foreach (Ped ped in World.GetAllPeds().Where(p => p.RelationshipGroup != "SYNCPED"))
|
||||
foreach (Ped ped in World.GetAllPeds().Where(p => p.RelationshipGroup != "SYNCPED" && !p.IsPlayer))
|
||||
{
|
||||
ped.CurrentVehicle?.Delete();
|
||||
ped.Kill();
|
||||
|
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyVersion>1.0.2.0001</AssemblyVersion>
|
||||
<AssemblyVersion>1.0.3.0001</AssemblyVersion>
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
<RepositoryUrl>https://github.com/GTACOOP-R/GTACoop-R</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
@ -88,7 +88,7 @@ namespace CoopServer
|
||||
|
||||
try
|
||||
{
|
||||
string data = await httpClient.GetStringAsync("https://ipinfo.io/json");
|
||||
string data = await httpClient.GetStringAsync("https://wimip.info/json");
|
||||
|
||||
info = JsonConvert.DeserializeObject<IpInfo>(data);
|
||||
}
|
||||
|
Reference in New Issue
Block a user