2class DayZPlayerImplementSwimming
6 SHumanCommandSwimSettings m_pSettings;
7 bool m_bWasSwimming =
false;
9 void DayZPlayerImplementSwimming(
DayZPlayer pPlayer)
12 m_pSettings = pPlayer.GetDayZPlayerType().CommandSwimSettingsW();
17 vector pp = m_pPlayer.PhysicsGetPositionWS();
18 vector wl = HumanCommandSwim.WaterLevelCheck(m_pPlayer, pp);
23 float GetCharacterDepth()
25 vector pp = m_pPlayer.PhysicsGetPositionWS();
26 vector wl = HumanCommandSwim.WaterLevelCheck(m_pPlayer, pp);
31 bool CheckSwimmingStart(out
vector waterLevel)
33 return DayZPlayerUtils.CheckWaterLevel(m_pPlayer,waterLevel) ==
EWaterLevels.LEVEL_SWIM_START;
37 bool HandleSwimming(
int pCurrentCommandID, HumanCommandMove pCMove, HumanMovementState pState)
42 m_bWasSwimming =
false;
48 if (CheckSwimmingStart(wl))
50 m_pPlayer.StartCommand_Swim();
51 m_bWasSwimming =
true;
58 pCMove.SetCurrentWaterLevel(wl[1]);
59 m_pPlayer.SetCurrentWaterLevel(wl[1]);
63 if ( DayZPlayerUtils.PlayerCanChangeStance(m_pPlayer,
DayZPlayerConstants.STANCEIDX_ERECT) )
69 m_pPlayer.StartCommand_Swim();
70 m_bWasSwimming =
true;
76 if ( DayZPlayerUtils.PlayerCanChangeStance(m_pPlayer,
DayZPlayerConstants.STANCEIDX_CROUCH) )
82 m_pPlayer.StartCommand_Swim();
83 m_bWasSwimming =
true;
94 if (GetWaterDepth() < m_pSettings.m_fWaterLevelOut)
96 if (DayZPlayerUtils.PlayerCanChangeStance(m_pPlayer,
DayZPlayerConstants.STANCEIDX_ERECT,
true))
98 HumanCommandSwim hcs = m_pPlayer.GetCommand_Swim();
100 m_bWasSwimming =
false;
106 m_bWasSwimming =
true;