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

◆ CanDisplayAttachmentCategory()

override bool OnDebugSpawn::CanDisplayAttachmentCategory ( string category_name)
protected

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

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