-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinputContextTransitions.script
More file actions
2719 lines (2358 loc) · 105 KB
/
Copy pathinputContextTransitions.script
File metadata and controls
2719 lines (2358 loc) · 105 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
enum ActiveBaseContext
{
None = 0,
Locomotion = 1,
Ladder = 2,
Swimming = 3,
BodyCarring = 4,
MeleeWeapon = 5,
RangedWeapon = 6,
BodyCarringWithRangedWeapon = 7,
}
abstract class InputContextTransition extends DefaultTransition
{
private const function GetVehicle( const scriptInterface : StateGameScriptInterface, out vehicle : weak< VehicleObject > ) : Bool
{
var player : weak< GameObject >;
var vehicleID : EntityID;
player = ( ( GameObject )( scriptInterface.owner ) );
vehicleID = scriptInterface.localBlackboard.GetEntityID( GetAllBlackboardDefs().PlayerStateMachine.EntityIDVehicleRemoteControlled );
if( VehicleComponent.GetVehicleFromID( player.GetGame(), vehicleID, vehicle ) )
{
return true;
}
if( VehicleComponent.GetVehicle( player.GetGame(), player.GetEntityID(), vehicle ) )
{
return true;
}
return false;
}
protected const function IsVehicleRemoteControlled( const scriptInterface : StateGameScriptInterface ) : Bool
{
var vehicle : weak< VehicleObject >;
if( GetVehicle( scriptInterface, vehicle ) )
{
return vehicle.IsVehicleRemoteControlled();
}
return false;
}
protected const function ToggleVehicleRemoteControlCamera( const scriptInterface : StateGameScriptInterface ) : Bool
{
var vehicle : weak< VehicleObject >;
if( GetVehicle( scriptInterface, vehicle ) && vehicle.IsVehicleRemoteControlled() )
{
vehicle.ToggleVehicleRemoteControlCamera();
return true;
}
return false;
}
protected const function SetVehicleRemoteControlled( const scriptInterface : StateGameScriptInterface, enable : Bool ) : Bool
{
var vehicle : weak< VehicleObject >;
if( GetVehicle( scriptInterface, vehicle ) && ( !( enable ) || vehicle.IsHackable() ) )
{
vehicle.SetVehicleRemoteControlled( enable, false, true );
return true;
}
return false;
}
protected const function GetDriverCombatType( const stateContext : StateContext ) : gamedataDriverCombatType
{
var driverCombatType : StateResultInt;
driverCombatType = stateContext.GetPermanentIntParameter( 'driverCombatType' );
if( driverCombatType.valid )
{
return ( ( gamedataDriverCombatType )( driverCombatType.value ) );
}
return gamedataDriverCombatType.Invalid;
}
protected const function GetUIBlackboard( scriptInterface : StateGameScriptInterface ) : IBlackboard
{
var blackboardSystem : BlackboardSystem;
var blackboard : IBlackboard;
blackboardSystem = scriptInterface.GetBlackboardSystem();
blackboard = blackboardSystem.Get( GetAllBlackboardDefs().UI_QuickSlotsData );
return blackboard;
}
}
abstract class InputContextTransitionDecisions extends InputContextTransition
{
protected const virtual function EnterCondition( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
return true;
}
protected const virtual function ToGameplayContext( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
return !( IsOnEnterConditionEnabled() ) || !( EnterCondition( stateContext, scriptInterface ) );
}
protected const virtual function ToBaseContext( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
return !( IsOnEnterConditionEnabled() ) || !( EnterCondition( stateContext, scriptInterface ) );
}
protected export const virtual function ExitCondition( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
return !( IsOnEnterConditionEnabled() ) || !( EnterCondition( stateContext, scriptInterface ) );
}
}
abstract class InputContextTransitionEvents extends InputContextTransition
{
var m_gameplaySettings : weak< GameplaySettingsSystem >;
var m_onInputSchemeUpdatedCallback : CallbackHandle;
var m_OnInputHintManagerInitializedChangedCallback : CallbackHandle;
var m_onInputSchemeChanged : Bool;
protected var m_hasControllerChanged : Bool;
protected var m_hasControllerSchemeChanged : Bool;
var m_isGameplayInputHintManagerInitialized : Bool;
var m_isGameplayInputHintRefreshRequired : Bool;
protected export function OnAttach( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface )
{
var inputSchemesBB : IBlackboard;
inputSchemesBB = GameInstance.GetBlackboardSystem( scriptInterface.GetGame() ).Get( GetAllBlackboardDefs().InputSchemes );
if( inputSchemesBB )
{
m_onInputSchemeUpdatedCallback = inputSchemesBB.RegisterListenerUint( GetAllBlackboardDefs().InputSchemes.Scheme, this, 'OnInputSchemeUpdated' );
m_OnInputHintManagerInitializedChangedCallback = inputSchemesBB.RegisterListenerVariant( GetAllBlackboardDefs().InputSchemes.InitializedInputHintManagerList, this, 'OnInputHintManagerInitializedChanged' );
}
m_gameplaySettings = GameplaySettingsSystem.GetGameplaySettingsSystemInstance( scriptInterface.executionOwner );
}
protected export function OnDetach( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface )
{
var inputSchemesBB : IBlackboard;
inputSchemesBB = GameInstance.GetBlackboardSystem( scriptInterface.GetGame() ).Get( GetAllBlackboardDefs().InputSchemes );
if( m_onInputSchemeUpdatedCallback )
{
inputSchemesBB.UnregisterListenerUint( GetAllBlackboardDefs().InputSchemes.Scheme, m_onInputSchemeUpdatedCallback );
}
if( m_OnInputHintManagerInitializedChangedCallback )
{
inputSchemesBB.UnregisterListenerVariant( GetAllBlackboardDefs().InputSchemes.InitializedInputHintManagerList, m_OnInputHintManagerInitializedChangedCallback );
}
}
protected event OnInputSchemeUpdated( value : Uint32 )
{
m_onInputSchemeChanged = true;
}
protected function OnInputHintManagerInitializedChanged( value : Variant )
{
var currentInitializedInputHintManagerList : array< CName >;
var isGameplayInputHintManagerInitialized : Bool;
var i : Int32;
currentInitializedInputHintManagerList = ( ( array< CName > )value );
for( i = 0; i < currentInitializedInputHintManagerList.Size(); i += 1 )
{
if( currentInitializedInputHintManagerList[ i ] == 'GameplayInputHelper' )
{
isGameplayInputHintManagerInitialized = true;
break;
}
}
m_isGameplayInputHintRefreshRequired = m_isGameplayInputHintManagerInitialized != isGameplayInputHintManagerInitialized && !( m_isGameplayInputHintManagerInitialized );
m_isGameplayInputHintManagerInitialized = isGameplayInputHintManagerInitialized;
}
protected const function ShouldForceRefreshInputHints( const stateContext : StateContext ) : Bool
{
var shouldForceRefreshInputHints : StateResultBool;
shouldForceRefreshInputHints = stateContext.GetTemporaryBoolParameter( 'ForceRefreshInputHints' );
return m_isGameplayInputHintRefreshRequired || ( shouldForceRefreshInputHints.valid && shouldForceRefreshInputHints.value );
}
protected const function ShowBodyCarryInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
var psmBodyCarrying : gamePSMBodyCarrying;
psmBodyCarrying = ( ( gamePSMBodyCarrying )( scriptInterface.localBlackboard.GetInt( GetAllBlackboardDefs().PlayerStateMachine.BodyCarrying ) ) );
if( scriptInterface.localBlackboard.GetBool( GetAllBlackboardDefs().PlayerStateMachine.CanThrowCarriedNPC ) )
{
ShowInputHint( scriptInterface, 'ThrowNPC', 'BodyCarry', "LocKey#17844", inkInputHintHoldIndicationType.Press );
stateContext.SetPermanentBoolParameter( 'isThrowCarriedNPCInputHintDisplayed', true, true );
}
if( psmBodyCarrying == gamePSMBodyCarrying.Carry )
{
if( scriptInterface.executionOwner.PlayerLastUsedPad() )
{
if( scriptInterface.HasStatFlag( gamedataStatType.CanShootWhileCarryingBody ) )
{
ShowInputHint( scriptInterface, 'DropCarriedObject', 'BodyCarry', "LocKey#43673", inkInputHintHoldIndicationType.FromInputConfig, true );
}
else
{
ShowInputHint( scriptInterface, 'DropCarriedObject', 'BodyCarry', "LocKey#43673" );
}
}
else
{
ShowInputHint( scriptInterface, 'DropCarriedObject', 'BodyCarry', "LocKey#43673", inkInputHintHoldIndicationType.Press );
}
}
stateContext.SetPermanentBoolParameter( 'isBodyCarryInputHintDisplayed', true, true );
}
protected const function RemoveBodyCarryInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'BodyCarry' );
}
stateContext.RemovePermanentBoolParameter( 'isThrowCarriedNPCInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isBodyCarryInputHintDisplayed' );
}
protected const function ShowLadderInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowInputHint( scriptInterface, 'ToggleSprint', 'Ladder', "LocKey#36200" );
ShowInputHint( scriptInterface, 'Jump', 'Ladder', "LocKey#36201" );
ShowInputHint( scriptInterface, 'ToggleCrouch', 'Ladder', "LocKey#36204" );
stateContext.SetPermanentBoolParameter( 'isLadderInputHintDisplayed', true, true );
}
protected const function RemoveLadderInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'Ladder' );
}
stateContext.RemovePermanentBoolParameter( 'isLadderInputHintDisplayed' );
}
protected const function ShowTerminalInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowInputHint( scriptInterface, 'Choice1', 'Terminal', "LocKey#49422" );
stateContext.SetPermanentBoolParameter( 'isTerminalInputHintDisplayed', true, true );
}
protected const function RemoveTerminalInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'Terminal' );
}
stateContext.RemovePermanentBoolParameter( 'isTerminalInputHintDisplayed' );
}
protected const function ShowGenericExplorationInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( stateContext.GetStateMachineCurrentState( 'CombatGadget' ) == 'combatGadgetCharge' )
{
ShowInputHint( scriptInterface, 'CancelChargingCG', 'Locomotion', "LocKey#49906" );
}
else if( !( IsEmptyHandsForced( stateContext, scriptInterface ) ) )
{
ShowInputHint( scriptInterface, 'SwitchItem', 'Locomotion', "LocKey#45381" );
}
ShowCrouchInputHint( stateContext, scriptInterface, 'Locomotion' );
stateContext.SetPermanentBoolParameter( 'isLocomotionInputHintDisplayed', true, true );
}
protected function RemoveGenericExplorationInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'Locomotion' );
}
stateContext.RemovePermanentBoolParameter( 'isCrouchInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isLocomotionInputHintDisplayed' );
}
protected const function ShowMeleeInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
var weapon : WeaponObject;
var isThrowable : Bool;
var isAiming : Bool;
weapon = GameObject.GetActiveWeapon( GameInstance.GetPlayerSystem( scriptInterface.GetGame() ).GetLocalPlayerMainGameObject() );
isThrowable = weapon.IsThrowable();
isAiming = stateContext.IsStateActive( 'UpperBody', 'aimingState' );
ShowInputHint( scriptInterface, 'MeleeAttack', 'Melee', ( ( isThrowable && isAiming ) ? ( "LocKey#17844" ) : ( "LocKey#40351" ) ), inkInputHintHoldIndicationType.Press, false, 1 );
ShowInputHint( scriptInterface, 'MeleeBlock', 'Melee', ( ( isThrowable ) ? ( "LocKey#45379" ) : ( "LocKey#36191" ) ), inkInputHintHoldIndicationType.Press, true, 2 );
ShowDodgeInputHint( stateContext, scriptInterface, 'Melee' );
if( !( stateContext.GetBoolParameter( 'isCrouchInputHintDisplayed', true ) ) && ( ( gamePSMCombat )( scriptInterface.localBlackboard.GetInt( GetAllBlackboardDefs().PlayerStateMachine.Combat ) ) ) != gamePSMCombat.InCombat )
{
ShowCrouchInputHint( stateContext, scriptInterface, 'Melee' );
}
stateContext.SetPermanentBoolParameter( 'isMeleeInputHintDisplayed', true, true );
stateContext.SetPermanentBoolParameter( 'isThrowInputHintDisplayed', isThrowable && isAiming, true );
}
protected function RemoveMeleeInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'Melee' );
}
stateContext.RemovePermanentBoolParameter( 'isMeleeInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isThrowInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isCrouchInputHintDisplayed' );
}
protected const function ShowRangedInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
var isChargeInputHintDisplayed : Bool;
var isChargeRangedWeapon : Bool;
isChargeInputHintDisplayed = stateContext.GetBoolParameter( 'isChargeInputHintDisplayed', true );
isChargeRangedWeapon = IsChargeRangedWeapon( scriptInterface );
if( !( isChargeInputHintDisplayed ) && isChargeRangedWeapon )
{
ShowInputHint( scriptInterface, 'RangedAttack', 'Ranged', "LocKey#47919", inkInputHintHoldIndicationType.FromInputConfig, true, 0 );
stateContext.SetPermanentBoolParameter( 'isChargeInputHintDisplayed', true, true );
}
if( !( stateContext.GetBoolParameter( 'isQuickMeleeInputHintDisplayed', true ) ) && !( StatusEffectSystem.ObjectHasStatusEffectWithTag( scriptInterface.executionOwner, 'NoQuickMelee' ) ) )
{
ShowInputHint( scriptInterface, 'QuickMelee', 'Ranged', "LocKey#45380", inkInputHintHoldIndicationType.FromInputConfig, true, 1 );
stateContext.SetPermanentBoolParameter( 'isQuickMeleeInputHintDisplayed', true, true );
}
if( !( stateContext.GetBoolParameter( 'isRangedInputHintDisplayed', true ) ) )
{
ShowInputHint( scriptInterface, 'Reload', 'Ranged', "LocKey#36198", inkInputHintHoldIndicationType.FromInputConfig, true, 2 );
stateContext.SetPermanentBoolParameter( 'isRangedInputHintDisplayed', true, true );
}
if( ( ( !( stateContext.GetBoolParameter( 'isRangedDodgeInputHintDisplayed', true ) ) && scriptInterface.HasStatFlag( gamedataStatType.HasDodge ) ) && !( stateContext.IsStateActive( 'UpperBody', 'aimingState' ) ) ) || scriptInterface.HasStatFlag( gamedataStatType.CanAimWhileDodging ) )
{
ShowDodgeInputHint( stateContext, scriptInterface, 'Ranged' );
stateContext.SetPermanentBoolParameter( 'isRangedDodgeInputHintDisplayed', true, true );
}
if( !( stateContext.GetBoolParameter( 'isCrouchInputHintDisplayed', true ) ) && ( ( gamePSMCombat )( scriptInterface.localBlackboard.GetInt( GetAllBlackboardDefs().PlayerStateMachine.Combat ) ) ) != gamePSMCombat.InCombat )
{
ShowCrouchInputHint( stateContext, scriptInterface, 'Ranged' );
}
}
protected function RemoveRangedInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'Ranged' );
}
stateContext.RemovePermanentBoolParameter( 'isChargeInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isQuickMeleeInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isRangedInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isRangedDodgeInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isCrouchInputHintDisplayed' );
}
protected const function ShowDodgeInputHint( stateContext : StateContext, scriptInterface : StateGameScriptInterface, source : CName )
{
var gamepadInputSchemeBB : IBlackboard;
var gamepadInputScheme : Uint32;
gamepadInputSchemeBB = GameInstance.GetBlackboardSystem( scriptInterface.GetGame() ).Get( GetAllBlackboardDefs().InputSchemes );
gamepadInputScheme = gamepadInputSchemeBB.GetUint( GetAllBlackboardDefs().InputSchemes.Scheme );
if( scriptInterface.executionOwner.PlayerLastUsedKBM() )
{
ShowInputHint( scriptInterface, 'Dodge', source, "LocKey#87591", inkInputHintHoldIndicationType.FromInputConfig, true, 3 );
}
else
{
if( gamepadInputScheme == ( ( Uint32 )( InputScheme.LEGACY ) ) )
{
ShowInputHint( scriptInterface, 'UI_FakeDodge', source, "LocKey#36192", inkInputHintHoldIndicationType.Press, false, 3, inkInputHintKeyCombinationType.And );
}
else
{
ShowInputHint( scriptInterface, 'UI_FakeDodge', source, "LocKey#87591", inkInputHintHoldIndicationType.Press, false, 3, inkInputHintKeyCombinationType.And );
}
}
}
protected const function ShowCrouchInputHint( stateContext : StateContext, scriptInterface : StateGameScriptInterface, source : CName )
{
if( !( stateContext.GetBoolParameter( 'isCrouchInputHintDisplayed', true ) ) )
{
ShowInputHint( scriptInterface, 'ToggleCrouch', source, "LocKey#36202", inkInputHintHoldIndicationType.FromInputConfig, true, ( ( Int32 )( gameuiInputHintSortingPriority.Bottom ) ) );
stateContext.SetPermanentBoolParameter( 'isCrouchInputHintDisplayed', true, true );
}
}
protected const function ShowVehicleDriverInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowVehicleDrawWeaponInputHint( stateContext, scriptInterface );
ShowInputHint( scriptInterface, 'ToggleVehCamera', 'VehicleDriver', "LocKey#36194", inkInputHintHoldIndicationType.FromInputConfig, true, 2 );
ShowVehicleExitInputHint( stateContext, scriptInterface, 'VehicleDriver' );
stateContext.SetPermanentBoolParameter( 'isDriverInputHintDisplayed', true, true );
}
protected const function RemoveVehicleDriverInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHint( scriptInterface, 'VehicleInsideWheel', 'UI_DPad' );
RemoveInputHintsBySource( scriptInterface, 'VehicleDriver' );
}
stateContext.RemovePermanentBoolParameter( 'isDriverInputHintDisplayed' );
}
protected const function ShowVehicleRestrictedInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowInputHint( scriptInterface, 'ToggleVehCamera', 'VehicleDriver', "LocKey#36194", inkInputHintHoldIndicationType.FromInputConfig, true );
ShowVehicleExitInputHint( stateContext, scriptInterface, 'VehicleDriver' );
}
protected const function RemoveVehicleRestrictedInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'VehicleDriver' );
}
}
protected const function ShowVehiclePassengerInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowVehicleExitInputHint( stateContext, scriptInterface, 'VehiclePassenger' );
stateContext.SetPermanentBoolParameter( 'isPassengerInputHintDisplayed', true, true );
}
protected const function RemoveVehiclePassengerInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHint( scriptInterface, 'VehicleInsideWheel', 'UI_DPad' );
RemoveInputHintsBySource( scriptInterface, 'VehiclePassenger' );
}
stateContext.RemovePermanentBoolParameter( 'isPassengerInputHintDisplayed' );
}
protected const function ShowVehicleRemoteControlDriverInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowInputHint( scriptInterface, 'ToggleVehCamera', 'VehicleRemoteControlDrive', "LocKey#36194" );
ShowInputHint( scriptInterface, 'Exit', 'VehicleRemoteControlDrive', "LocKey#36196", inkInputHintHoldIndicationType.FromInputConfig, true );
}
protected const function RemoveVehicleRemoteControlDriverInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'VehicleRemoteControlDrive' );
}
}
protected const function ShowVehicleDriverCombatInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowVehicleDriverCombatInputHintsInternal( 'VehicleDriverCombat', stateContext, scriptInterface );
}
protected const function RemoveVehicleDriverCombatInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'VehicleDriverCombat' );
}
stateContext.RemovePermanentBoolParameter( 'isDriverCombatScannerInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isDriverCombatInputHintDisplayed' );
}
protected const function ShowVehicleDriverCombatTPPInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowVehicleDriverCombatInputHintsInternal( 'VehicleDriverCombatTPP', stateContext, scriptInterface );
}
protected const function RemoveVehicleDriverCombatTPPInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'VehicleDriverCombatTPP' );
}
stateContext.RemovePermanentBoolParameter( 'isDriverCombatScannerInputHintDisplayed' );
stateContext.RemovePermanentBoolParameter( 'isDriverCombatInputHintDisplayed' );
}
private const function ShowVehicleDriverCombatInputHintsInternal( source : CName, stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
var vehicleRecord : Vehicle_Record;
var vehicle : weak< VehicleObject >;
var weapon : WeaponObject;
var isThrowable, isAiming : Bool;
VehicleComponent.GetVehicle( scriptInterface.executionOwner.GetGame(), scriptInterface.executionOwner, vehicle );
vehicleRecord = vehicle.GetRecord();
if( stateContext.GetBoolParameter( 'inMeleeDriverCombat', true ) )
{
RemoveInputHint( scriptInterface, 'UI_FakeRangedAttack', source );
RemoveInputHint( scriptInterface, 'UI_FakeCameraAim', source );
weapon = GameObject.GetActiveWeapon( GameInstance.GetPlayerSystem( scriptInterface.GetGame() ).GetLocalPlayerMainGameObject() );
isThrowable = weapon.IsThrowable();
isAiming = stateContext.IsStateActive( 'UpperBody', 'aimingState' );
ShowInputHint( scriptInterface, 'MeleeAttack', source, ( ( isThrowable && isAiming ) ? ( "LocKey#17844" ) : ( "LocKey#40351" ) ), inkInputHintHoldIndicationType.Press, true, 1 );
ShowInputHint( scriptInterface, 'MeleeBlock', source, ( ( isThrowable ) ? ( "LocKey#45379" ) : ( "LocKey#36191" ) ), inkInputHintHoldIndicationType.Press, true, 2 );
}
else
{
RemoveInputHint( scriptInterface, 'MeleeAttack', source );
RemoveInputHint( scriptInterface, 'MeleeBlock', source );
ShowInputHint( scriptInterface, 'UI_FakeRangedAttack', source, "LocKey#36197", inkInputHintHoldIndicationType.Press, false, 1 );
ShowInputHint( scriptInterface, 'UI_FakeCameraAim', source, "LocKey#45379", inkInputHintHoldIndicationType.FromInputConfig, true, 2 );
}
if( vehicleRecord.VehDataPackageHandle().DriverCombat().Type() != gamedataDriverCombatType.MountedWeapons || vehicle.CanSwitchWeapons() )
{
ShowInputHint( scriptInterface, 'SwitchItem', source, "LocKey#77771", inkInputHintHoldIndicationType.FromInputConfig, false, 3 );
}
ShowInputHint( scriptInterface, 'ExitCombatMode', source, "LocKey#87490", inkInputHintHoldIndicationType.FromInputConfig, true, 5 );
ShowInputHint( scriptInterface, 'ToggleVehCamera', source, "LocKey#36194", inkInputHintHoldIndicationType.FromInputConfig, true, 6 );
stateContext.SetPermanentBoolParameter( 'isDriverCombatInputHintDisplayed', true, true );
if( scriptInterface.executionOwner.PlayerLastUsedKBM() )
{
RemoveInputHint( scriptInterface, 'UI_FakeDriverCombatControllerVisionActivation', source );
stateContext.RemovePermanentBoolParameter( 'isDriverCombatScannerInputHintDisplayed' );
}
else if( EquipmentSystem.IsCyberdeckEquipped( scriptInterface.executionOwner ) && !( QuickhackModule.IsQuickhackBlockedByScene( scriptInterface.executionOwner ) ) )
{
ShowInputHint( scriptInterface, 'UI_FakeDriverCombatControllerVisionActivation', source, "LocKey#52040", inkInputHintHoldIndicationType.FromInputConfig, false, 4, inkInputHintKeyCombinationType.And );
stateContext.SetPermanentBoolParameter( 'isDriverCombatScannerInputHintDisplayed', true, true );
}
}
protected const function ShowVehicleDrawWeaponInputHint( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
var isVehicleCombatModeBlocked : Bool;
isVehicleCombatModeBlocked = IsVehicleBlockingCombat( scriptInterface ) || IsEmptyHandsForced( stateContext, scriptInterface );
if( isVehicleCombatModeBlocked )
{
RemoveInputHint( scriptInterface, 'EnterCombatMode', 'VehicleDriver' );
stateContext.SetPermanentBoolParameter( 'IsVehicleCombatModeBlocked', true, true );
return;
}
ShowInputHint( scriptInterface, 'EnterCombatMode', 'VehicleDriver', "LocKey#45381", inkInputHintHoldIndicationType.FromInputConfig, true, 1 );
stateContext.SetPermanentBoolParameter( 'IsVehicleCombatModeBlocked', false, true );
}
protected const function ShowVehicleExitInputHint( stateContext : StateContext, scriptInterface : StateGameScriptInterface, source : CName )
{
var vehicle : weak< GameObject >;
if( IsExitVehicleBlocked( scriptInterface ) )
{
RemoveInputHint( scriptInterface, 'Exit', source );
stateContext.SetPermanentBoolParameter( 'IsExitVehicleBlocked', true, true );
return;
}
VehicleComponent.GetVehicle( scriptInterface.owner.GetGame(), scriptInterface.executionOwner, vehicle );
if( vehicle = ( ( BikeObject )( vehicle ) ) )
{
ShowInputHint( scriptInterface, 'Exit', source, "LocKey#53066", inkInputHintHoldIndicationType.FromInputConfig, true, 127 );
}
else
{
ShowInputHint( scriptInterface, 'Exit', source, "LocKey#36196", inkInputHintHoldIndicationType.FromInputConfig, true, 127 );
}
stateContext.SetPermanentBoolParameter( 'IsExitVehicleBlocked', false, true );
}
protected const function ShowVehiclePassengerCombatInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowInputHint( scriptInterface, 'RangedAttack', 'VehiclePassengerCombat', "LocKey#36197", inkInputHintHoldIndicationType.Press );
ShowInputHint( scriptInterface, 'Reload', 'VehiclePassengerCombat', "LocKey#36198" );
if( StatusEffectSystem.ObjectHasStatusEffectWithTag( scriptInterface.executionOwner, 'VehicleScene' ) )
{
ShowInputHint( scriptInterface, 'WeaponWheel', 'VehiclePassengerCombat', "LocKey#36199" );
}
stateContext.SetPermanentBoolParameter( 'isPassengerCombatInputHintDisplayed', true, true );
}
protected const function RemoveVehiclePassengerCombatInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'VehiclePassengerCombat' );
}
stateContext.RemovePermanentBoolParameter( 'isPassengerCombatInputHintDisplayed' );
}
protected const function ShowAutodriveInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowVehicleDrawWeaponInputHint( stateContext, scriptInterface );
ShowInputHint( scriptInterface, 'HoldCinematicCamera', 'Autodrive', "LocKey#96518", inkInputHintHoldIndicationType.FromInputConfig, true, 1 );
ShowInputHint( scriptInterface, 'ToggleVehCamera', 'Autodrive', "LocKey#36194", inkInputHintHoldIndicationType.FromInputConfig, true, 2 );
ShowVehicleExitInputHint( stateContext, scriptInterface, 'Autodrive' );
stateContext.SetPermanentBoolParameter( 'isAutodriveInputHintDisplayed', true, true );
}
protected const function RemoveAutodriveInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'Autodrive' );
}
stateContext.RemovePermanentBoolParameter( 'isAutodriveInputHintDisplayed' );
}
protected const function ShowCinematicCameraInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowVehicleDrawWeaponInputHint( stateContext, scriptInterface );
ShowInputHint( scriptInterface, 'HoldCinematicCamera', 'CinematicCamera', "LocKey#96675", inkInputHintHoldIndicationType.FromInputConfig, true, 1 );
stateContext.SetPermanentBoolParameter( 'isCinematicCameraInputHintDisplayed', true, true );
}
protected const function RemoveCinematicCameraInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'CinematicCamera' );
}
stateContext.RemovePermanentBoolParameter( 'isCinematicCameraInputHintDisplayed' );
}
protected const function ShowDelamainInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowInputHint( scriptInterface, 'HoldCinematicCamera', 'DelamainTaxi', "LocKey#96518", inkInputHintHoldIndicationType.FromInputConfig, true, 1 );
ShowInputHint( scriptInterface, 'ToggleVehCamera', 'DelamainTaxi', "LocKey#36194", inkInputHintHoldIndicationType.FromInputConfig, true, 2 );
ShowVehicleExitInputHint( stateContext, scriptInterface, 'DelamainTaxi' );
stateContext.SetPermanentBoolParameter( 'isDelamainInputHintDisplayed', true, true );
}
protected const function RemoveDelamainInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'DelamainTaxi' );
}
stateContext.RemovePermanentBoolParameter( 'isDelamainInputHintDisplayed' );
}
protected const function ShowSwimmingInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
ShowInputHint( scriptInterface, 'ToggleSprint', 'Swimming', "LocKey#40155" );
ShowInputHint( scriptInterface, 'Jump', 'Swimming', "LocKey#40158", inkInputHintHoldIndicationType.Press );
ShowInputHint( scriptInterface, 'Dive', 'Swimming', "LocKey#40157" );
stateContext.SetPermanentBoolParameter( 'isSwimmingInputHintDisplayed', true, true );
}
protected const function RemoveSwimmingInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_isGameplayInputHintManagerInitialized )
{
RemoveInputHintsBySource( scriptInterface, 'Swimming' );
}
stateContext.RemovePermanentBoolParameter( 'isSwimmingInputHintDisplayed' );
}
protected function RemoveAllInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
RemoveGenericExplorationInputHints( stateContext, scriptInterface );
RemoveRangedInputHints( stateContext, scriptInterface );
RemoveMeleeInputHints( stateContext, scriptInterface );
RemoveBodyCarryInputHints( stateContext, scriptInterface );
RemoveLadderInputHints( stateContext, scriptInterface );
RemoveSwimmingInputHints( stateContext, scriptInterface );
RemoveVehicleDriverInputHints( stateContext, scriptInterface );
RemoveVehicleDriverCombatInputHints( stateContext, scriptInterface );
RemoveVehicleDriverCombatTPPInputHints( stateContext, scriptInterface );
RemoveVehicleRemoteControlDriverInputHints( stateContext, scriptInterface );
RemoveVehiclePassengerCombatInputHints( stateContext, scriptInterface );
RemoveAutodriveInputHints( stateContext, scriptInterface );
RemoveCinematicCameraInputHints( stateContext, scriptInterface );
RemoveDelamainInputHints( stateContext, scriptInterface );
RemoveVehiclePassengerInputHints( stateContext, scriptInterface );
RemoveVehicleRemoteControlDriverInputHints( stateContext, scriptInterface );
RemoveVehicleRestrictedInputHints( stateContext, scriptInterface );
}
protected function SetBaseContextInputHints( context : ActiveBaseContext, stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( context == ActiveBaseContext.None )
{
return;
}
RemoveAllInputHints( stateContext, scriptInterface );
switch( context )
{
case ActiveBaseContext.Locomotion:
{
ShowGenericExplorationInputHints( stateContext, scriptInterface );
break;
}
case ActiveBaseContext.Ladder:
{
ShowLadderInputHints( stateContext, scriptInterface );
break;
}
case ActiveBaseContext.Swimming:
{
ShowSwimmingInputHints( stateContext, scriptInterface );
break;
}
case ActiveBaseContext.BodyCarring:
{
ShowBodyCarryInputHints( stateContext, scriptInterface );
break;
}
case ActiveBaseContext.MeleeWeapon:
{
ShowMeleeInputHints( stateContext, scriptInterface );
break;
}
case ActiveBaseContext.RangedWeapon:
{
ShowRangedInputHints( stateContext, scriptInterface );
break;
}
case ActiveBaseContext.BodyCarringWithRangedWeapon:
{
ShowBodyCarryInputHints( stateContext, scriptInterface );
ShowRangedInputHints( stateContext, scriptInterface );
break;
}
default:
{
break;
}
}
}
protected function UpdateWeaponInputHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface ) : ActiveBaseContext
{
var isExploring : Bool;
var isExaminingDevice : Bool;
var isDeviceControlled : Bool;
var inEquipState : Bool;
var rightHandWeapon : weak< WeaponObject >;
var isRangedWeaponEquipped : Bool;
var isMeleeWeaponEquipped : Bool;
var canDisplayChargeInputHint : Bool;
var canDisplayThrowInputHint : Bool;
var canDisplayRangedDodgeInputHint : Bool;
var canDisplayCrouchInputHint : Bool;
var canDisplayThrowCarriedNPCInputHint : Bool;
var isMeleeInputHintDisplayed : Bool;
var isThrowInputHintDisplayed : Bool;
var isRangedInputHintDisplayed : Bool;
var isChargeInputHintDisplayed : Bool;
var isRangedDodgeInputHintDisplayed : Bool;
var isCrouchInputHintDisplayed : Bool;
var isThrowCarriedNPCInputHintDisplayed : Bool;
var context : ActiveBaseContext;
isExploring = IsInHighLevelState( stateContext, 'exploration' );
isExaminingDevice = IsExaminingDevice( scriptInterface ) || IsInteractingWithTerminal( scriptInterface );
isDeviceControlled = scriptInterface.executionOwner.GetTakeOverControlSystem().IsDeviceControlled();
inEquipState = ( IsRightHandInEquippedState( stateContext ) || IsRightHandInEquippingState( stateContext ) ) || IsInFirstEquip( stateContext );
rightHandWeapon = GetActiveWeapon( scriptInterface );
isRangedWeaponEquipped = inEquipState && rightHandWeapon.IsRanged();
isMeleeWeaponEquipped = ( inEquipState && !( isRangedWeaponEquipped ) ) && rightHandWeapon.IsMelee();
canDisplayChargeInputHint = isRangedWeaponEquipped && IsChargeRangedWeapon( scriptInterface );
canDisplayThrowInputHint = ( isMeleeWeaponEquipped && rightHandWeapon.IsThrowable() ) && stateContext.IsStateActive( 'UpperBody', 'aimingState' );
canDisplayRangedDodgeInputHint = ( !( isRangedWeaponEquipped ) || !( stateContext.IsStateActive( 'UpperBody', 'aimingState' ) ) ) || scriptInterface.HasStatFlag( gamedataStatType.CanAimWhileDodging );
canDisplayCrouchInputHint = ( ( gamePSMCombat )( scriptInterface.localBlackboard.GetInt( GetAllBlackboardDefs().PlayerStateMachine.Combat ) ) ) != gamePSMCombat.InCombat;
canDisplayThrowCarriedNPCInputHint = scriptInterface.localBlackboard.GetBool( GetAllBlackboardDefs().PlayerStateMachine.CanThrowCarriedNPC );
isMeleeInputHintDisplayed = stateContext.GetBoolParameter( 'isMeleeInputHintDisplayed', true );
isThrowInputHintDisplayed = stateContext.GetBoolParameter( 'isThrowInputHintDisplayed', true );
isRangedInputHintDisplayed = stateContext.GetBoolParameter( 'isRangedInputHintDisplayed', true );
isChargeInputHintDisplayed = stateContext.GetBoolParameter( 'isChargeInputHintDisplayed', true );
isRangedDodgeInputHintDisplayed = stateContext.GetBoolParameter( 'isRangedDodgeInputHintDisplayed', true );
isCrouchInputHintDisplayed = stateContext.GetBoolParameter( 'isCrouchInputHintDisplayed', true );
isThrowCarriedNPCInputHintDisplayed = stateContext.GetBoolParameter( 'isThrowCarriedNPCInputHintDisplayed', true );
if( ( ( isMeleeWeaponEquipped && isExploring ) && !( isExaminingDevice ) ) && !( isDeviceControlled ) )
{
if( isCrouchInputHintDisplayed && !( canDisplayCrouchInputHint ) )
{
RemoveInputHint( scriptInterface, 'ToggleCrouch', 'Melee' );
stateContext.RemovePermanentBoolParameter( 'isCrouchInputHintDisplayed' );
}
if( ( ( ( !( isMeleeInputHintDisplayed ) || m_hasControllerChanged ) || m_hasControllerSchemeChanged ) || isThrowInputHintDisplayed != canDisplayThrowInputHint ) || ( !( isCrouchInputHintDisplayed ) && canDisplayCrouchInputHint ) )
{
return ActiveBaseContext.MeleeWeapon;
}
}
else if( isMeleeInputHintDisplayed && ( ( ( !( isMeleeWeaponEquipped ) || !( isExploring ) ) || isExaminingDevice ) || isDeviceControlled ) )
{
RemoveMeleeInputHints( stateContext, scriptInterface );
}
if( ( ( ( isRangedWeaponEquipped && !( rightHandWeapon.IsHeavyWeapon() ) ) && isExploring ) && !( isExaminingDevice ) ) && !( isDeviceControlled ) )
{
if( isChargeInputHintDisplayed && !( canDisplayChargeInputHint ) )
{
RemoveInputHint( scriptInterface, 'RangedAttack', 'Ranged' );
stateContext.RemovePermanentBoolParameter( 'isChargeInputHintDisplayed' );
}
if( isRangedDodgeInputHintDisplayed && !( canDisplayRangedDodgeInputHint ) )
{
RemoveInputHint( scriptInterface, 'Dodge', 'Ranged' );
stateContext.RemovePermanentBoolParameter( 'isRangedInputHintDisplayed' );
}
if( isCrouchInputHintDisplayed && !( canDisplayCrouchInputHint ) )
{
RemoveInputHint( scriptInterface, 'ToggleCrouch', 'Ranged' );
stateContext.RemovePermanentBoolParameter( 'isCrouchInputHintDisplayed' );
}
if( ( ( ( ( ( !( isRangedInputHintDisplayed ) || m_hasControllerChanged ) || m_hasControllerSchemeChanged ) || ( !( isChargeInputHintDisplayed ) && canDisplayChargeInputHint ) ) || ( !( isRangedDodgeInputHintDisplayed ) && canDisplayRangedDodgeInputHint ) ) || ( !( isCrouchInputHintDisplayed ) && canDisplayCrouchInputHint ) ) || ( !( isThrowCarriedNPCInputHintDisplayed ) && canDisplayThrowCarriedNPCInputHint ) )
{
if( stateContext.GetBoolParameter( 'isBodyCarryInputHintDisplayed', true ) )
{
return ActiveBaseContext.BodyCarringWithRangedWeapon;
}
else
{
return ActiveBaseContext.RangedWeapon;
}
}
}
else if( isRangedInputHintDisplayed && ( ( ( ( !( isRangedWeaponEquipped ) || rightHandWeapon.GetCurrentTriggerMode().Type() == gamedataTriggerMode.Charge != isChargeInputHintDisplayed ) || !( isExploring ) ) || isExaminingDevice ) || isDeviceControlled ) )
{
RemoveRangedInputHints( stateContext, scriptInterface );
}
return context;
}
protected function ConsumeControllerChange( stateContext : StateContext, scriptInterface : StateGameScriptInterface ) : Bool
{
var isKBMInputDevice : Bool;
isKBMInputDevice = scriptInterface.executionOwner.PlayerLastUsedKBM();
if( stateContext.GetBoolParameter( 'isKBMInputDevice', true ) && !( isKBMInputDevice ) )
{
stateContext.SetPermanentBoolParameter( 'isKBMInputDevice', false, true );
return true;
}
if( !( stateContext.GetBoolParameter( 'isKBMInputDevice', true ) ) && isKBMInputDevice )
{
stateContext.SetPermanentBoolParameter( 'isKBMInputDevice', true, true );
return true;
}
return false;
}
protected function ConsumeInputSchemeChange() : Bool
{
var oldValue : Bool;
oldValue = m_onInputSchemeChanged;
m_onInputSchemeChanged = false;
return oldValue;
}
}
class InitialStateDecisions extends InputContextTransitionDecisions
{
protected export const function ToUiContext( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
var player : weak< PlayerPuppet >;
var expectedRecordID : TweakDBID;
var recordID : TweakDBID;
player = ( ( PlayerPuppet )( scriptInterface.executionOwner ) );
if( player )
{
expectedRecordID = T"Character.Player_Puppet_Menu";
recordID = player.GetRecordID();
if( recordID == expectedRecordID )
{
return true;
}
}
return false;
}
}
class DeviceControlContextDecisions extends InputContextTransitionDecisions
{
private var m_callbackID : CallbackHandle;
protected export function OnAttach( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface )
{
var allBlackboardDef : AllBlackboardDefinitions;
if( scriptInterface.localBlackboard )
{
allBlackboardDef = GetAllBlackboardDefs();
m_callbackID = scriptInterface.localBlackboard.RegisterListenerBool( allBlackboardDef.PlayerStateMachine.IsControllingDevice, this, 'OnControllingDeviceChange' );
EnableOnEnterCondition( scriptInterface.localBlackboard.GetBool( allBlackboardDef.PlayerStateMachine.IsControllingDevice ) );
}
}
protected export function OnDetach( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface )
{
m_callbackID = NULL;
}
protected event OnControllingDeviceChange( value : Bool )
{
EnableOnEnterCondition( value );
}
protected export const override function EnterCondition( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
return !( GetUIBlackboard( scriptInterface ).GetBool( GetAllBlackboardDefs().UI_QuickSlotsData.UIRadialContextRequest ) );
}
}
class DeviceControlContextEvents extends InputContextTransitionEvents
{
protected export virtual function OnEnter( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
RemoveAllInputHints( stateContext, scriptInterface );
}
}
class BraindanceContextDecisions extends InputContextTransitionDecisions
{
protected export const override function EnterCondition( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
if( IsPlayerInBraindance( scriptInterface ) )
{
return true;
}
return false;
}
}
class DeadContextDecisions extends InputContextTransitionDecisions
{
private var m_callbackID : CallbackHandle;
protected export function OnAttach( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface )
{
var allBlackboardDef : AllBlackboardDefinitions;
if( scriptInterface.localBlackboard )
{
allBlackboardDef = GetAllBlackboardDefs();
m_callbackID = scriptInterface.localBlackboard.RegisterListenerInt( allBlackboardDef.PlayerStateMachine.Vitals, this, 'OnVitalsChanged' );
OnVitalsChanged( scriptInterface.localBlackboard.GetInt( allBlackboardDef.PlayerStateMachine.Vitals ) );
}
}
protected export function OnDetach( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface )
{
m_callbackID = NULL;
}
protected event OnVitalsChanged( value : Int32 )
{
EnableOnEnterCondition( value == ( ( Int32 )( gamePSMVitals.Dead ) ) );
}
protected export const override function EnterCondition( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
return true;
}
}
class BaseContextDecisions extends InputContextTransitionDecisions
{
protected export const function ToVehicleRemoteControlDriverContext( const stateContext : StateContext, const scriptInterface : StateGameScriptInterface ) : Bool
{
var isVehicleRemoteControlled : Bool;
isVehicleRemoteControlled = IsVehicleRemoteControlled( scriptInterface );
if( isVehicleRemoteControlled )
{
return true;
}
return false;
}
}
class BaseContextEvents extends InputContextTransitionEvents
{
protected export function OnUpdate( timeDelta : Float, stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
if( m_gameplaySettings.GetIsInputHintEnabled() && m_isGameplayInputHintManagerInitialized )
{
UpdateHints( stateContext, scriptInterface );
}
}
private function UpdateHints( stateContext : StateContext, scriptInterface : StateGameScriptInterface )
{
var context : ActiveBaseContext;
var contextTemp : ActiveBaseContext;
if( ShouldForceRefreshInputHints( stateContext ) )
{
RemoveGenericExplorationInputHints( stateContext, scriptInterface );
RemoveLadderInputHints( stateContext, scriptInterface );
RemoveSwimmingInputHints( stateContext, scriptInterface );
RemoveBodyCarryInputHints( stateContext, scriptInterface );
RemoveMeleeInputHints( stateContext, scriptInterface );
RemoveRangedInputHints( stateContext, scriptInterface );
m_isGameplayInputHintRefreshRequired = false;
}
m_hasControllerChanged = ConsumeControllerChange( stateContext, scriptInterface );
m_hasControllerSchemeChanged = ConsumeInputSchemeChange();
context = UpdateLocomotionInputHints( stateContext, scriptInterface );
if( context == ActiveBaseContext.None )
{
context = UpdateLadderInputHints( stateContext, scriptInterface );
}
if( context == ActiveBaseContext.None )
{
context = UpdateSwimmingInputHints( stateContext, scriptInterface );
}
if( context == ActiveBaseContext.None )
{
context = UpdateBodyCarryInputHints( stateContext, scriptInterface );
}