mirror of
https://github.com/ApfelTeeSaft/OT6-Reconstruction.git
synced 2026-08-26 19:33:35 +00:00
Add UFortWeaponItemDefinition - Weapon data definition system
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
// UFortWeaponItemDefinition Implementation
|
||||
|
||||
#include "FortWeaponItemDefinition.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// UFortWeaponItemDefinition
|
||||
|
||||
UFortWeaponItemDefinition::UFortWeaponItemDefinition()
|
||||
: Icon(nullptr)
|
||||
, Rarity(EFortRarity::Common)
|
||||
, WeaponActorClass(nullptr)
|
||||
, WeaponCoreAnimation(EFortWeaponCoreAnimation::Rifle)
|
||||
, TriggerType(EFortWeaponTriggerType::OnPress)
|
||||
, WeaponMesh(nullptr)
|
||||
, WeaponFireMontage(nullptr)
|
||||
, WeaponFireDownsightsMontage(nullptr)
|
||||
, WeaponReloadMontage(nullptr)
|
||||
, WeaponFireCue(nullptr)
|
||||
, WeaponReloadCue(nullptr)
|
||||
, BulletShellFX(nullptr)
|
||||
, MuzzleFlashFX(nullptr)
|
||||
, ImpactFX(nullptr)
|
||||
, TracerFX(nullptr)
|
||||
, LootedWeaponsDurabilityModifier(1.0f)
|
||||
{
|
||||
|
||||
// Initialize default durability by rarity
|
||||
DurabilityByRarity.Add(EFortRarity::Common, 100.0f);
|
||||
DurabilityByRarity.Add(EFortRarity::Uncommon, 150.0f);
|
||||
DurabilityByRarity.Add(EFortRarity::Rare, 200.0f);
|
||||
DurabilityByRarity.Add(EFortRarity::Epic, 300.0f);
|
||||
DurabilityByRarity.Add(EFortRarity::Legendary, 400.0f);
|
||||
}
|
||||
|
||||
const FFortWeaponStats& UFortWeaponItemDefinition::GetWeaponStats() const
|
||||
{
|
||||
return WeaponStats;
|
||||
}
|
||||
|
||||
FFortWeaponStats UFortWeaponItemDefinition::GetWeaponStatsRow() const
|
||||
{
|
||||
|
||||
// Return copy of weapon stats
|
||||
return WeaponStats;
|
||||
}
|
||||
|
||||
float UFortWeaponItemDefinition::GetWeaponDurabilityByRarity(EFortRarity InRarity) const
|
||||
{
|
||||
|
||||
const float* Durability = DurabilityByRarity.Find(InRarity);
|
||||
if (Durability)
|
||||
{
|
||||
return (*Durability) * LootedWeaponsDurabilityModifier;
|
||||
}
|
||||
|
||||
// Default durability if rarity not found
|
||||
return 100.0f * LootedWeaponsDurabilityModifier;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// UFortWeaponRangedItemDefinition
|
||||
|
||||
UFortWeaponRangedItemDefinition::UFortWeaponRangedItemDefinition()
|
||||
: ProjectileClass(nullptr)
|
||||
, bUseProjectile(false)
|
||||
, ProjectileSpeed(10000.0f)
|
||||
{
|
||||
|
||||
WeaponCoreAnimation = EFortWeaponCoreAnimation::Rifle;
|
||||
TriggerType = EFortWeaponTriggerType::Automatic;
|
||||
|
||||
// Set default ranged weapon actor class
|
||||
WeaponActorClass = AFortWeaponRanged::StaticClass();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// UFortWeaponMeleeItemDefinition
|
||||
|
||||
UFortWeaponMeleeItemDefinition::UFortWeaponMeleeItemDefinition()
|
||||
: SwingRadius(200.0f)
|
||||
, SwingAngle(90.0f)
|
||||
, bCanHitMultiple(true)
|
||||
, MaxTargets(5)
|
||||
{
|
||||
|
||||
WeaponCoreAnimation = EFortWeaponCoreAnimation::Melee;
|
||||
TriggerType = EFortWeaponTriggerType::OnPress;
|
||||
|
||||
// Set default melee weapon actor class
|
||||
WeaponActorClass = AFortWeaponMelee::StaticClass();
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
// Source: D:\BuildFarm\buildmachine_++Fortnite+Release-Live\FortniteGame\Source\FortniteGame\Private\Weapons\Data\FortWeaponItemDefinition.cpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "FortWeaponData.h"
|
||||
#include "FortWeapon.h"
|
||||
#include "FortWeaponItemDefinition.generated.h"
|
||||
|
||||
/**
|
||||
* UFortWeaponItemDefinition - Defines weapon properties and stats
|
||||
*/
|
||||
UCLASS(Blueprintable)
|
||||
class FORTNITEGAME_API UFortWeaponItemDefinition : public UDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFortWeaponItemDefinition();
|
||||
|
||||
/**
|
||||
* Get weapon stats
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "Fort|Weapon")
|
||||
const FFortWeaponStats& GetWeaponStats() const;
|
||||
|
||||
/**
|
||||
* Get weapon stats row
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "Fort|Weapon")
|
||||
FFortWeaponStats GetWeaponStatsRow() const;
|
||||
|
||||
/**
|
||||
* Get weapon durability by rarity stats
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "Fort|Weapon")
|
||||
float GetWeaponDurabilityByRarity(EFortRarity Rarity) const;
|
||||
|
||||
/** Weapon display name */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Item")
|
||||
FText DisplayName;
|
||||
|
||||
/** Weapon description */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Item")
|
||||
FText Description;
|
||||
|
||||
/** Weapon icon */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Item")
|
||||
UTexture2D* Icon;
|
||||
|
||||
/** Weapon rarity */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Item")
|
||||
EFortRarity Rarity;
|
||||
|
||||
/**
|
||||
* Weapon class to spawn
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
TSubclassOf<AFortWeapon> WeaponActorClass;
|
||||
|
||||
/**
|
||||
* Weapon statistics
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
FFortWeaponStats WeaponStats;
|
||||
|
||||
/**
|
||||
* Weapon core animation type
|
||||
* Determines what animation set to use
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Animation")
|
||||
EFortWeaponCoreAnimation WeaponCoreAnimation;
|
||||
|
||||
/**
|
||||
* Weapon trigger type
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
EFortWeaponTriggerType TriggerType;
|
||||
|
||||
/**
|
||||
* Weapon mesh
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
USkeletalMesh* WeaponMesh;
|
||||
|
||||
/**
|
||||
* Weapon fire montage
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Animation")
|
||||
UAnimMontage* WeaponFireMontage;
|
||||
|
||||
/**
|
||||
* Weapon fire downsights montage
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Animation")
|
||||
UAnimMontage* WeaponFireDownsightsMontage;
|
||||
|
||||
/**
|
||||
* Weapon reload montage
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Animation")
|
||||
UAnimMontage* WeaponReloadMontage;
|
||||
|
||||
/**
|
||||
* Weapon fire sound
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Audio")
|
||||
USoundBase* WeaponFireCue;
|
||||
|
||||
/**
|
||||
* Weapon reload sound
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Audio")
|
||||
USoundBase* WeaponReloadCue;
|
||||
|
||||
/**
|
||||
* Bullet shell FX
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Effects")
|
||||
UParticleSystem* BulletShellFX;
|
||||
|
||||
/**
|
||||
* Muzzle flash FX
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Effects")
|
||||
UParticleSystem* MuzzleFlashFX;
|
||||
|
||||
/**
|
||||
* Impact FX
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Effects")
|
||||
UParticleSystem* ImpactFX;
|
||||
|
||||
/**
|
||||
* Tracer FX
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Effects")
|
||||
UParticleSystem* TracerFX;
|
||||
|
||||
/**
|
||||
* Weapon durability by rarity
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Durability")
|
||||
TMap<EFortRarity, float> DurabilityByRarity;
|
||||
|
||||
/**
|
||||
* Looted weapons durability modifier
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Durability")
|
||||
float LootedWeaponsDurabilityModifier;
|
||||
|
||||
/**
|
||||
* Ammo data reference
|
||||
*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Ammo")
|
||||
FFortAmmoData AmmoData;
|
||||
};
|
||||
|
||||
/**
|
||||
* UFortWeaponRangedItemDefinition - Ranged weapon item definition
|
||||
*/
|
||||
UCLASS()
|
||||
class FORTNITEGAME_API UFortWeaponRangedItemDefinition : public UFortWeaponItemDefinition
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFortWeaponRangedItemDefinition();
|
||||
|
||||
/** Projectile class for projectile weapons */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
TSubclassOf<AActor> ProjectileClass;
|
||||
|
||||
/** Use projectile instead of hitscan */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
bool bUseProjectile;
|
||||
|
||||
/** Projectile speed */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
float ProjectileSpeed;
|
||||
};
|
||||
|
||||
/**
|
||||
* UFortWeaponMeleeItemDefinition - Melee weapon item definition
|
||||
*/
|
||||
UCLASS()
|
||||
class FORTNITEGAME_API UFortWeaponMeleeItemDefinition : public UFortWeaponItemDefinition
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFortWeaponMeleeItemDefinition();
|
||||
|
||||
/** Swing radius */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
float SwingRadius;
|
||||
|
||||
/** Swing angle */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
float SwingAngle;
|
||||
|
||||
/** Can hit multiple targets */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
bool bCanHitMultiple;
|
||||
|
||||
/** Maximum number of targets */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fort|Weapon")
|
||||
int32 MaxTargets;
|
||||
};
|
||||
Reference in New Issue
Block a user