LEAP Documentation 40220
Documentation for the LEAP project
WeaponInstanceSpawnable.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"
7#include "WeaponInstanceSpawnable.generated.h"
8
10class ADeployable;
11class AContainer;
12
13DECLARE_DYNAMIC_MULTICAST_DELEGATE(FSpawnableEventSignature);
14
15UCLASS(Blueprintable)
16class PROJECTX_API UWeaponInstanceSpawnable : public UWeaponInstance
17{
18 GENERATED_UCLASS_BODY()
19public:
20 virtual bool CanFire(EWeaponError& ErrorMessage, uint8 Mode) const override;
21 virtual bool Fire(uint8 Mode, float WorldTimeOverride) override;
22 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
23 virtual void OwnerDied() override;
24 virtual bool CanReload(EWeaponError& ErrorMessage) const override;
25 virtual bool Reload(float WorldTimeOverride) override;
26 virtual bool UnEquip(bool bForce = false) override;
27
28protected:
29 virtual void EquipComplete() override;
30 virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
31 virtual void DisplayDeployMarker();
32 virtual void HideDeployMarker();
33 virtual bool UpdateDeployMarker();
34 virtual void InitializeWeapon(bool bFromBatchInitialization = false) override;
35
36 UFUNCTION()
37 virtual bool ValidateDeploy(FTransform& Transform) const;
38
39public:
40 UFUNCTION(BlueprintNativeEvent)
41 void GetSpawnTransform(FTransform& SpawnTransform);
42
43 UFUNCTION(BlueprintCallable, Category = Spawnable)
44 TSubclassOf<ADeployable> GetDeployableClass() const { return DeployableClass; }
45 UPROPERTY(BlueprintAssignable)
46 FSpawnableEventSignature ActiveSpawnableEvent;
47
48 UFUNCTION(BlueprintCallable, Category = Spawnable)
49 bool CanInteractWithActiveDeployables() const;
50
51 UFUNCTION(Server, Reliable, WithValidation)
52 void Server_SpawnActor(const FTransform& DeployTransform);
53
54 UFUNCTION()
55 virtual void DestroyOldestDeployable();
56 UFUNCTION()
57 virtual void OnDeployableSpawned(ADeployable* DeployedActor);
58 UFUNCTION()
59 virtual void OnDeployableDestroyed(ADeployable* DeployedActor);
60
61 //List of deployables owned by this weapon.
62 UPROPERTY(Replicated)
63 TArray<ADeployable*> Deployables;
64
65 UPROPERTY()
66 bool bFireValidated = false;
67
68 /* How far down and up from relative offset this deployable will attempt to adjust for the ground */
69 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
70 float GroundCheckDistance = 100.f;
71
72 /* How far in front of the player should the deployable be shown? */
73 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
74 float DeployableForwardOffset = 500.f;
75
76 UPROPERTY()
77 ADeployableMarker* DeployableMarker = NULL;
78
79 /* Marker class used to check for valid spawn locations*/
80 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
81 TSubclassOf<ADeployableMarker> DeployableMarkerClass = NULL;
82
83 /* Actor this item will deploy */
84 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
85 TSubclassOf<ADeployable> DeployableClass = NULL;
86
87 /* World-based deployment uses checks for deployment that are based on world checks such as spatial checks based on distance and offsets */
88 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
89 bool bUseWorldBasedDeployment = true;
90 /* Projectile-based deployment uses a logic for spawning like we do for projectiles that come out of guns using the characters view rotation for spawn direction*/
91 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon", meta = (EditCondition = "!bUseWorldBasedDeployment"))
92 bool bUseProjectileBasedDeployment = false;
93 /* Offset from the character to spawn at */
94 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon", meta = (EditCondition = "bUseWorldBasedDeployment || bUseProjectileBasedDeployment"))
95 FVector RelativeOffset = FVector::ZeroVector;
96 /* Leniency distance from the player we will allow when attempting to validate this placement on the server */
97 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon", meta = (EditCondition = "bUseWorldBasedDeployment"))
98 float DeployDistanceLeniency = 200.f;
99
100 /*Are the deployables fire and forget or can we interact with them after spawning*/
101 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
102 bool bFireAndForgetDeployables = true;
103
104 float DeployableExtraTimeMultiplier = 1.0f;
105};
EWeaponError
Definition: WeaponComponent.h:15
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FSpawnableEventSignature)
Definition: Deployable.h:47
Definition: DeployableMarker.h:35
Definition: WeaponInstance.h:220
Definition: WeaponInstanceSpawnable.h:17