1839 {
1840 if (!IsAlive())
1841 {
1843 {
1845 }
1846 return;
1847 }
1848
1849 bool bADSToggle = false;
1850 bool exitSights = false;
1851 HumanInputController hic = GetInputController();
1854 PlayerBase playerPB = PlayerBase.Cast(this);
1856
1857 if (playerPB.IsRolling())
1858 {
1859 exitSights = true;
1860 }
1861
1863 {
1866 }
1867
1869 {
1871 exitSights = true;
1872 }
1873 else
1874 {
1876 {
1878 bADSToggle = true;
1879 }
1880
1882 {
1885 {
1886 bADSToggle = false;
1887 exitSights = true;
1888 }
1889 else
1890 {
1891 bADSToggle = true;
1892 }
1893 }
1894 }
1895
1896 if (bADSToggle && !GetCommand_Melee2() && !
GetThrowing().IsThrowingModeEnabled())
1897 {
1898 if (hia.IsItemInHandsWeapon() && playerPB.GetItemInHands() && playerPB.GetItemInHands().IsWeapon() && playerPB.GetWeaponManager() && !playerPB.GetWeaponManager().IsRunning())
1899 {
1900 Weapon_Base weapon = Weapon_Base.Cast(GetHumanInventory().GetEntityInHands());
1901 ItemOptics optic = weapon.GetAttachedOptics();
1902 bool switchToADS = false;
1903 bool canUseIronsights = weapon.CanEnterIronsights();
1904 bool canUseOptics = optic != NULL;
1905
1906 if (canUseIronsights || canUseOptics)
1908
1909
1913 {
1914 switchToADS = false;
1915 }
1916
1917
1919 {
1920 exitSights = true;
1921 }
1922 else if (switchToADS)
1923 {
1924
1925 if (weapon.GetWasIronSight() && !canUseIronsights)
1926 {
1927 weapon.SetWasIronSight(false);
1928 }
1929 else if (!weapon.GetWasIronSight() && !canUseOptics)
1930 {
1931 weapon.SetWasIronSight(true);
1932 }
1933
1934 if (weapon.GetWasIronSight())
1935 {
1938 }
1939 else if (!weapon.GetWasIronSight() || (!canUseIronsights && canUseOptics))
1940 {
1943 }
1944 else
1945 {
1946 exitSights = true;
1947 }
1948
1950 {
1952 }
1953 }
1954 else
1955 {
1956 exitSights = true;
1957 }
1958 }
1959 }
1960
1961
1963 {
1965 }
1966 }
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()