LEAP Documentation 40220
Documentation for the LEAP project
WeaponInstanceSpawnableVehicle.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 "WeaponInstanceSpawnableVehicle.generated.h"
8
12
13UCLASS()
15{
16 GENERATED_UCLASS_BODY()
17
18public:
19 UFUNCTION(BlueprintCallable)
20 AProjectXVehicle* GetVehicle() const{ return Vehicle.IsValid() ? Vehicle.Get() : NULL;}
21 UFUNCTION(BlueprintCallable)
22 const FVector& GetDisplayScale() const { return DisplayScale; }
23
24 virtual bool Fire(uint8 Mode, float WorldTimeOverride) override;
25 virtual void FireComplete(uint8 Mode) override;
26 virtual bool CanReload(EWeaponError& ErrorMessage) const override;
27 virtual void UnEquipComplete() override;
28 virtual bool CanEquip() const override;
29 virtual bool CanFire(EWeaponError& ErrorMessage, uint8 Mode) const override;
30
31 UFUNCTION(Server, Reliable, WithValidation)
32 void Server_Toggle_SpawnActor(const FTransform& DeployTransform, bool OverrideValidation = false);
33 UFUNCTION(BlueprintNativeEvent)
34 void GetSpawnTransform(FTransform& SpawnTransform);
35 UFUNCTION(BlueprintCallable, Category = Spawnable)
36 TSubclassOf<AProjectXVehicle> GetVehicleClass() const { return VehicleClass; }
37
38 bool IsPersonalVehicle() const { return bPersonalVehicle; }
39 void SetDisableVehicle(const bool bInDisableVehicle);
40
41 UPROPERTY(BlueprintAssignable)
42 FVehicleSpawnedSignature ActiveSpawnableEvent;
43
44protected:
45
46 UFUNCTION()
47 void OnExitedVehicle(AProjectXVehicle* PreviousVehicle, AProjectXCharacter* OldDriver);
48 UFUNCTION()
49 virtual void OnVehicleDestroyed();
50 UFUNCTION()
51 virtual void OnRep_Vehicle();
52 UFUNCTION()
53 void DestroyVehicle(AProjectXVehicle* PreviousVehicle);
54 UFUNCTION()
55 void OnDriverDied(AActor* Victim, const float Damage, struct FDamageEvent const& DamageEvent, const class AController* EventInstigator, const class AActor* DamageCauser, const class APlayerState* InstigatorPlayerState);
56 UFUNCTION()
57 void LeaveVehicle(bool bHold, float Duration);
58
59 UFUNCTION(BlueprintImplementableEvent, Category = "Deployable Weapon")
61
62 //List of deployables owned by this weapon.
63 UPROPERTY(ReplicatedUsing = OnRep_Vehicle)
64 TWeakObjectPtr<AProjectXVehicle> Vehicle;
65 /* How far in front of the player should the deployable be shown? */
66 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
67 float DeployableForwardOffset = 500.f;
68 /* Actor this item will deploy */
69 UPROPERTY(EditDefaultsOnly, Category = "Deployable Vehicle")
70 TSubclassOf<AProjectXVehicle> VehicleClass = NULL;
71 /* Leniency distance from the player we will allow when attempting to validate this placement on the server */
72 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
73 float DeployDistanceLeniency = 200.f;
74 /* Max number of instances that can be spawned*/
75 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
76 int32 MaxInstances = 1;
77 /*Delay before vehicle is destoryed*/
78 UPROPERTY(EditDefaultsOnly, meta = (ClampMin = 0.0f), Category = "Deployable Weapon")
79 float VehicleDeathDelay = 1.0f;
80 /* the size the vehicle is displayed at*/
81 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
82 FVector DisplayScale = FVector::OneVector;
83
84 FTimerHandle DeathTimer;
85 FTimerDelegate DeathDelegate;
86
87
88 UPROPERTY()
89 bool bFireValidated = false;
90 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
91 bool bPersonalVehicle = true;
92 UPROPERTY(EditDefaultsOnly, Category = "Deployable Weapon")
93 bool bDisabledVehicle = false;
94};
EWeaponError
Definition: WeaponComponent.h:15
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FVehicleSpawnedSignature, AProjectXVehicle *, Vehicle)
Definition: ProjectXCharacter.h:128
TWeakObjectPtr< AProjectXVehicle > PreviousVehicle
Definition: ProjectXCharacter.h:714
TWeakObjectPtr< AProjectXVehicle > Vehicle
Definition: ProjectXCharacter.h:711
virtual void OnRep_Vehicle()
Definition: ProjectXCharacter.cpp:2219
FORCEINLINE AProjectXVehicle * GetVehicle() const
Definition: ProjectXCharacter.h:213
Definition: ProjectXVehicle.h:56
Definition: WeaponInstance.h:220
Definition: WeaponInstanceSpawnableVehicle.h:15
bool IsPersonalVehicle() const
Definition: WeaponInstanceSpawnableVehicle.h:38