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

◆ CanDisplayAttachmentCategory()

override bool OnDebugSpawn::CanDisplayAttachmentCategory ( string category_name)
protected

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

565{
569
570 void CivilianSedan()
571 {
572 //m_dmgContactCoef = 0.065;
573
574 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
575 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
576 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
577 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
578 m_EngineStop = "CivilianSedan_engine_stop_SoundSet";
579 m_EngineStopFuel = "CivilianSedan_engine_stop_fuel_SoundSet";
580
581 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
582 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
583
584 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
585 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
586
587 SetEnginePos("0 0.7 1.6");
588 }
589
590 override void EEInit()
591 {
592 super.EEInit();
593
594 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
595 {
597 m_UTSSettings.m_ManualUpdate = true;
599 m_UTSSettings.m_TemperatureCap = 0;
600 m_UTSSettings.m_RangeFull = 0.5;
601 m_UTSSettings.m_RangeMax = 2;
602
605 }
606 }
607
608 override void OnEngineStart()
609 {
610 super.OnEngineStart();
611
612 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
613 {
614 m_UTSource.SetDefferedActive(true, 20.0);
615 }
616 }
617
618 override void OnEngineStop()
619 {
620 super.OnEngineStop();
621
622 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
623 {
624 m_UTSource.SetDefferedActive(false, 10.0);
625 }
626 }
627
628 override void EOnPostSimulate(IEntity other, float timeSlice)
629 {
630 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
631 {
632 if (m_UTSource.IsActive())
633 {
635 }
636 }
637 }
638
639 override int GetAnimInstance()
640 {
641 return VehicleAnimInstances.SEDAN;
642 }
643
644 override float GetTransportCameraDistance()
645 {
646 return 4.5;
647 }
648
649 override int GetSeatAnimationType(int posIdx)
650 {
651 switch (posIdx)
652 {
653 case 0:
654 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
655 case 1:
656 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
657 case 2:
658 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
659 case 3:
660 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
661 }
662
663 return 0;
664 }
665
666 // Override for car-specific light type
668 {
669 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
670 }
671
672 // Override for car-specific light type
674 {
675 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
676 }
677
678 override bool CanReleaseAttachment( EntityAI attachment )
679 {
680 if( !super.CanReleaseAttachment( attachment ) )
681 return false;
682
683 string attType = attachment.GetType();
684
685 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
686 {
687 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
688 return false;
689 }
690
691 return true;
692 }
693
694 override protected bool CanManipulateSpareWheel(string slotSelectionName)
695 {
696 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
697 }
698
699 override bool CanDisplayAttachmentCategory(string category_name)
700 {
701 //super
702 if (!super.CanDisplayAttachmentCategory(category_name))
703 return false;
704 //
705
706 category_name.ToLower();
707 if (category_name.Contains("engine"))
708 {
709 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
710 return false;
711 }
712
713 return true;
714 }
715
716 override bool CanDisplayCargo()
717 {
718 if ( !super.CanDisplayCargo() )
719 return false;
720
721 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
722 return false;
723
724 return true;
725 }
726
727 override int GetCarDoorsState( string slotType )
728 {
729 CarDoor carDoor;
730
731 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
732 if (!carDoor)
733 {
734 return CarDoorState.DOORS_MISSING;
735 }
736
737 switch (slotType)
738 {
739 case "CivSedanDriverDoors":
740 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
741 break;
742
743 case "CivSedanCoDriverDoors":
744 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
745 break;
746
747 case "CivSedanCargo1Doors":
748 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
749 break;
750
751 case "CivSedanCargo2Doors":
752 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
753 break;
754
755 case "CivSedanTrunk":
756 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
757 break;
758
759 case "CivSedanHood":
760 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
761 break;
762 }
763
764 return CarDoorState.DOORS_MISSING;
765 }
766
767
768 override bool CrewCanGetThrough( int posIdx )
769 {
770 switch( posIdx )
771 {
772 case 0:
773 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
774 return false;
775
776 return true;
777 break;
778
779 case 1:
780 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
781 return false;
782
783 return true;
784 break;
785
786 case 2:
787 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
788 return false;
789
790 return true;
791 break;
792
793 case 3:
794 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
795 return false;
796
797 return true;
798 break;
799 }
800
801 return false;
802 }
803
804 override string GetDoorSelectionNameFromSeatPos(int posIdx)
805 {
806 switch( posIdx )
807 {
808 case 0:
809 return "doors_driver";
810 break;
811 case 1:
812 return "doors_codriver";
813 break;
814 case 2:
815 return "doors_cargo1";
816 break;
817 case 3:
818 return "doors_cargo2";
819 break;
820 }
821
822 return super.GetDoorSelectionNameFromSeatPos(posIdx);
823 }
824
825 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
826 {
827 switch( posIdx )
828 {
829 case 0:
830 return "CivSedanDriverDoors";
831 break;
832 case 1:
833 return "CivSedanCoDriverDoors";
834 break;
835 case 2:
836 return "CivSedanCargo1Doors";
837 break;
838 case 3:
839 return "CivSedanCargo2Doors";
840 break;
841 }
842
843 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
844 }
845
846 // 0 full ambient and engine sound
847 // 1 zero ambient and engine sound
848 override float OnSound(CarSoundCtrl ctrl, float oldValue)
849 {
850 switch (ctrl)
851 {
852 case CarSoundCtrl.DOORS:
853 float newValue = 0;
854 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
855 {
856 newValue += 0.25;
857 }
858
859 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
860 {
861 newValue += 0.25;
862 }
863
864 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
865 {
866 newValue += 0.25;
867 }
868
869 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
870 {
871 newValue += 0.25;
872 }
873
874 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
875 {
876 newValue -= 0.6;
877 }
878
879 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
880 {
881 newValue -= 0.6;
882 }
883
884 return Math.Clamp(newValue, 0, 1);
885 break;
886 }
887
888 return super.OnSound(ctrl, oldValue);
889 }
890
891 override string GetAnimSourceFromSelection(string selection)
892 {
893 switch (selection)
894 {
895 case "doors_driver":
896 return "DoorsDriver";
897 case "doors_codriver":
898 return "DoorsCoDriver";
899 case "doors_cargo1":
900 return "DoorsCargo1";
901 case "doors_cargo2":
902 return "DoorsCargo2";
903 case "doors_hood":
904 return "DoorsHood";
905 case "doors_trunk":
906 return "DoorsTrunk";
907 }
908
909 return "";
910 }
911
912 override bool IsVitalTruckBattery()
913 {
914 return false;
915 }
916
917 override bool IsVitalGlowPlug()
918 {
919 return false;
920 }
921
922 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
923 {
924 switch (currentSeat)
925 {
926 case 0:
927 return nextSeat == 1;
928
929 case 1:
930 return nextSeat == 0;
931
932 case 2:
933 return nextSeat == 3;
934
935 case 3:
936 return nextSeat == 2;
937 }
938
939 return false;
940 }
941
942 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
943 {
944 switch (pCurrentSeat)
945 {
946 case 0:
947 return pDoorsSelection == "DoorsDriver";
948
949 case 1:
950 return pDoorsSelection == "DoorsCoDriver";
951
952 case 2:
953 return pDoorsSelection == "DoorsCargo1";
954
955 case 3:
956 return pDoorsSelection == "DoorsCargo2";
957 }
958
959 return false;
960 }
961
962 override void OnDebugSpawn()
963 {
964 SpawnUniversalParts();
965 SpawnAdditionalItems();
966 FillUpCarFluids();
967
968 GetInventory().CreateInInventory("CivSedanWheel");
969 GetInventory().CreateInInventory("CivSedanWheel");
970 GetInventory().CreateInInventory("CivSedanWheel");
971 GetInventory().CreateInInventory("CivSedanWheel");
972
973 GetInventory().CreateInInventory("CivSedanDoors_Driver");
974 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
975 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
976 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
977 GetInventory().CreateInInventory("CivSedanHood");
978 GetInventory().CreateInInventory("CivSedanTrunk");
979
980 //-----IN CAR CARGO
981 GetInventory().CreateInInventory("CivSedanWheel");
982 GetInventory().CreateInInventory("CivSedanWheel");
983 }
984
985 override float GetPushForceCoefficientMultiplier()
986 {
987 return 1.5;
988 }
989}
990
991class CivilianSedan_Wine extends CivilianSedan
992{
993 override void OnDebugSpawn()
994 {
995 SpawnUniversalParts();
996 SpawnAdditionalItems();
997 FillUpCarFluids();
998
999 GetInventory().CreateInInventory("CivSedanWheel");
1000 GetInventory().CreateInInventory("CivSedanWheel");
1001 GetInventory().CreateInInventory("CivSedanWheel");
1002 GetInventory().CreateInInventory("CivSedanWheel");
1003
1004 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1005 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1006 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1007 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1008 GetInventory().CreateInInventory("CivSedanHood_Wine");
1009 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1010
1011 //-----IN CAR CARGO
1012 GetInventory().CreateInInventory("CivSedanWheel");
1013 GetInventory().CreateInInventory("CivSedanWheel");
1014 }
1015}
1016
1017class CivilianSedan_Black extends CivilianSedan
1018{
1019 override void OnDebugSpawn()
1020 {
1021 SpawnUniversalParts();
1022 SpawnAdditionalItems();
1023 FillUpCarFluids();
1024
1025 GetInventory().CreateInInventory("CivSedanWheel");
1026 GetInventory().CreateInInventory("CivSedanWheel");
1027 GetInventory().CreateInInventory("CivSedanWheel");
1028 GetInventory().CreateInInventory("CivSedanWheel");
1029
1030 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1031 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1032 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1033 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1034 GetInventory().CreateInInventory("CivSedanHood_Black");
1035 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1036
1037 //-----IN CAR CARGO
1038 GetInventory().CreateInInventory("CivSedanWheel");
1039 GetInventory().CreateInInventory("CivSedanWheel");
1040 }
1041}
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.