diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 00000000..ea241d51 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,40 @@ +name: .NET Test + +on: + workflow_dispatch: + push: + paths-ignore: + - '**/*.md' + pull_request: + paths-ignore: + - '**/*.md' + +jobs: + test: + runs-on: ubuntu-latest + + env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + token: ${{ secrets.FIKA_GITMODULES }} + + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Install dependencies + run: dotnet restore --configfile Nuget.config + + - name: Build + run: dotnet build --nologo --no-restore --configuration Debug + + - name: Test + run: dotnet test --nologo --no-restore --no-build --blame-hang-timeout 1min + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5cf05e7d..8087d5cf 100644 --- a/.gitignore +++ b/.gitignore @@ -371,5 +371,4 @@ FodyWeavers.xsd # Fika /Build /Properties/private.snk -/Properties/public.snk -/References \ No newline at end of file +/Properties/public.snk \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a647a612 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "References"] + path = References + url = https://github.com/project-fika/References.git diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index d9530814..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "version": "2.0.0", - "options": { - "env": { - "DOTNET_NOLOGO": "yes", - "DOTNET_CLI_TELEMETRY_OPTOUT": "yes" - } - }, - "tasks": [ - { - "label": "dotnet: restore", - "type": "shell", - "command": "dotnet restore --nologo", - }, - { - "label": "dotnet: build debug", - "type": "shell", - "command": "dotnet build --nologo --no-restore --configuration Debug", - "dependsOrder": "sequence", - "dependsOn": "dotnet: restore", - "group": { - "kind": "build" - } - }, - { - "label": "dotnet: build release", - "type": "shell", - "command": "dotnet build --nologo --no-restore --configuration Release", - "dependsOrder": "sequence", - "dependsOn": "dotnet: restore", - "group": { - "kind": "build" - } - }, - { - "label": "dotnet: build gold-master", - "type": "shell", - "command": "dotnet build --nologo --no-restore --configuration GoldMaster", - "dependsOrder": "sequence", - "dependsOn": "dotnet: restore", - "group": { - "kind": "build" - } - } - ] -} \ No newline at end of file diff --git a/Fika-Plugin.code-workspace b/Fika-Plugin.code-workspace new file mode 100644 index 00000000..765fb25b --- /dev/null +++ b/Fika-Plugin.code-workspace @@ -0,0 +1,61 @@ +{ + "folders": [ + { + "path": "." + } + ], + "tasks": { + "version": "2.0.0", + "options": { + "env": { + "DOTNET_NOLOGO": "yes", + "DOTNET_CLI_TELEMETRY_OPTOUT": "yes" + } + }, + "tasks": [ + { + "label": "dotnet: restore", + "type": "shell", + "command": "dotnet restore --nologo", + }, + { + "label": "dotnet: build debug", + "type": "shell", + "command": "dotnet build --nologo --no-restore --configuration Debug", + "dependsOrder": "sequence", + "dependsOn": "dotnet: restore", + "group": { + "kind": "build" + } + }, + { + "label": "dotnet: build release", + "type": "shell", + "command": "dotnet build --nologo --no-restore --configuration Release", + "dependsOrder": "sequence", + "dependsOn": "dotnet: restore", + "group": { + "kind": "build" + } + }, + { + "label": "dotnet: build gold-master", + "type": "shell", + "command": "dotnet build --nologo --no-restore --configuration GoldMaster", + "dependsOrder": "sequence", + "dependsOn": "dotnet: restore", + "group": { + "kind": "build" + } + } + ] + }, + "settings": { + "window.title": "Fika.Plugin" + }, + "extensions": { + "recommendations": [ + "ms-dotnettools.csharp" + ] + } +} \ No newline at end of file diff --git a/Fika.sln b/Fika-Plugin.sln similarity index 100% rename from Fika.sln rename to Fika-Plugin.sln diff --git a/Fika.Core/Coop/GameMode/CoopGame.cs b/Fika.Core/Coop/GameMode/CoopGame.cs index 82e33130..4dda819f 100644 --- a/Fika.Core/Coop/GameMode/CoopGame.cs +++ b/Fika.Core/Coop/GameMode/CoopGame.cs @@ -437,10 +437,10 @@ private bool TryDespawnFurthest(Profile profile, Vector3 position, CoopHandler c } //Dont despawn inside of dynamic AI range - if (furthestDistance < FikaPlugin.DynamicAIRange.Value * FikaPlugin.DynamicAIRange.Value) //Square it because we use sqrMagnitude for distance calculation + if (furthestDistance < FikaPlugin.DespawnMinimumDistance.Value * FikaPlugin.DespawnMinimumDistance.Value) //Square it because we use sqrMagnitude for distance calculation { #if DEBUG - Logger.LogWarning($"We're not despawning anything. Furthest despawnable bot is inside DynamicAI range."); + Logger.LogWarning($"We're not despawning anything. Furthest despawnable bot is inside minimum despawn range."); #endif return false; } diff --git a/Fika.Core/Fika.Core.csproj b/Fika.Core/Fika.Core.csproj index 07689c06..7d7b9d12 100644 --- a/Fika.Core/Fika.Core.csproj +++ b/Fika.Core/Fika.Core.csproj @@ -60,7 +60,7 @@ False - ..\References\Assembly-CSharp.dll + ..\References\hollowed.dll False diff --git a/Fika.Core/FikaPlugin.cs b/Fika.Core/FikaPlugin.cs index 2bd8b638..e733f8b7 100644 --- a/Fika.Core/FikaPlugin.cs +++ b/Fika.Core/FikaPlugin.cs @@ -122,15 +122,15 @@ public class FikaPlugin : BaseUnityPlugin public static ConfigEntry FreeCamButton { get; set; } // Performance - public static ConfigEntry EnforcedSpawnLimits { get; set; } - public static ConfigEntry DespawnFurthest { get; set; } public static ConfigEntry DynamicAI { get; set; } public static ConfigEntry DynamicAIRange { get; set; } public static ConfigEntry DynamicAIRate { get; set; } public static ConfigEntry CullPlayers { get; set; } public static ConfigEntry CullingRange { get; set; } - - // Bot Limits + // Performance | Bot Limits + public static ConfigEntry EnforcedSpawnLimits { get; set; } + public static ConfigEntry DespawnFurthest { get; set; } + public static ConfigEntry DespawnMinimumDistance { get; set; } public static ConfigEntry MaxBotsFactory { get; set; } public static ConfigEntry MaxBotsCustoms { get; set; } public static ConfigEntry MaxBotsInterchange { get; set; } @@ -295,9 +295,11 @@ private void SetupConfig() // Performance | Max Bots - EnforcedSpawnLimits = Config.Bind("Performance | Max Bots", "Enforced Spawn Limits", false, new ConfigDescription("Enforces spawn limits when spawning bots, making sure to not go over the vanilla limits. This mainly takes affect when using spawn mods or anything that modifies the bot limits. Will not block spawns of special bots like bosses.", tags: new ConfigurationManagerAttributes() { Order = 13 })); + EnforcedSpawnLimits = Config.Bind("Performance | Max Bots", "Enforced Spawn Limits", false, new ConfigDescription("Enforces spawn limits when spawning bots, making sure to not go over the vanilla limits. This mainly takes affect when using spawn mods or anything that modifies the bot limits. Will not block spawns of special bots like bosses.", tags: new ConfigurationManagerAttributes() { Order = 14 })); + + DespawnFurthest = Config.Bind("Performance | Max Bots", "Despawn Furthest", false, new ConfigDescription("When enforcing spawn limits, should the furthest bot be de-spawned instead of blocking the spawn. This will make for a much more active raid on a lower Max Bots count. Helpful for weaker PCs. Will only despawn pmcs and scavs. If you don't run a dynamic spawn mod, this will however quickly exhaust the spawns on the map, making the raid very dead instead.", tags: new ConfigurationManagerAttributes() { Order = 13 })); - DespawnFurthest = Config.Bind("Performance | Max Bots", "Despawn Furthest", false, new ConfigDescription("When enforcing spawn limits, should the furthest bot be de-spawned instead of blocking the spawn. This will make for a much more active raid on a lower Max Bots count. Helpful for weaker PCs. Will only despawn pmcs and scavs. If you don't run a dynamic spawn mod, this will however quickly exhaust the spawns on the map, making the raid very dead instead.", tags: new ConfigurationManagerAttributes() { Order = 12 })); + DespawnMinimumDistance = Config.Bind("Performance | Max Bots", "Despawn Minimum Distance", 200.0f, new ConfigDescription("Don't despawn bots within this distance.", new AcceptableValueRange(50f, 750f), new ConfigurationManagerAttributes() { Order = 12 })); MaxBotsFactory = Config.Bind("Performance | Max Bots", "Max Bots Factory", 0, new ConfigDescription("Max amount of bots that can be active at the same time on Factory. Useful if you have a weaker PC. Set to 0 to use vanilla limits.", new AcceptableValueRange(0, 50), new ConfigurationManagerAttributes() { Order = 11 })); diff --git a/NuGet.Config b/Nuget.config similarity index 100% rename from NuGet.Config rename to Nuget.config diff --git a/README.md b/README.md index eba8cec9..0268f989 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,37 @@ Client-side changes to make multiplayer work. +## /!\ **NOTICE** /!\ + +If you somehow ended up here while you just want to play a stable release, +please download the release from the discord [here](https://discord.gg/project-fika). + +If you're interested to contribute, then you're at the right place! + ## State of the project -There are few bugs left. The goal now is to look back and refactor old code to make it better, as a lot of it is not efficient or easy to read. +There are few bugs left. The goal now is to look back and refactor old code to +make it better, as a lot of it is not efficient or easy to read. ## Contributing -You are free to fork, improve and send PRs to improve the project. Please try to make your code coherent for the other developers. +You are free to fork, improve and send PRs to improve the project. Please try +to make your code coherent for the other developers. ## Requirements - [Visual Studio Code](https://code.visualstudio.com/) - [.NET SDK 8.0.x](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) +## Setup + +- Fika developer: `git submodule update --init --recursive` +- Collaborator: + 1. Copy-paste the contents of `EscapeFromTarkov_Data/Managed/` into + `References/` + 2. Copy-paste from Aki.Modules `project/Shared/Hollowed/hollowed.dll` into + `References/` + ## Build ### Debug / Release @@ -24,7 +42,8 @@ You are free to fork, improve and send PRs to improve the project. Please try to PowerShell | `dotnet build` VSCode | `Terminal > Run Build Task...` -You have to create a `References` folder and populate it with the required dependencies from your game installation for the project to build. +You have to create a `References` folder and populate it with the required +dependencies from your game installation for the project to build. ### GoldMaster @@ -37,11 +56,11 @@ You have to create a `References` folder and populate it with the required depen This project is licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.en). -### Dependencies +### Credits **Project** | **License** ----------- | ----------------------------------------------------------------------- Aki.Modules | [NCSA](https://dev.sp-tarkov.com/SPT-AKI/Modules/src/branch/master/LICENSE.md) -SIT | [NCSA](./LICENSE-SIT.md) (`SIT.Client master:9de30d8`) +SIT | [NCSA](./LICENSE-SIT.md) (`Forked from SIT.Client master:9de30d8`) Open.NAT | [MIT](https://github.com/lontivero/Open.NAT/blob/master/LICENSE) (for UPnP implementation) LiteNetLib | [MIT](https://github.com/RevenantX/LiteNetLib/blob/master/LICENSE.txt) (for P2P UDP implementation) diff --git a/References b/References new file mode 160000 index 00000000..c79307a8 --- /dev/null +++ b/References @@ -0,0 +1 @@ +Subproject commit c79307a8011144ad54d2bc6afb1f7e46c607f71c