-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvehicles.script
More file actions
1788 lines (1656 loc) · 62.1 KB
/
Copy pathvehicles.script
File metadata and controls
1788 lines (1656 loc) · 62.1 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
import class VehicleObject extends GameObject
{
private var m_vehicleComponent : weak< VehicleComponent >;
private var m_uiComponent : weak< worlduiWidgetComponent >;
protected var m_crowdMemberComponent : CrowdMemberBaseComponent;
private var m_attitudeAgent : AttitudeAgent;
private var m_hitTimestamp : Float;
private var m_drivingTrafficPattern : CName;
private var m_onPavement : Bool;
private var m_inTrafficLane : Bool;
private var m_timesSentReactionEvent : Int32;
private var m_timesToResendHandleReactionEvent : Int32;
private var m_hasReactedToStimuli : Bool;
private var m_gotStuckIncrement : Int32;
private var m_waitForPassengersToSpawnEventDelayID : DelayID;
private var m_triggerPanicDrivingEventDelayID : DelayID;
private var m_reactionTriggerEvent : HandleReactionEvent;
private var m_fearInside : Bool;
private var m_photoModeActiveListener : CallbackHandle;
private var m_vehicleUpsideDown : Bool;
private var m_isQhackUploadInProgress : Bool;
private var m_hitByPlayer : Bool;
private var m_currentlyUploadingAction : weak< ScriptableDeviceAction >;
private var m_bumpedRecently : Int32;
private var m_bumpTimestamp : Float;
private var m_minUnconsciousImpact : Float;
private var m_driverUnconscious : Bool;
private var m_abandoned : Bool;
public const override function IsVehicle() : Bool
{
return true;
}
public const override function IsPrevention() : Bool
{
return m_vehicleComponent && m_vehicleComponent.HasPreventionPassenger();
}
public import final function GetBlackboard() : IBlackboard;
public import const final function GetRecord() : weak< Vehicle_Record >;
public import const final function IsVehicleRemoteControlled() : Bool;
public import const final function IsVehicleAccelerateQuickhackActive() : Bool;
public import const final function IsVehicleForceBrakesQuickhackActive() : Bool;
public import const final function GetDistanceToPlayerSquared() : Float;
public import const final function IsHackable() : Bool;
public import const final function IsVehicleInsideInnerAreaOfAreaSpeedLimiter() : Bool;
public import const final function IsPlayerMounted() : Bool;
public import const final function IsPlayerDriver() : Bool;
public import const final function HasPassengers() : Bool;
public import const final function HasTrafficSlot() : Bool;
public import final function PreHijackPrepareDriverSlot();
public import final function CanUnmount( isPlayer : Bool, mountedObject : weak< GameObject >, optional checkSpecificDirection : vehicleExitDirection ) : vehicleUnmountPosition;
public import final function DetermineCoolExitImpulseLevel( mountedObject : weak< GameObject >, maxImpulseHeightThreshold : Float, minImpulseHeightThreshold : Float ) : vehicleCoolExitImpulseLevel;
public import final function ToggleRadioReceiver( toggle : Bool );
public import final function SetRadioReceiverStation( stationIndex : Uint32 );
public import final function NextRadioReceiverStation();
public import final function SetRadioTier( radioTier : Uint32, overrideTier : Bool );
public import final function ToggleHorn( toggle : Bool, optional isPolice : Bool );
public import final function ToggleSiren( toggle : Bool );
public import final function NotifyWindowChange( windowName : CName, isOpened : Bool );
public import final function DetachPart( partName : CName );
public import final function DetachAllParts();
public import final function SetHasExploded();
public import final function HasOccupantSlot( slotName : CName ) : Bool;
public import const final function GetRecordID() : TweakDBID;
public import final function GetAccessoryController() : vehicleController;
public import const final function IsAirControlEnabled() : Bool;
public import final function EnableAirControl( toggle : Bool );
public import const final function IsInAir() : Bool;
public import const final function IsLeaningOnOneWheel() : Bool;
public import const final function IsFlippedOver() : Bool;
public import const final function IsSkidding( wheelSlipThreshold : Float ) : Bool;
public import final function GetCameraManager() : VehicleCameraManager;
public import const final function IsPlayerVehicle() : Bool;
public import const final function IsPlayerActiveVehicle() : Bool;
public import const final function IsCrowdVehicle() : Bool;
public import const final function IsVehicleParked() : Bool;
public import const final function IsAutoDriveModeEnabled() : Bool;
public import final function SetVehicleRemoteControlled( enable : Bool, shouldUnseatPassengers : Bool, shouldModifyInteractionState : Bool );
public import final function ToggleVehicleRemoteControlCamera();
public import final function SetIsHackable( enable : Bool );
public import final function ActivateNetrunnerQuickhack( chooseHack : VehicleNetrunnerQuickhackType );
public import final function IsRadioReceiverActive() : Bool;
public import final function WasRadioReceiverPlaying() : Bool;
public import final function GetCurrentRadioIndex() : Uint32;
public import final function GetRadioReceiverStationName() : CName;
public import final function GetRadioReceiverTrackName() : CName;
public import final function GetAnimsetOverrideForPassenger( slotName : CName ) : CName;
public import final function GetAnimsetOverrideForPassengerFromSlotName( slotName : CName ) : CName;
public import final function GetAnimsetOverrideForPassengerFromBoneName( boneName : CName ) : CName;
public import final function GetBoneNameFromSlot( slotName : CName ) : CName;
public import final function GetSlotIdForMountedObject( mountedObject : weak< GameObject > ) : CName;
public import final function ShouldDamageSystemIgnoreHit( hitComponentName : CName ) : Bool;
public import const final function GetCurrentSlotLocalPathLength() : Float;
public import const final function GetCurrentSlotLocalPathProgression() : Float;
public import const final function GetCurrentSlotEstimatedTimeToArrival() : Float;
public import final function TurnVehicleOn( on : Bool );
public import final function TurnEngineOn( on : Bool );
public import final function LockVehicleOnState( shouldLock : Bool );
public import const final function IsVehicleTurnedOn() : Bool;
public import const final function IsEngineTurnedOn() : Bool;
public import const final function IsVehicleOnStateLocked() : Bool;
public import final function ForceBrakesFor( seconds : Float );
public import final function ForceBrakesUntilStoppedOrFor( secondsToTimeout : Float, optional callback : vehicleForceBrakesCallbackListener );
public import final function ActivateTemporaryLossOfControl();
public import final function PhysicsWakeUp();
public import final function IsInTrafficPhysicsState() : Bool;
public import const final function IsExecutingAnyCommand() : Bool;
public import const final function GetAIComponent() : AIVehicleAgent;
public import const final function GetCustomizationComponent() : VehicleCustomizationComponent;
public import const final function IsChasingTarget() : Bool;
public import const final function GetTimeChasingTarget() : Float;
public import final function HasNavPathToTarget( targetID : EntityID, duration : Float, invert : Bool ) : Bool;
public import const final function IsPerformingPanicDriving() : Bool;
public import const final function IsPerformingSceneAnimation() : Bool;
public import const final function CanStartPanicDriving() : Bool;
public import final function EnableHighPriorityPanicDriving();
public import final function ApplyPermanentStun();
public import const final function CommandsFromDriverEnabled() : Bool;
public import const final function GetPoliceStrategy() : vehiclePoliceStrategy;
public import final function SetPoliceStrategy( strategy : vehiclePoliceStrategy );
public import const final function GetPoliceStrategyDestination() : Vector3;
public import final function SetPoliceStrategyDestination( dest : Vector4 );
public import final function AreFrontWheelsCentered() : Bool;
public import final function AddCollisionForce( force : Vector4 );
public import final function GetCollisionForce() : Vector4;
public import final function GetLinearVelocity() : Vector4;
public import final function GetTotalMass() : Float;
public import const final function CanSwitchWeapons() : Bool;
public import const final function GetActiveWeapons( out weaponList : array< weak< WeaponObject > > );
public import final function IsArmedVehicle() : Bool;
public import final function EnableNPCCombat( enable : Bool );
public import final function NPCShoot( target : Vector4, projectiles : Uint32 );
public import final function IsNPCShooting() : Bool;
public import final function EverPerformedChase() : Bool;
public import final function TrySetHitCooldown() : Bool;
public import final function ApplyAvgZOffset();
public final function GetCurrentSpeed() : Float
{
return GetBlackboard().GetFloat( GetAllBlackboardDefs().Vehicle.SpeedValue );
}
public const final function IsAbandoned() : Bool
{
return m_abandoned;
}
public import final function SetDestructionGridPointValues( layer : Uint32, values : Float[ 15 ], accumulate : Bool );
public import final function DestructionResetGrid();
public import final function DestructionResetGlass();
private import final function GetUIComponents() : array< worlduiWidgetComponent >;
public import final function SendDelayedFinishedMountingEventToPS( isMounting : Bool, slotID : CName, character : GameObject, delay : Float );
public const final function IsDestroyed() : Bool
{
return GetVehiclePS().GetIsDestroyed();
}
public const final function IsStolen() : Bool
{
return GetVehiclePS().GetIsStolen();
}
public const final function RecordHasTag( tag : CName ) : Bool
{
var vehicleRecord : Vehicle_Record;
if( !( VehicleComponent.GetVehicleRecord( this, vehicleRecord ) ) )
{
return false;
}
return RecordHasTag( vehicleRecord, tag );
}
public const final function RecordHasTag( vehicleRecord : Vehicle_Record, tag : CName ) : Bool
{
var vehicleTags : array< CName >;
vehicleTags = vehicleRecord.Tags();
if( vehicleTags.Contains( tag ) )
{
return true;
}
return false;
}
public const override function IsGameplayRelevant() : Bool
{
return false;
}
protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
{
EntityRequestComponentsInterface.RequestComponent( ri, 'controller', 'VehicleComponent', false );
EntityRequestComponentsInterface.RequestComponent( ri, 'CrowdMember', 'CrowdMemberBaseComponent', false );
EntityRequestComponentsInterface.RequestComponent( ri, 'AttitudeAgent', 'AttitudeAgent', true );
super.OnRequestComponents( ri );
}
protected event OnTakeControl( ri : EntityResolveComponentsInterface )
{
m_vehicleComponent = ( ( VehicleComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
m_crowdMemberComponent = ( ( CrowdMemberBaseComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'CrowdMember' ) ) );
m_attitudeAgent = ( ( AttitudeAgent )( EntityResolveComponentsInterface.GetComponent( ri, 'AttitudeAgent' ) ) );
super.OnTakeControl( ri );
}
protected event OnGameAttached()
{
super.OnGameAttached();
SetInteriorUIEnabled( false );
m_hitByPlayer = false;
if( ( GetVehiclePS().GetIsVehicleVisualCustomizationActive() && GetVehiclePS().GetIsVehicleApperanceCustomizationInDistanceTermination() ) && !( GetVehiclePS().GetIsVehicleVisualCustomizationBlockedByDamage() ) )
{
ExecuteVisualCustomizationWithDelay( true, false, false, 0.0 );
GameInstance.GetDelaySystem( GetGame() ).DelayEvent( this, new CheckVehicleVisialCustomizationDistanceTermination, 2.0 );
}
}
protected event OnDetach()
{
super.OnDetach();
GetVehiclePS().SetVehicleApperanceCustomizationInDistanceTermination( false );
}
protected event OnDeviceLinkRequest( evt : DeviceLinkRequest )
{
var link : VehicleDeviceLinkPS;
if( IsCrowdVehicle() )
{
return false;
}
link = VehicleDeviceLinkPS.CreateAndAcquirVehicleDeviceLinkPS( GetGame(), GetEntityID() );
if( link )
{
GameInstance.GetPersistencySystem( GetGame() ).QueuePSEvent( link.GetID(), link.GetClassName(), evt );
}
}
protected event OnEventReceived( stimEvent : StimuliEvent )
{
var mountInfos : array< MountingInfo >;
var delayReactionEvt : DelayReactionToMissingPassengersEvent;
mountInfos = GameInstance.GetMountingFacility( GetGame() ).GetMountingInfoMultipleWithIds( , GetEntityID() );
if( ( m_inTrafficLane && ( mountInfos.Size() == 0 ) ) && stimEvent.GetStimType() != gamedataStimType.Invalid )
{
delayReactionEvt = new DelayReactionToMissingPassengersEvent;
delayReactionEvt.stimEvent = stimEvent;
GameInstance.GetDelaySystem( GetGame() ).DelayEvent( this, delayReactionEvt, 2.0 );
}
}
protected event OnDelayReactionToMissingPassengersEvent( evt : DelayReactionToMissingPassengersEvent )
{
var mountInfos : array< MountingInfo >;
mountInfos = GameInstance.GetMountingFacility( GetGame() ).GetMountingInfoMultipleWithIds( , GetEntityID() );
if( mountInfos.Size() == 0 )
{
if( !( evt.delayedAlready ) && m_inTrafficLane )
{
evt.delayedAlready = true;
GameInstance.GetDelaySystem( GetGame() ).DelayEvent( this, evt, 2.0 );
}
}
else
{
VehicleComponent.QueueEventToAllPassengers( GetGame(), GetEntityID(), evt.stimEvent );
}
}
protected event OnTeleport()
{
var autodriveSystem : AutoDriveSystem;
if( IsAutoDriveModeEnabled() )
{
if( autodriveSystem = ( ( AutoDriveSystem )( GameInstance.GetScriptableSystemsContainer( GetGame() ).Get( 'AutoDriveSystem' ) ) ) )
{
autodriveSystem.QueueRequest( new StopAutoDriveOnTeleportRequest );
}
}
}
public const override function GetDeviceLink() : VehicleDeviceLinkPS
{
var link : VehicleDeviceLinkPS;
link = VehicleDeviceLinkPS.AcquireVehicleDeviceLink( GetGame(), GetEntityID() );
if( link )
{
return link;
}
return NULL;
}
protected override function SendEventToDefaultPS( evt : Event )
{
var persistentState : VehicleComponentPS;
persistentState = GetVehiclePS();
if( persistentState == NULL )
{
return;
}
GameInstance.GetPersistencySystem( GetGame() ).QueuePSEvent( persistentState.GetID(), persistentState.GetClassName(), evt );
}
protected event OnMountingEvent( evt : MountingEvent )
{
var mountChild : GameObject;
mountChild = ( ( GameObject )( GameInstance.FindEntityByID( GetGame(), evt.request.lowLevelMountingInfo.childId ) ) );
if( mountChild == NULL )
{
return false;
}
if( mountChild.IsPlayer() )
{
SetInteriorUIEnabled( true );
SyncVehicleVisualCustomizationDefinition();
GetVehicleComponent().EnableCustomizableAppearance( false );
if( ReevaluateStealing( mountChild, evt.request.lowLevelMountingInfo.slotId.id, evt.request.mountData.mountEventOptions.occupiedByNonFriendly ) )
{
StealVehicle( mountChild );
}
}
}
protected event OnVehicleFinishedMounting( evt : VehicleFinishedMountingEvent )
{
if( ( evt.isMounting && evt.character ) && evt.character.IsPlayer() )
{
m_abandoned = false;
if( ( GetVehiclePS().GetIsVehicleVisualCustomizationActive() && !( GetVehiclePS().GetIsVehicleApperanceCustomizationInDistanceTermination() ) ) && !( GetVehiclePS().GetIsVehicleVisualCustomizationBlockedByDamage() ) )
{
ExecuteVisualCustomizationWithDelay( true, false, false, 0.0 );
}
else
{
if( ( VehicleVisualCustomizationTemplate.IsValid( GetVehiclePS().GetVehicleVisualCustomizationTemplate() ) && !( GetVehiclePS().GetIsVehicleVisualCustomizationBlockedByDamage() ) ) && !( GetVehiclePS().GetIsVehicleApperanceCustomizationInDistanceTermination() ) )
{
ExecuteVisualCustomizationWithDelay( true, false, false, 0.80000001 );
}
}
}
}
protected event OnUnmountingEvent( evt : UnmountingEvent )
{
var mountChild : GameObject;
var isSilentUnmount : Bool;
mountChild = ( ( GameObject )( GameInstance.FindEntityByID( GetGame(), evt.request.lowLevelMountingInfo.childId ) ) );
isSilentUnmount = evt.request.mountData && evt.request.mountData.mountEventOptions.silentUnmount;
if( mountChild && mountChild.IsPlayer() )
{
if( !( isSilentUnmount ) )
{
SetInteriorUIEnabled( false );
}
GameInstance.GetDelaySystem( GetGame() ).DelayEvent( this, new CheckVehicleVisialCustomizationDistanceTermination, 1.0 );
}
}
private function SetInteriorUIEnabled( enabled : Bool )
{
var uiComponents : array< worlduiWidgetComponent >;
var component : worlduiWidgetComponent;
var i, total : Int32;
uiComponents = GetUIComponents();
total = uiComponents.Size();
if( total > 0 )
{
for( i = 0; i < total; i += 1 )
{
component = uiComponents[ i ];
if( component )
{
component.Toggle( enabled );
}
}
GetBlackboard().SetBool( GetAllBlackboardDefs().Vehicle.IsUIActive, enabled );
GetBlackboard().FireCallbacks();
}
}
private function ReevaluateStealing( character : weak< GameObject >, slotID : CName, stealingAction : Bool ) : Bool
{
var vehicleRecord : Vehicle_Record;
if( !( character ) || !( character.IsPlayer() ) )
{
return false;
}
if( stealingAction )
{
return true;
}
if( ( IsStolen() || slotID != VehicleComponent.GetDriverSlotName() ) || IsPlayerVehicle() )
{
return false;
}
if( !( VehicleComponent.GetVehicleRecord( this, vehicleRecord ) ) )
{
return false;
}
if( vehicleRecord.Affiliation().Type() == gamedataAffiliation.NCPD || RecordHasTag( vehicleRecord, 'TriggerPrevention' ) )
{
return true;
}
return false;
}
private function StealVehicle( thief : weak< GameObject > )
{
StimBroadcasterComponent.BroadcastStim( thief, gamedataStimType.CrowdIllegalAction );
StimBroadcasterComponent.BroadcastActiveStim( thief, gamedataStimType.CrimeWitness, 4.4000001 );
GetVehiclePS().SetIsStolen( true );
}
protected event OnWorkspotFinished( componentName : CName )
{
if( componentName == 'trunkBodyDisposalPlayer' )
{
GetVehicleComponent().MountNpcBodyToTrunk();
}
else if( componentName == 'trunkBodyPickupPlayer' )
{
GetVehicleComponent().FinishTrunkBodyPickup();
}
}
public const virtual function GetVehiclePS() : VehicleComponentPS
{
var ps : PersistentState;
ps = GetControllerPersistentState();
return ( ( VehicleComponentPS )( ps ) );
}
public const override function GetPSClassName() : CName
{
return GetVehiclePS().GetClassName();
}
protected const function GetControllerPersistentState() : PersistentState
{
var psID : PersistentID;
psID = GetVehicleComponent().GetPersistentID();
if( PersistentID.IsDefined( psID ) )
{
return GameInstance.GetPersistencySystem( GetGame() ).GetConstAccessToPSObject( psID, GetVehicleComponent().GetPSName() );
}
else
{
return NULL;
}
}
public const virtual function GetVehicleComponent() : VehicleComponent
{
return m_vehicleComponent;
}
public const function GetCrowdMemberComponent() : CrowdMemberBaseComponent
{
return m_crowdMemberComponent;
}
public const override function GetAttitudeAgent() : AttitudeAgent
{
return m_attitudeAgent;
}
public const override function ShouldShowScanner() : Bool
{
if( GetHudManager().IsBraindanceActive() && !( m_scanningComponent.IsBraindanceClue() ) )
{
return false;
}
return true;
}
protected event OnHUDInstruction( evt : HUDInstruction )
{
if( evt.quickhackInstruction.ShouldProcess() )
{
TryOpenQuickhackMenu( evt.quickhackInstruction.ShouldOpen() );
}
}
public const override function IsQuickHackAble() : Bool
{
var isNetrunner : Bool;
var isQuickHacksExposed : Bool;
var isQHBlockedByScene : Bool;
isNetrunner = IsNetrunner();
isQuickHacksExposed = IsQuickHacksExposed();
isQHBlockedByScene = QuickhackModule.IsQuickhackBlockedByScene( GameInstance.GetPlayerSystem( GetGame() ).GetLocalPlayerMainGameObject() );
return ( isNetrunner && isQuickHacksExposed ) && !( isQHBlockedByScene );
}
public const override function IsQuickHacksExposed() : Bool
{
return GetVehiclePS().IsQuickHacksExposed();
}
protected override function SendQuickhackCommands( shouldOpen : Bool )
{
var quickSlotsManagerNotification : RevealInteractionWheel;
var context : GetActionsContext;
var actions : array< DeviceAction >;
var commands : array< QuickhackData >;
quickSlotsManagerNotification = new RevealInteractionWheel;
quickSlotsManagerNotification.lookAtObject = this;
if( shouldOpen )
{
context = GetVehiclePS().GenerateContext( gamedeviceRequestType.Remote, Device.GetInteractionClearance(), GameInstance.GetPlayerSystem( GetGame() ).GetLocalPlayerControlledGameObject(), GetEntityID() );
GetVehiclePS().GetRemoteActions( actions, context );
if( ( m_isQhackUploadInProgress && !( IsActionQueueEnabled() ) ) || IsActionQueueFull() )
{
ScriptableDeviceComponentPS.SetActionsInactiveAll( actions, "LocKey#7020" );
}
if( IsActionQueueEnabled() )
{
QuickHackableQueueHelper.CheckAndSetInactivityReasonForVehicleActions( actions, m_currentlyUploadingAction );
}
QuickHackableHelper.TranslateActionsIntoQuickSlotCommands( actions, commands, this, GetVehiclePS() );
quickSlotsManagerNotification.commands = commands;
quickSlotsManagerNotification.shouldReveal = actions.Size() > 0;
}
GameInstance.GetUISystem( GetGame() ).QueueEvent( quickSlotsManagerNotification );
}
protected event OnUploadProgressStateChanged( evt : UploadProgramProgressEvent )
{
if( evt.progressBarContext == EProgressBarContext.QuickHack && evt.progressBarType == EProgressBarType.UPLOAD )
{
switch( evt.state )
{
case EUploadProgramState.STARTED:
m_isQhackUploadInProgress = true;
break;
case EUploadProgramState.COMPLETED:
m_isQhackUploadInProgress = false;
break;
}
}
}
public const override function CanRevealRemoteActionsWheel() : Bool
{
return IsQuickHackAble();
}
public const override function ShouldRegisterToHUD() : Bool
{
return true;
}
protected event OnSetExposeQuickHacks( evt : SetExposeQuickHacks )
{
RequestHUDRefresh();
}
public const override function GetDefaultHighlight() : FocusForcedHighlightData
{
var highlight : FocusForcedHighlightData;
var currentOutlineType : EFocusOutlineType;
if( IsDestroyed() || IsPlayerMounted() )
{
return NULL;
}
if( m_scanningComponent.IsBraindanceBlocked() || m_scanningComponent.IsPhotoModeBlocked() )
{
return NULL;
}
currentOutlineType = GetCurrentOutline();
if( currentOutlineType == EFocusOutlineType.INVALID )
{
return NULL;
}
highlight = new FocusForcedHighlightData;
highlight.sourceID = GetEntityID();
highlight.sourceName = GetClassName();
highlight.outlineType = currentOutlineType;
if( highlight.outlineType == EFocusOutlineType.QUEST )
{
highlight.highlightType = EFocusForcedHighlightType.QUEST;
}
else if( highlight.outlineType == EFocusOutlineType.HACKABLE )
{
highlight.highlightType = EFocusForcedHighlightType.HACKABLE;
}
if( IsNetrunner() )
{
highlight.patternType = VisionModePatternType.Netrunner;
}
else
{
highlight.patternType = VisionModePatternType.Default;
}
return highlight;
}
public const override function GetCurrentOutline() : EFocusOutlineType
{
if( IsQuest() )
{
return EFocusOutlineType.QUEST;
}
if( IsNetrunner() )
{
return EFocusOutlineType.HACKABLE;
}
return EFocusOutlineType.INVALID;
}
public const override function IsNetrunner() : Bool
{
var isCyberdeckEquipped : Bool;
isCyberdeckEquipped = EquipmentSystem.IsCyberdeckEquipped( GameInstance.GetPlayerSystem( GetGame() ).GetLocalPlayerMainGameObject() );
return isCyberdeckEquipped;
}
public const override function CompileScannerChunks() : Bool
{
var record : Vehicle_Record;
var uiData : VehicleUIData_Record;
var vehicleNameChunk : ScannerVehicleName;
var VehicleManufacturerChunk : ScannerVehicleManufacturer;
var productionYearsChunk : ScannerVehicleProdYears;
var driveLayoutChunk : ScannerVehicleDriveLayout;
var horsepowerChunk : ScannerVehicleHorsepower;
var massChunk : ScannerVehicleMass;
var stateChunk : ScannerVehicleState;
var infoChunk : ScannerVehicleInfo;
var vehicleCustomizationChunk : ScannerVehicleCustomizationTemplate;
var scannerBlackboard : weak< IBlackboard >;
scannerBlackboard = GameInstance.GetBlackboardSystem( GetGame() ).Get( GetAllBlackboardDefs().UI_ScannerModules );
scannerBlackboard.SetInt( GetAllBlackboardDefs().UI_ScannerModules.ObjectType, ( ( Int32 )( ScannerObjectType.VEHICLE ) ), true );
record = GetRecord();
uiData = record.VehicleUIData();
vehicleNameChunk = new ScannerVehicleName;
vehicleNameChunk.Set( LocKeyToString( record.DisplayName() ) );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleName, vehicleNameChunk );
VehicleManufacturerChunk = new ScannerVehicleManufacturer;
VehicleManufacturerChunk.Set( record.Manufacturer().EnumName() );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleManufacturer, VehicleManufacturerChunk );
productionYearsChunk = new ScannerVehicleProdYears;
productionYearsChunk.Set( uiData.ProductionYear() );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleProductionYears, productionYearsChunk );
massChunk = new ScannerVehicleMass;
massChunk.Set( RoundMath( MeasurementUtils.ValueToImperial( uiData.Mass(), EMeasurementUnit.Kilogram ) ) );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleMass, massChunk );
infoChunk = new ScannerVehicleInfo;
infoChunk.Set( uiData.Info() );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleInfo, infoChunk );
vehicleCustomizationChunk = new ScannerVehicleCustomizationTemplate;
vehicleCustomizationChunk.Set( GetVehicleComponent().GetCurrentAppearanceColorTemplate(), GetRecord().ColorProfilesRestricted(), GetRecord().TwintoneModelName() );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleCustomization, vehicleCustomizationChunk );
if( ( this == ( ( CarObject )( this ) ) ) || ( this == ( ( BikeObject )( this ) ) ) )
{
horsepowerChunk = new ScannerVehicleHorsepower;
horsepowerChunk.Set( RoundMath( uiData.Horsepower() ) );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleHorsepower, horsepowerChunk );
stateChunk = new ScannerVehicleState;
stateChunk.Set( m_vehicleComponent.GetVehicleStateForScanner() );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleState, stateChunk );
driveLayoutChunk = new ScannerVehicleDriveLayout;
driveLayoutChunk.Set( uiData.DriveLayout() );
scannerBlackboard.SetVariant( GetAllBlackboardDefs().UI_ScannerModules.ScannerVehicleDriveLayout, driveLayoutChunk );
}
return true;
}
protected event OnLookedAtEvent( evt : LookedAtEvent )
{
super.OnLookedAtEvent( evt );
VehicleComponent.QueueEventToAllPassengers( GetGame(), this, evt );
}
protected event OnCrowdSettingsEvent( evt : CrowdSettingsEvent )
{
if( !( m_driverUnconscious ) )
{
m_drivingTrafficPattern = evt.movementType;
m_crowdMemberComponent.ChangeMoveType( m_drivingTrafficPattern );
}
}
protected event OnStuckEvent( evt : VehicleStuckEvent )
{
m_gotStuckIncrement += 1;
m_drivingTrafficPattern = 'stop';
m_crowdMemberComponent.ChangeMoveType( m_drivingTrafficPattern );
GameInstance.GetDelaySystem( GetGame() ).DelayEvent( this, m_reactionTriggerEvent, 1.0 );
if( IsPrevention() )
{
VehicleComponent.QueueEventToAllPassengers( GetGame(), GetEntityID(), evt );
}
}
protected event OnVehicleDestructionEvent( evt : gameVehicleDestructionEvent )
{
if( evt.attackData.GetAttackType() == gamedataAttackType.Melee )
{
if( VehicleComponent.HasActiveDriverMounted( GetGame(), GetEntityID() ) && !( IsPlayerDriver() ) )
{
m_vehicleComponent.PlayDelayedHonk( TweakDBInterface.GetFloat( T"vehicles.honking.meleeHonkDuration", 1.0 ), TweakDBInterface.GetFloat( T"vehicles.honking.meleeHonkDelay", 0.30000001 ) );
}
}
}
protected event OnTrafficAudioEvent( evt : TrafficAudioEvent )
{
if( evt.audioAction == audioTrafficVehicleAudioAction.Horn )
{
}
}
protected event OnVehicleBumpEvent( evt : VehicleBumpEvent )
{
var isBike : Bool;
m_vehicleComponent.CheckForDrag( evt.impactVelocityChange );
isBike = this == ( ( BikeObject )( this ) );
if( evt.isInTraffic && ( evt.impactVelocityChange > 0.0 ) )
{
HandleTrafficBump( evt.impactVelocityChange );
}
else if( evt.hitVehicle && isBike )
{
m_vehicleComponent.HandleBikeCollisionReaction( evt.impactVelocityChange, Vector4.Vector3To4( evt.hitNormal ) );
}
}
private function HandleTrafficBump( impact : Float )
{
var impactNormal : Float;
var threshold : Float;
if( impact > 20.0 )
{
return;
}
if( IsExecutingAnyCommand() )
{
return;
}
if( m_minUnconsciousImpact == 0.0 )
{
m_minUnconsciousImpact = TweakDBInterface.GetFloat( T"AIGeneralSettings.minUnconsciousImpact", 6.5 );
}
impactNormal = ( impact - 20.0 ) * 0.11111;
if( ( impact > m_minUnconsciousImpact ) && ( RandRangeF( 0.0, 1.0 ) < ( ( 100.0 - ( m_minUnconsciousImpact + ( ( impactNormal * impactNormal ) * ( 20.0 - m_minUnconsciousImpact ) ) ) ) / 100.0 ) ) )
{
TriggerUnconsciousBehaviorForPassengers();
}
else
{
EscalateBumpVehicleReaction();
}
threshold = TweakDBInterface.GetFloat( T"vehicles.honking.collisionHonkUpperThreshold", 100.0 ) / 3.5999999;
if( ( ( impact < threshold ) && VehicleComponent.HasActiveDriverMounted( GetGame(), GetEntityID() ) ) && !( IsPlayerDriver() ) )
{
m_vehicleComponent.PlayDelayedHonk( TweakDBInterface.GetFloat( T"vehicles.honking.collisionHonkDuration", 1.5 ), TweakDBInterface.GetFloat( T"vehicles.honking.collisionHonkDelay", 0.5 ) );
}
}
private function EscalateBumpVehicleReaction()
{
var broadcaster : StimBroadcasterComponent;
var driver : GameObject;
if( !( GameObject.IsCooldownActive( this, 'bumpCooldown' ) ) )
{
GameObject.StartCooldown( this, 'bumpCooldown', 1.0 );
driver = VehicleComponent.GetDriverMounted( GetGame(), GetEntityID() );
if( ( VehicleComponent.IsMountedToVehicle( GetGame(), driver ) && ( ( NPCPuppet )( driver ) ) ) && ScriptedPuppet.IsActive( driver ) )
{
GameObject.PlayVoiceOver( driver, 'vehicle_bump', 'Scripts:EscalateBumpVehicleReaction', , , true );
}
if( m_bumpTimestamp >= EngineTime.ToFloat( GameInstance.GetSimTime( GetGame() ) ) )
{
m_bumpedRecently += 1;
if( m_bumpedRecently > 2 )
{
broadcaster = GameInstance.GetPlayerSystem( GetGame() ).GetLocalPlayerMainGameObject().GetStimBroadcasterComponent();
if( broadcaster && driver )
{
broadcaster.SendDrirectStimuliToTarget( this, gamedataStimType.Bump, driver );
}
}
}
else
{
m_bumpedRecently = 1;
m_bumpTimestamp = EngineTime.ToFloat( GameInstance.GetSimTime( GetGame() ) ) + 60.0;
}
}
}
private function TriggerUnconsciousBehaviorForPassengers()
{
var mountInfos : array< MountingInfo >;
var i : Int32;
var passenger : GameObject;
var delayBehaviorEvent : WaitForPassengersToSpawnEvent;
var game : GameInstance;
if( !( m_driverUnconscious ) )
{
m_drivingTrafficPattern = 'stop';
m_crowdMemberComponent.ChangeMoveType( m_drivingTrafficPattern );
m_driverUnconscious = true;
ApplyPermanentStun();
}
game = GetGame();
mountInfos = GameInstance.GetMountingFacility( game ).GetMountingInfoMultipleWithIds( , GetEntityID() );
if( mountInfos.Size() == 0 )
{
GameInstance.GetDelaySystem( game ).CancelDelay( m_waitForPassengersToSpawnEventDelayID );
delayBehaviorEvent = new WaitForPassengersToSpawnEvent;
m_waitForPassengersToSpawnEventDelayID = GameInstance.GetDelaySystem( game ).DelayEvent( this, delayBehaviorEvent, 1.5 );
}
for( i = 0; i < mountInfos.Size(); i += 1 )
{
if( mountInfos[ i ].slotId.id == 'trunk_body' )
{
continue;
}
passenger = ( ( GameObject )( GameInstance.FindEntityByID( game, mountInfos[ i ].childId ) ) );
if( passenger )
{
StatusEffectHelper.ApplyStatusEffect( passenger, T"BaseStatusEffect.Defeated" );
if( VehicleComponent.IsDriver( GetGame(), passenger ) )
{
m_vehicleComponent.PlayHonkForDuration( 7.5 );
}
}
}
}
protected event OnUnableToStartPanicDriving( evt : VehicleUnableToStartPanicDriving )
{
if( evt.forceExitVehicle )
{
TriggerExitBehavior();
}
else
{
TriggerFearInsideVehicleBehavior();
ResendHandleReactionEvent();
}
}
protected event OnWaitForPassengersToSpawnEvent( evt : WaitForPassengersToSpawnEvent )
{
TriggerUnconsciousBehaviorForPassengers();
}
protected event OnHandleReactionEvent( evt : HandleReactionEvent )
{
var randomDraw : Float;
var prevention : PreventionSystem;
var isMaxTacOnScene : Bool;
if( IsPerformingPanicDriving() || IsExecutingAnyCommand() )
{
return NULL;
}
if( ( EngineTime.ToFloat( GameInstance.GetSimTime( GetGame() ) ) <= ( m_hitTimestamp + 2.0 ) ) && evt.stimEvent.sourceObject.IsPlayer() )
{
EnableHighPriorityPanicDriving();
}
if( !( GameObject.IsCooldownActive( this, 'vehicleReactionCooldown' ) ) && !( m_driverUnconscious ) )
{
m_reactionTriggerEvent = evt;
GameObject.StartCooldown( this, 'vehicleReactionCooldown', 1.0 );
randomDraw = RandRangeF( 0.0, 1.0 );
prevention = ( ( PreventionSystem )( GameInstance.GetScriptableSystemsContainer( GetGame() ).Get( 'PreventionSystem' ) ) );
isMaxTacOnScene = !( prevention.IsMaxTacDefeated() );
if( ( ( ( m_gotStuckIncrement < 2 ) && !( m_abandoned ) ) && CanStartPanicDriving() ) && !( isMaxTacOnScene ) )
{
TriggerDrivingPanicBehavior( evt.stimEvent.sourcePosition );
m_fearInside = false;
}
else
{
if( isMaxTacOnScene || ( ( ( ( randomDraw <= 0.30000001 ) || ( m_gotStuckIncrement > 2 ) ) && evt.stimEvent.sourceObject.IsPlayer() ) && CanNPCsLeaveVehicle() ) )
{
TriggerExitBehavior();
m_fearInside = false;
}
else
{
if( !( m_fearInside ) )
{
TriggerFearInsideVehicleBehavior();
m_fearInside = true;
}
ResendHandleReactionEvent();
}
}
}
}
protected event OnTriggerPanicDrivingEvent( evt : TriggerPanicDrivingEvent )
{
PanicDrivingBehavior();
}
private function PanicDrivingBehavior()
{
if( !( m_abandoned ) && !( IsPlayerMounted() ) )
{
if( m_drivingTrafficPattern == 'stop' )
{
ResetReactionSequenceOfAllPassengers();
}
GameObject.PlayVoiceOver( VehicleComponent.GetDriverMounted( GetGame(), GetEntityID() ), 'fear_run', 'Scripts:PanicDrivingBehavior', , , true );
m_drivingTrafficPattern = 'panic';
m_crowdMemberComponent.ChangeMoveType( m_drivingTrafficPattern );
ResetTimesSentReactionEvent();
}
}
private function TriggerDrivingPanicBehavior( threatPosition : Vector4 )
{
var panicDrivingEvent : TriggerPanicDrivingEvent;
GameInstance.GetDelaySystem( GetGame() ).CancelDelay( m_triggerPanicDrivingEventDelayID );
panicDrivingEvent = new TriggerPanicDrivingEvent;
if( EngineTime.ToFloat( GameInstance.GetSimTime( GetGame() ) ) <= ( m_hitTimestamp + 2.0 ) )
{
QueueEvent( panicDrivingEvent );
}
else if( Vector4.DistanceSquared( GetWorldPosition(), threatPosition ) < ( 15.0 * 15.0 ) )
{
m_triggerPanicDrivingEventDelayID = GameInstance.GetDelaySystem( GetGame() ).DelayEvent( this, panicDrivingEvent, RandRangeF( 0.40000001, 0.69999999 ) );
}
else
{
m_triggerPanicDrivingEventDelayID = GameInstance.GetDelaySystem( GetGame() ).DelayEvent( this, panicDrivingEvent, RandRangeF( 0.80000001, 1.5 ) );
}
}
private function TriggerFearInsideVehicleBehavior()
{
var npcReactionEvent : DelayedCrowdReactionEvent;
m_drivingTrafficPattern = 'stop';
m_crowdMemberComponent.ChangeMoveType( m_drivingTrafficPattern );
npcReactionEvent = new DelayedCrowdReactionEvent;
npcReactionEvent.stimEvent = m_reactionTriggerEvent.stimEvent;
npcReactionEvent.vehicleFearPhase = 2;
VehicleComponent.QueueEventToAllPassengers( GetGame(), GetEntityID(), npcReactionEvent, , true );
}
public function TriggerExitBehavior( optional maxDelayOverride : Float )
{
var npcReactionEvent : DelayedCrowdReactionEvent;
var passengersCanLeaveCar : array< weak< GameObject > >;
var passengersCantLeaveCar : array< weak< GameObject > >;
var exitEvent : AIEvent;
VehicleComponent.CheckIfPassengersCanLeaveCar( GetGame(), GetEntityID(), passengersCanLeaveCar, passengersCantLeaveCar );
m_drivingTrafficPattern = 'stop';
m_crowdMemberComponent.ChangeMoveType( m_drivingTrafficPattern );
npcReactionEvent = new DelayedCrowdReactionEvent;
npcReactionEvent.stimEvent = m_reactionTriggerEvent.stimEvent;
if( IsDestroyed() )
{
return;
}
if( ( passengersCanLeaveCar.Size() > 0 ) && !( IsA( 'vehicleAVBaseObject' ) ) )
{
if( ( ( ( IsPerformingPanicDriving() || ( ( ScriptedPuppet )( passengersCanLeaveCar[ 0 ] ) ).IsCrowd() ) && !( ( ( ScriptedPuppet )( passengersCanLeaveCar[ 0 ] ) ).IsPrevention() ) ) && !( ( ( ScriptedPuppet )( passengersCanLeaveCar[ 0 ] ) ).IsAggressive() ) ) && !( IsQuest() ) )
{
exitEvent = new AIEvent;
exitEvent.name = 'ExitVehicleInPanic';
VehicleComponent.QueueEventToPassengers( GetGame(), GetEntityID(), exitEvent, passengersCanLeaveCar, true, maxDelayOverride );
npcReactionEvent.vehicleFearPhase = 3;
VehicleComponent.QueueEventToPassengers( GetGame(), GetEntityID(), npcReactionEvent, passengersCanLeaveCar, true, maxDelayOverride );
}
else
{
exitEvent = new AIEvent;
exitEvent.name = 'ExitVehicle';
VehicleComponent.QueueEventToPassengers( GetGame(), GetEntityID(), exitEvent, passengersCanLeaveCar, true, maxDelayOverride );
}
ResetTimesSentReactionEvent();
}
if( passengersCantLeaveCar.Size() > 0 )
{
if( ( ( ScriptedPuppet )( passengersCantLeaveCar[ 0 ] ) ).IsCharacterCivilian() )
{
npcReactionEvent.vehicleFearPhase = 2;
}
VehicleComponent.QueueEventToPassengers( GetGame(), GetEntityID(), npcReactionEvent, passengersCantLeaveCar, true );
ResendHandleReactionEvent();
}
m_abandoned = true;
}
private function ResendHandleReactionEvent()
{
var delayTime : Float;
if( !( IsTargetClose( m_reactionTriggerEvent.stimEvent.sourceObject.GetWorldPosition(), 20.0 ) ) )
{
if( m_timesToResendHandleReactionEvent == 0 )
{
m_timesToResendHandleReactionEvent = TweakDBInterface.GetInt( T"AIGeneralSettings.timesToResendHandleReactionEvent", 3 );
}