DayZ 1.27
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 строка 615

616 {
617 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_DEATH)
618 {
620 {
621 case -1:
622 break;
623 case 0:
625
626 PhysicsSetSolid(true);
627
629 DayZPlayerVehicleCommandDeathCallback callbackVeh;
630 Class.CastTo(callbackVeh, StartCommand_Death(DayZPlayerConstants.DEATH_PULL_OUT_TRANSPORT, 0, DayZPlayerVehicleCommandDeathCallback, m_PullPlayerOutOfVehicleKeepsInLocalSpace));
631 Class.CastTo(callbackVeh.m_pPlayer, this);
632 break;
633 }
634
635 return true;
636 }
637
638 if (m_DeathAnimType != -2 && g_Game.GetMissionState() == g_Game.MISSION_STATE_GAME)
639 {
640 if (!CommitedSuicide())
641 {
642 int type = m_DeathAnimType;
643 if (type == DayZPlayerConstants.DEATH_DEFAULT)
644 type = GetTypeOfDeath(pCurrentCommandID);
645
646 m_WasInVehicle = false;
647 HumanCommandVehicle hcv = GetCommand_Vehicle();
648 if (hcv)
649 {
651 m_WasInVehicle = !hcv.IsGettingIn() && !hcv.IsGettingOut();
652 }
653
654 int seatIndex = -1;
656 {
657 seatIndex = m_TransportCache.CrewMemberIndex(this);
658 }
659
661 m_ShouldBeUnconscious = false;
662
663 bool keepInLocalSpace = m_PullPlayerOutOfVehicleKeepsInLocalSpace;
665 {
666 if (IsUnconscious() || m_WasInVehicle)
667 {
668 keepInLocalSpace = true;
669 m_TransportCache.CrewDeath(seatIndex);
670 }
671 else
672 {
673 m_TransportCache.CrewGetOut(seatIndex);
674 }
675
676 m_TransportCache.MarkCrewMemberDead(seatIndex);
677
678 if (seatIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
679 {
681
682#ifdef FEATURE_NETWORK_RECONCILIATION
683 PlayerIdentity identity = GetIdentity();
684
685 if (identity)
686 {
688 identity.Possess(this);
689 }
690#endif
691 }
692 }
693
694 DisableSimulation(false);
695 GetItemAccessor().HideItemInHands(false);
696 m_TransportCache = null;
697
698 DayZPlayerCommandDeathCallback callback;
699 Class.CastTo(callback, StartCommand_Death(type, m_DeathHitDir, DayZPlayerCommandDeathCallback, keepInLocalSpace));
700 Class.CastTo(callback.m_pPlayer, this);
701 }
702 else
703 {
704 PhysicsSetRagdoll(true);
705 }
706
707 // disable voice communication
708 GetGame().GetWorld().SetVoiceOn(false, false);
709
710 return true;
711 }
712
713 return false;
714 }
DayZGame g_Game
Определения DayZGame.c:3868
proto native World GetWorld()
bool m_ShouldBeUnconscious
Определения DayZPlayerImplement.c:149
bool CommitedSuicide()
Определения DayZPlayerImplement.c:3752
int m_DeathAnimType
Определения DayZPlayerImplement.c:511
int m_PullPlayerOutOfVehicleState
Определения DayZPlayerImplement.c:183
bool m_PullPlayerOutOfVehicleKeepsInLocalSpace
Определения DayZPlayerImplement.c:182
bool m_WasInVehicle
Определения DayZPlayerImplement.c:180
int GetTypeOfDeath(int pCurrentCommandID)
Определения DayZPlayerImplement.c:721
float m_DeathHitDir
Определения DayZPlayerImplement.c:512
Transport m_TransportCache
Определения DayZPlayerImplement.c:162
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().