1887 {
1888 if (!IsAlive())
1889 {
1891 {
1893 }
1894 return;
1895 }
1896
1897 bool bADSToggle = false;
1898 bool exitSights = false;
1899 HumanInputController hic = GetInputController();
1902 PlayerBase playerPB = PlayerBase.Cast(this);
1904
1905 if (playerPB.IsRolling())
1906 {
1907 exitSights = true;
1908 }
1909
1910 bool isItemInHandsWeapon = hia.IsItemInHandsWeapon();
1912 {
1915 }
1916
1918 {
1920 exitSights = true;
1921 }
1922 else
1923 {
1925 if (
m_bADS != isWeaponADS)
1926 {
1928 bADSToggle = true;
1929 }
1930
1932 {
1935 {
1936 bADSToggle = false;
1937 exitSights = true;
1938 }
1939 else
1940 {
1941 bADSToggle = true;
1942 }
1943 }
1944 }
1945
1946 if (bADSToggle && !GetCommand_Melee2() && !
GetThrowing().IsThrowingModeEnabled())
1947 {
1948 if (hia.IsItemInHandsWeapon() && playerPB.GetWeaponManager() && !playerPB.GetWeaponManager().IsRunning())
1949 {
1950 Weapon_Base weapon = Weapon_Base.Cast(GetEntityInHands());
1951 ItemOptics optic = weapon.GetAttachedOptics();
1952 bool switchToADS = false;
1953 bool canUseIronsights = weapon.CanEnterIronsights();
1954 bool canUseOptics = optic != NULL;
1955
1956 if (canUseIronsights || canUseOptics)
1958
1959
1963 {
1964 switchToADS = false;
1965 }
1966
1967
1969 {
1970 exitSights = true;
1971 }
1972 else if (switchToADS)
1973 {
1974
1975 if (weapon.GetWasIronSight() && !canUseIronsights)
1976 {
1977 weapon.SetWasIronSight(false);
1978 }
1979 else if (!weapon.GetWasIronSight() && !canUseOptics)
1980 {
1981 weapon.SetWasIronSight(true);
1982 }
1983
1984 if (weapon.GetWasIronSight())
1985 {
1988 }
1989 else if (!weapon.GetWasIronSight() || (!canUseIronsights && canUseOptics))
1990 {
1993 }
1994 else
1995 {
1996 exitSights = true;
1997 }
1998
2000 {
2002 }
2003 }
2004 else
2005 {
2006 exitSights = true;
2007 }
2008 }
2009 }
2010
2011
2013 {
2015 }
2016 }
bool IsProcessing()
returns true when FP is heating or cooling
StarlightOptic ItemOptics
void ResetWeaponRaiseProgress()
DayZPlayerImplementThrowing GetThrowing()
bool IsWeaponRaiseCompleted()
void SetIronsights(bool value)
bool IsWeaponObstructionBlockingADS()
ref HumanMovementState m_MovementState
time step for gradual update of dead screen visibilibty up to full visbility [s]
bool IsHandheldOpticsInUse()
DayZPlayerInventory GetDayZPlayerInventory()
void SwitchOptics(ItemOptics optic, bool state)
proto native void SetADS(bool pState)
sets head tilt to optics
DayZPlayerConstants
defined in C++
void HumanCommandWeapons()