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

◆ HandleDeath()

bool DayZPlayer::HandleDeath ( int pCurrentCommandID)
inlineprotected

Can't pull a body out of a car that is in water, don't need to handle that

player looks to be dead now, not unconscious

we don't want the vehicle to be haunted, re-possess the dead player so other players can use the vehicle

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

624 {
625 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_DEATH)
626 {
628 {
629 case -1:
630 break;
631 case 0:
633
634 PhysicsSetSolid(true);
635
637 DayZPlayerVehicleCommandDeathCallback callbackVeh;
638 Class.CastTo(callbackVeh, StartCommand_Death(DayZPlayerConstants.DEATH_PULL_OUT_TRANSPORT, 0, DayZPlayerVehicleCommandDeathCallback, m_PullPlayerOutOfVehicleKeepsInLocalSpace));
639 Class.CastTo(callbackVeh.m_pPlayer, this);
640 break;
641 }
642
643 return true;
644 }
645
646 if (m_DeathAnimType != -2 && g_Game.GetMissionState() == g_Game.MISSION_STATE_GAME)
647 {
648 if (!CommitedSuicide())
649 {
650 int type = m_DeathAnimType;
651 if (type == DayZPlayerConstants.DEATH_DEFAULT)
652 type = GetTypeOfDeath(pCurrentCommandID);
653
654 m_WasInVehicle = false;
655 HumanCommandVehicle hcv = GetCommand_Vehicle();
656 if (hcv)
657 {
659 m_WasInVehicle = !hcv.IsGettingIn() && !hcv.IsGettingOut();
660 }
661
662 int seatIndex = -1;
664 {
665 seatIndex = m_TransportCache.CrewMemberIndex(this);
666 }
667
669 m_ShouldBeUnconscious = false;
670
671 bool keepInLocalSpace = m_PullPlayerOutOfVehicleKeepsInLocalSpace;
673 {
674 if (IsUnconscious() || m_WasInVehicle)
675 {
676 keepInLocalSpace = true;
677 m_TransportCache.CrewDeath(seatIndex);
678 }
679 else
680 {
681 m_TransportCache.CrewGetOut(seatIndex);
682 }
683
684 m_TransportCache.MarkCrewMemberDead(seatIndex);
685
686 if (seatIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
687 {
689
690#ifdef FEATURE_NETWORK_RECONCILIATION
691 PlayerIdentity identity = GetIdentity();
692
693 if (identity)
694 {
696 identity.Possess(this);
697 }
698#endif
699 }
700 }
701
702 DisableSimulation(false);
703 GetItemAccessor().HideItemInHands(false);
704 m_TransportCache = null;
705
706 DayZPlayerCommandDeathCallback callback;
707 Class.CastTo(callback, StartCommand_Death(type, m_DeathHitDir, DayZPlayerCommandDeathCallback, keepInLocalSpace));
708 Class.CastTo(callback.m_pPlayer, this);
709 }
710 else
711 {
712 PhysicsSetRagdoll(true);
713 }
714
715 // disable voice communication
716 GetGame().GetWorld().SetVoiceOn(false, false);
717
718 return true;
719 }
720
721 return false;
722 }
DayZGame g_Game
Определения DayZGame.c:3868
proto native World GetWorld()
bool m_ShouldBeUnconscious
Определения DayZPlayerImplement.c:149
bool CommitedSuicide()
Определения DayZPlayerImplement.c:3818
int m_DeathAnimType
Определения DayZPlayerImplement.c:519
int m_PullPlayerOutOfVehicleState
Определения DayZPlayerImplement.c:185
bool m_PullPlayerOutOfVehicleKeepsInLocalSpace
Определения DayZPlayerImplement.c:184
bool m_WasInVehicle
Определения DayZPlayerImplement.c:182
int GetTypeOfDeath(int pCurrentCommandID)
Определения DayZPlayerImplement.c:729
float m_DeathHitDir
Определения DayZPlayerImplement.c:520
Transport m_TransportCache
Определения DayZPlayerImplement.c:164
proto native Transport GetTransport()
proto native bool IsGettingIn()
proto native bool IsGettingOut()
proto void SetVoiceOn(bool listening, bool toggled=false)
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()

Перекрестные ссылки Class::CastTo(), CommitedSuicide(), g_Game, GetGame(), HumanCommandVehicle::GetTransport(), GetTypeOfDeath(), CGame::GetWorld(), HumanCommandVehicle::IsGettingIn(), HumanCommandVehicle::IsGettingOut(), m_DeathAnimType, m_DeathHitDir, DayZPlayerCommandDeathCallback::m_pPlayer, m_PullPlayerOutOfVehicleKeepsInLocalSpace, m_PullPlayerOutOfVehicleState, m_ShouldBeUnconscious, m_TransportCache, m_WasInVehicle и World::SetVoiceOn().

Используется в CommandHandler().