LEAP Documentation 40220
Documentation for the LEAP project
ProjectXPlayerController.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios 2017. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GameFramework/PlayerController.h"
7#include "OwnedInterface.h"
8#include "TeamInterface.h"
9#include "ProjectX.h"
10#include "CosmeticsManager.h"
11#include "PlayerStructs.h"
13#include "ProjectXPlayerController.generated.h"
14
15#define VIEW_TRACEDISTANCE 100000.0f
16#define CONN_SERVER_NOT_RESPONDING_SECONDS 6.0f
17#define CONN_BAD_PING 200
18#define CONN_BAD_RESPONSE_SECONDS 2.0f
19#define CONN_BAD_PACKET_LOSS 0.25f
20#define CONN_ALERT_DELAY 5.0f
21#define CONN_ALERT_RESTORE_DELAY 1.0f
22#define NUM_ACTORSTATE_SEND_PER_CHUNK 50
23
24class UDecalActor;
26class UKillCameraComponent;
28class UCurveFloat;
29class APawn;
31class UChatBoxWidget;
35class APlayerState;
36
37UENUM(BlueprintType)
38enum class EPlayerError : uint8
39{
42};
43
44UENUM(BlueprintType)
45enum class ESpawnError : uint8
46{
54};
55
57DECLARE_DYNAMIC_MULTICAST_DELEGATE(FNewHudCreatedSignature);
60DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnKeyBindingUpdatedSignature);
63DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnConnectionStatusChangedSignature);
66DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnInteractSignature, float, ExitTime);
67DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRadarSizeUpdatedSignature, float, RadarSizeMultiplier);
68DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FRestartFailureSignature, ESpawnError, SpawnError);
69DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnCharacterTargetedSignature, AActor*, TargetedActor);
70DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTeamChangeResponseReceived, ETeamJoinResponse, ChangeResponse);
71DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FGamePadStateChangeSignature, bool, bIsUsingGamepad);
72DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FNewPawnSignature, APawn*, NewPawn);
74DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPlayerFollowedSignature, AProjectXPlayerState*, PlayerState);
75DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FKillParticipationSignature, AActor*, Victim, float, Damage, bool, bKiller);
76DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FHitPredictionSignature, AActor*, Victim, TSubclassOf<UWeaponInstance>, Weapon, bool, bHeadshot, float, Damage, bool, bHealing);
77
78//Set bUseDefaultProcess to false if we should skip regular rotation updates from inside ADriverCameraManager::ProcessViewRotation
79DECLARE_EVENT_FourParams(AProjectXPlayerController, FViewRotationUpdateEvent, float /* DeltaTime */, FRotator& /* OutViewRotation */, FRotator& /* OutDeltaRot */, bool& /* bUseDefaultProcess */);
80
81UCLASS(Config = Game)
82class PROJECTX_API AProjectXPlayerController : public APlayerController, public IOwnedInterface, public ITeamInterface
83{
84 GENERATED_UCLASS_BODY()
85
86public:
87 virtual APlayerState* GetOwnedPlayerState() const override;
88 virtual int32 GetTeam() const override;
89 UFUNCTION(BlueprintCallable, Category = PlayerController)
90 virtual UKillCameraComponent* GetKillCameraComponent() const { return KillCameraComponent; }
91 UFUNCTION(BlueprintCallable, Category = PlayerController)
92 FORCEINLINE class UMapRotationReceiverComponent* GetMapRotationReceiverComponent() const { return MapRotationReceiverComponent; }
93
95 UFUNCTION(BlueprintCallable, Category = PlayerController, DisplayName = "Server Restart Player", meta = (ScriptName = "ServerRestartPlayer"))
96 void K2_ServerRestartPlayer();
98 UFUNCTION(BlueprintPure, Category = PlayerController, DisplayName = "Can Restart Player", meta = (ScriptName = "CanRestartPlayer"))
99 bool K2_CanRestartPlayer() { return CanRestartPlayer(); }
100
101 virtual void SetViewTargetWithBlend(class AActor* NewViewTarget, float BlendTime = 0, enum EViewTargetBlendFunction BlendFunc = VTBlend_Linear, float BlendExp = 0, bool bLockOutgoing = false);
102 virtual void SetControlRotation(const FRotator& NewRotation);
103 virtual void UpdateRotation(float DeltaTime);
104 virtual void ServerRestartPlayer_Implementation() override;
105 virtual void ServerFinalizeRestartPlayer();
106 virtual bool CanRestartPlayer() override;
107 virtual void ClientWasKicked_Implementation(const FText& KickReason) override;
108 virtual void SetupInputComponent() override;
109 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
110 virtual void BeginPlay() override;
111 virtual void GetSeamlessTravelActorList(bool bToEntry, TArray<class AActor*>& ActorList) override;
112 virtual void Tick(float DeltaSeconds) override;
113 virtual void TickAimAssist(const FVector& PawnLocation, const FRotator& PawnRotation, float DeltaTime);
114 virtual void TickCurrentViewHitResult(const FVector& PawnLocation, const FRotator& PawnRotation, float DeltaTime);
115 virtual void TickConnectionQualityDetection(float DeltaTime);
116 virtual void AddPitchInput(float Val) override;
117 virtual void AddYawInput(float Val) override;
118 virtual void AddRollInput(float Val) override;
119 virtual void ModifyViewAcceleration(float Rate);
120 virtual void InteractPressed();
121 virtual void InteractReleased();
122 virtual void RequestRevive();
123 virtual void TriggerRevivePrompt(AProjectXPlayerState* Reviver);
124 virtual void OnPossess(APawn* PawnToPossess) override;
125 virtual void RespawnFromReviveBeacon();
126 virtual void AcceptRevive();
127 virtual void DeclineRevive();
128 /* Kills the stored widget reference for the revive prompt */
129 virtual void ClearWaitingOnReviveState();
130 virtual void CloseRevivePrompt();
131 virtual class APlayerState* GetNextViewablePlayer(int32 dir) override;
132 virtual void ServerViewNextPlayer_Implementation() override;
133 virtual void ServerViewPrevPlayer_Implementation() override;
134 UFUNCTION(Client, Reliable, WithValidation)
135 void Client_Reliable_ViewPlayer(AProjectXPlayerState* TargetPlayerState);
136 UFUNCTION()
137 virtual void SwitchToNextPlayer();
138 UFUNCTION()
139 virtual void SwitchToPreviousPlayer();
140
141 UFUNCTION()
142 virtual void MenuToggled(UAdvancedUserWidget* Widget, bool bToggle);
143 virtual void PawnLeavingGame() override;
144 void OnNewPawn(APawn* NewPawh);
145 void InitializePlayerCosmeticRequestInfo();
146 void RequestCosmeticFromPlayer();
147
148 UFUNCTION(Server, Reliable, WithValidation)
149 void Server_Reliable_RequestCosmeticFromPlayer(APlayerState* RequestedPlayerState);
150
151 UFUNCTION(BlueprintPure, Category = Bindings)
152 bool IsPlayerBindingNewButton() const {
153 UProjectXGameViewportClient* Viewport = Cast<UProjectXGameViewportClient>(GetWorld()->GetGameViewport());
154 return Viewport ? Viewport->IsPlayerBindingNewButton() : false;
155 }
156 UFUNCTION(BlueprintPure, Category = Bindings)
157 bool IsPlayerHoldingControllerContextChangeButton() const { return bControllerContextChanged; }
158 void ApplyInputSettings();
159 UFUNCTION(BlueprintCallable)
160 void KeysRebound() {OnKeybindUpdatedEvent.Broadcast(); }
161 UFUNCTION(Client, Reliable)
162 void Client_ConfirmHitActor(AActor* Victim, UClass* Weapon, bool bHeadshot, float Damage, bool bHealing);
163 UFUNCTION(Client, Reliable)
164 void Client_RequestRedeploy();
165 UFUNCTION(Client, Reliable)
166 void Client_PlayerEquipRequest(AProjectXPlayerState* PXPlayerState, const TArray<FEquipInfo>& Equips);
167 UFUNCTION(Client, Reliable)
168 void Client_ServerRestartPlayerFailed(ESpawnError ErrorType);
169 UFUNCTION(BlueprintCallable)
170 void UpdateRadarSizeMultiplier(float NewRadarSize);
171 UFUNCTION(BlueprintCallable, Category = Spectating)
172 void EnableSpectatorMode();
173 UFUNCTION(BlueprintImplementableEvent, Category = "QuickChat")
174 void SpawnContextPing(FVector SpawnVector);
175 UFUNCTION(BlueprintCallable, Category = "Base Control")
176 void SelectPlayerClass(TSubclassOf<AProjectXCharacter> PlayerClass);
177 UFUNCTION(BlueprintCallable, Category = "Spawning")
178 bool SelectSpawnTarget(AActor* SpawnTarget);
179 UFUNCTION(BlueprintCallable, Category = "Spawning")
180 bool SelectBestSpawnTarget(FVector TargetLocation, bool bUseTargetLocation = false);
181 UFUNCTION(BlueprintCallable, Category = "Spawning")
182 void ClearSpawnTarget();
183 UFUNCTION(BlueprintCallable, Category = "Spawning")
184 void UpdateReviveTimeMultiplier(float NewMultiplier) { ReviveTimeMultiplier = NewMultiplier; }
185 UFUNCTION(BlueprintCallable, Category = "Spawning")
186 FORCEINLINE float GetReviveTimeMultiplier() const { return ReviveTimeMultiplier; }
187 FORCEINLINE bool GetHasDeployedAtLeastOnce() const { return bHasDeployedAtLeastOnce;}
188 void SetHasDeployedAtLeastOnce(bool bHasDeployed) {bHasDeployedAtLeastOnce = bHasDeployed;}
189 void StartPlayerTalking();
190 void StopPlayerTalking();
191
192 void ToggleFollowCam(bool bFollowEnabled);
193 UFUNCTION(BlueprintCallable)
194 AProjectXPlayerState* GetFollowPlayer() const;
195
196 UFUNCTION(BlueprintCallable, Category = PlayerController)
197 bool ChangeTeam(uint8 Team);
198 UFUNCTION(BlueprintCallable, Category = PlayerController)
199 bool ChangeSquad(int32 Squad) { Server_Reliable_SelectSquad(Squad); return true; }
200 void RequestAutoAssignSquad() { Server_Reliable_AutoAssignSquad(); }
201
202 UFUNCTION(BlueprintCallable, Category = PlayerController)
203 virtual bool WaitingToPlayMatchStart();
204
205 AProjectXPlayerState* FindPlayerByNameOrID(const FString& PlayerNameOrID) const;
206
207 UFUNCTION(exec)
208 void SetWelcomeMessage(const FString& NewWelcomeMessage);
209 UFUNCTION(exec)
210 void SessionKickPlayer(const FString& PlayerNameOrID, const FString& Reason);
211 UFUNCTION(exec)
212 void KickPlayer(const FString& PlayerNameOrID, const FString& Reason);
213 UFUNCTION(exec)
214 void BanPlayer(const FString& PlayerNameOrID, const FString& Reason);
215 UFUNCTION(exec)
216 void ReportPlayer(const FString& PlayerNameOrID, const FString& Reason);
217 UFUNCTION(exec)
218 void FlySpeed(const float NewFlySpeed = 1000.0f);
219 UFUNCTION(exec)
220 void GetMusicTrack();
221 UFUNCTION(exec)
222 void SmoothCam(const float NewSmoothCamSpeed = -1.0f);
223 UFUNCTION(exec)
224 void ToggleMeshes();
225 UFUNCTION(exec)
226 void SkipMap();
227 UFUNCTION(exec)
228 void SkipWave();
229 UFUNCTION(exec)
230 void DumpChat();
231 UFUNCTION(exec)
232 void StartMatch();
233 UFUNCTION(exec)
234 void PermanentInvisibility();
235 UFUNCTION(exec)
236 void IncrementPlayerStat(int8 EnumElement, int32 NumToAdd, int32 DebugMapType, FString MapName);
237 UFUNCTION(Server, Reliable, WithValidation)
238 void Server_Reliable_SelectPlayerClass(TSubclassOf<AProjectXCharacter> PlayerClass);
239 UFUNCTION(Server,Reliable,WithValidation)
240 void Server_Reliable_RespawnFromReviveBeacon();
241 UFUNCTION(Server, Reliable, WithValidation)
242 void Server_Reliable_DeclineRevive();
243
244 UFUNCTION(Server, Reliable, WithValidation)
245 virtual void Server_Reliable_LeaveVehicle();
246 // EOS Anti-Cheat: Helper for sending an anti-cheat message from client to server.
247 UFUNCTION(Server, Reliable, WithValidation)
248 void Server_AntiCheatMessage(const TArray<uint8>& Message);
249 // EOS Anti-Cheat: Helper for sending an anti-cheat message from server to client.
250 UFUNCTION(Client, Reliable)
251 void Client_AntiCheatMessage(const TArray<uint8>& Message);
252 UFUNCTION(BlueprintCallable)
253 void MatchStartRequest(){Server_Reliable_MatchStartRequest(); }
254 UFUNCTION(BlueprintCallable)
255 void ToggleReadyStatus(bool bReady);
256 UFUNCTION(BlueprintCallable, Category = PlayerController)
257 static void SendHitConfirm(AActor* Victim, float Damage, struct FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser, bool bHealing);
258
259 UFUNCTION()
260 virtual void OnRep_KillCameraClass();
261 virtual void OnRep_Pawn() override;
262 virtual void OnRep_PlayerState() override;
263
264 UFUNCTION()
265 virtual void VoteYes();
266 UFUNCTION()
267 virtual void VoteNo();
268 UFUNCTION()
269 virtual void ToggleMap();
270 UFUNCTION(BlueprintCallable, Category = "PlayerController")
271 virtual void ResetIdleTimer();
272 UFUNCTION()
273 void WaitForInitialHud();
274 UFUNCTION()
275 void FocusReviveBeacon(float BlendTime);
276 void OnInitialHudReady();
277 TSubclassOf<UAdvancedUserWidget> GetChatBoxWidgetClass() { return ChatBoxWidgetClass; }
278 virtual void CloseChat();
279 template<bool bNewToggle>
280 void ToggleControllerContextChange();
281
282 //Returns the vehicle pawn this controller's pawn is currently possessing.
283 UFUNCTION(BlueprintPure)
284 virtual AProjectXVehicle* GetVehicle() const;
285 //Returns the character pawn this controller is meant to control. Used when trying to get the "player" pawn when the owning controller is possessing a vehicle.
286 UFUNCTION(BlueprintPure)
287 virtual AProjectXCharacter* GetCharacter() const;
288 virtual void LeaveVehicle();
289
290 UFUNCTION(Server, WithValidation, Reliable)
291 void Server_Reliable_PossessRecordingPawn(AProjectXCharacter* TargetedCharacter, AProjectXCharacter* OriginalCharacter);
292
293 UFUNCTION(Server, WithValidation, Reliable)
294 void Server_Reliable_PossessOriginalCharacter(AProjectXCharacter* OriginalCharacter);
295public:
296 /* If testing in editor, should game over result in a travel to the main menu? */
297 UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category = "Debug")
298 bool bTravelIfGameOverInEditor = false;
299
300 UPROPERTY(BlueprintAssignable, Category = "Push To Talk Events")
301 FPlayerSpeakSignature OnPlayerStartedSpeaking;
302 UPROPERTY(BlueprintAssignable, Category = "Push To Talk Events")
303 FPlayerSpeakSignature OnPlayerStoppedSpeaking;
304 UPROPERTY(BlueprintAssignable, Category = "Game Events")
305 FVictorySignature OnPlayerVictory;
306 UPROPERTY(BlueprintAssignable)
307 FOnInteractSignature OnInteract;
308 UPROPERTY(BlueprintAssignable)
309 FOnInteractComplete OnInteractComplete;
310 UPROPERTY(BlueprintAssignable, Category = "Game Events")
311 FIdlePlayerSignature OnIdlePlayerWarning;
312 UPROPERTY(BlueprintAssignable, Category = "Game Events")
313 FOnTeamChangeResponseReceived OnTeamChangeResponseReceived;
314 UPROPERTY(BlueprintAssignable, Category = "Game Events")
315 FIdlePlayerSignature OnIdlePlayerStopWarning;
316 UPROPERTY(BlueprintAssignable, Category = "Game Events")
317 FGamePadStateChangeSignature OnGamepadStateChanged;
318 UPROPERTY(BlueprintAssignable, Category = "Game Events")
319 FNewPawnSignature OnPawnChanged;
320 UPROPERTY(BlueprintAssignable, Category = "Network Events")
321 FOnConnectionStatusChangedSignature OnBadConnectionDetected;
322 UPROPERTY(BlueprintAssignable, Category = "Network Events")
323 FOnConnectionStatusChangedSignature OnGoodConnectionDetected;
324 UPROPERTY(BlueprintAssignable, Category = "Network Events")
325 FOnConnectionStatusChangedSignature OnServerNotRespondingDetected;
326 UPROPERTY(BlueprintAssignable, Category = "Network Events")
327 FOnConnectionStatusChangedSignature OnServerRespondingDetected;
328 UPROPERTY(BlueprintAssignable, Category = "Generic Events")
329 FNewHudCreatedSignature OnNewHUDCreatedAndReady;
330 UPROPERTY(BlueprintAssignable, Category = "Generic Events")
331 FPlayerErrorSignature OnPlayerError;
332 UPROPERTY(BlueprintAssignable, Category = "Player Restart Events")
333 FRestartFailureSignature OnServerRestartPlayerFailure;
334 UPROPERTY(BlueprintAssignable, Category = "Player Restart Events")
335 FOnPlayerRestartEvent OnPlayerRestartRequested;
336 UPROPERTY(BlueprintAssignable, Category = "Targeting Events")
337 FOnCharacterTargetedSignature OnPlayerTargetedStartedEvent;
338 UPROPERTY(BlueprintAssignable, Category = "Targeting Events")
339 FOnCharacterTargetedSignature OnPlayerTargetedStoppedEvent;
340 UPROPERTY(BlueprintAssignable)
341 FOnKeyBindingUpdatedSignature OnKeybindUpdatedEvent;
342 FViewRotationUpdateEvent ViewRotationUpdateEvent;
343 UPROPERTY(BlueprintAssignable, Category = "Weapon Events")
344 FHitPredictionSignature OnClientHitPrediction;
345 UPROPERTY(BlueprintAssignable, Category = "Radar")
346 FOnRadarSizeUpdatedSignature OnRadarSizeMultiplierUpdated;
347 UPROPERTY(BlueprintAssignable, Category = "GameEvents")
348 FGenericDelegateSignature OnServerRequestedRedeploy;
349 UPROPERTY(BlueprintAssignable, Category = "GameEvents")
350 FOnPlayerKickedSignature OnPlayerKicked;
351 UPROPERTY(BlueprintAssignable, Category = "GameEvents")
352 FOnPlayerFollowedSignature OnFollowPlayerUpdatedEvent;
353 UPROPERTY(BlueprintAssignable, Category = "GameEvents")
354 FOnWarnPlayerIdle OnWarnPlayerIdle;
355
356 UPROPERTY()
357 bool bClientIdleWarned = false;
358 bool ServerStatTracking = false;
359
360 UPROPERTY(BlueprintReadOnly)
361 float RadarSizeMultiplier = 1.0f;
362
363 UPROPERTY()
364 bool bDebug = false;
365
366 float RedeployModifier = 0.0f;
367 bool bSetRedeployTimer = false;
368 bool bIsRedeploying = false;
369
370 UFUNCTION(BlueprintCallable,BlueprintPure)
371 FORCEINLINE UVivoxPlayerComponent* GetVivoxComponent() const { return VivoxPlayerComponent; }
372
373 void SetAimAssistConfiguration(UCurveFloat* const FallOffCurve, FVector2D Angle);
374 void SetLookSensitivityMultiplier(float Multiplier);
375
376 void RegisterWithAntiCheat();
377 void UnregisterWithAntiCheat();
378
379 UFUNCTION(Client, Reliable)
380 void Client_EndSession();
381 UFUNCTION(Client, Reliable)
382 void Client_BeginSession();
383
384protected:
385 UPROPERTY()
386 class UMapRotationReceiverComponent* MapRotationReceiverComponent = NULL;
387
388 UPROPERTY()
389 class UKillCameraComponent* KillCameraComponent = NULL;
390
391 UPROPERTY(ReplicatedUsing = OnRep_KillCameraClass, EditDefaultsOnly, Category = Kill)
392 TSubclassOf<class UKillCameraComponent> KillCameraClass = NULL;
393
394 UPROPERTY(EditDefaultsOnly, Category = DamageType)
395 TSubclassOf<UDamageType> SuicideDamageType;
396
397 UPROPERTY(GlobalConfig)
398 TSubclassOf<class UKillCameraComponent> KillCameraClassOverride = NULL;
399 UPROPERTY(GlobalConfig)
400 int32 IdleTimeoutTime = 120;
401 /* How long before opening the map on match start*/
402 UPROPERTY(EditDefaultsOnly, GlobalConfig, Category = "Menus")
403 float MapOpenDelay = 2.f;
404 UPROPERTY(EditDefaultsOnly)
405 UVivoxPlayerComponent* VivoxPlayerComponent = NULL;
406
407 UFUNCTION(Server, Reliable)
408 void Server_RequestActorStateInfo();
409 UFUNCTION(Server, Reliable, WithValidation)
410 void Server_Reliable_SelectTeam(uint8 Team);
411 UFUNCTION(Server, Reliable, WithValidation)
412 void Server_Reliable_SelectSquad(int32 Squad);
413 UFUNCTION(Server, Reliable, WithValidation)
414 void Server_Reliable_AutoAssignSquad();
415 UFUNCTION(Client, Reliable, WithValidation)
416 virtual void Client_Reliable_TeamChangeResponse(ETeamJoinResponse ResponseMessage);
417 UFUNCTION(Client, Reliable, WithValidation)
418 virtual void Client_WarnIdlePlayerToggle(bool bWarn);
419 UFUNCTION(Client, Reliable, WithValidation)
420 virtual void Client_EarlyWarnIdlePlayer();
421 virtual void ClientSetHUD_Implementation(TSubclassOf<AHUD> NewHUDClass) override;
422
423 UFUNCTION(Server, Reliable, WithValidation)
424 virtual void Server_ResetIdleTimer();
425
426 UFUNCTION()
427 virtual void WarnIdlePlayerToggle(bool bWarning);
428 UFUNCTION()
429 virtual void IdlePlayerTimeout();
430 virtual void ResetIdleTimerIfNeeded();
431 UFUNCTION(BlueprintCallable)
432 virtual void ResetIdleTimerUI();
433
434 virtual void ToggleTeamChat();
435 virtual void ToggleChat();
436 void SendContextPing();
437 virtual void UpdatePlayerTargeting(const FVector& PawnLocation, const FRotator& PawnRotation, float DeltaSeconds);
438 UFUNCTION(Server, Reliable, WithValidation)
439 void Server_Reliable_SelectSpawnTarget(AActor* SpawnTarget);
440 UFUNCTION(Server, Reliable, WithValidation)
441 void Server_Reliable_ClearSpawnTarget();
442 UFUNCTION(Server, Reliable, WithValidation)
443 void Server_Reliable_ReadyStatusUpdated(bool bReady);
444 UFUNCTION(Server, Reliable, WithValidation)
445 void Server_Reliable_MatchStartRequest();
446 UFUNCTION(BlueprintCallable, Server, Reliable, Category = PlayerController)
447 void Server_RedeployCharacter();
448
449 TArray<AActor*> GetIgnoredAimAssistActors();
450
451 //Is this player waiting to play match start effects?
452 UPROPERTY()
453 bool bWaitingToPlayMatchStart = true;
454
455 /* Amount to slow the reticle while it's over a target */
456 UPROPERTY(EditDefaultsOnly)
457 float AimAssistFriction = 0.6f;
458 /* Strength of force that wants to snap the reticle to the target*/
459 UPROPERTY(EditDefaultsOnly)
460 float AimAssistAdhesion = 5.0f;
461 /* How quickly to ramp up the player's turn speed while spinning. This value is a multiplier per second. */
462 UPROPERTY(EditDefaultsOnly)
463 float TurnRateAccelerationRate = 5.0f;
464 /* How fast to ramp down the player's turn speed when no rotation is detected. This value is a multiplier per second. */
465 UPROPERTY(EditDefaultsOnly)
466 float TurnRateDeccelerationRate = 10.0f;
467 /* This is the max value the multiplier is allowed to reach when TurnRateAccelerationRate is incrementing This value is a multiplier per second.*/
468 UPROPERTY(EditDefaultsOnly)
469 float TurnRateAccelerationMax = 5.0f;
470 /* The amount of time you have to wait between requesting help*/
471 UPROPERTY(EditDefaultsOnly)
472 float RequestHelpDelay = 5.0f;
473 UPROPERTY(EditDefaultsOnly)
474 UCurveFloat* DefaultAutoAimFalloffCurve = nullptr;
475 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI", meta = (AllowPrivateAccess = true))
476 TSubclassOf<UAdvancedUserWidget> ChatBoxWidgetClass;
477 UPROPERTY(EditDefaultsOnly)
478 TSubclassOf<class UProjectXDamageType> ReviveDamageType;
479 TWeakObjectPtr<UChatBoxWidget> ChatBoxInstance;
480
481 TArray<TWeakObjectPtr<AActor>> PlayersToIgnore;
482
483 TArray<TWeakObjectPtr<APlayerState>>PlayerToLoadCosmetics;
484 TWeakObjectPtr<AProjectXPlayerState> FollowPlayer = NULL;
485
486private:
487 bool bIsBinding = false;
488 bool bIsFollowingPlayer = false;
489 bool bControllerContextChanged = false;
490 UCurveFloat* AutoAimFalloffCurve = nullptr;
491 FVector2D AimAssistAngle = FVector2D(15.0f, 30.0f);
492 float ViewAccelerationCooldown = 0.0f;
493 float ViewRotationMultiplier = 1.0f;
494 float ViewAccelerationMultiplier = 1.0f;
495 float LastKnownYaw = 0.f;
496 float LastKnownPitch = 0.f;
497 float ReviveTimeMultiplier = 1.0f;
498 bool bIncludeAlliesInAimAssistHitResult = false;
499 FHitResult AimAssistHitResult;
500 FHitResult CurrentViewHitResult;
501 FHitResult VisibilityHitResult;
502 FHitResult TargetingHitResult;
503 static FHitResult EmptyViewHitResult;
504 static TArray<FHitResult> EmptyTargetingHitResult;
505 static TArray<TWeakObjectPtr<AActor>> EmptyActorArray;
506
507 TArray<TWeakObjectPtr<AActor>> TargetedActors;
508 TWeakObjectPtr<AProjectXCharacter> CachedCharacter = NULL;
509 TArray<FHitResult> TargetingHits;
510 FTimerHandle InitialHudTimer;
511 FTimerHandle LeaveVehicleTimer;
512 FTimerHandle IdlePlayerTimer;
513 FTimerHandle IdlePlayerWarningTimer;
514 FTimerHandle IdlePlayerFifteenSecondWarningTimer;
515 FTimerHandle ArmoryIdleResetTimer;
516
517 bool bHasDeployedAtLeastOnce = false;
518 float LastRequestedHelpTime = 0.0f;
519 float AvgLostPacketPctIn = 0.0f;
520 float AvgLostPacketPctOut = 0.0f;
521 bool ServerNotResponding = 0.0f;
522 float LastGoodConnectionTime = 0.0f;
523 float LastBadConnectionTime = 0.0f;
524 float IdleTimerResetCooldownTime = 2.0f;
525 TArray<UObject*> HiddenWidgets;
526 FRotator DesiredControlRotation = FRotator::ZeroRotator;
527 float LookSensitivityRuntimeMultiplier = 1.0f;
528 FVector FollowComponentTargetRelativeLocation = FVector::ZeroVector;
529 bool bRegisteredWithAntiCheat = false;
530 TArray<FLevelActorState> StateChangedActors;
531 bool bRequestedActorStateInfo = false;
532 void SendActorStateInfoToClient();
533 void Client_ReceiveActorStateInfo(TArray<FLevelActorState> SendList);
534 TWeakObjectPtr<UContextMenuWidget> RevivePromptWidget = nullptr;
535
536public:
537 /* precise camera-center trace forwards for a single blocking hit */
538 UFUNCTION(BlueprintPure)
539 static const FHitResult& GetPlayerViewHitResult(UObject* const WorldContextObject);
540 /* returns anything hitting aim assist volumes exclusive of allies */
541 UFUNCTION(BlueprintPure)
542 static const FHitResult& GetPlayerAimAssistHitResult(UObject* const WorldContextObject);
543 /* returns anything hitting aim assist volumes inclusive of allies */
544 UFUNCTION(BlueprintPure)
545 static const TArray<FHitResult>& GetTargetingHitResult(UObject* const WorldContextObject);
546 UFUNCTION(BlueprintPure)
547 static const TArray<AActor*> GetTargetedActors(UObject* const WorldContextObject);
548 /* get potential targets which are collected on tick */
549 static const TArray<TWeakObjectPtr<AActor>>& GetTargets(UObject* const WorldContextObject);
550
551 virtual void CurrentViewHitResultInDistance(const float Distance, FHitResult& ReturnHitResult);
552
553 TWeakObjectPtr<class UFOVCameraModifier> FOVCameraModifier = nullptr;
554 bool bFPMeshesVisible = true;
555 float SmoothCamSpeed = -1.0f;
556 bool bRestartingPlayer = false;
557
559 UPROPERTY(EditAnywhere, BlueprintReadWrite, config, Category = PlayerController)
560 float InputADSYawScale;
561
563 UPROPERTY(EditAnywhere, BlueprintReadWrite, config, Category = PlayerController)
564 float InputADSPitchScale;
565
566 //Achievement debug DamageType
567 UPROPERTY(EditDefaultsOnly, Category = PlayerController)
568 TSubclassOf<class UProjectXDamageType> GrenadeDamageType;
569
570 int8 DebugGrenadeKillStat = 99;
571
572};
ETeamJoinResponse
Definition: ProjectXGameMode.h:38
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FiveParams(FHitPredictionSignature, AActor *, Victim, TSubclassOf< UWeaponInstance >, Weapon, bool, bHeadshot, float, Damage, bool, bHealing)
DECLARE_EVENT_FourParams(AProjectXPlayerController, FViewRotationUpdateEvent, float, FRotator &, FRotator &, bool &)
EPlayerError
Definition: ProjectXPlayerController.h:39
@ SpawnTargetDoesntExist
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FKillParticipationSignature, AActor *, Victim, float, Damage, bool, bKiller)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPlayerErrorSignature, EPlayerError, Error)
ESpawnError
Definition: ProjectXPlayerController.h:46
@ InvalidSpawnLocation
@ InvalidPlayerController
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnWarnPlayerIdle)
Definition: ProjectXCharacter.h:128
Definition: ProjectXPlayerController.h:83
void RequestAutoAssignSquad()
Definition: ProjectXPlayerController.h:200
FORCEINLINE bool GetHasDeployedAtLeastOnce() const
Definition: ProjectXPlayerController.h:187
void SetHasDeployedAtLeastOnce(bool bHasDeployed)
Definition: ProjectXPlayerController.h:188
Definition: ProjectXPlayerState.h:238
Definition: ProjectXRecordingPawn.h:15
Definition: ProjectXVehicle.h:56
Definition: Debug.h:14
Definition: OwnedInterface.h:20
Definition: TeamInterface.h:26
Definition: AdvancedUserWidget.h:30
Definition: ChatBoxWidget.h:12
Definition: ContextMenuWidget.h:37
Definition: FOVCameraModifier.h:12
Definition: MapRotationReceiverComponent.h:11
Definition: ProjectXDamageType.h:62
Definition: ProjectXGameViewportClient.h:23
bool IsPlayerBindingNewButton() const
Definition: ProjectXGameViewportClient.h:51
Definition: CosmeticAssetBase.h:36
Definition: ProjectX.h:43