LEAP Documentation 40220
Documentation for the LEAP project
WeaponInstance.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "PlayerStructs.h"
7#include "CosmeticAssetBase.h"
8#include "Engine/DataTable.h"
9#include "Components/ActorComponent.h"
10#include "Components/MaterialBillboardComponent.h"
11#include "ReactsToMatchEvents.h"
12#include "GameFramework/CharacterMovementComponent.h"
13#include "ObjectInfoInterface.h"
14#include "WeaponInstance.generated.h"
15
16class UAnimInstance;
17class UAnimMontage;
18class UTexture2D;
19class USkeletalMesh;
21class UWeaponComponent;
22class UGlobalAmmoComponent;
24class AProjectXHUD;
25class UReticleWidget;
26class UMaterial;
27class UStreamableRenderAsset;
28class UAudioComponent;
29class UParticleSystem;
30class UNiagaraComponent;
31class UCameraShakeBase;
32class USoundConcurrency;
33
34//How much time leniency we grant to players as the server.
35#define MAX_DELTA_TOLERANCE 0.04f
36#define DEFAULT_PHYSICS_MATERIAL "DefaultPhysicalMaterial"
37#define MAX_DIST_TOLERANCE 400.f
38
39USTRUCT(BlueprintType)
41{
42 GENERATED_USTRUCT_BODY()
43public:
44
45 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Perk)
46 TArray<UAnimMontage*> AnimationMontages;
47};
48
49UENUM(BlueprintType)
50enum class ECompressedFlags : uint8
51{
52 NONE = 0,
53 FLAG_JumpPressed = 0x01, // Jump pressed
54 FLAG_WantsToCrouch = 0x02, // Wants to crouch
55 FLAG_Reserved_1 = 0x04, // Reserved for future use
56 FLAG_Reserved_2 = 0x08, // Reserved for future use
57 // Remaining bit masks are available for custom flags.
58 Jetpack = 0x10,
59 Dash = 0x20, // Dash movement is limited on the +Z to prevent dashing upwards
60 Hookshot = 0x40,
61 OmniDash = 0x80, // This dash does not limit vertical movement
62};
63
64USTRUCT(Blueprintable)
66{
67 GENERATED_USTRUCT_BODY()
68
69 UPROPERTY(EditDefaultsOnly, Category = "Attachments")
70 FName Socket = NAME_None;
71 UPROPERTY(EditDefaultsOnly, Category = "Attachments")
72 TSoftObjectPtr<UStaticMesh> StaticMeshAttachment;
73 UPROPERTY(EditDefaultsOnly, Category = "Attachments")
74 TSoftObjectPtr<USkeletalMesh> SkeletalMeshAttachment;
75 UPROPERTY(EditDefaultsOnly, Category = "Attachments")
76 TSoftObjectPtr<UParticleSystem> ParticlesAttachment;
77};
78
79USTRUCT(Blueprintable)
80struct FImpactTableRow : public FTableRowBase
81{
82 GENERATED_USTRUCT_BODY()
83
84 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
85 class UPhysicalMaterial* Material = NULL;
86 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
87 TSoftObjectPtr<class UNiagaraSystem> NiagaraParticle = NULL;
88 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
89 TSoftObjectPtr<class UParticleSystem> Particle = NULL;
90 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
91 TSoftObjectPtr<class USoundBase> Sound = NULL;
92 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
93 TSoftObjectPtr<class UMaterial> DecalMaterial = NULL;
94 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
95 TSubclassOf<UCameraShakeBase> CameraShake = nullptr;
96 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
97 float CameraShakeInnerRadius = 0.0f;
98 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
99 float CameraShakeOuterRadius = 0.0f;
100 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
101 FVector DecalSize = FVector(1.25f, 4.f, 4.f);
102 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
103 float DecalLifetime = 10.f;
104 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
105 float DecalMaxDrawDistance = 10000.f;
106 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
107 float ParticleMaxDrawDistance = 25000.f;
108 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
109 bool bFrustumCullParticles = true;
110 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
111 bool bFrustumCullDecals = true;
112};
113
114//A loaded version of ImpactTableRow
115USTRUCT(Blueprintable)
117{
118 GENERATED_USTRUCT_BODY()
119
120 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
121 UNiagaraSystem* NiagaraParticle = NULL;
122 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
123 UParticleSystem* Particle = NULL;
124 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
125 USoundBase* Sound = NULL;
126 UPROPERTY(EditDefaultsOnly, Category = "Impact Effects")
127 class UMaterial* Decal = NULL;
128};
129
130UENUM(BlueprintType)
131enum class EWeaponState : uint8
132{
133 Ready, //Weapon is equipped and idle
134 Down, //Weapon is not equipped
135 Firing, //Weapon is firing
136 Reloading, //Weapon is reloading
137 Overheated, //Weapon has overheatead and is cooling down
138 Equipping, //Weapon is equipping
139 UnEquipping, //Weapon is unequipping
140 WaitingToUnequip, //Weapon is waiting for the unequip action to finish
141 Custom, //Undefined, usable by child classes.
142 None = 255
143};
144
145UENUM(BlueprintType, meta = (Bitflags))
146enum class EFireMode : uint8
147{
148 None = 0,
149 Primary = 0x00000001,
150 Secondary = 0x00000002,
151 Tertiary = 0x00000004
152};
153ENUM_CLASS_FLAGS(EFireMode)
154
155UENUM(BlueprintType)
156enum class EFireType : uint8
157{
159 Automatic,
160 Charged
161};
162
163UENUM(BlueprintType)
164enum class EReloadType : uint8
165{
166 Magazine,
168};
169enum class EWeaponError : uint8;
170
171UENUM(BlueprintType)
172enum class ECoolDownType : uint8
173{
174 Ammo = 0,
175 CoolDown = 1,
176};
177
178UENUM(BlueprintType)
179enum class ECoolDownTrigger : uint8
180{
181 Fire = 0,
182 Unequip = 1,
183 ActiveTime = 2,
184 Custom = 3,
185};
186
187UENUM(BlueprintType)
188enum class EDesignatorTeamView : uint8
189{
190 Everyone,
191 Allies,
192 Enemies,
193 User,
194};
195
196USTRUCT(Blueprintable)
198{
199 GENERATED_USTRUCT_BODY()
200
201 UPROPERTY(EditDefaultsOnly, Category = "Overheat")
203 UPROPERTY(EditDefaultsOnly, Category = "Overheat")
204 float FloatValue = 5.f;
205};
206
207DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FChargeEventSignature, float, TotalTime, float, TimeElapsed);
208DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FCoolDownSignature, float, TotalTime, float, TimeElapsed);
209DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FWeaponActiveEvent, bool, bActive);
210DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FWeaponDesignatorTargetSignature, bool, bValid);
211DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FWeaponAmmoChangedSignature, float, CurrentAmmo);
214DECLARE_DYNAMIC_MULTICAST_DELEGATE(FWeaponStopActionsSignature);
215DECLARE_DYNAMIC_MULTICAST_DELEGATE(FWeaponCompleteSignature);
217
218UCLASS(Blueprintable, HideCategories = (Collision, Tags, Activation, ComponentReplication, Cooking))
219class PROJECTX_API UWeaponInstance : public UActorComponent, public IReactsToMatchEvents, public IObjectInfoInterface
220{
221 GENERATED_UCLASS_BODY()
222
223public:
224 virtual void BeginPlay() override;
225 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
226 virtual void Activate(bool bReset = false) override;
227 virtual void Deactivate() override;
228 virtual void MatchEnded() override;
229 virtual bool Fire(uint8 Mode = 0, float WorldTimeOverride = -1.f);
230 virtual void CancelFire();
231 virtual void InitializeWeapon(bool bFromBatchInitialization = false);
232 virtual bool SetupChildWeapon(UWeaponInstance* ParentWeaponToSet);
233 virtual void OwnerDied();
234 virtual void StopAllActions();
235 virtual void StopInputConstrainedActions();
236 virtual void UpdateOwningCharacter(AProjectXCharacter* NewCharacter) { OwningCharacter = NewCharacter; }
237 virtual bool ImplementsFireMode(uint8 Mode);
238 virtual void FireReleased(uint8 Mode = 0);
239 virtual bool Reload(float WorldTimeOverride = -1.f);
240 virtual void CancelReload();
241 virtual bool Equip();
242 virtual bool UnEquip(bool bForce = false);
243 virtual void UnEquipComplete();
244 virtual bool QueueUnEquip();
245 virtual void CancelQueuedUnEquip();
246 virtual void ActiveTimeComplete();
247 virtual void UpdateMeshes1P();
248 virtual void UpdateMeshes3P();
249 virtual void ApplyWeaponSkins();
250 virtual void UpdateWeaponSkin(UMaterialInstance* Material, int MaterialIndex);
251 virtual void UpdateWeaponSkinParticleSystem(UParticleSystem* WeaponSkinParticleSystem);
252 virtual void SetWeaponState(EWeaponState NewState);
253 virtual void LoadImpactEffectTable(UDataTable* ImpactTable);
254 virtual void ToggleWeaponPerks(bool bPerksOn);
255
256 virtual void SetMaxMagazineAmmo(float NewMaxAmmo);
257
258 UFUNCTION(BlueprintCallable)
259 void SetFireAnimMontage(UAnimMontage* NewFireAnimation1P, UAnimMontage* NewFireAnimation3P) { FireAnimation1P = NewFireAnimation1P ? NewFireAnimation1P : FireAnimation1P; FireAnimation3P = NewFireAnimation3P ? NewFireAnimation3P : FireAnimation3P; }
260
261 /* Fetches the interpolation position 0-1 for ramp-up style fire weapons */
262 UFUNCTION(BlueprintPure, Category = Weapon)
263 FORCEINLINE float GetFireRatePercentage() const { return FireRateInterp; }
264 UFUNCTION(BlueprintPure, Category = Weapon)
265 FORCEINLINE bool IsReady() const { return WeaponState == EWeaponState::Ready; }
266 UFUNCTION(BlueprintPure, Category = Weapon)
267 FORCEINLINE bool IsEquipped() const { return WeaponState != EWeaponState::Down && WeaponState != EWeaponState::UnEquipping && WeaponState != EWeaponState::WaitingToUnequip && WeaponState != EWeaponState::None; }
268 UFUNCTION(BlueprintPure, Category = Weapon)
269 FORCEINLINE bool IsDown() const { return WeaponState == EWeaponState::Down; }
270 UFUNCTION(BlueprintPure, Category = Weapon)
271 FORCEINLINE bool IsFiring() const { return WeaponState == EWeaponState::Firing; }
272 UFUNCTION(BlueprintPure, Category = Weapon)
273 FORCEINLINE bool IsHoldingPrimary() const { return bHoldingFire; }
274 UFUNCTION(BlueprintPure, Category = Weapon)
275 FORCEINLINE bool IsReloading() const { return WeaponState == EWeaponState::Reloading; }
276 UFUNCTION(BlueprintPure, Category = Weapon)
277 FORCEINLINE bool IsEquipping() const { return WeaponState == EWeaponState::Equipping; }
278 UFUNCTION(BlueprintPure, Category = Weapon)
279 FORCEINLINE bool IsUnEquipping() const { return WeaponState == EWeaponState::UnEquipping; }
280 UFUNCTION(BlueprintPure, Category = Weapon)
281 FORCEINLINE bool IsWaitingToUnEquip() const { return WeaponState == EWeaponState::WaitingToUnequip; }
282 UFUNCTION(BlueprintPure, Category = Weapon)
283 FORCEINLINE bool IsOverheated() const { return WeaponState == EWeaponState::Overheated || bIsOverheating; }
284 UFUNCTION(BlueprintPure, Category = Weapon)
285 FORCEINLINE bool CanWeaponOverheat() const { return bCanWeaponOverheat; }
286 UFUNCTION(BlueprintPure, Category = Weapon)
287 FORCEINLINE bool CanTightAim() const { return !IsDown() && !IsReloading() && !IsEquipping() && !IsUnEquipping() && !IsOverheated(); }
288 UFUNCTION(BlueprintPure, Category = Weapon)
289 FORCEINLINE bool IsTightAiming() const { return bTightAiming; }
290 UFUNCTION(BlueprintPure, Category = Weapon)
291 FORCEINLINE bool HasSwayOnTightAim() const { return bHasSwayOnTightAim; }
292 UFUNCTION(BlueprintPure, Category = Weapon)
293 FORCEINLINE float GetSwayIntensityMultiplier() const { return SwayIntensityMultiplier; }
294 UFUNCTION(BlueprintPure, Category = Weapon)
295 FORCEINLINE float GetFireRate() const { return FMath::Clamp(FMath::Lerp(FireRate, FireRateMin, FireRateInterp), SMALL_NUMBER, BIG_NUMBER); } //Clamp non zero. Used in division
296 UFUNCTION(BlueprintPure, Category = Weapon)
297 FORCEINLINE float GetDisplayFireRate() const { return 60.0f/FireRate; }
298 UFUNCTION(BlueprintPure, Category = Weapon)
299 FORCEINLINE EFireType GetFireType() const {return WeaponFireType;}
300 UFUNCTION(BlueprintPure, Category = Weapon)
301 FORCEINLINE bool IsSemiAutomatic() const { return WeaponFireType == EFireType::SemiAutomatic; }
302 UFUNCTION(BlueprintPure, Category = Weapon)
303 FORCEINLINE bool IsAutomatic() const { return WeaponFireType == EFireType::Automatic; }
304 UFUNCTION(BlueprintPure, Category = Weapon)
305 FORCEINLINE bool IsCharged() const { return WeaponFireType == EFireType::Charged; }
306 UFUNCTION(BlueprintCallable, Category = Weapon)
307 FORCEINLINE bool IsInitialized() const { return bInitialized; }
308 UFUNCTION()
309 FORCEINLINE bool IsDebugging() const { return bDebug; }
310 FORCEINLINE bool IsChildWeapon() const { return bIsChildWeapon; }
311 //Is currently in a first person perspective of this weapon's owner.
312 UFUNCTION(BlueprintPure, Category = Weapon)
313 FORCEINLINE bool CanQuickSwitchTo() const { return bCanQuickSwitchTo; }
314 UFUNCTION(BlueprintPure, Category = Weapon)
315 FORCEINLINE bool ShouldUnEquipAfterFire() const { return bUnEquipAfterFire; }
316 UFUNCTION(BlueprintPure, Category = Weapon)
317 FORCEINLINE bool ShouldUnequipOnToggle() const { return bUnequipsOnToggle; }
318 UFUNCTION(BlueprintPure, Category = Weapon)
319 FORCEINLINE bool ShouldUnEquipOnEmpty() const { return bUnEquipOnEmpty; }
320 UFUNCTION(BlueprintPure, Category = Weapon)
321 FORCEINLINE bool CanBePreviousWeapon() const { return bCanBePreviousWeapon; }
322 UFUNCTION(BlueprintPure, Category = Weapon)
323 FORCEINLINE bool IsExclusiveWeapon() const { return bExclusiveWeapon && !IsBeingDestroyed(); }
324 UFUNCTION(BlueprintPure, Category = Weapon)
325 FORCEINLINE float GetDamageForce() const { return DamageForce; }
326 UFUNCTION(BlueprintPure, Category = Weapon)
327 FORCEINLINE bool CanHoldBreathWhileADSing() const { return bCanHoldBreathWhileADSing; }
328 UFUNCTION(BlueprintPure, Category = Weapon)
329 FORCEINLINE bool UsesAmmo() const { return bUsesAmmo; }
330 UFUNCTION(BlueprintPure, Category = Weapon)
331 FORCEINLINE bool UsesGlobalAmmo() const { return bGlobalAmmo; }
332 UFUNCTION(BlueprintPure, Category = Weapon)
333 bool HasInfiniteReserveAmmo() const;
334 UFUNCTION(BlueprintPure, Category = Weapon)
335 float GetMaxMagAmmo() const;
336 UFUNCTION(BlueprintPure, Category = Weapon)
337 FORCEINLINE float GetReserveAmmo() const { return HasInfiniteReserveAmmo() ? 0.f : TotalAmmo; }
338 UFUNCTION(BlueprintPure, Category = Weapon)
339 FORCEINLINE float GetMaxReserveAmmo() const { return HasInfiniteReserveAmmo() ? 0.f : MaxTotalAmmo; }
340 UFUNCTION(BlueprintPure, Category = Weapon)
341 FORCEINLINE FName GetKeyChainSocket() const { return KeyChainSocketName; }
342 UFUNCTION(BlueprintPure, Category = Weapon)
343 const FText& GetWeaponName() const { return WeaponName; }
344 UFUNCTION(BlueprintPure, Category = Weapon)
345 const FText& GetWeaponDescription() const{return WeaponDescription;}
346 UFUNCTION(BlueprintPure, Category = Weapon)
347 FORCEINLINE TAssetPtr<UTexture2D> GetWeaponIcon() const { return WeaponIcon; }
348 UFUNCTION(BlueprintPure, Category = Weapon)
349 FORCEINLINE TAssetPtr<UTexture2D> GetWeaponKillFeedIcon() const { return WeaponKillFeedIcon; }
350 UFUNCTION(BlueprintPure, Category = Weapon)
351 FORCEINLINE bool UsesCoolDown() const { return bUsesCoolDown; }
352 UFUNCTION(BlueprintPure, Category = Weapon)
353 FORCEINLINE float GetCoolDownDuration() const { return CoolDown; }
354 UFUNCTION(BlueprintPure, Category = Weapon)
355 FORCEINLINE float GetChargeValue() const { return ChargeValue; }
356 UFUNCTION(BlueprintPure, Category = "Weapon|Overheat")
357 FORCEINLINE float GetOverheatThreshold() const { return OverheatThreshold; }
358 UFUNCTION(BlueprintPure, Category = Weapon)
359 FORCEINLINE bool DoesWeaponSupportTightAiming() const {return bCanTightAim;}
360 UFUNCTION(BlueprintPure,Category = Display)
361 FORCEINLINE FName GetDisplaySocketName() const{return DisplaySocketName;}
362 UFUNCTION(BlueprintPure, Category = Display)
363 FORCEINLINE float GetDisplayCameraFocalDistance() const { return DisplayFocalDistance; }
364 FORCEINLINE bool IsAlmostReady() const { return WeaponState == EWeaponState::Ready || IsActionNearlyComplete(WeaponState); }
365 FORCEINLINE FName GetSocket1P() const { return SocketAttach1P; }
366 FORCEINLINE FName GetSocket3P() const { return SocketAttach3P; }
367 UFUNCTION(BlueprintPure, Category = Weapon)
368 FORCEINLINE EWeaponState GetWeaponState() const { return WeaponState; }
369 UFUNCTION(BlueprintPure, Category = Character)
370 const TArray<EPerkType>& GetPerkSlots() const { return PerkSlots; }
371 UFUNCTION(BlueprintPure, Category = Weapon)
372 FTransform GetDesignatorTransform();
373 UFUNCTION(BlueprintPure, Category = Weapon)
374 const FString& GetWeaponID() const { return WeaponID; }
375 UFUNCTION(BlueprintPure, Category = Weapon)
376 virtual float GetWeaponSpread() const;
377 UFUNCTION(BlueprintPure, Category = Weapon)
378 virtual float GetMagAmmo() const;
379 UFUNCTION(BlueprintPure,Category = Weapon)
380 virtual float GetDisplayDamage() const { return GetDamage(FHitResult()); }
381 UFUNCTION(BlueprintPure, Category = Weapon)
382 UWeaponComponent* GetOwningComponent() const;
383 UFUNCTION(BlueprintPure, Category = Weapon)
384 AProjectXCharacter* GetOwningCharacter() const;
385 UFUNCTION(BlueprintPure, Category = Weapon)
386 AController* GetOwningController() const;
387 UFUNCTION(BlueprintPure, Category = Weapon)
388 virtual AProjectXPlayerController* GetOwningPlayerController() const;
389 UFUNCTION(BlueprintPure, Category = Weapon)
390 UGlobalAmmoComponent* GetGlobalAmmoComponent() const;
391 UFUNCTION(BlueprintPure, Category = Weapon)
392 FVector GetKeyChainScale() const { return KeyChainScale; }
393 UFUNCTION(BlueprintPure, Category = Weapon)
394 bool IsCurrentViewTarget() const;
395 //Returns true if this weapon is owned by the current client
396 UFUNCTION(BlueprintPure, Category = Weapon)
397 virtual bool IsLocallyOwned() const;
398 //Returns true if this weapon is the authoritative copy
399 UFUNCTION(BlueprintPure, Category = Weapon)
400 virtual bool IsAuthority() const;
401 UFUNCTION(BlueprintPure)
402 AProjectXHUD* GetHUD() const;
403 UFUNCTION(BlueprintPure)
404 UReticleWidget* GetReticle() const;
405 UFUNCTION(BlueprintPure, Category = Weapon)
406 virtual float GetTightAimPercent() const;
407 UFUNCTION(BlueprintPure, Category = Weapon)
408 float GetTightAimSpreadModifier() const { return FMath::Lerp(TightAimSpreadModifier.X, TightAimSpreadModifier.Y, GetTightAimPercent()); }
409 UFUNCTION(BlueprintPure, Category = Weapon)
410 virtual float GetMovementSpreadModifier() const;
411 UFUNCTION(BlueprintPure, Category = Weapon)
412 TSubclassOf<class UUserWidget> GetTightAimWidget() const { return TightAimWidget; }
413 UFUNCTION(BlueprintPure, Category = Weapon)
414 virtual float GetGlobalRestockTime() const;
415 UFUNCTION(BlueprintPure, Category = Weapon)
416 virtual float GetGlobalRestockAmount() const;
417 UFUNCTION(BlueprintPure, Category = Weapon)
418 virtual bool IsProgressiveGlobalAmmoRestock() const;
419 UFUNCTION(BlueprintPure, Category = Weapon)
420 virtual bool IsHeadshot(const FHitResult& HitResult) const;
421 UFUNCTION(BlueprintPure, Category = Weapon)
422 virtual float GetDamage(const FHitResult& HitResult, float DamageModifer = 1.0f, const UWeaponComponent* WeaponComponent = NULL) const;
423 UFUNCTION(BlueprintPure, Category = Weapon)
424 virtual float GetDamageMultiplier(const FHitResult& HitResult, float DamageModifer = 1.0f, const UWeaponComponent* WeaponComponent = NULL) const;
425 UFUNCTION(BlueprintPure, Category = Weapon)
426 virtual TSubclassOf<UDamageType> GetDamageType() const;
427 UFUNCTION(BlueprintPure, Category = Weapon)
428 float GetDamageScalingMultiplier(float Value) const;
429 UFUNCTION(BlueprintPure, Category = Weapon)
430 bool IsCoolingDown() const;
431 UFUNCTION(BlueprintPure, Category = Weapon)
432 float CoolDownDurationRemaining() const;
433 UFUNCTION(BlueprintPure, Category = "Weapon|Overheat")
434 float GetCurrentHeat() const;
435 UFUNCTION(BlueprintPure, Category = "Weapon|Overheat")
436 float GetHeatAsPercentage() const;
437 UFUNCTION(BlueprintPure, Category = Weapon)
438 UParticleSystem* GetWeaponSkinParticle() const { return WeaponSkinParticle; }
439 UFUNCTION()
440 virtual bool IsTightAimFireMode(uint8 Mode) const;
441 //Returns true if this weapon is owned by the current client but is not the authority (used to determine if RPCs need to be sent)
442 UFUNCTION()
443 virtual bool IsLocallyOwnedRemote() const;
444 //Returns true if this weapon is only a simulated one (skip all validation, we're just a slave)
445 UFUNCTION()
446 virtual bool IsSimulatedOnly() const;
447 //Returns true if this weapon is the authoritative copy and not owned by the current client
448 UFUNCTION()
449 virtual bool IsNonOwningAuthority() const;
450 UFUNCTION(BlueprintCallable, Category = "Weapon")
451 virtual void AddAmmo(float InAmmo);
452
453 virtual const FText& GetObjectName() const { return WeaponName; };
454 virtual const FString GetOwnerName() const;
455 virtual const FText& GetObjectDescription() const { return WeaponDescription; };
456 virtual bool IsActionNearlyComplete(EWeaponState State) const;
457 virtual bool IsChildWeaponFireMode(uint8 Mode) const;
458 virtual float GetReticleSpreadMultiplier() const { return ReticleSpreadMultiplier; };
459 virtual bool ShouldReloadCancel(uint8 Mode) const;
460 virtual bool CanReload(EWeaponError& ErrorMessage) const;
461 virtual bool CanFire(EWeaponError& ErrorMessage, uint8 Mode = 0) const;
462 virtual bool IsManagedByWeaponComponent() const { return bIsManagedByWeaponComponent;};
463 virtual bool BlocksWeaponComponentWhileEquipped() const { return bBlockWeaponComponentWhileEquipped; };
464 virtual bool CancelsCurrentEquippedWeaponActionsWhenEquipped() const { return bCancelCurrentEquippedWeaponActions; };
465 virtual bool BlocksUnmanagedWeapons() const { return bBlocksUnmanagedWeapons; };
466 virtual bool CanEquip() const;
467 virtual bool CanUnEquip(bool bTestOnly = false) const;
468 virtual bool CanQueueUnEquip() const;
469 virtual bool IsAwaitingUnEquip() const;
470 virtual float GetDamageMaterialMultiplier(const FHitResult& HitResult) const;
471 virtual bool HasEnoughAmmo(float Amount, uint8 Mode = 0) const;
472 float GetWeaponMovementVelocity() const { return WeaponMovementVelocity; }
473 TSubclassOf <class UAfflictionInstance> GetWeaponMovementAfflictionClass() const { return WeaponMovementAfflictionClass; }
474
475 TSubclassOf <class UAfflictionInstance> GetWeaponAffliction() const { return WeaponAffliction; }
476
477 virtual FVector GetWeaponMovementDirection() const;
478 const FVector GetWeaponPivotOffset() const;
479 TSoftObjectPtr<USkeletalMesh> GetMesh1P() const;
480 TSoftObjectPtr<USkeletalMesh> GetMesh3P() const;
481 ECompressedFlags GetWeaponMovementFlag() const { return WeaponMovementFlag; }
482 TArray<FWeaponAttachment>& GetMeshAttachments() { return Attachments; }
483
484 UFUNCTION(BlueprintNativeEvent)
485 void OnChargeValueUpdated(float Charge);
486 UFUNCTION(BlueprintImplementableEvent)
487 void OnWeaponParticleLoaded(UParticleSystem* Particle);
488 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Fire", ScriptName = "Fire"))
489 void K2_Fire(uint8 Mode);
490 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Fire Released", ScriptName = "FireReleased"))
491 void K2_FireReleased(uint8 Mode);
492 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Fire Complete", ScriptName = "FireComplete"))
493 void K2_FireComplete(uint8 Mode);
494 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Reload", ScriptName = "Reload"))
495 void K2_Reload();
496 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Reload Cancelled", ScriptName = "ReloadCancel"))
497 void K2_ReloadCancel();
498 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Reload Complete", ScriptName = "ReloadComplete"))
499 void K2_ReloadComplete();
500 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Equip", ScriptName = "Equip"))
501 void K2_Equip();
502 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Equip Complete", ScriptName = "EquipComplete"))
503 void K2_EquipComplete();
504 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On UnEquip", ScriptName = "UnEquip"))
505 void K2_UnEquip();
506 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On UnEquip Complete", ScriptName = "UnEquipComplete"))
507 void K2_UnEquipComplete();
508 UFUNCTION(BlueprintImplementableEvent)
509 void K2_ToggleDesignatorMarker(AActor* NewDesignatorMarker);
510 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Weapon State Changed", ScriptName = "WeaponStateChanged"))
511 void K2_WeaponStateChanged(EWeaponState NewWeaponState);
512 UFUNCTION(BlueprintImplementableEvent, Category = Weapon, meta = (DisplayName = "On Owner Died", ScriptName = "OwnerDied"))
513 void K2_OwnerDied();
514
515
516 UFUNCTION(BlueprintCallable, Category = Weapon, meta = (DisplayName = "Is Headshot", ScriptName = "IsHeadshot"))
517 static bool IsHeadshotStatic(const FHitResult& HitResult, const TSubclassOf<UDamageType> DamageType);
518 UFUNCTION(BlueprintCallable, Category = Weapon)
519 static bool ShouldDisplayHitConfirm(AActor* Target, AActor* Instigator);
520 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Mag Capacity", ScriptName = "GetMagCapacity"))
521 static float GetMagCapacityFromClass(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetMaxMagAmmo() : 0.f; }
522 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Global Restock Time", ScriptName = "GetGlobalRestockTime"))
523 static float GetGlobalRestockTimeFromClass(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetGlobalRestockTime() : 0.f; }
524 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Global Restock Amount", ScriptName = "GetGlobalRestockAmount"))
525 static float GetGlobalRestockAmountFromClass(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetGlobalRestockAmount() : 0.f; }
526 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get KeyChain Scale", ScriptName = "GetKeyChainScale"))
527 static FVector GetKeyChainScaleStatic(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetKeyChainScale() : FVector::OneVector; }
528 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Weapon Name", ScriptName = "GetWeaponName"))
529 static FText GetWeaponNameFromClass(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetWeaponName() : FText::FromString(""); }
530 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Weapon Name", ScriptName = "GetWeaponDescription"))
531 static FText GetWeaponDescriptionFromClass(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetWeaponDescription() : FText::FromString(""); }
532 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Weapon ID", ScriptName = "GetWeaponID"))
533 static FString GetWeaponIDFromClass(TSubclassOf<UWeaponInstance> Class);
534 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Weapon Icon", ScriptName = "GetWeaponIcon"))
535 static TAssetPtr<UTexture2D> GetWeaponIconFromClass(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetWeaponIcon() : NULL; }
536 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Weapon KeyChain Socket", ScriptName = "GetWeaponKeyChainSocket"))
537 static FName GetWeaponKeyChainSocket(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetKeyChainSocket() : ""; }
538 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Weapon Kill Feed Icon", ScriptName = "GetWeaponKillFeedIcon"))
539 static TAssetPtr<UTexture2D> GetWeaponKillFeedIconFromClass(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetWeaponKillFeedIcon() : NULL; }
540 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "GetDisplayMesh", ScriptName = "GetDisplayMesh"))
541 static TSoftObjectPtr<USkeletalMesh> Get3rdPersonDisplayMeshFromClass(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->DisplayMesh3P : NULL; }
542 static void GetAllImpactEffectRows(class UDataTable* DataTable, TArray<struct FImpactTableRow*>& ImpactEffectRows);
543 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "GetNumberOfPerkSlots", ScriptName = "GetNumberOfPerkSlots"))
544 static uint8 StaticGetNumberOfPerksSlots(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetPerkSlots().Num() : 0; }
545 UFUNCTION(BlueprintPure, Category = "Player Class", meta = (DisplayName = "GetPerkSlots", ScriptName = "GetPerkSlots"))
546 static TArray<EPerkType> StaticGetPerkSlots(TSubclassOf<UWeaponInstance> Class) { return (Class && Class->GetDefaultObject<UWeaponInstance>()) ? Class->GetDefaultObject<UWeaponInstance>()->GetPerkSlots() : TArray<EPerkType>(); }
547 static struct FImpactTableRow* GetImpactEffectByName(class UDataTable* DataTable, FName RowName);
548 static struct FImpactTableRow* GetImpactEffectByPhysicsMaterial(class UDataTable* DataTable, const UPhysicalMaterial* Material);
549 static void SpawnImpactEffects(UObject* WorldContextObject, class UDataTable* DataTable, const FHitResult& Hit, class UParticleSystemComponent*& ParticleSystem, class UAudioComponent*& AudioComponent, class UDecalComponent*& DecalComponent, UNiagaraComponent*& NiagaraParticleSystem);
550 /* Max amount of ammo this weapon can hold in mag */
551 UPROPERTY(EditDefaultsOnly, Replicated,Category = "Weapon|Ammo", meta = (EditCondition = "bUsesAmmo"))
552 float MaxMagazineAmmo = 10.f;
553 /*Length of the cooldown*/
554 UPROPERTY(EditDefaultsOnly, Category = "Weapon|CoolDown", meta = (EditCondition = "bUsesCoolDown"))
555 float CoolDown = 0.0f;
556 /* Base weapon damage. */
557 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
558 float BaseDamage = 10.f;
559
560 UPROPERTY(BlueprintAssignable)
561 FChargeEventSignature ChargeStartEvent;
562 UPROPERTY(BlueprintAssignable)
563 FChargeEventSignature ChargeFinishedEvent;
564 UPROPERTY(BlueprintAssignable)
565 FWeaponActiveEvent WeaponToggleEvent;
566 UPROPERTY(BlueprintAssignable)
567 FWeaponCancelledEvent WeaponCancelledEvent;
568 UPROPERTY(BlueprintAssignable)
569 FWeaponOverheatEvent ONWeaponOverheatStart;
570 UPROPERTY(BlueprintAssignable)
571 FWeaponOverheatEvent ONWeaponOverheatEnd;
572 UPROPERTY(BlueprintAssignable)
573 FWeaponEquipStateChangeSignature OnWeaponEquipped;
574 UPROPERTY(BlueprintAssignable)
575 FWeaponStopActionsSignature OnWeaponStopActions;
576 UPROPERTY(BlueprintAssignable)
577 FCoolDownSignature OnCoolDownStarted;
578 UPROPERTY(BlueprintAssignable)
579 FWeaponCompleteSignature OnCoolDownFinished;
580 UPROPERTY(BlueprintAssignable)
581 FWeaponAmmoChangedSignature OnWeaponAmmoChanged;
582 UPROPERTY(BlueprintAssignable)
583 FWeaponDesignatorTargetSignature OnValidDesignatorTargetEvent;
584
585 UAnimMontage* GetFireMontage1P() const;
586 UAnimMontage* GetFireMontage3P() const;
587
588 virtual void OnHeatCoolDownComplete();
589 virtual void FireComplete(uint8 Mode);
590 virtual void ChargeStart(uint8 Mode,float StartOverride = 0.0f);
591 virtual void EquipComplete();
592 virtual void ReloadComplete();
593 virtual void SetMagazineAmmo(float NewMagAmmo);
594 virtual void StartWeaponMovement(const FVector& Direction);
595 virtual void StopWeaponMovement();
596 virtual void OnWeaponDown() { if (IsSimulatedOnly()) K2_UnEquip(); }
597 virtual void ToggleEquippedAffliction(bool bIsEquipped);
598 virtual void CoolDownStart(uint8 Mode);
599 virtual bool ConsumeAmmo(float Amount, uint8 Mode = 0);
600 virtual bool GenerateHeat(uint8 Mode = 0);
601 virtual void ToggleTightAim(bool bEnable);
602 virtual void ToggleDesignatorMarker(bool bEnable);
603 virtual void UpdateDesignator(float DeltaTime = 0.f);
604 virtual bool CanSpawnDesignator() const;
605 virtual void PlayFireCounter();
606 virtual void PlayWeaponFireEffects(uint8 BurstCounter = 0);
607 virtual void PlayWeaponFireEffects1P();
608 virtual void PlayWeaponFireEffects3P();
609 virtual void PlayWeaponReload();
610 virtual void StopWeaponReload();
611 virtual void PlayWeaponEquip();
612 virtual void PlayWeaponUnEquip();
613 virtual void DecayFireRate();
614 //This waits Firerate before calling start heat cooldown, so a quick release don't start simulating the heat cooling down in-between shots
615 virtual void WaitToStartHeatCooldown();
616 virtual void StartHeatCooldown();
617 virtual void PredictCurrentHeat();
618 virtual void AsyncLoadImpactTableNiagaraParticle(TSoftObjectPtr<UNiagaraSystem> AssetPointer, UPhysicalMaterial* Material);
619 virtual void AsyncLoadImpactTableParticle(TSoftObjectPtr<UParticleSystem> AssetPointer, UPhysicalMaterial* Material);
620 virtual void AsyncLoadImpactTableSound(TSoftObjectPtr<USoundBase> AssetPointer, UPhysicalMaterial* Material);
621 virtual void AsyncLoadImpactTableDecal(TSoftObjectPtr<UMaterial> AssetPointer, UPhysicalMaterial* Material);
622
623 UFUNCTION(BlueprintPure, Category = Weapon, meta = (DisplayName = "Get Target Transform", ScriptName = "GetTargetTransform"))
624 virtual bool GetTargetTransform(FTransform& Transform) const;
625
626 UFUNCTION(Server, Reliable, WithValidation)
627 void Server_Reliable_UnEquip();
628 UFUNCTION(Server, Reliable, WithValidation)
629 void Server_Reliable_Fire(uint8 Mode = 0, float WorldTimeOverride = -1.f);
630 UFUNCTION(Server, Reliable, WithValidation)
631 void Server_Reliable_CancelFire();
632 UFUNCTION(Server, Reliable, WithValidation)
633 void Server_Reliable_ChargeStart(float ChargeStartTime,uint8 Mode = 0, float WorldTimeOverride = -1.f);
634 UFUNCTION(Server, Reliable, WithValidation)
635 void Server_Reliable_FireReleased(uint8 Mode);
636 UFUNCTION(Server, Reliable, WithValidation)
637 void Server_Reliable_Reload(float WorldTimeSeconds);
638 UFUNCTION(Server, Reliable, WithValidation)
639 void Server_Reliable_ReloadCancel();
640 UFUNCTION(Server, Reliable, WithValidation)
641 void Server_Reliable_TightAim(bool bEnable);
642 UFUNCTION(NetMulticast, Reliable)
643 void Multicast_ChargeFinished(float ChargeVal);
644
645 UFUNCTION(Client, Reliable)
646 void Client_Reliable_BroadcastWeaponError(EWeaponError Error) const;
647 UFUNCTION(Client, Reliable)
648 void Client_Reliable_ReloadComplete(float ReloadAmount);
649 UFUNCTION(Client, Reliable)
650 void Client_Reliable_TotalAmmoChanged(float NewTotalAmmo);
651 UFUNCTION(Client, Reliable)
652 void Client_Reliable_SetMagazineAmmo(float NewMagAmmo);
653 UFUNCTION(Client, Reliable)
654 void Client_Reliable_HeatCooldownComplete(uint8 Mode);
655
656 UFUNCTION()
657 virtual void ChargeTimeComplete(uint8 Mode, bool bExecuteFire = true);
658 UFUNCTION()
659 virtual void DeferredReload();
660 UFUNCTION()
661 virtual void CoolDownFinished();
662
663 UFUNCTION()
664 void OnRep_ChargeIsReady();
665 UFUNCTION()
666 void OnRep_IsOverheating();
667 UFUNCTION()
668 void OnRep_HoldingFire();
669 UFUNCTION()
670 void OnRep_ParentWeapon();
671 UFUNCTION()
672 virtual void OnRep_WeaponState(EWeaponState PreviousState);
673 UFUNCTION()
674 virtual void OnRep_FireCounter();
675 UFUNCTION()
676 virtual void OnRep_TightAiming();
677
678 void BroadcastWeaponError(EWeaponError Error) const;
679
680 /* If TRUE, this weapon will be managed by the Weapon Component, which means there can only be 1 weapon equipped at a time and all events are managed through the state machine in it.
681 If set to FALSE this weapon doesn't have to be equipped on the Weapon Component and will try to manage its own state changes */
682 UPROPERTY(EditDefaultsOnly, Category = "Weapon")
683 bool bIsManagedByWeaponComponent = true;
684 /* If this weapon is managed by the Weapon Component, should we prevent unmanaged weapons to equipping while this weapon is equipped? */
685 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "bIsManagedByWeaponComponent"))
686 bool bBlocksUnmanagedWeapons = false;
687 /* If this weapon is not managed by the Weapon Component, should we prevent the component from running input-based logic while this weapon is equipped? (Switching weapons, firing...) */
688 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
689 bool bBlockWeaponComponentWhileEquipped = true;
690 /* If this weapon is not managed by the Weapon Component, should we still query the weapon component bCanFire state before some of our actions? */
691 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
692 bool bRespectWeaponComponentFireLock = true;
693 /* If this weapon is not managed by the Weapon Component, should we cancel any current actions such as ongoing reloads? */
694 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
695 bool bCancelCurrentEquippedWeaponActions = true;
696 /* If this weapon is not managed by the Weapon Component, should we be allowed to equip when the current weapon (if any on the weapon component) is equipping? */
697 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
698 bool bCanEquipWhileSharedWeaponIsEquipping = false;
699 /* If this weapon is not managed by the Weapon Component, should we be allowed to equip when the current weapon (if any on the weapon component) is unequipping? */
700 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
701 bool bCanEquipWhileSharedWeaponIsUnequipping = false;
702 /* If we are not managed by the weapon component, this means we might be shared with an already equipped weapon, which then controls the mesh. What anims should we play per-weapon on 1P when firing?*/
703 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged|Animation|First Person", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
704 TMap<TSubclassOf<UWeaponInstance>, FMontageList> FireAnimsPerWeapon1P;
705 /* If we are not managed by the weapon component, this means we might be shared with an already equipped weapon, which then controls the mesh. What anims should we play per-weapon on 3P when firing?*/
706 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged|Animation|Third Person", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
707 TMap<TSubclassOf<UWeaponInstance>, FMontageList> FireAnimsPerWeapon3P;
708 /* When querying which animation to play, if we can't find one for the current equipped weapon, should we fallback to the standard "FireAnim"? */
709 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged|Animation", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
710 bool bFallBackToFireAnim = true;
711 /* During the equip of this Unmanaged Weapon, should we interpolate to the RelativePositionOffset and RelativeRotationOffset set up for this weapon? */
712 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "!bIsManagedByWeaponComponent"))
713 bool bInterpolateToUnmanagedOffset = false;
714 /* If bInterpolateToUnmanagedOffset is true, how long should it take to interpolate to this weapon's offset? */
715 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "!bIsManagedByWeaponComponent && bInterpolateToUnmanagedOffset"))
716 float UnmanagedOffsetInterpolateToTime = 0.1f;
717 /* If bInterpolateToUnmanagedOffset is true, how long should it take to interpolate from this weapon's offset to the equipped one's? */
718 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Unmanaged", meta = (EditCondition = "!bIsManagedByWeaponComponent && bInterpolateToUnmanagedOffset"))
719 float UnmanagedOffsetInterpolateFromTime = 0.1f;
720 /* toggles whether this uses the cooldown*/
721 UPROPERTY(EditDefaultsOnly, Category = "Weapon|CoolDown")
722 bool bUsesCoolDown = false;
723 /*What triggers the Cooldown of this weapon? */
724 UPROPERTY(EditDefaultsOnly, Category = "Weapon|CoolDown", meta = (EditCondition = "bUsesCoolDown"))
725 ECoolDownTrigger CoolDownTriggerState = ECoolDownTrigger::Fire;
726 /* Should this weapon display debugging information? */
727 UPROPERTY(EditDefaultsOnly, Category = "Weapon")
728 bool bDebug = false;
729 /*Toggle if the charged shot will fire only on release or if it will auto fire at charge time*/
730 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Charge")
731 bool bFireChargeOnRelease = false;
732 /* Determines the amount of time to charge*/
733 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon|Charge")
734 float ChargeRate = 1.f;
735 /* Duration that it takes for this weapon to fire (delay between shots in seconds)*/
736 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
737 float FireRate = 1.f;
738 /* How much force does this weapon invoke upon physics actors that it damages? */
739 UPROPERTY(EditDefaultsOnly, Category = "Weapon")
740 float DamageForce = 200000.f;
741 /* Max fire rate if FireRateRampUp is > 0*/
742 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
743 float FireRateMin = 1.f;
744 /* Duration that it takes for this weapon to reach its maximum fire rate*/
745 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
746 float FireRateRampUp = 0.0f;
747 /* Duration that it takes for this weapon to reload */
748 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
749 float ReloadRate = 1.f;
750 /* Duration you can keep the weapon equiped for*/
751 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
752 float ActiveTime = 0.0f;
753 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
754 FString WeaponID = "";
755 /* At what distance does aim assist start to fall off? Distance is X and falloff value is Y. If you want a gun that has 100% aim assist up to 1500cm, define a key at (0, 1) and a key at (1500, 1) then taper off the curve over time as X gets > 1500 */
756 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Aim Assist")
757 UCurveFloat* AimAssistDistanceFalloffCurve = nullptr;
758 /* Same as above but for tight aiming. If using 2x zoom, you'll want to double the distance of your falloff curve. */
759 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Aim Assist")
760 UCurveFloat* TightAimedAimAssistDistanceFalloffCurve = nullptr;
761 /* Anything below the first value will be 100% aim assist, the amount of assist will drop off until the player's angle reaches the second value. */
762 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Aim Assist")
763 FVector2D AimAssistFalloffAngle = FVector2D(3.0f, 6.0f);
764 /* Same as above but for tight-aiming. If you have the player on 2x zoom you will want to make the cone 2x tighter. */
765 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Aim Assist")
766 FVector2D TightAimedAimAssistFalloffAngle = FVector2D(1.0f, 3.0f);
767 /* Should this weapon generate head and use overheating features */
768 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Overheat")
769 bool bCanWeaponOverheat = false;
770 /* Are we allowed to hold our breath while Tight aiming (ADS)? */
771 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Gameplay|Stats")
772 bool bCanHoldBreathWhileADSing = false;
773 /* Can this weapon be switched to another one while colling down? */
774 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Overheat", meta = (EditCondition = "bCanWeaponOverheat"))
775 bool bCanUnequipWhileOverheating = true;
776 /* The amount of heat this weapon generates per shot for each Fire Mode */
777 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Overheat", meta = (EditCondition = "bCanWeaponOverheat"))
778 TArray<FFireModeToFloat> HeatGeneratedPerShot = TArray<FFireModeToFloat>();
779 /* The amount of heat this weapon dissipates per second when not holding the trigger */
780 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Overheat", meta = (EditCondition = "bCanWeaponOverheat"))
781 float HeatDissipationRate = 1.f;
782 /* How much heat can this weapon hold before overheating and shutting down*/
783 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Overheat", meta = (EditCondition = "bCanWeaponOverheat"))
784 float OverheatThreshold = 100.f;
785 /* How much time does this weapon need to fully cool down in seconds after overheating. A value of 0 means the weapon will never cool down by itself and needs to be manually triggered */
786 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon|Overheat", meta = (EditCondition = "bCanWeaponOverheat"))
787 float TimeToFullyCoolDown = 5.f;
788 /* Duration that it takes for this weapon to be equipped */
789 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon|Equip")
790 float EquipRate = 0.25f;
791 /* Duration that it takes for this weapon to be unequipped, if < 0, it will use the EquipRate */
792 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon|Equip")
793 float UnequipRate = -1.f;
794 /* Can we switch to this weapon using quick switch? */
795 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
796 bool bCanQuickSwitchTo = true;
797 /* When trying to equip this weapon again, shoud we toggle its state an unequip it? */
798 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
799 bool bUnequipsOnToggle = false;
800 /* Is this weapon a suitable candidate for being considered a previous weapon? */
801 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
802 bool bCanBePreviousWeapon = true;
803 /* Should we fire immediately when we've finished equipping? */
804 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip", meta = (EditCondition = "!bAltFireOnEquip"))
805 bool bFireOnEquip = false;
806 /* Should we fire immediately when we've finished equipping? */
807 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip", meta = (EditCondition = "!bFireOnEquip"))
808 bool bAltFireOnEquip = false;
809 /* Should we equip our previous weapon after placing firing this weapon? */
810 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
811 bool bUnEquipAfterFire = false;
812 /* Should we equip our previous weapon after emptying this weapon? */
813 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
814 bool bUnEquipOnEmpty = false;
815 /* Should we equip our previous weapon after emptying this weapon? */
816 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
817 bool bDropWeaponWhenEmpty = false;
818 /* Can we equip this weapon when it's empty? Should be only used on weapons that restock on their own. */
819 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
820 bool bCanEquipWhenEmpty = true;
821 /* Can never be switched away from in normal gameplay. */
822 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
823 bool bExclusiveWeapon = false;
824 /*The fire mode that this weapon uses */
825 UPROPERTY(EditDefaultsOnly, Category = "Weapon", meta = (Bitmask, BitmaskEnum = EFireMode))
826 uint8 FireModeFlags = 0;
827 /* Affliction applied when the weapon is equipped*/
828 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
829 TSubclassOf<UAfflictionInstance> EquippedAffliction = NULL;
830 /* In the event this weapon's attack comes in contact with a physical material in this list, the associative damage multiplier will be applied. */
831 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
832 TMap<class UPhysicalMaterial*, float> DamageMultipliers;
833 /*What Perecent do we need to charge to to fire*/
834 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
835 float MinimumChargeValue = 1.0f;
836 /* The method with which this weapon fires */
837 UPROPERTY(EditDefaultsOnly, Category = "Weapon")
839 /*Is Holding the trigger required for the charge*/
840 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Charge")
841 bool bHeldToCharge = true;
842 /* How Damage will be scaled based on a curve */
843 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Equip")
844 UCurveFloat* DamageScalingCurve;
845 /* Whether or not this weapon uses ammo */
846 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo")
847 bool bUsesAmmo = true;
848 /* The method with which this weapon fires */
849 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bUsesAmmo"))
851 /* Whether or not ammo is consumed on fire */
852 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bUsesAmmo"))
853 bool bConsumeOnFire = true;
854 /* Whether or not we should reload this gun immediately upon emptying it. */
855 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bUsesAmmo"))
856 bool bReloadWhenEmptied = true;
857 /* Does this weapon have infinite reserve (total) ammo? */
858 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bUsesAmmo"))
859 bool bInfiniteReserveAmmo = true;
860 /* Max amount of ammo this weapon can hold in reserve */
861 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bUsesAmmo"))
862 float MaxTotalAmmo = 100.f;
863 /* Amount of ammo this weapon consumes per shot */
864 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bUsesAmmo"))
865 float AmmoConsumedPerShot = 1.f;
866 /* Should ammo be globally synchronized on this player? */
867 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bUsesAmmo"))
868 bool bGlobalAmmo = false;
869 /* How frequently should the globally synchronized ammo be restocked? */
870 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bGlobalAmmo"))
871 float RestockTime = 5.f;
872 /* How much globally synchronized ammo should be added per restock */
873 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bGlobalAmmo"))
874 float RestockAmount = 5.f;
875 /* If true will gradually restock RestockAmount over RestockTime, instead of in steps. */
876 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bGlobalAmmo"))
877 bool bProgressiveRestock = false;
878 /* Reset ammo on Spawn*/
879 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Ammo", meta = (EditCondition = "bGlobalAmmo"))
880 bool bResetAmmoOnSpawn = false;
881 /* Does this weapon support tight-aim? */
882 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim")
883 bool bCanTightAim = false;
884 /* Do we have a sway when tight aiming? */
885 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
886 bool bHasSwayOnTightAim = true;
887 /* Do we have a sway when tight aiming? */
888 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim && bHasSwayOnTightAim"))
889 float SwayIntensityMultiplier = 1.f;
890 /* Which action causes tight aim to occur? */
891 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
892 EFireMode TightAimFireMode = EFireMode::Secondary;
893 /* How long it takes to get into tight-aim */
894 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
895 float TightAimRate = 0.25f;
896 /* Shift the field of view to this value when tight-aiming */
897 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
898 float TightAimFOV = 45.f;
899 /* Distance of focus, the rest gets blurred out */
900 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
901 float TightAimFocalDistance = 20.f;
902 /* Lower value results in a blurrier depth of field */
903 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
904 float TightAimFStop = 36.f;
905 /*Weapon Offset while tight aiming*/
906 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
907 FVector TightAimRelativeWeaponOffset = FVector::ZeroVector;
908 /*Weapon rotation offset while tightaiming*/
909 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
910 FRotator TightAimRelativeWeaponRotationOffset = FRotator::ZeroRotator;
911 /* If true, tight aiming is allowed to interrupt reloading */
912 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
913 bool bTightAimInterruptsReload = false;
914 /* Modifies spread of weapons depending on tight aim progress */
915 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
916 FVector2D TightAimSpreadModifier = FVector2D(1.f, 1.f);
917 /* Widget to display when we begin tight aiming */
918 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
919 TSubclassOf<class UUserWidget> TightAimWidget = NULL;
920 /* Post process reticle texture to use while tight aiming */
921 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
922 UTexture* TightAimReticleTexture = NULL;
923 /* Post process reticle texture to use while tight aiming */
924 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
925 FVector2D TightAimReticleTextureScale = FVector2D(0.05f, 0.05f);
926 /* Post process reticle texture to use while tight aiming */
927 UPROPERTY(EditDefaultsOnly, Category = "Weapon|Tight Aim", meta = (EditCondition = "bCanTightAim"))
928 FLinearColor TightAimReticleTextureTint = FLinearColor::White;
929 /* Base weapon damage. */
930 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
931 TSubclassOf<class UDamageType> BaseDamageType = NULL;
932 /*Should we allow the weapon to apply movement while firing?*/
933 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Movement")
934 bool bEnableWeaponMovement = false;
935 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Movement", meta = (EditCondition = "bEnableWeaponMovement"))
936 TSubclassOf <class UAfflictionInstance > WeaponMovementAfflictionClass = NULL;
937 /* Force applied when triggered*/
938 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Movement", meta = (EditCondition = "bEnableWeaponMovement"))
939 float WeaponMovementVelocity = 500.f;
940 /* The max amount of time the movement logic can run. For any value bigger than 0, (limited by the weapon's fire-rate) the movement logic will be run for that amount of time in seconds */
941 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Movement", meta = (EditCondition = "bEnableWeaponMovement"))
942 float MaxWeaponMovementDuration = 0.f;
943 /*If you have more than one weaponmovement component, use different flags to make sure they dont interfere with each other */
944 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Movement", meta = (EditCondition = "bEnableWeaponMovement"))
946 /*If a dash is being used as the movement flag, should we align our camera to the dash direction? */
947 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Movement", meta = (EditCondition = "bEnableWeaponMovement && WeaponMovementFlag == ECompressedFlags::Dash || WeaponMovementFlag == ECompressedFlags::OmniDash"))
948 bool bLooksTowardsDashMovement = false;
949 /*If a dash is being used as the movement flag, should we break after dashing ? */
950 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Movement", meta = (EditCondition = "bEnableWeaponMovement && WeaponMovementFlag == ECompressedFlags::Dash || WeaponMovementFlag == ECompressedFlags::OmniDash"))
951 bool bBreakAfterDashing = false;
952 /* Which action causes this weapon to activate its movement? */
953 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Movement", meta = (EditCondition = "bEnableWeaponMovement"))
954 EFireMode WeaponMovementFireMode = EFireMode::Secondary;
955 /*Should we treat this weapon as a child weapon? Children weapons are allowed to be "attached" to other weapons and be controlled by them, useful for alt firemodes */
956 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Child Weapons")
957 bool bIsChildWeapon = false;
958 /* Weapons this weapon should initialize as children during Initialization */
959 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Child Weapons", meta = (EditCondition = "!bIsChildWeapon"))
960 TSubclassOf<UWeaponInstance> ChildWeaponClass = NULL;
961 /* Should we route a fire mode to the Child Weapon?*/
962 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Child Weapons", meta = (EditCondition = "!bIsChildWeapon && ChildWeaponClass!= NULL"))
963 EFireMode ChildWeaponFireMode = EFireMode::Secondary;
964 /*Name of the socket that the keychain attaches too*/
965 UPROPERTY(EditDefaultsOnly, Category = "Weapon | KeyChain")
966 FName KeyChainSocketName = "KeyChainSocket";
967 /* scale of the keychain*/
968 UPROPERTY(EditDefaultsOnly, Category = "Weapon | KeyChain")
969 FVector KeyChainScale = FVector(1.0f, 1.0f, 1.0f);
970 /*who will the designator spawn for*/
971 UPROPERTY(EditDefaultsOnly, Category = "Designator")
972 EDesignatorTeamView DesignatorTeamView;
973 /*Designator class to spawn*/
974 UPROPERTY(EditDefaultsOnly, Category = "Designator")
975 TSubclassOf<class ADesignatorMarker> DesignatorMarkerClass = NULL;
976 /* Do you need a target for the designator*/
977 UPROPERTY(EditDefaultsOnly, Category = "Designator")
978 bool bDesignatorRequiresTarget = true;
979 /* Usually this is the fire rate for auto weapons. How long the recoil effect takes. */
980 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
981 float WeaponMeshRecoilTime = 0.5f;
982 /* How far the weapon recoils */
983 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
984 float WeaponMeshRecoilDistance = 0.0f;
985 /* How far the weapon recoils while tight aimed */
986 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
987 float WeaponMeshRecoilDistanceTightAimed = 0.0f;
988 /* How the recoil animation plays out. Usually you use a bounce curve so that it pulls back and returns to it's original position 0-1-0 */
989 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
990 UCurveFloat* WeaponMeshRecoilCurve = nullptr;
991 /* First person display mesh for this item */
992 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|First Person")
993 TSoftObjectPtr<USkeletalMesh> DisplayMesh1P;
994 /* Third person display mesh for this item */
995 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|Third Person")
996 TSoftObjectPtr<USkeletalMesh> DisplayMesh3P;
997 /* First person gun attachments */
998 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|First Person")
999 TArray<FWeaponAttachment> Attachments;
1000 /* Where to attach the 1st person weapon on the skeleton */
1001 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|First Person")
1002 FName SocketAttach1P;
1003 /* Where to attach the 3rd person weapon on the skeleton */
1004 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|Third Person")
1005 FName SocketAttach3P;
1006 //The scale to Mesh3P this weapon will apply.
1007 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|Third Person")
1008 FVector Mesh3PScale = FVector(1.f, 1.f, 1.f);
1009 /* First person animation class for this weapon */
1010 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1011 TSubclassOf<UAnimInstance> AnimationClass1P;
1012 /* First Person AnimMontage to play each time we fire */
1013 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1014 UAnimMontage* FireAnimation1P;
1015 /* Third Person AnimMontage representing the player's aim down sights fire */
1016 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1017 UAnimMontage* TightAimFireAnimation1P;
1018 /* First Person Montage representing the player's reload. Looping animation for single reload */
1019 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1020 UAnimMontage* ReloadAnimation1P;
1021 /* For single reload, this would be the animation to start */
1022 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1023 UAnimMontage* ReloadAnimation1PStart;
1024 /* For single reload, this would be the ending animation (shotgun pump) */
1025 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1026 UAnimMontage* ReloadAnimation1PEnd;
1027 /* Skips ths "SwapWeaponIn" animation, playing the fire immediately instead */
1028 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1029 bool bPlayFireAnimationImmediately = false;
1030 /* First Person Montage representing the player's swap-in motion */
1031 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1032 UAnimMontage* SwapWeaponIn1P;
1033 /* First Person Montage representing the player's swap-out motion */
1034 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|First Person")
1035 UAnimMontage* SwapWeaponOut1P;
1036 /* First person weapon animation class */
1037 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1038 TSubclassOf<UAnimInstance> WeaponAnimationClass;
1039 /* Third person weapon animation class */
1040 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1041 TSubclassOf<UAnimInstance> WeaponAnimationClass3P;
1042 /* Animation to play on the weapon each time we fire. This applies to 1p*/
1043 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1044 UAnimMontage* WeaponFireAnimation;
1045 /* Animation to play on the weapon each time we fire. This applies to 3p*/
1046 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1047 UAnimMontage* WeaponFireAnimation3P;
1048 /* First Person Montage representing the weapon's reload */
1049 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1050 UAnimMontage* WeaponReloadAnimation1P;
1051 /* For single reload, this would be the animation to start it + 1 loop */
1052 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1053 UAnimMontage* WeaponReloadAnimation1PStart;
1054 /* For single reload, this would be the ending animation + 1 loop */
1055 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1056 UAnimMontage* WeaponReloadAnimation1PEnd;
1057 /* Animation to play while equipping the weapon */
1058 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1059 UAnimMontage* WeaponEquipAnimation;
1060 /* Third person display mesh for this weapon */
1061 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Third Person")
1062 TSubclassOf<UAnimInstance> AnimationClass3P;
1063 /* Third Person AnimMontage to play each time we fire */
1064 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Third Person")
1065 UAnimMontage* FireAnimation3P;
1066 /* Third Person AnimMontage representing the player's aim down sights fire */
1067 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Third Person")
1068 UAnimMontage* TightAimFireAnimation3P;
1069 /* Third Person AnimMontage representing the player's reload */
1070 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Third Person")
1071 UAnimMontage* ReloadAnimation3P;
1072 /* Third Person Montage representing the player's swap-in motion */
1073 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Third Person")
1074 UAnimMontage* SwapWeaponIn3P;
1075 /* Third Person Montage representing the player's swap-out motion */
1076 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Third Person")
1077 UAnimMontage* SwapWeaponOut3P;
1078 /* Third Person Montage representing the weapon's reload */
1079 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Animation|Weapon")
1080 UAnimMontage* WeaponReloadAnimation3P;
1081 /* Sound to play on the first shot */
1082 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1083 USoundBase* FireSingleSound;
1084 /* Sound to play on every shot after the first shot if the trigger is held and weapon mode is auto. Depending on the weapon firerate, this method could cause inconsistent timings due to frame rate. Use FireAutoLoopSound instead. This could be useful for playing nonspecific sounds such as weapon tails in tandem with a loop. */
1085 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1086 USoundBase* FireAutoSound;
1087 /* Sound to loop while the automatic weapon is firing. */
1088 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1089 USoundBase* FireAutoLoopSound;
1090 /* Sound to play when the weapon has finished firing. This cleans up a loop nicely by giving it a tail. */
1091 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1092 USoundBase* FireAutoLoopTail;
1093 /* Some weapons give a dry-fire style "click" when empty. This sound will play when the last bullet is consumed. */
1094 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1095 USoundBase* WeaponMagEmptySound;
1096 /* The base clip has how many shots per second? This allows us to mathematically sync the clip to the gun's fire rate. */
1097 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1098 float AutoFireClipShotsPerSec = 10.0f;
1099 /* This prevents burst weapons from playing a sound per shot and will only play a sound on the first shot. This is useful if your burst is baked into a single sound. */
1100 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1101 bool bPlaySingleSoundForBursts = true;
1102 /* For all other clients hearing this from a distance - Will play the looping sound and stop the looping sound when the player presses and releases the fire button. If false, the looping sound will start on the second shot (allowing FireSingleSound to play first) */
1103 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1104 bool bStartLoopingSoundOnFirstShotRemote = true;
1105 /* For the local client - Will play the looping sound and stop the looping sound when the player presses and releases the fire button. If false, the looping sound will start on the second shot (allowing FireSingleSound to play first) */
1106 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1107 bool bStartLoopingSoundOnFirstShotLocal = true;
1108 /* Will automatically adjust the pitch of the looping sound to match the fire rate. Expects the source audio to have a fire rate of 10 rounds per second. */
1109 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Sound")
1110 bool bSyncLoopingSoundToFireRate = true;
1111 //The scale to Mesh1P this weapon will apply.
1112 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|First Person")
1113 FVector Mesh1PScale = FVector(1.f, 1.f, 1.f);
1114 //For easy tweaking of scale without messing with offset data. Will recompute offsets automatically.
1115 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|First Person")
1116 float Mesh1PScaleMultiplier = 2.0f;
1117 /* Every gun needs to be held a bit differently so it looks like its pointing at the center of the screen. Tweaks go here. */
1118 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|First Person")
1119 FVector RelativePositionOffset = FVector(30.0f, -22.0f, -152.0f);
1120 /* Every gun needs to be rotated to look like its pointing the center of the screen. Tweaks go here. */
1121 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Mesh|First Person")
1122 FRotator RelativeRotationOffset = FRotator(16.0f, 0.0f, 10.0f);
1123 // Name of this weapon.
1124 UPROPERTY(EditDefaultsOnly, Category = "UI")
1125 FText WeaponName;
1126 UPROPERTY(EditDefaultsOnly, Category = "UI")
1127 FText WeaponDescription;
1128 /* Multiplier that allows a designer to tune how much spread a reticle has (so long as its hooked up in the reticle)*/
1129 UPROPERTY(EditDefaultsOnly, Category = "Weapon")
1130 float ReticleSpreadMultiplier = 1.f;
1131 // Name of this weapon.
1132 UPROPERTY(EditDefaultsOnly, Category = "UI")
1133 TSubclassOf<UReticleWidget> ReticleWidget = NULL;
1134 /* Ammo counter widget */
1135 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI")
1136 TSubclassOf<UUserWidget> AmmoCounterWidget = NULL;
1137 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI")
1138 FName AmmoCounterSocket = "CounterAttachmentPoint";
1139 // Weapon icon used for generic display purposes
1140 UPROPERTY(EditDefaultsOnly, Category = "UI")
1141 TAssetPtr<UTexture2D> WeaponIcon = NULL;
1142 // Weapon icon used for the kill feed.
1143 UPROPERTY(EditDefaultsOnly, Category = "UI")
1144 TAssetPtr<UTexture2D> WeaponKillFeedIcon = NULL;
1145 UPROPERTY(EditDefaultsOnly, Category = "Weapon | Equip")
1146 TSubclassOf <class UAfflictionInstance > WeaponAffliction = NULL;
1147 UPROPERTY(EditDefaultsOnly, Category = "Loadout")
1149 UPROPERTY(EditDefaultsOnly, Category = "Weapon")
1150 bool bAppliesUltimateDamageMultiplier = false;
1151
1152 UPROPERTY(EditDefaultsOnly, Category = "Display")
1153 FName DisplaySocketName = "DisplaySocket";
1154 UPROPERTY(EditDefaultsOnly, Category = "Display")
1155 float DisplayFocalDistance = -1.0f;
1156 UPROPERTY(ReplicatedUsing = OnRep_WeaponState)
1158 UPROPERTY(ReplicatedUsing = OnRep_ParentWeapon)
1159 UWeaponInstance* ParentWeapon = NULL;
1160 UPROPERTY(ReplicatedUsing = OnRep_FireCounter)
1161 uint8 FireCounter = 0;
1162 UPROPERTY(ReplicatedUsing = OnRep_HoldingFire)
1163 bool bHoldingFire = false;
1164 UPROPERTY(ReplicatedUsing = OnRep_ChargeIsReady)
1165 bool bCharging = false;
1166 UPROPERTY(ReplicatedUsing = OnRep_IsOverheating)
1167 bool bIsOverheating = false;
1168 UPROPERTY(BlueprintReadOnly, ReplicatedUsing = OnRep_TightAiming)
1169 bool bTightAiming = false;
1170 UPROPERTY(Replicated)
1171 UWeaponInstance* ChildWeapon = nullptr;
1172
1173 UPROPERTY()
1174 float TotalAmmo = 0.f;
1175 /* How much ammo we have in our current mag */
1176 float MagazineAmmo = 0.f;
1177 UPROPERTY()
1178 bool bAwaitingUnEquip = false;
1179 UPROPERTY()
1180 AProjectXCharacter* OwningCharacter = NULL;
1181 UPROPERTY()
1182 UWeaponComponent* OwningComponent = NULL;
1183 UPROPERTY()
1184 TMap<uint8, UMaterialInstance*> WeaponSkin;
1185 UPROPERTY(BlueprintReadOnly)
1186 UParticleSystem* WeaponSkinParticle = nullptr;
1187
1188 TWeakObjectPtr<class ADesignatorMarker> DesignatorMarker = NULL;
1189 float ChargeValue;
1190 bool bValidDesignator = false;
1191 bool bInitialized = false;
1192 float GlobalAmmoRestockMultiplier = 1.0f;
1193
1194protected:
1195 float WeaponEquippedTimestamp = 0.f;
1196private:
1197 friend class UWeaponComponent;
1201
1202 void EndLoopingFireSound();
1203
1204 UPROPERTY()
1205 mutable UGlobalAmmoComponent* GlobalAmmoComponent = NULL;
1206 UPROPERTY()
1207 TMap<UPhysicalMaterial*, FImpactEffects> ImpactEffectMap;
1208
1209 float CurrentHeat = 0.f;
1210 uint8 ClientFireCounter = 0;
1211 int32 ChargingInterpolatorId;
1212 uint32 TightAimInterpolationID = INDEX_NONE;
1213 float LastReloadTime = 0.0f;
1214 float FireRateInterp = 0.0f;
1215 int32 FireRateRampInterpID = INDEX_NONE;
1216 float LastWeaponFireTime = 0.0f;
1217 float AutoFireAudioDelay = 0.0f;
1218 float LastDelayedPlayTime = 0.0f;
1219 UUserWidget* CreatedTightAimWidget = nullptr; //Store scope widget for destruction when tight aim is completed
1220 uint32 OffsetShiftInterpolationID = INDEX_NONE;
1221
1222 UPROPERTY()
1223 UAudioComponent* ActiveLoopingAudioComponent = nullptr;
1224
1225 FTimerHandle FireTimer = FTimerHandle();
1226 FTimerHandle WeaponMovementTimer = FTimerHandle();
1227 FTimerHandle WaitingForHeatCoolDownStartTimer = FTimerHandle();
1228 FTimerHandle TriggerReleasedHeatCoolDownTimer = FTimerHandle();
1229 FTimerHandle HeatCoolDownTimer = FTimerHandle();
1230 FTimerHandle ReloadTimer = FTimerHandle();
1231 FTimerHandle EquipTimer = FTimerHandle();
1232 FTimerHandle UnEquipTimer = FTimerHandle();
1233 FTimerHandle CoolDownTimer = FTimerHandle();
1234 FTimerHandle FireCounterTimer = FTimerHandle();
1235 FTimerHandle ActiveTimer = FTimerHandle();
1236};
EPerkType
Definition: CosmeticAssetBase.h:61
@ Dash
Definition: DashComponent.cpp:90
EWeaponError
Definition: WeaponComponent.h:15
EWeaponState
Definition: WeaponInstance.h:132
EFireType
Definition: WeaponInstance.h:157
EDesignatorTeamView
Definition: WeaponInstance.h:189
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FChargeEventSignature, float, TotalTime, float, TimeElapsed)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FWeaponActiveEvent, bool, bActive)
ECompressedFlags
Definition: WeaponInstance.h:51
EReloadType
Definition: WeaponInstance.h:165
ECoolDownTrigger
Definition: WeaponInstance.h:180
ECoolDownType
Definition: WeaponInstance.h:173
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FWeaponCancelledEvent)
EFireMode
Definition: WeaponInstance.h:147
Definition: DesignatorMarker.h:13
Definition: ProjectXCharacter.h:128
Definition: ProjectXHUD.h:20
Definition: ProjectXPlayerController.h:83
Definition: ObjectInfoInterface.h:16
Definition: ReactsToMatchEvents.h:16
Definition: ChildWeaponInstanceShotgunMortar.h:14
Definition: MeleeDashMovementComponent.h:13
Definition: ReticleWidget.h:13
Definition: WeaponInstance.h:220
virtual bool BlocksWeaponComponentWhileEquipped() const
Definition: WeaponInstance.h:463
virtual void UpdateOwningCharacter(AProjectXCharacter *NewCharacter)
Definition: WeaponInstance.h:236
virtual bool CancelsCurrentEquippedWeaponActionsWhenEquipped() const
Definition: WeaponInstance.h:464
TSubclassOf< class UAfflictionInstance > GetWeaponMovementAfflictionClass() const
Definition: WeaponInstance.h:473
ECompressedFlags GetWeaponMovementFlag() const
Definition: WeaponInstance.h:481
TArray< FWeaponAttachment > & GetMeshAttachments()
Definition: WeaponInstance.h:482
FORCEINLINE bool IsChildWeapon() const
Definition: WeaponInstance.h:310
FORCEINLINE bool IsAlmostReady() const
Definition: WeaponInstance.h:364
float GetWeaponMovementVelocity() const
Definition: WeaponInstance.h:472
virtual bool BlocksUnmanagedWeapons() const
Definition: WeaponInstance.h:465
TSubclassOf< class UAfflictionInstance > GetWeaponAffliction() const
Definition: WeaponInstance.h:475
virtual const FText & GetObjectDescription() const
Definition: WeaponInstance.h:455
FORCEINLINE FName GetSocket3P() const
Definition: WeaponInstance.h:366
FORCEINLINE FName GetSocket1P() const
Definition: WeaponInstance.h:365
virtual float GetReticleSpreadMultiplier() const
Definition: WeaponInstance.h:458
virtual bool IsManagedByWeaponComponent() const
Definition: WeaponInstance.h:462
Definition: WeaponInstanceMeleeDash.h:13
Definition: WeaponInstancePowerSword.h:18
Definition: WeaponInstance.h:198
Definition: WeaponInstance.h:117
Definition: WeaponInstance.h:81
class UPhysicalMaterial * Material
Definition: WeaponInstance.h:85
TSoftObjectPtr< class USoundBase > Sound
Definition: WeaponInstance.h:91
Definition: WeaponInstance.h:41
Definition: WeaponInstance.h:66