1871 {
1872 if (!IsAlive())
1873 {
1875 {
1877 }
1878 return;
1879 }
1880
1881 bool bADSToggle = false;
1882 bool exitSights = false;
1883 HumanInputController hic = GetInputController();
1886 PlayerBase playerPB = PlayerBase.Cast(this);
1888
1889 if (playerPB.IsRolling())
1890 {
1891 exitSights = true;
1892 }
1893
1894 bool isItemInHandsWeapon = hia.IsItemInHandsWeapon();
1896 {
1899 }
1900
1902 {
1904 exitSights = true;
1905 }
1906 else
1907 {
1909 if (
m_bADS != isWeaponADS)
1910 {
1912 bADSToggle = true;
1913 }
1914
1916 {
1919 {
1920 bADSToggle = false;
1921 exitSights = true;
1922 }
1923 else
1924 {
1925 bADSToggle = true;
1926 }
1927 }
1928 }
1929
1930 if (bADSToggle && !GetCommand_Melee2() && !
GetThrowing().IsThrowingModeEnabled())
1931 {
1932 if (hia.IsItemInHandsWeapon() && playerPB.GetWeaponManager() && !playerPB.GetWeaponManager().IsRunning())
1933 {
1934 Weapon_Base weapon = Weapon_Base.Cast(GetEntityInHands());
1935 ItemOptics optic = weapon.GetAttachedOptics();
1936 bool switchToADS = false;
1937 bool canUseIronsights = weapon.CanEnterIronsights();
1938 bool canUseOptics = optic != NULL;
1939
1940 if (canUseIronsights || canUseOptics)
1942
1943
1947 {
1948 switchToADS = false;
1949 }
1950
1951
1953 {
1954 exitSights = true;
1955 }
1956 else if (switchToADS)
1957 {
1958
1959 if (weapon.GetWasIronSight() && !canUseIronsights)
1960 {
1961 weapon.SetWasIronSight(false);
1962 }
1963 else if (!weapon.GetWasIronSight() && !canUseOptics)
1964 {
1965 weapon.SetWasIronSight(true);
1966 }
1967
1968 if (weapon.GetWasIronSight())
1969 {
1972 }
1973 else if (!weapon.GetWasIronSight() || (!canUseIronsights && canUseOptics))
1974 {
1977 }
1978 else
1979 {
1980 exitSights = true;
1981 }
1982
1984 {
1986 }
1987 }
1988 else
1989 {
1990 exitSights = true;
1991 }
1992 }
1993 }
1994
1995
1997 {
1999 }
2000 }
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()