diff --git a/Config/DefaultGame.ini b/Config/DefaultGame.ini index b991c9822..d6f6c04bb 100644 --- a/Config/DefaultGame.ini +++ b/Config/DefaultGame.ini @@ -15,6 +15,7 @@ InsertPack = (PackSource="StarterContent.upack",PackName="StarterContent") bIsDrawHitCursorLine=0 bIsDrawDeprojectedCursorLine=0 bIsShowMouseCursor=1 +bIsDrawExplosionSpheres=0 NetGraph=1 CameraVerticalSpeedLag=0.000000 UnUsedEnum=Everything diff --git a/Content/Maps/warmup.umap b/Content/Maps/warmup.umap index 912f09d95..cc6628b50 100644 Binary files a/Content/Maps/warmup.umap and b/Content/Maps/warmup.umap differ diff --git a/Source/Cloud9/Game/Cloud9DeveloperSettings.cpp b/Source/Cloud9/Game/Cloud9DeveloperSettings.cpp index 9c1300cdb..2ecd3f759 100644 --- a/Source/Cloud9/Game/Cloud9DeveloperSettings.cpp +++ b/Source/Cloud9/Game/Cloud9DeveloperSettings.cpp @@ -33,6 +33,7 @@ UCloud9DeveloperSettings::UCloud9DeveloperSettings(const FObjectInitializer& Obj bIsShowMouseCursor = 0; bIsDrawDeprojectedCursorLine = 0; bIsDrawHitCursorLine = 0; + bIsDrawExplosionSpheres = 0; NetGraph = 0; Volume = 0.1; } @@ -98,6 +99,12 @@ void UCloud9DeveloperSettings::InitializeCVars() TEXT("Whether to show mouse cursor on screen or not in game") ); + RegisterConsoleVariable( + bIsDrawExplosionSpheres, + TEXT("r.bIsDrawExplosionSpheres"), + TEXT("Whether to debug explosions spheres") + ); + RegisterConsoleVariable( NetGraph, TEXT("r.NetGraph"), diff --git a/Source/Cloud9/Game/Cloud9DeveloperSettings.h b/Source/Cloud9/Game/Cloud9DeveloperSettings.h index 1f55dbe4d..2cf3f1de7 100644 --- a/Source/Cloud9/Game/Cloud9DeveloperSettings.h +++ b/Source/Cloud9/Game/Cloud9DeveloperSettings.h @@ -67,6 +67,9 @@ class CLOUD9_API UCloud9DeveloperSettings : public UDeveloperSettings UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Debug) int32 bIsShowMouseCursor; + UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Debug) + int32 bIsDrawExplosionSpheres; + UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Debug) int32 NetGraph; diff --git a/Source/Cloud9/Weapon/Classes/Cloud9WeaponGrenade.cpp b/Source/Cloud9/Weapon/Classes/Cloud9WeaponGrenade.cpp index f62080531..4c18a422c 100644 --- a/Source/Cloud9/Weapon/Classes/Cloud9WeaponGrenade.cpp +++ b/Source/Cloud9/Weapon/Classes/Cloud9WeaponGrenade.cpp @@ -23,6 +23,8 @@ #include "Cloud9WeaponGrenade.h" +#include "DrawDebugHelpers.h" + #include "Cloud9/Character/Cloud9Character.h" #include "Cloud9/Game/Cloud9DeveloperSettings.h" #include "Cloud9/Game/Cloud9GameInstance.h" @@ -90,8 +92,9 @@ bool ACloud9WeaponGrenade::OnInitialize(const FWeaponId& NewWeaponId, FName NewW } let CommonData = WeaponDefinition.GetCommonData(); - Explosion->Radius = CommonData->Grenade.ExplosionRadius; - Explosion->ImpulseStrength = CommonData->Grenade.ImpulseStrength; + + Explosion->Radius = GetWeaponInfo()->Radius; + Explosion->ImpulseStrength = GetWeaponInfo()->Damage * CommonData->Grenade.ImpulseMultiplier; Explosion->bIgnoreOwningActor = true; Explosion->bImpulseVelChange = true; @@ -232,6 +235,7 @@ bool ACloud9WeaponGrenade::OnGrenadeActionLoop() return false; } + // TODO: look like active effect not required (can be replaced by niagara effect) if (IsValid(ActiveEffect)) { ActiveEffect->Activate(); @@ -262,6 +266,49 @@ bool ACloud9WeaponGrenade::OnGrenadeActionLoop() UCloud9SoundPlayer::PlayRandomSound(ExplodeSounds, GetActorLocation(), Settings->Volume); } + if (Settings->bIsDrawExplosionSpheres) + { + constexpr int SphereSegments = 32; + constexpr int SphereLifeTime = 4.0f; + constexpr int SphereThickness = 1.0f; + + DrawDebugSphere( + GetWorld(), + GetActorLocation(), + Explosion->Radius * 0.5f, + SphereSegments, + FColor::Red, + false, + SphereLifeTime, + 0, + SphereThickness + ); + + DrawDebugSphere( + GetWorld(), + GetActorLocation(), + Explosion->Radius * 0.75f, + SphereSegments, + FColor::Yellow, + false, + SphereLifeTime, + 0, + SphereThickness + ); + + DrawDebugSphere( + GetWorld(), + GetActorLocation(), + Explosion->Radius * 1.0f, + SphereSegments, + FColor::Green, + false, + SphereLifeTime, + 0, + SphereThickness + ); + } + // Activate action finished timer ActiveTimerHandle = GetWorld() | EUWorld::AsyncAfter{ diff --git a/Source/Cloud9/Weapon/Tables/WeaponCommonData.h b/Source/Cloud9/Weapon/Tables/WeaponCommonData.h index 6b87208fd..9bdb6d82d 100644 --- a/Source/Cloud9/Weapon/Tables/WeaponCommonData.h +++ b/Source/Cloud9/Weapon/Tables/WeaponCommonData.h @@ -69,11 +69,11 @@ struct FGrenadeCommonData { GENERATED_BODY() - UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Explosive) - float ExplosionRadius = 200.0f; - - UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Explosive) - float ImpulseStrength = 2000.0f; + /** + * Only relevant for frag (explosive) + */ + UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Damage) + float ImpulseMultiplier = 10.0f; UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Throw) float MaxThrowImpulse = 800.0f; diff --git a/Source/Cloud9/Weapon/Tables/WeaponTableGrenade.h b/Source/Cloud9/Weapon/Tables/WeaponTableGrenade.h index 996b5a160..6943720cb 100644 --- a/Source/Cloud9/Weapon/Tables/WeaponTableGrenade.h +++ b/Source/Cloud9/Weapon/Tables/WeaponTableGrenade.h @@ -106,25 +106,28 @@ struct FGrenadeWeaponInfo : public FBaseWeaponInfo TSubclassOf Class; /** - * -- + * Only relevant for frag (explosive) and molotov grenade */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Damage, meta=(UIMin="0", UIMax="1000", ClampMin="0", ClampMax="1000")) float Damage; /** - * Damage against armored opponents is multiplied by ArmorPenetration * 0.5 + * Effective radius for grenade + * - Explosive - Explosive radius + * - Molotov - Radius of burning + * - Smoke - Radius of smoke + * - Flash - Not relevant */ - UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Damage, - meta=(UIMin="0", UIMax="1.0", ClampMin="0", ClampMax="2.0")) - float ArmorPenetration = 2.0f; + UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Damage) + float Radius = 200.0f; /** - * -- + * Damage against armored opponents is multiplied by ArmorPenetration * 0.5 */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Damage, - meta=(UIMin="0", UIMax="1.0", ClampMin="0", ClampMax="1.0")) - float RangeModifier = 1.0f; + meta=(UIMin="0", UIMax="1.0", ClampMin="0", ClampMax="2.0")) + float ArmorPenetration = 2.0f; /** * Time to pull out pin of grenade before throw