Fixed: flare gun not working properly, menu bug
This commit is contained in:
parent
b1277584fd
commit
fd30a899c1
@ -178,6 +178,8 @@ namespace RageCoop.Client
|
|||||||
MainChat.OnKeyDown(e.KeyCode);
|
MainChat.OnKeyDown(e.KeyCode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Networking.IsOnServer)
|
||||||
|
{
|
||||||
if (Game.IsControlPressed(GTA.Control.FrontendPause))
|
if (Game.IsControlPressed(GTA.Control.FrontendPause))
|
||||||
{
|
{
|
||||||
Function.Call(Hash.ACTIVATE_FRONTEND_MENU, Function.Call<int>(Hash.GET_HASH_KEY, "FE_MENU_VERSION_SP_PAUSE"), false, 0);
|
Function.Call(Hash.ACTIVATE_FRONTEND_MENU, Function.Call<int>(Hash.GET_HASH_KEY, "FE_MENU_VERSION_SP_PAUSE"), false, 0);
|
||||||
@ -188,6 +190,7 @@ namespace RageCoop.Client
|
|||||||
Function.Call(Hash.ACTIVATE_FRONTEND_MENU, Function.Call<int>(Hash.GET_HASH_KEY, "FE_MENU_VERSION_SP_PAUSE"), false, 0);
|
Function.Call(Hash.ACTIVATE_FRONTEND_MENU, Function.Call<int>(Hash.GET_HASH_KEY, "FE_MENU_VERSION_SP_PAUSE"), false, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (e.KeyCode == Settings.MenuKey)
|
if (e.KeyCode == Settings.MenuKey)
|
||||||
{
|
{
|
||||||
if (MainMenu.MenuPool.AreAnyVisible)
|
if (MainMenu.MenuPool.AreAnyVisible)
|
||||||
|
@ -97,8 +97,6 @@ namespace RageCoop.Client.Menus
|
|||||||
{
|
{
|
||||||
MainMenu.Items[2].Enabled = true;
|
MainMenu.Items[2].Enabled = true;
|
||||||
MainMenu.Items[2].Title = "Disconnect";
|
MainMenu.Items[2].Title = "Disconnect";
|
||||||
SubSettings.MainMenu.Items[1].Enabled = !Main.Settings.DisableTraffic && Main.NPCsAllowed;
|
|
||||||
|
|
||||||
MainMenu.Visible = false;
|
MainMenu.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ namespace RageCoop.Client.Menus.Sub
|
|||||||
|
|
||||||
private static NativeItem _menuKey = new NativeItem("Menu Key","The key to open menu", Main.Settings.MenuKey.ToString());
|
private static NativeItem _menuKey = new NativeItem("Menu Key","The key to open menu", Main.Settings.MenuKey.ToString());
|
||||||
private static NativeItem _passengerKey = new NativeItem("Passenger Key", "The key to enter a vehicle as passenger", Main.Settings.PassengerKey.ToString());
|
private static NativeItem _passengerKey = new NativeItem("Passenger Key", "The key to enter a vehicle as passenger", Main.Settings.PassengerKey.ToString());
|
||||||
|
private static NativeItem _vehicleSoftLimit = new NativeItem("Vehicle limit (soft)", "The game won't spawn more NPC traffic if the limit is exceeded. \n-1 for unlimited (not recommended).",Main.Settings.WorldVehicleSoftLimit.ToString());
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
@ -40,6 +41,7 @@ namespace RageCoop.Client.Menus.Sub
|
|||||||
_showNetworkInfoItem.CheckboxChanged += ShowNetworkInfoCheckboxChanged;
|
_showNetworkInfoItem.CheckboxChanged += ShowNetworkInfoCheckboxChanged;
|
||||||
_menuKey.Activated+=ChaneMenuKey;
|
_menuKey.Activated+=ChaneMenuKey;
|
||||||
_passengerKey.Activated+=ChangePassengerKey;
|
_passengerKey.Activated+=ChangePassengerKey;
|
||||||
|
_vehicleSoftLimit.Activated+=vehicleSoftLimit_Activated;
|
||||||
|
|
||||||
MainMenu.Add(_disableTrafficItem);
|
MainMenu.Add(_disableTrafficItem);
|
||||||
MainMenu.Add(_disablePauseAlt);
|
MainMenu.Add(_disablePauseAlt);
|
||||||
@ -47,14 +49,28 @@ namespace RageCoop.Client.Menus.Sub
|
|||||||
MainMenu.Add(_showNetworkInfoItem);
|
MainMenu.Add(_showNetworkInfoItem);
|
||||||
MainMenu.Add(_menuKey);
|
MainMenu.Add(_menuKey);
|
||||||
MainMenu.Add(_passengerKey);
|
MainMenu.Add(_passengerKey);
|
||||||
|
MainMenu.Add(_vehicleSoftLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void _disablePauseAlt_CheckboxChanged(object sender, EventArgs e)
|
private void _disablePauseAlt_CheckboxChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Main.Settings.DisableAlternatePause=_disablePauseAlt.Checked;
|
Main.Settings.DisableAlternatePause=_disablePauseAlt.Checked;
|
||||||
Util.SaveSettings();
|
Util.SaveSettings();
|
||||||
}
|
}
|
||||||
|
private void vehicleSoftLimit_Activated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Main.Settings.WorldVehicleSoftLimit =int.Parse(
|
||||||
|
Game.GetUserInput(WindowTitle.EnterMessage20,
|
||||||
|
Main.Settings.WorldVehicleSoftLimit.ToString(), 20));
|
||||||
|
_menuKey.AltTitle=Main.Settings.WorldVehicleSoftLimit.ToString();
|
||||||
|
Util.SaveSettings();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
private void ChaneMenuKey(object sender, EventArgs e)
|
private void ChaneMenuKey(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -903,7 +903,8 @@ namespace RageCoop.Client
|
|||||||
WeaponHash.UpNAtomizer,
|
WeaponHash.UpNAtomizer,
|
||||||
WeaponHash.GrenadeLauncher,
|
WeaponHash.GrenadeLauncher,
|
||||||
WeaponHash.GrenadeLauncherSmoke,
|
WeaponHash.GrenadeLauncherSmoke,
|
||||||
WeaponHash.CompactGrenadeLauncher
|
WeaponHash.CompactGrenadeLauncher,
|
||||||
|
WeaponHash.FlareGun,
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
public static readonly Dictionary<WeaponHash, ExplosionType> WeaponExplosionTypes = new Dictionary<WeaponHash, ExplosionType> {
|
public static readonly Dictionary<WeaponHash, ExplosionType> WeaponExplosionTypes = new Dictionary<WeaponHash, ExplosionType> {
|
||||||
|
@ -50,6 +50,11 @@ namespace RageCoop.Client
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DisableAlternatePause { get; set; } = true;
|
public bool DisableAlternatePause { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The game won't spawn more NPC traffic if the limit is exceeded. -1 for unlimited (not recommended).
|
||||||
|
/// </summary>
|
||||||
|
public int WorldVehicleSoftLimit { get; set; } = 35;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,6 +496,11 @@ namespace RageCoop.Client
|
|||||||
|
|
||||||
if (IsReloading)
|
if (IsReloading)
|
||||||
{
|
{
|
||||||
|
if (!MainPed.IsTaskActive(TaskType.CTaskReloadGun))
|
||||||
|
{
|
||||||
|
MainPed.Task.ReloadWeapon();
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (!_isPlayingAnimation)
|
if (!_isPlayingAnimation)
|
||||||
{
|
{
|
||||||
string[] reloadingAnim = MainPed.GetReloadingAnimation();
|
string[] reloadingAnim = MainPed.GetReloadingAnimation();
|
||||||
@ -506,6 +511,7 @@ namespace RageCoop.Client
|
|||||||
MainPed.Task.PlayAnimation(_currentAnimation[0], _currentAnimation[1], 8f, -1, AnimationFlags.AllowRotation | AnimationFlags.UpperBodyOnly);
|
MainPed.Task.PlayAnimation(_currentAnimation[0], _currentAnimation[1], 8f, -1, AnimationFlags.AllowRotation | AnimationFlags.UpperBodyOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
SmoothTransition();
|
SmoothTransition();
|
||||||
}
|
}
|
||||||
else if (_currentAnimation[1] == "reload_aim")
|
else if (_currentAnimation[1] == "reload_aim")
|
||||||
@ -563,6 +569,7 @@ namespace RageCoop.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region WEAPON
|
#region WEAPON
|
||||||
|
WeaponHash appliedWeaponhash = WeaponHash.Unarmed;
|
||||||
private void CheckCurrentWeapon()
|
private void CheckCurrentWeapon()
|
||||||
{
|
{
|
||||||
if (MainPed.Weapons.Current.Hash != (WeaponHash)CurrentWeaponHash || !WeaponComponents.Compare(_lastWeaponComponents))
|
if (MainPed.Weapons.Current.Hash != (WeaponHash)CurrentWeaponHash || !WeaponComponents.Compare(_lastWeaponComponents))
|
||||||
@ -593,7 +600,6 @@ namespace RageCoop.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void DisplayAiming()
|
private void DisplayAiming()
|
||||||
{
|
{
|
||||||
if (Velocity==default)
|
if (Velocity==default)
|
||||||
|
@ -14,7 +14,11 @@ namespace RageCoop.Client
|
|||||||
ID=EntityPool.RequestNewID();
|
ID=EntityPool.RequestNewID();
|
||||||
IsMine=true;
|
IsMine=true;
|
||||||
MainProjectile = p;
|
MainProjectile = p;
|
||||||
ShooterID=p.Owner.GetSyncEntity().ID;
|
var shooter = p.Owner.GetSyncEntity();
|
||||||
|
if(shooter != null)
|
||||||
|
{
|
||||||
|
ShooterID=shooter.ID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public SyncedProjectile(int id)
|
public SyncedProjectile(int id)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
|
||||||
|
using System;
|
||||||
using GTA;
|
using GTA;
|
||||||
using GTA.Native;
|
using GTA.Native;
|
||||||
using RageCoop.Core;
|
using RageCoop.Core;
|
||||||
@ -16,7 +17,10 @@ namespace RageCoop.Client
|
|||||||
public static object PedsLock = new object();
|
public static object PedsLock = new object();
|
||||||
private static Dictionary<int, SyncedPed> ID_Peds = new Dictionary<int, SyncedPed>();
|
private static Dictionary<int, SyncedPed> ID_Peds = new Dictionary<int, SyncedPed>();
|
||||||
public static int CharactersCount { get { return ID_Peds.Count; } }
|
public static int CharactersCount { get { return ID_Peds.Count; } }
|
||||||
|
#if BENCHMARK
|
||||||
private static Stopwatch PerfCounter=new Stopwatch();
|
private static Stopwatch PerfCounter=new Stopwatch();
|
||||||
|
private static Stopwatch PerfCounter2=Stopwatch.StartNew();
|
||||||
|
#endif
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Faster access to Character with Handle, but values may not equal to <see cref="ID_Peds"/> since Ped might not have been created.
|
/// Faster access to Character with Handle, but values may not equal to <see cref="ID_Peds"/> since Ped might not have been created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -54,6 +58,8 @@ namespace RageCoop.Client
|
|||||||
ID_Projectiles.Clear();
|
ID_Projectiles.Clear();
|
||||||
Handle_Projectiles.Clear();
|
Handle_Projectiles.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region PEDS
|
||||||
public static SyncedPed GetPedByID(int id)
|
public static SyncedPed GetPedByID(int id)
|
||||||
{
|
{
|
||||||
return ID_Peds.ContainsKey(id) ? ID_Peds[id] : null;
|
return ID_Peds.ContainsKey(id) ? ID_Peds[id] : null;
|
||||||
@ -140,6 +146,7 @@ namespace RageCoop.Client
|
|||||||
Main.Logger.Debug($"Removing ped {c.ID}. Reason:{reason}");
|
Main.Logger.Debug($"Removing ped {c.ID}. Reason:{reason}");
|
||||||
p.AttachedBlip?.Delete();
|
p.AttachedBlip?.Delete();
|
||||||
p.Kill();
|
p.Kill();
|
||||||
|
p.MarkAsNoLongerNeeded();
|
||||||
p.Delete();
|
p.Delete();
|
||||||
}
|
}
|
||||||
c.PedBlip?.Delete();
|
c.PedBlip?.Delete();
|
||||||
@ -147,8 +154,9 @@ namespace RageCoop.Client
|
|||||||
ID_Peds.Remove(id);
|
ID_Peds.Remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region VEHICLES
|
||||||
public static SyncedVehicle GetVehicleByID(int id)
|
public static SyncedVehicle GetVehicleByID(int id)
|
||||||
{
|
{
|
||||||
return ID_Vehicles.ContainsKey(id) ? ID_Vehicles[id] : null;
|
return ID_Vehicles.ContainsKey(id) ? ID_Vehicles[id] : null;
|
||||||
@ -195,13 +203,16 @@ namespace RageCoop.Client
|
|||||||
}
|
}
|
||||||
Main.Logger.Debug($"Removing vehicle {v.ID}. Reason:{reason}");
|
Main.Logger.Debug($"Removing vehicle {v.ID}. Reason:{reason}");
|
||||||
veh.AttachedBlip?.Delete();
|
veh.AttachedBlip?.Delete();
|
||||||
|
veh.MarkAsNoLongerNeeded();
|
||||||
veh.Delete();
|
veh.Delete();
|
||||||
}
|
}
|
||||||
ID_Vehicles.Remove(id);
|
ID_Vehicles.Remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region PROJECTILES
|
||||||
public static SyncedProjectile GetProjectileByID(int id)
|
public static SyncedProjectile GetProjectileByID(int id)
|
||||||
{
|
{
|
||||||
return ID_Projectiles.ContainsKey(id) ? ID_Projectiles[id] : null;
|
return ID_Projectiles.ContainsKey(id) ? ID_Projectiles[id] : null;
|
||||||
@ -257,16 +268,26 @@ namespace RageCoop.Client
|
|||||||
{
|
{
|
||||||
return ID_Projectiles.ContainsKey(id);
|
return ID_Projectiles.ContainsKey(id);
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
public static void DoSync()
|
public static void DoSync()
|
||||||
{
|
{
|
||||||
|
#if BENCHMARK
|
||||||
PerfCounter.Restart();
|
PerfCounter.Restart();
|
||||||
Debug.TimeStamps[TimeStamp.CheckProjectiles]=PerfCounter.ElapsedTicks;
|
Debug.TimeStamps[TimeStamp.CheckProjectiles]=PerfCounter.ElapsedTicks;
|
||||||
|
#endif
|
||||||
var allPeds = World.GetAllPeds();
|
var allPeds = World.GetAllPeds();
|
||||||
var allVehicles=World.GetAllVehicles();
|
var allVehicles=World.GetAllVehicles();
|
||||||
var allProjectiles=World.GetAllProjectiles();
|
var allProjectiles=World.GetAllProjectiles();
|
||||||
|
if (Main.Settings.WorldVehicleSoftLimit>-1)
|
||||||
|
{
|
||||||
|
if (Main.Ticked%100==0) { if (allVehicles.Length>Main.Settings.WorldVehicleSoftLimit) { SetBudget(0); } else { SetBudget(1); } }
|
||||||
|
}
|
||||||
|
|
||||||
|
#if BENCHMARK
|
||||||
|
|
||||||
if (Main.Ticked%100==0) { if (allVehicles.Length>50) { SetBudget(0); } else { SetBudget(1); } }
|
|
||||||
Debug.TimeStamps[TimeStamp.GetAllEntities]=PerfCounter.ElapsedTicks;
|
Debug.TimeStamps[TimeStamp.GetAllEntities]=PerfCounter.ElapsedTicks;
|
||||||
|
#endif
|
||||||
lock (ProjectilesLock)
|
lock (ProjectilesLock)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -306,6 +327,8 @@ namespace RageCoop.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lock (PedsLock)
|
lock (PedsLock)
|
||||||
{
|
{
|
||||||
EntityPool.AddPlayer();
|
EntityPool.AddPlayer();
|
||||||
@ -323,8 +346,10 @@ namespace RageCoop.Client
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Debug.TimeStamps[TimeStamp.AddPeds]=PerfCounter.ElapsedTicks;
|
#if BENCHMARK
|
||||||
|
|
||||||
|
Debug.TimeStamps[TimeStamp.AddPeds]=PerfCounter.ElapsedTicks;
|
||||||
|
#endif
|
||||||
|
|
||||||
foreach (SyncedPed c in ID_Peds.Values.ToArray())
|
foreach (SyncedPed c in ID_Peds.Values.ToArray())
|
||||||
{
|
{
|
||||||
@ -337,7 +362,9 @@ namespace RageCoop.Client
|
|||||||
// Outgoing sync
|
// Outgoing sync
|
||||||
if (c.IsMine)
|
if (c.IsMine)
|
||||||
{
|
{
|
||||||
|
#if BENCHMARK
|
||||||
|
var start = PerfCounter2.ElapsedTicks;
|
||||||
|
#endif
|
||||||
// event check
|
// event check
|
||||||
SyncEvents.Check(c);
|
SyncEvents.Check(c);
|
||||||
|
|
||||||
@ -349,20 +376,31 @@ namespace RageCoop.Client
|
|||||||
{
|
{
|
||||||
Networking.SendPed(c);
|
Networking.SendPed(c);
|
||||||
}
|
}
|
||||||
|
#if BENCHMARK
|
||||||
|
|
||||||
|
Debug.TimeStamps[TimeStamp.SendPed]=PerfCounter2.ElapsedTicks-start;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else // Incoming sync
|
else // Incoming sync
|
||||||
{
|
{
|
||||||
|
#if BENCHMARK
|
||||||
|
var start = PerfCounter2.ElapsedTicks;
|
||||||
|
#endif
|
||||||
c.Update();
|
c.Update();
|
||||||
if (c.IsOutOfSync)
|
if (c.IsOutOfSync)
|
||||||
{
|
{
|
||||||
RemovePed(c.ID, "OutOfSync");
|
RemovePed(c.ID, "OutOfSync");
|
||||||
}
|
}
|
||||||
|
#if BENCHMARK
|
||||||
|
|
||||||
|
Debug.TimeStamps[TimeStamp.UpdatePed]=PerfCounter2.ElapsedTicks-start;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if BENCHMARK
|
||||||
|
|
||||||
Debug.TimeStamps[TimeStamp.PedTotal]=PerfCounter.ElapsedTicks;
|
Debug.TimeStamps[TimeStamp.PedTotal]=PerfCounter.ElapsedTicks;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
lock (VehiclesLock)
|
lock (VehiclesLock)
|
||||||
{
|
{
|
||||||
@ -378,8 +416,10 @@ namespace RageCoop.Client
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Debug.TimeStamps[TimeStamp.AddVehicles]=PerfCounter.ElapsedTicks;
|
#if BENCHMARK
|
||||||
|
|
||||||
|
Debug.TimeStamps[TimeStamp.AddVehicles]=PerfCounter.ElapsedTicks;
|
||||||
|
#endif
|
||||||
foreach (SyncedVehicle v in ID_Vehicles.Values.ToArray())
|
foreach (SyncedVehicle v in ID_Vehicles.Values.ToArray())
|
||||||
{
|
{
|
||||||
if ((v.MainVehicle!=null)&&(!v.MainVehicle.Exists()))
|
if ((v.MainVehicle!=null)&&(!v.MainVehicle.Exists()))
|
||||||
@ -415,9 +455,9 @@ namespace RageCoop.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#if BENCHMARK
|
||||||
Debug.TimeStamps[TimeStamp.VehicleTotal]=PerfCounter.ElapsedTicks;
|
Debug.TimeStamps[TimeStamp.VehicleTotal]=PerfCounter.ElapsedTicks;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user