From 6948bdb8664b38db87c607b99f6636b331b0bf48 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 13 Dec 2020 23:47:31 +0300 Subject: [PATCH] fix: cosmetics it's selectable now, but saving a set of accessories still doesn't work correctly --- ServerExt/Classes/ExtCharacterInfo.uc | 7 +++- ServerExt/Classes/ExtMenu_Gear.uc | 38 ++++++++++++++++++- ServerExt/Classes/ExtPlayerReplicationInfo.uc | 2 +- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/ServerExt/Classes/ExtCharacterInfo.uc b/ServerExt/Classes/ExtCharacterInfo.uc index b138b10..3fdeba8 100644 --- a/ServerExt/Classes/ExtCharacterInfo.uc +++ b/ServerExt/Classes/ExtCharacterInfo.uc @@ -547,7 +547,7 @@ static final function SetAttachmentMesh(KFCharacterInfo_Human C, int CurrentAtta * Removes any attachments that exist in the same socket or have overriding cases * Network: Local Player */ -static final function DetachConflictingAttachments(KFCharacterInfo_Human C, int NewAttachmentMeshIndex, KFPawn KFP, optional KFPlayerReplicationInfo KFPRI) +static final function DetachConflictingAttachments(KFCharacterInfo_Human C, int NewAttachmentMeshIndex, KFPawn KFP, optional KFPlayerReplicationInfo KFPRI, optional out array out_RemovedAttachments) { local name NewAttachmentSocketName; local int i, CurrentAttachmentIdx; @@ -574,6 +574,7 @@ static final function DetachConflictingAttachments(KFCharacterInfo_Human C, int KFP.ThirdPersonAttachmentSocketNames[i] == NewAttachmentSocketName) { C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI); + out_RemovedAttachments.AddItem(i); continue; } @@ -581,6 +582,7 @@ static final function DetachConflictingAttachments(KFCharacterInfo_Human C, int if (C.GetOverrideCase(CurrentAttachmentIdx, NewAttachmentMeshIndex)) { C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI); + out_RemovedAttachments.AddItem(i); continue; } @@ -588,6 +590,7 @@ static final function DetachConflictingAttachments(KFCharacterInfo_Human C, int if (C.GetOverrideCase(NewAttachmentMeshIndex, CurrentAttachmentIdx)) { C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI); + out_RemovedAttachments.AddItem(i); continue; } } @@ -663,7 +666,7 @@ static function int GetAttachmentSlotIndex( for (AttachmentIdx = 0; AttachmentIdx < `MAX_COSMETIC_ATTACHMENTS; AttachmentIdx++) { CosmeticMeshIdx = bCustom ? EPRI.CustomCharacter.AttachmentMeshIndices[AttachmentIdx] : KFPRI.RepCustomizationInfo.AttachmentMeshIndices[AttachmentIdx]; - if (CosmeticMeshIdx == INDEX_NONE || CosmeticMeshIdx == CurrentAttachmentMeshIndex) + if (CosmeticMeshIdx == CurrentAttachmentMeshIndex) { return AttachmentIdx; } diff --git a/ServerExt/Classes/ExtMenu_Gear.uc b/ServerExt/Classes/ExtMenu_Gear.uc index 867efd4..67148b1 100644 --- a/ServerExt/Classes/ExtMenu_Gear.uc +++ b/ServerExt/Classes/ExtMenu_Gear.uc @@ -108,6 +108,9 @@ function LocalizeText() LocalizedObject.SetString("bodiesString", class'KFGFxMenu_Gear'.Default.BodyString); LocalizedObject.SetString("skinsString", class'KFGFxMenu_Gear'.Default.SkinsString); LocalizedObject.SetString("attachmentsString", class'KFGFxMenu_Gear'.Default.AttachmentsString); + LocalizedObject.SetString("attachment0String", class'KFGFxMenu_Gear'.Default.Attachment0String); + LocalizedObject.SetString("attachment1String", class'KFGFxMenu_Gear'.Default.Attachment1String); + LocalizedObject.SetString("attachment2String", class'KFGFxMenu_Gear'.Default.Attachment2String); SetObject("localizeText", LocalizedObject); } @@ -643,6 +646,40 @@ function Callback_Body(int MeshIndex, int SkinIndex) SetGearButtons(MeshIndex, SkinIndex, class'KFGFxMenu_Gear'.Default.BodyMeshKey, class'KFGFxMenu_Gear'.Default.BodySkinKey, class'KFGFxMenu_Gear'.Default.BodyFunctionKey); } +function Callback_Attachment1(int MeshIndex, int SkinIndex) +{ + Callback_AttachmentNumbered(MeshIndex, SkinIndex, 0); +} + +function Callback_Attachment2(int MeshIndex, int SkinIndex) +{ + Callback_AttachmentNumbered(MeshIndex, SkinIndex, 1); +} + +function Callback_Attachment3(int MeshIndex, int SkinIndex) +{ + Callback_AttachmentNumbered(MeshIndex, SkinIndex, 2); +} + +function Callback_AttachmentNumbered(int MeshIndex, int SkinIndex, int SlotIndex) +{ + local Pawn P; + local KFPawn KFP; + P = GetPC().Pawn; + if(P != none) + { + KFP = KFPawn(P); + + if (KFP != none && ExtPRI != None) + { + if (MeshIndex >= 0) + class'ExtCharacterInfo'.Static.DetachConflictingAttachments(CurrentCharInfo, MeshIndex, KFP, ExtPRI); + ExtPRI.UpdateCustomization(CO_Attachment, MeshIndex, SkinIndex, SlotIndex); + } + } + SetAttachmentButtons(class'KFGFxMenu_Gear'.Default.AttachmentKey, class'KFGFxMenu_Gear'.Default.AttachmentFunctionKey); +} + function Callback_Attachment(int MeshIndex, int SkinIndex) { local int SlotIndex; @@ -667,7 +704,6 @@ function Callback_Attachment(int MeshIndex, int SkinIndex) ExtPRI.UpdateCustomization(CO_Attachment, MeshIndex, SkinIndex, SlotIndex); } - SetAttachmentButtons(class'KFGFxMenu_Gear'.Default.AttachmentKey, class'KFGFxMenu_Gear'.Default.AttachmentFunctionKey); } } diff --git a/ServerExt/Classes/ExtPlayerReplicationInfo.uc b/ServerExt/Classes/ExtPlayerReplicationInfo.uc index b850980..3d874a9 100644 --- a/ServerExt/Classes/ExtPlayerReplicationInfo.uc +++ b/ServerExt/Classes/ExtPlayerReplicationInfo.uc @@ -505,7 +505,7 @@ simulated function ChangeCharacter(byte CharIndex, optional bool bFirstSet) } } -simulated function UpdateCustomization(byte Type, byte MeshIndex, byte SkinIndex, optional byte SlotIndex) +simulated function UpdateCustomization(int Type, int MeshIndex, int SkinIndex, optional int SlotIndex) { switch (Type) {