DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ EOnPostSimulate()

override void OnDebugSpawn::EOnPostSimulate ( IEntity other,
float timeSlice )
protected

См. определение в файле CivilianSedan.c строка 493

494{
498
499 void CivilianSedan()
500 {
501 //m_dmgContactCoef = 0.065;
502
503 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
504 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
505 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
506 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
507 m_EngineStop = "CivilianSedan_engine_stop_SoundSet";
508 m_EngineStopFuel = "CivilianSedan_engine_stop_fuel_SoundSet";
509
510 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
511 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
512
513 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
514 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
515
516 SetEnginePos("0 0.7 1.6");
517 }
518
519 override void EEInit()
520 {
521 super.EEInit();
522
523 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
524 {
526 m_UTSSettings.m_ManualUpdate = true;
528 m_UTSSettings.m_TemperatureCap = 0;
529 m_UTSSettings.m_RangeFull = 0.5;
530 m_UTSSettings.m_RangeMax = 2;
531
534 }
535 }
536
537 override void OnEngineStart()
538 {
539 super.OnEngineStart();
540
541 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
542 {
543 m_UTSource.SetDefferedActive(true, 20.0);
544 }
545 }
546
547 override void OnEngineStop()
548 {
549 super.OnEngineStop();
550
551 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
552 {
553 m_UTSource.SetDefferedActive(false, 10.0);
554 }
555 }
556
557 override void EOnPostSimulate(IEntity other, float timeSlice)
558 {
559 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
560 {
561 if (m_UTSource.IsActive())
562 {
564 }
565 }
566 }
567
568 override int GetAnimInstance()
569 {
570 return VehicleAnimInstances.SEDAN;
571 }
572
573 override float GetTransportCameraDistance()
574 {
575 return 4.5;
576 }
577
578 override int GetSeatAnimationType(int posIdx)
579 {
580 switch (posIdx)
581 {
582 case 0:
583 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
584 case 1:
585 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
586 case 2:
587 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
588 case 3:
589 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
590 }
591
592 return 0;
593 }
594
595 // Override for car-specific light type
597 {
598 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
599 }
600
601 // Override for car-specific light type
603 {
604 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
605 }
606
607 override bool CanReleaseAttachment( EntityAI attachment )
608 {
609 if( !super.CanReleaseAttachment( attachment ) )
610 return false;
611
612 string attType = attachment.GetType();
613
614 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
615 {
616 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
617 return false;
618 }
619
620 return true;
621 }
622
623 override protected bool CanManipulateSpareWheel(string slotSelectionName)
624 {
625 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
626 }
627
628 override bool CanDisplayAttachmentCategory(string category_name)
629 {
630 //super
631 if (!super.CanDisplayAttachmentCategory(category_name))
632 return false;
633 //
634
635 category_name.ToLower();
636 if (category_name.Contains("engine"))
637 {
638 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
639 return false;
640 }
641
642 return true;
643 }
644
645 override bool CanDisplayCargo()
646 {
647 if ( !super.CanDisplayCargo() )
648 return false;
649
650 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
651 return false;
652
653 return true;
654 }
655
656 override int GetCarDoorsState( string slotType )
657 {
658 CarDoor carDoor;
659
660 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
661 if (!carDoor)
662 {
663 return CarDoorState.DOORS_MISSING;
664 }
665
666 switch (slotType)
667 {
668 case "CivSedanDriverDoors":
669 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
670 break;
671
672 case "CivSedanCoDriverDoors":
673 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
674 break;
675
676 case "CivSedanCargo1Doors":
677 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
678 break;
679
680 case "CivSedanCargo2Doors":
681 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
682 break;
683
684 case "CivSedanTrunk":
685 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
686 break;
687
688 case "CivSedanHood":
689 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
690 break;
691 }
692
693 return CarDoorState.DOORS_MISSING;
694 }
695
696
697 override bool CrewCanGetThrough( int posIdx )
698 {
699 switch( posIdx )
700 {
701 case 0:
702 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
703 return false;
704
705 return true;
706 break;
707
708 case 1:
709 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
710 return false;
711
712 return true;
713 break;
714
715 case 2:
716 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
717 return false;
718
719 return true;
720 break;
721
722 case 3:
723 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
724 return false;
725
726 return true;
727 break;
728 }
729
730 return false;
731 }
732
733 override string GetDoorSelectionNameFromSeatPos(int posIdx)
734 {
735 switch( posIdx )
736 {
737 case 0:
738 return "doors_driver";
739 break;
740 case 1:
741 return "doors_codriver";
742 break;
743 case 2:
744 return "doors_cargo1";
745 break;
746 case 3:
747 return "doors_cargo2";
748 break;
749 }
750
751 return super.GetDoorSelectionNameFromSeatPos(posIdx);
752 }
753
754 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
755 {
756 switch( posIdx )
757 {
758 case 0:
759 return "CivSedanDriverDoors";
760 break;
761 case 1:
762 return "CivSedanCoDriverDoors";
763 break;
764 case 2:
765 return "CivSedanCargo1Doors";
766 break;
767 case 3:
768 return "CivSedanCargo2Doors";
769 break;
770 }
771
772 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
773 }
774
775 // 0 full ambient and engine sound
776 // 1 zero ambient and engine sound
777 override float OnSound(CarSoundCtrl ctrl, float oldValue)
778 {
779 switch (ctrl)
780 {
781 case CarSoundCtrl.DOORS:
782 float newValue = 0;
783 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
784 {
785 newValue += 0.25;
786 }
787
788 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
789 {
790 newValue += 0.25;
791 }
792
793 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
794 {
795 newValue += 0.25;
796 }
797
798 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
799 {
800 newValue += 0.25;
801 }
802
803 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
804 {
805 newValue -= 0.6;
806 }
807
808 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
809 {
810 newValue -= 0.6;
811 }
812
813 return Math.Clamp(newValue, 0, 1);
814 break;
815 }
816
817 return super.OnSound(ctrl, oldValue);
818 }
819
820 override string GetAnimSourceFromSelection(string selection)
821 {
822 switch (selection)
823 {
824 case "doors_driver":
825 return "DoorsDriver";
826 case "doors_codriver":
827 return "DoorsCoDriver";
828 case "doors_cargo1":
829 return "DoorsCargo1";
830 case "doors_cargo2":
831 return "DoorsCargo2";
832 case "doors_hood":
833 return "DoorsHood";
834 case "doors_trunk":
835 return "DoorsTrunk";
836 }
837
838 return "";
839 }
840
841 override bool IsVitalTruckBattery()
842 {
843 return false;
844 }
845
846 override bool IsVitalGlowPlug()
847 {
848 return false;
849 }
850
851 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
852 {
853 switch (currentSeat)
854 {
855 case 0:
856 return nextSeat == 1;
857
858 case 1:
859 return nextSeat == 0;
860
861 case 2:
862 return nextSeat == 3;
863
864 case 3:
865 return nextSeat == 2;
866 }
867
868 return false;
869 }
870
871 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
872 {
873 switch (pCurrentSeat)
874 {
875 case 0:
876 return pDoorsSelection == "DoorsDriver";
877
878 case 1:
879 return pDoorsSelection == "DoorsCoDriver";
880
881 case 2:
882 return pDoorsSelection == "DoorsCargo1";
883
884 case 3:
885 return pDoorsSelection == "DoorsCargo2";
886 }
887
888 return false;
889 }
890
891 override void OnDebugSpawn()
892 {
893 SpawnUniversalParts();
894 SpawnAdditionalItems();
895 FillUpCarFluids();
896
897 GetInventory().CreateInInventory("CivSedanWheel");
898 GetInventory().CreateInInventory("CivSedanWheel");
899 GetInventory().CreateInInventory("CivSedanWheel");
900 GetInventory().CreateInInventory("CivSedanWheel");
901
902 GetInventory().CreateInInventory("CivSedanDoors_Driver");
903 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
904 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
905 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
906 GetInventory().CreateInInventory("CivSedanHood");
907 GetInventory().CreateInInventory("CivSedanTrunk");
908
909 //-----IN CAR CARGO
910 GetInventory().CreateInInventory("CivSedanWheel");
911 GetInventory().CreateInInventory("CivSedanWheel");
912 }
913
914 override float GetPushForceCoefficientMultiplier()
915 {
916 return 1.5;
917 }
918}
919
920class CivilianSedan_Wine extends CivilianSedan
921{
922 override void OnDebugSpawn()
923 {
924 SpawnUniversalParts();
925 SpawnAdditionalItems();
926 FillUpCarFluids();
927
928 GetInventory().CreateInInventory("CivSedanWheel");
929 GetInventory().CreateInInventory("CivSedanWheel");
930 GetInventory().CreateInInventory("CivSedanWheel");
931 GetInventory().CreateInInventory("CivSedanWheel");
932
933 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
934 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
935 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
936 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
937 GetInventory().CreateInInventory("CivSedanHood_Wine");
938 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
939
940 //-----IN CAR CARGO
941 GetInventory().CreateInInventory("CivSedanWheel");
942 GetInventory().CreateInInventory("CivSedanWheel");
943 }
944}
945
946class CivilianSedan_Black extends CivilianSedan
947{
948 override void OnDebugSpawn()
949 {
950 SpawnUniversalParts();
951 SpawnAdditionalItems();
952 FillUpCarFluids();
953
954 GetInventory().CreateInInventory("CivSedanWheel");
955 GetInventory().CreateInInventory("CivSedanWheel");
956 GetInventory().CreateInInventory("CivSedanWheel");
957 GetInventory().CreateInInventory("CivSedanWheel");
958
959 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
960 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
961 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
962 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
963 GetInventory().CreateInInventory("CivSedanHood_Black");
964 GetInventory().CreateInInventory("CivSedanTrunk_Black");
965
966 //-----IN CAR CARGO
967 GetInventory().CreateInInventory("CivSedanWheel");
968 GetInventory().CreateInInventory("CivSedanWheel");
969 }
970}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Определения Car.c:4
CarDoorState
Определения CarScript.c:2
override float GetPushForceCoefficientMultiplier()
Определения CivilianSedan.c:850
class CivilianSedan extends CarScript OnDebugSpawn()
Определения CivilianSedan.c:430
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Определения CivilianSedan.c:787
override string GetAnimSourceFromSelection(string selection)
Определения CivilianSedan.c:756
override int GetSeatAnimationType(int posIdx)
Определения CivilianSedan.c:514
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Определения CivilianSedan.c:713
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
Определения CivilianSedan.c:690
override void EOnPostSimulate(IEntity other, float timeSlice)
Определения CivilianSedan.c:493
override void OnEngineStop()
Определения CivilianSedan.c:483
void CivilianSedan()
Определения CivilianSedan.c:435
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
Определения CivilianSedan.c:433
override float GetTransportCameraDistance()
Определения CivilianSedan.c:509
override void EEInit()
Определения CivilianSedan.c:455
override bool CanReleaseAttachment(EntityAI attachment)
Определения CivilianSedan.c:543
override bool CanDisplayCargo()
Определения CivilianSedan.c:581
override void OnEngineStart()
Определения CivilianSedan.c:473
override CarLightBase CreateFrontLight()
Определения CivilianSedan.c:532
override int GetAnimInstance()
Определения CivilianSedan.c:504
override bool CrewCanGetThrough(int posIdx)
Определения CivilianSedan.c:633
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Определения CivilianSedan.c:807
bool CanManipulateSpareWheel(string slotSelectionName)
Определения CivilianSedan.c:559
override bool IsVitalGlowPlug()
Определения CivilianSedan.c:782
override CarRearLightBase CreateRearLight()
Определения CivilianSedan.c:538
override bool IsVitalTruckBattery()
Определения CivilianSedan.c:777
override string GetDoorSelectionNameFromSeatPos(int posIdx)
Определения CivilianSedan.c:669
override int GetCarDoorsState(string slotType)
Определения CivilianSedan.c:592
override bool CanDisplayAttachmentCategory(string category_name)
Определения CivilianSedan.c:564
ref UniversalTemperatureSourceSettings m_UTSSettings
Определения FireplaceBase.c:220
ref UniversalTemperatureSource m_UTSource
Определения FireplaceBase.c:219
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
VehicleAnimInstances
Определения VehicleAnimInstances.c:2
Определения CarRearLightBase.c:2
override void OnDebugSpawn()
Определения CivilianSedan.c:456
Определения CivilianSedan.c:455
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения EnEntity.c:165
Определения EnMath.c:7
original Timer deletes m_params which is unwanted
Определения UniversalTemperatureSource.c:38
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int STATE_RUINED
Определения 3_Game/constants.c:848
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
bool Contains(string sample)
Returns true if sample is substring of string.
Определения EnString.c:286
proto int ToLower()
Changes string to lowercase. Returns length.