DayZ 1.29
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 строка 2991

2992 {
2993 EvaluateDamageHit(pCurrentCommandID);
2994
2995 // lower implement
2996 super.CommandHandler(pDt,pCurrentCommandID,pCurrentCommandFinished);
2997
2998 vector playerPosition = PhysicsGetPositionWS();
2999
3000 HumanInputController hic = GetInputController();
3001
3004
3006
3007 if (m_BrokenLegsJunctureReceived)//was there a change in broken legs state ?
3008 {
3010 bool initial = m_BrokenLegState < 0;//negative values indicate initial activation
3011
3012 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
3013 {
3014 DropHeavyItem();
3015 if (initial)
3016 {
3018 hic.ResetADS();
3019 GetUApi().GetInputByID(UATempRaiseWeapon).Supress();
3020 ExitSights();
3021 }
3022 }
3023 }
3024
3025 if (IsFireWeaponRaised() || m_IsHoldingBreath)
3026 {
3027 ProcessHoldBreath(pDt);
3028 }
3029
3031
3032 if (m_AreHandsLocked && GetEntityInHands())
3033 {
3034 m_AreHandsLocked = false;
3035 }
3036
3037 // freelook camera memory for weapon raycast
3038 if (m_DirectionToCursor == vector.Zero)
3039 {
3040 if (hic.CameraIsFreeLook())
3041 {
3042 m_DirectionToCursor = g_Game.GetCurrentCameraDirection();
3043 }
3044 }
3045 else
3046 {
3047 if (!hic.CameraIsFreeLook())
3048 {
3049 m_DirectionToCursor = vector.Zero;
3050 }
3051 }
3052
3053 if (m_WeaponManager)
3054 {
3055 m_WeaponManager.Update(pDt);
3056 }
3057 if (m_EmoteManager && IsPlayerSelected())
3058 {
3059 m_EmoteManager.Update(pDt);
3060 }
3061 if (m_RGSManager)
3062 {
3063 m_RGSManager.Update();
3064 }
3065 if (m_StanceIndicator)
3066 {
3067 m_StanceIndicator.Update();
3068 }
3069 if (m_StaminaHandler)
3070 {
3071 m_StaminaHandler.Update(pDt, pCurrentCommandID);
3072 }
3073 if (m_InjuryHandler)
3074 {
3075 m_InjuryHandler.Update(pDt);
3076 }
3077 if (m_HCAnimHandler)
3078 {
3079 m_HCAnimHandler.Update(pDt, m_MovementState);
3080 }
3081 if (m_ShockHandler)
3082 {
3083 m_ShockHandler.Update(pDt);
3084 }
3085
3086 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !g_Game.IsMultiplayer())
3087 {
3088 GetPlayerSoundManagerServer().Update();
3089 ShockRefill(pDt);
3090 FreezeCheck();
3091 }
3092
3093 if (m_IsDrowning)
3094 {
3095 ProcessDrowning(pDt);
3096 }
3097 UpdateDelete();
3098
3099 HandleDamageHit(pCurrentCommandID);
3100
3101 if (mngr && hic)
3102 {
3103 mngr.Update(pCurrentCommandID);
3104
3105 HumanCommandUnconscious hcu = GetCommand_Unconscious();
3106 HumanCommandVehicle hcv = GetCommand_Vehicle();
3107
3108 if (!m_UnconsciousDebug)
3109 {
3111 if (m_ShouldBeUnconscious && m_IsUnconscious)
3112 {
3113 if (hcu)
3114 {
3116 m_Swimming.m_bWasSwimming |= hcu.IsInWater();
3117 }
3118
3119 if (m_Swimming.m_bWasSwimming)
3120 {
3121 m_LastCommandBeforeUnconscious = DayZPlayerConstants.COMMANDID_SWIM;
3122 }
3123
3124 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3125 }
3127 else if (m_ShouldBeUnconscious)
3128 {
3130 bool isTransitioning = hcv && (hcv.IsGettingIn() || hcv.IsGettingOut() || hcv.IsSwitchSeat());
3131
3132 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3133 {
3134 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3135
3136 m_IsUnconscious = true;
3138 }
3142 else if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH && pCurrentCommandID != DayZPlayerConstants.COMMANDID_FALL && !isTransitioning)
3143 {
3144 m_LastCommandBeforeUnconscious = pCurrentCommandID;
3145
3146 if (hcv)
3147 {
3148 m_TransportCache = hcv.GetTransport();
3149 }
3150 else
3151 {
3152 m_TransportCache = null;
3153 }
3154
3156 m_JumpClimb.CheckAndFinishJump();
3157 StartCommand_Unconscious(0);
3158 SetFallYDiff(playerPosition[1]);
3159 }
3160 }
3162 else if (m_IsUnconscious)
3163 {
3165 if (hcu && pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3166 {
3167 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3168
3170 if (m_UnconsciousTime > 2)
3171 {
3172 int wakeUpStance = DayZPlayerConstants.STANCEIDX_PRONE;
3173
3175 if (m_Swimming.m_bWasSwimming || m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
3176 wakeUpStance = -1;
3177
3178 hcu.WakeUp(wakeUpStance);
3179
3180 m_IsUnconscious = false;
3181 OnUnconsciousStop(pCurrentCommandID);
3182 }
3183 }
3184 else
3185 {
3187 if (IsAlive())
3188 {
3189 m_IsUnconscious = false;
3190 OnUnconsciousStop(pCurrentCommandID);
3191 }
3192 }
3193 }
3194 }
3195
3196 // quickbar use
3197 int quickBarSlot = hic.IsQuickBarSlot();
3198 if (quickBarSlot && IsAlive())
3199 {
3200 if (hic.IsQuickBarSingleUse())
3201 {
3202 OnQuickBarSingleUse(quickBarSlot);
3203 //Print("PlayerBase.c IsQuickBarSingleUse - slot: " + quickBarSlot.ToString());
3204 }
3205 if (hic.IsQuickBarContinuousUseStart() && ((!g_Game.IsDedicatedServer()) && !g_Game.GetUIManager().GetMenu()))
3206 {
3207 OnQuickBarContinuousUseStart(quickBarSlot);
3208 //Print("PlayerBase.c IsQuickBarContinuousUseStart - slot: " + quickBarSlot.ToString());
3209 }
3210 if (hic.IsQuickBarContinuousUseEnd() && ((!g_Game.IsDedicatedServer())))
3211 {
3212 OnQuickBarContinuousUseEnd(quickBarSlot);
3213 //Print("PlayerBase.c IsQuickBarContinuousUseEnd - slot: " + quickBarSlot.ToString());
3214 }
3215 }
3216
3217 /*if ((pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM))
3218 {
3219 mngr.Update(); // checks for suitable action and sets it
3220 }*/
3221 }
3222
3223 if (m_StaminaHandler && hic)
3224 {
3225 HumanCommandMove hcm = GetCommand_Move();
3226 bool isSwimmingOrClimbing = GetCommand_Swim() || GetCommand_Climb() || GetCommand_Ladder();
3227 bool isStaminaLimitAppliable = hcm || isSwimmingOrClimbing;
3228
3229 if (isStaminaLimitAppliable)
3230 {
3232 }
3233 }
3234
3235 //map closing - feel free to move to different "update" if it does not belong here
3236 if (IsMapOpen())
3237 {
3238 if (!g_Game.IsDedicatedServer())
3239 {
3240 if (!CfgGameplayHandler.GetUse3DMap() && !g_Game.GetUIManager().IsMenuOpen(MENU_MAP))
3241 {
3242 CloseMapEx(false);
3243 }
3244 else if (CfgGameplayHandler.GetUse3DMap())
3245 {
3247 {
3248 CloseMapEx(true);
3249 }
3250 else if (IsMapCallbackEndInput())
3251 {
3252 CloseMapEx(false);
3253 }
3254 }
3255 }
3256 }
3257
3258
3259 #ifdef DIAG_DEVELOPER
3260 if (m_Bot)
3261 m_Bot.OnUpdate(pDt);
3262 #endif
3263
3264 if (m_CheckMeleeItem && (!g_Game.IsDedicatedServer()))
3265 {
3268 }
3269
3270 #ifdef DEVELOPER
3271 TryGetInVehicleDebug();
3272 #endif
3273
3274 OnCommandHandlerTick(pDt, pCurrentCommandID);
3275 }
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
DayZGame g_Game
Определения DayZGame.c:3942
ref HumanMovementState m_MovementState
movement state
Определения DayZPlayerCamera3rdPerson.c:324
eBrokenLegs
Определения EBrokenLegs.c:2
EStaminaConsumers
Определения EStaminaConsumers.c:2
proto native UAInputAPI GetUApi()
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:192
void OnUnconsciousStart()
Определения PlayerBase.c:3502
PlayerSoundManagerServer GetPlayerSoundManagerServer()
Определения PlayerBase.c:1631
void OnCommandHandlerTick(float delta_time, int pCurrentCommandID)
Определения PlayerBase.c:2836
vector m_DirectionToCursor
Определения PlayerBase.c:170
void CloseMapEx(bool cancelled)
Определения PlayerBase.c:3304
void DropHeavyItem()
Определения PlayerBase.c:3907
bool IsMapCallbackCancelInput()
Определения PlayerBase.c:3378
float m_UnconsciousTime
Определения PlayerBase.c:155
bool m_IsDrowning
Определения PlayerBase.c:279
bool m_AreHandsLocked
Определения PlayerBase.c:164
void OnUnconsciousUpdate(float pDt, int last_command)
Определения PlayerBase.c:3602
bool m_BrokenLegsJunctureReceived
Определения PlayerBase.c:194
ItemBase m_CheckMeleeItem
Определения PlayerBase.c:305
bool m_IsHoldingBreath
Определения PlayerBase.c:142
ActionManagerBase GetActionManager()
Определения PlayerBase.c:1829
void CheckSendSoundEvent()
Определения PlayerBase.c:7484
bool CanSprint()
Определения PlayerBase.c:5335
void OnQuickBarContinuousUseStart(int slotClicked)
Определения PlayerBase.c:4748
void CheckZeroSoundEvent()
Определения PlayerBase.c:7473
void UpdateDelete()
Определения PlayerBase.c:8240
bool CheckMeleeItemDamage(ItemBase item)
Определения PlayerBase.c:5421
void ProcessHoldBreath(float dT)
Определения PlayerBase.c:2284
bool IsMapOpen()
Определения PlayerBase.c:3363
void ProcessADDModifier()
Определения PlayerBase.c:6773
void FreezeCheck()
Определения PlayerBase.c:3429
ref StanceIndicator m_StanceIndicator
Определения PlayerBase.c:101
void OnUnconsciousStop(int pCurrentCommandID)
Определения PlayerBase.c:3555
void SetCheckMeleeItem(ItemBase item=null)
Определения PlayerBase.c:3419
void OnQuickBarContinuousUseEnd(int slotClicked)
Определения PlayerBase.c:4783
ref WeaponManager m_WeaponManager
Определения PlayerBase.c:129
void OnQuickBarSingleUse(int slotClicked)
Определения PlayerBase.c:4644
ref StaminaHandler m_StaminaHandler
Определения PlayerBase.c:97
RandomGeneratorSyncManager m_RGSManager
Определения PlayerBase.c:202
ref HeatComfortAnimHandler m_HCAnimHandler
Определения PlayerBase.c:136
void BrokenLegForceProne(bool forceOverride=false)
Определения PlayerBase.c:3771
void ProcessDrowning(float dT)
Определения PlayerBase.c:2257
eBrokenLegs GetBrokenLegs()
Определения PlayerBase.c:3696
void ShockRefill(float pDt)
functionality moved to ShockMdfr::OnTick
ref ShockHandler m_ShockHandler
Определения PlayerBase.c:99
bool IsMapCallbackEndInput()
Определения PlayerBase.c:3388
override bool CanConsumeStamina(EStaminaConsumers consumer)
Определения PlayerBase.c:4505
ref InjuryAnimationHandler m_InjuryHandler
Определения PlayerBase.c:98
ref EmoteManager m_EmoteManager
Определения PlayerBase.c:94
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:1071
proto native DayZPlayerInstanceType GetInstanceType()
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
const int MENU_MAP
Определения 3_Game/DayZ/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(), g_Game, GetActionManager(), GetBrokenLegs(), 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.