Space Plunder
Loading...
Searching...
No Matches
FWeaponData_T Struct Reference

Struct representing data of a weapon that changes. More...

#include <WeaponStructs.h>

Inheritance diagram for FWeaponData_T:

Public Member Functions

bool operator== (const FWeaponData_T &Other) const
 
bool IsValid () const
 
void AddAttachment (const FString &AttachmentID)
 
int32 AddAmmo (const int32 AmountToAdd, const int32 MaxAmmo)
 

Static Public Member Functions

static FWeaponData_T Empty ()
 

Public Attributes

FString WeaponID = "DefaultWeapon"
 
EWeaponFireMode FireMode = EWeaponFireMode::Single
 
float TriggerSpamTimeRemaining = 0.0f
 
bool bShouldAutoReload = false
 
int32 CurrentAmmo = 0
 
int32 TotalAmmoCount = 0
 
TArray< FString > CurrentWeaponAttachments
 
FVector WeaponOffset = FVector::ZeroVector
 
FRotator RotationOffset = FRotator::ZeroRotator
 

Detailed Description

Struct representing data of a weapon that changes.

Current Ammo, Fire Mode, Attachments, and TriggerSpamTime

Member Function Documentation

◆ AddAmmo()

int32 FWeaponData_T::AddAmmo ( const int32 AmountToAdd,
const int32 MaxAmmo )
inline

Returns Remaining Ammo

931 {
932 //- Weapon Ammo full //
933 if(TotalAmmoCount >= MaxAmmo)
934 {
935 return AmountToAdd;
936 }
937 //- Total ammo + the pickup ammo is less than the max ammo, simply add them together
938 if((TotalAmmoCount + AmountToAdd) <= MaxAmmo)
939 {
940 TotalAmmoCount += AmountToAdd;
941 return 0;
942 }
943 //- the amount to pickup will end up more than the Max ammo
944 if((TotalAmmoCount + AmountToAdd) > MaxAmmo)
945 {
946 TotalAmmoCount = MaxAmmo;
947 const int32 Remainder = (TotalAmmoCount + AmountToAdd) - MaxAmmo;
948 return Remainder;
949 }
950 // Should only cover if the ammo is Already Max
951 return AmountToAdd;
952
953 // //If the total ammo is less than the max ammo && the total ammo + the pickup ammo is less than the max ammo, simply add them together
954 // if(TotalAmmoCount < MaxAmmo && (TotalAmmoCount + AmountToAdd) <= MaxAmmo)
955 // {
956 // TotalAmmoCount = TotalAmmoCount + AmountToAdd;
957 // return 0;
958 // }
959 // If the total ammo is less than max, && the amount to pickup will end up more than the Max ammo
960 // if(TotalAmmoCount < MaxAmmo && (TotalAmmoCount + AmountToAdd) > MaxAmmo)
961 // {
962 // TotalAmmoCount = MaxAmmo;
963 // const int32 Remainder = (TotalAmmoCount + AmountToAdd) - MaxAmmo;
964 // return Remainder;
965 // }
966 // // Should only cover if the ammo is Already Max
967 // return AmountToAdd;
968 }
int32 TotalAmmoCount
Definition WeaponStructs.h:883

◆ AddAttachment()

void FWeaponData_T::AddAttachment ( const FString & AttachmentID)
inline

Adds the Attachment ID to the list of IDs

921 {
922 if(!CurrentWeaponAttachments.Contains(AttachmentID))
923 {
924 CurrentWeaponAttachments.Add(AttachmentID);
925 }
926 }
TArray< FString > CurrentWeaponAttachments
Definition WeaponStructs.h:887

◆ Empty()

static FWeaponData_T FWeaponData_T::Empty ( )
inlinestatic

Returns an Empty Invalid Struct, for resetting weapons

904 {
905 FWeaponData_T EmptyWeaponData;
906 return EmptyWeaponData;
907 }
Struct representing data of a weapon that changes.
Definition WeaponStructs.h:861

◆ IsValid()

bool FWeaponData_T::IsValid ( ) const
inline

Checks if Mesh is Valid and if the ID has been set

897 {
898 // if(MeshForPickup == nullptr){return false;}
899 if(WeaponID == "DefaultWeapon"){return false;}
900 return true;
901 }
FString WeaponID
Definition WeaponStructs.h:866

◆ operator==()

bool FWeaponData_T::operator== ( const FWeaponData_T & Other) const
inline
892 {
893 return WeaponID == Other.WeaponID;
894 }

Member Data Documentation

◆ bShouldAutoReload

bool FWeaponData_T::bShouldAutoReload = false

◆ CurrentAmmo

int32 FWeaponData_T::CurrentAmmo = 0

The Ammo Left in the Clip

◆ CurrentWeaponAttachments

TArray<FString> FWeaponData_T::CurrentWeaponAttachments

A list of IDs of the Attachments that are on the Weapon

◆ FireMode

EWeaponFireMode FWeaponData_T::FireMode = EWeaponFireMode::Single

Auto, Single, Burst or Changing

◆ RotationOffset

FRotator FWeaponData_T::RotationOffset = FRotator::ZeroRotator

◆ TotalAmmoCount

int32 FWeaponData_T::TotalAmmoCount = 0

The Total Backup Ammo

◆ TriggerSpamTimeRemaining

float FWeaponData_T::TriggerSpamTimeRemaining = 0.0f

Used as a timer to stop pressing faster than the fire rate, it is stored on Drop/Swap, to stop avoiding

◆ WeaponID

FString FWeaponData_T::WeaponID = "DefaultWeapon"

Weapon ID Used for Finding Info in DataTables

◆ WeaponOffset

FVector FWeaponData_T::WeaponOffset = FVector::ZeroVector

For Pickup PAD, how High up of the ground it should be etc.


The documentation for this struct was generated from the following file: