fix: cosmetics

it's selectable now, but saving a set of accessories still doesn't work correctly
This commit is contained in:
GenZmeY 2020-12-13 23:47:31 +03:00
parent d69656e0ab
commit 6948bdb866
3 changed files with 43 additions and 4 deletions

View File

@ -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 * Removes any attachments that exist in the same socket or have overriding cases
* Network: Local Player * 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<int> out_RemovedAttachments)
{ {
local name NewAttachmentSocketName; local name NewAttachmentSocketName;
local int i, CurrentAttachmentIdx; local int i, CurrentAttachmentIdx;
@ -574,6 +574,7 @@ static final function DetachConflictingAttachments(KFCharacterInfo_Human C, int
KFP.ThirdPersonAttachmentSocketNames[i] == NewAttachmentSocketName) KFP.ThirdPersonAttachmentSocketNames[i] == NewAttachmentSocketName)
{ {
C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI); C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI);
out_RemovedAttachments.AddItem(i);
continue; continue;
} }
@ -581,6 +582,7 @@ static final function DetachConflictingAttachments(KFCharacterInfo_Human C, int
if (C.GetOverrideCase(CurrentAttachmentIdx, NewAttachmentMeshIndex)) if (C.GetOverrideCase(CurrentAttachmentIdx, NewAttachmentMeshIndex))
{ {
C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI); C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI);
out_RemovedAttachments.AddItem(i);
continue; continue;
} }
@ -588,6 +590,7 @@ static final function DetachConflictingAttachments(KFCharacterInfo_Human C, int
if (C.GetOverrideCase(NewAttachmentMeshIndex, CurrentAttachmentIdx)) if (C.GetOverrideCase(NewAttachmentMeshIndex, CurrentAttachmentIdx))
{ {
C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI); C.RemoveAttachmentMeshAndSkin(i, KFP, KFPRI);
out_RemovedAttachments.AddItem(i);
continue; continue;
} }
} }
@ -663,7 +666,7 @@ static function int GetAttachmentSlotIndex(
for (AttachmentIdx = 0; AttachmentIdx < `MAX_COSMETIC_ATTACHMENTS; AttachmentIdx++) for (AttachmentIdx = 0; AttachmentIdx < `MAX_COSMETIC_ATTACHMENTS; AttachmentIdx++)
{ {
CosmeticMeshIdx = bCustom ? EPRI.CustomCharacter.AttachmentMeshIndices[AttachmentIdx] : KFPRI.RepCustomizationInfo.AttachmentMeshIndices[AttachmentIdx]; CosmeticMeshIdx = bCustom ? EPRI.CustomCharacter.AttachmentMeshIndices[AttachmentIdx] : KFPRI.RepCustomizationInfo.AttachmentMeshIndices[AttachmentIdx];
if (CosmeticMeshIdx == INDEX_NONE || CosmeticMeshIdx == CurrentAttachmentMeshIndex) if (CosmeticMeshIdx == CurrentAttachmentMeshIndex)
{ {
return AttachmentIdx; return AttachmentIdx;
} }

View File

@ -108,6 +108,9 @@ function LocalizeText()
LocalizedObject.SetString("bodiesString", class'KFGFxMenu_Gear'.Default.BodyString); LocalizedObject.SetString("bodiesString", class'KFGFxMenu_Gear'.Default.BodyString);
LocalizedObject.SetString("skinsString", class'KFGFxMenu_Gear'.Default.SkinsString); LocalizedObject.SetString("skinsString", class'KFGFxMenu_Gear'.Default.SkinsString);
LocalizedObject.SetString("attachmentsString", class'KFGFxMenu_Gear'.Default.AttachmentsString); 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); 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); 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) function Callback_Attachment(int MeshIndex, int SkinIndex)
{ {
local int SlotIndex; local int SlotIndex;
@ -667,7 +704,6 @@ function Callback_Attachment(int MeshIndex, int SkinIndex)
ExtPRI.UpdateCustomization(CO_Attachment, MeshIndex, SkinIndex, SlotIndex); ExtPRI.UpdateCustomization(CO_Attachment, MeshIndex, SkinIndex, SlotIndex);
} }
SetAttachmentButtons(class'KFGFxMenu_Gear'.Default.AttachmentKey, class'KFGFxMenu_Gear'.Default.AttachmentFunctionKey); SetAttachmentButtons(class'KFGFxMenu_Gear'.Default.AttachmentKey, class'KFGFxMenu_Gear'.Default.AttachmentFunctionKey);
} }
} }

View File

@ -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) switch (Type)
{ {