diff --git a/Content/Blueprints/Weapon/BP_AssaultRifle.uasset b/Content/Blueprints/Weapon/BP_AssaultRifle.uasset index d93b95c..774c200 100644 Binary files a/Content/Blueprints/Weapon/BP_AssaultRifle.uasset and b/Content/Blueprints/Weapon/BP_AssaultRifle.uasset differ diff --git a/Content/Blueprints/Weapon/Projectiles/BP_Grenade.uasset b/Content/Blueprints/Weapon/Projectiles/BP_Grenade.uasset index 41ae80f..48b3c3a 100644 Binary files a/Content/Blueprints/Weapon/Projectiles/BP_Grenade.uasset and b/Content/Blueprints/Weapon/Projectiles/BP_Grenade.uasset differ diff --git a/Content/Blueprints/Weapon/Projectiles/BP_ProjectileBullet.uasset b/Content/Blueprints/Weapon/Projectiles/BP_ProjectileBullet.uasset index 17dcd5f..38211fc 100644 Binary files a/Content/Blueprints/Weapon/Projectiles/BP_ProjectileBullet.uasset and b/Content/Blueprints/Weapon/Projectiles/BP_ProjectileBullet.uasset differ diff --git a/Content/Blueprints/Weapon/Projectiles/BP_ProjectileGrenade.uasset b/Content/Blueprints/Weapon/Projectiles/BP_ProjectileGrenade.uasset index 12dbc23..448c3a7 100644 Binary files a/Content/Blueprints/Weapon/Projectiles/BP_ProjectileGrenade.uasset and b/Content/Blueprints/Weapon/Projectiles/BP_ProjectileGrenade.uasset differ diff --git a/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset b/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset index c8f2b0e..f5dbdd0 100644 Binary files a/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset and b/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset differ diff --git a/Content/Maps/BlasterMap.umap b/Content/Maps/BlasterMap.umap index f0b5b25..933d14f 100644 Binary files a/Content/Maps/BlasterMap.umap and b/Content/Maps/BlasterMap.umap differ diff --git a/Source/Blaster/Weapon/Projectile.h b/Source/Blaster/Weapon/Projectile.h index 71869d6..aa7a80f 100644 --- a/Source/Blaster/Weapon/Projectile.h +++ b/Source/Blaster/Weapon/Projectile.h @@ -22,9 +22,19 @@ public: FVector_NetQuantize100 InitialVelocity; UPROPERTY(EditAnywhere) - float InitialSpeed = 15000; + float InitialSpeed = 25000; + // SSR will get Damage directly from the weapon + // Non SSR, Damage will be set from the weapon + // Only set this for Grenades and Rockets + UPROPERTY(EditAnywhere) float Damage = 20.f; + + // SSR will get Damage directly from the weapon + // Non SSR, Damage will be set from the weapon + // Doesn't matter for Grenades and rockets + UPROPERTY(EditAnywhere) + float HeadShotDamage = 40.f; protected: virtual void BeginPlay() override; diff --git a/Source/Blaster/Weapon/ProjectileBullet.cpp b/Source/Blaster/Weapon/ProjectileBullet.cpp index a83e549..f2c8e2b 100644 --- a/Source/Blaster/Weapon/ProjectileBullet.cpp +++ b/Source/Blaster/Weapon/ProjectileBullet.cpp @@ -46,7 +46,9 @@ void AProjectileBullet::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, { if (OwnerCharacter->HasAuthority() && !bUseServerSideRewind) { - UGameplayStatics::ApplyDamage(OtherActor, Damage, OwnerController, this, UDamageType::StaticClass()); + const float DamageToCause = Hit.BoneName.ToString() == FString("head") ? HeadShotDamage : Damage; + + UGameplayStatics::ApplyDamage(OtherActor, DamageToCause, OwnerController, this, UDamageType::StaticClass()); Super::OnHit(HitComp, OtherActor, OtherComp, NormalImpulse, Hit); return; } diff --git a/Source/Blaster/Weapon/ProjectileWeapon.cpp b/Source/Blaster/Weapon/ProjectileWeapon.cpp index 1262073..de06432 100644 --- a/Source/Blaster/Weapon/ProjectileWeapon.cpp +++ b/Source/Blaster/Weapon/ProjectileWeapon.cpp @@ -17,8 +17,8 @@ void AProjectileWeapon::Fire(const FVector& HitTarget) { FTransform SocketTransform = MuzzleFlashSocket->GetSocketTransform(GetWeaponMesh()); // From muzzle flash socket to hit location from TraceUnderCrosshairs - FVector ToTarget = HitTarget - SocketTransform.GetLocation(); - FRotator TargetRotation = ToTarget.Rotation(); + const FVector ToTarget = HitTarget - SocketTransform.GetLocation(); + const FRotator TargetRotation = ToTarget.Rotation(); FActorSpawnParameters SpawnParams; SpawnParams.Owner = GetOwner(); @@ -34,6 +34,7 @@ void AProjectileWeapon::Fire(const FVector& HitTarget) SpawnedProjectile = World->SpawnActor(ProjectileClass, SocketTransform.GetLocation(), TargetRotation, SpawnParams); SpawnedProjectile->bUseServerSideRewind = false; SpawnedProjectile->Damage = Damage; + SpawnedProjectile->HeadShotDamage = HeadShotDamage; } else // Server, not locally controlled - spawn non-replicated projectile, SSR { @@ -64,6 +65,7 @@ void AProjectileWeapon::Fire(const FVector& HitTarget) SpawnedProjectile = World->SpawnActor(ProjectileClass, SocketTransform.GetLocation(), TargetRotation, SpawnParams); SpawnedProjectile->bUseServerSideRewind = false; SpawnedProjectile->Damage = Damage; + SpawnedProjectile->HeadShotDamage = HeadShotDamage; } } }