Skip to content

Commit

Permalink
Major cleanup
Browse files Browse the repository at this point in the history
- Moved namespaces
- Updated for SPT rebranding
- Cleaned up crap
  • Loading branch information
Lacyway committed Jun 6, 2024
1 parent e5ef38a commit 129868b
Show file tree
Hide file tree
Showing 37 changed files with 952 additions and 958 deletions.
35 changes: 0 additions & 35 deletions Fika.Core/AkiSupport/Airdrops/Models/FikaAirdropParametersModel.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
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
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 @@ -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;
}
}
}
24 changes: 10 additions & 14 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.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.Networking;
using LiteNetLib;
using LiteNetLib.Utils;
using SPT.Custom.Airdrops.Models;
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 @@ -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 Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace SPT.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 SPT.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
29 changes: 29 additions & 0 deletions Fika.Core/Coop/Airdrops/Models/FikaAirdropParametersModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Newtonsoft.Json;
using UnityEngine;

namespace Fika.Core.Coop.Airdrops.Models
{
/// <summary>
/// Created by: SPT team
/// Link: https://dev.sp-tarkov.com/SPT/Modules/src/branch/master/project/SPT.Custom/Airdrops/Models
/// </summary>
public class FikaAirdropParametersModel
{
public FikaAirdropConfigModel Config;
public bool AirdropAvailable;
public bool PlaneSpawned;
public bool BoxSpawned;
public float DistanceTraveled;
public float DistanceToTravel;
public float DistanceToDrop;
public float Timer;
public int DropHeight;
public int TimeToStart;
public Vector3 StartPosition;
public Vector3 SpawnPoint;
public Vector3 LookPoint;

[JsonIgnore]
public Vector3 RandomAirdropPoint = Vector3.zero;
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
using EFT;
using EFT.Airdrop;
using Fika.Core.AkiSupport.Airdrops.Models;
using Fika.Core.Coop.Airdrops.Models;
using Newtonsoft.Json;
using SPT.Common.Http;
using SPT.Custom.Airdrops.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;

namespace Fika.Core.AkiSupport.Airdrops.Utils
namespace Fika.Core.Coop.Airdrops.Utils
{
/// <summary>
/// Originally developed by SPT <see href="https://dev.sp-tarkov.com/SPT/Modules/src/branch/master/project/SPT.Custom/Airdrops/Utils/AirdropUtil.cs"/>
/// </summary>
public static class FikaAirdropUtil
{
public static FikaAirdropConfigModel AirdropConfigModel { get; private set; }
Expand Down Expand Up @@ -119,7 +121,7 @@ public static FikaAirdropParametersModel InitAirdropParams(GameWorld gameWorld,

if (flareAirdropPoints.Count == 0 && isFlare)
{
Debug.LogError($"[AKI-AIRDROPS]: Airdrop called in by flare, Unable to find an airdropPoint within 100m, defaulting to normal drop");
Debug.LogError($"[SPT-AIRDROPS]: Airdrop called in by flare, Unable to find an airdropPoint within 100m, defaulting to normal drop");
flareAirdropPoints.Add(allAirdropPoints.OrderBy(_ => Guid.NewGuid()).FirstOrDefault());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
using BepInEx.Logging;
using Comfort.Common;
using Coop.Airdrops;
using EFT;
using EFT.Interactive;
using EFT.InventoryLogic;
using Fika.Core;
using Fika.Core.Coop.Airdrops.Models;
using Newtonsoft.Json;
using SPT.Common.Http;
using SPT.Custom.Airdrops.Models;
using System.Linq;

namespace Aki.Custom.Airdrops.Utils
namespace Fika.Core.Coop.Airdrops.Utils
{
/// <summary>
/// Originally developed by SPT <see href="https://dev.sp-tarkov.com/SPT/Modules/src/branch/master/project/SPT.Custom/Airdrops/Utils/ItemFactoryUtil.cs"/>
/// </summary>
public class FikaItemFactoryUtil
{
private readonly ItemFactory itemFactory;
Expand All @@ -33,7 +36,7 @@ public void BuildContainer(LootableContainer container, FikaAirdropConfigModel c
}
else
{
logSource.LogError($"[AKI-AIRDROPS]: unable to find template: {containerId}");
logSource.LogError($"[SPT-AIRDROPS]: unable to find template: {containerId}");
}
}

Expand Down
8 changes: 4 additions & 4 deletions Fika.Core/Coop/BTR/FikaBTRManager_Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void Awake()
}
catch
{
btrLogger.LogError("[AKI-BTR] Unable to spawn BTR. Check logs.");
btrLogger.LogError("[SPT-BTR] Unable to spawn BTR. Check logs.");
Destroy(this);
throw;
}
Expand Down Expand Up @@ -410,7 +410,7 @@ public void ClientInteraction(Player player, PlayerInteractPacket packet)
BTRView btrView = gameWorld.BtrController.BtrView;
if (btrView == null)
{
btrLogger.LogError("[AKI-BTR] BTRInteractionPatch - btrView is null");
btrLogger.LogError("[SPT-BTR] BTRInteractionPatch - btrView is null");
return;
}

Expand Down Expand Up @@ -469,13 +469,13 @@ private void OnDestroy()

if (btrClientSide != null)
{
Debug.LogWarning("[AKI-BTR] BTRManager - Destroying btrClientSide");
Debug.LogWarning("[SPT-BTR] BTRManager - Destroying btrClientSide");
Destroy(btrClientSide.gameObject);
}

if (btrServerSide != null)
{
Debug.LogWarning("[AKI-BTR] BTRManager - Destroying btrServerSide");
Debug.LogWarning("[SPT-BTR] BTRManager - Destroying btrServerSide");
Destroy(btrServerSide.gameObject);
}
}
Expand Down
12 changes: 6 additions & 6 deletions Fika.Core/Coop/BTR/FikaBTRManager_Host.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private void Awake()
}
catch
{
btrLogger.LogError("[AKI-BTR] Unable to spawn BTR. Check logs.");
btrLogger.LogError("[SPT-BTR] Unable to spawn BTR. Check logs.");
Destroy(this);
throw;
}
Expand Down Expand Up @@ -473,7 +473,7 @@ private void UpdateBTRSideDoorState(byte state)
}
catch
{
btrLogger.LogError("[AKI-BTR] lastInteractedBtrSide is null when it shouldn't be. Check logs.");
btrLogger.LogError("[SPT-BTR] lastInteractedBtrSide is null when it shouldn't be. Check logs.");
throw;
}
}
Expand Down Expand Up @@ -660,7 +660,7 @@ public bool HostInteraction(Player player, PlayerInteractPacket packet)
BTRView btrView = gameWorld.BtrController.BtrView;
if (btrView == null)
{
btrLogger.LogError("[AKI-BTR] BTRInteractionPatch - btrView is null");
btrLogger.LogError("[SPT-BTR] BTRInteractionPatch - btrView is null");
return false;
}

Expand All @@ -679,7 +679,7 @@ public void HostObservedInteraction(Player player, PlayerInteractPacket packet)
BTRView btrView = gameWorld.BtrController.BtrView;
if (btrView == null)
{
btrLogger.LogError("[AKI-BTR] BTRInteractionPatch - btrView is null");
btrLogger.LogError("[SPT-BTR] BTRInteractionPatch - btrView is null");
return;
}

Expand Down Expand Up @@ -747,13 +747,13 @@ private void OnDestroy()

if (btrClientSide != null)
{
Debug.LogWarning("[AKI-BTR] BTRManager - Destroying btrClientSide");
Debug.LogWarning("[SPT-BTR] BTRManager - Destroying btrClientSide");
Destroy(btrClientSide.gameObject);
}

if (btrServerSide != null)
{
Debug.LogWarning("[AKI-BTR] BTRManager - Destroying btrServerSide");
Debug.LogWarning("[SPT-BTR] BTRManager - Destroying btrServerSide");
Destroy(btrServerSide.gameObject);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override void CallMalfunctionRepaired(Weapon weapon)
public override void Execute(GClass2850 operation, [CanBeNull] Callback callback)
{
#if DEBUG
ConsoleScreen.Log("InvOperation: " + operation.GetType().Name);
ConsoleScreen.Log("InvOperation: " + operation.GetType().Name);
#endif

// Do not replicate picking up quest items, throws an error on the other clients
Expand Down
Loading

0 comments on commit 129868b

Please sign in to comment.