Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groups #80

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
31f590c
Don't show cancel button as scav
Lacyway Jul 9, 2024
015582b
Update 'IsSingleplayer'
Lacyway Jul 9, 2024
8b0776e
Disable chat by default
Lacyway Jul 9, 2024
084846b
Improve inertia classes
Lacyway Jul 9, 2024
dd58015
Cleanup LocalGamePatch
Lacyway Jul 10, 2024
70b8465
Add SniperScav filter option to Dynamic AI
Lacyway Jul 10, 2024
48c87e4
Remove FasterInventoryScroll option
Lacyway Jul 10, 2024
773e6b6
Force local raid even when grouping
hel0t Jun 20, 2024
2784cb1
Add class & patch to contain matchmaking group info
hel0t Jun 20, 2024
8226489
Forward all network game creations into local game & local game patches
hel0t Jun 20, 2024
89ccf47
Add group utils helpers
hel0t Jun 20, 2024
68d33be
Add helper classes to contain useful functions for matching and grouping
hel0t Jun 20, 2024
4c1013a
remove old group id
hel0t Jun 24, 2024
df1635d
Update matching type enum
hel0t Jun 24, 2024
4994fcf
Add group info to information packet
hel0t Jun 24, 2024
7ffe69b
Update GroupId
hel0t Jun 24, 2024
f55533d
Improve null check
hel0t Jun 24, 2024
7c11928
update info packet to include group info
hel0t Jun 30, 2024
60e99ce
add endpoint for group raid info
hel0t Jun 30, 2024
a459be3
update server group & client ready/connected info
hel0t Jun 30, 2024
99f90cf
add join group raid notification handler
hel0t Jun 30, 2024
083b07c
enable patches
hel0t Jun 30, 2024
4eefa4e
Remove group member from notification messages
hel0t Jul 1, 2024
ca8c246
Update references & class names
hel0t Jul 2, 2024
f4ca289
Use safer dictionary access
hel0t Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions Fika.Core/Coop/ClientClasses/NoInertiaMovementContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using Comfort.Common;
using EFT;
using System;
using UnityEngine;

namespace Fika.Core.Coop.ClientClasses
{
/// <summary>
/// Used to simulate having near no inertia
/// </summary>
public class NoInertiaMovementContext : MovementContext
{
public new static NoInertiaMovementContext Create(Player player, Func<IAnimator> animatorGetter, Func<ICharacterController> characterControllerGetter, LayerMask groundMask)
{
NoInertiaMovementContext movementContext = Create<NoInertiaMovementContext>(player, animatorGetter, characterControllerGetter, groundMask);
return movementContext;
}

public override void Init()
{
base.Init();
TiltInertia = 0.22f;
WalkInertia = 0.005f;
SprintBrakeInertia = 0f;
}

public override void WeightRelatedValuesUpdated()
{
if (_player.ProceduralWeaponAnimation != null)
{
_player.ProceduralWeaponAnimation.Overweight = _player.Physical.Overweight;
_player.ProceduralWeaponAnimation.UpdateSwayFactors();
_player.ProceduralWeaponAnimation.UpdateSwaySettings();
_player.ProceduralWeaponAnimation.WeaponFlipSpeed = InertiaSettings.WeaponFlipSpeed.Evaluate(_player.Physical.Inertia);
}
UpdateCovertEfficiency(_player.MovementContext.ClampedSpeed, true);
_player.UpdateStepSoundRolloff();
_player.HealthController.FallSafeHeight = Mathf.Lerp(Singleton<BackendConfigSettingsClass>.Instance.Health.Falling.SafeHeight, Singleton<BackendConfigSettingsClass>.Instance.Stamina.SafeHeightOverweight, _player.Physical.Overweight);
PlayerAnimatorTransitionSpeed = TransitionSpeed;
if (PoseLevel > _player.Physical.MaxPoseLevel && CurrentState is MovementState movementState)
{
movementState.ChangePose(_player.Physical.MaxPoseLevel - PoseLevel);
}
if (_player.PoseMemo > _player.Physical.MaxPoseLevel)
{
_player.PoseMemo = _player.Physical.MaxPoseLevel;
}
float walkSpeedLimit = _player.Physical.WalkSpeedLimit;
RemoveStateSpeedLimit(Player.ESpeedLimit.Weight);
if (walkSpeedLimit < 1f)
{
AddStateSpeedLimit(walkSpeedLimit * MaxSpeed, Player.ESpeedLimit.Weight);
}
UpdateCharacterControllerSpeedLimit();
}
}
}
3 changes: 3 additions & 0 deletions Fika.Core/Coop/ClientClasses/NoInertiaPhysical.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

namespace Fika.Core.Coop.ClientClasses
{
/// <summary>
/// Currently unused
/// </summary>
public class NoInertiaPhysical : PlayerPhysicalClass
{
private CoopPlayer coopPlayer;
Expand Down
34 changes: 10 additions & 24 deletions Fika.Core/Coop/Components/CoopHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static string GetServerId()
CoopHandler coopGC = GetCoopHandler();
if (coopGC == null)
{
return FikaBackendUtils.GetGroupId();
return FikaBackendUtils.GetServerId();
}

return coopGC.ServerId;
Expand Down Expand Up @@ -226,7 +226,6 @@ void ProcessQuitting()
{
coopGame.Stop(Singleton<GameWorld>.Instance.MainPlayer.ProfileId, coopGame.MyExitStatus, MyPlayer.ActiveHealthController.IsAlive ? coopGame.MyExitLocation : null, 0);
}
return;
}
}

Expand Down Expand Up @@ -348,7 +347,9 @@ await Singleton<PoolManager>.Instance.LoadBundlesAndCreatePools(PoolManager.Pool
if (botController != null)
{
// Start Coroutine as botController might need a while to start sometimes...
#if DEBUG
Logger.LogInfo("Starting AddClientToBotEnemies routine.");
#endif
StartCoroutine(AddClientToBotEnemies(botController, otherPlayer));
}
else
Expand Down Expand Up @@ -519,8 +520,10 @@ private ObservedCoopPlayer SpawnObservedPlayer(Profile profile, Vector3 position
private IEnumerator AddClientToBotEnemies(BotsController botController, LocalPlayer playerToAdd)
{
CoopGame coopGame = LocalGameInstance;


#if DEBUG
Logger.LogInfo($"AddClientToBotEnemies: " + playerToAdd.Profile.Nickname);
#endif

while (coopGame.Status != GameStatus.Running && !botController.IsEnable)
{
Expand All @@ -531,29 +534,12 @@ private IEnumerator AddClientToBotEnemies(BotsController botController, LocalPla
{
yield return null;
}


#if DEBUG
Logger.LogInfo($"Adding Client {playerToAdd.Profile.Nickname} to enemy list");
botController.AddActivePLayer(playerToAdd);

bool found = false;

for (int i = 0; i < botController.BotSpawner.PlayersCount; i++)
{
if (botController.BotSpawner.GetPlayer(i) == playerToAdd)
{
found = true;
break;
}
}
#endif

if (found)
{
Logger.LogInfo($"Verified that {playerToAdd.Profile.Nickname} was added to the enemy list.");
}
else
{
Logger.LogInfo($"Failed to add {playerToAdd.Profile.Nickname} to the enemy list.");
}
botController.AddActivePLayer(playerToAdd);
}

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions Fika.Core/Coop/Custom/FikaDynamicAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ private void Spawner_OnBotCreated(BotOwner botOwner)
return;
}

if (FikaPlugin.DynamicAIIgnoreSnipers.Value)
{
if (botOwner.IsRole(WildSpawnType.marksman))
{
return;
}
}

bots.Add((CoopBot)botOwner.GetPlayer);
}

Expand Down
Loading