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

◆ CanReleaseAttachment()

override bool OnDebugSpawn::CanReleaseAttachment ( EntityAI attachment)
protected

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

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