eNelx

Witcher 3 needed help with mod scripts

Aug 12th, 2023
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 82.00 KB | Gaming | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9. class CPlayerInput
  10. {
  11.  
  12. private var altSignCasting : bool;
  13.  
  14.  
  15. private saved var actionLocks : array<array<SInputActionLock>>;
  16.  
  17. private var totalCameraPresetChange : float; default totalCameraPresetChange = 0.0f;
  18. private var potAction : SInputAction;
  19. private var potPress : bool;
  20. private var debugBlockSourceName : name; default debugBlockSourceName = 'PLAYER';
  21. private var holdFastMenuInvoked : bool; default holdFastMenuInvoked = false;
  22. private var potionUpperHeld, potionLowerHeld : bool;
  23. private var potionModeHold : bool;
  24.  
  25. default potionModeHold = true;
  26.  
  27. public function Initialize(isFromLoad : bool, optional previousInput : CPlayerInput)
  28. {
  29. var missingLocksCount, i : int;
  30. var dummy : array<SInputActionLock>;
  31.  
  32.  
  33. var inGameConfigWrapper : CInGameConfigWrapper;
  34.  
  35. inGameConfigWrapper = theGame.GetInGameConfigWrapper();
  36. if(inGameConfigWrapper.GetVarValue('Gameplay', 'EnableAlternateSignCasting') == "1")
  37. altSignCasting = true;
  38. else
  39. altSignCasting = false;
  40. theInput.RegisterListener( this, 'OnAltQuen', 'AltQuenCasting' );
  41.  
  42.  
  43. if(previousInput)
  44. {
  45. actionLocks = previousInput.actionLocks;
  46. }
  47. else
  48. {
  49. if(!isFromLoad)
  50. {
  51. actionLocks.Grow(EnumGetMax('EInputActionBlock')+1);
  52. }
  53. else
  54. {
  55. missingLocksCount = EnumGetMax('EInputActionBlock') + 1 - actionLocks.Size();
  56. for ( i = 0; i < missingLocksCount; i += 1 )
  57. {
  58. actionLocks.PushBack( dummy );
  59. }
  60. }
  61. }
  62.  
  63. theInput.RegisterListener( this, 'OnCommSprint', 'Sprint' );
  64. theInput.RegisterListener( this, 'OnCommSprintToggle', 'SprintToggle' );
  65. theInput.RegisterListener( this, 'OnCommWalkToggle', 'WalkToggle' );
  66. theInput.RegisterListener( this, 'OnCommGuard', 'Guard' );
  67.  
  68.  
  69. theInput.RegisterListener( this, 'OnCommSpawnHorse', 'SpawnHorse' );
  70.  
  71.  
  72.  
  73. theInput.RegisterListener( this, 'OnCommDrinkPotion1', 'DrinkPotion1' );
  74. theInput.RegisterListener( this, 'OnCommDrinkPotion2', 'DrinkPotion2' );
  75. theInput.RegisterListener( this, 'OnCommDrinkPotion3', 'DrinkPotion3' );
  76. theInput.RegisterListener( this, 'OnCommDrinkPotion4', 'DrinkPotion4' );
  77. theInput.RegisterListener( this, 'OnCommDrinkpotionUpperHeld', 'DrinkPotionUpperHold' );
  78. theInput.RegisterListener( this, 'OnCommDrinkpotionLowerHeld', 'DrinkPotionLowerHold' );
  79.  
  80.  
  81. theInput.RegisterListener( this, 'OnCommSteelSword', 'SteelSword' );
  82. theInput.RegisterListener( this, 'OnCommSilverSword', 'SilverSword' );
  83. theInput.RegisterListener( this, 'OnCommSheatheAny', 'SwordSheathe' );
  84. theInput.RegisterListener( this, 'OnCommSheatheSilver', 'SwordSheatheSilver' );
  85. theInput.RegisterListener( this, 'OnCommSheatheSteel', 'SwordSheatheSteel' );
  86.  
  87. theInput.RegisterListener( this, 'OnToggleSigns', 'ToggleSigns' );
  88. theInput.RegisterListener( this, 'OnSelectSign', 'SelectAard' );
  89. theInput.RegisterListener( this, 'OnSelectSign', 'SelectYrden' );
  90. theInput.RegisterListener( this, 'OnSelectSign', 'SelectIgni' );
  91. theInput.RegisterListener( this, 'OnSelectSign', 'SelectQuen' );
  92. theInput.RegisterListener( this, 'OnSelectSign', 'SelectAxii' );
  93.  
  94.  
  95.  
  96. theInput.RegisterListener( this, 'OnCommDeckEditor', 'PanelGwintDeckEditor' );
  97. theInput.RegisterListener( this, 'OnCommMenuHub', 'HubMenu' );
  98. theInput.RegisterListener( this, 'OnCommPanelInv', 'PanelInv' );
  99. theInput.RegisterListener( this, 'OnCommHoldFastMenu', 'HoldFastMenu' );
  100. theInput.RegisterListener( this, 'OnCommPanelChar', 'PanelChar' );
  101. theInput.RegisterListener( this, 'OnCommPanelMed', 'PanelMed' );
  102. theInput.RegisterListener( this, 'OnCommPanelMap', 'PanelMap' );
  103. theInput.RegisterListener( this, 'OnCommPanelMapPC', 'PanelMapPC' );
  104. theInput.RegisterListener( this, 'OnCommPanelJour', 'PanelJour' );
  105. theInput.RegisterListener( this, 'OnCommPanelAlch', 'PanelAlch' );
  106. theInput.RegisterListener( this, 'OnCommPanelGlossary', 'PanelGlossary' );
  107. theInput.RegisterListener( this, 'OnCommPanelBestiary', 'PanelBestiary' );
  108. theInput.RegisterListener( this, 'OnCommPanelMeditation', 'PanelMeditation' );
  109. theInput.RegisterListener( this, 'OnCommPanelCrafting', 'PanelCrafting' );
  110. theInput.RegisterListener( this, 'OnShowControlsHelp', 'ControlsHelp' );
  111. theInput.RegisterListener( this, 'OnCommPanelUIResize', 'PanelUIResize' );
  112.  
  113. theInput.RegisterListener( this, 'OnCastSign', 'CastSign' );
  114. theInput.RegisterListener( this, 'OnExpFocus', 'Focus' );
  115. theInput.RegisterListener( this, 'OnExpMedallion', 'Medallion' );
  116.  
  117.  
  118. theInput.RegisterListener( this, 'OnBoatDismount', 'BoatDismount' );
  119.  
  120. theInput.RegisterListener( this, 'OnDiving', 'DiveDown' );
  121. theInput.RegisterListener( this, 'OnDiving', 'DiveUp' );
  122. theInput.RegisterListener( this, 'OnDivingDodge', 'DiveDodge' );
  123.  
  124.  
  125. theInput.RegisterListener( this, 'OnCbtSpecialAttackWithAlternateLight', 'SpecialAttackWithAlternateLight' );
  126. theInput.RegisterListener( this, 'OnCbtSpecialAttackWithAlternateHeavy', 'SpecialAttackWithAlternateHeavy' );
  127. theInput.RegisterListener( this, 'OnCbtAttackWithAlternateLight', 'AttackWithAlternateLight' );
  128. theInput.RegisterListener( this, 'OnCbtAttackWithAlternateHeavy', 'AttackWithAlternateHeavy' );
  129.  
  130. theInput.RegisterListener( this, 'OnCbtAttackLight', 'AttackLight' );
  131. theInput.RegisterListener( this, 'OnCbtAttackHeavy', 'AttackHeavy' );
  132. theInput.RegisterListener( this, 'OnCbtSpecialAttackLight', 'SpecialAttackLight' );
  133. theInput.RegisterListener( this, 'OnCbtSpecialAttackHeavy', 'SpecialAttackHeavy' );
  134. theInput.RegisterListener( this, 'OnCbtDodge', 'Dodge' );
  135. theInput.RegisterListener( this, 'OnCbtRoll', 'CbtRoll' );
  136. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapW' );
  137. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapS' );
  138. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapA' );
  139. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapD' );
  140. theInput.RegisterListener( this, 'OnCbtLockAndGuard', 'LockAndGuard' );
  141. theInput.RegisterListener( this, 'OnCbtCameraLockOrSpawnHorse', 'CameraLockOrSpawnHorse' );
  142. theInput.RegisterListener( this, 'OnCbtCameraLock', 'CameraLock' );
  143. theInput.RegisterListener( this, 'OnCbtComboDigitLeft', 'ComboDigitLeft' );
  144. theInput.RegisterListener( this, 'OnCbtComboDigitRight', 'ComboDigitRight' );
  145.  
  146.  
  147.  
  148. theInput.RegisterListener( this, 'OnCbtCiriSpecialAttack', 'CiriSpecialAttack' );
  149. theInput.RegisterListener( this, 'OnCbtCiriAttackHeavy', 'CiriAttackHeavy' );
  150. theInput.RegisterListener( this, 'OnCbtCiriSpecialAttackHeavy', 'CiriSpecialAttackHeavy' );
  151. theInput.RegisterListener( this, 'OnCbtCiriDodge', 'CiriDodge' );
  152. theInput.RegisterListener( this, 'OnCbtCiriDash', 'CiriDash' );
  153.  
  154.  
  155. theInput.RegisterListener( this, 'OnCbtThrowItem', 'ThrowItem' );
  156. theInput.RegisterListener( this, 'OnCbtThrowItemHold', 'ThrowItemHold' );
  157. theInput.RegisterListener( this, 'OnCbtThrowCastAbort', 'ThrowCastAbort' );
  158.  
  159.  
  160. theInput.RegisterListener( this, 'OnCiriDrawWeapon', 'CiriDrawWeapon' );
  161. theInput.RegisterListener( this, 'OnCiriDrawWeapon', 'CiriDrawWeaponAlternative' );
  162. theInput.RegisterListener( this, 'OnCiriHolsterWeapon', 'CiriHolsterWeapon' );
  163. theInput.RegisterListener( this, 'OnResurrect', 'Resurrect' );
  164. theInput.RegisterListener( this, 'OnTpFreeCam', 'TpFreeCam' );
  165. theInput.RegisterListener( this, 'OnTeleportToPin', 'TeleportToPin' );
  166.  
  167.  
  168. if( !theGame.IsFinalBuild() )
  169. {
  170. theInput.RegisterListener( this, 'OnDbgSpeedUp', 'Debug_SpeedUp' );
  171. theInput.RegisterListener( this, 'OnDbgHit', 'Debug_Hit' );
  172. theInput.RegisterListener( this, 'OnDbgKillTarget', 'Debug_KillTarget' );
  173. theInput.RegisterListener( this, 'OnDbgKillAll', 'Debug_KillAllEnemies' );
  174. theInput.RegisterListener( this, 'OnDbgKillAllTargetingPlayer', 'Debug_KillAllTargetingPlayer' );
  175. theInput.RegisterListener( this, 'OnCommPanelFakeHud', 'PanelFakeHud' );
  176. theInput.RegisterListener( this, 'OnDbgTeleportToPin', 'Debug_TeleportToPin' );
  177. }
  178.  
  179.  
  180. theInput.RegisterListener( this, 'OnChangeCameraPreset', 'CameraPreset' );
  181. theInput.RegisterListener( this, 'OnChangeCameraPresetByMouseWheel', 'CameraPresetByMouseWheel' );
  182. theInput.RegisterListener( this, 'OnMeditationAbort', 'MeditationAbort');
  183.  
  184. theInput.RegisterListener( this, 'OnFastMenu', 'FastMenu' );
  185. theInput.RegisterListener( this, 'OnIngameMenu', 'IngameMenu' );
  186.  
  187. theInput.RegisterListener( this, 'OnToggleHud', 'ToggleHud' );
  188.  
  189. // AutoLoot mod added
  190. theInput.RegisterListener( this, 'OnAutoLootRadiusLoot', 'AutoLootRadius' );
  191. }
  192.  
  193.  
  194. function Destroy()
  195. {
  196. }
  197.  
  198.  
  199.  
  200.  
  201.  
  202. public function FindActionLockIndex(action : EInputActionBlock, sourceName : name) : int
  203. {
  204. var i : int;
  205.  
  206. for(i=0; i<actionLocks[action].Size(); i+=1)
  207. if(actionLocks[action][i].sourceName == sourceName)
  208. return i;
  209.  
  210. return -1;
  211. }
  212.  
  213.  
  214. public function BlockAction(action : EInputActionBlock, sourceName : name, lock : bool, optional keepOnSpawn : bool, optional onSpawnedNullPointerHackFix : CPlayer, optional isFromQuest : bool, optional isFromPlace : bool)
  215. {
  216. var index : int;
  217. var isLocked, wasLocked : bool;
  218. var actionLock : SInputActionLock;
  219.  
  220. if (action == EIAB_HighlightObjective)
  221. {
  222. index = FindActionLockIndex(action, sourceName);
  223. }
  224.  
  225. index = FindActionLockIndex(action, sourceName);
  226.  
  227. wasLocked = (actionLocks[action].Size() > 0);
  228.  
  229. if(lock)
  230. {
  231. if(index != -1)
  232. return;
  233.  
  234. actionLock.sourceName = sourceName;
  235.  
  236. if( action == EIAB_CameraLock )
  237. {
  238. actionLock.removedOnSpawn = true;
  239. }
  240. else
  241. {
  242. actionLock.removedOnSpawn = !keepOnSpawn;
  243. }
  244. actionLock.isFromQuest = isFromQuest;
  245. actionLock.isFromPlace = isFromPlace;
  246.  
  247. actionLocks[action].PushBack(actionLock);
  248. }
  249. else
  250. {
  251. if(index == -1)
  252. return;
  253.  
  254. actionLocks[action].Erase(index);
  255. }
  256.  
  257. isLocked = (actionLocks[action].Size() > 0);
  258. if(isLocked != wasLocked)
  259. OnActionLockChanged(action, isLocked, sourceName, onSpawnedNullPointerHackFix);
  260. }
  261.  
  262.  
  263. public final function TutorialForceUnblockRadial() : array<SInputActionLock>
  264. {
  265. var ret : array<SInputActionLock>;
  266.  
  267. ret = actionLocks[EIAB_RadialMenu];
  268.  
  269. actionLocks[EIAB_RadialMenu].Clear();
  270.  
  271. thePlayer.SetBIsInputAllowed(true, '');
  272.  
  273. BlockAction( EIAB_Signs, 'ToxicGasTutorial', true, true, NULL, false);
  274.  
  275. return ret;
  276. }
  277.  
  278.  
  279. public final function TutorialForceRestoreRadialLocks(radialLocks : array<SInputActionLock>)
  280. {
  281. actionLocks[EIAB_RadialMenu] = radialLocks;
  282. thePlayer.UnblockAction(EIAB_Signs, 'ToxicGasTutorial' );
  283. }
  284.  
  285. private function OnActionLockChanged(action : EInputActionBlock, locked : bool, optional sourceName : name, optional onSpawnedNullPointerHackFix : CPlayer)
  286. {
  287. var player : CPlayer;
  288. var lockType : EPlayerInteractionLock;
  289. var hud : CR4ScriptedHud;
  290. var guiManager : CR4GuiManager;
  291. var rootMenu : CR4MenuBase;
  292.  
  293.  
  294. if( sourceName == debugBlockSourceName )
  295. {
  296.  
  297. sourceName = sourceName;
  298. }
  299.  
  300.  
  301. if(action == EIAB_FastTravel)
  302. {
  303. theGame.GetCommonMapManager().EnableFastTravelling(!locked);
  304. }
  305. else if(action == EIAB_Interactions)
  306. {
  307.  
  308. if(sourceName == 'InsideCombatAction')
  309. lockType = PIL_CombatAction;
  310. else
  311. lockType = PIL_Default;
  312.  
  313. if(!thePlayer)
  314. player = onSpawnedNullPointerHackFix;
  315. else
  316. player = thePlayer;
  317.  
  318. if(player)
  319. {
  320. if(locked)
  321. player.LockButtonInteractions(lockType);
  322. else
  323. player.UnlockButtonInteractions(lockType);
  324. }
  325.  
  326.  
  327. hud = (CR4ScriptedHud)theGame.GetHud();
  328. if ( hud )
  329. {
  330. hud.ForceInteractionUpdate();
  331. }
  332. }
  333. else if(action == EIAB_Movement && locked && thePlayer)
  334. {
  335.  
  336. if(thePlayer.IsUsingVehicle() && thePlayer.GetCurrentStateName() == 'HorseRiding')
  337. {
  338. ((CActor)thePlayer.GetUsedVehicle()).GetMovingAgentComponent().ResetMoveRequests();
  339. thePlayer.GetUsedVehicle().SetBehaviorVariable( '2idle', 1);
  340.  
  341. thePlayer.SetBehaviorVariable( 'speed', 0);
  342. thePlayer.SetBehaviorVariable( '2idle', 1);
  343. }
  344. else if(!thePlayer.IsInAir())
  345. {
  346. thePlayer.RaiseForceEvent( 'Idle' );
  347. }
  348. }
  349. else if (action == EIAB_DismountVehicle)
  350. {
  351. guiManager = theGame.GetGuiManager();
  352.  
  353. if (guiManager)
  354. {
  355. guiManager.UpdateDismountAvailable(locked);
  356. }
  357. }
  358. else if (action == EIAB_OpenPreparation || action == EIAB_OpenMap || action == EIAB_OpenInventory ||
  359. action == EIAB_OpenJournal || action == EIAB_OpenCharacterPanel || action == EIAB_OpenGlossary ||
  360. action == EIAB_OpenAlchemy || action == EIAB_MeditationWaiting || action == EIAB_OpenMeditation)
  361. {
  362. guiManager = theGame.GetGuiManager();
  363.  
  364. if (guiManager && guiManager.IsAnyMenu())
  365. {
  366. rootMenu = (CR4MenuBase)guiManager.GetRootMenu();
  367.  
  368. if (rootMenu)
  369. {
  370. rootMenu.ActionBlockStateChange(action, locked);
  371. }
  372. }
  373. }
  374. }
  375.  
  376. public function BlockAllActions(sourceName : name, lock : bool, optional exceptions : array<EInputActionBlock>, optional saveLock : bool, optional onSpawnedNullPointerHackFix : CPlayer, optional isFromQuest : bool, optional isFromPlace : bool)
  377. {
  378. var i, size : int;
  379.  
  380. size = EnumGetMax('EInputActionBlock')+1;
  381. for(i=0; i<size; i+=1)
  382. {
  383. if ( exceptions.Contains(i) || i == EIAB_CameraLock )
  384. continue;
  385.  
  386. BlockAction(i, sourceName, lock, saveLock, onSpawnedNullPointerHackFix, isFromQuest, isFromPlace);
  387. }
  388. }
  389.  
  390.  
  391. public final function BlockAllQuestActions(sourceName : name, lock : bool)
  392. {
  393. var action, j, size : int;
  394. var isLocked, wasLocked : bool;
  395. var exceptions : array< EInputActionBlock >;
  396.  
  397. if(lock)
  398. {
  399.  
  400. exceptions.PushBack( EIAB_FastTravelGlobal );
  401. BlockAllActions(sourceName, lock, exceptions, true, , true);
  402. }
  403. else
  404. {
  405.  
  406. size = EnumGetMax('EInputActionBlock')+1;
  407. for(action=0; action<size; action+=1)
  408. {
  409. wasLocked = (actionLocks[action].Size() > 0);
  410.  
  411. for(j=0; j<actionLocks[action].Size();)
  412. {
  413. if(actionLocks[action][j].isFromQuest)
  414. {
  415. actionLocks[action].EraseFast(j);
  416. }
  417. else
  418. {
  419. j += 1;
  420. }
  421. }
  422.  
  423. isLocked = (actionLocks[action].Size() > 0);
  424. if(wasLocked != isLocked)
  425. OnActionLockChanged(action, isLocked);
  426. }
  427. }
  428. }
  429.  
  430.  
  431. public function BlockAllUIQuestActions(sourceName : name, lock : bool)
  432. {
  433. var i, j, action, size : int;
  434. var uiActions : array<int>;
  435. var wasLocked, isLocked : bool;
  436.  
  437. if( lock )
  438. {
  439. BlockAction(EIAB_OpenInventory, sourceName, true, true, NULL, false);
  440. BlockAction(EIAB_MeditationWaiting, sourceName, true, true, NULL, false);
  441. BlockAction(EIAB_OpenMeditation, sourceName, true, true, NULL, false);
  442. BlockAction(EIAB_FastTravel, sourceName, true, true, NULL, false);
  443. BlockAction(EIAB_OpenMap, sourceName, true, true, NULL, false);
  444. BlockAction(EIAB_OpenCharacterPanel, sourceName, true, true, NULL, false);
  445. BlockAction(EIAB_OpenJournal, sourceName, true, true, NULL, false);
  446. BlockAction(EIAB_OpenAlchemy, sourceName, true, true, NULL, false);
  447. }
  448. else
  449. {
  450.  
  451. uiActions.Resize(8);
  452. uiActions[0] = EIAB_OpenInventory;
  453. uiActions[1] = EIAB_MeditationWaiting;
  454. uiActions[2] = EIAB_OpenMeditation;
  455. uiActions[3] = EIAB_FastTravel;
  456. uiActions[4] = EIAB_OpenMap;
  457. uiActions[5] = EIAB_OpenCharacterPanel;
  458. uiActions[6] = EIAB_OpenJournal;
  459. uiActions[7] = EIAB_OpenAlchemy;
  460.  
  461. size = uiActions.Size();
  462. for(i=0; i<size; i+=1)
  463. {
  464. action = uiActions[i];
  465.  
  466. wasLocked = (actionLocks[action].Size() > 0);
  467.  
  468. for(j=0; j<actionLocks[action].Size();)
  469. {
  470. if(actionLocks[action][j].isFromQuest)
  471. {
  472. actionLocks[action].EraseFast(j);
  473. }
  474. else
  475. {
  476. j += 1;
  477. }
  478. }
  479.  
  480. isLocked = (actionLocks[action].Size() > 0);
  481. if(wasLocked != isLocked)
  482. OnActionLockChanged(action, isLocked);
  483. }
  484. }
  485. }
  486.  
  487.  
  488. public function ForceUnlockAllInputActions(alsoQuestLocks : bool)
  489. {
  490. var i, j : int;
  491.  
  492. for(i=0; i<=EnumGetMax('EInputActionBlock'); i+=1)
  493. {
  494. if(alsoQuestLocks)
  495. {
  496. actionLocks[i].Clear();
  497. OnActionLockChanged(i, false);
  498. }
  499. else
  500. {
  501. for(j=actionLocks[i].Size()-1; j>=0; j-=1)
  502. {
  503. if(actionLocks[i][j].removedOnSpawn)
  504. actionLocks[i].Erase(j);
  505. }
  506.  
  507. if(actionLocks[i].Size() == 0)
  508. OnActionLockChanged(i, false);
  509. }
  510. }
  511. }
  512.  
  513. public function RemoveLocksOnSpawn()
  514. {
  515. var i, j : int;
  516.  
  517. for(i=0; i<actionLocks.Size(); i+=1)
  518. {
  519. for(j=actionLocks[i].Size()-1; j>=0; j-=1)
  520. {
  521. if(actionLocks[i][j].removedOnSpawn || i == EIAB_CameraLock)
  522. {
  523. actionLocks[i].Erase(j);
  524. }
  525. }
  526. }
  527. }
  528.  
  529. public function GetActionLocks(action : EInputActionBlock) : array< SInputActionLock >
  530. {
  531. return actionLocks[action];
  532. }
  533.  
  534. public function GetAllActionLocks() : array< array< SInputActionLock > >
  535. {
  536. return actionLocks;
  537. }
  538.  
  539. public function IsActionAllowed(action : EInputActionBlock) : bool
  540. {
  541. var actionAllowed : bool;
  542. actionAllowed = (actionLocks[action].Size() == 0);
  543. return actionAllowed;
  544. }
  545.  
  546. public function IsActionBlockedBy( action : EInputActionBlock, sourceName : name ) : bool
  547. {
  548. return FindActionLockIndex( action, sourceName ) != -1;
  549. }
  550.  
  551. public final function GetActionBlockedHudLockType(action : EInputActionBlock) : name
  552. {
  553. var i : int;
  554.  
  555. if(action == EIAB_Undefined)
  556. return '';
  557.  
  558. for(i=0; i<actionLocks[action].Size(); i+=1)
  559. {
  560. if(actionLocks[action][i].isFromPlace)
  561. return 'place';
  562. }
  563.  
  564. if(actionLocks[action].Size() > 0)
  565. return 'time';
  566.  
  567. return '';
  568. }
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576. event OnAltQuen( action : SInputAction )
  577. {
  578. if(altSignCasting && !theInput.LastUsedPCInput() && IsPressed( action ) && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  579. {
  580. AltCastSign(ST_Quen);
  581. }
  582. }
  583.  
  584.  
  585. event OnCommSprint( action : SInputAction )
  586. {
  587. if( IsPressed( action ) )
  588. {
  589.  
  590. if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && !GetWitcherPlayer().IsCurrentSignChanneled())
  591. {
  592. AltCastSign(ST_Aard);
  593. return false;
  594. }
  595.  
  596.  
  597. thePlayer.SetSprintActionPressed(true);
  598.  
  599. if ( thePlayer.rangedWeapon )
  600. thePlayer.rangedWeapon.OnSprintHolster();
  601. }
  602.  
  603.  
  604. }
  605.  
  606. event OnCommSprintToggle( action : SInputAction )
  607. {
  608. if( IsPressed(action) )
  609. {
  610.  
  611. if( theInput.LastUsedPCInput() || thePlayer.GetLeftStickSprint() )
  612. {
  613. if ( thePlayer.GetIsSprintToggled() )
  614. thePlayer.SetSprintToggle( false );
  615. else
  616. {
  617. thePlayer.SetSprintToggle( true );
  618.  
  619. if ( thePlayer.rangedWeapon )
  620. thePlayer.rangedWeapon.OnSprintHolster();
  621.  
  622. }
  623. }
  624. }
  625. }
  626.  
  627.  
  628.  
  629. private var holdTimer : float;
  630.  
  631.  
  632. event OnCommWalkToggle( action : SInputAction )
  633. {
  634.  
  635. var horse : CNewNPC;
  636. var horseWalkState : int;
  637.  
  638. horse = thePlayer.GetHorseCurrentlyMounted();
  639. if(horse)
  640. {
  641. horseWalkState = horse.GetHorseComponent().GetHorseWalkState();
  642. if( IsPressed(action) )
  643. {
  644. holdTimer = theGame.GetEngineTimeAsSeconds();
  645. }
  646. else if( IsReleased(action) )
  647. {
  648. if(theGame.GetEngineTimeAsSeconds() - holdTimer > 0.2)
  649. {
  650. horse.GetHorseComponent().SetHorseWalkState(0);
  651. }
  652. else
  653. {
  654. if(horseWalkState == 0)
  655. horse.GetHorseComponent().SetHorseWalkState(1);
  656. else if(horseWalkState == 1)
  657. horse.GetHorseComponent().SetHorseWalkState(2);
  658. else
  659. horse.GetHorseComponent().SetHorseWalkState(0);
  660. }
  661. }
  662. return false;
  663. }
  664.  
  665.  
  666. if( IsPressed(action) && !thePlayer.GetIsSprinting() && !thePlayer.modifyPlayerSpeed )
  667. {
  668. if ( thePlayer.GetIsWalkToggled() )
  669. thePlayer.SetWalkToggle( false );
  670. else
  671. thePlayer.SetWalkToggle( true );
  672. }
  673. }
  674.  
  675.  
  676. event OnCommGuard( action : SInputAction )
  677. {
  678. if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  679. return false;
  680.  
  681. if ( !thePlayer.IsInsideInteraction() )
  682. {
  683. if ( IsActionAllowed(EIAB_Parry) )
  684. {
  685. if( IsReleased(action) && thePlayer.GetCurrentStateName() == 'CombatFists' )
  686. thePlayer.OnGuardedReleased();
  687.  
  688. if( IsPressed(action) )
  689. {
  690. thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  691. thePlayer.SetGuarded(true);
  692. thePlayer.OnPerformGuard();
  693. }
  694. else if( IsReleased(action) )
  695. {
  696. thePlayer.SetGuarded(false);
  697. }
  698. }
  699. else
  700. {
  701. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);
  702. }
  703. }
  704. }
  705.  
  706.  
  707.  
  708.  
  709.  
  710. private var pressTimestamp : float;
  711. private const var DOUBLE_TAP_WINDOW : float;
  712. default DOUBLE_TAP_WINDOW = 0.4;
  713.  
  714. event OnCommSpawnHorse( action : SInputAction )
  715. {
  716. var isSpawnHorseSecondTap : bool;
  717. isSpawnHorseSecondTap = false;
  718.  
  719. if( IsPressed( action ) )
  720. return false;
  721.  
  722. isSpawnHorseSecondTap = pressTimestamp + DOUBLE_TAP_WINDOW >= theGame.GetEngineTimeAsSeconds();
  723.  
  724. if( IsActionAllowed( EIAB_CallHorse )
  725. && !thePlayer.IsInInterior() && !thePlayer.IsInAir()
  726. && (isSpawnHorseSecondTap || theInput.LastUsedPCInput()) )
  727. {
  728. if ( thePlayer.IsHoldingItemInLHand () )
  729. {
  730. thePlayer.OnUseSelectedItem(true);
  731. thePlayer.SetPlayerActionToRestore ( PATR_CallHorse );
  732. }
  733. else
  734. {
  735. theGame.OnSpawnPlayerHorse();
  736. }
  737. }
  738. else if( isSpawnHorseSecondTap || theInput.LastUsedPCInput() )
  739. {
  740. if( thePlayer.IsInInterior() )
  741. thePlayer.DisplayActionDisallowedHudMessage( EIAB_Undefined, false, true );
  742. else
  743. thePlayer.DisplayActionDisallowedHudMessage( EIAB_CallHorse );
  744. }
  745.  
  746. pressTimestamp = theGame.GetEngineTimeAsSeconds();
  747.  
  748. return true;
  749. }
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756. event OnCommMenuHub( action : SInputAction )
  757. {
  758. if(IsReleased(action))
  759. {
  760. PushMenuHub();
  761. }
  762. }
  763.  
  764. final function PushMenuHub()
  765. {
  766. if ( theGame.IsBlackscreenOrFading() )
  767. {
  768. return;
  769. }
  770. theGame.RequestMenu('CommonMenu');
  771. }
  772.  
  773.  
  774.  
  775. event OnCommPanelChar( action : SInputAction )
  776. {
  777. if(IsReleased(action))
  778. {
  779. PushCharacterScreen();
  780. }
  781. }
  782. final function PushCharacterScreen()
  783. {
  784. if ( theGame.IsBlackscreenOrFading() )
  785. {
  786. return;
  787. }
  788.  
  789. if( IsActionAllowed(EIAB_OpenCharacterPanel) )
  790. {
  791. theGame.RequestMenuWithBackground( 'CharacterMenu', 'CommonMenu' );
  792. }
  793. else
  794. {
  795. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenCharacterPanel);
  796. }
  797. }
  798.  
  799.  
  800. event OnCommPanelInv( action : SInputAction )
  801. {
  802. if (IsReleased(action))
  803. {
  804. PushInventoryScreen();
  805. }
  806. }
  807.  
  808. final function PushInventoryScreen()
  809. {
  810. if ( theGame.IsBlackscreenOrFading() )
  811. {
  812. return;
  813. }
  814. if( IsActionAllowed(EIAB_OpenInventory) )
  815. {
  816. theGame.RequestMenuWithBackground( 'InventoryMenu', 'CommonMenu' );
  817. }
  818. else
  819. {
  820. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenInventory);
  821. }
  822. }
  823.  
  824.  
  825. event OnCommDeckEditor( action : SInputAction )
  826. {
  827. if( IsReleased(action) )
  828. {
  829. if ( theGame.IsBlackscreenOrFading() )
  830. {
  831. return false;
  832. }
  833. if (theGame.GetGwintManager().GetHasDoneTutorial() || theGame.GetGwintManager().HasLootedCard())
  834. {
  835. if( IsActionAllowed(EIAB_OpenGwint) )
  836. {
  837. theGame.RequestMenu( 'DeckBuilder' );
  838. }
  839. else
  840. {
  841. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGwint);
  842. }
  843. }
  844. }
  845. }
  846.  
  847.  
  848. event OnCommPanelMed( action : SInputAction )
  849. {
  850. if( IsReleased(action) )
  851. {
  852. if( IsActionAllowed(EIAB_MeditationWaiting) )
  853. {
  854. GetWitcherPlayer().Meditate();
  855. }
  856. else
  857. {
  858. thePlayer.DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting);
  859. }
  860. }
  861. }
  862.  
  863. event OnCommPanelMapPC( action : SInputAction )
  864. {
  865. if( IsReleased(action) )
  866. {
  867. PushMapScreen();
  868. }
  869. }
  870.  
  871. event OnCommPanelMap( action : SInputAction )
  872. {
  873. if( IsPressed(action) )
  874. {
  875. PushMapScreen();
  876. }
  877. }
  878. final function PushMapScreen()
  879. {
  880. if ( theGame.IsBlackscreenOrFading() )
  881. {
  882. return;
  883. }
  884. if( IsActionAllowed(EIAB_OpenMap) )
  885. {
  886. theGame.RequestMenuWithBackground( 'MapMenu', 'CommonMenu' );
  887. }
  888. else
  889. {
  890. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMap);
  891. }
  892. }
  893.  
  894.  
  895. event OnCommPanelJour( action : SInputAction )
  896. {
  897. if( IsReleased(action) )
  898. {
  899. PushJournalScreen();
  900. }
  901. }
  902. final function PushJournalScreen()
  903. {
  904. if ( theGame.IsBlackscreenOrFading() )
  905. {
  906. return;
  907. }
  908. if( IsActionAllowed(EIAB_OpenJournal) )
  909. {
  910.  
  911. theGame.RequestMenuWithBackground( 'JournalQuestMenu', 'CommonMenu' );
  912. }
  913. else
  914. {
  915. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenJournal);
  916. }
  917. }
  918.  
  919. event OnCommPanelMeditation( action : SInputAction )
  920. {
  921. if( IsReleased(action) )
  922. {
  923. PushMeditationScreen();
  924. }
  925. }
  926.  
  927. final function PushMeditationScreen()
  928. {
  929. if ( theGame.IsBlackscreenOrFading() )
  930. {
  931. return;
  932. }
  933. if( IsActionAllowed(EIAB_OpenMeditation) )
  934. {
  935. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  936. }
  937. else
  938. {
  939. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMeditation);
  940. }
  941. }
  942.  
  943. event OnCommPanelCrafting( action : SInputAction )
  944. {
  945. if( IsReleased(action) )
  946. {
  947. PushCraftingScreen();
  948. }
  949. }
  950.  
  951. final function PushCraftingScreen()
  952. {
  953. if ( theGame.IsBlackscreenOrFading() )
  954. {
  955. return;
  956. }
  957.  
  958. theGame.RequestMenuWithBackground( 'CraftingMenu', 'CommonMenu' );
  959. }
  960.  
  961.  
  962. event OnCommPanelBestiary( action : SInputAction )
  963. {
  964. if( IsReleased(action) )
  965. {
  966. PushBestiaryScreen();
  967. }
  968. }
  969.  
  970. final function PushBestiaryScreen()
  971. {
  972. if ( theGame.IsBlackscreenOrFading() )
  973. {
  974. return;
  975. }
  976. if( IsActionAllowed(EIAB_OpenGlossary) )
  977. {
  978. theGame.RequestMenuWithBackground( 'GlossaryBestiaryMenu', 'CommonMenu' );
  979. }
  980. else
  981. {
  982. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  983. }
  984. }
  985.  
  986. event OnCommPanelAlch( action : SInputAction )
  987. {
  988. if( IsReleased(action) )
  989. {
  990. PushAlchemyScreen();
  991. }
  992. }
  993. final function PushAlchemyScreen()
  994. {
  995. if ( theGame.IsBlackscreenOrFading() )
  996. {
  997. return;
  998. }
  999. if( IsActionAllowed(EIAB_OpenAlchemy) )
  1000. {
  1001. theGame.RequestMenuWithBackground( 'AlchemyMenu', 'CommonMenu' );
  1002. }
  1003. else
  1004. {
  1005. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenAlchemy);
  1006. }
  1007. }
  1008.  
  1009. event OnCommPanelGlossary( action : SInputAction )
  1010. {
  1011. if( IsReleased(action) )
  1012. {
  1013. PushGlossaryScreen();
  1014. }
  1015. }
  1016. final function PushGlossaryScreen()
  1017. {
  1018. if ( theGame.IsBlackscreenOrFading() )
  1019. {
  1020. return;
  1021. }
  1022. if( IsActionAllowed(EIAB_OpenGlossary) )
  1023. {
  1024. theGame.RequestMenuWithBackground( 'GlossaryEncyclopediaMenu', 'CommonMenu' );
  1025. }
  1026. else
  1027. {
  1028. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  1029. }
  1030. }
  1031.  
  1032. event OnShowControlsHelp( action : SInputAction )
  1033. {
  1034. if( IsReleased(action) )
  1035. {
  1036. if ( theGame.IsBlackscreenOrFading() )
  1037. {
  1038. return false;
  1039. }
  1040.  
  1041.  
  1042. }
  1043. }
  1044.  
  1045. event OnCommPanelUIResize( action : SInputAction )
  1046. {
  1047. if( IsReleased(action) )
  1048. {
  1049. if ( theGame.IsBlackscreenOrFading() )
  1050. {
  1051. return false;
  1052. }
  1053. theGame.RequestMenu( 'RescaleMenu' );
  1054. }
  1055. }
  1056.  
  1057. event OnCommPanelFakeHud( action : SInputAction )
  1058. {
  1059. if( IsReleased(action) )
  1060. {
  1061. if ( theGame.IsBlackscreenOrFading() )
  1062. {
  1063. return false;
  1064. }
  1065.  
  1066. }
  1067. }
  1068.  
  1069.  
  1070.  
  1071.  
  1072. private var processedSwordHold : bool;
  1073.  
  1074. event OnCommSteelSword( action : SInputAction )
  1075. {
  1076. var duringCastSign : bool;
  1077.  
  1078. if(IsPressed(action))
  1079. processedSwordHold = false;
  1080.  
  1081. if ( theInput.LastUsedGamepad() && theInput.IsActionPressed('Alternate') )
  1082. {
  1083. return false;
  1084. }
  1085.  
  1086. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  1087. {
  1088. if( !processedSwordHold )
  1089. {
  1090. if ( IsActionAllowed(EIAB_DrawWeapon) && thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1091. {
  1092. thePlayer.PushCombatActionOnBuffer( EBAT_Draw_Steel, BS_Pressed );
  1093. if ( thePlayer.GetBIsCombatActionAllowed() )
  1094. thePlayer.ProcessCombatActionBuffer();
  1095. }
  1096. processedSwordHold = true;
  1097. }
  1098. }
  1099. }
  1100.  
  1101. event OnCommSilverSword( action : SInputAction )
  1102. {
  1103. var duringCastSign : bool;
  1104.  
  1105. if( IsPressed(action) )
  1106. processedSwordHold = false;
  1107.  
  1108. if ( theInput.LastUsedGamepad() && theInput.IsActionPressed('Alternate') )
  1109. {
  1110. return false;
  1111. }
  1112.  
  1113. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  1114. {
  1115. if( !processedSwordHold )
  1116. {
  1117. if ( IsActionAllowed(EIAB_DrawWeapon) && thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1118. {
  1119. thePlayer.PushCombatActionOnBuffer( EBAT_Draw_Silver, BS_Pressed );
  1120. if ( thePlayer.GetBIsCombatActionAllowed() || duringCastSign )
  1121. thePlayer.ProcessCombatActionBuffer();
  1122. }
  1123. processedSwordHold = true;
  1124. }
  1125.  
  1126. }
  1127. }
  1128.  
  1129. event OnCommSheatheAny( action : SInputAction )
  1130. {
  1131. var duringCastSign : bool;
  1132.  
  1133. if( IsPressed( action ) )
  1134. {
  1135. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1136. {
  1137. thePlayer.PushCombatActionOnBuffer( EBAT_Sheathe_Sword, BS_Pressed );
  1138. if ( thePlayer.GetBIsCombatActionAllowed() || duringCastSign )
  1139. {
  1140. thePlayer.ProcessCombatActionBuffer();
  1141. }
  1142. }
  1143. processedSwordHold = true;
  1144. }
  1145. }
  1146.  
  1147. event OnCommSheatheSteel( action : SInputAction )
  1148. {
  1149. if( IsPressed( action ) && thePlayer.IsWeaponHeld( 'steelsword' ) && !processedSwordHold)
  1150. {
  1151. OnCommSheatheAny(action);
  1152. }
  1153. }
  1154.  
  1155. event OnCommSheatheSilver( action : SInputAction )
  1156. {
  1157. if( IsPressed( action ) && thePlayer.IsWeaponHeld( 'silversword' ) && !processedSwordHold)
  1158. {
  1159. OnCommSheatheAny(action);
  1160. }
  1161. }
  1162.  
  1163. event OnCommDrinkPot( action : SInputAction )
  1164. {
  1165. if(IsPressed(action))
  1166. {
  1167. if(!potPress)
  1168. {
  1169. potPress = true;
  1170. potAction = action;
  1171. thePlayer.AddTimer('PotDrinkTimer', 0.3);
  1172. }
  1173. else
  1174. {
  1175. PotDrinkTimer(true);
  1176. thePlayer.RemoveTimer('PotDrinkTimer');
  1177. }
  1178. }
  1179. }
  1180.  
  1181. public function PotDrinkTimer(isDoubleTapped : bool)
  1182. {
  1183. thePlayer.RemoveTimer('PotDrinkTimer');
  1184. potPress = false;
  1185.  
  1186. if(isDoubleTapped)
  1187. OnCommDrinkPotion2(potAction);
  1188. else
  1189. OnCommDrinkPotion1(potAction);
  1190. }
  1191.  
  1192.  
  1193.  
  1194.  
  1195. event OnCbtComboDigitLeft( action : SInputAction )
  1196. {
  1197. if ( theInput.IsActionPressed('Alternate') )
  1198. {
  1199. OnTogglePreviousSign(action);
  1200. }
  1201. }
  1202.  
  1203. event OnCbtComboDigitRight( action : SInputAction )
  1204. {
  1205. if ( theInput.IsActionPressed('Alternate') )
  1206. {
  1207. OnToggleNextSign(action);
  1208. }
  1209. }
  1210.  
  1211.  
  1212. event OnSelectSign(action : SInputAction)
  1213. {
  1214. if( IsPressed( action ) )
  1215. {
  1216.  
  1217. if(altSignCasting)
  1218. {
  1219. switch( action.aName )
  1220. {
  1221. case 'SelectAard' :
  1222. AltCastSign(ST_Aard);
  1223. break;
  1224. case 'SelectYrden' :
  1225. AltCastSign(ST_Yrden);
  1226. break;
  1227. case 'SelectIgni' :
  1228. AltCastSign(ST_Igni);
  1229. break;
  1230. case 'SelectQuen' :
  1231. AltCastSign(ST_Quen);
  1232. break;
  1233. case 'SelectAxii' :
  1234. AltCastSign(ST_Axii);
  1235. break;
  1236. default :
  1237. break;
  1238. }
  1239. }
  1240.  
  1241. else
  1242. {
  1243. switch( action.aName )
  1244. {
  1245. case 'SelectAard' :
  1246. GetWitcherPlayer().SetEquippedSign(ST_Aard);
  1247. break;
  1248. case 'SelectYrden' :
  1249. GetWitcherPlayer().SetEquippedSign(ST_Yrden);
  1250. break;
  1251. case 'SelectIgni' :
  1252. GetWitcherPlayer().SetEquippedSign(ST_Igni);
  1253. break;
  1254. case 'SelectQuen' :
  1255. GetWitcherPlayer().SetEquippedSign(ST_Quen);
  1256. break;
  1257. case 'SelectAxii' :
  1258. GetWitcherPlayer().SetEquippedSign(ST_Axii);
  1259. break;
  1260. default :
  1261. break;
  1262. }
  1263. }
  1264. }
  1265.  
  1266. else if (IsReleased( action ) && altSignCasting && GetWitcherPlayer().IsCurrentSignChanneled())
  1267. {
  1268. thePlayer.AbortSign();
  1269. }
  1270.  
  1271. }
  1272.  
  1273. event OnToggleSigns( action : SInputAction )
  1274. {
  1275. var tolerance : float;
  1276. tolerance = 2.5f;
  1277.  
  1278. if( action.value < -tolerance )
  1279. {
  1280. GetWitcherPlayer().TogglePreviousSign();
  1281. }
  1282. else if( action.value > tolerance )
  1283. {
  1284. GetWitcherPlayer().ToggleNextSign();
  1285. }
  1286. }
  1287. event OnToggleNextSign( action : SInputAction )
  1288. {
  1289. if( IsPressed( action ) )
  1290. {
  1291. GetWitcherPlayer().ToggleNextSign();
  1292. }
  1293. }
  1294. event OnTogglePreviousSign( action : SInputAction )
  1295. {
  1296. if( IsPressed( action ) )
  1297. {
  1298. GetWitcherPlayer().TogglePreviousSign();
  1299. }
  1300. }
  1301.  
  1302. event OnToggleItem( action : SInputAction )
  1303. {
  1304. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1305. {
  1306. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1307. return false;
  1308. }
  1309.  
  1310. if( IsReleased( action ) )
  1311. {
  1312. if( theInput.GetLastActivationTime( action.aName ) < 0.3 )
  1313. GetWitcherPlayer().ToggleNextItem();
  1314. }
  1315. }
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321. event OnCommDrinkpotionUpperHeld( action : SInputAction )
  1322. {
  1323. if(!potionModeHold)
  1324. return false;
  1325.  
  1326.  
  1327. if(thePlayer.IsCiri())
  1328. return false;
  1329.  
  1330. if(IsReleased(action))
  1331. return false;
  1332.  
  1333. potionUpperHeld = true;
  1334. GetWitcherPlayer().FlipSelectedPotion(true);
  1335. }
  1336.  
  1337. event OnCommDrinkpotionLowerHeld( action : SInputAction )
  1338. {
  1339. if(!potionModeHold)
  1340. return false;
  1341.  
  1342.  
  1343. if(thePlayer.IsCiri())
  1344. return false;
  1345.  
  1346. if(IsReleased(action))
  1347. return false;
  1348.  
  1349. potionLowerHeld = true;
  1350. GetWitcherPlayer().FlipSelectedPotion(false);
  1351. }
  1352.  
  1353. public final function SetPotionSelectionMode(b : bool)
  1354. {
  1355. potionModeHold = b;
  1356. }
  1357.  
  1358. private final function DrinkPotion(action : SInputAction, upperSlot : bool) : bool
  1359. {
  1360. var witcher : W3PlayerWitcher;
  1361.  
  1362. if ( potionModeHold && IsReleased(action) )
  1363. {
  1364. if(!potionUpperHeld && !potionLowerHeld)
  1365. {
  1366. GetWitcherPlayer().OnPotionDrinkInput(upperSlot);
  1367. }
  1368.  
  1369. if(upperSlot)
  1370. potionUpperHeld = false;
  1371. else
  1372. potionLowerHeld = false;
  1373. }
  1374. else if(!potionModeHold && IsPressed(action))
  1375. {
  1376. witcher = GetWitcherPlayer();
  1377. if(!witcher.IsPotionDoubleTapRunning())
  1378. {
  1379. witcher.SetPotionDoubleTapRunning(true, upperSlot);
  1380. return true;
  1381. }
  1382. else
  1383. {
  1384. witcher.SetPotionDoubleTapRunning(false);
  1385. witcher.FlipSelectedPotion(upperSlot);
  1386. return true;
  1387. }
  1388. }
  1389.  
  1390. return false;
  1391. }
  1392.  
  1393.  
  1394. event OnCommDrinkPotion1( action : SInputAction )
  1395. {
  1396.  
  1397. if(thePlayer.IsCiri())
  1398. return false;
  1399.  
  1400. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1401. {
  1402. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1403. return false;
  1404. }
  1405.  
  1406. if ( theInput.LastUsedGamepad() )
  1407. {
  1408. return DrinkPotion(action, true);
  1409. }
  1410. else
  1411. if ( IsReleased(action) )
  1412. {
  1413. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion1);
  1414. return true;
  1415. }
  1416.  
  1417. return false;
  1418. }
  1419.  
  1420.  
  1421. event OnCommDrinkPotion2( action : SInputAction )
  1422. {
  1423. var witcher : W3PlayerWitcher;
  1424.  
  1425.  
  1426. if(thePlayer.IsCiri())
  1427. return false;
  1428.  
  1429. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1430. {
  1431. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1432. return false;
  1433. }
  1434.  
  1435. if ( theInput.LastUsedGamepad() )
  1436. {
  1437. return DrinkPotion(action, false);
  1438. }
  1439. else
  1440. if ( IsReleased(action) )
  1441. {
  1442. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion2);
  1443. return true;
  1444. }
  1445.  
  1446. return false;
  1447. }
  1448.  
  1449.  
  1450. event OnCommDrinkPotion3( action : SInputAction )
  1451. {
  1452.  
  1453. if(thePlayer.IsCiri())
  1454. return false;
  1455.  
  1456. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1457. {
  1458. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1459. return false;
  1460. }
  1461.  
  1462. if ( IsReleased(action) )
  1463. {
  1464. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion3);
  1465. return true;
  1466. }
  1467.  
  1468. return false;
  1469. }
  1470.  
  1471.  
  1472. event OnCommDrinkPotion4( action : SInputAction )
  1473. {
  1474. var witcher : W3PlayerWitcher;
  1475.  
  1476.  
  1477. if(thePlayer.IsCiri())
  1478. return false;
  1479.  
  1480. if( !IsActionAllowed( EIAB_QuickSlots ) )
  1481. {
  1482. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  1483. return false;
  1484. }
  1485.  
  1486. if ( IsReleased(action) )
  1487. {
  1488. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion4);
  1489. return true;
  1490. }
  1491.  
  1492. return false;
  1493. }
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499. event OnDiving( action : SInputAction )
  1500. {
  1501. if ( IsPressed(action) && IsActionAllowed(EIAB_Dive) )
  1502. {
  1503. if ( action.aName == 'DiveDown' )
  1504. {
  1505. if ( thePlayer.OnAllowedDiveDown() )
  1506. {
  1507. if ( !thePlayer.OnCheckDiving() )
  1508. thePlayer.OnDive();
  1509.  
  1510. if ( thePlayer.bLAxisReleased )
  1511. thePlayer.SetBehaviorVariable( 'divePitch',-1.0);
  1512. else
  1513. thePlayer.SetBehaviorVariable( 'divePitch', -0.9);
  1514. thePlayer.OnDiveInput(-1.f);
  1515.  
  1516. if ( thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1517. {
  1518. thePlayer.OnRangedForceHolster( true, false );
  1519. thePlayer.OnFullyBlendedIdle();
  1520. }
  1521. }
  1522. }
  1523. else if ( action.aName == 'DiveUp' )
  1524. {
  1525. if ( thePlayer.bLAxisReleased )
  1526. thePlayer.SetBehaviorVariable( 'divePitch',1.0);
  1527. else
  1528. thePlayer.SetBehaviorVariable( 'divePitch', 0.9);
  1529.  
  1530. if ( thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1531. {
  1532. thePlayer.OnRangedForceHolster( true, false );
  1533. thePlayer.OnFullyBlendedIdle();
  1534. }
  1535.  
  1536. thePlayer.OnDiveInput(1.f);
  1537. }
  1538. }
  1539. else if ( IsReleased(action) )
  1540. {
  1541. thePlayer.SetBehaviorVariable( 'divePitch',0.0);
  1542. thePlayer.OnDiveInput(0.f);
  1543. }
  1544. else if ( IsPressed(action) && !IsActionAllowed(EIAB_Dive) )
  1545. {
  1546. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dive);
  1547. }
  1548. }
  1549.  
  1550. event OnDivingDodge( action : SInputAction )
  1551. {
  1552. var isDodgeAllowed : bool;
  1553.  
  1554. if( IsPressed(action) )
  1555. {
  1556. isDodgeAllowed = IsActionAllowed(EIAB_Dodge);
  1557. if( isDodgeAllowed && IsActionAllowed(EIAB_Dive) )
  1558. {
  1559. if ( thePlayer.OnCheckDiving() && thePlayer.GetBIsInputAllowed() )
  1560. {
  1561. thePlayer.PushCombatActionOnBuffer( EBAT_Dodge, BS_Pressed );
  1562. if ( thePlayer.GetBIsCombatActionAllowed() )
  1563. thePlayer.ProcessCombatActionBuffer();
  1564. }
  1565. }
  1566. else
  1567. {
  1568. if(!isDodgeAllowed)
  1569. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  1570. else
  1571. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dive);
  1572. }
  1573. }
  1574. }
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580. event OnExpFistFightLight( action : SInputAction )
  1581. {
  1582. var fistsAllowed : bool;
  1583.  
  1584. if( IsPressed(action) )
  1585. {
  1586. fistsAllowed = IsActionAllowed(EIAB_Fists);
  1587. if( fistsAllowed && IsActionAllowed(EIAB_LightAttacks) )
  1588. {
  1589.  
  1590. thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  1591. }
  1592. else
  1593. {
  1594. if(!fistsAllowed)
  1595. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1596. else
  1597. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  1598. }
  1599. }
  1600. }
  1601.  
  1602. event OnExpFistFightHeavy( action : SInputAction )
  1603. {
  1604. var fistsAllowed : bool;
  1605.  
  1606. if( IsPressed(action) )
  1607. {
  1608. fistsAllowed = IsActionAllowed(EIAB_Fists);
  1609. if( fistsAllowed && IsActionAllowed(EIAB_HeavyAttacks) )
  1610. {
  1611.  
  1612. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Pressed );
  1613. }
  1614. else
  1615. {
  1616. if(!fistsAllowed)
  1617. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1618. else
  1619. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  1620. }
  1621. }
  1622. }
  1623.  
  1624.  
  1625.  
  1626. event OnExpFocus( action : SInputAction )
  1627. {
  1628.  
  1629. if(!thePlayer.IsCiri())
  1630. {
  1631. if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign'))
  1632. {
  1633. if(IsPressed( action ))
  1634. {
  1635. theGame.GetFocusModeController().Deactivate();
  1636. AltCastSign(ST_Igni);
  1637. return false;
  1638. }
  1639. else if (IsReleased( action ) && GetWitcherPlayer().IsCurrentSignChanneled())
  1640. {
  1641. thePlayer.AbortSign();
  1642. }
  1643. }
  1644. }
  1645.  
  1646. if(thePlayer.IsCiri() && IsActionAllowed(EIAB_ExplorationFocus))
  1647. {
  1648. if( IsPressed( action ) )
  1649. {
  1650. if( thePlayer.GoToCombatIfNeeded() )
  1651. {
  1652. OnCommGuard( action );
  1653. return false;
  1654. }
  1655. theGame.GetFocusModeController().Activate();
  1656. }
  1657. else if( IsReleased( action ) )
  1658. {
  1659. theGame.GetFocusModeController().Deactivate();
  1660. }
  1661. }
  1662. else if(IsActionAllowed(EIAB_ExplorationFocus) && !GetWitcherPlayer().IsCurrentSignChanneled())
  1663. {
  1664. if( IsPressed( action ) )
  1665. {
  1666.  
  1667. if( thePlayer.GoToCombatIfNeeded() )
  1668. {
  1669. OnCommGuard( action );
  1670. return false;
  1671. }
  1672. theGame.GetFocusModeController().Activate();
  1673.  
  1674. }
  1675. else if( IsReleased( action ) )
  1676. {
  1677. theGame.GetFocusModeController().Deactivate();
  1678. }
  1679. }
  1680. else
  1681. {
  1682. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ExplorationFocus);
  1683. theGame.GetFocusModeController().Deactivate();
  1684. }
  1685. }
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691. private function ShouldSwitchAttackType():bool
  1692. {
  1693. var outKeys : array<EInputKey>;
  1694.  
  1695. if ( theInput.LastUsedPCInput() )
  1696. {
  1697. theInput.GetPCKeysForAction('PCAlternate',outKeys);
  1698. if ( outKeys.Size() > 0 )
  1699. {
  1700. if ( theInput.IsActionPressed('PCAlternate') )
  1701. {
  1702. return true;
  1703. }
  1704. }
  1705. }
  1706. return false;
  1707. }
  1708.  
  1709. event OnCbtAttackWithAlternateLight( action : SInputAction )
  1710. {
  1711. CbtAttackPC( action, false);
  1712. }
  1713.  
  1714. event OnCbtAttackWithAlternateHeavy( action : SInputAction )
  1715. {
  1716. CbtAttackPC( action, true);
  1717. }
  1718.  
  1719. function CbtAttackPC( action : SInputAction, isHeavy : bool )
  1720. {
  1721. var switchAttackType : bool;
  1722.  
  1723. switchAttackType = ShouldSwitchAttackType();
  1724.  
  1725. if ( !theInput.LastUsedPCInput() )
  1726. {
  1727. return;
  1728. }
  1729.  
  1730. if ( thePlayer.IsCiri() )
  1731. {
  1732. if ( switchAttackType != isHeavy)
  1733. {
  1734. OnCbtCiriAttackHeavy(action);
  1735. }
  1736. else
  1737. {
  1738. OnCbtAttackLight(action);
  1739. }
  1740. }
  1741. else
  1742. {
  1743. if ( switchAttackType != isHeavy)
  1744. {
  1745. OnCbtAttackHeavy(action);
  1746. }
  1747. else
  1748. {
  1749. OnCbtAttackLight(action);
  1750. }
  1751. }
  1752. }
  1753.  
  1754. event OnCbtAttackLight( action : SInputAction )
  1755. {
  1756. var allowed, checkedFists : bool;
  1757.  
  1758. if( IsPressed(action) )
  1759. {
  1760.  
  1761. if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign'))
  1762. {
  1763. AltCastSign(ST_Axii);
  1764. return false;
  1765. }
  1766.  
  1767.  
  1768.  
  1769. if( IsActionAllowed(EIAB_LightAttacks) )
  1770. {
  1771. if (thePlayer.GetBIsInputAllowed())
  1772. {
  1773. allowed = false;
  1774.  
  1775. if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  1776. {
  1777. checkedFists = true;
  1778. if(IsActionAllowed(EIAB_Fists))
  1779. allowed = true;
  1780. }
  1781. else if(IsActionAllowed(EIAB_SwordAttack))
  1782. {
  1783. checkedFists = false;
  1784. allowed = true;
  1785. }
  1786.  
  1787. if(allowed)
  1788. {
  1789. thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  1790. }
  1791. else
  1792. {
  1793. if(checkedFists)
  1794. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1795. else
  1796. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  1797. }
  1798. }
  1799. }
  1800. else if ( !IsActionBlockedBy(EIAB_LightAttacks,'interaction') )
  1801. {
  1802. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  1803. }
  1804. }
  1805. }
  1806.  
  1807. event OnCbtAttackHeavy( action : SInputAction )
  1808. {
  1809. var allowed, checkedSword : bool;
  1810. var outKeys : array<EInputKey>;
  1811.  
  1812. if ( thePlayer.GetBIsInputAllowed() )
  1813. {
  1814.  
  1815. if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign'))
  1816. {
  1817. if(IsPressed( action ))
  1818. {
  1819. AltCastSign(ST_Yrden);
  1820. return false;
  1821. }
  1822. else if (IsReleased( action ))
  1823. {
  1824. return false;
  1825. }
  1826. }
  1827.  
  1828.  
  1829. if( IsActionAllowed(EIAB_HeavyAttacks) )
  1830. {
  1831. allowed = false;
  1832.  
  1833. if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  1834. {
  1835. checkedSword = false;
  1836. if(IsActionAllowed(EIAB_Fists))
  1837. allowed = true;
  1838. }
  1839. else if(IsActionAllowed(EIAB_SwordAttack))
  1840. {
  1841. checkedSword = true;
  1842. allowed = true;
  1843. }
  1844.  
  1845. if(allowed)
  1846. {
  1847. if ( ( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None ) && IsPressed(action) )
  1848. {
  1849. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  1850. }
  1851. else
  1852. {
  1853. if( IsReleased(action) && theInput.GetLastActivationTime( action.aName ) < 0.2 )
  1854. {
  1855. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  1856. }
  1857. }
  1858. }
  1859. else
  1860. {
  1861. if(checkedSword)
  1862. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  1863. else
  1864. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  1865. }
  1866. }
  1867. else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  1868. {
  1869. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  1870. }
  1871. }
  1872. }
  1873.  
  1874. private function CheckFinisherInput() : bool
  1875. {
  1876. var enemyInCone : CActor;
  1877. var npc : CNewNPC;
  1878. var interactionTarget : CInteractionComponent;
  1879.  
  1880. var isDeadlySwordHeld : bool;
  1881.  
  1882. interactionTarget = theGame.GetInteractionsManager().GetActiveInteraction();
  1883. if ( interactionTarget && interactionTarget.GetName() == "Finish" )
  1884. {
  1885. npc = (CNewNPC)( interactionTarget.GetEntity() );
  1886.  
  1887. isDeadlySwordHeld = thePlayer.IsDeadlySwordHeld();
  1888. if( ( theInput.GetActionValue( 'AttackHeavy' ) == 1.f || theInput.GetActionValue( 'AttackLight' ) == 1.f )
  1889. && isDeadlySwordHeld )
  1890. {
  1891. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_FinisherInput) );
  1892. npc.SignalGameplayEvent('Finisher');
  1893.  
  1894. }
  1895. else if ( !isDeadlySwordHeld )
  1896. {
  1897. if ( thePlayer.IsWeaponHeld( 'fist' ))
  1898. thePlayer.SetBehaviorVariable( 'combatTauntType', 1.f );
  1899. else
  1900. thePlayer.SetBehaviorVariable( 'combatTauntType', 0.f );
  1901.  
  1902. thePlayer.RaiseEvent( 'CombatTaunt' );
  1903. }
  1904.  
  1905. return true;
  1906.  
  1907. }
  1908. return false;
  1909. }
  1910.  
  1911. private function IsPlayerAbleToPerformSpecialAttack() : bool
  1912. {
  1913. if( ( thePlayer.GetCurrentStateName() == 'Exploration' ) && !( thePlayer.IsWeaponHeld( 'silversword' ) || thePlayer.IsWeaponHeld( 'steelsword' ) ) )
  1914. {
  1915. return false;
  1916. }
  1917. return true;
  1918. }
  1919.  
  1920. event OnCbtSpecialAttackWithAlternateLight( action : SInputAction )
  1921. {
  1922. CbSpecialAttackPC( action, false);
  1923. }
  1924.  
  1925. event OnCbtSpecialAttackWithAlternateHeavy( action : SInputAction )
  1926. {
  1927. CbSpecialAttackPC( action, true);
  1928. }
  1929.  
  1930. function CbSpecialAttackPC( action : SInputAction, isHeavy : bool )
  1931. {
  1932. var switchAttackType : bool;
  1933.  
  1934. switchAttackType = ShouldSwitchAttackType();
  1935.  
  1936. if ( !theInput.LastUsedPCInput() )
  1937. {
  1938. return;
  1939. }
  1940.  
  1941. if ( IsPressed(action) )
  1942. {
  1943. if ( thePlayer.IsCiri() )
  1944. {
  1945.  
  1946. OnCbtCiriSpecialAttackHeavy(action);
  1947. }
  1948. else
  1949. {
  1950. if (switchAttackType != isHeavy)
  1951. {
  1952. OnCbtSpecialAttackHeavy(action);
  1953. }
  1954. else
  1955. {
  1956. OnCbtSpecialAttackLight(action);
  1957. }
  1958. }
  1959. }
  1960. else if ( IsReleased( action ) )
  1961. {
  1962. if ( thePlayer.IsCiri() )
  1963. {
  1964. OnCbtCiriSpecialAttackHeavy(action);
  1965. }
  1966. else
  1967. {
  1968.  
  1969. OnCbtSpecialAttackHeavy(action);
  1970. OnCbtSpecialAttackLight(action);
  1971. }
  1972. }
  1973. }
  1974.  
  1975. event OnCbtSpecialAttackLight( action : SInputAction )
  1976. {
  1977.  
  1978. if(!theInput.LastUsedPCInput() && IsPressed( action ) && theInput.GetActionValue( 'CastSign' ) > 0)
  1979. {
  1980. return false;
  1981. }
  1982.  
  1983.  
  1984. if ( IsReleased( action ) )
  1985. {
  1986. thePlayer.CancelHoldAttacks();
  1987. return true;
  1988. }
  1989.  
  1990. if ( !IsPlayerAbleToPerformSpecialAttack() )
  1991. return false;
  1992.  
  1993. if( !IsActionAllowed(EIAB_LightAttacks) )
  1994. {
  1995. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  1996. return false;
  1997. }
  1998. if(!IsActionAllowed(EIAB_SpecialAttackLight) )
  1999. {
  2000. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackLight);
  2001. return false;
  2002. }
  2003.  
  2004. if( IsPressed(action) && thePlayer.CanUseSkill(S_Sword_s01) )
  2005. {
  2006. thePlayer.PrepareToAttack();
  2007. thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2008. thePlayer.AddTimer( 'IsSpecialLightAttackInputHeld', 0.00001, true );
  2009. }
  2010. }
  2011.  
  2012. event OnCbtSpecialAttackHeavy( action : SInputAction )
  2013. {
  2014.  
  2015. if(!theInput.LastUsedPCInput() && IsPressed( action ) && theInput.GetActionValue( 'CastSign' ) > 0)
  2016. {
  2017. return false;
  2018. }
  2019.  
  2020.  
  2021. if ( IsReleased( action ) )
  2022. {
  2023. thePlayer.CancelHoldAttacks();
  2024. return true;
  2025. }
  2026.  
  2027. if ( !IsPlayerAbleToPerformSpecialAttack() || GetWitcherPlayer().IsInCombatAction_SpecialAttackHeavy() )
  2028. return false;
  2029.  
  2030. if( !IsActionAllowed(EIAB_HeavyAttacks))
  2031. {
  2032. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  2033. return false;
  2034. }
  2035. if(!IsActionAllowed(EIAB_SpecialAttackHeavy))
  2036. {
  2037. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackHeavy);
  2038. return false;
  2039. }
  2040.  
  2041. if( IsPressed(action) && thePlayer.CanUseSkill(S_Sword_s02) )
  2042. {
  2043. thePlayer.PrepareToAttack();
  2044. thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2045. thePlayer.AddTimer( 'IsSpecialHeavyAttackInputHeld', 0.00001, true );
  2046. }
  2047. else if ( IsPressed(action) )
  2048. {
  2049. if ( theInput.IsActionPressed('AttackHeavy') )
  2050. theInput.ForceDeactivateAction('AttackHeavy');
  2051. else if ( theInput.IsActionPressed('AttackWithAlternateHeavy') )
  2052. theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2053. }
  2054. }
  2055.  
  2056.  
  2057. event OnCbtCiriSpecialAttack( action : SInputAction )
  2058. {
  2059. if( !GetCiriPlayer().HasSword() )
  2060. return false;
  2061.  
  2062. if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) )
  2063. {
  2064. if ( thePlayer.HasAbility('CiriBlink') && ((W3ReplacerCiri)thePlayer).HasStaminaForSpecialAction(true) )
  2065. thePlayer.PrepareToAttack();
  2066. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Pressed );
  2067. thePlayer.ProcessCombatActionBuffer();
  2068. }
  2069. else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0 )
  2070. {
  2071. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Released );
  2072. thePlayer.ProcessCombatActionBuffer();
  2073. }
  2074. }
  2075.  
  2076.  
  2077. event OnCbtCiriAttackHeavy( action : SInputAction )
  2078. {
  2079. var specialAttackAction : SInputAction;
  2080.  
  2081. if( !GetCiriPlayer().HasSword() )
  2082. return false;
  2083.  
  2084. specialAttackAction = theInput.GetAction('CiriSpecialAttackHeavy');
  2085.  
  2086. if( thePlayer.GetBIsInputAllowed() && IsReleased(action) && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) == 0 )
  2087. {
  2088. if( IsActionAllowed(EIAB_HeavyAttacks) && IsActionAllowed(EIAB_SwordAttack) )
  2089. {
  2090. if ( thePlayer.GetCurrentMeleeWeaponType() == PW_Steel )
  2091. {
  2092. thePlayer.PrepareToAttack();
  2093. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2094. if ( thePlayer.GetBIsCombatActionAllowed() )
  2095. thePlayer.ProcessCombatActionBuffer();
  2096. }
  2097. }
  2098. else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  2099. {
  2100. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2101. }
  2102. }
  2103. }
  2104.  
  2105.  
  2106. event OnCbtCiriSpecialAttackHeavy( action : SInputAction )
  2107. {
  2108. if( !GetCiriPlayer().HasSword() )
  2109. return false;
  2110.  
  2111. if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) )
  2112. {
  2113. theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2114. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Pressed );
  2115. thePlayer.ProcessCombatActionBuffer();
  2116. }
  2117. else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack_Heavy && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0 )
  2118. {
  2119. theInput.ForceDeactivateAction('CiriAttackHeavy');
  2120. theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2121. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Released );
  2122. thePlayer.ProcessCombatActionBuffer();
  2123. }
  2124. }
  2125.  
  2126. event OnCbtCiriDodge( action : SInputAction )
  2127. {
  2128. if( IsActionAllowed(EIAB_Dodge) && IsPressed(action) && thePlayer.IsAlive() )
  2129. {
  2130. if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2131. {
  2132. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2133. thePlayer.ProcessCombatActionBuffer();
  2134. }
  2135. else if ( thePlayer.GetBIsInputAllowed() )
  2136. {
  2137. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2138. if ( thePlayer.GetBIsCombatActionAllowed() )
  2139. thePlayer.ProcessCombatActionBuffer();
  2140. }
  2141. else
  2142. {
  2143. if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2144. {
  2145. if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2146. {
  2147. thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2148. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2149. thePlayer.ProcessCombatActionBuffer();
  2150. }
  2151. else
  2152. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2153. }
  2154. }
  2155. }
  2156. else if ( !IsActionAllowed(EIAB_Dodge) )
  2157. {
  2158. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2159. }
  2160. }
  2161.  
  2162. event OnCbtCiriDash( action : SInputAction )
  2163. {
  2164. if ( theInput.LastUsedGamepad() && IsPressed( action ) )
  2165. {
  2166. thePlayer.StartDodgeTimer();
  2167. }
  2168. else if( IsActionAllowed(EIAB_Dodge) && thePlayer.IsAlive() )
  2169. {
  2170. if ( theInput.LastUsedGamepad() )
  2171. {
  2172. if ( !(thePlayer.IsDodgeTimerRunning() && !thePlayer.IsInsideInteraction() && IsReleased(action)) )
  2173. return false;
  2174. }
  2175.  
  2176. if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2177. {
  2178. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2179. thePlayer.ProcessCombatActionBuffer();
  2180. }
  2181. else if ( thePlayer.GetBIsInputAllowed() )
  2182. {
  2183. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2184. if ( thePlayer.GetBIsCombatActionAllowed() )
  2185. thePlayer.ProcessCombatActionBuffer();
  2186. }
  2187. else
  2188. {
  2189. if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2190. {
  2191. if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2192. {
  2193. thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2194. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2195. thePlayer.ProcessCombatActionBuffer();
  2196. }
  2197. else
  2198. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  2199. }
  2200. }
  2201. }
  2202. else if ( !IsActionAllowed(EIAB_Dodge) )
  2203. {
  2204. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2205. }
  2206. }
  2207.  
  2208. event OnCbtDodge( action : SInputAction )
  2209. {
  2210. if ( IsPressed(action) )
  2211. {
  2212.  
  2213. if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign'))
  2214. {
  2215.  
  2216.  
  2217. }
  2218. else
  2219.  
  2220. {
  2221. thePlayer.EvadePressed(EBAT_Dodge);
  2222. }
  2223. }
  2224. }
  2225.  
  2226. event OnCbtRoll( action : SInputAction )
  2227. {
  2228. if ( theInput.LastUsedPCInput() )
  2229. {
  2230. if ( IsPressed( action ) )
  2231. {
  2232. thePlayer.EvadePressed(EBAT_Roll);
  2233. }
  2234. }
  2235. else
  2236. {
  2237. if ( IsPressed( action ) )
  2238. {
  2239.  
  2240. if(altSignCasting && theInput.IsActionPressed('CastSign'))
  2241. {
  2242. return false;
  2243. }
  2244.  
  2245. else
  2246. {
  2247. thePlayer.StartDodgeTimer();
  2248. }
  2249. }
  2250. else if ( IsReleased( action ) )
  2251. {
  2252. if ( thePlayer.IsDodgeTimerRunning() )
  2253. {
  2254. thePlayer.StopDodgeTimer();
  2255. if ( !thePlayer.IsInsideInteraction() )
  2256. thePlayer.EvadePressed(EBAT_Roll);
  2257. }
  2258.  
  2259. }
  2260. }
  2261. }
  2262.  
  2263.  
  2264. public function GetIsAltSignCasting() : bool
  2265. {
  2266. return altSignCasting;
  2267. }
  2268.  
  2269. public function GetIsAltSignCastingPressed() : bool
  2270. {
  2271. return altSignCasting && theInput.IsActionPressed('CastSign');
  2272. }
  2273.  
  2274. public function SetIsAltSignCasting(enable : bool)
  2275. {
  2276. altSignCasting = enable;
  2277. }
  2278.  
  2279. private function AltCastSign(signType : ESignType)
  2280. {
  2281. var signSkill : ESkill;
  2282.  
  2283. if( !thePlayer.GetBIsInputAllowed() )
  2284. {
  2285. return;
  2286. }
  2287.  
  2288. if( !IsActionAllowed(EIAB_Signs) || GetWitcherPlayer().IsSignBlocked(signType) )
  2289. {
  2290. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs);
  2291. return;
  2292. }
  2293. if ( thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsableItemLBlocked() )
  2294. {
  2295. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2296. return;
  2297. }
  2298.  
  2299. signSkill = SignEnumToSkillEnum(signType);
  2300. if( signSkill != S_SUndefined )
  2301. {
  2302. if(!thePlayer.CanUseSkill(signSkill))
  2303. {
  2304. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs, false, false, true);
  2305. return;
  2306. }
  2307.  
  2308. if( thePlayer.HasStaminaToUseSkill( signSkill, false ) )
  2309. {
  2310. GetWitcherPlayer().SetEquippedSign(signType);
  2311. thePlayer.SetupCombatAction( EBAT_CastSign, BS_Pressed );
  2312. }
  2313. else
  2314. {
  2315. thePlayer.SoundEvent("gui_no_stamina");
  2316. }
  2317. }
  2318. }
  2319.  
  2320.  
  2321. var lastMovementDoubleTapName : name;
  2322.  
  2323. event OnMovementDoubleTap( action : SInputAction )
  2324. {
  2325. if ( IsPressed( action ) )
  2326. {
  2327. if ( !thePlayer.IsDodgeTimerRunning() || action.aName != lastMovementDoubleTapName )
  2328. {
  2329. thePlayer.StartDodgeTimer();
  2330. lastMovementDoubleTapName = action.aName;
  2331. }
  2332. else
  2333. {
  2334. thePlayer.StopDodgeTimer();
  2335.  
  2336. thePlayer.EvadePressed(EBAT_Dodge);
  2337. }
  2338.  
  2339. }
  2340. }
  2341.  
  2342. event OnCastSign( action : SInputAction )
  2343. {
  2344. var signSkill : ESkill;
  2345.  
  2346. if( altSignCasting )
  2347. thePlayer.ApplyCastSettings();
  2348.  
  2349.  
  2350. if(altSignCasting && !theInput.LastUsedPCInput())
  2351. {
  2352. if(IsPressed( action ) && (theInput.GetActionValue( 'LockAndGuard' ) > 0))
  2353. {
  2354. AltCastSign(ST_Igni);
  2355. }
  2356. else if(IsPressed( action ))
  2357. {
  2358. thePlayer.BlockAction(EIAB_Interactions, 'NGE_CastSign_Block');
  2359. thePlayer.BlockAction(EIAB_InteractionAction, 'NGE_CastSign_Block');
  2360. thePlayer.BlockAction(EIAB_InteractionContainers, 'NGE_CastSign_Block');
  2361. }
  2362. else if(IsReleased( action ))
  2363. {
  2364. thePlayer.UnblockAction(EIAB_Interactions, 'NGE_CastSign_Block');
  2365. thePlayer.UnblockAction(EIAB_InteractionAction, 'NGE_CastSign_Block');
  2366. thePlayer.UnblockAction(EIAB_InteractionContainers, 'NGE_CastSign_Block');
  2367. }
  2368.  
  2369. return false;
  2370. }
  2371.  
  2372.  
  2373. if( !thePlayer.GetBIsInputAllowed() )
  2374. {
  2375. return false;
  2376. }
  2377.  
  2378. if( IsPressed(action) )
  2379. {
  2380. if( !IsActionAllowed(EIAB_Signs) )
  2381. {
  2382. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs);
  2383. return false;
  2384. }
  2385. if ( thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsableItemLBlocked() )
  2386. {
  2387. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2388. return false;
  2389. }
  2390.  
  2391. signSkill = SignEnumToSkillEnum( thePlayer.GetEquippedSign() );
  2392. if( signSkill != S_SUndefined )
  2393. {
  2394. if(!thePlayer.CanUseSkill(signSkill))
  2395. {
  2396. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs, false, false, true);
  2397. return false;
  2398. }
  2399.  
  2400. if( thePlayer.HasStaminaToUseSkill( signSkill, false ) )
  2401. {
  2402. if( GetInvalidUniqueId() != thePlayer.inv.GetItemFromSlot( 'l_weapon' ) && !thePlayer.IsUsableItemLBlocked())
  2403. {
  2404.  
  2405.  
  2406.  
  2407. }
  2408. thePlayer.SetupCombatAction( EBAT_CastSign, BS_Pressed );
  2409. }
  2410. else
  2411. {
  2412. thePlayer.SoundEvent("gui_no_stamina");
  2413. }
  2414. }
  2415. }
  2416. }
  2417.  
  2418.  
  2419.  
  2420.  
  2421. event OnThrowBomb(action : SInputAction)
  2422. {
  2423. var selectedItemId : SItemUniqueId;
  2424.  
  2425. selectedItemId = thePlayer.GetSelectedItemId();
  2426. if(!thePlayer.inv.IsItemBomb(selectedItemId))
  2427. return false;
  2428.  
  2429. if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 )
  2430. {
  2431.  
  2432. if(IsPressed(action))
  2433. {
  2434. thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  2435. }
  2436.  
  2437. return false;
  2438. }
  2439.  
  2440. if ( IsReleased(action) )
  2441. {
  2442. if ( thePlayer.IsThrowHold() )
  2443. {
  2444. if ( thePlayer.playerAiming.GetAimedTarget() )
  2445. {
  2446. if ( thePlayer.AllowAttack( thePlayer.playerAiming.GetAimedTarget(), EBAT_ItemUse ) )
  2447. {
  2448. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  2449. thePlayer.ProcessCombatActionBuffer();
  2450. }
  2451. else
  2452. thePlayer.BombThrowAbort();
  2453. }
  2454. else
  2455. {
  2456. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  2457. thePlayer.ProcessCombatActionBuffer();
  2458. }
  2459.  
  2460. thePlayer.SetThrowHold( false );
  2461.  
  2462. return true;
  2463.  
  2464. }
  2465. else
  2466. {
  2467. if(!IsActionAllowed(EIAB_ThrowBomb))
  2468. {
  2469. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  2470. return false;
  2471. }
  2472.  
  2473. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2474. {
  2475. thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  2476. thePlayer.OnUseSelectedItem( true );
  2477. return true;
  2478. }
  2479. if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )
  2480. {
  2481.  
  2482. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  2483. return true;
  2484. }
  2485.  
  2486. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2487. return true;
  2488. }
  2489. }
  2490.  
  2491. return false;
  2492. }
  2493.  
  2494. event OnThrowBombHold(action : SInputAction)
  2495. {
  2496. var locks : array<SInputActionLock>;
  2497. var ind : int;
  2498.  
  2499. var selectedItemId : SItemUniqueId;
  2500.  
  2501. selectedItemId = thePlayer.GetSelectedItemId();
  2502. if(!thePlayer.inv.IsItemBomb(selectedItemId))
  2503. return false;
  2504.  
  2505. if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 )
  2506. {
  2507.  
  2508. if(IsPressed(action))
  2509. {
  2510. thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  2511. }
  2512.  
  2513. return false;
  2514. }
  2515.  
  2516. if( IsPressed(action) )
  2517. {
  2518. if(!IsActionAllowed(EIAB_ThrowBomb))
  2519. {
  2520. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  2521. return false;
  2522. }
  2523. else if(GetWitcherPlayer().GetBombDelay(GetWitcherPlayer().GetItemSlot(selectedItemId)) > 0 )
  2524. {
  2525.  
  2526. return false;
  2527. }
  2528. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2529. {
  2530. thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  2531. thePlayer.OnUseSelectedItem( true );
  2532. return true;
  2533. }
  2534. if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )
  2535. {
  2536. if( thePlayer.GetBIsCombatActionAllowed() )
  2537. {
  2538. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Pressed );
  2539. thePlayer.ProcessCombatActionBuffer();
  2540. }
  2541. }
  2542.  
  2543.  
  2544.  
  2545. locks = GetActionLocks(EIAB_ThrowBomb);
  2546. ind = FindActionLockIndex(EIAB_ThrowBomb, 'BombThrow');
  2547. if(ind >= 0)
  2548. locks.Erase(ind);
  2549.  
  2550. if(locks.Size() != 0)
  2551. return false;
  2552.  
  2553. thePlayer.SetThrowHold( true );
  2554. return true;
  2555. }
  2556.  
  2557. return false;
  2558. }
  2559.  
  2560. event OnThrowBombAbort(action : SInputAction)
  2561. {
  2562. if( IsPressed(action) )
  2563. {
  2564. thePlayer.BombThrowAbort();
  2565. }
  2566. }
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572. event OnCbtThrowItem( action : SInputAction )
  2573. {
  2574. var isUsableItem, isCrossbow, isBomb, ret : bool;
  2575. var itemId : SItemUniqueId;
  2576.  
  2577.  
  2578. if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering())
  2579. return false;
  2580.  
  2581. if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  2582. return false;
  2583.  
  2584. itemId = thePlayer.GetSelectedItemId();
  2585.  
  2586. if(!thePlayer.inv.IsIdValid(itemId))
  2587. return false;
  2588.  
  2589. isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  2590. if(!isCrossbow)
  2591. {
  2592. isBomb = thePlayer.inv.IsItemBomb(itemId);
  2593. if(!isBomb)
  2594. {
  2595. isUsableItem = true;
  2596. }
  2597. }
  2598.  
  2599.  
  2600.  
  2601.  
  2602. if( isCrossbow )
  2603. {
  2604. if ( IsActionAllowed(EIAB_Crossbow) )
  2605. {
  2606. if( IsPressed(action))
  2607. {
  2608. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  2609. {
  2610.  
  2611.  
  2612. thePlayer.SetPlayerActionToRestore ( PATR_Crossbow );
  2613. thePlayer.OnUseSelectedItem( true );
  2614. ret = true;
  2615. }
  2616. else if ( thePlayer.GetBIsInputAllowed() && !thePlayer.IsCurrentlyUsingItemL() )
  2617. {
  2618. thePlayer.SetIsAimingCrossbow( true );
  2619. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  2620.  
  2621.  
  2622. ret = true;
  2623. }
  2624. }
  2625. else
  2626. {
  2627.  
  2628. if ( thePlayer.GetIsAimingCrossbow() && !thePlayer.IsCurrentlyUsingItemL() )
  2629. {
  2630. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2631.  
  2632.  
  2633. thePlayer.SetIsAimingCrossbow( false );
  2634. ret = true;
  2635. }
  2636. }
  2637. }
  2638. else
  2639. {
  2640. if ( !thePlayer.IsInShallowWater() )
  2641. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  2642. }
  2643.  
  2644. if ( IsPressed(action) )
  2645. thePlayer.AddTimer( 'IsItemUseInputHeld', 0.00001, true );
  2646. else
  2647. thePlayer.RemoveTimer('IsItemUseInputHeld');
  2648.  
  2649. return ret;
  2650. }
  2651. else if(isBomb)
  2652. {
  2653. return OnThrowBomb(action);
  2654. }
  2655. else if(isUsableItem && !thePlayer.IsSwimming() )
  2656. {
  2657. if( IsActionAllowed(EIAB_UsableItem) )
  2658. {
  2659. if(IsPressed(action) && thePlayer.HasStaminaToUseAction(ESAT_UsableItem))
  2660. {
  2661. thePlayer.SetPlayerActionToRestore ( PATR_Default );
  2662. thePlayer.OnUseSelectedItem();
  2663. return true;
  2664. }
  2665.  
  2666. }
  2667. else
  2668. {
  2669. thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  2670. }
  2671. }
  2672.  
  2673. return false;
  2674. }
  2675.  
  2676. event OnCbtThrowItemHold( action : SInputAction )
  2677. {
  2678. var isBomb, isCrossbow, isUsableItem : bool;
  2679. var itemId : SItemUniqueId;
  2680.  
  2681.  
  2682. if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering() )
  2683. return false;
  2684.  
  2685. if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  2686. return false;
  2687.  
  2688. itemId = thePlayer.GetSelectedItemId();
  2689.  
  2690. if(!thePlayer.inv.IsIdValid(itemId))
  2691. return false;
  2692.  
  2693. isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  2694. if(!isCrossbow)
  2695. {
  2696. isBomb = thePlayer.inv.IsItemBomb(itemId);
  2697. if(isBomb)
  2698. {
  2699. return OnThrowBombHold(action);
  2700. }
  2701. else
  2702. {
  2703. isUsableItem = true;
  2704. }
  2705. }
  2706.  
  2707.  
  2708. if(IsPressed(action))
  2709. {
  2710. if( isCrossbow && !IsActionAllowed(EIAB_Crossbow) )
  2711. {
  2712. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  2713. return false;
  2714. }
  2715.  
  2716. if( isUsableItem)
  2717. {
  2718. if(!IsActionAllowed(EIAB_UsableItem))
  2719. {
  2720. thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  2721. return false;
  2722. }
  2723. else if(thePlayer.IsSwimming())
  2724. {
  2725. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  2726. return false;
  2727. }
  2728. }
  2729. }
  2730.  
  2731. if( IsPressed(action) )
  2732. {
  2733. thePlayer.SetThrowHold( true );
  2734. return true;
  2735. }
  2736. else if( IsReleased(action) && thePlayer.IsThrowHold())
  2737. {
  2738.  
  2739.  
  2740. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  2741. thePlayer.SetThrowHold( false );
  2742. return true;
  2743. }
  2744.  
  2745. return false;
  2746. }
  2747.  
  2748. event OnCbtThrowCastAbort( action : SInputAction )
  2749. {
  2750. var player : W3PlayerWitcher;
  2751. var throwStage : EThrowStage;
  2752.  
  2753. if(thePlayer.inv.IsItemBomb(thePlayer.GetSelectedItemId()))
  2754. {
  2755. return OnThrowBombAbort(action);
  2756. }
  2757.  
  2758. if( IsPressed(action) )
  2759. {
  2760. player = GetWitcherPlayer();
  2761. if(player)
  2762. {
  2763. if( player.IsCastingSign() )
  2764. {
  2765. player.CastSignAbort();
  2766. }
  2767. else
  2768. {
  2769. if ( thePlayer.inv.IsItemCrossbow( thePlayer.inv.GetItemFromSlot( 'l_weapon' ) ) )
  2770. {
  2771. thePlayer.OnRangedForceHolster();
  2772. }
  2773. else
  2774. {
  2775. throwStage = (int)thePlayer.GetBehaviorVariable( 'throwStage', (int)TS_Stop);
  2776.  
  2777. if(throwStage == TS_Start || throwStage == TS_Loop)
  2778. player.ThrowingAbort();
  2779. }
  2780. }
  2781. }
  2782. }
  2783. }
  2784.  
  2785. event OnCbtSelectLockTarget( inputVector : Vector )
  2786. {
  2787. var newLockTarget : CActor;
  2788. var inputHeading : float;
  2789. var target : CActor;
  2790.  
  2791. inputVector.Y = inputVector.Y * -1.f;
  2792. inputHeading = VecHeading( inputVector );
  2793.  
  2794. newLockTarget = thePlayer.GetScreenSpaceLockTarget( thePlayer.GetDisplayTarget(), 180.f, 1.f, inputHeading );
  2795.  
  2796. if ( newLockTarget )
  2797. thePlayer.ProcessLockTarget( newLockTarget );
  2798.  
  2799. target = thePlayer.GetTarget();
  2800. if ( target )
  2801. {
  2802. thePlayer.SetSlideTarget( target );
  2803.  
  2804. }
  2805. }
  2806.  
  2807. event OnCbtLockAndGuard( action : SInputAction )
  2808. {
  2809. if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  2810. return false;
  2811.  
  2812.  
  2813. if( IsReleased(action) )
  2814. {
  2815.  
  2816. if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign') && GetWitcherPlayer().IsCurrentSignChanneled())
  2817. {
  2818. thePlayer.AbortSign();
  2819. }
  2820.  
  2821.  
  2822. thePlayer.SetGuarded(false);
  2823. thePlayer.OnGuardedReleased();
  2824. }
  2825.  
  2826. if( (thePlayer.IsWeaponHeld('fists') || thePlayer.GetCurrentStateName() == 'CombatFists') && !IsActionAllowed(EIAB_Fists))
  2827. {
  2828. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2829. return false;
  2830. }
  2831.  
  2832. if( IsPressed(action) )
  2833. {
  2834.  
  2835. if(altSignCasting && !theInput.LastUsedPCInput() && theInput.IsActionPressed('CastSign'))
  2836. {
  2837. AltCastSign(ST_Igni);
  2838. return false;
  2839. }
  2840.  
  2841.  
  2842.  
  2843. if( !IsActionAllowed(EIAB_Parry) )
  2844. {
  2845. if ( IsActionBlockedBy(EIAB_Parry,'UsableItem') )
  2846. {
  2847. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);
  2848. }
  2849. return true;
  2850. }
  2851.  
  2852. if ( thePlayer.GetCurrentStateName() == 'Exploration' )
  2853. thePlayer.GoToCombatIfNeeded();
  2854.  
  2855. if ( thePlayer.bLAxisReleased )
  2856. thePlayer.ResetRawPlayerHeading();
  2857.  
  2858. if ( thePlayer.rangedWeapon && thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  2859. thePlayer.OnRangedForceHolster( true, true );
  2860.  
  2861. thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  2862. thePlayer.SetGuarded(true);
  2863. thePlayer.OnPerformGuard();
  2864. }
  2865. }
  2866.  
  2867. event OnCbtCameraLockOrSpawnHorse( action : SInputAction )
  2868. {
  2869. if ( OnCbtCameraLock(action) )
  2870. return true;
  2871.  
  2872. if ( OnCommSpawnHorse(action) )
  2873. return true;
  2874.  
  2875. return false;
  2876. }
  2877.  
  2878. event OnCbtCameraLock( action : SInputAction )
  2879. {
  2880. if( IsPressed(action) )
  2881. {
  2882. if ( thePlayer.IsThreatened() || thePlayer.IsActorLockedToTarget() )
  2883. {
  2884. if( !IsActionAllowed(EIAB_CameraLock))
  2885. {
  2886. return false;
  2887. }
  2888. else if ( !thePlayer.IsHardLockEnabled() && thePlayer.GetDisplayTarget() && (CActor)( thePlayer.GetDisplayTarget() ) && IsActionAllowed(EIAB_HardLock))
  2889. {
  2890. if ( thePlayer.bLAxisReleased )
  2891. thePlayer.ResetRawPlayerHeading();
  2892.  
  2893. thePlayer.HardLockToTarget( true );
  2894. }
  2895. else
  2896. {
  2897. thePlayer.HardLockToTarget( false );
  2898. }
  2899. return true;
  2900. }
  2901. }
  2902. return false;
  2903. }
  2904.  
  2905. event OnChangeCameraPreset( action : SInputAction )
  2906. {
  2907. if( IsPressed(action) )
  2908. {
  2909. ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  2910. }
  2911. }
  2912.  
  2913. event OnChangeCameraPresetByMouseWheel( action : SInputAction )
  2914. {
  2915. var tolerance : float;
  2916. tolerance = 10.0f;
  2917.  
  2918. if( ( action.value * totalCameraPresetChange ) < 0.0f )
  2919. {
  2920. totalCameraPresetChange = 0.0f;
  2921. }
  2922.  
  2923. totalCameraPresetChange += action.value;
  2924. if( totalCameraPresetChange < -tolerance )
  2925. {
  2926. ((CCustomCamera)theCamera.GetTopmostCameraObject()).PrevPreset();
  2927. totalCameraPresetChange = 0.0f;
  2928. }
  2929. else if( totalCameraPresetChange > tolerance )
  2930. {
  2931. ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  2932. totalCameraPresetChange = 0.0f;
  2933. }
  2934. }
  2935.  
  2936. event OnMeditationAbort(action : SInputAction)
  2937. {
  2938. var med : W3PlayerWitcherStateMeditation;
  2939.  
  2940. if (!theGame.GetGuiManager().IsAnyMenu())
  2941. {
  2942. med = (W3PlayerWitcherStateMeditation)GetWitcherPlayer().GetCurrentState();
  2943. if(med)
  2944. {
  2945.  
  2946.  
  2947. med.StopRequested(false);
  2948. }
  2949. }
  2950. }
  2951.  
  2952. public final function ClearLocksForNGP()
  2953. {
  2954. var i : int;
  2955.  
  2956. for(i=actionLocks.Size()-1; i>=0; i-=1)
  2957. {
  2958. OnActionLockChanged(i, false);
  2959. actionLocks[i].Clear();
  2960. }
  2961. }
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967. public function Dbg_UnlockAllActions()
  2968. {
  2969. var i : int;
  2970.  
  2971. if( theGame.IsFinalBuild() )
  2972. {
  2973. return;
  2974. }
  2975.  
  2976. for(i=actionLocks.Size()-1; i>=0; i-=1)
  2977. {
  2978. OnActionLockChanged(i, false);
  2979. }
  2980. actionLocks.Clear();
  2981. }
  2982.  
  2983. event OnDbgSpeedUp( action : SInputAction )
  2984. {
  2985. if( theGame.IsFinalBuild() )
  2986. {
  2987. return false;
  2988. }
  2989.  
  2990. if(IsPressed(action))
  2991. {
  2992. theGame.SetTimeScale(4, theGame.GetTimescaleSource(ETS_DebugInput), theGame.GetTimescalePriority(ETS_DebugInput));
  2993. }
  2994. else if(IsReleased(action))
  2995. {
  2996. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_DebugInput) );
  2997. }
  2998. }
  2999.  
  3000. event OnDbgHit( action : SInputAction )
  3001. {
  3002. if( theGame.IsFinalBuild() )
  3003. {
  3004. return false;
  3005. }
  3006.  
  3007. if(IsReleased(action))
  3008. {
  3009. thePlayer.SetBehaviorVariable( 'HitReactionDirection',(int)EHRD_Back);
  3010. thePlayer.SetBehaviorVariable( 'isAttackReflected', 0 );
  3011. thePlayer.SetBehaviorVariable( 'HitReactionType', (int)EHRT_Heavy);
  3012. thePlayer.SetBehaviorVariable( 'HitReactionWeapon', 0);
  3013. thePlayer.SetBehaviorVariable( 'HitSwingDirection',(int)ASD_LeftRight);
  3014. thePlayer.SetBehaviorVariable( 'HitSwingType',(int)AST_Horizontal);
  3015.  
  3016. thePlayer.RaiseForceEvent( 'Hit' );
  3017. thePlayer.OnRangedForceHolster( true );
  3018. GetWitcherPlayer().SetCustomRotation( 'Hit', thePlayer.GetHeading()+180, 1080.f, 0.1f, false );
  3019. thePlayer.CriticalEffectAnimationInterrupted("OnDbgHit");
  3020. }
  3021. }
  3022.  
  3023. event OnDbgKillTarget( action : SInputAction )
  3024. {
  3025. var target : CActor;
  3026.  
  3027. if( theGame.IsFinalBuild() )
  3028. {
  3029. return false;
  3030. }
  3031.  
  3032. target = thePlayer.GetTarget();
  3033.  
  3034. if( target && IsReleased(action) )
  3035. {
  3036. target.Kill( 'Debug' );
  3037. }
  3038. }
  3039.  
  3040. event OnDbgKillAll( action : SInputAction )
  3041. {
  3042. if( theGame.IsFinalBuild() )
  3043. {
  3044. return false;
  3045. }
  3046.  
  3047. if(IsReleased(action))
  3048. thePlayer.DebugKillAll();
  3049. }
  3050.  
  3051.  
  3052. event OnDbgKillAllTargetingPlayer( action : SInputAction )
  3053. {
  3054. var i : int;
  3055. var all : array<CActor>;
  3056.  
  3057. if( theGame.IsFinalBuild() )
  3058. {
  3059. return false;
  3060. }
  3061.  
  3062. if(IsPressed(action))
  3063. {
  3064. all = GetActorsInRange(thePlayer, 10000, 10000, '', true);
  3065. for(i=0; i<all.Size(); i+=1)
  3066. {
  3067. if(all[i] != thePlayer && all[i].GetTarget() == thePlayer)
  3068. all[i].Kill( 'Debug' );
  3069. }
  3070. }
  3071. }
  3072.  
  3073. event OnDbgTeleportToPin( action : SInputAction )
  3074. {
  3075. if( theGame.IsFinalBuild() )
  3076. {
  3077. return false;
  3078. }
  3079.  
  3080. if(IsReleased(action))
  3081. thePlayer.DebugTeleportToPin();
  3082. }
  3083. //---=== telepporttopin ===---
  3084. event OnTeleportToPin( action : SInputAction )
  3085. {
  3086. var mapManager : CCommonMapManager = theGame.GetCommonMapManager();
  3087. var rootMenu : CR4Menu = theGame.GetGuiManager().GetRootMenu();
  3088. // var mapMenu : CR4MapMenu;
  3089. var currWorld : CWorld = theGame.GetWorld();
  3090. var destWorldPath : string;
  3091. var id : int;
  3092. var area : int;
  3093. var type : int;
  3094. var position : Vector;
  3095. var rotation : EulerAngles;
  3096. var goToCurrent : Bool = false;
  3097. var goToOther : Bool = false;
  3098. var i : int;
  3099.  
  3100. if(IsReleased(action)){
  3101.  
  3102. if (mapManager.GetIdOfFirstUser1MapPin(id))
  3103. {
  3104. // Log("id: "+IntToString(id));
  3105. i = mapManager.GetUserMapPinIndexById(id);
  3106. // Log("i: "+IntToString(i));
  3107. mapManager.GetUserMapPinByIndex( i, id, area, position.X, position.Y, type );
  3108. // Log("index: "+IntToString(i)+" ; id: "+IntToString(id)+" ; area: "+IntToString(area)+" ; type: "+IntToString(type));
  3109. destWorldPath = mapManager.GetWorldPathFromAreaType( area );
  3110.  
  3111. if (destWorldPath == currWorld.GetPath() )
  3112. {
  3113. goToCurrent = true;
  3114. }
  3115. else
  3116. {
  3117. goToOther = true;
  3118. }
  3119. }
  3120. else
  3121. {
  3122. theGame.RequestMenuWithBackground( 'MapMenu', 'CommonMenu' );
  3123. }
  3124.  
  3125. if ( goToCurrent )
  3126. {
  3127. currWorld.NavigationComputeZ(position, -500.f, 500.f, position.Z);
  3128.  
  3129. thePlayer.Teleport( position );
  3130.  
  3131. if ( !currWorld.NavigationComputeZ(position, -500.f, 500.f, position.Z) )
  3132. {
  3133. thePlayer.AddTimer( 'DebugWaitForNavigableTerrain', 0.25f, true );
  3134. }
  3135. }
  3136. else if ( goToOther )
  3137. {
  3138. theGame.ScheduleWorldChangeToPosition( destWorldPath, position, rotation );
  3139. thePlayer.AddTimer( 'DebugWaitForNavigableTerrain', 0.25f, true, , , true );
  3140. }
  3141.  
  3142. if ( rootMenu )
  3143. {
  3144. rootMenu.CloseMenu();
  3145. }
  3146. }
  3147. }
  3148. //---=== telepporttopin ===---
  3149.  
  3150.  
  3151.  
  3152. event OnBoatDismount( action : SInputAction )
  3153. {
  3154. var boatComp : CBoatComponent;
  3155. var stopAction : SInputAction;
  3156.  
  3157. stopAction = theInput.GetAction('GI_Decelerate');
  3158.  
  3159. if( IsReleased(action) && ( theInput.LastUsedPCInput() || ( stopAction.value < 0.7 && stopAction.lastFrameValue < 0.7 ) ) )
  3160. {
  3161. if( thePlayer.IsActionAllowed( EIAB_DismountVehicle ) )
  3162. {
  3163. boatComp = (CBoatComponent)thePlayer.GetUsedVehicle().GetComponentByClassName( 'CBoatComponent' );
  3164. boatComp.IssueCommandToDismount( DT_normal );
  3165. }
  3166. else
  3167. {
  3168. thePlayer.DisplayActionDisallowedHudMessage(EIAB_DismountVehicle);
  3169. }
  3170. }
  3171. }
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177. event OnCiriDrawWeapon( action : SInputAction )
  3178. {
  3179. var duringCastSign : bool;
  3180.  
  3181.  
  3182. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  3183. {
  3184. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() )
  3185. {
  3186. if (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel && !thePlayer.IsThreatened() )
  3187. thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3188. else
  3189. thePlayer.OnEquipMeleeWeapon( PW_Steel, false );
  3190. }
  3191. }
  3192. else if(IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel || thePlayer.GetCurrentMeleeWeaponType() == PW_Silver) ) )
  3193. {
  3194. CiriSheatheWeapon();
  3195. }
  3196. }
  3197.  
  3198. event OnCiriHolsterWeapon( action : SInputAction )
  3199. {
  3200. var currWeaponType : EPlayerWeapon;
  3201.  
  3202. if(IsPressed( action ))
  3203. {
  3204. currWeaponType = thePlayer.GetCurrentMeleeWeaponType();
  3205.  
  3206. if(currWeaponType == PW_Steel || currWeaponType == PW_Silver)
  3207. {
  3208. CiriSheatheWeapon();
  3209. }
  3210. }
  3211. }
  3212.  
  3213. //---=== resurrect ===---
  3214. event OnResurrect( action : SInputAction )
  3215. {
  3216. if(IsPressed (action))
  3217. {
  3218. if ( !thePlayer.IsAlive() )
  3219. {
  3220. thePlayer.CheatResurrect();
  3221. theInput.RestoreContext( 'Exploration', true );
  3222. theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
  3223. }
  3224. }
  3225. }
  3226. //---=== resurrect ===---
  3227.  
  3228. //---=== tpfreecam ===---
  3229. event OnTpFreeCam(action : SInputAction)
  3230. {
  3231. /* var cameraRotation : EulerAngles = theCamera.GetCameraRotation();
  3232. var pos : Vector = theGame.GetFreeCameraPosition();*/
  3233.  
  3234. if(IsPressed(action) && theGame.IsFreeCameraEnabled() && !theGame.IsDialogOrCutscenePlaying() )
  3235. {
  3236. thePlayer.Teleport(theGame.GetFreeCameraPosition());
  3237.  
  3238. /* thePlayer.TeleportWithRotation( pos , VecToRotation(VecFromHeading(theCamera.GetCameraHeading())));
  3239. theGame.MoveFreeCamera( pos, cameraRotation );*/
  3240. }
  3241. }
  3242. //---=== tpfreecam ===---
  3243.  
  3244. private final function CiriSheatheWeapon()
  3245. {
  3246. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && !thePlayer.IsThreatened() )
  3247. {
  3248. thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3249. }
  3250. }
  3251.  
  3252.  
  3253.  
  3254.  
  3255. event OnCommHoldFastMenu( action : SInputAction )
  3256. {
  3257. if(IsPressed(action))
  3258. {
  3259. holdFastMenuInvoked = true;
  3260. PushInventoryScreen();
  3261. }
  3262. }
  3263.  
  3264. event OnFastMenu( action : SInputAction )
  3265. {
  3266. if( IsReleased(action) )
  3267. {
  3268. if(holdFastMenuInvoked)
  3269. {
  3270. holdFastMenuInvoked = false;
  3271. return false;
  3272. }
  3273.  
  3274. if ( theGame.IsBlackscreenOrFading() )
  3275. {
  3276. return false;
  3277. }
  3278.  
  3279. if (theGame.GetGuiManager().IsAnyMenu())
  3280. {
  3281. return false;
  3282. }
  3283.  
  3284. if( IsActionAllowed( EIAB_OpenFastMenu ) )
  3285. {
  3286. theGame.SetMenuToOpen( '' );
  3287. theGame.RequestMenu('CommonMenu' );
  3288. }
  3289. else
  3290. {
  3291. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenFastMenu);
  3292. }
  3293. }
  3294. }
  3295.  
  3296. event OnIngameMenu( action : SInputAction )
  3297. {
  3298. var openedPanel : name;
  3299. openedPanel = theGame.GetMenuToOpen();
  3300.  
  3301. if (IsPressed(action) && theGame.IsFreeCameraEnabled() && theGame.GetTimeScale() > 0.1 && !theInput.IsActionPressed('Sprint')){
  3302. thePlayer.RemoveTimer( 'FCControl' );
  3303. thePlayer.AddTimer( 'FCControl', 0.f, true );
  3304. theGame.SetTimeScale(0.0016 , theGame.GetTimescaleSource(ETS_DebugInput), theGame.GetTimescalePriority(ETS_DebugInput), false, true );
  3305. theGame.GetGuiManager().ShowNotification("Game slowed down");
  3306. /* thePlayer.freezeall( true );
  3307. theSound.SoundEvent( "system_pause" );
  3308. theGame.PauseGameplayFx( true );
  3309. theGame.GetWorld().ForceUpdateWaterOnPause( true );*/
  3310. }
  3311. else if(IsPressed(action) && theGame.IsFreeCameraEnabled()){
  3312. thePlayer.RemoveTimer( 'FCControl' );
  3313. thePlayer.AddTimer( 'FCControl', 0.01f, true );
  3314. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_DebugInput) );
  3315. if (!thePlayer.IsspeedadjusterTimerRunning())
  3316. theGame.GetGuiManager().ShowNotification("Restored Gamespeed");
  3317. /* thePlayer.freezeall( false );
  3318. theSound.SoundEvent( "system_resume" );
  3319. theGame.PauseGameplayFx( false );
  3320. theGame.GetWorld().ForceUpdateWaterOnPause( false );*/
  3321. }
  3322.  
  3323. if ( IsPressed( action ) && theGame.IsFreeCameraEnabled()){
  3324. if (!thePlayer.IsspeedadjusterTimerRunning()){
  3325. thePlayer.StartSpeedAdjuster();
  3326. }else{
  3327. thePlayer.StopSpeedAdjuster();
  3328. if (!FactsDoesExist("SlowFC")){
  3329. theGame.GetGuiManager().ShowNotification("Slowed down Freecam");
  3330. FactsAdd("SlowFC");
  3331. }else{
  3332. theGame.GetGuiManager().ShowNotification("Freecam speed restored");
  3333. FactsRemove("SlowFC");
  3334. }
  3335. }
  3336. }
  3337.  
  3338. if( IsReleased(action)
  3339. && openedPanel != 'GlossaryTutorialsMenu'
  3340. && !theGame.GetGuiManager().IsAnyMenu()
  3341. && !theGame.IsBlackscreenOrFading()
  3342. && (!theGame.IsFreeCameraEnabled() || theInput.IsActionPressed('Sprint'))
  3343. {
  3344. theGame.SetMenuToOpen( '' );
  3345. theGame.RequestMenu('CommonIngameMenu' );
  3346. }
  3347. }
  3348.  
  3349. event OnToggleHud( action : SInputAction )
  3350. {
  3351. var hud : CR4ScriptedHud;
  3352. if ( IsReleased(action) )
  3353. {
  3354. hud = (CR4ScriptedHud)theGame.GetHud();
  3355. if ( hud )
  3356. {
  3357. hud.ToggleHudByUser();
  3358. }
  3359. }
  3360. }
  3361.  
  3362. public final function Debug_ClearAllActionLocks(optional action : EInputActionBlock, optional all : bool)
  3363. {
  3364. var i : int;
  3365.  
  3366. if(all)
  3367. {
  3368. Dbg_UnlockAllActions();
  3369. }
  3370. else
  3371. {
  3372. OnActionLockChanged(action, false);
  3373. actionLocks[action].Clear();
  3374. }
  3375. }
  3376.  
  3377. public final function OnAutoLootRadiusLoot(action : SInputAction)
  3378. {
  3379. if(IsPressed(action))
  3380. {
  3381. AL_LootInRadius();
  3382. }
  3383. }
  3384. }
  3385.  
Tags: Mods witcher 3
Add Comment
Please, Sign In to add comment