Skip to content

Commit

Permalink
Used trimmed profile for preview screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jan 4, 2025
1 parent 75d5e73 commit cda5de3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions Fika.Core/Coop/Utils/FikaBackendUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ internal static void AddPartyMembers(Dictionary<Profile, bool> profiles)
{
Profile profile = kvp.Key;
InfoClass info = profile.Info;
FikaPlugin.Instance.FikaLogger.LogError($"REceived profile: {profile.Encyclopedia}, {profile.InsuredItems}, {profile.TaskConditionCounters}");
GClass1322 infoSet = new()
{
AccountId = profile.AccountId,
Expand Down
16 changes: 14 additions & 2 deletions Fika.Core/Coop/Utils/FikaGlobals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,21 @@ public static Profile GetProfile(bool scav)
return session.ProfileOfPet;
}

public static bool IsMineClose(MineDirectional mine, Vector3 minePosition)
/// <summary>
/// Gets the current PMC or scav profile with trimmed data
/// </summary>
/// <param name="scav">If the scav profile should be returned</param>
/// <returns>A trimmed <see cref="Profile"/> of chosen side</returns>
public static Profile GetLiteProfile(bool scav)
{
return Vector3.Distance(mine.transform.position, minePosition) < Mathf.Epsilon;
Profile profile = GetProfile(scav);
GClass1962 liteDescriptor = new(profile, SearchControllerSerializer)
{
Encyclopedia = [],
InsuredItems = [],
TaskConditionCounters = []
};
return new(liteDescriptor);
}
}
}
2 changes: 1 addition & 1 deletion Fika.Core/Networking/FikaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ public void OnPeerConnected(NetPeer peer)
NotificationManagerClass.DisplayMessageNotification(string.Format(LocaleUtils.CONNECTED_TO_SERVER.Localized(), peer.Port),
ENotificationDurationType.Default, ENotificationIconType.Friend);

Profile ownProfile = FikaGlobals.GetProfile(FikaBackendUtils.IsScav);
Profile ownProfile = FikaGlobals.GetLiteProfile(FikaBackendUtils.IsScav);
if (ownProfile == null)
{
logger.LogError("OnPeerConnected: Own profile was null!");
Expand Down
2 changes: 1 addition & 1 deletion Fika.Core/Networking/FikaServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public async Task Init()
visualProfiles = [];
if (!FikaBackendUtils.IsDedicated)
{
Profile ownProfile = FikaGlobals.GetProfile(FikaBackendUtils.IsScav);
Profile ownProfile = FikaGlobals.GetLiteProfile(FikaBackendUtils.IsScav);
if (ownProfile != null)
{
visualProfiles.Add(ownProfile, true);
Expand Down

0 comments on commit cda5de3

Please sign in to comment.