@@ -648,9 +648,11 @@ void UARWeaponInventoryComponent::AddMagazineMod(int8 WeaponIdx, int8 MagazineMo
648648 if (GetOwnerRole () < ENetRole::ROLE_Authority)
649649 {
650650 ServerAddMagazineMod (WeaponIdx, MagazineModIndex);
651+ return ;
651652 }
652-
653- // Predictively apply mod on client, and show it on UI.
653+ }
654+ void UARWeaponInventoryComponent::ServerAddMagazineMod_Implementation (int8 WeaponIdx, int8 MagazineModIndex)
655+ {
654656 if (AARCharacter* Character = Cast<AARCharacter>(GetOwner ()))
655657 {
656658 if (AARPlayerController* PC = Cast<AARPlayerController>(Character->Controller ))
@@ -664,16 +666,18 @@ void UARWeaponInventoryComponent::AddMagazineMod(int8 WeaponIdx, int8 MagazineMo
664666 if (Weapon)
665667 {
666668 Weapon->AddMagazineUpgrade (Magazine);
667- FARWeaponModInfo Info;
668- Info.Icon = Magazine->Icon ->GetPathName ();
669- Info.UpgradeType = EARWeaponUpgradeType::Magazine;
670- Weapon->ClientOnMagazineAdded (Info);
669+ ClientAddMagazineMod (WeaponIdx, MagazineModIndex);
671670 }
672671 }
673672 }
674673 }
675674}
676- void UARWeaponInventoryComponent::ServerAddMagazineMod_Implementation (int8 WeaponIdx, int8 MagazineModIndex)
675+ bool UARWeaponInventoryComponent::ServerAddMagazineMod_Validate (int8 WeaponIdx, int8 MagazineModIndex)
676+ {
677+ return true ;
678+ }
679+
680+ void UARWeaponInventoryComponent::ClientAddMagazineMod_Implementation (int8 WeaponIdx, int8 MagazineModIndex)
677681{
678682 if (AARCharacter* Character = Cast<AARCharacter>(GetOwner ()))
679683 {
@@ -688,13 +692,13 @@ void UARWeaponInventoryComponent::ServerAddMagazineMod_Implementation(int8 Weapo
688692 if (Weapon)
689693 {
690694 Weapon->AddMagazineUpgrade (Magazine);
695+ FARWeaponModInfo Info;
696+ Info.Icon = Magazine->Icon ->GetPathName ();
697+ Info.UpgradeType = EARWeaponUpgradeType::Magazine;
698+ Weapon->ClientOnMagazineAdded (Info);
691699 MainInventory->RemoveItem (MagazineModIndex);
692700 }
693701 }
694702 }
695703 }
696- }
697- bool UARWeaponInventoryComponent::ServerAddMagazineMod_Validate (int8 WeaponIdx, int8 MagazineModIndex)
698- {
699- return true ;
700704}
0 commit comments