434 {
436 {
437 return super.ModCommandHandlerBefore(pDt, pCurrentCommandID, pCurrentCommandFinished);
438 }
439
441
442 DayZCreatureAIInputController controller;
443 g_Game.GameScript.CallFunction(
this,
"GetInputController", controller, 0);
444
445 if (!input || !controller)
446 {
447 return super.ModCommandHandlerBefore(pDt, pCurrentCommandID, pCurrentCommandFinished);
448 }
449
451
452 float maxTurnSpeed = 100.0;
453 movementX = Math.Clamp(movementX * maxTurnSpeed * pDt, -180, 180);
454
456 {
457 movementX = 0;
458 }
459
462
465
467
468 int iAlert = 0;
469 float fAlert = 0;
470 int iSpeed = 0;
471 float fSpeed = 0;
472
473 if (isMove)
474 {
475 iAlert = 1;
476 fAlert = 0.2;
477
480 bool isWalk = !isSprint && !isJog;
481 if (isSprint)
482 {
484 iSpeed = 3;
485 }
486 else if (isJog)
487 {
489 iSpeed = 2;
490 }
491 else if (isWalk)
492 {
494 iSpeed = 1;
495 }
496 }
497
498 DayZAnimalInputController animalController;
499 if (Class.CastTo(animalController, controller))
500 {
503
504 if (!isMove)
505 {
506 if (isRest)
507 {
508 iSpeed = 0;
510 }
511
512 if (isSleep)
513 {
514 iSpeed = 0;
516 }
517 }
518 }
519
521 if (iSpeed > 0 && lowVel)
522 {
523 iAlert = 4;
524 fAlert = 1.0;
525
526 iSpeed = 3;
527 }
528
529 if (animalController)
530 {
531 switch (iSpeed)
532 {
533 case 0:
534 fSpeed = 0;
535 break;
536 case 1:
537 fSpeed = 2;
538 break;
539 case 2:
540 fSpeed = 3;
541 break;
542 case 3:
543 fSpeed = 5;
544 break;
545 }
546 }
547
552
554 {
556 }
557
558 return true;
559 }
DayZPlayer m_CinematicPlayer
proto native float SyncedValue_ID(int action, bool check_focus=true)
Get action state.
proto native float Length()
Returns length of vector (magnitude)
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.