Space Plunder
Loading...
Searching...
No Matches
WeaponStructs.h
Go to the documentation of this file.
1#pragma once
2#include "CoreMinimal.h"
3#include "RecoilData.h"
4#include "Engine/DataTable.h"
5#include "WeaponStructs.generated.h"
6
7
8class USoundCue;
9DECLARE_LOG_CATEGORY_EXTERN(LogWeaponSystem, Display, All);
10
11
13{
14 inline int32 DebugWeapons = 0;
15 inline int32 DebugUnlimitedAmmo = 0;
16 inline int32 DebugCheatWeapons = 0;
17}
18
19
20
25UENUM(BlueprintType)
26enum class EWeaponOverlay : uint8
27{
28 Default,
31 Rifle,
32 Shotgun,
34 Sniper,
35 Sword,
36 Knife,
39 Bow
40};
41
59UENUM(Blueprintable, BlueprintType)
60enum class EMeleeWeaponAttack : uint8
61{
62 Default,
63 Jab,
64 Heavy,
65 Combo,
66 Stealth,
67 Sweep,
68 Counter,
69 Stun,
70 Running,
71};
72
81UENUM(Blueprintable, BlueprintType)
82enum class EWeaponType : uint8
83{
84 Default,
85 HitScan,
87 Melee,
89};
90
97UENUM(Blueprintable, BlueprintType)
98enum class EWeaponFireMode : uint8
99{
100 Single,
101 Burst,
102 FullAuto,
103 Charge,
104};
105
116USTRUCT(BlueprintType)
118{
119 GENERATED_BODY()
120
121 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
122 bool bIsReloading = false;
123 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
124 bool bFiringWeapon = false;
125 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
126 bool bIsHolstered = false;
127 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
128 bool bIsAiming = false;
129 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
130 bool bHasGun = false;
131 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
132 bool bIsWeaponInAutoMode = false;
133 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
134 bool bIsWeaponInBurstMode = false;
135 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
136 bool bIsWeaponInSingleMode = false;
137 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
138 bool bIsWeaponInChargeMode = false;
139
140 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
141 bool bIsCrouching = false;
142};
143
148UENUM(BlueprintType)
149enum class EAttachmentType : uint8
150{
151 Optical,
153 Barrel,
154 Laser,
155 Light,
156 Grip,
157 Stock,
158 Magazines,
159 Trigger,
160 Bipod,
161 Knife,
162
163};
164
165// UENUM(BlueprintType)
166// enum class EWeaponCrosshair : uint8
167// {
168// Pistol,
169// Shotgun,
170// Launcher,
171// Sniper,
172// Rifle
173//
174// };
175
180USTRUCT(BlueprintType)
182{
183 GENERATED_BODY()
184
185 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle")
186 float RadiusMultiplier = 2.0f;
187 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle")
188 float RadiusLowerBounds = 40.0f;
189 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle")
190 float RadiusUpperBounds = 80.0f;
191
192 float GetCrosshairSize(const float Radius) const
193 {
194 const float LargerRadius = Radius * RadiusMultiplier;
195 if(LargerRadius > RadiusUpperBounds)
196 {
197 return RadiusUpperBounds;
198 }
199 if(LargerRadius > RadiusLowerBounds)
200 {
201 return LargerRadius;
202 }
203 return RadiusLowerBounds;
204 }
206 {
207
208 }
209 FReticleSizeData(const float Multiplier, const float LowerBounds, const float UpperBounds)
210 {
211 RadiusMultiplier = Multiplier;
212 RadiusLowerBounds = LowerBounds;
213 RadiusUpperBounds = UpperBounds;
214 }
215
216};
217
218//- Stores Crosshair and Reticle Data //
223USTRUCT(BlueprintType)
225{
226 GENERATED_BODY()
227
228 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle")
229 bool bHasMaxCrosshairRadius = false;
230 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle", meta=(EditCondition=bHasMaxCrosshairRadius))
231 float MaxCrosshairRadius = 96.0f;
232
233
234 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle")
235 FReticleSizeData ReticleSize;
236
237 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle")
238 bool bUseSeparateHorizontal = false;
239 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle", meta=(EditCondition=bUseSeparateHorizontal))
240 FReticleSizeData ReticleHorizontalSize;
241
242 //- Materials //
243 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle")
244 UMaterialInterface* ReticleMaterial = nullptr;
245 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Reticle")
246 bool bUseSeparateHorizontalImage = false;
247
248 //+ Crosshairs //
249 //Data from SCrosshairWidget //
250 //Radius Segments etc.
251
252
253};
254
255
256
257
258USTRUCT(BlueprintType)
259struct FMeleeWeaponAnim : public FTableRowBase
260{
261 GENERATED_BODY()
262
263 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Melee")
264 TArray<UAnimMontage*> Animations;
265 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Melee")
267};
268
269
270
271USTRUCT(BlueprintType)
272struct FWeaponProjectileStats_T : public FTableRowBase
273{
274 GENERATED_BODY()
275
276 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
277 FString ProjectileID = "DefaultWeapon";
278
279 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Size")
280 float CapsuleHalfHeight = 8.0f;
281 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Size")
282 float CapsuleRadius = 8.0f;
283
284
285 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
286 class UNiagaraSystem* ImpactEffects = nullptr;
287 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
288 class UNiagaraSystem* TrailEffects = nullptr;
289 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
290 class USoundBase* ImpactSound = nullptr;
291 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
292 class USoundBase* ProjectileSound = nullptr;
293
294
295 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
296 bool bDealsDamage = true;
297 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
298 TSubclassOf<UDamageType> DamageType = UDamageType::StaticClass();
300 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage", meta=(EditCondition="bDealsDamage"))
301 float DamageInnerRadius = 150.0f;
303 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage", meta=(EditCondition="bDealsDamage"))
304 float DamageOuterRadius = 450.0f;
306 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage", meta=(EditCondition="bDealsDamage"))
307 float DamageFalloff = 0.0f;
308
309 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Force")
310 bool bDealsImpulse = true;
311 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Force", meta=(EditCondition="bDealsImpulse"))
312 float RadialForceStrength = 500.0f;
313 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Force", meta=(EditCondition="bDealsImpulse"))
314 bool bImpulseFalloffLinear = true;
315 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Force", meta=(EditCondition="bDealsImpulse"))
316 float ImpulseMultiplier = 1.0f;
317 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Force", meta=(EditCondition="bDealsImpulse"))
318 float ImpulseMax = 1000.0f;
319 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Force", meta=(EditCondition="bDealsImpulse"))
320 float CharacterExplosionClampMax = 3500.0f;
321 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Force", meta=(EditCondition="bDealsImpulse"))
322 float CharacterExplosionClampMaxOutput = 1.0f;
323 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Radial Force", meta=(EditCondition="bDealsImpulse"))
324 float CharacterExplosionClampMinOutput = 0.5f;
325
326 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Homing")
327 bool bHasHoming = false;
328 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Homing", meta=(EditCondition="bHasHoming"))
329 float InitialLockOnDelay = 3.0f;
330 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Homing", meta=(EditCondition="bHasHoming"))
331 float LockOnTime = 3.0f;
332
333 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
334 bool bIgnoreOwner = true;
335 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Damage")
336 bool bHideMeshOnHit = true;
337
338
339 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Delay")
340 bool bDelayedTrigger = false;
341 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Delay", meta= (EditCondition=bDelayedTrigger))
342 float TriggerDelay = 2.0f;
343 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Delay", meta= (ExposeOnSpawn=bDelayedTrigger))
344 // float ExplosionDelay = 2.0f;
345
346 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Speed")
347 float InitialSpeed = 2.0f;
348 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Speed")
349 bool bRotationFollowsVelocity = true;
350 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Bounce")
351 bool bShouldBounce = false;
352 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Bounce")
353 float Bounciness = 0.2f;
354 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Bounce")
355 float Friction = 0.6f;
356 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Speed")
357 float GravityScale = 1.0f;
358 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Speed")
359 FVector Velocity = FVector(0.0f, 0.0f, 0.0f);
360
361
362 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Speed")
363 bool bSticky = false;
364
365 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Lifetime")
366 bool bDestroyAfterHit = true;
367 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Lifetime")
368 float DestroyDelay = 2.0f;
369
370 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Visual")
371 class UStaticMesh* StaticMesh = nullptr;
372 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Visual")
373 FRotator RotationOffset = FRotator::ZeroRotator;
374
375
377 {
378 FWeaponProjectileStats_T EmptyWeaponProjectile;
379 return EmptyWeaponProjectile;
380 }
381};
382
383
384USTRUCT(BlueprintType)
385struct FWeaponEffects_T : public FTableRowBase
386{
387 GENERATED_BODY()
388
389 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Feedback")
390 UForceFeedbackEffect* SingleFireControllerFeedback = nullptr;
391 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Feedback")
392 UForceFeedbackEffect* AutoFireControllerFeedback = nullptr;
393 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Feedback")
394 UForceFeedbackEffect* BurstFireControllerFeedback = nullptr;
395 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Feedback")
396 UForceFeedbackEffect* ChargeFireControllerFeedback = nullptr;
397
398 UPROPERTY(EditAnywhere,BlueprintReadWrite, Category="VFX")
399 class UNiagaraSystem* MuzzleFlashParticleSystem = nullptr;
400 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="VFX")
401 class UNiagaraSystem* TracerParticleSystem = nullptr;
402
403 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Sounds")
404 class USoundBase* WeaponSound = nullptr;
405 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Sounds")
406 class USoundBase* WeaponSilencedSound = nullptr;
407 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Sounds")
408 class USoundBase* WeaponDryFireSound = nullptr;
409 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Sounds")
410 float WeaponSoundVolume = 1.0f;
411
412 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Camera Shake")
413 TSubclassOf<UCameraShakeBase> CameraShake = nullptr;
414 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Camera Shake")
415 float CameraShakeBaseScale = 1.0f;
417 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon|Effects|Camera Shake")
418 float CameraShakeMaxAccuracyMultiplier = 0.5f;
420 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon|Effects|Camera Shake")
421 float CameraShakeMinAccuracyMultiplier = 2.0f;
422
423
424 static FWeaponEffects_T Empty()
425 {
426 FWeaponEffects_T EmptyWeaponEffects;
427 return EmptyWeaponEffects;
428 }
429};
430
431USTRUCT(BlueprintType)
433{
434 GENERATED_BODY()
435
436 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
437 bool bSilencer = false;
438 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
439 bool bDamageTypeModifier = false;
440 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
441 TSubclassOf<class UDamageType> DamageType = UDamageType::StaticClass();
442 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto")
443 bool bAddAutoMode = false;
444 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto")
445 bool bAddBurstMode = false;
446
447 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
448 bool bModifyAmmo = false;
449 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo", meta=(EditCondition=bModifyAmmo))
450 int32 MaxAmmo = 0;
451 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo", meta=(EditCondition=bModifyAmmo))
452 int32 ClipSize = 0;
453 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Recoil")
454 // float RecoilAnimRate = 650.0f;
455 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Recoil")
456 // int32 RecoilBursts = 0;
457 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread")
458 bool bModifySpread = false;
459 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread", meta=(EditCondition=bModifySpread))
460 float BulletSpread = 0.0f;
461 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread", meta=(EditCondition=bModifySpread))
462 float GunRange = 0.0f;
463 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread", meta=(EditCondition=bModifySpread))
464 float WeaponRangeMin = 0.0f;
465 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread", meta=(EditCondition=bModifySpread))
466 float WeaponRangeMax = 0.0f;
467 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread", meta=(EditCondition=bModifySpread))
468 float Recoil = 1.0f;
469
470 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
471 bool bModifyDamage = false;
472
473 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage", meta=(EditCondition=bModifyDamage))
474 float DefaultDamage = 20.0f;
475 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage", meta=(EditCondition=bModifyDamage))
476 float MaxDamageMultiplier = 5.0f;
477 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage", meta=(EditCondition=bModifyDamage))
478 float MinDamageMultiplier = 0.5f;
479
480
481 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto")
482 // int32 BurstRounds = 3;
483 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FireRate")
484 bool bModifyFireRate = false;
485 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FireRate", meta=(EditCondition=bModifyFireRate))
486 float BurstCooldown = 0.2f;
487 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FireRate", meta=(EditCondition=bModifyFireRate))
488 float FireRate = 100.0f;
489 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FireRate", meta=(EditCondition=bModifyFireRate))
490 float ReloadTime = 1.0f;
491
492 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto")
493 // bool bMultiFire = false;
494 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto", meta=(EditCondition=bMultiFire))
495 // int32 MultiFireRounds = 3;
496};
497
498
499USTRUCT(BlueprintType)
500struct FWeaponAttachment : public FTableRowBase
501{
502 GENERATED_BODY()
503
504 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachment")
505 FString WeaponAttachmentID = "DefaultAttachment";
506 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachment")
507 class UStaticMesh* StaticMesh = nullptr;
508 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachment")
510 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachment")
511 bool bActive = true;
512
513 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats")
514 FWeaponModifiers WeaponStatModifiers;
515
516 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offsets")
517 FVector AttachmentOffset = FVector::ZeroVector;
518 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offsets")
519 FRotator AttachmentRotationOffset= FRotator::ZeroRotator;
520
521 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offsets")
522 bool bModifyMuzzleLocation = false;
523 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offsets", meta=(EditCondition=bModifyMuzzleLocation))
524 FVector MuzzleOffset = FVector::ZeroVector;
525
526
527 bool operator==(const FWeaponAttachment& Other) const
528 {
529 return WeaponAttachmentID == Other.WeaponAttachmentID;
530 }
531 bool IsValid() const
532 {
533 if(StaticMesh == nullptr){return false;}
534 if(WeaponAttachmentID == "DefaultAttachment"){return false;}
535 return true;
536 }
537
539 {
540 FWeaponAttachment Attachment;
541 return Attachment;
542 }
543
544 FName AttachmentTypeName() const
545 {
546 switch (AttachmentType)
547 {
549 return FName("Barrel");
551 return FName("Bipod");
553 return FName("Grip");
555 return FName("Light");
557 return FName("Laser");
559 return FName("Magazines");
561 return FName("Optical");
563 return FName("Stock");
565 return FName("Suppressor");
567 return FName("Trigger");
569 return FName("Knife");
570 default:
571 return FName("Default");
572 }
573 }
574};
575
576USTRUCT(BlueprintType)
578{
579 GENERATED_BODY()
580
581 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachment")
582 TArray<EAttachmentType> AvailableAttachmentTypes;
583 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachment")
584 TArray<FString> IDBlackList;
585};
586
591USTRUCT(BlueprintType)
593{
594 GENERATED_BODY()
595
596 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spawn")
597 FTransform CapsuleTransform = FTransform(FVector(0));
598 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spawn")
599 float CapsuleHalfHeight = 44.0f;
600 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spawn")
601 float CapsuleRadius = 22.0f;
602
603 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spawn")
604 FTransform InteractionSphereTransform = FTransform(FVector(0));
606 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spawn")
607 float InteractionSphereRadius = 64.0f;
608
610 {
611
612 }
613};
614
615
620USTRUCT(BlueprintType)
621struct FWeaponStats_T : public FTableRowBase
622{
623 //- Static data that shouldn't change //
624 GENERATED_BODY()
625
626 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
627 FString WeaponID = "DefaultWeapon";
628 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
629 FString WeaponDisplayName = "Default Weapon";
630 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
632 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
634 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
635 bool bNonLethal = false;
636 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
637 bool bSilenced = false;
638 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
639 bool bMeleeWeapon = false;
640 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Melee", meta=(EditCondition="bMeleeWeapon"))
641 FName MeleeNotifyName = "Default";
642
643 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
644 FName FlashLightSocketName = "LightSource";
645 //@TODO Have multiple? have CurrentFOv in WeaponData?
646 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Details")
647 float FOV = 90.0f;
648 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachments")
649 int32 MaxAttachmentsAvailable = 1;
650 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachments")
651 FWeaponAttachmentsCompatibility AttachmentsCompatibility;
652
653 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
654 int32 MaxAmmo = 128;
655 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
656 int32 ClipSize = 32;
657
658 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Recoil")
659 FRecoilAnimData RecoilAnimData;
660 //- FireRate RPM //
661 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Recoil")
662 float RecoilAnimRate = 650.0f;
663 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Recoil")
664 int32 RecoilBursts = 0;
665
666 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil")
667 float Recoil = 1.0f;
668 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Recoil")
669 UCurveVector* RecoilCurve = nullptr;
670
671 //- Note, Changing Spread depends on range as well
672 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread")
673 float BulletSpread = 2000.0f;
674 //- Note, Changing Spread depends on range as well
675 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread")
676 float GunRange = 200000.0f;
677 //- Damage At Full //
678 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread")
679 float WeaponRangeMin = 500.0f;
680 //- Damage After this = 0 or very small //
681 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread")
682 float WeaponRangeMax = 3500.0f;
683 //- Multiplier when closer than Min Distance //
684 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread")
685 float MaxDamageMultiplier = 5.0f;
686 //- Multiplier at Full distance //
687 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Spread")
688 float MinDamageMultiplier = 0.5f;
689
690
691 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Reload")
692 float ReloadTime = 1.0f;
693
694 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
695 float DefaultDamage = 20.0f;
696 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
697 TSubclassOf<class UDamageType> DamageType = UDamageType::StaticClass();
698
699 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto")
700 bool bHasAutoMode = false;
701
702 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto")
703 bool bHasBurstMode = false;
704 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto", meta=(EditCondition=bHasBurstMode))
705 int32 BurstRounds = 3;
706 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto", meta=(EditCondition=bHasBurstMode))
707 float BurstCooldown = 0.2f;
708 //- 1 = Very Fast, 250 Slow i.e. Sniper FireRate RPM //
709 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto", meta = (ClampMin = "4", ClampMax = "10000", UIMin = "4", UIMax = "10000"))
710 float FireRate = 100.0f;
711 //- Does this Weapon Shoot multiple Bullets, per round, ie. Shotgun //
712 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto")
713 bool bMultiFire = false;
714 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto", meta=(EditCondition=bMultiFire))
715 int32 MultiFireRounds = 3;
716
717 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offset")
718 FVector WeaponOffset = FVector::ZeroVector;
719 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offset")
720 FRotator RotationOffset= FRotator::ZeroRotator;
721 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offset")
722 bool bIsLeftHand = false;
723 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offset")
724 FVector MuzzleOffset = FVector::ZeroVector;
725 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offset")
726 FRotator MuzzleRotation = FRotator::ZeroRotator;
727 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offset")
728 FVector MuzzleFlashOffset = FVector::ZeroVector;
729 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offset")
730 FVector RecoilOffset = FVector::ZeroVector;
731 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offset")
732 FRotator RecoilRotation = FRotator::ZeroRotator;
733
734
735 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Visual")
736 class UTexture2D* WeaponThumbnail = nullptr;
737 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Visual")
738 FCrosshairData Crosshair;
739 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Visual")
740 class USkeletalMesh* MeshForPickup = nullptr;
741 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Visual")
743
744 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projecile", meta=(EditCondition="WeaponType==EWeaponType::Projectile"))
745 FWeaponProjectileStats_T WeaponProjectileStats = FWeaponProjectileStats_T::Empty();
746 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Projecile")
747 FRotator ProjectileRotationOffset = FRotator::ZeroRotator;
748
749 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Effects")
750 FString WeaponEffectsID = "DefaultEffects";
751
752 bool operator==(const FWeaponStats_T& Other) const
753 {
754 return WeaponID == Other.WeaponID;
755 }
756 bool operator!=(const FWeaponStats_T& Other) const
757 {
758 return WeaponID != Other.WeaponID;
759 }
760
762 {
763
764 }
765
767 {
768 FWeaponStats_T EmptyWeaponStats;
769 return EmptyWeaponStats;
770 }
771
772 bool GetIsAttachmentCompatible(const FString& AttachmentID, const EAttachmentType AttachmentType) const
773 {
774 //- Check Blacklist //
775 for(const auto& ID : AttachmentsCompatibility.IDBlackList)
776 {
777 if(ID == AttachmentID)
778 {
779 return false;
780 }
781 }
782 //- Check available types //
783 for(const auto& AvailableType : AttachmentsCompatibility.AvailableAttachmentTypes)
784 {
785 if(AttachmentType == AvailableType)
786 {
787 return true;
788 }
789 }
790 return false;
791 }
792
793 FWeaponStats_T AddModifiers(const TArray<FWeaponModifiers>& Modifiers)
794 {
795 for(const auto Modifier: Modifiers)
796 {
797 if(Modifier.bSilencer)
798 {
799 bSilenced = true;
800 }
801 if(Modifier.bDamageTypeModifier)
802 {
803 DamageType = Modifier.DamageType;
804 }
805 if(Modifier.bAddAutoMode)
806 {
807 bHasAutoMode = true;
808 }
809 if(Modifier.bAddBurstMode)
810 {
811 bHasBurstMode = true;
812 }
813 if(Modifier.bModifyAmmo)
814 {
815 MaxAmmo += Modifier.MaxAmmo;
816 ClipSize += Modifier.ClipSize;
817 }
818 if(Modifier.bModifySpread)
819 {
820 BulletSpread += Modifier.BulletSpread;
821 GunRange += Modifier.GunRange;
822 WeaponRangeMin += Modifier.WeaponRangeMin;
823 WeaponRangeMax += Modifier.WeaponRangeMax;
824 Recoil += Modifier.Recoil;
825 }
826 if(Modifier.bModifyFireRate)
827 {
828 ReloadTime += Modifier.ReloadTime;
829 BurstCooldown += Modifier.BurstCooldown;
830 FireRate += Modifier.FireRate;
831 }
832 if(Modifier.bModifyDamage)
833 {
834 DefaultDamage += Modifier.DefaultDamage;
835 MaxDamageMultiplier += Modifier.MaxDamageMultiplier;
836 MinDamageMultiplier += Modifier.MinDamageMultiplier;
837 }
838 }
839 return *this;
840 }
841
842 bool IsValid() const
843 {
844 if(MeshForPickup == nullptr){return false;}
845 if(WeaponID == "DefaultWeapon"){return false;}
846 return true;
847 }
848};
849
850
851
858//- STATS THAT CHANGE EG. AMMO, //
859USTRUCT(BlueprintType)
860struct FWeaponData_T : public FTableRowBase
861{
862 GENERATED_BODY()
863
864
865 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon")
866 FString WeaponID = "DefaultWeapon";
867
869 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Auto")
872 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Auto")
873 float TriggerSpamTimeRemaining = 0.0f;
874
875 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Reload")
876 bool bShouldAutoReload = false;
877
879 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
880 int32 CurrentAmmo = 0;
882 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Ammo")
883 int32 TotalAmmoCount = 0;
884
886 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attachments")
887 TArray<FString> CurrentWeaponAttachments;
888
889
890 //- Implementing the '==' operator for the struct
891 bool operator==(const FWeaponData_T& Other) const
892 {
893 return WeaponID == Other.WeaponID;
894 }
896 bool IsValid() const
897 {
898 // if(MeshForPickup == nullptr){return false;}
899 if(WeaponID == "DefaultWeapon"){return false;}
900 return true;
901 }
904 {
905 FWeaponData_T EmptyWeaponData;
906 return EmptyWeaponData;
907 }
908 // bool GetDoesHaveAttachmentType(FWeaponAttachment WeaponAttachment) const
909 // {
910 //
911 // CurrentWeaponAttachments
912 // }
913
914 //- Gets Ammo in Weapon and Reserves //
915 // int32 GetTotalAmmo() const
916 // {
917 // return CurrentAmmo + TotalAmmoCount;
918 // }
920 void AddAttachment(const FString& AttachmentID)
921 {
922 if(!CurrentWeaponAttachments.Contains(AttachmentID))
923 {
924 CurrentWeaponAttachments.Add(AttachmentID);
925 }
926 }
927
928
930 int32 AddAmmo(const int32 AmountToAdd, const int32 MaxAmmo)
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 }
969
971 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offsets")
972 FVector WeaponOffset = FVector::ZeroVector;
973 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Offsets")
974 FRotator RotationOffset = FRotator::ZeroRotator;
975};
976
EWeaponType
Represents the types of weapons available in the game.
Definition WeaponStructs.h:83
EWeaponOverlay
Specifies the different weapon overlay types.
Definition WeaponStructs.h:27
EWeaponFireMode
Enum class representing the different fire modes for a weapon.
Definition WeaponStructs.h:99
EAttachmentType
Enum class representing different types of weapon attachments.
Definition WeaponStructs.h:150
EMeleeWeaponAttack
Enumeration representing different types of melee weapon attacks.
Definition WeaponStructs.h:61
DECLARE_LOG_CATEGORY_EXTERN(LogWeaponSystem, Display, All)
Definition WeaponStructs.h:13
int32 DebugWeapons
Definition WeaponStructs.h:14
int32 DebugCheatWeapons
Definition WeaponStructs.h:16
int32 DebugUnlimitedAmmo
Definition WeaponStructs.h:15
Struct representing the data for a crosshair.
Definition WeaponStructs.h:225
Definition WeaponStructs.h:260
A struct that represents the state of a player's weapon.
Definition WeaponStructs.h:118
Definition RecoilData.h:33
A struct that represents the outer Image size data for a reticle.
Definition WeaponStructs.h:182
FReticleSizeData(const float Multiplier, const float LowerBounds, const float UpperBounds)
Definition WeaponStructs.h:209
FReticleSizeData()
Definition WeaponStructs.h:205
Definition WeaponStructs.h:501
bool IsValid() const
Definition WeaponStructs.h:531
static FWeaponAttachment Empty()
Definition WeaponStructs.h:538
FName AttachmentTypeName() const
Definition WeaponStructs.h:544
Definition WeaponStructs.h:578
Struct representing data of a weapon that changes.
Definition WeaponStructs.h:861
FString WeaponID
Definition WeaponStructs.h:866
void AddAttachment(const FString &AttachmentID)
Definition WeaponStructs.h:920
bool IsValid() const
Definition WeaponStructs.h:896
int32 AddAmmo(const int32 AmountToAdd, const int32 MaxAmmo)
Definition WeaponStructs.h:930
static FWeaponData_T Empty()
Definition WeaponStructs.h:903
Definition WeaponStructs.h:386
Definition WeaponStructs.h:433
Definition WeaponStructs.h:273
Transform, and Capsule Size when dropping a weapon, or spawning one.
Definition WeaponStructs.h:593
Represents statistics for a weapon.
Definition WeaponStructs.h:622
FWeaponStats_T AddModifiers(const TArray< FWeaponModifiers > &Modifiers)
Definition WeaponStructs.h:793
bool operator!=(const FWeaponStats_T &Other) const
Definition WeaponStructs.h:756
bool IsValid() const
Definition WeaponStructs.h:842
bool GetIsAttachmentCompatible(const FString &AttachmentID, const EAttachmentType AttachmentType) const
Definition WeaponStructs.h:772
TSubclassOf< class UDamageType > DamageType
Definition WeaponStructs.h:697
FWeaponStats_T()
Definition WeaponStructs.h:761
static FWeaponStats_T Empty()
Definition WeaponStructs.h:766