Skip to content

Commit

Permalink
Merge pull request #82 from project-fika/3.9-dev
Browse files Browse the repository at this point in the history
3.9 dev > main
  • Loading branch information
Lacyway authored Jul 6, 2024
2 parents c69bff5 + 984b514 commit 341141d
Show file tree
Hide file tree
Showing 146 changed files with 4,510 additions and 2,458 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

35 changes: 0 additions & 35 deletions Fika.Core/AkiSupport/Airdrops/Models/FikaAirdropParametersModel.cs

This file was deleted.

51 changes: 0 additions & 51 deletions Fika.Core/AkiSupport/Overrides/MaxBotPatch_Override.cs

This file was deleted.

Binary file modified Fika.Core/Bundles/Files/newmatchmakerui.bundle
Binary file not shown.
28 changes: 25 additions & 3 deletions Fika.Core/Console/FikaCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
using EFT.UI;
using Fika.Core.Coop.Components;
using Fika.Core.Coop.GameMode;
using Fika.Core.Coop.Matchmaker;
using Fika.Core.Coop.Players;
using Fika.Core.Coop.Utils;

namespace Fika.Core.Console
{
public class FikaCommands
{
#if DEBUG
[ConsoleCommand("bring", "", null, "Teleports all AI to yourself as the host", [])]
public static void Bring()
{
Expand All @@ -30,7 +31,7 @@ public static void Bring()

if (CoopHandler.TryGetCoopHandler(out CoopHandler coopHandler))
{
if (MatchmakerAcceptPatches.IsServer)
if (FikaBackendUtils.IsServer)
{
int count = 0;
foreach (CoopPlayer player in coopHandler.Players.Values)
Expand All @@ -56,7 +57,7 @@ public static void Bring()
}

[ConsoleCommand("god", "", null, "Set god mode on/off", [])]
public static void God(bool state)
public static void God([ConsoleArgument(false, "true or false to toggle god mode")] bool state)
{
CoopGame coopGame = (CoopGame)Singleton<IFikaGame>.Instance;

Expand Down Expand Up @@ -90,6 +91,27 @@ public static void God(bool state)
ConsoleScreen.LogWarning("Could not find CoopHandler.");
}
}
#endif

[ConsoleCommand("debug", "", null, "Toggle debug window", [])]
public static void Debug(bool state)
{
CoopGame coopGame = (CoopGame)Singleton<IFikaGame>.Instance;

if (coopGame == null)
{
ConsoleScreen.LogWarning("You are not in a game.");
return;
}

if (coopGame.Status != GameStatus.Started)
{
ConsoleScreen.LogWarning("Game is not running.");
return;
}

coopGame.ToggleDebug(state);
}

[ConsoleCommand("clear", "", null, "Clears the console output", [])]
public static void Clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
using EFT.Airdrop;
using EFT.Interactive;
using EFT.SynchronizableObjects;
using Fika.Core.Coop.Matchmaker;
using Fika.Core.Coop.Utils;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.AI;

namespace Fika.Core.AkiSupport.Airdrops
namespace Fika.Core.Coop.Airdrops
{
/// <summary>
/// Created by: SPT-Aki team
/// Link: https://dev.sp-tarkov.com/SPT-AKI/Modules/src/branch/master/project/Aki.Custom/Airdrops/AirdropBox.cs
/// Created by: SPT team
/// Link: https://dev.sp-tarkov.com/SPT/Modules/src/branch/master/project/SPT.Custom/Airdrops/AirdropBox.cs
/// </summary>
public class FikaAirdropBox : MonoBehaviour
{
Expand Down Expand Up @@ -79,7 +79,7 @@ private static async Task<GameObject> LoadCrate()
IEasyAssets easyAssets = Singleton<PoolManager>.Instance.EasyAssets;
await easyAssets.Retain(AIRDROP_SOUNDS_PATH, null, null).LoadingJob;

Dictionary<BaseBallistic.ESurfaceSound, AirdropSurfaceSet> soundsDictionary = new Dictionary<BaseBallistic.ESurfaceSound, AirdropSurfaceSet>();
Dictionary<BaseBallistic.ESurfaceSound, AirdropSurfaceSet> soundsDictionary = new();
AirdropSurfaceSet[] sets = easyAssets.GetAsset<AirdropSounds>(AIRDROP_SOUNDS_PATH).Sets;
foreach (AirdropSurfaceSet set in sets)
{
Expand Down Expand Up @@ -151,7 +151,7 @@ private void OnBoxLand(out float clipLength)
Volume = surfaceSet.LandingSoundBank.BaseVolume
});

if (MatchmakerAcceptPatches.IsServer)
if (FikaBackendUtils.IsServer)
{
AddNavMeshObstacle();
}
Expand All @@ -171,7 +171,7 @@ private bool RaycastBoxDistance(LayerMask layerMask, out RaycastHit hitInfo)

private bool RaycastBoxDistance(LayerMask layerMask, out RaycastHit hitInfo, Vector3 origin)
{
Ray ray = new Ray(origin, Vector3.down);
Ray ray = new(origin, Vector3.down);

bool raycast = Physics.Raycast(ray, out hitInfo, Mathf.Infinity, layerMask);
if (!raycast) return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using System.Threading.Tasks;
using UnityEngine;

namespace Fika.Core.AkiSupport.Airdrops
namespace Fika.Core.Coop.Airdrops
{
/// <summary>
/// Created by: SPT-Aki team
/// Link: https://dev.sp-tarkov.com/SPT-AKI/Modules/src/branch/master/project/Aki.Custom/Airdrops/AirdropPlane.cs
/// Created by: SPT team
/// Link: https://dev.sp-tarkov.com/SPT/Modules/src/branch/master/project/SPT.Custom/Airdrops/AirdropPlane.cs
/// </summary>
public class FikaAirdropPlane : MonoBehaviour
{
Expand Down Expand Up @@ -82,7 +82,7 @@ private void SetPosition(int dropHeight, Vector3 airdropPoint)

transform.position = new Vector3(pointOnCircle.x, dropHeight, pointOnCircle.y);
newPosition = transform.position;
Vector3 lookPoint = new Vector3(airdropPoint.x, dropHeight, airdropPoint.z);
Vector3 lookPoint = new(airdropPoint.x, dropHeight, airdropPoint.z);
transform.LookAt(lookPoint);
newRotation = lookPoint;
}
Expand Down Expand Up @@ -154,7 +154,7 @@ private IEnumerator ChangeHeading()

private float EasingSmoothSquared(float x)
{
return x < 0.5 ? x * x * 2 : (1 - (1 - x) * (1 - x) * 2);
return x < 0.5 ? x * x * 2 : 1 - (1 - x) * (1 - x) * 2;
}
}
}
40 changes: 18 additions & 22 deletions Fika.Core/Coop/Airdrops/FikaAirdropsManager.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
using Aki.Custom.Airdrops.Models;
using Aki.Custom.Airdrops.Utils;
using BepInEx.Logging;
using BepInEx.Logging;
using Comfort.Common;
using EFT;
using EFT.InventoryLogic;
using Fika.Core.AkiSupport.Airdrops;
using Fika.Core.AkiSupport.Airdrops.Models;
using Fika.Core.AkiSupport.Airdrops.Utils;
using Fika.Core.Coop.Airdrops;
using Fika.Core.Coop.Airdrops.Models;
using Fika.Core.Coop.Airdrops.Utils;
using Fika.Core.Coop.Components;
using Fika.Core.Coop.GameMode;
using Fika.Core.Coop.Matchmaker;
using Fika.Core.Coop.Utils;
using Fika.Core.Networking;
using LiteNetLib;
using LiteNetLib.Utils;
using System;
using System.Collections;
using UnityEngine;

namespace Aki.Custom.Airdrops
namespace Coop.Airdrops
{
/// <summary>
/// Created by: SPT-Aki team
/// Link: https://dev.sp-tarkov.com/SPT-AKI/Modules/src/branch/master/project/Aki.Custom/Airdrops/AirdropsManager.cs
/// Created by: SPT team
/// Link: https://dev.sp-tarkov.com/SPT/Modules/src/branch/master/project/SPT.Custom/Airdrops/AirdropsManager.cs
/// Modified by Lacyway and nexus4880: Uses BSG code to serialize/deserialize data from host to clients
/// </summary>
public class FikaAirdropsManager : MonoBehaviour
Expand Down Expand Up @@ -84,7 +82,7 @@ protected async void Start()
}

// If this is not the server, then this manager will have to wait for the packet to initialize stuff.
if (MatchmakerAcceptPatches.IsClient)
if (FikaBackendUtils.IsClient)
{
return;
}
Expand All @@ -110,17 +108,15 @@ protected async void Start()

try
{
airdropPlane = await FikaAirdropPlane.Init(
AirdropParameters.RandomAirdropPoint,
AirdropParameters.DropHeight,
AirdropParameters.Config.PlaneVolume,
airdropPlane = await FikaAirdropPlane.Init(AirdropParameters.RandomAirdropPoint,
AirdropParameters.DropHeight, AirdropParameters.Config.PlaneVolume,
AirdropParameters.Config.PlaneSpeed);
AirdropBox = await FikaAirdropBox.Init(AirdropParameters.Config.CrateFallSpeed);
factory = new FikaItemFactoryUtil();
}
catch
{
Logger.LogError("[AKI-AIRDROPS]: Unable to create plane or crate, airdrop won't occur");
Logger.LogError("[SPT-AIRDROPS]: Unable to create plane or crate, airdrop won't occur");
Destroy(this);
throw;
}
Expand All @@ -132,7 +128,7 @@ protected async void Start()

public void SendParamsToClients()
{
if (!MatchmakerAcceptPatches.IsServer)
if (!FikaBackendUtils.IsServer)
{
return;
}
Expand Down Expand Up @@ -166,13 +162,13 @@ protected async void FixedUpdate()
}

// If we are a client. Wait until the server has sent all the data.
if (MatchmakerAcceptPatches.IsClient && rootItem == null)
if (FikaBackendUtils.IsClient && rootItem == null)
{
return;
}

// If we have all the parameters sent from the Server. Lets build the plane, box, container and loot
if (MatchmakerAcceptPatches.IsClient && !ClientLootBuilt)
if (FikaBackendUtils.IsClient && !ClientLootBuilt)
{
ClientLootBuilt = true;

Expand Down Expand Up @@ -212,7 +208,7 @@ protected async void FixedUpdate()
return;
}

if (MatchmakerAcceptPatches.IsServer || MatchmakerAcceptPatches.IsSinglePlayer)
if (FikaBackendUtils.IsServer || FikaBackendUtils.IsSinglePlayer)
{
AirdropParameters.Timer += 0.02f;

Expand Down Expand Up @@ -273,7 +269,7 @@ private void StartBox()

private void BuildLootContainer(FikaAirdropConfigModel config)
{
if (MatchmakerAcceptPatches.IsClient)
if (FikaBackendUtils.IsClient)
{
return;
}
Expand Down Expand Up @@ -301,7 +297,7 @@ private void BuildLootContainer(FikaAirdropConfigModel config)
}

// Get the lootData. Send to clients.
if (MatchmakerAcceptPatches.IsServer)
if (FikaBackendUtils.IsServer)
{
StartCoroutine(SendLootToClients(isFlareDrop));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Aki.Custom.Airdrops.Models
namespace Fika.Core.Coop.Airdrops.Models
{
/// <summary>
/// Created by: SPT-Aki team
/// Link: https://dev.sp-tarkov.com/SPT-AKI/Modules/src/branch/master/project/Aki.Custom/Airdrops/Models
/// Created by: SPT team
/// Link: https://dev.sp-tarkov.com/SPT/Modules/src/branch/master/project/SPT.Custom/Airdrops/Models
/// </summary>
public class FikaAirdropConfigModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Aki.Custom.Airdrops.Models
namespace Fika.Core.Coop.Airdrops.Models
{
/// <summary>
/// Created by: SPT-Aki team
/// Link: https://dev.sp-tarkov.com/SPT-AKI/Modules/src/branch/master/project/Aki.Custom/Airdrops/Models
/// Created by: SPT team
/// Link: https://dev.sp-tarkov.com/SPT/Modules/src/branch/master/project/SPT.Custom/Airdrops/Models
/// </summary>
public class FikaAirdropLootResultModel
{
Expand Down
Loading

0 comments on commit 341141d

Please sign in to comment.