diff --git a/Config/DefaultGame.ini b/Config/DefaultGame.ini index 79af9bd76..1bb4e9b8e 100644 --- a/Config/DefaultGame.ini +++ b/Config/DefaultGame.ini @@ -23,6 +23,9 @@ bIsPrintHitScanInfo=0 CameraVerticalSpeedLag=0.000000 NetGraph=1 bIsAutoSelectWeapon=0 +bIsInfiniteAmmo=0 +bIsCheatsEnabled=0 +bIsSelfAimEnabled=0 Volume=0.200000 UnUsedEnum=Everything UnUsedStruct=(IntField0=3,FloatField1=0.000000) diff --git a/Content/Maps/warmup.umap b/Content/Maps/warmup.umap index 6ab1ea384..df4c5a4a4 100644 Binary files a/Content/Maps/warmup.umap and b/Content/Maps/warmup.umap differ diff --git a/Content/Physicals/PM_Character.uasset b/Content/Physicals/PM_Character.uasset index 26cc5654a..16a310610 100644 Binary files a/Content/Physicals/PM_Character.uasset and b/Content/Physicals/PM_Character.uasset differ diff --git a/Source/Cloud9/Character/Cloud9Character.cpp b/Source/Cloud9/Character/Cloud9Character.cpp index 7e4234862..e46f0107f 100644 --- a/Source/Cloud9/Character/Cloud9Character.cpp +++ b/Source/Cloud9/Character/Cloud9Character.cpp @@ -323,8 +323,6 @@ float ACloud9Character::InternalTakePointDamage( let BoneName = PointDamageEvent.HitInfo.BoneName; Damage = Super::InternalTakePointDamage(Damage, PointDamageEvent, EventInstigator, DamageCauser); - let Armor = HealthComponent->GetArmor(); - if (let Weapon = Cast(DamageCauser)) { let WeaponInfo = Weapon->GetWeaponInfo(); @@ -334,12 +332,12 @@ float ACloud9Character::InternalTakePointDamage( if (HeadBoneNames.Contains(BoneName)) { Damage *= WeaponInfo->HeadshotMultiplier; - HitInArmor = true; + HitInArmor = HealthComponent->HasHelmet(); } else if (UpperBodyBoneNames.Contains(BoneName)) { Damage *= WeaponInfo->UpperBodyMultiplier; - HitInArmor = true; + HitInArmor = HealthComponent->IsArmored(); } else if (LowerBodyBoneNames.Contains(BoneName)) { @@ -350,9 +348,10 @@ float ACloud9Character::InternalTakePointDamage( Damage *= WeaponInfo->LegMultiplier; } - if (Armor != 0.0f and HitInArmor) + if (HitInArmor) { Damage *= WeaponInfo->ArmorPenetration * ArmorCoefficient; + HealthComponent->TakeArmorDamage(Damage / 2); } let Distance = FVector::DistSquared(DamageCauser->GetActorLocation(), GetActorLocation()); diff --git a/Source/Cloud9/Character/Components/Cloud9HealthComponent.cpp b/Source/Cloud9/Character/Components/Cloud9HealthComponent.cpp index 241e6c9c4..bbfd3b445 100644 --- a/Source/Cloud9/Character/Components/Cloud9HealthComponent.cpp +++ b/Source/Cloud9/Character/Components/Cloud9HealthComponent.cpp @@ -167,7 +167,6 @@ void UCloud9HealthComponent::OnTakePointDamage( AActor* DamageCauser) { TakeHealthDamage(Damage); - TakeArmorDamage(0.0f); // TODO: Add armor damage calc AddAttackerScore(InstigatedBy); } @@ -181,6 +180,5 @@ void UCloud9HealthComponent::OnTakeRadialDamage( AActor* DamageCauser) { TakeHealthDamage(Damage); - TakeArmorDamage(0.0f); // TODO: Add armor damage calc AddAttackerScore(InstigatedBy); } diff --git a/Source/Cloud9/Character/Components/Cloud9HealthComponent.h b/Source/Cloud9/Character/Components/Cloud9HealthComponent.h index ebe501a07..2a9ec1ec6 100644 --- a/Source/Cloud9/Character/Components/Cloud9HealthComponent.h +++ b/Source/Cloud9/Character/Components/Cloud9HealthComponent.h @@ -83,6 +83,7 @@ class CLOUD9_API UCloud9HealthComponent : public UActorComponent float GetHealth() const { return Health; } float GetArmor() const { return Armor; } + bool IsArmored() const { return Armor > 0.0f; } bool HasHelmet() const { return bHasHelmet; } bool IsAlive() const { return bIsAlive; } diff --git a/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp b/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp index 6f629b4bc..a3abff35d 100644 --- a/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp +++ b/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp @@ -88,4 +88,7 @@ bool UCloud9PhysicalMaterial::TestBackgroundDecalProbability() const return FMath::RandRange(0.0f, 1.0f) < FirearmBackgroundDecalProbability; } -UNiagaraSystem* UCloud9PhysicalMaterial::GetRandomFirearmSquib() const { return GetRandomItem(FirearmEffects); } +UNiagaraSystem* UCloud9PhysicalMaterial::GetRandomFirearmSquib(bool IsAlternative) const +{ + return IsAlternative ? GetRandomItem(FirearmAltEffects) : GetRandomItem(FirearmEffects); +} diff --git a/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.h b/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.h index 6dd892f5b..860e31df5 100644 --- a/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.h +++ b/Source/Cloud9/Physicals/Cloud9PhysicalMaterial.h @@ -18,7 +18,7 @@ class CLOUD9_API UCloud9PhysicalMaterial : public UPhysicalMaterial UCloud9PhysicalMaterial(); UMaterialInterface* GetRandomFirearmDecal() const; - UNiagaraSystem* GetRandomFirearmSquib() const; + UNiagaraSystem* GetRandomFirearmSquib(bool IsAlternative) const; UMaterialInterface* GetRandomBackgroundDecal() const; FVector GetBackgroundDecalSize() const; @@ -48,6 +48,8 @@ class CLOUD9_API UCloud9PhysicalMaterial : public UPhysicalMaterial UPROPERTY(EditDefaultsOnly, Category="Firearm Hit Effect") TSet FirearmEffects; + UPROPERTY(EditDefaultsOnly, Category="Firearm Hit Effect") + TSet FirearmAltEffects; UPROPERTY(EditDefaultsOnly, Category="Firearm Background Decal") TSet FirearmBackgroundDecals; diff --git a/Source/Cloud9/Weapon/Classes/Cloud9WeaponFirearm.cpp b/Source/Cloud9/Weapon/Classes/Cloud9WeaponFirearm.cpp index bf75dbdfa..7a8e12c4d 100644 --- a/Source/Cloud9/Weapon/Classes/Cloud9WeaponFirearm.cpp +++ b/Source/Cloud9/Weapon/Classes/Cloud9WeaponFirearm.cpp @@ -35,6 +35,7 @@ #include "Cloud9/Contollers/Cloud9PlayerController.h" #include "Cloud9/Character/Cloud9Character.h" #include "Cloud9/Character/Components/Cloud9AnimationComponent.h" +#include "Cloud9/Character/Components/Cloud9HealthComponent.h" #include "Cloud9/Character/Components/Cloud9InventoryComponent.h" #include "Cloud9/Character/Damages/FirearmDamageType.h" #include "Cloud9/Game/Cloud9DeveloperSettings.h" @@ -470,7 +471,22 @@ EFirearmFireStatus ACloud9WeaponFirearm::Fire( if (let PhysicalMaterial = Cast(LineHit.PhysMaterial); IsValid(PhysicalMaterial)) { - if (let FirearmSquib = PhysicalMaterial->GetRandomFirearmSquib(); IsValid(FirearmSquib)) + if (let HealthComponent = DamagedActor->FindComponentByClass(); + IsValid(HealthComponent) and HealthComponent->IsArmored()) + { + if (let FirearmSquib = PhysicalMaterial->GetRandomFirearmSquib(true); IsValid(FirearmSquib)) + { + UNiagaraFunctionLibrary::SpawnSystemAtLocation( + GetWorld(), + FirearmSquib, + LineHit.Location, + LineHit.Normal.Rotation(), + FVector::OneVector, + true); + } + } + + if (let FirearmSquib = PhysicalMaterial->GetRandomFirearmSquib(false); IsValid(FirearmSquib)) { UNiagaraFunctionLibrary::SpawnSystemAtLocation( GetWorld(),