DayZ 1.30
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 строка 3206

3207 {
3208 EvaluateDamageHit(pCurrentCommandID);
3209
3210 // lower implement
3211 super.CommandHandler(pDt,pCurrentCommandID,pCurrentCommandFinished);
3212
3214
3215 vector playerPosition = PhysicsGetPositionWS();
3216
3217 HumanInputController hic = GetInputController();
3218
3221
3223
3224 if (m_BrokenLegsJunctureReceived)//was there a change in broken legs state ?
3225 {
3227 bool initial = m_BrokenLegState < 0;//negative values indicate initial activation
3228
3229 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
3230 {
3231 DropHeavyItem();
3232 if (initial)
3233 {
3235 hic.ResetADS();
3236 GetUApi().GetInputByID(UATempRaiseWeapon).Supress();
3237 ExitSights();
3238 }
3239 }
3240 }
3241
3242 if (IsFireWeaponRaised() || m_IsHoldingBreath)
3243 {
3244 ProcessHoldBreath(pDt);
3245 }
3246
3248
3249 if (m_AreHandsLocked && GetEntityInHands())
3250 {
3251 m_AreHandsLocked = false;
3252 }
3253
3254 // freelook camera memory for weapon raycast
3255 if (m_DirectionToCursor == vector.Zero)
3256 {
3257 if (hic.CameraIsFreeLook())
3258 {
3259 m_DirectionToCursor = g_Game.GetCurrentCameraDirection();
3260 }
3261 }
3262 else
3263 {
3264 if (!hic.CameraIsFreeLook())
3265 {
3266 m_DirectionToCursor = vector.Zero;
3267 }
3268 }
3269
3271 {
3274 {
3275 if (m_IsSurrendered)
3277 else
3279 }
3280 }
3281
3282 if (m_WeaponManager)
3283 {
3284 m_WeaponManager.Update(pDt);
3285 }
3286 if (m_EmoteManager && IsPlayerSelected())
3287 {
3288 m_EmoteManager.Update(pDt);
3289 }
3290 if (m_RGSManager)
3291 {
3292 m_RGSManager.Update();
3293 }
3294 if (m_StanceIndicator)
3295 {
3296 m_StanceIndicator.Update();
3297 }
3298 if (m_StaminaHandler)
3299 {
3300 m_StaminaHandler.Update(pDt, pCurrentCommandID);
3301 }
3302 if (m_InjuryHandler)
3303 {
3304 m_InjuryHandler.Update(pDt);
3305 }
3306 if (m_HCAnimHandler)
3307 {
3308 m_HCAnimHandler.Update(pDt, m_MovementState);
3309 }
3310 if (m_ShockHandler)
3311 {
3312 m_ShockHandler.Update(pDt);
3313 }
3314
3315 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3316 {
3317 DustEffectManager.GetDustEffectManager().Update(pDt);
3318 }
3319
3320 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
3321 {
3322 GetPlayerSoundManagerServer().Update();
3323 ShockRefill(pDt);
3324 FreezeCheck();
3325 }
3326
3327 if (m_IsDrowning)
3328 {
3329 ProcessDrowning(pDt);
3330 }
3331 UpdateDelete();
3332
3333 HandleDamageHit(pCurrentCommandID);
3334
3335 if (mngr && hic)
3336 {
3337 //invalidate construction data before client update, to be validated during variants update
3338 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT || !GetGame().IsMultiplayer() && GetConstructionActionData())
3340
3341 mngr.Update(pCurrentCommandID);
3342
3343 HumanCommandUnconscious hcu = GetCommand_Unconscious();
3344 HumanCommandVehicle hcv = GetCommand_Vehicle();
3345
3346 if (hcu && hcu.IsRagdoll())
3347 {
3348 // Don't attach us back to the vehicle once we wake up
3349 m_TransportCache = null;
3350 }
3351
3352 if (!m_UnconsciousDebug)
3353 {
3355 if (m_ShouldBeUnconscious && m_IsUnconscious)
3356 {
3357 if (hcu)
3358 {
3360 m_Swimming.m_bWasSwimming |= hcu.IsInWater();
3361 }
3362
3363 if (m_Swimming.m_bWasSwimming)
3364 {
3365 m_LastCommandBeforeUnconscious = DayZPlayerConstants.COMMANDID_SWIM;
3366 }
3367
3368 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3369 }
3371 else if (m_ShouldBeUnconscious)
3372 {
3374 bool isTransitioning = hcv && (hcv.IsGettingIn() || hcv.IsGettingOut() || hcv.IsSwitchSeat());
3375
3376 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3377 {
3378 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3379
3380 m_IsUnconscious = true;
3382 }
3386 else if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH && pCurrentCommandID != DayZPlayerConstants.COMMANDID_FALL && !isTransitioning)
3387 {
3388 m_LastCommandBeforeUnconscious = pCurrentCommandID;
3389
3390 if (hcv)
3391 {
3392 m_TransportCache = hcv.GetTransport();
3393 }
3394 else
3395 {
3396 m_TransportCache = null;
3397 }
3398
3399 Motorbike motorbike = Motorbike.Cast(m_TransportCache);
3400 if (motorbike)
3401 {
3402 motorbike.FallOver();
3403 }
3404
3406 m_JumpClimb.CheckAndFinishJump();
3407 hcu = StartCommand_Unconscious(0);
3408 SetFallYDiff(playerPosition[1]);
3409 }
3410 }
3412 else if (m_IsUnconscious)
3413 {
3415 if (hcu && pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3416 {
3417 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3418
3420 if (m_UnconsciousTime > 2)
3421 {
3422 // If the player is falling then prevent waking up
3423 if (false == PhysicsIsFalling(false))
3424 {
3425 int wakeUpStance = DayZPlayerConstants.STANCEIDX_PRONE;
3426
3428 if (m_Swimming.m_bWasSwimming || m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
3429 wakeUpStance = -1;
3430
3431 hcu.WakeUp(wakeUpStance);
3432
3433 m_IsUnconscious = false;
3434 OnUnconsciousStop(pCurrentCommandID);
3435 }
3436 }
3437 }
3438 else
3439 {
3441 if (IsAlive())
3442 {
3443 m_IsUnconscious = false;
3444 OnUnconsciousStop(pCurrentCommandID);
3445 }
3446 }
3447 }
3448 }
3449
3450 // quickbar use
3451 int quickBarSlot = hic.IsQuickBarSlot();
3452 if (quickBarSlot && IsAlive())
3453 {
3454 if (hic.IsQuickBarSingleUse())
3455 {
3456 OnQuickBarSingleUse(quickBarSlot);
3457 //Print("PlayerBase.c IsQuickBarSingleUse - slot: " + quickBarSlot.ToString());
3458 }
3459 if (hic.IsQuickBarContinuousUseStart() && ((!g_Game.IsDedicatedServer()) && !g_Game.GetUIManager().GetMenu()))
3460 {
3461 OnQuickBarContinuousUseStart(quickBarSlot);
3462 //Print("PlayerBase.c IsQuickBarContinuousUseStart - slot: " + quickBarSlot.ToString());
3463 }
3464 if (hic.IsQuickBarContinuousUseEnd() && ((!g_Game.IsDedicatedServer())))
3465 {
3466 OnQuickBarContinuousUseEnd(quickBarSlot);
3467 //Print("PlayerBase.c IsQuickBarContinuousUseEnd - slot: " + quickBarSlot.ToString());
3468 }
3469 }
3470
3471 /*if ((pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM))
3472 {
3473 mngr.Update(); // checks for suitable action and sets it
3474 }*/
3475 }
3476
3477 if (m_StaminaHandler && hic)
3478 {
3479 HumanCommandMove hcm = GetCommand_Move();
3480 bool isSwimmingOrClimbing = GetCommand_Swim() || GetCommand_Climb() || GetCommand_Ladder();
3481 bool isStaminaLimitAppliable = hcm || isSwimmingOrClimbing;
3482
3483 if (isStaminaLimitAppliable)
3484 {
3486 }
3487 }
3488
3489 //map closing - feel free to move to different "update" if it does not belong here
3490 if (IsMapOpen())
3491 {
3492 if (!g_Game.IsDedicatedServer())
3493 {
3494 if (!CfgGameplayHandler.GetUse3DMap() && !g_Game.GetUIManager().IsMenuOpen(MENU_MAP))
3495 {
3496 CloseMapEx(false);
3497 }
3498 else if (CfgGameplayHandler.GetUse3DMap())
3499 {
3501 {
3502 CloseMapEx(true);
3503 }
3504 else if (IsMapCallbackEndInput())
3505 {
3506 CloseMapEx(false);
3507 }
3508 }
3509 }
3510 }
3511
3512
3513 #ifdef ROBOCLIENT
3514 if (m_Bot)
3515 m_Bot.OnUpdate(pDt);
3516 #endif
3517
3518 if (m_CheckMeleeItem && (!g_Game.IsDedicatedServer()))
3519 {
3522 }
3523
3524 #ifdef DEVELOPER
3525 TryGetInVehicleDebug();
3526 #endif
3527
3528 OnCommandHandlerTick(pDt, pCurrentCommandID);
3529 }
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
DayZGame g_Game
Определения DayZGame.c:4074
ref HumanMovementState m_MovementState
movement state
Определения DayZPlayerCamera3rdPerson.c:324
eBrokenLegs
Определения EBrokenLegs.c:2
EStaminaConsumers
Определения EStaminaConsumers.c:2
proto native UAInputAPI GetUApi()
void Invalidate()
to be called from outside
Определения ConstructionActionData.c:142
proto native bool IsRagdoll()
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()
bool m_StartedSurrenderTransition
Определения PlayerBase.c:315
int m_BrokenLegState
Определения PlayerBase.c:191
void OnUnconsciousStart()
Определения PlayerBase.c:3756
PlayerSoundManagerServer GetPlayerSoundManagerServer()
Определения PlayerBase.c:1671
void OnCommandHandlerTick(float delta_time, int pCurrentCommandID)
Определения PlayerBase.c:3038
vector m_DirectionToCursor
Определения PlayerBase.c:169
void CloseMapEx(bool cancelled)
Определения PlayerBase.c:3558
void DropHeavyItem()
Определения PlayerBase.c:4177
bool IsMapCallbackCancelInput()
Определения PlayerBase.c:3632
float m_UnconsciousTime
Определения PlayerBase.c:154
bool m_IsDrowning
Определения PlayerBase.c:278
void OnFinishTransitionFromSurrender()
Определения PlayerBase.c:2092
bool m_AreHandsLocked
Определения PlayerBase.c:163
void OnUnconsciousUpdate(float pDt, int last_command)
Определения PlayerBase.c:3870
bool m_BrokenLegsJunctureReceived
Определения PlayerBase.c:193
ItemBase m_CheckMeleeItem
Определения PlayerBase.c:304
bool m_IsHoldingBreath
Определения PlayerBase.c:141
ActionManagerBase GetActionManager()
Определения PlayerBase.c:1887
void CheckSendSoundEvent()
Определения PlayerBase.c:7829
bool CanSprint()
Определения PlayerBase.c:5612
void OnQuickBarContinuousUseStart(int slotClicked)
Определения PlayerBase.c:5042
void CheckZeroSoundEvent()
Определения PlayerBase.c:7818
void UpdateDelete()
Определения PlayerBase.c:8594
bool CheckMeleeItemDamage(ItemBase item)
Определения PlayerBase.c:5698
void ProcessHoldBreath(float dT)
Определения PlayerBase.c:2465
bool IsMapOpen()
Определения PlayerBase.c:3617
bool m_IsSurrendered
Определения PlayerBase.c:314
void ProcessADDModifier()
Определения PlayerBase.c:7094
void FreezeCheck()
Определения PlayerBase.c:3683
ref StanceIndicator m_StanceIndicator
Определения PlayerBase.c:101
void OnUnconsciousStop(int pCurrentCommandID)
Определения PlayerBase.c:3819
void SetCheckMeleeItem(ItemBase item=null)
Определения PlayerBase.c:3673
float m_SurrenderTransitionTimer
Определения PlayerBase.c:316
void OnFinishTransitionToSurrender()
Определения PlayerBase.c:2073
void OnQuickBarContinuousUseEnd(int slotClicked)
Определения PlayerBase.c:5077
ref WeaponManager m_WeaponManager
Определения PlayerBase.c:128
void OnQuickBarSingleUse(int slotClicked)
Определения PlayerBase.c:4938
ref StaminaHandler m_StaminaHandler
Определения PlayerBase.c:97
RandomGeneratorSyncManager m_RGSManager
Определения PlayerBase.c:201
ConstructionActionData GetConstructionActionData()
Определения PlayerBase.c:2321
ref HeatComfortAnimHandler m_HCAnimHandler
Определения PlayerBase.c:135
void BrokenLegForceProne(bool forceOverride=false)
Определения PlayerBase.c:4041
void CheckShouldCancelSurrender()
Определения PlayerBase.c:3183
void ProcessDrowning(float dT)
Определения PlayerBase.c:2436
eBrokenLegs GetBrokenLegs()
Определения PlayerBase.c:3966
void ShockRefill(float pDt)
functionality moved to ShockMdfr::OnTick
ref ShockHandler m_ShockHandler
Определения PlayerBase.c:99
bool IsMapCallbackEndInput()
Определения PlayerBase.c:3642
override bool CanConsumeStamina(EStaminaConsumers consumer)
Определения PlayerBase.c:4799
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:1084
proto native DayZPlayerInstanceType GetInstanceType()
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
DayZGame GetGame()
Определения gameplay.c:636
const int MENU_MAP
Определения 3_Game/DayZ/constants.c:197
void HumanCommandMove()
Определения human.c:534
void HumanCommandUnconscious()
Определения human.c:660

Перекрестные ссылки ActionManagerBase(), BrokenLegForceProne(), HumanInputController::CameraIsFreeLook(), CanConsumeStamina(), CanSprint(), CheckMeleeItemDamage(), CheckSendSoundEvent(), CheckShouldCancelSurrender(), CheckZeroSoundEvent(), CloseMapEx(), DropHeavyItem(), FreezeCheck(), g_Game, GetActionManager(), GetBrokenLegs(), GetConstructionActionData(), DustEffectManager::GetDustEffectManager(), 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(), HumanCommandUnconscious::IsRagdoll(), 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_IsSurrendered, m_MovementState, m_RGSManager, m_ShockHandler, m_StaminaHandler, m_StanceIndicator, m_StartedSurrenderTransition, m_SurrenderTransitionTimer, m_UnconsciousTime, m_WeaponManager, MENU_MAP, OnCommandHandlerTick(), OnFinishTransitionFromSurrender(), OnFinishTransitionToSurrender(), OnQuickBarContinuousUseEnd(), OnQuickBarContinuousUseStart(), OnQuickBarSingleUse(), OnUnconsciousStart(), OnUnconsciousStop(), OnUnconsciousUpdate(), ProcessADDModifier(), ProcessDrowning(), ProcessHoldBreath(), HumanInputController::ResetADS(), SetCheckMeleeItem(), ShockRefill(), UAInput::Supress(), DustEffectManager::Update(), UpdateDelete(), HumanCommandUnconscious::WakeUp() и vector::Zero.