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

◆ CommandHandler()

override void ManBase::CommandHandler ( float pDt,
int pCurrentCommandID,
bool pCurrentCommandFinished )
inlineprotected

When the player should be and is unconscious

Player can start floating while unconscious

When the player will be unconscious, or is being blocked from being unconscious

If the player is getting in/out or switching seats, delay unconsciousness until after animation has finished

Death gate - prevent unlikely occurence of death -> unconsciousness transition Fall gate - prevent unconciousness animation from playing while falling, doesn't look good Transition gate - prevent unconciousness while previous command is transitioning

TODO: rework vehicle command Knockout back to force player prone after they have exited the vehicle

When the player is waking up

Make sure the player is actually unconscious

protection for a player being broken when attempting to wake them up too early into unconsciousness

Don't set the stance if we are swimming or in a vehicle, stance change animation could play

Maybe instead error out or notify of possible desync?

only run and higher for movement

SPRINT: enable/disable - based on stamina; disable also when raised

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

2865 {
2866 EvaluateDamageHit(pCurrentCommandID);
2867
2868 // lower implement
2869 super.CommandHandler(pDt,pCurrentCommandID,pCurrentCommandFinished);
2870
2871 vector playerPosition = PhysicsGetPositionWS();
2872
2873 HumanInputController hic = GetInputController();
2874
2877
2879
2880 if (m_BrokenLegsJunctureReceived)//was there a change in broken legs state ?
2881 {
2883 bool initial = m_BrokenLegState < 0;//negative values indicate initial activation
2884
2885 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
2886 {
2887 DropHeavyItem();
2888 if (initial)
2889 {
2891 hic.ResetADS();
2892 GetUApi().GetInputByID(UATempRaiseWeapon).Supress();
2893 ExitSights();
2894 }
2895 }
2896 }
2897
2898 GetDayZPlayerInventory().HandleInventory(pDt);
2899
2900 if (IsFireWeaponRaised() || m_IsHoldingBreath)
2901 {
2902 ProcessHoldBreath(pDt);
2903 }
2904
2906
2907 if (m_AreHandsLocked && GetHumanInventory().GetEntityInHands())
2908 {
2909 m_AreHandsLocked = false;
2910 }
2911
2912 // freelook camera memory for weapon raycast
2913 if (hic.CameraIsFreeLook() && m_DirectionToCursor == vector.Zero)
2914 {
2916 }
2917 else if (!hic.CameraIsFreeLook() && m_DirectionToCursor != vector.Zero)
2918 {
2919 m_DirectionToCursor = vector.Zero;
2920 }
2921
2922 if (m_WeaponManager)
2923 {
2924 m_WeaponManager.Update(pDt);
2925 }
2926 if (m_EmoteManager && IsPlayerSelected())
2927 {
2928 m_EmoteManager.Update(pDt);
2929 }
2930 if (m_RGSManager)
2931 {
2932 m_RGSManager.Update();
2933 }
2934 if (m_StanceIndicator)
2935 {
2936 m_StanceIndicator.Update();
2937 }
2938 if (m_StaminaHandler)
2939 {
2940 m_StaminaHandler.Update(pDt, pCurrentCommandID);
2941 }
2942 if (m_InjuryHandler)
2943 {
2944 m_InjuryHandler.Update(pDt);
2945 }
2946 if (m_HCAnimHandler)
2947 {
2948 m_HCAnimHandler.Update(pDt, m_MovementState);
2949 }
2950 if (m_ShockHandler)
2951 {
2952 m_ShockHandler.Update(pDt);
2953 }
2954
2955 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
2956 {
2957 GetPlayerSoundManagerServer().Update();
2958 ShockRefill(pDt);
2959 FreezeCheck();
2960 }
2961
2962 GetHumanInventory().Update(pDt);
2963 if (m_IsDrowning)
2964 {
2965 ProcessDrowning(pDt);
2966 }
2967 UpdateDelete();
2968
2969 HandleDamageHit(pCurrentCommandID);
2970
2971 if (mngr && hic)
2972 {
2973 mngr.Update(pCurrentCommandID);
2974
2975 HumanCommandUnconscious hcu = GetCommand_Unconscious();
2976 HumanCommandVehicle hcv = GetCommand_Vehicle();
2977
2978 if (!m_UnconsciousDebug)
2979 {
2981 if (m_ShouldBeUnconscious && m_IsUnconscious)
2982 {
2983 if (hcu)
2984 {
2986 m_Swimming.m_bWasSwimming |= hcu.IsInWater();
2987 }
2988
2989 if (m_Swimming.m_bWasSwimming)
2990 {
2991 m_LastCommandBeforeUnconscious = DayZPlayerConstants.COMMANDID_SWIM;
2992 }
2993
2994 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
2995 }
2997 else if (m_ShouldBeUnconscious)
2998 {
3000 bool isTransitioning = hcv && (hcv.IsGettingIn() || hcv.IsGettingOut() || hcv.IsSwitchSeat());
3001
3002 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3003 {
3004 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3005
3006 m_IsUnconscious = true;
3008 }
3012 else if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH && pCurrentCommandID != DayZPlayerConstants.COMMANDID_FALL && !isTransitioning)
3013 {
3014 m_LastCommandBeforeUnconscious = pCurrentCommandID;
3015
3016 if (hcv)
3017 {
3018 m_TransportCache = hcv.GetTransport();
3019 }
3020 else
3021 {
3022 m_TransportCache = null;
3023 }
3024
3026 m_JumpClimb.CheckAndFinishJump();
3027 StartCommand_Unconscious(0);
3028 SetFallYDiff(playerPosition[1]);
3029 }
3030 }
3032 else if (m_IsUnconscious)
3033 {
3035 if (hcu && pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3036 {
3037 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3038
3040 if (m_UnconsciousTime > 2)
3041 {
3042 int wakeUpStance = DayZPlayerConstants.STANCEIDX_PRONE;
3043
3045 if (m_Swimming.m_bWasSwimming || m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
3046 wakeUpStance = -1;
3047
3048 hcu.WakeUp(wakeUpStance);
3049
3050 m_IsUnconscious = false;
3051 OnUnconsciousStop(pCurrentCommandID);
3052 }
3053 }
3054 else
3055 {
3057 if (IsAlive())
3058 {
3059 m_IsUnconscious = false;
3060 OnUnconsciousStop(pCurrentCommandID);
3061 }
3062 }
3063 }
3064 }
3065
3066 // quickbar use
3067 int quickBarSlot = hic.IsQuickBarSlot();
3068 if (quickBarSlot && IsAlive())
3069 {
3070 if (hic.IsQuickBarSingleUse())
3071 {
3072 OnQuickBarSingleUse(quickBarSlot);
3073 //Print("PlayerBase.c IsQuickBarSingleUse - slot: " + quickBarSlot.ToString());
3074 }
3075 if (hic.IsQuickBarContinuousUseStart() && ((!GetGame().IsDedicatedServer()) && !GetGame().GetUIManager().GetMenu()))
3076 {
3077 OnQuickBarContinuousUseStart(quickBarSlot);
3078 //Print("PlayerBase.c IsQuickBarContinuousUseStart - slot: " + quickBarSlot.ToString());
3079 }
3080 if (hic.IsQuickBarContinuousUseEnd() && ((!GetGame().IsDedicatedServer())))
3081 {
3082 OnQuickBarContinuousUseEnd(quickBarSlot);
3083 //Print("PlayerBase.c IsQuickBarContinuousUseEnd - slot: " + quickBarSlot.ToString());
3084 }
3085 }
3086
3087 /*if ((pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM))
3088 {
3089 mngr.Update(); // checks for suitable action and sets it
3090 }*/
3091 }
3092
3093 if (m_StaminaHandler && hic)
3094 {
3095 HumanCommandMove hcm = GetCommand_Move();
3096 bool isSwimmingOrClimbing = GetCommand_Swim() || GetCommand_Climb() || GetCommand_Ladder();
3097 bool isStaminaLimitAppliable = hcm || isSwimmingOrClimbing;
3098
3099 if (isStaminaLimitAppliable)
3100 {
3101 bool isRunning = hcm && hcm.GetCurrentMovementSpeed() > 1.0;
3102
3104 if (isRunning || isSwimmingOrClimbing)
3105 {
3108 {
3109 hic.LimitsDisableSprint(false);
3110 }
3111 else
3112 {
3113 hic.LimitsDisableSprint(true);
3114 }
3115 }
3116 else
3117 {
3119 }
3120 }
3121 }
3122
3123 //map closing - feel free to move to different "update" if it does not belong here
3124 if (IsMapOpen())
3125 {
3126 if (!GetGame().IsDedicatedServer())
3127 {
3128 if (!CfgGameplayHandler.GetUse3DMap() && !GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
3129 {
3130 CloseMapEx(false);
3131 }
3132 else if (CfgGameplayHandler.GetUse3DMap())
3133 {
3135 {
3136 CloseMapEx(true);
3137 }
3138 else if (IsMapCallbackEndInput())
3139 {
3140 CloseMapEx(false);
3141 }
3142 }
3143 }
3144 }
3145
3146
3147 #ifdef DIAG_DEVELOPER
3148 if (m_Bot)
3149 m_Bot.OnUpdate(pDt);
3150 #endif
3151
3152 if (m_CheckMeleeItem && (!GetGame().IsDedicatedServer()))
3153 {
3156 }
3157
3158 #ifdef DEVELOPER
3159 TryGetInVehicleDebug();
3160 #endif
3161
3162 OnCommandHandlerTick(pDt, pCurrentCommandID);
3163 }
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
ref HumanMovementState m_MovementState
movement state
Определения DayZPlayerCamera3rdPerson.c:324
eBrokenLegs
Определения EBrokenLegs.c:2
EStaminaConsumers
Определения EStaminaConsumers.c:2
proto native UAInputAPI GetUApi()
proto native vector GetCurrentCameraDirection()
proto native float GetCurrentMovementSpeed()
0,1,2..3 idle, walk, run, sprint
proto native bool IsInWater()
proto native void WakeUp(int targetStance=-1)
proto native Transport GetTransport()
proto native bool IsGettingIn()
proto native bool IsSwitchSeat()
proto native bool IsGettingOut()
proto native bool CameraIsFreeLook()
returns true if freelook is active
proto native void LimitsDisableSprint(bool pDisable)
this disables sprint
proto native bool IsQuickBarContinuousUseStart()
proto native void ResetADS()
resets ADS mode to default
proto native int IsQuickBarSlot()
returns 1..10 if some quickbar slot is used, 0 otherwise
proto native bool IsQuickBarSingleUse()
proto native bool IsQuickBarContinuousUseEnd()
int m_BrokenLegState
Определения PlayerBase.c:145
void OnUnconsciousStart()
Определения PlayerBase.c:3388
PlayerSoundManagerServer GetPlayerSoundManagerServer()
Определения PlayerBase.c:1491
void OnCommandHandlerTick(float delta_time, int pCurrentCommandID)
Определения PlayerBase.c:2718
vector m_DirectionToCursor
Определения PlayerBase.c:123
void CloseMapEx(bool cancelled)
Определения PlayerBase.c:3192
void DropHeavyItem()
Определения PlayerBase.c:3788
bool IsMapCallbackCancelInput()
Определения PlayerBase.c:3264
float m_UnconsciousTime
Определения PlayerBase.c:108
bool m_IsDrowning
Определения PlayerBase.c:232
bool m_AreHandsLocked
Определения PlayerBase.c:117
void OnUnconsciousUpdate(float pDt, int last_command)
Определения PlayerBase.c:3483
bool m_BrokenLegsJunctureReceived
Определения PlayerBase.c:147
ItemBase m_CheckMeleeItem
Определения PlayerBase.c:258
bool m_IsHoldingBreath
Определения PlayerBase.c:95
ActionManagerBase GetActionManager()
Определения PlayerBase.c:1699
void CheckSendSoundEvent()
Определения PlayerBase.c:7245
bool CanSprint()
Определения PlayerBase.c:5191
void OnQuickBarContinuousUseStart(int slotClicked)
Определения PlayerBase.c:4607
void CheckZeroSoundEvent()
Определения PlayerBase.c:7234
void UpdateDelete()
Определения PlayerBase.c:7955
bool CheckMeleeItemDamage(ItemBase item)
Определения PlayerBase.c:5274
void ProcessHoldBreath(float dT)
Определения PlayerBase.c:2161
bool IsMapOpen()
Определения PlayerBase.c:3249
void ProcessADDModifier()
Определения PlayerBase.c:6547
void FreezeCheck()
Определения PlayerBase.c:3315
ref StanceIndicator m_StanceIndicator
Определения PlayerBase.c:54
void OnUnconsciousStop(int pCurrentCommandID)
Определения PlayerBase.c:3439
void SetCheckMeleeItem(ItemBase item=null)
Определения PlayerBase.c:3305
void OnQuickBarContinuousUseEnd(int slotClicked)
Определения PlayerBase.c:4642
ref WeaponManager m_WeaponManager
Определения PlayerBase.c:82
void OnQuickBarSingleUse(int slotClicked)
Определения PlayerBase.c:4499
ref StaminaHandler m_StaminaHandler
Определения PlayerBase.c:50
RandomGeneratorSyncManager m_RGSManager
Определения PlayerBase.c:155
ref HeatComfortAnimHandler m_HCAnimHandler
Определения PlayerBase.c:89
void BrokenLegForceProne(bool forceOverride=false)
Определения PlayerBase.c:3652
void ProcessDrowning(float dT)
Определения PlayerBase.c:2134
eBrokenLegs GetBrokenLegs()
Определения PlayerBase.c:3577
void ShockRefill(float pDt)
functionality moved to ShockMdfr::OnTick
ref ShockHandler m_ShockHandler
Определения PlayerBase.c:52
bool IsMapCallbackEndInput()
Определения PlayerBase.c:3274
override bool CanConsumeStamina(EStaminaConsumers consumer)
Определения PlayerBase.c:4360
ref InjuryAnimationHandler m_InjuryHandler
Определения PlayerBase.c:51
ref EmoteManager m_EmoteManager
Определения PlayerBase.c:47
proto native void Supress()
proto native UAInput GetInputByID(int iID)
returns list of all bindable (i.e. visible) inputs from the active group ('core' by default)
DayZPlayerInstanceType
defined in C++
Определения dayzplayer.c:1068
proto native DayZPlayerInstanceType GetInstanceType()
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
const int MENU_MAP
Определения constants.c:191
void HumanCommandMove()
Определения human.c:514
void HumanCommandUnconscious()
Определения human.c:638

Перекрестные ссылки ActionManagerBase(), BrokenLegForceProne(), HumanInputController::CameraIsFreeLook(), CanConsumeStamina(), CanSprint(), CheckMeleeItemDamage(), CheckSendSoundEvent(), CheckZeroSoundEvent(), CloseMapEx(), DropHeavyItem(), FreezeCheck(), GetActionManager(), GetBrokenLegs(), CGame::GetCurrentCameraDirection(), HumanCommandMove::GetCurrentMovementSpeed(), GetGame(), UAInputAPI::GetInputByID(), GetInstanceType(), GetPlayerSoundManagerServer(), HumanCommandVehicle::GetTransport(), GetUApi(), CfgGameplayHandler::GetUse3DMap(), HumanCommandVehicle::IsGettingIn(), HumanCommandVehicle::IsGettingOut(), HumanCommandUnconscious::IsInWater(), IsMapCallbackCancelInput(), IsMapCallbackEndInput(), IsMapOpen(), HumanInputController::IsQuickBarContinuousUseEnd(), HumanInputController::IsQuickBarContinuousUseStart(), HumanInputController::IsQuickBarSingleUse(), HumanInputController::IsQuickBarSlot(), HumanCommandVehicle::IsSwitchSeat(), HumanInputController::LimitsDisableSprint(), m_AreHandsLocked, m_BrokenLegsJunctureReceived, m_BrokenLegState, m_CheckMeleeItem, m_DirectionToCursor, m_EmoteManager, m_HCAnimHandler, m_InjuryHandler, m_IsDrowning, m_IsHoldingBreath, m_MovementState, m_RGSManager, m_ShockHandler, m_StaminaHandler, m_StanceIndicator, m_UnconsciousTime, m_WeaponManager, MENU_MAP, OnCommandHandlerTick(), OnQuickBarContinuousUseEnd(), OnQuickBarContinuousUseStart(), OnQuickBarSingleUse(), OnUnconsciousStart(), OnUnconsciousStop(), OnUnconsciousUpdate(), ProcessADDModifier(), ProcessDrowning(), ProcessHoldBreath(), HumanInputController::ResetADS(), SetCheckMeleeItem(), ShockRefill(), UAInput::Supress(), UpdateDelete(), HumanCommandUnconscious::WakeUp() и vector::Zero.