Skip to content

Commit

Permalink
Merge pull request #48 from RAGECOOP/dev-nightly
Browse files Browse the repository at this point in the history
Dev nightly
  • Loading branch information
oldnapalm committed Jul 26, 2023
2 parents e30ef1f + 99642fd commit e88e903
Show file tree
Hide file tree
Showing 31 changed files with 122 additions and 214 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-test.yaml
Expand Up @@ -7,6 +7,7 @@ on:
- '*/*' # matches every branch containing a single '/'
- '**' # matches every branch
- '!main' # excludes main
- '!dev-nightly' # excludes nightly

pull_request:
branches: [ "main", "dev-nightly" ]
Expand Down Expand Up @@ -42,6 +43,6 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: RageCoop.Client
path: bin/Release/Client/RageCoop
path: bin/Release/Client
- uses: actions/checkout@v2


4 changes: 2 additions & 2 deletions RageCoop.Client.Installer/MainWindow.xaml.cs
Expand Up @@ -78,10 +78,10 @@ private void Install(string root)
Environment.Exit(1);
}
var shvdnVer = GetVer(shvdnPath);
if (shvdnVer < new Version(3, 5, 1))
if (shvdnVer < new Version(3, 6, 0))
{
MessageBox.Show("Please update ScriptHookVDotNet to latest version!" +
$"\nCurrent version is {shvdnVer}, 3.5.1 or higher is required");
$"\nCurrent version is {shvdnVer}, 3.6.0 or higher is required");
Environment.Exit(1);
}
if (File.Exists(lemonPath))
Expand Down
4 changes: 4 additions & 0 deletions RageCoop.Client/Main.cs
Expand Up @@ -141,7 +141,9 @@ private void OnTick(object sender, EventArgs e)
}
catch (Exception ex)
{
#if DEBUG
Main.Logger.Error(ex);
#endif
}

if (Networking.ShowNetworkInfo)
Expand Down Expand Up @@ -347,7 +349,9 @@ private static void DoQueuedActions()
}
catch (Exception ex)
{
#if DEBUG
Logger.Error(ex);
#endif
QueuedActions.Remove(action);
}
}
Expand Down
6 changes: 4 additions & 2 deletions RageCoop.Client/Menus/CoopMenu.cs
Expand Up @@ -67,16 +67,18 @@ static CoopMenu()

Menu.AddSubMenu(SettingsMenu.Menu);
Menu.AddSubMenu(DevToolMenu.Menu);
#if DEBUG
Menu.AddSubMenu(DebugMenu.Menu);
Menu.AddSubMenu(UpdateMenu.Menu);
#endif

MenuPool.Add(Menu);
MenuPool.Add(SettingsMenu.Menu);
MenuPool.Add(DevToolMenu.Menu);
#if DEBUG
MenuPool.Add(DebugMenu.Menu);
MenuPool.Add(DebugMenu.DiagnosticMenu);
#endif
MenuPool.Add(ServersMenu.Menu);
MenuPool.Add(UpdateMenu.Menu);
MenuPool.Add(PopUp);

Menu.Add(_aboutItem);
Expand Down
4 changes: 3 additions & 1 deletion RageCoop.Client/Menus/Sub/DebugMenu.cs
@@ -1,4 +1,5 @@
using GTA;
#if DEBUG
using GTA;
using LemonUI.Menus;
using System;
using System.Drawing;
Expand Down Expand Up @@ -56,3 +57,4 @@ static DebugMenu()

}
}
#endif
105 changes: 0 additions & 105 deletions RageCoop.Client/Menus/Sub/UpdateMenu.cs

This file was deleted.

14 changes: 10 additions & 4 deletions RageCoop.Client/Networking/Networking.cs
Expand Up @@ -53,13 +53,14 @@ public static void ToggleConnection(string address, string username = null, stri
NetPeerConfiguration config = new NetPeerConfiguration("623c92c287cc392406e7aaaac1c0f3b0")
{
AutoFlushSendQueue = false,
SimulatedMinimumLatency = SimulatedLatency,
SimulatedRandomLatency = 0,
AcceptIncomingConnections = true,
MaximumConnections = 32,
PingInterval = 5
};

#if DEBUG
config.SimulatedMinimumLatency = SimulatedLatency;
config.SimulatedRandomLatency = 0;
#endif
config.EnableMessageType(NetIncomingMessageType.UnconnectedData);
config.EnableMessageType(NetIncomingMessageType.NatIntroductionSuccess);

Expand Down Expand Up @@ -96,7 +97,12 @@ public static void ToggleConnection(string address, string username = null, stri
Peer.OnMessageReceived += (s, m) =>
{
try { ProcessMessage(m); }
catch (Exception ex) { Main.Logger.Error(ex); }
catch (Exception ex)
{
#if DEBUG
Main.Logger.Error(ex);
#endif
}
};
Main.QueueAction(() => { Notification.Show($"~y~Trying to connect..."); });
Menus.CoopMenu._serverConnectItem.Enabled = false;
Expand Down
2 changes: 2 additions & 0 deletions RageCoop.Client/Networking/Receive.cs
Expand Up @@ -149,6 +149,7 @@ public static void ProcessMessage(NetIncomingMessage message)
}
catch (Exception ex)
{
#if DEBUG
Main.QueueAction(() =>
{
GTA.UI.Notification.Show($"~r~~h~Packet Error {ex.Message}");
Expand All @@ -157,6 +158,7 @@ public static void ProcessMessage(NetIncomingMessage message)
Main.Logger.Error($"[{packetType}] {ex.Message}");
Main.Logger.Error(ex);
Peer.Shutdown($"Packet Error [{packetType}]");
#endif
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions RageCoop.Client/Properties/AssemblyInfo.cs
Expand Up @@ -16,7 +16,7 @@


// Version informationr(
[assembly: AssemblyVersion("1.5.4.1")]
[assembly: AssemblyFileVersion("1.5.4.1")]
[assembly: AssemblyVersion("1.5.4.4")]
[assembly: AssemblyFileVersion("1.5.4.4")]
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]

2 changes: 1 addition & 1 deletion RageCoop.Client/RageCoop.Client.csproj
Expand Up @@ -36,7 +36,6 @@
<Compile Include="Menus\Sub\DevToolMenu.cs" />
<Compile Include="Menus\Sub\ServersMenu.cs" />
<Compile Include="Menus\Sub\SettingsMenu.cs" />
<Compile Include="Menus\Sub\UpdateMenu.cs" />
<Compile Include="Networking\Chat.cs" />
<Compile Include="Networking\DownloadManager.cs" />
<Compile Include="Networking\HolePunch.cs" />
Expand Down Expand Up @@ -67,6 +66,7 @@
<Compile Include="Sync\EntityPool.cs" />
<Compile Include="Sync\SyncEvents.cs" />
<Compile Include="Sync\Voice.cs" />
<Compile Include="Util\AddOnDataProvider.cs" />
<Compile Include="Util\Memory.cs" />
<Compile Include="Util\NativeCaller.cs" />
<Compile Include="Util\PedConfigFlags.cs" />
Expand Down
4 changes: 2 additions & 2 deletions RageCoop.Client/Scripting/BaseScript.cs
Expand Up @@ -46,7 +46,7 @@ public override void OnStart()
int weather1 = default(int);
int weather2 = default(int);
float percent2 = default(float);
Function.Call(Hash._GET_WEATHER_TYPE_TRANSITION, &weather1, &weather2, &percent2);
Function.Call(Hash.GET_CURR_WEATHER_STATE, &weather1, &weather2, &percent2);
API.SendCustomEvent(CustomEvents.WeatherTimeSync, time.Hours, time.Minutes, time.Seconds, weather1, weather2, percent2);
}
});
Expand All @@ -60,7 +60,7 @@ public override void OnStart()
private void WeatherTimeSync(CustomEventReceivedArgs e)
{
World.CurrentTimeOfDay = new TimeSpan((int)e.Args[0], (int)e.Args[1], (int)e.Args[2]);
Function.Call(Hash._SET_WEATHER_TYPE_TRANSITION, (int)e.Args[3], (int)e.Args[4], (float)e.Args[5]);
Function.Call(Hash.SET_CURR_WEATHER_STATE, (int)e.Args[3], (int)e.Args[4], (float)e.Args[5]);
}

private void SetDisplayNameTag(CustomEventReceivedArgs e)
Expand Down
4 changes: 2 additions & 2 deletions RageCoop.Client/Settings.cs
Expand Up @@ -22,7 +22,7 @@ public class Settings
/// <summary>
/// Don't use it!
/// </summary>
public string MasterServer { get; set; } = "https://masterserver.ragecoop.online/";
public string MasterServer { get; set; } = "https://masterserver.ragecoop.com/";
/// <summary>
/// Don't use it!
/// </summary>
Expand Down Expand Up @@ -51,7 +51,7 @@ public class Settings
/// <summary>
/// Disable world NPC traffic, mission entities won't be affected
/// </summary>
public bool DisableTraffic { get; set; } = true;
public bool DisableTraffic { get; set; } = false;

/// <summary>
/// Bring up pause menu but don't freeze time when FrontEndPauseAlternate(Esc) is pressed.
Expand Down
6 changes: 3 additions & 3 deletions RageCoop.Client/Sync/Entities/Ped/SyncedPed.cs
Expand Up @@ -28,7 +28,7 @@ internal SyncedPed(Ped p)
MainPed = p;
OwnerID = Main.LocalPlayerID;

Function.Call(Hash._SET_PED_CAN_PLAY_INJURED_ANIMS, false);
Function.Call(Hash.SET_PED_IS_IGNORED_BY_AUTO_OPEN_DOORS, false);
MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableHurt, true);
// MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DisableMelee, true);

Expand Down Expand Up @@ -235,7 +235,7 @@ private bool CreateCharacter()
Function.Call(Hash.SET_PED_CAN_BE_TARGETTED_BY_PLAYER, MainPed.Handle, Game.Player, true);
Function.Call(Hash.SET_PED_GET_OUT_UPSIDE_DOWN_VEHICLE, MainPed.Handle, false);
Function.Call(Hash.SET_CAN_ATTACK_FRIENDLY, MainPed.Handle, true, true);
Function.Call(Hash._SET_PED_CAN_PLAY_INJURED_ANIMS, false);
Function.Call(Hash.SET_PED_IS_IGNORED_BY_AUTO_OPEN_DOORS, false);
Function.Call(Hash.SET_PED_CAN_EVASIVE_DIVE, MainPed.Handle, false);

MainPed.SetConfigFlag((int)PedConfigFlags.CPED_CONFIG_FLAG_DrownsInWater, false);
Expand Down Expand Up @@ -713,7 +713,7 @@ private void DisplayInVehicle()
case 5:
if (MainPed.VehicleTryingToEnter != CurrentVehicle.MainVehicle || MainPed.GetSeatTryingToEnter() != Seat)
{
MainPed.Task.EnterVehicle(CurrentVehicle.MainVehicle, Seat, -1, 5, EnterVehicleFlags.AllowJacking);
MainPed.Task.EnterVehicle(CurrentVehicle.MainVehicle, Seat, -1, 5, EnterVehicleFlags.JackAnyone);
}
break;
case 6:
Expand Down
Expand Up @@ -70,7 +70,6 @@ internal bool IsFlipped
private readonly List<Vector3> _predictedTrace = new List<Vector3>();
private readonly List<Vector3> _orgTrace = new List<Vector3>();
private Vector3 _predictedPosition;
private readonly float _elapsed;
#endregion

#region OUTGOING
Expand Down
6 changes: 3 additions & 3 deletions RageCoop.Client/Sync/Entities/Vehicle/SyncedVehicle.cs
Expand Up @@ -197,13 +197,13 @@ internal override void Update()
if (!_lastTransformed)
{
_lastTransformed = true;
Function.Call(Hash._TRANSFORM_VEHICLE_TO_SUBMARINE, MainVehicle.Handle, false);
Function.Call(Hash.TRANSFORM_TO_SUBMARINE, MainVehicle.Handle, false);
}
}
else if (_lastTransformed)
{
_lastTransformed = false;
Function.Call(Hash._TRANSFORM_SUBMARINE_TO_VEHICLE, MainVehicle.Handle, false);
Function.Call(Hash.TRANSFORM_TO_CAR, MainVehicle.Handle, false);
}
}
else if (IsDeluxo)
Expand Down Expand Up @@ -364,7 +364,7 @@ private string PedalingAnimName(bool fast)

private void StartPedalingAnim(bool fast)
{
MainVehicle.Driver?.Task.PlayAnimation(PedalingAnimDict(), PedalingAnimName(fast), 8.0f, -8.0f, -1, AnimationFlags.Loop | AnimationFlags.AllowRotation, 1.0f);
MainVehicle.Driver?.Task.PlayAnimation(PedalingAnimDict(), PedalingAnimName(fast), 8.0f, -8.0f, -1, AnimationFlags.Loop | AnimationFlags.Secondary, 1.0f);

}

Expand Down
2 changes: 1 addition & 1 deletion RageCoop.Client/Sync/EntityPool.cs
Expand Up @@ -365,7 +365,7 @@ public static void DoSync()
SyncedPed c = GetPedByHandle(p.Handle);
if (c == null && (p != Game.Player.Character))
{
if (allPeds.Length > Main.Settings.WorldPedSoftLimit && p.PopulationType != EntityPopulationType.RandomAmbient)
if (allPeds.Length > Main.Settings.WorldPedSoftLimit && p.PopulationType == EntityPopulationType.RandomAmbient && !p.IsInVehicle())
{
p.Delete();
continue;
Expand Down

0 comments on commit e88e903

Please sign in to comment.