DayZ 1.28
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?

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

2867 {
2868 EvaluateDamageHit(pCurrentCommandID);
2869
2870 // lower implement
2871 super.CommandHandler(pDt,pCurrentCommandID,pCurrentCommandFinished);
2872
2873 vector playerPosition = PhysicsGetPositionWS();
2874
2875 HumanInputController hic = GetInputController();
2876
2879
2881
2882 if (m_BrokenLegsJunctureReceived)//was there a change in broken legs state ?
2883 {
2885 bool initial = m_BrokenLegState < 0;//negative values indicate initial activation
2886
2887 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
2888 {
2889 DropHeavyItem();
2890 if (initial)
2891 {
2893 hic.ResetADS();
2894 GetUApi().GetInputByID(UATempRaiseWeapon).Supress();
2895 ExitSights();
2896 }
2897 }
2898 }
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 if (m_IsDrowning)
2963 {
2964 ProcessDrowning(pDt);
2965 }
2966 UpdateDelete();
2967
2968 HandleDamageHit(pCurrentCommandID);
2969
2970 if (mngr && hic)
2971 {
2972 mngr.Update(pCurrentCommandID);
2973
2974 HumanCommandUnconscious hcu = GetCommand_Unconscious();
2975 HumanCommandVehicle hcv = GetCommand_Vehicle();
2976
2977 if (!m_UnconsciousDebug)
2978 {
2980 if (m_ShouldBeUnconscious && m_IsUnconscious)
2981 {
2982 if (hcu)
2983 {
2985 m_Swimming.m_bWasSwimming |= hcu.IsInWater();
2986 }
2987
2988 if (m_Swimming.m_bWasSwimming)
2989 {
2990 m_LastCommandBeforeUnconscious = DayZPlayerConstants.COMMANDID_SWIM;
2991 }
2992
2993 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
2994 }
2996 else if (m_ShouldBeUnconscious)
2997 {
2999 bool isTransitioning = hcv && (hcv.IsGettingIn() || hcv.IsGettingOut() || hcv.IsSwitchSeat());
3000
3001 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3002 {
3003 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3004
3005 m_IsUnconscious = true;
3007 }
3011 else if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH && pCurrentCommandID != DayZPlayerConstants.COMMANDID_FALL && !isTransitioning)
3012 {
3013 m_LastCommandBeforeUnconscious = pCurrentCommandID;
3014
3015 if (hcv)
3016 {
3017 m_TransportCache = hcv.GetTransport();
3018 }
3019 else
3020 {
3021 m_TransportCache = null;
3022 }
3023
3025 m_JumpClimb.CheckAndFinishJump();
3026 StartCommand_Unconscious(0);
3027 SetFallYDiff(playerPosition[1]);
3028 }
3029 }
3031 else if (m_IsUnconscious)
3032 {
3034 if (hcu && pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3035 {
3036 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3037
3039 if (m_UnconsciousTime > 2)
3040 {
3041 int wakeUpStance = DayZPlayerConstants.STANCEIDX_PRONE;
3042
3044 if (m_Swimming.m_bWasSwimming || m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
3045 wakeUpStance = -1;
3046
3047 hcu.WakeUp(wakeUpStance);
3048
3049 m_IsUnconscious = false;
3050 OnUnconsciousStop(pCurrentCommandID);
3051 }
3052 }
3053 else
3054 {
3056 if (IsAlive())
3057 {
3058 m_IsUnconscious = false;
3059 OnUnconsciousStop(pCurrentCommandID);
3060 }
3061 }
3062 }
3063 }
3064
3065 // quickbar use
3066 int quickBarSlot = hic.IsQuickBarSlot();
3067 if (quickBarSlot && IsAlive())
3068 {
3069 if (hic.IsQuickBarSingleUse())
3070 {
3071 OnQuickBarSingleUse(quickBarSlot);
3072 //Print("PlayerBase.c IsQuickBarSingleUse - slot: " + quickBarSlot.ToString());
3073 }
3074 if (hic.IsQuickBarContinuousUseStart() && ((!GetGame().IsDedicatedServer()) && !GetGame().GetUIManager().GetMenu()))
3075 {
3076 OnQuickBarContinuousUseStart(quickBarSlot);
3077 //Print("PlayerBase.c IsQuickBarContinuousUseStart - slot: " + quickBarSlot.ToString());
3078 }
3079 if (hic.IsQuickBarContinuousUseEnd() && ((!GetGame().IsDedicatedServer())))
3080 {
3081 OnQuickBarContinuousUseEnd(quickBarSlot);
3082 //Print("PlayerBase.c IsQuickBarContinuousUseEnd - slot: " + quickBarSlot.ToString());
3083 }
3084 }
3085
3086 /*if ((pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM))
3087 {
3088 mngr.Update(); // checks for suitable action and sets it
3089 }*/
3090 }
3091
3092 if (m_StaminaHandler && hic)
3093 {
3094 HumanCommandMove hcm = GetCommand_Move();
3095 bool isSwimmingOrClimbing = GetCommand_Swim() || GetCommand_Climb() || GetCommand_Ladder();
3096 bool isStaminaLimitAppliable = hcm || isSwimmingOrClimbing;
3097
3098 if (isStaminaLimitAppliable)
3099 {
3101 }
3102 }
3103
3104 //map closing - feel free to move to different "update" if it does not belong here
3105 if (IsMapOpen())
3106 {
3107 if (!GetGame().IsDedicatedServer())
3108 {
3109 if (!CfgGameplayHandler.GetUse3DMap() && !GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
3110 {
3111 CloseMapEx(false);
3112 }
3113 else if (CfgGameplayHandler.GetUse3DMap())
3114 {
3116 {
3117 CloseMapEx(true);
3118 }
3119 else if (IsMapCallbackEndInput())
3120 {
3121 CloseMapEx(false);
3122 }
3123 }
3124 }
3125 }
3126
3127
3128 #ifdef DIAG_DEVELOPER
3129 if (m_Bot)
3130 m_Bot.OnUpdate(pDt);
3131 #endif
3132
3133 if (m_CheckMeleeItem && (!GetGame().IsDedicatedServer()))
3134 {
3137 }
3138
3139 #ifdef DEVELOPER
3140 TryGetInVehicleDebug();
3141 #endif
3142
3143 OnCommandHandlerTick(pDt, pCurrentCommandID);
3144 }
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 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:3369
PlayerSoundManagerServer GetPlayerSoundManagerServer()
Определения PlayerBase.c:1491
void OnCommandHandlerTick(float delta_time, int pCurrentCommandID)
Определения PlayerBase.c:2716
vector m_DirectionToCursor
Определения PlayerBase.c:123
void CloseMapEx(bool cancelled)
Определения PlayerBase.c:3173
void DropHeavyItem()
Определения PlayerBase.c:3770
bool IsMapCallbackCancelInput()
Определения PlayerBase.c:3245
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:3465
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:7237
bool CanSprint()
Определения PlayerBase.c:5181
void OnQuickBarContinuousUseStart(int slotClicked)
Определения PlayerBase.c:4597
void CheckZeroSoundEvent()
Определения PlayerBase.c:7226
void UpdateDelete()
Определения PlayerBase.c:7990
bool CheckMeleeItemDamage(ItemBase item)
Определения PlayerBase.c:5264
void ProcessHoldBreath(float dT)
Определения PlayerBase.c:2152
bool IsMapOpen()
Определения PlayerBase.c:3230
void ProcessADDModifier()
Определения PlayerBase.c:6539
void FreezeCheck()
Определения PlayerBase.c:3296
ref StanceIndicator m_StanceIndicator
Определения PlayerBase.c:54
void OnUnconsciousStop(int pCurrentCommandID)
Определения PlayerBase.c:3420
void SetCheckMeleeItem(ItemBase item=null)
Определения PlayerBase.c:3286
void OnQuickBarContinuousUseEnd(int slotClicked)
Определения PlayerBase.c:4632
ref WeaponManager m_WeaponManager
Определения PlayerBase.c:82
void OnQuickBarSingleUse(int slotClicked)
Определения PlayerBase.c:4489
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:3634
void ProcessDrowning(float dT)
Определения PlayerBase.c:2125
eBrokenLegs GetBrokenLegs()
Определения PlayerBase.c:3559
void ShockRefill(float pDt)
functionality moved to ShockMdfr::OnTick
ref ShockHandler m_ShockHandler
Определения PlayerBase.c:52
bool IsMapCallbackEndInput()
Определения PlayerBase.c:3255
override bool CanConsumeStamina(EStaminaConsumers consumer)
Определения PlayerBase.c:4350
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
Определения 3_Game/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(), 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.