File size: 255,326 Bytes
24b81cb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 | class PlayerBase extends ManBase
{
const int SIMPLIFIED_SHOCK_CAP = 63;
const int SHAKE_LEVEL_MAX = 7;
private int m_LifeSpanState;
private int m_LastShavedSeconds;
private int m_BloodType;
private bool m_HasBloodTypeVisible;
private bool m_LiquidTendencyDrain; //client-side only - Obsolete
private bool m_FlagRaisingTendency;
private int m_HasBloodyHandsVisible;
private int m_FaceCoveredForShaveLayers = 0; //DEPRECATED
protected bool m_HasHeatBuffer;
protected bool m_PlayerLoaded;
protected bool m_PlayerDisconnectProcessed;
protected bool m_ProcessUIWarning;
protected int m_LocalRefreshAnimStateIdx;
protected int m_RefreshAnimStateIdx;
private int m_StoreLoadVersion;
const int ACT_STORE_SAVE_VERSION = 4;
protected int m_LifespanLevelLocal; //control variable for change calls
protected int m_AnimCommandStarting; //signals the command that is about to start the next frame (e.g. Swim, Fall...)
EUndergroundPresence m_UndergroundPresence;
private PluginPlayerStatus m_ModulePlayerStatus;
PluginConfigEmotesProfile m_ConfigEmotesProfile;
private PluginLifespan m_ModuleLifespan;
protected PluginPresenceNotifier m_PresenceNotifier;
protected ref UndergroundHandlerClient m_UndergroundHandler;
ref PlayerStats m_PlayerStats;
PluginRecipesManager m_ModuleRecipesManager;
ref BleedingSourcesManagerServer m_BleedingManagerServer;
ref BleedingSourcesManagerRemote m_BleedingManagerRemote;
ref ModifiersManager m_ModifiersManager;
ref NotifiersManager m_NotifiersManager;
ref protected ActionManagerBase m_ActionManager;
//ref PlayerLightManager m_PlayerLightManager;
ref PlayerAgentPool m_AgentPool;
int m_Agents;
ref Environment m_Environment;
ref EmoteManager m_EmoteManager;
ref SymptomManager m_SymptomManager;
ref VirtualHud m_VirtualHud;
ref StaminaHandler m_StaminaHandler;
ref InjuryAnimationHandler m_InjuryHandler;
ref ShockHandler m_ShockHandler; //New shock handler
ref SoftSkillsManager m_SoftSkillsManager;
ref StanceIndicator m_StanceIndicator;
ref TransferValues m_TrasferValues;
ref DebugMonitorValues m_DebugMonitorValues;
const int OVERLOAD_LIMIT = 30000;
float m_CargoLoad;
float m_VisibilityCoef;
float m_OriginalSlidePoseAngle;
int m_SoundEvent;
int m_SoundEventParam;
int m_FliesIndex;
bool m_SoundEventSent;
ref Param2<float,float> m_UAProgressParam;
ref Param2<int,int> m_UAParam;
ref Param3<float,float,bool> m_StaminaParam;
ref Param1<string> m_UAParamMessage;
ref Param1<float> m_UnconParam;
ref Param1<float> m_DeathDarkeningParam;
ref DamageDealtEffect m_DamageDealtEffect;
ref EffectRadial m_EffectRadial;
ref FlashbangEffect m_FlashbangEffect;
ref ShockDealtEffect m_ShockDealtEffect;
ref EffectParticle m_FliesEff;
ref TInputActionMap m_InputActionMap; // Backwards compatibility
ref TInputActionMap m_InputActionMapControled;
ref TInputActionMap m_InputActionMapAsTarget;
bool m_ActionsInitialize;
//ref CraftingMeta m_CraftingMeta;
ref HiddenSelectionsData m_EmptyGloves;
ref WeaponManager m_WeaponManager;
ref CraftingManager m_CraftingManager;
ref ArrowManagerPlayer m_ArrowManager;
ref InventoryActionHandler m_InventoryActionHandler;
ref protected QuickBarBase m_QuickBarBase;
ref PlayerSoundManagerServer m_PlayerSoundManagerServer;
ref PlayerSoundManagerClient m_PlayerSoundManagerClient;
ref HeatComfortAnimHandler m_HCAnimHandler;
ref EffectSound m_SoundFliesEffect;
bool m_QuickBarHold;
bool m_QuickBarFT = false;
Hud m_Hud;
protected int m_RecipePick;
protected bool m_IsHoldingBreath;
protected bool m_IsInWater;
float m_LastPostFrameTickTime;
//AbstractWave m_SaySoundWave;
ref Timer m_DeathCheckTimer;
bool m_CorpseProcessing;
int m_CorpseState;
protected int m_CorpseStateLocal;
int m_PersistentFlags;
int m_StaminaState;
float m_UnconsciousTime;
int m_ShockSimplified;
float m_CurrentShock; //Used to synchronize shock between server and client
bool m_IsRestrained;
bool m_IsRestrainStarted;
bool m_IsRestrainPrelocked;
bool m_ImmunityBoosted;
bool m_AreHandsLocked; //Currently only used to block quickbar usage after canceling placement
float m_UnconsciousVignetteTarget = 2;
float m_CameraSwayModifier = 0.2;
float m_LastShockHitTime;
DayZPlayerCameraBase m_CurrentCamera;
int m_BleedingBits;
vector m_DirectionToCursor;
vector m_DefaultHitPosition;
int m_DiseaseCount;
int m_HealingsCount;
protected bool m_AllowQuickRestrain;
protected bool m_AllowQuickFishing;
protected int m_Shakes;
protected int m_ShakesForced;
int m_BreathVapour;
int m_HealthLevel;
int m_MixedSoundStates;
int m_QuickBarBonus = 0;
bool m_IsVehicleSeatDriver;
float m_UnconsciousEndTime = 0;
int m_BleedingSourceCount;
Head_Default m_CharactersHead;
EPulseType m_PulseType;
PlayerBase m_CheckPulseLastTarget;
int m_ForceInjuryAnimMask;
//string m_sOpticsType;
bool m_HideHairAnimated;
string m_DecayedTexture;
protected ref array<EntityAI> m_ItemsToDelete;
int m_BrokenLegState = eBrokenLegs.NO_BROKEN_LEGS; //Describe the current leg state, can go bellow 0, cannot be used directly to obtain broken legs state, use GetBrokenLegs() instead
int m_LocalBrokenState = eBrokenLegs.NO_BROKEN_LEGS;
bool m_BrokenLegsJunctureReceived;
ref EffectSound m_BrokenLegSound;
const string SOUND_BREAK_LEG = "broken_leg_SoundSet";
bool m_CanPlayBrokenLegSound; //Used to check if sound has already been played
static bool DEBUG_INVENTORY_ACCESS = false;
static ref array<string> m_BleedingSourcesLow; //Stores all LOWER body part bleeding sources
static ref array<string> m_BleedingSourcesUp; //Stores all UPPER body part bleeding sources EXCLUDING HEAD
float m_UnconRefillModifier = 1;
ref protected RandomGeneratorSyncManager m_RGSManager;
int m_AntibioticsActive;//ref count for antibiotics activation
// CONTAMINATED AREA RELATED
bool m_ContaminatedAreaEffectEnabled;
const string CONTAMINATED_AREA_AMBIENT = "ContaminatedArea_SoundSet";//obsolete, use EffectTrigger::GetAmbientSoundsetName() instead
EffectSound m_AmbientContamination;
protected int m_ContaminatedAreaCount;
protected int m_EffectAreaCount;
protected bool m_InsideEffectArea;
protected bool m_InsideEffectAreaPrev;
protected EffectTrigger m_CurrentEffectTrigger;
static ref array<Man> m_ServerPlayers = new array<Man>;
protected bool m_CanDisplayHitEffectPPE;
protected string m_CachedPlayerName;//cached from player identity
protected string m_CachedPlayerID;//cached from player identity
#ifdef DIAG_DEVELOPER
int m_IsInsideTrigger;
bool m_CanBeTargetedDebug; //server-side only
ref array<EntityAI> m_PresetItems = new array<EntityAI>;
bool m_PresetSpawned;
ref CameraToolsMenuClient m_CameraToolsMenuClient;
#endif
#ifdef DEVELOPER
Transport m_GetInVehicleTransportDebug;
#endif
#ifdef BOT
ref Bot m_Bot;
#endif
//Temp QuickBar load
ref array<ref Param2<EntityAI,int> > m_aQuickBarLoad;
//hologram
ref Hologram m_HologramServer;
ref Hologram m_HologramLocal;
vector m_LocalProjectionPosition = "0 0 0 ";
vector m_LocalProjectionOrientation = "0 0 0 ";
//Sheduler
float m_LastTick = -1;
int m_AddModifier = -1;
//crafting start
int m_RecipeID = -1;
EntityAI m_Item1;
EntityAI m_Item2;
bool m_IsCraftingReady;
float m_RecipeAnimLength;
vector m_CraftingInitialPos;
ref array<int> m_Recipes;
//crafting end
ref SoundParams m_SaySoundParams;
ref SoundObjectBuilder m_SaySoundBuilder;
ref SoundObject m_SaySoundObject;
string m_SaySoundLastSetName;
//input control
bool m_ActionQBControl;
//Action data for base building actions
ref ConstructionActionData m_ConstructionActionData;
//Action data for fireplace (indoor)
vector m_LastFirePoint;
float m_LastFirePointRot;
int m_LastFirePointIndex;
bool ItemToInventory;
bool m_IsFighting = false;
bool m_IsDrowning;//Set only via the setter SetDrowning
// debug monitor
int m_DebugMonitorEnabled;
//map
ActionUnfoldMapCB m_hac;
bool m_MapOpen;
bool m_MapCloseRequestProcessed; //DEPRECATED
protected bool m_MapClosingSyncSent;
protected float m_LastMapScale = -1.0;
protected vector m_LastMapPos;
protected ref MapNavigationBehaviour m_MapNavigationBehaviour;
//inventory soft locking
protected bool m_InventorySoftLocked; //obsolete, count should be checked instead. Left in here for legacy's sake.
protected int m_InventorySoftLockCount = 0;
static ref TStringArray m_QBarItems;
//Analytics
string m_DatabaseID;
ref Timer m_AnalyticsTimer;
//! melee stats
protected bool m_MeleeDebug;
//protected bool m_CheckMeleeItem;
protected ItemBase m_CheckMeleeItem;
//! user actions last message
protected string m_UALastMessage;
protected ref Timer m_UALastMessageTimer;
bool m_WorkingNVGHeadset; //Deprecated
bool m_LoweredNVGHeadset;
protected ref array<int> m_ActiveNVTypes;
//bool m_PreviousNVGState;
int m_SyncedModifiers;
int m_SyncedModifiersPrev;
PluginAdminLog m_AdminLog;
ref PlayerStomach m_PlayerStomach;
protected static Particle m_ContaminatedAroundPlayer;
protected static Particle m_ContaminatedAroundPlayerTiny;
protected PlayerStat<float> m_StatWater;
protected PlayerStat<float> m_StatToxicity;
protected PlayerStat<float> m_StatEnergy;
protected PlayerStat<float> m_StatHeatComfort;
protected PlayerStat<float> m_StatTremor;
protected PlayerStat<int> m_StatWet
protected PlayerStat<int> m_StatBloodType
protected PlayerStat<float> m_StatDiet
protected PlayerStat<float> m_StatStamina
protected PlayerStat<float> m_StatSpecialty
protected PlayerStat<float> m_StatHeatBuffer
//!effect widgets
protected GameplayEffectWidgets_base m_EffectWidgets;
protected ref array<int> m_ProcessAddEffectWidgets;
protected ref array<int> m_ProcessRemoveEffectWidgets;
//postprocess processing
protected ref array<int> m_ProcessAddGlassesEffects;
protected ref array<int> m_ProcessRemoveGlassesEffects;
void PlayerBase()
{
Init();
}
void Init()
{
SetEventMask(EntityEvent.INIT|EntityEvent.POSTFRAME|EntityEvent.FRAME);
m_StoreLoadVersion = 0;
m_IsCraftingReady = false;
m_Recipes = new array<int>;
m_LastShavedSeconds = 0;
m_BloodType = 0;
m_HasBloodTypeVisible = false;
m_LifeSpanState = 0;
m_LifespanLevelLocal = -1;
m_CorpseState = 0;
m_CorpseStateLocal = 0;
m_HasBloodyHandsVisible = 0;
m_PlayerLoaded = false;
m_PlayerSelected = false;
m_ProcessUIWarning = false;
m_FlagRaisingTendency = true;
m_LiquidTendencyDrain = false;
m_UAParamMessage = new Param1<string>("");
m_UnconParam = new Param1<float>(0);
m_DeathDarkeningParam = new Param1<float>(0);
m_UAParam = new Param2<int,int>(0,0);
m_UAProgressParam = new Param2<float,float>(0,0);
m_QuickBarBase = new QuickBarBase(this);
m_QuickBarBonus = Math.Max(ConfigGetInt("quickBarBonus"), 0);
m_CargoLoad = 0;
m_VisibilityCoef = 1.0;
m_Hud = GetGame().GetMission().GetHud();
m_RecipePick = 0;
m_ActionQBControl = false;
m_QuickBarHold = false;
m_HideHairAnimated = true;
m_WorkingNVGHeadset = false;
m_LoweredNVGHeadset = false;
m_AreHandsLocked = false;
m_ItemsToDelete = new array<EntityAI>;
m_AnimCommandStarting = HumanMoveCommandID.None;
m_EmptyGloves = new HiddenSelectionsData(ConfigGetString("emptyGloves"));
m_CanDisplayHitEffectPPE = true;
#ifdef DIAG_DEVELOPER
m_CanBeTargetedDebug = true;
//RegisterNetSyncVariableBool("m_CanBeTargetedDebug");
#endif
m_AnalyticsTimer = new Timer(CALL_CATEGORY_SYSTEM);
m_StaminaHandler = new StaminaHandler(this);//current stamina calculation
m_InjuryHandler = new InjuryAnimationHandler(this);
m_ShockHandler = new ShockHandler(this); //New shock handler
m_HCAnimHandler = new HeatComfortAnimHandler(this);
m_PlayerStats = new PlayerStats(this);//player stats
m_ArrowManager = new ArrowManagerPlayer(this);
if (GetGame().IsServer())
{
m_PlayerStomach = new PlayerStomach(this);
m_NotifiersManager = new NotifiersManager(this); // player notifiers
m_AgentPool = new PlayerAgentPool(this); // agent pool manager
m_BleedingManagerServer = new BleedingSourcesManagerServer(this);
m_Environment = new Environment(this);//environment effects on player
m_ModifiersManager = new ModifiersManager(this); // player modifiers
m_PlayerSoundManagerServer = new PlayerSoundManagerServer(this);
m_VirtualHud = new VirtualHud(this);
m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
}
m_SymptomManager = new SymptomManager(this); // state manager
m_ModuleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
m_TrasferValues = new TransferValues(this);
m_EmoteManager = new EmoteManager(this);
m_SoftSkillsManager = new SoftSkillsManager(this);//Soft Skills calculation
m_WeaponManager = new WeaponManager(this);
m_DebugMonitorValues = new DebugMonitorValues(this);
m_RGSManager = new RandomGeneratorSyncManager(this);
if (!GetGame().IsDedicatedServer())
{
m_MeleeDebug = false;
m_UALastMessage = "";
m_UALastMessageTimer = new Timer;
m_InventoryActionHandler = new InventoryActionHandler(this);
m_BleedingManagerRemote = new BleedingSourcesManagerRemote(this);
m_PlayerSoundManagerClient = new PlayerSoundManagerClient(this);
m_StanceIndicator = new StanceIndicator(this);
m_ActionsInitialize = false;
ClientData.AddPlayerBase(this);
m_ProcessAddEffectWidgets = new array<int>;
m_ProcessRemoveEffectWidgets = new array<int>;
m_ActiveNVTypes = new array<int>;
m_ProcessAddGlassesEffects = new array<int>;
m_ProcessRemoveGlassesEffects = new array<int>;
}
m_ActionManager = NULL;
//m_PlayerLightManager = NULL;
m_ConfigEmotesProfile = PluginConfigEmotesProfile.Cast(GetPlugin(PluginConfigEmotesProfile));
if (GetDayZGame().IsDebug())
{
PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed = PluginConfigDebugProfileFixed.Cast(GetPlugin(PluginConfigDebugProfileFixed));
PluginConfigDebugProfile m_ConfigDebugProfile = PluginConfigDebugProfile.Cast(GetPlugin(PluginConfigDebugProfile));
PluginDeveloper m_Developer = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
PlayerBase player = this;
if (m_ConfigDebugProfile)
{
string default_preset = m_ConfigDebugProfile.GetDefaultPreset();
if (player && default_preset != "")
{
TStringArray preset_array = new TStringArray;
m_ConfigDebugProfileFixed.GetPresetItems(default_preset, preset_array);
bool is_preset_fixed = true;
if (preset_array.Count() == 0)
{
m_ConfigDebugProfile.GetPresetItems(default_preset, preset_array);
is_preset_fixed = false;
}
if (preset_array.Count() > 0)
{
m_Developer.ClearInventory(player);
for (int i = 0; i < preset_array.Count(); i++)
{
float health = -1;
int quantity = -1;
if (is_preset_fixed)
{
health = m_ConfigDebugProfileFixed.GetItemHealth(default_preset, i);
quantity = m_ConfigDebugProfileFixed.GetItemQuantity(default_preset, i);
}
else
{
health = m_ConfigDebugProfile.GetItemHealth(default_preset, i);
quantity = m_ConfigDebugProfile.GetItemQuantity(default_preset, i);
}
m_Developer.SpawnEntityInPlayerInventory(player, preset_array.Get(i), health, quantity);
}
}
}
}
}
m_MapNavigationBehaviour = new MapNavigationBehaviour(this);
m_ModulePlayerStatus = PluginPlayerStatus.Cast(GetPlugin(PluginPlayerStatus));
m_ModuleLifespan = PluginLifespan.Cast(GetPlugin(PluginLifespan));
m_BleedingSourcesLow = new array<string>;
m_BleedingSourcesLow.Insert("RightToeBase");
m_BleedingSourcesLow.Insert("RightFoot");
m_BleedingSourcesLow.Insert("LeftToeBase");
m_BleedingSourcesLow.Insert("LeftFoot");
m_BleedingSourcesLow.Insert("RightUpLegRoll");
m_BleedingSourcesLow.Insert("RightUpLeg");
m_BleedingSourcesLow.Insert("RightLegRoll");
m_BleedingSourcesLow.Insert("RightLeg");
m_BleedingSourcesLow.Insert("LeftUpLegRoll");
m_BleedingSourcesLow.Insert("LeftUpLeg");
m_BleedingSourcesLow.Insert("LeftLegRoll");
m_BleedingSourcesLow.Insert("LeftLeg");
m_BleedingSourcesUp = new array<string>;
m_BleedingSourcesUp.Insert("RightForeArmRoll");
m_BleedingSourcesUp.Insert("LeftForeArmRoll");
m_BleedingSourcesUp.Insert("RightForeArm");
m_BleedingSourcesUp.Insert("RightArmRoll");
m_BleedingSourcesUp.Insert("RightArm");
m_BleedingSourcesUp.Insert("RightShoulder");
m_BleedingSourcesUp.Insert("LeftForeArm");
m_BleedingSourcesUp.Insert("LeftArmRoll");
m_BleedingSourcesUp.Insert("LeftArm");
m_BleedingSourcesUp.Insert("LeftShoulder");
m_BleedingSourcesUp.Insert("Spine3");
m_BleedingSourcesUp.Insert("Spine2");
m_BleedingSourcesUp.Insert("Spine1");
m_BleedingSourcesUp.Insert("Spine");
m_BleedingSourcesUp.Insert("Pelvis");
m_BleedingSourcesUp.Insert("Neck");
RegisterNetSyncVariableInt("m_LifeSpanState", LifeSpanState.BEARD_NONE, LifeSpanState.COUNT);
RegisterNetSyncVariableInt("m_BloodType", 0, 128);
RegisterNetSyncVariableInt("m_ShockSimplified",0, SIMPLIFIED_SHOCK_CAP);
RegisterNetSyncVariableInt("m_SoundEvent",0, EPlayerSoundEventID.ENUM_COUNT - 1);
RegisterNetSyncVariableInt("m_SoundEventParam", 0, ((EPlayerSoundEventParam.ENUM_COUNT - 1) * 2) - 1);
RegisterNetSyncVariableInt("m_StaminaState",0, eStaminaState.COUNT - 1);
RegisterNetSyncVariableInt("m_BleedingBits");
RegisterNetSyncVariableInt("m_Shakes", 0, SHAKE_LEVEL_MAX);
RegisterNetSyncVariableInt("m_BreathVapour", 0, BREATH_VAPOUR_LEVEL_MAX);
RegisterNetSyncVariableInt("m_HealthLevel", eInjuryHandlerLevels.PRISTINE, eInjuryHandlerLevels.RUINED);
RegisterNetSyncVariableInt("m_MixedSoundStates", 0, eMixedSoundStates.COUNT - 1);
RegisterNetSyncVariableInt("m_CorpseState",-PlayerConstants.CORPSE_STATE_DECAYED,PlayerConstants.CORPSE_STATE_DECAYED);//do note the negative min, negative sign denotes a special meaning
RegisterNetSyncVariableInt("m_RefreshAnimStateIdx",0,3);
RegisterNetSyncVariableInt("m_BrokenLegState", -eBrokenLegs.BROKEN_LEGS_SPLINT, eBrokenLegs.BROKEN_LEGS_SPLINT);
RegisterNetSyncVariableInt("m_SyncedModifiers", 0, ((eModifierSyncIDs.LAST_INDEX - 1) * 2) - 1);
RegisterNetSyncVariableInt("m_HasBloodyHandsVisible", 0, eBloodyHandsTypes.LAST_INDEX - 1);
RegisterNetSyncVariableInt("m_ActionSoundCategoryHash");
RegisterNetSyncVariableBool("m_IsUnconscious");
RegisterNetSyncVariableBool("m_IsRestrained");
RegisterNetSyncVariableBool("m_IsInWater");
RegisterNetSyncVariableBool("m_InsideEffectArea");
RegisterNetSyncVariableBool("m_HasBloodTypeVisible");
//RegisterNetSyncVariableBool("m_LiquidTendencyDrain");
RegisterNetSyncVariableBool("m_IsRestrainStarted");
RegisterNetSyncVariableBool("m_IsRestrainPrelocked");
RegisterNetSyncVariableBool("m_HasHeatBuffer");
RegisterNetSyncVariableFloat("m_CurrentShock"); //Register shock synchronized variable
m_OriginalSlidePoseAngle = GetSlidePoseAngle();
//! sets default hit position and cache it here (mainly for impact particles)
m_DefaultHitPosition = SetDefaultHitPosition(GetDayZPlayerType().GetDefaultHitPositionComponent());
m_DecayedTexture = ConfigGetString("decayedTexture");
m_FliesIndex = -1;
GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(this.OnPlayerLoaded);
}
void IncreaseAntibioticsCount()
{
m_AntibioticsActive++;
}
void DecreaseAntibioticsCount()
{
m_AntibioticsActive--;
if (m_AntibioticsActive < 0)
{
m_AntibioticsActive = 0;
Error("DecreaseAntibioticsCount called more times than IncreaseAntibioticsCount (should be equal) - check your code, forcing clamp to 0");
}
}
bool IsAntibioticsActive()
{
return (m_AntibioticsActive > 0);
}
void SetSoundCategoryHash(int hash)
{
m_ActionSoundCategoryHash = hash;
SetSynchDirty();
}
void RequestTriggerEffect(EffectTrigger trigger, int ppeIdx = -1, int aroundId = ParticleList.CONTAMINATED_AREA_GAS_AROUND, int tinyId = ParticleList.CONTAMINATED_AREA_GAS_TINY, string soundset = "", bool partDynaUpdate = false, int newBirthRate = 0, bool forceUpdate = false)
{
//do note multiple triggers can be calling this method within a single frame depending on the contaminated area setup and dynamic gameplay events(such as gas grenades being deployed)
if (!m_InsideEffectArea)
return;
bool allow = false;
if (!m_CurrentEffectTrigger)
{
allow = true;
}
else if (trigger == m_CurrentEffectTrigger && forceUpdate)
{
allow = true;
//Print("ON Enabling effect FORCED " + trigger);
}
else if (trigger.GetEffectsPriority() > m_CurrentEffectTrigger.GetEffectsPriority())
{
RemoveCurrentEffectTrigger();
allow = true;
}
if (allow)
{
/*
Print("--------------------------------------------------");
Print("ON Enabling effect " + trigger);
Print("------------> soundset " + soundset);
Print("--------------------------------------------------");
*/
m_CurrentEffectTrigger = trigger;
SetContaminatedEffectEx( true, ppeIdx, aroundId, tinyId, soundset,partDynaUpdate, newBirthRate );
}
}
void RemoveCurrentEffectTrigger()
{
if (m_CurrentEffectTrigger)
{
/*
Print("--------------------------------------------------");
Print("OFF Disabling effect");
Print("--------------------------------------------------");
*/
SetContaminatedEffectEx( false, m_CurrentEffectTrigger.m_PPERequester );
m_CurrentEffectTrigger = null;
}
}
void IncreaseContaminatedAreaCount()
{
if (m_ContaminatedAreaCount == 0)
OnContaminatedAreaEnterServer();
m_ContaminatedAreaCount++;
}
void DecreaseContaminatedAreaCount()
{
m_ContaminatedAreaCount--;
if (m_ContaminatedAreaCount <= 0)
{
m_ContaminatedAreaCount = 0;
OnContaminatedAreaExitServer();
}
}
void IncreaseEffectAreaCount()
{
if (m_EffectAreaCount == 0)
{
m_InsideEffectArea = true;
SetSynchDirty();
OnPlayerIsNowInsideEffectAreaBeginServer();
}
m_EffectAreaCount++;
}
void DecreaseEffectAreaCount()
{
m_EffectAreaCount--;
if (m_EffectAreaCount <= 0)
{
m_EffectAreaCount = 0;
m_InsideEffectArea = false;
SetSynchDirty();
OnPlayerIsNowInsideEffectAreaEndServer();
}
}
protected void OnContaminatedAreaEnterServer()
{
GetModifiersManager().ActivateModifier( eModifiers.MDF_AREAEXPOSURE );
//Print("Contaminated ENTERED <------------------------------------------------------------- FINAL");
}
protected void OnContaminatedAreaExitServer()
{
GetModifiersManager().DeactivateModifier( eModifiers.MDF_AREAEXPOSURE );
//Print("Contaminated LEFT <------------------------------------------------------------- FINAL");
}
protected void OnPlayerIsNowInsideEffectAreaBeginServer()
{
//Print("ANY EFFECT AREA ENTERED <------------------------------------------------------------- FINAL");
}
protected void OnPlayerIsNowInsideEffectAreaEndServer()
{
//Print("ANY EFFECT AREA LEFT <------------------------------------------------------------- FINAL");
}
protected void OnPlayerIsNowInsideEffectAreaBeginClient()
{
//Print("ANY EFFECT AREA ENTERED CLIENT <------------------------------------------------------------- FINAL");
}
protected void OnPlayerIsNowInsideEffectAreaEndClient()
{
RemoveCurrentEffectTrigger();
//Print("ANY EFFECT AREA LEFT CLIENT <------------------------------------------------------------- FINAL");
}
//! Returns item that's on this player's attachment slot. Parameter slot_type should be a string from config parameter 'itemInfo[]' like "Legs", "Headgear" and so on.
ItemBase GetItemOnSlot(string slot_type)
{
int slot_id = InventorySlots.GetSlotIdFromString(slot_type);
EntityAI item_EAI = this.GetInventory().FindAttachment(slot_id);
ItemBase item_IB = ItemBase.Cast(item_EAI);
if (item_EAI && !item_IB)
{
string str = "Warning! GetItemOnSlot() >> found item on slot " + slot_type + " can't be cast to ItemBase! Found item is " + item_EAI.GetType() + " and the player is " + GetType() + "!";
Error(str);
return null;
}
return item_IB;
}
//! Returns item on player's head. For an example, a headtorch.
ItemBase GetItemOnHead()
{
return GetItemOnSlot("Headgear");
}
override int GetQuickBarBonus()
{
return m_QuickBarBonus;
}
//--------------------------------------------------------------------------
// Inventory overrides
//--------------------------------------------------------------------------
override bool CanDropEntity (notnull EntityAI item)
{
if (GetInventory().HasInventoryReservation(item, null))
{
return false;
}
if (IsRestrained())
{
if (GetHumanInventory().GetEntityInHands() == item)
return false;
}
return true;
}
//--------------------------------------------------------------------------
// PLAYER DAMAGE EVENT HANDLING
//--------------------------------------------------------------------------
int GetBreathVapourLevel()
{
return m_BreathVapour;
}
// adds state to and syncs sound states variable which is used to generate sound client-side
void UnsetMixedSoundState(eMixedSoundStates state)
{
int bit_mask_remove = ~state;
eMixedSoundStates new_states = m_MixedSoundStates & bit_mask_remove;
if (new_states != m_MixedSoundStates)
{
m_MixedSoundStates = new_states;
SetSynchDirty();
}
}
// adds state to and syncs sound states variable which is used to generate sound client-side
void SetMixedSoundState(eMixedSoundStates state)
{
eMixedSoundStates new_states = m_MixedSoundStates | state;
if (new_states != m_MixedSoundStates)
{
m_MixedSoundStates = new_states;
SetSynchDirty();
}
}
override bool IsPlayer()
{
return true;
}
bool IsBleeding()
{
return (m_BleedingBits != 0);
}
void SetBleedingBits(int bits)
{
if (m_BleedingBits != bits)
{
if (m_BleedingBits == 0)
{
OnBleedingBegin();
}
else if (bits == 0)
{
OnBleedingEnd();
}
}
m_BleedingBits = bits;
SetSynchDirty();
}
int GetBleedingBits()
{
return m_BleedingBits;
}
void IncreaseDiseaseCount()
{
m_DiseaseCount++;
}
void DecreaseDiseaseCount()
{
m_DiseaseCount--;
}
void IncreaseHealingsCount()
{
m_HealingsCount++;
}
void DecreaseHealingsCount()
{
m_HealingsCount--;
}
bool HasHealings()
{
return m_HealingsCount;//0 for no healings, 1+ for healings, gets truncated to 1
}
bool HasDisease()
{
return m_DiseaseCount;//0 for no disease, 1+ for disease, gets truncated to 1
}
EPulseType GetPulseType()
{
return m_PulseType;
}
void SetPulseType(EPulseType pulse_type)
{
m_PulseType = pulse_type;
}
void QueueAddEffectWidget(array<int> effects)
{
m_ProcessAddEffectWidgets.InsertArray(effects);
}
void QueueRemoveEffectWidget(array<int> effects)
{
m_ProcessRemoveEffectWidgets.InsertArray(effects);
}
void QueueAddGlassesEffect(int id)
{
m_ProcessAddGlassesEffects.Insert(id);
}
void QueueRemoveGlassesEffect(int id)
{
m_ProcessRemoveGlassesEffects.Insert(id);
}
DamageDealtEffect GetDamageDealtEffect()
{
return m_DamageDealtEffect;
}
override void SpawnDamageDealtEffect()
{
if (m_DamageDealtEffect)
{
delete m_DamageDealtEffect;
}
if (m_CanDisplayHitEffectPPE)
{
m_DamageDealtEffect = new DamageDealtEffect();
}
}
void SpawnDamageDealtEffect2(Param param1 = null, Param param2 = null)
{
if (m_EffectRadial)
{
delete m_EffectRadial;
}
m_EffectRadial = new EffectRadial(param1,param2);
}
FlashbangEffect GetFlashbangEffect()
{
return m_FlashbangEffect;
}
void SpawnFlashbangEffect(PlayerBase player, bool visual)
{
if (m_FlashbangEffect)
{
m_FlashbangEffect.Stop();
delete m_FlashbangEffect;
}
m_FlashbangEffect = new FlashbangEffect(player, visual);
}
ShockDealtEffect GetShockEffect()
{
return m_ShockDealtEffect;
}
void SpawnShockEffect(float intensity_max)
{
if (m_ShockDealtEffect)
{
delete m_ShockDealtEffect;
}
m_ShockDealtEffect = new ShockDealtEffect(intensity_max);
}
override void EEKilled(Object killer)
{
//Print(Object.GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " event EEKilled, player has died at STS=" + GetSimulationTimeStamp());
if (m_AdminLog)
{
m_AdminLog.PlayerKilled(this, killer);
}
if (GetBleedingManagerServer())
delete GetBleedingManagerServer();
if (GetModifiersManager())
GetModifiersManager().DeactivateAllModifiers();
// kill character in database
if (GetHive())
{
GetHive().CharacterKill(this);
}
// disable voice communication
GetGame().EnableVoN(this, false);
if (!GetGame().IsDedicatedServer())
ClientData.RemovePlayerBase(this);
GetSymptomManager().OnPlayerKilled();
if (GetEconomyProfile() && !m_CorpseProcessing && m_CorpseState == 0 && GetGame().GetMission().InsertCorpse(this))
{
m_CorpseProcessing = true;
//Print("EEKilled - processing corpse");
}
if (GetGame().IsMultiplayer() && GetGame().IsServer())
{
if (GetGame().GetMission())
{
GetGame().GetMission().SyncRespawnModeInfo(GetIdentity());
}
}
super.EEKilled(killer);
}
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
{
super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
if (m_AdminLog)
{
m_AdminLog.PlayerHitBy(damageResult, damageType, this, source, component, dmgZone, ammo);
}
if (damageResult != null && damageResult.GetDamage(dmgZone, "Shock") > 0)
{
m_LastShockHitTime = GetGame().GetTime();
if (!IsUnconscious())
{
if (GetGame().ConfigIsExisting("cfgAmmo " + ammo + " unconRefillModifier"))
{
m_UnconRefillModifier = GetGame().ConfigGetInt("cfgAmmo " + ammo + " unconRefillModifier");
}
else
{
m_UnconRefillModifier = 1;
}
}
}
//! DT_EXPLOSION & FlashGrenade
if (damageType == DT_EXPLOSION && ammo == "FlashGrenade_Ammo")
{
GetStaminaHandler().DepleteStamina(EStaminaModifiers.OVERALL_DRAIN);
}
//new bleeding computation
//---------------------------------------
if (damageResult != null && GetBleedingManagerServer())
{
float dmg = damageResult.GetDamage(dmgZone, "Blood");
GetBleedingManagerServer().ProcessHit(dmg, source, component, dmgZone, ammo, modelPos);
}
//---------------------------------------
#ifdef DIAG_DEVELOPER
if (DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG))
Print("EEHitBy() | " + GetDisplayName() + " hit by " + source.GetDisplayName() + " to " + dmgZone);
PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast(GetPlugin(PluginRemotePlayerDebugServer));
if (plugin_remote_server)
{
plugin_remote_server.OnDamageEvent(this, damageResult);
}
#endif
if (GetGame().IsDebugMonitor())
m_DebugMonitorValues.SetLastDamage(source.GetDisplayName());
if (m_ActionManager)
m_ActionManager.Interrupt();
int transferShockToDamageCoef = g_Game.ConfigGetInt(string.Format("%1 %2 DamageApplied transferShockToDamage", CFG_AMMO, ammo));
if (transferShockToDamageCoef == 1)
{
//Print("PlayerBase | EEHitBy | nonlethal hit");
AddHealth("", "Health", -ConvertNonlethalDamage(damageResult.GetDamage(dmgZone, "Shock"), damageType));
if (dmgZone != "Head")
AddHealth(dmgZone, "Health", -damageResult.GetDamage(dmgZone, "Shock")); //Also deal damage to zone health, no dmg reduction
}
if (GetGame().IsServer())
{
if (GetHealth("RightLeg", "Health") <= 1 || GetHealth("LeftLeg", "Health") <= 1 || GetHealth("RightFoot", "Health") <= 1 || GetHealth("LeftFoot", "Health") <= 1)
{
if (GetModifiersManager().IsModifierActive(eModifiers.MDF_BROKEN_LEGS))//effectively resets the modifier
{
GetModifiersManager().DeactivateModifier(eModifiers.MDF_BROKEN_LEGS);
}
GetModifiersManager().ActivateModifier(eModifiers.MDF_BROKEN_LEGS);
}
if (ammo == "Bullet_CupidsBolt" && IsAlive())
{
DamageSystem.ResetAllZones(this);
m_ModifiersManager.ResetAll();
m_ModifiersManager.ActivateModifier(eModifiers.MDF_IMMUNITYBOOST);
// bleeding sources
if (m_BleedingManagerServer)
m_BleedingManagerServer.RemoveAllSources();
// Stats
if (GetPlayerStats())
{
int bloodType = GetStatBloodType().Get();
float energyValue = GetStatEnergy().Get();
float waterValue = GetStatWater().Get();
float heatBuffer = GetStatHeatBuffer().Get();
float heatComfort = GetStatHeatComfort().Get();
GetPlayerStats().ResetAllStats();
GetStatBloodType().Set(bloodType);
GetStatWater().Set(waterValue);
GetStatEnergy().Set(energyValue);
GetStatHeatBuffer().Set(heatBuffer);
GetStatHeatComfort().Set(heatComfort);
}
// Agents
if (m_AgentPool)
m_AgentPool.RemoveAllAgents();
if (m_StaminaHandler)
m_StaminaHandler.SetStamina(GameConstants.STAMINA_MAX);
// uncon
if (IsUnconscious())
DayZPlayerSyncJunctures.SendPlayerUnconsciousness(this, false);
}
}
m_ShockHandler.CheckValue(true);
//analytics
GetGame().GetAnalyticsServer().OnEntityHit(source, this);
}
override void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
{
super.EEHitByRemote(damageType, source, component, dmgZone, ammo, modelPos);
if (m_MeleeFightLogic.IsInBlock())
{
EffectSound sound = SEffectManager.PlaySoundOnObject("BlockingAttack_SoundSet", this);
sound.SetAutodestroy(true);
}
}
override void EEDelete(EntityAI parent)
{
SEffectManager.DestroyEffect(m_FliesEff);
StopSoundSet(m_SoundFliesEffect);
if (GetArrowManager())
GetArrowManager().ClearArrows();
}
override protected float ConvertNonlethalDamage(float damage, DamageType damageType)
{
return damage * GameConstants.NL_DAMAGE_FIREARM_CONVERSION_PLAYERS;
}
/** Call only on client or single player PlayerBase
* (as GetGame().GetPlayer())
*/
override void OnReceivedHit(ImpactEffectsData hitData)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
float shakeStrength = Math.InverseLerp(0, 500, hitData.m_InSpeed.Length());
GetCurrentCamera().SpawnCameraShake(shakeStrength);
OnPlayerRecievedHit();
}
if (hitData.m_AmmoType == "Bullet_CupidsBolt")
Ammo_CupidsBolt.PlayOnHitParticle(hitData.m_Position);
//ParticleManager.GetInstance().PlayInWorld(ParticleList.BOLT_CUPID_HIT, hitData.m_Position);
}
// DEPRECATED by method above
override void OnPlayerRecievedHit()
{
#ifndef NO_GUI
if (m_MeleeFightLogic.IsInBlock())
{
EffectSound sound = SEffectManager.PlaySoundOnObject("BlockingAttack_SoundSet", this);
sound.SetAutodestroy(true);
return;
}
SpawnDamageDealtEffect();
CachedObjectsParams.PARAM2_FLOAT_FLOAT.param1 = 32;
CachedObjectsParams.PARAM2_FLOAT_FLOAT.param2 = 0.3;
SpawnDamageDealtEffect2(CachedObjectsParams.PARAM2_FLOAT_FLOAT);
CloseMapEx(true);
#endif
}
void OnPlayerReceiveFlashbangHitStart(bool visual)
{
SpawnFlashbangEffect(this, visual);
}
void OnPlayerReceiveFlashbangHitEnd() {}
//--------------------------------------------------------------------------
//! Melee helpers
//--------------------------------------------------------------------------
//! select & return hit component for attacking AI
override string GetHitComponentForAI()
{
return GetDayZPlayerType().GetHitComponentForAI();
}
//! returns default hit component (fallback)
override string GetDefaultHitComponent()
{
return GetDayZPlayerType().GetDefaultHitComponent();
}
override vector GetDefaultHitPosition()
{
return m_DefaultHitPosition;
}
//! returns list of suitable finisher hit components (defined on base entity/entity type)
override array<string> GetSuitableFinisherHitComponents()
{
return GetDayZPlayerType().GetSuitableFinisherHitComponents();
}
protected vector SetDefaultHitPosition(string pSelection)
{
return GetSelectionPositionMS(pSelection);
}
//--------------------------------------------------------------------------
//!DEPRECATED!
void AddPossibleCoverFaceForShave()
{
m_FaceCoveredForShaveLayers++;
}
//!DEPRECATED!
void RemovePossibleCoverFaceForShave()
{
m_FaceCoveredForShaveLayers--;
}
//--------------------------------------------------------------------------
override void EEItemAttached(EntityAI item, string slot_name)
{
super.EEItemAttached(item, slot_name);
ItemBase itemIB = ItemBase.Cast(item);
SwitchItemSelectionTexture(item, slot_name);
Param1<PlayerBase> p = new Param1<PlayerBase>(this);
item.SwitchItemSelectionTextureEx(EItemManipulationContext.ATTACHING, p);
m_QuickBarBase.updateSlotsCount();
CalculateVisibilityForAI();
UpdateShoulderProxyVisibility(item, slot_name);
HideHairSelections(itemIB,true);
GetGame().GetAnalyticsClient().OnItemAttachedAtPlayer(item, slot_name);
Clothing clothing = Clothing.Cast(item);
if (clothing)
{
if (!GetGame().IsDedicatedServer())
{
if (clothing.GetEffectWidgetTypes())
{
QueueAddEffectWidget(clothing.GetEffectWidgetTypes());
}
if (clothing.GetGlassesEffectID() > -1)
{
QueueAddGlassesEffect(clothing.GetGlassesEffectID());
}
GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 200, false);//sometimes it takes a while to load in
UpdateCorpseStateVisual();//....but if possible, we don't want a delay
}
else if (GetGame().IsServer())
{
if (clothing.IsGasMask())
{
GetModifiersManager().ActivateModifier(eModifiers.MDF_MASK);
}
}
clothing.UpdateNVGStatus(this,true);
}
AdjustBandana(item,slot_name);
}
override void EEItemDetached(EntityAI item, string slot_name)
{
super.EEItemDetached(item, slot_name);
ItemBase item_base = ItemBase.Cast(item);
SwitchItemSelectionTexture(item, slot_name);
item.SwitchItemSelectionTextureEx(EItemManipulationContext.DETACHING);
m_QuickBarBase.updateSlotsCount();
CalculateVisibilityForAI();
HideHairSelections(item_base,false);
Clothing clothing = Clothing.Cast(item);
if (clothing)
{
if (!GetGame().IsDedicatedServer())
{
if (clothing.GetEffectWidgetTypes())
{
QueueRemoveEffectWidget(clothing.GetEffectWidgetTypes());
}
if (clothing.GetGlassesEffectID() > -1)
{
QueueRemoveGlassesEffect(clothing.GetGlassesEffectID());
}
}
if (GetGame().IsServer())
{
if (clothing.IsGasMask())
{
GetModifiersManager().DeactivateModifier(eModifiers.MDF_MASK);
}
}
clothing.UpdateNVGStatus(this);
GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 200, false);//sometimes it takes a while to load in
UpdateCorpseStateVisual();//....but if possible, we don't want a delay
}
}
void SwitchItemTypeAttach(EntityAI item, string slot)
{
//Print("SwitchItemTypeAttach: " + item.GetType());
if (!GetGame().IsServer())
return;
/*InventoryLocation invloc = new InventoryLocation;
item.GetInventory().GetCurrentInventoryLocation(invloc);
//Print(invloc.DumpToString());
if (item.ConfigIsExisting("ChangeIntoOnAttach") && invloc.GetType() != InventoryLocationType.UNKNOWN)
{
string str = item.ChangeIntoOnAttach(slot);
if (str != "")
{
string typestr = item.GetType();
MiscGameplayFunctions.TurnItemIntoItem(ItemBase.Cast(item), str, this);
}
}*/
}
void SwitchItemTypeDetach(EntityAI item, string slot)
{
//Print("SwitchItemTypeDetach: " + item.GetType());
}
void UpdateShoulderProxyVisibility(EntityAI item, string slot_name)
{
string slot = slot_name;
bool boo;
boo = item.IsWeapon();
if (slot == "Melee")
{
SetSimpleHiddenSelectionState(SIMPLE_SELECTION_MELEE_RIFLE,boo);
SetSimpleHiddenSelectionState(SIMPLE_SELECTION_MELEE_MELEE,!boo);
}
else if (slot == "Shoulder")
{
SetSimpleHiddenSelectionState(SIMPLE_SELECTION_SHOULDER_RIFLE,boo);
SetSimpleHiddenSelectionState(SIMPLE_SELECTION_SHOULDER_MELEE,!boo);
}
}
override void SwitchItemSelectionTexture(EntityAI item, string slot_name)
{
super.SwitchItemSelectionTexture(item,slot_name);
//shirt + armband
EntityAI armband = FindAttachmentBySlotName("Armband");
if (slot_name == "Body" && armband)
{
Param1<PlayerBase> p = new Param1<PlayerBase>(this);
armband.SwitchItemSelectionTextureEx(EItemManipulationContext.UPDATE,p);
}
}
void RemoveAllItems()
{
array<EntityAI> itemsArray = new array<EntityAI>;
ItemBase item;
GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER, itemsArray);
for (int i = 0; i < itemsArray.Count(); i++)
{
Class.CastTo(item, itemsArray.Get(i));
if (item && !item.IsInherited(SurvivorBase)) GetInventory().LocalDestroyEntity(item);
}
}
bool GetHitPPEEnabled()
{
return m_CanDisplayHitEffectPPE;
}
void SetHitPPEEnabled(bool enabled)
{
m_CanDisplayHitEffectPPE = enabled;
}
bool IsMale()
{
if (ConfigGetBool("woman") != 1)
{
return true;
}
return false;
}
int GetVoiceType()
{
int voice_type = ConfigGetInt("voiceType");
if (voice_type == 0)
{
voice_type = 1;
}
return voice_type;
}
PlayerSoundManagerServer GetPlayerSoundManagerServer()
{
return m_PlayerSoundManagerServer;
}
UndergroundHandlerClient GetUndergroundHandler()
{
if (!m_UndergroundHandler && IsAlive())
{
m_UndergroundHandler = new UndergroundHandlerClient(this);
}
return m_UndergroundHandler;
}
void KillUndergroundHandler()
{
m_UndergroundHandler = null;
}
// --------------------------------------------------
// User Actions
//---------------------------------------------------
void SetActions(out TInputActionMap InputActionMap)
{
AddAction(ActionOpenDoors, InputActionMap);
AddAction(ActionCloseDoors, InputActionMap);
AddAction(ActionLockedDoors, InputActionMap);
AddAction(ActionEnterLadder, InputActionMap);
AddAction(ActionExitLadder, InputActionMap);
//-----------CheckIfCanMOveToTarget----------
AddAction(ActionStartEngine, InputActionMap);
AddAction(ActionStopEngine, InputActionMap);
AddAction(ActionSwitchSeats, InputActionMap);
AddAction(ActionOpenCarDoors,InputActionMap);
AddAction(ActionCloseCarDoors,InputActionMap);
AddAction(ActionUncoverHeadSelf, InputActionMap);
AddAction(ActionDrinkPondContinuous, InputActionMap);
AddAction(ActionIgniteFireplaceByAir, InputActionMap);
AddAction(ActionMineBushByHand, InputActionMap);
AddAction(ActionUngagSelf, InputActionMap);
AddAction(ActionWashHandsWater, InputActionMap);
AddAction(ActionGetOutTransport, InputActionMap);
AddAction(ActionUnrestrainTargetHands, InputActionMap);
AddAction(ActionTakeArrow, InputActionMap);
AddAction(ActionTakeArrowToHands, InputActionMap);
}
void SetActions() // Backwards compatibility, not recommended to use
{
}
void SetActionsRemoteTarget(out TInputActionMap InputActionMap)
{
AddAction(ActionCPR, InputActionMap);
AddAction(ActionUncoverHeadTarget, InputActionMap);
AddAction(ActionUngagTarget, InputActionMap);
AddAction(ActionPullBodyFromTransport, InputActionMap);
AddAction(ActionCheckPulseTarget, InputActionMap);
}
void SetActionsRemoteTarget() // Backwards compatibility, not recommended to use
{
}
void InitializeActions()
{
// Backwards compatibility
if (IsControlledPlayer())
{
m_InputActionMap = new TInputActionMap;
SetActions();
}
else
{
m_InputActionMap = new TInputActionMap;
SetActionsRemoteTarget();
}
//////////////////////////
m_InputActionMapControled = new TInputActionMap;
SetActions(m_InputActionMapControled);
m_InputActionMapAsTarget = new TInputActionMap;
SetActionsRemoteTarget(m_InputActionMapAsTarget);
}
override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
{
if (!m_ActionsInitialize)
{
m_ActionsInitialize = true;
InitializeActions();
}
// Backwards compatibility
array<ActionBase_Basic> bcActions = m_InputActionMap.Get(action_input_type);
if (!bcActions)
{
if (IsControlledPlayer())
actions = m_InputActionMapControled.Get(action_input_type);
else
actions = m_InputActionMapAsTarget.Get(action_input_type);
}
else
{
if (!actions)
actions = new array<ActionBase_Basic>();
if (IsControlledPlayer())
actions.InsertAll(m_InputActionMapControled.Get(action_input_type));
else
actions.InsertAll(m_InputActionMapAsTarget.Get(action_input_type));
actions.InsertAll(bcActions);
}
}
void AddAction(typename actionName, out TInputActionMap InputActionMap)
{
ActionBase action = GetActionManager().GetAction(actionName);
typename ai = action.GetInputType();
if (!ai)
{
m_ActionsInitialize = false;
return;
}
ref array<ActionBase_Basic> action_array = InputActionMap.Get(ai);
if (!action_array)
{
action_array = new array<ActionBase_Basic>;
InputActionMap.Insert(ai, action_array);
}
action_array.Insert(action);
}
void AddAction(typename actionName) // Backwards compatibility, not recommended to use
{
AddAction(actionName, m_InputActionMap);
}
void RemoveAction(typename actionName, out TInputActionMap InputActionMap)
{
ActionBase action = GetActionManager().GetAction(actionName);
typename ai = action.GetInputType();
ref array<ActionBase_Basic> action_array = InputActionMap.Get(ai);
if (action_array)
{
for (int i = 0; i < action_array.Count(); i++)
{
if (action == action_array.Get(i))
{
action_array.Remove(i);
}
}
action_array = new array<ActionBase_Basic>;
InputActionMap.Insert(ai, action_array);
}
action_array.Insert(action);
}
void RemoveAction(typename actionName) // Backwards compatibility, not recommended to use
{
RemoveAction(actionName, m_InputActionMap);
}
int GetCurrentRecipe()
{
return m_RecipePick;
}
void SetNextRecipe()
{
m_RecipePick++;
}
void SetFirstRecipe()
{
m_RecipePick = 0;
}
//---------------------------------------------------
ActionManagerBase GetActionManager()
{
return m_ActionManager;
}
EmoteManager GetEmoteManager()
{
return m_EmoteManager;
}
RandomGeneratorSyncManager GetRandomGeneratorSyncManager()
{
return m_RGSManager;
}
//!called every command handler tick when player is on ladder
override void OnLadder(float delta_time, HumanMovementState pState)
{
ProcessHandDamage(delta_time, pState);
}
void ProcessHandDamage(float delta_time, HumanMovementState pState)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
{
if (pState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SLIDE)
{
//Print("sliding down");
EntityAI gloves = GetInventory().FindAttachment(InventorySlots.GLOVES);
if (gloves && gloves.GetHealthLevel() < 4)
{
gloves.AddHealth("","", PlayerConstants.GLOVES_DAMAGE_SLIDING_LADDER_PER_SEC * delta_time);
return;
}
if (Math.RandomFloat01() < PlayerConstants.CHANCE_TO_BLEED_SLIDING_LADDER_PER_SEC * delta_time)
{
if (Math.RandomFloat01() < 0.5)
{
if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("LeftForeArmRoll"))
{
SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
}
}
else
{
if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("RightForeArmRoll"))
{
SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
}
}
}
}
}
}
override void ProcessFeetDamageServer(int pUserInt)
{
//InventorySlots.HEADGEAR
EntityAI shoes = GetInventory().FindAttachment(InventorySlots.FEET);
string surface; int liquid;
GetGame().SurfaceUnderObject(this, surface, liquid);
float modifier_surface = Surface.GetParamFloat(surface, "footDamage");
if (shoes && shoes.GetHealthLevel() < 4)
{
shoes.AddHealth("", "", -1 * modifier_surface * PlayerConstants.SHOES_MOVEMENT_DAMAGE_PER_STEP * (float)PlayerConstants.CHECK_EVERY_N_STEP);
return;
}
float rnd = Math.RandomFloat01();
float modifier_movement = GetFeetDamageMoveModifier();
float chance = modifier_movement * modifier_surface * PlayerConstants.BAREFOOT_MOVEMENT_BLEED_MODIFIER * (float)PlayerConstants.CHECK_EVERY_N_STEP;
if (rnd < chance)
{
if (pUserInt % 2 == 0)
{
if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("RightFoot"))
SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
}
else
{
if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("LeftFoot"))
SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
}
}
}
float GetFeetDamageMoveModifier()
{
float modifier;
switch(m_MovementState.m_iMovement)
{
case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
modifier = 1;
break
case DayZPlayerConstants.MOVEMENTIDX_RUN:
modifier = 0.5;
break
case DayZPlayerConstants.MOVEMENTIDX_WALK:
modifier = 0;
break
}
return modifier;
}
void SetStamina(int value, int range)
{
if (m_ModulePlayerStatus)
m_ModulePlayerStatus.SetStamina(value, range);
}
#ifdef DIAG_DEVELOPER
void SetStaminaDisabled(bool value)
{
if (m_StaminaHandler)
m_StaminaHandler.SetStaminaDisabled(value);
}
#endif
void SetQuickRestrain(bool enable)
{
m_AllowQuickRestrain = enable;
}
void SetQuickFishing(bool enable)
{
m_AllowQuickFishing = enable;
}
bool IsQuickRestrain()
{
return m_AllowQuickRestrain;
}
bool IsQuickFishing()
{
return m_AllowQuickFishing;
}
PlayerStats GetPlayerStats()
{
return m_PlayerStats;
}
CraftingManager GetCraftingManager()
{
return m_CraftingManager;
}
StaminaHandler GetStaminaHandler()
{
return m_StaminaHandler;
}
override WeaponManager GetWeaponManager()
{
return m_WeaponManager;
}
override ArrowManagerBase GetArrowManager()
{
return m_ArrowManager;
}
bool CanBeRestrained()
{
if (IsInVehicle() || IsRaised() || IsSwimming() || IsClimbing() || IsClimbingLadder() || IsRestrained() || !GetWeaponManager() || GetWeaponManager().IsRunning() || !GetActionManager() || GetActionManager().GetRunningAction() != null || IsMapOpen())
{
return false;
}
if (GetThrowing() && GetThrowing().IsThrowingModeEnabled())
{
return false;
}
return true;
}
void SetRestrainStarted(bool restrain_started)
{
m_IsRestrainStarted = restrain_started;
SetSynchDirty();
}
bool IsRestrainStarted()
{
return m_IsRestrainStarted;
}
void SetRestrainPrelocked(bool restrain_prelock)
{
m_IsRestrainPrelocked = restrain_prelock;
SetSynchDirty();
}
bool IsRestrainPrelocked()
{
return m_IsRestrainPrelocked;
}
void SetRestrained(bool is_restrained)
{
m_IsRestrained = is_restrained;
SetSynchDirty();
}
override bool IsRestrained()
{
return m_IsRestrained;
}
override bool IsInventoryVisible()
{
return true;
}
bool CanManipulateInventory()
{
if (IsControlledPlayer())
{
return !IsRestrained() && !IsRestrainPrelocked();
}
return true;
}
override bool CanReleaseAttachment (EntityAI attachment)
{
return super.CanReleaseAttachment(attachment);
}
override bool CanReleaseCargo (EntityAI cargo)
{
return super.CanReleaseCargo(cargo);
}
override bool CanReceiveItemIntoCargo(EntityAI item)
{
return super.CanReceiveItemIntoCargo(item);
}
override bool CanSwapItemInCargo (EntityAI child_entity, EntityAI new_entity)
{
return super.CanSwapItemInCargo(child_entity, new_entity);
}
override bool CanReceiveItemIntoHands(EntityAI item_to_hands)
{
if (IsInVehicle())
return false;
if (!CanPickupHeavyItem(item_to_hands))
return false;
return super.CanReceiveItemIntoHands(item_to_hands);
}
override bool CanSaveItemInHands(EntityAI item_in_hands)
{
return super.CanSaveItemInHands(item_in_hands);
}
override bool CanReleaseFromHands(EntityAI handheld)
{
return super.CanReleaseFromHands(handheld);
}
int GetCraftingRecipeID()
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
return GetCraftingManager().GetRecipeID();
}
else
{
return m_RecipeID;
}
}
void SetCraftingRecipeID(int recipeID)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
GetCraftingManager().SetRecipeID(recipeID);
}
else
{
m_RecipeID = recipeID;
}
}
// --------------------------------------------------
// Action data for base building actions
//---------------------------------------------------
ConstructionActionData GetConstructionActionData()
{
return m_ConstructionActionData;
}
void ResetConstructionActionData()
{
if (m_ConstructionActionData)
{
m_ConstructionActionData.ResetActionIndexes();
}
}
// --------------------------------------------------
// Action data for fireplace (indoor)
//---------------------------------------------------
vector GetLastFirePoint()
{
return m_LastFirePoint;
}
float GetLastFirePointRot()
{
return m_LastFirePointRot;
}
int GetLastFirePointIndex()
{
return m_LastFirePointIndex;
}
void SetLastFirePoint(vector last_fire_point)
{
m_LastFirePoint = last_fire_point;
}
void SetLastFirePointRot(float last_fire_point_rot)
{
m_LastFirePointRot = last_fire_point_rot;
}
void SetLastFirePointIndex(int last_fire_point_index)
{
m_LastFirePointIndex = last_fire_point_index;
}
// --------------------------------------------------
// QuickBar
//---------------------------------------------------
void RemoveQuickBarEntityShortcut(EntityAI entity)
{
int index = m_QuickBarBase.FindEntityIndex(entity);
if (index != -1)
m_QuickBarBase.SetEntityShortcut(entity,-1);
}
//---------------------------------------------------
void SetEnableQuickBarEntityShortcut(EntityAI entity, bool value)
{
int index = m_QuickBarBase.FindEntityIndex(entity);
if (index != -1)
m_QuickBarBase.SetShotcutEnable(index,value);
}
//---------------------------------------------------
int FindQuickBarEntityIndex(EntityAI entity)
{
int index;
index = m_QuickBarBase.FindEntityIndex(entity);
if (m_QuickBarBase.GetEntity(index) == NULL)
return -1;
return index;
}
//---------------------------------------------------
int GetQuickBarSize()
{
return m_QuickBarBase.GetSize();
}
//---------------------------------------------------
EntityAI GetQuickBarEntity(int index)
{
return m_QuickBarBase.GetEntity(index);
}
//---------------------------------------------------
void UpdateQuickBarEntityVisibility(EntityAI entity)
{
int i = FindQuickBarEntityIndex(entity);
if (i >= 0)
m_QuickBarBase.UpdateShotcutVisibility(i);
}
//---------------------------------------------------
void SetQuickBarEntityShortcut(EntityAI entity, int index, bool force = false)
{
m_QuickBarBase.SetEntityShortcut(entity, index, force);
}
//---------------------------------------------------
void OnQuickbarSetEntityRequest(ParamsReadContext ctx)
{
m_QuickBarBase.OnSetEntityRequest(ctx);
}
//---------------------------------------------------
// Applies splint on all limbs.
void ApplySplint()
{
float add_health_coef = 0.33;
// The idea is to slightly increase health of broken limb so the player is still limping. Using more splints will help but each time less. 100% recovery can be achieved only through long term healing.
if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
{
AddHealth("LeftLeg", "Health", (GetMaxHealth("LeftLeg", "Health") - GetHealth("LeftLeg", "Health") ) * add_health_coef );
AddHealth("RightLeg", "Health", (GetMaxHealth("RightLeg", "Health") - GetHealth("RightLeg", "Health")) * add_health_coef );
AddHealth("RightFoot", "Health", (GetMaxHealth("RightFoot", "Health") - GetHealth("RightFoot", "Health")) * add_health_coef );
AddHealth("LeftFoot", "Health", (GetMaxHealth("LeftFoot", "Health") - GetHealth("LeftFoot", "Health")) * add_health_coef );
}
}
void ProcessDrowning(float dT)
{
GetStaminaHandler().DepleteStamina(EStaminaModifiers.DROWN,dT);
#ifndef SERVER
//PP EFFECTS
PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
req.SetStamina01(GetStaminaHandler().GetStaminaNormalized());
#endif
}
void SpawnDrowningBubbles()
{
if (!GetDrowningWaterLevelCheck())
return;
float bubbleFrequency = Math.Lerp(PlayerConstants.DROWNING_BUBBLE_FREQUENCY_MIN, PlayerConstants.DROWNING_BUBBLE_FREQUENCY_MAX, GetStaminaHandler().GetSyncedStaminaNormalized());
int boneIdx = GetBoneIndexByName("Head");
if (boneIdx != -1)
{
Particle p = ParticleManager.GetInstance().PlayInWorld(ParticleList.DROWNING_BUBBLES, "-0.03 0.15 0");
if (p)
AddChild(p, boneIdx);
GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SpawnDrowningBubbles, bubbleFrequency);
}
}
void ProcessHoldBreath(float dT)
{
if (IsTryingHoldBreath() && CanStartConsumingStamina(EStaminaConsumers.HOLD_BREATH))
{
if (!m_IsHoldingBreath)
{
OnHoldBreathStart();
m_IsHoldingBreath = true;
}
}
else if (!IsTryingHoldBreath() || !CanConsumeStamina(EStaminaConsumers.HOLD_BREATH))
{
if (m_IsHoldingBreath) OnHoldBreathEnd();
m_IsHoldingBreath = false;
}
}
void OnHoldBreathStart()
{
//SendSoundEvent(SoundSetMap.GetSoundSetID("holdBreath_male_Char_SoundSet"));
RequestSoundEventEx(EPlayerSoundEventID.HOLD_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
}
void OnHoldBreathExhausted()
{
RequestSoundEventEx(EPlayerSoundEventID.EXHAUSTED_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
}
void OnHoldBreathEnd()
{
//SendSoundEvent(SoundSetMap.GetSoundSetID("releaseBreath_male_Char_SoundSet"));
RequestSoundEventEx(EPlayerSoundEventID.RELEASE_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
}
override bool IsHoldingBreath()
{
return m_IsHoldingBreath;
}
override bool IsRefresherSignalingViable()
{
return false;
}
eMixedSoundStates GetMixedSoundStates()
{
return m_MixedSoundStates;
}
AbstractWave SaySoundSet(string name)
{
if (m_SaySoundLastSetName != name)
{
m_SaySoundParams = new SoundParams(name);
m_SaySoundBuilder = new SoundObjectBuilder(m_SaySoundParams);
m_SaySoundLastSetName = name;
}
m_SaySoundObject = m_SaySoundBuilder.BuildSoundObject();
m_SaySoundObject.SetPosition(GetPosition());
return GetGame().GetSoundScene().Play3D(m_SaySoundObject, m_SaySoundBuilder);
}
EntityAI FindCargoByBaseType(string searched_item)
{
EntityAI attachment;
string item_name;
int attcount = this.GetInventory().AttachmentCount();
for (int att = 0; att < attcount; att++)
{
attachment = GetInventory().GetAttachmentFromIndex(att);
if (attachment.IsItemBase())
{
item_name = attachment.GetType();
if (GetGame().IsKindOf(item_name, searched_item))
{
return attachment;
}
}
}
return NULL;
}
void InitEditor()
{
if (GetGame().IsDebug())
{
if (!GetGame().IsMultiplayer() && GetGame().GetPlayer() && GetGame().GetPlayer().GetID() == this.GetID())
{
PluginSceneManager scene_editor = PluginSceneManager.Cast(GetPlugin(PluginSceneManager));
scene_editor.InitLoad();
}
}
}
//---------------------------------------------------------------------------------------------------------------------------
void OnPlayerLoaded()
{
InitEditor();
if (GetGame().IsMultiplayer() || GetGame().IsServer())
{
if (m_ModuleLifespan)
{
m_ModuleLifespan.SynchLifespanVisual(this, m_LifeSpanState, m_HasBloodyHandsVisible, m_HasBloodTypeVisible, m_BloodType);
}
}
if (IsControlledPlayer())//true only on client for the controlled character
{
if (!m_VirtualHud)
m_VirtualHud = new VirtualHud(this);
if (m_Hud)
{
m_Hud.UpdateBloodName();
PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Stop();
PPERequesterBank.GetRequester(PPERequester_ShockHitReaction).Stop();
PPERequesterBank.GetRequester(PPERequester_UnconEffects).Stop(); //TODO - stop en mass...check if effects do not terminate (spawning inside of contaminated area)?!
GetGame().GetUIManager().CloseAll();
GetGame().GetMission().SetPlayerRespawning(false);
GetGame().GetMission().OnPlayerRespawned(this);
m_Hud.ShowHudUI(true);
m_Hud.ShowQuickbarUI(true);
m_Hud.UpdateQuickbarGlobalVisibility();
}
m_EffectWidgets = GetGame().GetMission().GetEffectWidgets();
}
if (!GetGame().IsDedicatedServer())
{
GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 2000, false);//sometimes it takes a while to load in
m_PlayerSoundEventHandler = new PlayerSoundEventHandler(this);
}
int slot_id = InventorySlots.GetSlotIdFromString("Head");
m_CharactersHead = Head_Default.Cast(GetInventory().FindPlaceholderForSlot(slot_id));
CheckHairClippingOnCharacterLoad();
UpdateHairSelectionVisibility();
PreloadDecayTexture();
Weapon_Base wpn = Weapon_Base.Cast(GetItemInHands());
if (wpn)
wpn.ValidateAndRepair();
/*
PreloadDecayTexture();
UpdateCorpseStateVisual();
*/
m_PlayerLoaded = true;
//Print("PlayerBase | OnPlayerLoaded()");
}
void SetPlayerDisconnected(bool state)
{
m_PlayerDisconnectProcessed = state;
}
bool IsPlayerDisconnected()
{
return m_PlayerDisconnectProcessed;
}
// --------------------------------------------------
// Advanced placement
//---------------------------------------------------
//get hologram
Hologram GetHologramServer()
{
return m_HologramServer;
}
Hologram GetHologramLocal()
{
return m_HologramLocal;
}
void PlacingStartServer(ItemBase item)
{
if (item)
{
m_HologramServer = new Hologram(this, GetLocalProjectionPosition(), item);
GetHologramServer().SetProjectionPosition(GetLocalProjectionPosition());
GetHologramServer().SetProjectionOrientation(GetLocalProjectionOrientation());
GetHologramServer().GetProjectionEntity().OnPlacementStarted(this);
GetHologramServer().CheckPowerSource();
GetHologramServer().RefreshVisual();
}
}
void PlacingStartLocal(ItemBase item)
{
if (GetGame().IsMultiplayer() && GetGame().IsServer())
return;
if (item)
{
m_HologramLocal = new Hologram(this, GetLocalProjectionPosition(), item);
GetHologramLocal().GetProjectionEntity().OnPlacementStarted(this);
}
}
void PlacingCancelServer()
{
EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
if (IsPlacingServer())
{
GetHologramServer().CheckPowerSource();
GetHologramServer().GetParentEntity().OnPlacementCancelled(this);
SetLocalProjectionPosition(vector.Zero);
delete m_HologramServer;
return;
}
else if (entityInHands && entityInHands.HasEnergyManager())
{
if (entityInHands.GetCompEM().IsPlugged())
entityInHands.OnPlacementCancelled(this);
}
}
//Called when item placement is canceled, will prevent quickbar usage until the item the player was placing is back in hands
void LockHandsUntilItemHeld()
{
m_AreHandsLocked = true;
}
void PlacingCancelLocal()
{
EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
if (entityInHands && entityInHands.HasEnergyManager())
{
if (entityInHands.GetCompEM().IsPlugged())
entityInHands.OnPlacementCancelled(this);
}
SetLocalProjectionPosition(vector.Zero);
delete m_HologramLocal;
}
void PlacingCompleteServer()
{
SetLocalProjectionPosition(vector.Zero);
delete m_HologramServer;
}
void PlacingCompleteLocal()
{
SetLocalProjectionPosition(vector.Zero);
delete m_HologramLocal;
}
bool IsPlacingServer()
{
if (m_HologramServer)
return true;
return false;
}
bool IsPlacingLocal()
{
if (m_HologramLocal)
return true;
return false;
}
void SetDrowning(bool enable)
{
if (enable != m_IsDrowning)
{
if (enable)
OnDrowningStart();
else
OnDrowningEnd();
}
m_IsDrowning = enable;
}
void OnDrowningStart()
{
#ifndef SERVER
if (IsControlledPlayer())
{
PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
req.Start();
}
//Particles
SpawnDrowningBubbles();
#endif
}
void OnDrowningEnd()
{
#ifndef SERVER
if (IsControlledPlayer())
{
PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
req.Stop();
}
GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(SpawnDrowningBubbles);
#endif
}
bool TogglePlacingServer(int userDataType, ParamsReadContext ctx)
{
if (userDataType == INPUT_UDT_ADVANCED_PLACEMENT)
{
PlacingCancelServer();
return true;
}
return false;
}
void RequestResetADSSync()
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT && GetGame().IsMultiplayer())
{
if (ScriptInputUserData.CanStoreInputUserData())
{
ScriptInputUserData ctx = new ScriptInputUserData;
ctx.Write(INPUT_UDT_RESET_ADS);
ctx.Send();
}
}
else if (!GetGame().IsMultiplayer())
{
m_ResetADS = true;
}
}
//! server only
bool ResetADSPlayerSync(int userDataType, ParamsReadContext ctx)
{
if (userDataType == INPUT_UDT_RESET_ADS)
{
ScriptJunctureData pCtx = new ScriptJunctureData;
SendSyncJuncture(DayZPlayerSyncJunctures.SJ_ADS_RESET,pCtx);
return true;
}
return false;
}
override bool CanPlaceItem(EntityAI item)
{
if (m_UndergroundPresence > EUndergroundPresence.NONE)
{
TStringSet disallowedUndergroundTypes = CfgGameplayHandler.GetDisallowedTypesInUnderground();
foreach (string t: disallowedUndergroundTypes)
{
if (item.IsKindOf(t))
return false;
}
}
return true;
}
void SetUnderground(EUndergroundPresence presence)
{
m_UndergroundPresence = presence;
}
void TogglePlacingLocal(ItemBase item = null)
{
if (IsPlacingLocal())
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT && GetGame().IsMultiplayer())
{
if (ScriptInputUserData.CanStoreInputUserData())
{
ScriptInputUserData ctx = new ScriptInputUserData;
ctx.Write(INPUT_UDT_ADVANCED_PLACEMENT);
ctx.Send();
}
}
PlacingCancelLocal();
}
else if (!item)
{
PlacingStartLocal(GetItemInHands());
}
else
{
PlacingStartLocal(item);
}
}
void SetLocalProjectionPosition(vector local_position)
{
m_LocalProjectionPosition = local_position;
}
void SetLocalProjectionOrientation(vector local_orientation)
{
m_LocalProjectionOrientation = local_orientation;
}
vector GetLocalProjectionPosition()
{
return m_LocalProjectionPosition;
}
vector GetLocalProjectionOrientation()
{
return m_LocalProjectionOrientation;
}
//! DEPRECATED
void AddToEnvironmentTemperature(float pTemperature) {};
// ------------------------------------------------------------------------
//! water contact (driven by Environment)
void SetInWater(bool pState)
{
m_IsInWater = pState;
SetSynchDirty();
}
bool IsInWater()
{
return m_IsInWater;
}
// -------------------------------------------------------------------------
void ~PlayerBase()
{
if (GetGame() && (!GetGame().IsDedicatedServer()))
{
ClientData.RemovePlayerBase(this);
SetContaminatedEffectEx(false);
}
SEffectManager.DestroyEffect(m_FliesEff);
StopSoundSet(m_SoundFliesEffect);
}
void OnCameraChanged(DayZPlayerCameraBase new_camera)
{
m_CameraSwayModifier = new_camera.GetWeaponSwayModifier();
m_CurrentCamera = new_camera;
}
DayZPlayerCamera GetCurrentPlayerCamera()
{
return m_CurrentCamera;
}
bool IsCurrentCameraAimedAtGround()
{
if (!m_CurrentCamera)
return false;
return m_CurrentCamera.GetCurrentPitch() < PlayerConstants.CAMERA_THRESHOLD_PITCH;
}
BleedingSourcesManagerServer GetBleedingManagerServer()
{
return m_BleedingManagerServer;
}
BleedingSourcesManagerRemote GetBleedingManagerRemote()
{
return m_BleedingManagerRemote;
}
SymptomManager GetSymptomManager()
{
return m_SymptomManager;
}
VirtualHud GetVirtualHud()
{
if (!m_VirtualHud)
{
m_VirtualHud = new VirtualHud(this);
}
return m_VirtualHud;
}
TransferValues GetTransferValues()
{
return m_TrasferValues;
}
DebugMonitorValues GetDebugMonitorValues()
{
return m_DebugMonitorValues;
}
// -------------------------------------------------------------------------
/*bool IsCraftingSetUp()
{
return m_IsCraftingReady;
}*/
// -------------------------------------------------------------------------
/*void PerformRecipe()
{*/
/*
Debug.Log("Ingredient1: "+ToString(m_Item1.Ptr().GetType()),"recipes");
Debug.Log("Ingredient2: "+ToString(m_Item2.Ptr().GetType()),"recipes");
*/
/*int id = GetCraftingMeta().GetRecipeID();
ItemBase item1 = GetCraftingMeta().GetIngredient1();
ItemBase item2 = GetCraftingMeta().GetIngredient2();
Debug.Log("PerformRecipe called on player: "+ string.ToString(this),"recipes");
if (m_ModuleRecipesManager)
{
if (!item1 || !item2)
{
Debug.Log("PerformRecipe: At least one of the object links is now null, not performing the recipe","recipes");
}
else
{
m_ModuleRecipesManager.PerformRecipeServer(id, item1,item2,this);
}
RequestCraftingDisable();
}
}*/
// -------------------------------------------------------------------------
/*float GetCraftingSetUpDistance()
{
return Math.AbsFloat(vector.Distance(GetCraftingMeta().GetInitPos(), GetPosition()));
}*/
// -------------------------------------------------------------------------
/*void RequestCraftingSetup(int id, EntityAI item1, EntityAI item2, int craft_type)
{
if (!GetGame().IsDedicatedServer())
{
SetUpCraftingClient(id,item1,item2,craft_type);
SendCraftingMeta();
}
}*/
/*void RequestCraftingDisable()
{
if (GetGame().IsServer())
{
SendDisableRequestToClient();
DisableCrafting();
}
}*/
/*private void SendDisableRequestToClient()
{
GetGame().RPCSingleParam(this, ERPCs.RPC_CRAFTING_DISABLE, NULL,this);
}*/
/*private void OnReceiveDisableRequest()
{
DisableCrafting();
}*/
/*private void SendCraftingMeta()
{
array<ref Param> params = new array<ref Param>;
CraftingMeta cm = GetCraftingMeta();
cm.SerializeValues(params);
GetGame().RPC(this, ERPCs.RPC_CRAFTING_SETUP, params,this);
}*/
/*private void OnReceiveCraftingMeta(ParamsReadContext ctx)
{
CreateCraftingMeta(0,NULL,NULL,"0 0 0", 0,0);
GetCraftingMeta().DeserializeValuesCtx(ctx);
SetUpCraftingServer();
}*/
// -------------------------------------------------------------------------
/*private void SetUpCraftingServer()
{
if (GetGame().IsMultiplayer() && GetGame().IsServer())
{
m_IsCraftingReady = true;
m_ModuleRecipesManager.OnCraftingSetUpServer(GetCraftingMeta(), this);
}
}*/
/*private void SetUpCraftingClient(int id, EntityAI item1, EntityAI item2, int craft_type)
{
if (!GetGame().IsDedicatedServer())
{
m_IsCraftingReady = true;
float specialty_weight = m_ModuleRecipesManager.GetRecipeSpecialty(id);
float length = m_ModuleRecipesManager.GetRecipeLengthInSecs(id);
CreateCraftingMeta(id, item1, item2, GetPosition(), length, specialty_weight);
m_ModuleRecipesManager.OnCraftingSetUpClient(GetCraftingMeta(), this);
Debug.Log("SetUpCrafting2 called for id: "+ id.ToString()+ " on player: "+ this.ToString(),"recipes");
if (craft_type != AT_WORLD_CRAFT)
{
ActionManagerClient mngr = GetActionManager();
mngr.DisableActions();
ActionTarget actionTarget;
if (item2 == GetItemInHands())
{
actionTarget = new ActionTarget(item1, -1, vector.Zero, -1);
mngr.InjectContinuousAction(craft_type,actionTarget,item2);
}
else
{
actionTarget = new ActionTarget(item2, -1, vector.Zero, -1);
mngr.InjectContinuousAction(craft_type,actionTarget,item1);
}
}
}
}*/
// -------------------------------------------------------------------------
/*void DisableCrafting()
{
m_IsCraftingReady = false;
if (!GetGame().IsDedicatedServer())
{
ActionManagerClient mngr = GetActionManager();
if (mngr)
{
mngr.EnableActions();
GetCraftingMeta() = NULL;
}
}
}*/
//--------------------------------------------------------------------------
void OnScheduledTick(float deltaTime)
{
if (!IsPlayerSelected() || !IsAlive())
return;
if (m_ModifiersManager)
m_ModifiersManager.OnScheduledTick(deltaTime);
if (m_NotifiersManager)
m_NotifiersManager.OnScheduledTick();
if (m_TrasferValues)
m_TrasferValues.OnScheduledTick(deltaTime);
if (m_VirtualHud)
m_VirtualHud.OnScheduledTick();
if (GetBleedingManagerServer())
GetBleedingManagerServer().OnTick(deltaTime);
if (m_Environment)
m_Environment.Update(deltaTime);
// Check if electric device needs to be unplugged
ItemBase heldItem = GetItemInHands();
if (heldItem && heldItem.HasEnergyManager() && heldItem.GetCompEM().IsPlugged())
{
// Now we know we are working with an electric device which is plugged into a power source.
EntityAI placed_entity = heldItem;
// Unplug the device when the player is too far from the power source.
placed_entity.GetCompEM().UpdatePlugState();
}
}
void OnCommandHandlerTick(float delta_time, int pCurrentCommandID)
{
if (!IsAlive())
{
if (!m_DeathSyncSent && m_KillerData)
{
SyncEvents.SendEntityKilled(this, m_KillerData.m_Killer, m_KillerData.m_MurderWeapon, m_KillerData.m_KillerHiTheBrain);
//Print("Sending Death Sync, yay! Headshot by killer = " + m_KillerData.m_KillerHiTheBrain);
//Print("And was he killed by headshot in general? = " + m_KilledByHeadshot);
m_DeathSyncSent = true;
}
return;
}
if (m_DebugMonitorValues)
m_DebugMonitorValues.OnScheduledTick(delta_time);
if (GetSymptomManager())
GetSymptomManager().OnTick(delta_time, pCurrentCommandID, m_MovementState);//needs to stay in command handler tick as it's playing animations
//if (GetBleedingManagerServer()) GetBleedingManagerServer().OnTick(delta_time);
DayZPlayerInstanceType instType = GetInstanceType();
if (instType == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
if (m_PlayerSoundEventHandler)
m_PlayerSoundEventHandler.OnTick(delta_time);
if (m_ProcessRemoveEffectWidgets && m_ProcessRemoveEffectWidgets.Count() > 0)
{
m_EffectWidgets.RemoveActiveEffects(m_ProcessRemoveEffectWidgets);
}
if (m_ProcessAddEffectWidgets && m_ProcessAddEffectWidgets.Count() > 0)
{
m_EffectWidgets.AddActiveEffects(m_ProcessAddEffectWidgets);
}
HandleGlassesEffect();
if (m_ContaminatedAreaEffectEnabled)
ContaminatedParticleAdjustment();
#ifdef DIAG_DEVELOPER
if (m_WeaponDebug)
{
m_WeaponDebug.OnCommandHandlerUpdate();
}
#endif
m_ProcessAddEffectWidgets.Clear(); //clears array for remotes as well
m_ProcessRemoveEffectWidgets.Clear(); //clears array for remotes as well
}
m_AnimCommandStarting = HumanMoveCommandID.None;
if (CfgGameplayHandler.GetAllowStaminaAffectInertia())
UpdateMovementInertia();
}
//! Update movement inertia based on stamina available
void UpdateMovementInertia()
{
HumanCommandMove hcm = GetCommand_Move();
if (hcm)
{
float staminaPercentage = GetStaminaHandler().GetSyncedStaminaNormalized();
hcm.SetTurnSpanSprintModifier(2 - staminaPercentage);
hcm.SetRunSprintFilterModifier((2 - staminaPercentage) * 0.5);
hcm.SetDirectionSprintFilterModifier(2 - staminaPercentage);
}
}
bool m_ShowDbgUI = true;
int m_DbgListSelection = 0;
float m_DbgSliderValue = 0.0;
ref array<string> m_DbgOptions = {"jedna", "dva", "tri"};
NotifiersManager GetNotifiersManager()
{
return m_NotifiersManager;
}
//--------------------------------------------------------------------------
void OnTick()
{
float deltaT = (GetGame().GetTime() - m_LastTick) * 0.001;
if (m_LastTick < 0)
deltaT = 0; //first tick protection
m_LastTick = GetGame().GetTime();
OnScheduledTick(deltaT);
}
// -------------------------------------------------------------------------
override void EEItemIntoHands(EntityAI item)
{
super.EEItemIntoHands(item);
if (item)
{
MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(item, {Bolt_Base});
Weapon_Base w;
if (Class.CastTo(w, item))
{
w.ResetWeaponAnimState();
HumanCommandMove cm = GetCommand_Move();
if (cm)
{
cm.SetMeleeBlock(false);
GetMeleeFightLogic().SetBlock(false);
}
}
//! fixes situation where raise is canceling some manipulation with heavy item(ex. TakeItemToHands), forces normal stance
if (item.IsHeavyBehaviour() && IsRaised())
{
HumanCommandMove cm2 = GetCommand_Move();
if (cm2)
{
cm2.ForceStance(DayZPlayerConstants.STANCEIDX_ERECT);
}
}
OnItemInHandsChanged();
}
}
override void EEItemOutOfHands(EntityAI item)
{
super.EEItemOutOfHands(item);
if (IsPlacingLocal())
{
GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(TogglePlacingLocal);
}
OnItemInHandsChanged();
}
PlayerStomach GetStomach()
{
return m_PlayerStomach;
}
override void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
{
EvaluateDamageHit(pCurrentCommandID);
// lower implement
super.CommandHandler(pDt,pCurrentCommandID,pCurrentCommandFinished);
HumanInputController hic = GetInputController();
CheckZeroSoundEvent();
CheckSendSoundEvent();
ProcessADDModifier();
if (m_BrokenLegsJunctureReceived)//was there a change in broken legs state ?
{
m_BrokenLegsJunctureReceived = false;
bool initial = m_BrokenLegState < 0;//negative values indicate initial activation
if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
{
DropHeavyItem();
if (initial)
{
BrokenLegForceProne();
hic.ResetADS();
GetUApi().GetInputByID(UATempRaiseWeapon).Supress();
ExitSights();
}
}
}
GetDayZPlayerInventory().HandleInventory(pDt);
if (IsFireWeaponRaised() || m_IsHoldingBreath)
{
ProcessHoldBreath(pDt);
}
ActionManagerBase mngr = GetActionManager();
if (m_AreHandsLocked && GetHumanInventory().GetEntityInHands())
{
m_AreHandsLocked = false;
}
// freelook camera memory for weapon raycast
if (hic.CameraIsFreeLook() && m_DirectionToCursor == vector.Zero)
{
m_DirectionToCursor = GetGame().GetCurrentCameraDirection();
}
else if (!hic.CameraIsFreeLook() && m_DirectionToCursor != vector.Zero)
{
m_DirectionToCursor = vector.Zero;
}
if (m_WeaponManager)
{
m_WeaponManager.Update(pDt);
}
if (m_EmoteManager && IsPlayerSelected())
{
m_EmoteManager.Update(pDt);
}
if (m_RGSManager)
{
m_RGSManager.Update();
}
if (m_StanceIndicator)
{
m_StanceIndicator.Update();
}
if (m_StaminaHandler)
{
m_StaminaHandler.Update(pDt, pCurrentCommandID);
}
if (m_InjuryHandler)
{
m_InjuryHandler.Update(pDt);
}
if (m_HCAnimHandler)
{
m_HCAnimHandler.Update(pDt, m_MovementState);
}
if (m_ShockHandler)
{
m_ShockHandler.Update(pDt);
}
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
{
GetPlayerSoundManagerServer().Update();
ShockRefill(pDt);
FreezeCheck();
}
GetHumanInventory().Update(pDt);
if (m_IsDrowning)
{
ProcessDrowning(pDt);
}
UpdateDelete();
HandleDamageHit(pCurrentCommandID);
if (mngr && hic)
{
mngr.Update(pCurrentCommandID);
HumanCommandUnconscious hcu = GetCommand_Unconscious();
HumanCommandVehicle hcv = GetCommand_Vehicle();
if (!m_UnconsciousDebug)
{
//! When the player should be and is unconscious
if (m_ShouldBeUnconscious && m_IsUnconscious)
{
if (hcu)
{
//! Player can start floating while unconscious
m_Swimming.m_bWasSwimming |= hcu.IsInWater();
}
if (m_Swimming.m_bWasSwimming)
{
m_LastCommandBeforeUnconscious = DayZPlayerConstants.COMMANDID_SWIM;
}
OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
}
//! When the player will be unconscious, or is being blocked from being unconscious
else if (m_ShouldBeUnconscious)
{
//! If the player is getting in/out or switching seats, delay unconsciousness until after animation has finished
bool isTransitioning = hcv && (hcv.IsGettingIn() || hcv.IsGettingOut() || hcv.IsSwitchSeat());
if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
{
OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
m_IsUnconscious = true;
OnUnconsciousStart();
}
//! Death gate - prevent unlikely occurence of death -> unconsciousness transition
//! Fall gate - prevent unconciousness animation from playing while falling, doesn't look good
//! Transition gate - prevent unconciousness while previous command is transitioning
else if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH && pCurrentCommandID != DayZPlayerConstants.COMMANDID_FALL && !isTransitioning)
{
m_LastCommandBeforeUnconscious = pCurrentCommandID;
if (hcv)
{
m_TransportCache = hcv.GetTransport();
}
//! TODO: rework vehicle command Knockout back to force player prone after they have exited the vehicle
m_JumpClimb.CheckAndFinishJump();
StartCommand_Unconscious(0);
SetFallYDiff(GetPosition()[1]);
}
}
//! When the player is waking up
else if (m_IsUnconscious)
{
//! Make sure the player is actually unconscious
if (hcu && pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
{
OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
//! protection for a player being broken when attempting to wake them up too early into unconsciousness
if (m_UnconsciousTime > 2)
{
int wakeUpStance = DayZPlayerConstants.STANCEIDX_PRONE;
//! Don't set the stance if we are swimming or in a vehicle, stance change animation could play
if (m_Swimming.m_bWasSwimming || m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
wakeUpStance = -1;
hcu.WakeUp(wakeUpStance);
m_IsUnconscious = false;
OnUnconsciousStop(pCurrentCommandID);
}
}
else
{
//! Maybe instead error out or notify of possible desync?
if (IsAlive())
{
m_IsUnconscious = false;
OnUnconsciousStop(pCurrentCommandID);
}
}
}
}
// quickbar use
int quickBarSlot = hic.IsQuickBarSlot();
if (quickBarSlot && IsAlive())
{
if (hic.IsQuickBarSingleUse())
{
OnQuickBarSingleUse(quickBarSlot);
//Print("PlayerBase.c IsQuickBarSingleUse - slot: " + quickBarSlot.ToString());
}
if (hic.IsQuickBarContinuousUseStart() && ((!GetGame().IsDedicatedServer()) && !GetGame().GetUIManager().GetMenu()))
{
OnQuickBarContinuousUseStart(quickBarSlot);
//Print("PlayerBase.c IsQuickBarContinuousUseStart - slot: " + quickBarSlot.ToString());
}
if (hic.IsQuickBarContinuousUseEnd() && ((!GetGame().IsDedicatedServer())))
{
OnQuickBarContinuousUseEnd(quickBarSlot);
//Print("PlayerBase.c IsQuickBarContinuousUseEnd - slot: " + quickBarSlot.ToString());
}
}
/*if ((pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM))
{
mngr.Update(); // checks for suitable action and sets it
}*/
}
if (m_StaminaHandler && hic)
{
//! SPRINT: enable/disable - based on stamina; disable also when raised
if (!CanConsumeStamina(EStaminaConsumers.SPRINT) || !CanSprint())
{
hic.LimitsDisableSprint(true);
}
else
{
hic.LimitsDisableSprint(false);
}
}
//map closing - feel free to move to different "update" if it does not belong here
if (IsMapOpen())
{
if (!GetGame().IsDedicatedServer())
{
if (!CfgGameplayHandler.GetUse3DMap() && !GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
{
CloseMapEx(false);
}
else if (CfgGameplayHandler.GetUse3DMap())
{
if (IsMapCallbackCancelInput())
{
CloseMapEx(true);
}
else if (IsMapCallbackEndInput())
{
CloseMapEx(false);
}
}
}
}
#ifdef BOT
if (m_Bot)
m_Bot.OnUpdate(pDt);
#endif
if (m_CheckMeleeItem && (!GetGame().IsDedicatedServer()))
{
CheckMeleeItemDamage(m_CheckMeleeItem);
SetCheckMeleeItem();
}
#ifdef DEVELOPER
TryGetInVehicleDebug();
#endif
OnCommandHandlerTick(pDt, pCurrentCommandID);
}
#ifdef DEVELOPER
void SetGetInVehicleDebug(EntityAI ent)
{
m_GetInVehicleTransportDebug = Transport.Cast(ent);
}
void TryGetInVehicleDebug()
{
if (m_GetInVehicleTransportDebug)
{
HumanCommandVehicle vehCommand = StartCommand_Vehicle(m_GetInVehicleTransportDebug, 0, 0);
if (vehCommand)
{
vehCommand.SetVehicleType(m_GetInVehicleTransportDebug.GetAnimInstance());
}
m_GetInVehicleTransportDebug = null;
}
}
#endif
//MAP handling
//! DEPRECATED; terminates map animation callback and re-enables controls
void CloseMap()
{
CloseMapEx(false);
}
void CloseMapEx(bool cancelled)
{
if (m_hac && !GetMapClosingSyncSent())
{
if (ScriptInputUserData.CanStoreInputUserData())
{
if (GetGame().IsMultiplayer() && GetGame().IsClient())
{
ActionManagerClient mngr_client;
CastTo(mngr_client, GetActionManager());
if (cancelled)
{
mngr_client.RequestInterruptAction();
}
else
{
mngr_client.RequestEndAction();
}
GetGame().GetMission().RemoveActiveInputExcludes({"map"});
GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
}
else if (!GetGame().IsMultiplayer())
{
int command_ID = DayZPlayerConstants.CMD_ACTIONINT_END;
if (cancelled)
{
command_ID = DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT;
}
m_hac.InternalCommand(command_ID);
}
SetMapClosingSyncSet(true);
}
}
if (!GetGame().IsDedicatedServer())
{
if (GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
{
GetGame().GetUIManager().FindMenu(MENU_MAP).Close();
if (m_Hud)
{
m_Hud.ShowHudPlayer(true);
m_Hud.ShowQuickbarPlayer(true);
}
GetGame().GetMission().RemoveActiveInputExcludes({"map"});
GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
}
}
}
void SetMapOpen(bool state)
{
m_MapOpen = state;
}
bool IsMapOpen()
{
return m_MapOpen;
}
void SetMapClosingSyncSet(bool state)
{
m_MapClosingSyncSent = state;
}
bool GetMapClosingSyncSent()
{
return m_MapClosingSyncSent;
}
bool IsMapCallbackCancelInput()
{
if (IsRaised() || (GetUApi().GetInputByID(UAUIMenu).LocalPress() || GetUApi().GetInputByID(UAGear).LocalPress()))
{
return true;
}
return false;
}
bool IsMapCallbackEndInput()
{
if (GetUApi().GetInputByID(UADefaultAction).LocalPress())
{
return true;
}
return false;
}
MapNavigationBehaviour GetMapNavigationBehaviour()
{
return m_MapNavigationBehaviour;
}
void MapNavigationItemInPossession(EntityAI item)
{
if (GetMapNavigationBehaviour())
{
GetMapNavigationBehaviour().OnItemInPlayerPossession(item);
}
}
void MapNavigationItemNotInPossession(EntityAI item)
{
if (GetMapNavigationBehaviour())
{
GetMapNavigationBehaviour().OnItemNotInPlayerPossession(item);
}
}
void SetCheckMeleeItem(ItemBase item = null)
{
m_CheckMeleeItem = item;
}
/*
void AirTemperatureCheck()
{
if (!m_Environment.IsTemperatureSet())
return;
float air_temperature = m_Environment.GetTemperature();
int level = 0;//default
if (MiscGameplayFunctions.IsValueInRange(air_temperature, PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH, PlayerConstants.BREATH_VAPOUR_THRESHOLD_LOW))
{
float value = Math.InverseLerp(PlayerConstants.BREATH_VAPOUR_THRESHOLD_LOW, PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH,air_temperature);
value = Math.Clamp(value,0,1);
level = Math.Round(Math.Lerp(1,BREATH_VAPOUR_LEVEL_MAX,value));
}
else if (air_temperature < PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH)
{
level = BREATH_VAPOUR_LEVEL_MAX;
}
if (level != m_BreathVapour)
{
m_BreathVapour = level;
SetSynchDirty();
}
}
*/
void SetShakesForced(int value)
{
m_ShakesForced = value;
}
void FreezeCheck()
{
int level;
if (m_ShakesForced > 0)
{
level = m_ShakesForced;
}
else
{
float heat_comfort = GetStatHeatComfort().Get();
if (heat_comfort <= PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING)
{
float value = Math.InverseLerp(PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING, PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL,heat_comfort);
level = Math.Lerp(1,7,value);
level = Math.Clamp(value,1,7);
/*
value = Math.Clamp(value,0,1);
level = Math.Round(value * SHAKE_LEVEL_MAX);//translate from normalized value to levels
*/
}
}
if (level != m_Shakes)
{
m_Shakes = level;
SetSynchDirty();
}
}
override bool IsLanded(int pCurrentCommandID)
{
if (super.IsLanded(pCurrentCommandID))
{
return true;
}
//! Handle fall damage for unconscious
if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
{
bool wasFalling = m_IsUnconsciousFalling;
m_IsUnconsciousFalling = PhysicsIsFalling(false);
return wasFalling && !m_IsUnconsciousFalling;
}
//! No fall damage for players currently being damaged, animation is temporary
return false;
}
override bool OnLand(int pCurrentCommandID, FallDamageData fallDamageData)
{
if (super.OnLand(pCurrentCommandID, fallDamageData))
{
return true;
}
//! Nothing happens for unconscious
//! Nothing happens for being damaged
return false;
}
override bool IsAlreadyInFallingCommand(int pCurrentCommandID)
{
if (super.IsAlreadyInFallingCommand(pCurrentCommandID))
{
return true;
}
//! Don't switch to falling command if unconscious
//! Don't switch to falling command if being damaged
return pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS || pCurrentCommandID == DayZPlayerConstants.COMMANDID_DAMAGE;
}
void OnUnconsciousStart()
{
CloseInventoryMenu();
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
SetInventorySoftLock(true);
if (m_LastCommandBeforeUnconscious != DayZPlayerConstants.COMMANDID_VEHICLE)
{
EntityAI entity_in_hands = GetHumanInventory().GetEntityInHands();
if (entity_in_hands && CanDropEntity(entity_in_hands) && !IsRestrained())
{
DropItem(ItemBase.Cast(entity_in_hands));
}
}
GetGame().GetSoundScene().SetSoundVolume(0,2);
m_EffectWidgets.AddSuspendRequest(EffectWidgetSuspends.UNCON);
}
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || (!GetGame().IsMultiplayer() && GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT))
{
SetSynchDirty();
if (m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
{
if (m_TransportCache)
m_TransportCache.MarkCrewMemberUnconscious(m_TransportCache.CrewMemberIndex(this));
}
// disable voice communication
GetGame().EnableVoN(this, false);
if (m_AdminLog)
{
m_AdminLog.UnconStart(this);
}
// When we fall uncon we force out of block
if (GetMeleeFightLogic())
{
GetMeleeFightLogic().SetBlock(false);
}
}
SetMasterAttenuation("UnconsciousAttenuation");
}
void OnUnconsciousStop(int pCurrentCommandID)
{
m_UnconRefillModifier =1;
SetSynchDirty();
m_UnconsciousTime = 0;
m_UnconsciousVignetteTarget = 2;
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH)
{
GetGame().GetSoundScene().SetSoundVolume(g_Game.m_volume_sound,1);
PPERequesterBank.GetRequester(PPERequester_UnconEffects).Stop();
GetGame().GetMission().GetHud().ShowHudUI(true);
GetGame().GetMission().GetHud().ShowQuickbarUI(true);
if (GetGame().GetUIManager().IsDialogVisible())
{
GetGame().GetUIManager().CloseDialog();
}
if (GetGame().GetUIManager().IsMenuOpen(MENU_RESPAWN_DIALOGUE))
{
GetGame().GetUIManager().FindMenu(MENU_RESPAWN_DIALOGUE).Close();
}
}
SetInventorySoftLock(false);
m_EffectWidgets.RemoveSuspendRequest(EffectWidgetSuspends.UNCON);
}
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
{
// enable voice communication
if (IsAlive())
GetGame().EnableVoN(this, true);
if (m_AdminLog)
{
m_AdminLog.UnconStop(this);
}
}
SetMasterAttenuation("");
}
void OnUnconsciousUpdate(float pDt, int last_command)
{
m_UnconsciousTime += pDt;
if (GetGame().IsServer())
{
int shock_simplified = SimplifyShock();
if (m_ShockSimplified != shock_simplified)
{
m_ShockSimplified = shock_simplified;
SetSynchDirty();
}
if (m_UnconsciousTime > PlayerConstants.UNCONSCIOUS_IN_WATER_TIME_LIMIT_TO_DEATH && last_command == DayZPlayerConstants.COMMANDID_SWIM)
{
SetHealth("","",-100);
}
}
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
GetGame().GetMission().GetHud().ShowHudUI(false);
GetGame().GetMission().GetHud().ShowQuickbarUI(false);
if (GetPulseType() == EPulseType.REGULAR)
{
float shock_simple_normalized = GetSimplifiedShockNormalized();
float sin = Math.Sin(m_UnconsciousTime * 0.3);
float sin_normalized = (sin + 1) / 2;
if (sin_normalized < 0.05)
{
m_UnconsciousVignetteTarget = (1 - shock_simple_normalized / 3) * 2/*vignette max*/;
}
float vignette = Math.Lerp(2,m_UnconsciousVignetteTarget, sin_normalized);
//PrintString(m_UnconsciousVignetteTarget.ToString());
m_UnconParam.param1 = vignette;
PPERequesterBank.GetRequester(PPERequester_UnconEffects).Start(m_UnconParam);
}
}
}
int SimplifyShock()
{
int shock = Math.Lerp(0, SIMPLIFIED_SHOCK_CAP, GetHealth("","Shock") / GetMaxHealth("","Shock"));
shock = Math.Clamp(shock, 0, SIMPLIFIED_SHOCK_CAP);
return shock;
}
float GetSimplifiedShockNormalized()
{
return (m_ShockSimplified / SIMPLIFIED_SHOCK_CAP);
}
override bool IsUnconscious()
{
return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_UNCONSCIOUS || m_IsUnconscious;
}
override bool CanBeTargetedByAI(EntityAI ai)
{
#ifdef DIAG_DEVELOPER
if (!m_CanBeTargetedDebug)
{
return false;
}
#endif
return super.CanBeTargetedByAI(ai) && !IsUnconscious() && !IsInVehicle();
}
void GiveShock(float shock)
{
AddHealth("","Shock",shock);
}
void OnRestrainStart()
{
CloseInventoryMenu();
GetGame().GetMission().RemoveActiveInputExcludes({"inventory"},true);
GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
}
//! functionality moved to ShockMdfr::OnTick
void ShockRefill(float pDt);
//BrokenLegs
// -----------------------
eBrokenLegs GetBrokenLegs()
{
return Math.AbsInt(m_BrokenLegState);//negative value denotes first time activation
}
//Server side
void SetBrokenLegs(int stateId)
{
m_BrokenLegState = stateId;
DayZPlayerSyncJunctures.SendBrokenLegsEx(this, stateId);
eBrokenLegs state = GetBrokenLegs();//m_BrokenLegState can go bellow 0, cannot be used directly
if (state == eBrokenLegs.NO_BROKEN_LEGS)
{
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
}
else if (state == eBrokenLegs.BROKEN_LEGS)
{
SetLegHealth();
}
else if (state == eBrokenLegs.BROKEN_LEGS_SPLINT)
{
// handle splint here
}
SetSynchDirty();
}
//Update of state
void UpdateBrokenLegs(int stateId)
{
eBrokenLegs state = GetBrokenLegs();
//Raise broken legs flag and force to prone
if (state != eBrokenLegs.NO_BROKEN_LEGS)
{
if (state == eBrokenLegs.BROKEN_LEGS_SPLINT)
{
if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE)
{
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.BROKEN_LEGS_SPLINT;
}
m_InjuryHandler.CheckValue(false);
}
else if (state == eBrokenLegs.BROKEN_LEGS)
{
if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE)
{
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.BROKEN_LEGS;
}
BrokenLegWalkShock();
m_InjuryHandler.CheckValue(false);
}
}
else if (state == eBrokenLegs.NO_BROKEN_LEGS)
{
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
}
}
void BreakLegSound()
{
PlaySoundSet(m_BrokenLegSound, SOUND_BREAK_LEG, 0.1, 0.1);
}
void BrokenLegForceProne(bool forceOverride = false)
{
if (!IsInWater() && !IsSwimming() && !IsClimbingLadder() && !IsInVehicle() && !IsClimbing() && DayZPlayerUtils.PlayerCanChangeStance(this, DayZPlayerConstants.STANCEIDX_PRONE))
{
if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE && m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
{
EntityAI attachment;
Class.CastTo(attachment, GetItemOnSlot("Splint_Right"));
if (attachment && attachment.GetType() == "Splint_Applied")
{
attachment.Delete();
}
m_ShockHandler.SetShock(PlayerConstants.BROKEN_LEGS_INITIAL_SHOCK);
m_ShockHandler.CheckValue(true);
if (m_ShockHandler.GetCurrentShock() >= 25) //Prevent conflict with unconsciousness by not forcing prone when going uncon (25 shock or less left)
{
//calcels user action
HumanCommandActionCallback cmd = GetCommand_Action();
if (cmd)
{
cmd.Cancel();
}
StopHandEvent();
//Get command move and verify not null
HumanCommandMove hcm = StartCommand_Move();//not sure why this is here
hcm = GetCommand_Move();
if (hcm)
{
hcm.ForceStance(DayZPlayerConstants.STANCEIDX_PRONE);
}
}
}
}
m_JumpClimb.CheckAndFinishJump();
}
//Used to inflict shock when player is walking (only inflicted on Update timer)
void BrokenLegWalkShock()
{
//No need to pursue here if player is prone as the following logic is not applied
if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE && m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
{
float avgLegHealth = GetHealth("RightLeg","") + GetHealth("LeftLeg","") + GetHealth("RightFoot","") + GetHealth("LeftFoot","");
avgLegHealth *= 0.25; //divide by 4 to make the average leg health;
if (IsSwimming())
{
//swimming other than forward is not detectable in script other than through velocity check
vector v;
PhysicsGetVelocity(v);
if (v.LengthSq() > 0)
{
m_ShockHandler.SetShock(PlayerConstants.BROKEN_LEGS_SHOCK_SWIM);
}
}
else if (m_MovementState.m_iMovement != 0)
{
if (IsClimbingLadder())
{
MovingShock(avgLegHealth, PlayerConstants.BROKEN_LEGS_HIGH_SHOCK_WALK, PlayerConstants.BROKEN_LEGS_MID_SHOCK_WALK, PlayerConstants.BROKEN_LEGS_LOW_SHOCK_WALK);
}
else if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
{
if (m_MovementState.m_iMovement > 1)//only jog and faster
{
MovingShock(avgLegHealth, PlayerConstants.BROKEN_LEGS_HIGH_SHOCK_WALK, PlayerConstants.BROKEN_LEGS_MID_SHOCK_WALK, PlayerConstants.BROKEN_LEGS_LOW_SHOCK_WALK);
}
}
else if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
{
//any speed other than idle
MovingShock(avgLegHealth, PlayerConstants.BROKEN_LEGS_HIGH_SHOCK_WALK * PlayerConstants.BROKEN_CROUCH_MODIFIER, PlayerConstants.BROKEN_LEGS_MID_SHOCK_WALK * PlayerConstants.BROKEN_CROUCH_MODIFIER, PlayerConstants.BROKEN_LEGS_LOW_SHOCK_WALK * PlayerConstants.BROKEN_CROUCH_MODIFIER);
}
}
else
{
//Here apply shock if player is standing or crouched and STANDING STILL
m_ShockHandler.SetShock(PlayerConstants.BROKEN_LEGS_STAND_SHOCK);
}
m_ShockHandler.CheckValue(true);
}
}
//Always use the same thresholds but allow passing of different shock values
void MovingShock(float legHealth, float highShock, float midShock, float lowShock)
{
if (legHealth <= PlayerConstants.BROKEN_LEGS_LOW_HEALTH_THRESHOLD)
{
//Inflict "high shock"
m_ShockHandler.SetShock(highShock);
}
else if (legHealth >= PlayerConstants.BROKEN_LEGS_HIGH_HEALTH_THRESHOLD)
{
//Inflict "low shock"
m_ShockHandler.SetShock(lowShock);
}
else
{
//If neither high nore low, inflict "mid shock"
m_ShockHandler.SetShock(midShock);
}
}
void DealShock(float dmg)
{
Param1<float> damage = new Param1<float>(0);
damage.param1 = dmg;
GetGame().RPCSingleParam(this, ERPCs.RPC_SHOCK, damage, true, GetIdentity());
}
//Prevent player from picking up heavy items when legs are broken
override bool CanPickupHeavyItem(notnull EntityAI item)
{
if (item.IsHeavyBehaviour() && (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS || GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS_SPLINT))
return false;
return super.CanPickupHeavyItem(item);
}
//Set all leg zones' health to 0 in order to limit emergent behaviour and prevent confusion as to how broken legs really work
void SetLegHealth()
{
SetHealth("RightLeg", "", 0);
SetHealth("RightFoot", "", 0);
SetHealth("LeftLeg", "", 0);
SetHealth("LeftFoot", "", 0);
}
void DropHeavyItem()
{
ItemBase itemInHands = GetItemInHands();
if (itemInHands && itemInHands.IsHeavyBehaviour())
DropItem(itemInHands);
}
bool IsWearingSplint()
{
EntityAI attachment;
Class.CastTo(attachment, GetItemOnSlot("Splint_Right"));
if (attachment && attachment.GetType() == "Splint_Applied")
{
return true;
}
return false;
}
// -----------------------
override void OnCommandSwimStart()
{
ItemBase itemInHands = GetItemInHands();
if (itemInHands)
{
if (itemInHands.IsHeavyBehaviour())
{
TryHideItemInHands(false);
DropHeavyItem();
}
else
{
TryHideItemInHands(true);
}
itemInHands.OnItemInHandsPlayerSwimStart(this);
}
m_AnimCommandStarting = HumanMoveCommandID.CommandSwim;
if (GetInventory())
GetInventory().LockInventory(LOCK_FROM_SCRIPT);
CloseInventoryMenu();
GetDayZGame().GetBacklit().OnSwimmingStart();
AbortWeaponEvent();
GetWeaponManager().DelayedRefreshAnimationState(10);
RequestHandAnimationStateRefresh();
GetGame().GetMission().AddActiveInputExcludes({"swimming"});
}
override void OnCommandSwimFinish()
{
TryHideItemInHands(false, true);
if (GetInventory())
GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
GetDayZGame().GetBacklit().OnSwimmingStop();
GetWeaponManager().RefreshAnimationState();
GetGame().GetMission().RemoveActiveInputExcludes({"swimming"});
}
override void OnCommandLadderStart()
{
m_AnimCommandStarting = HumanMoveCommandID.CommandLadder;
TryHideItemInHands(true);
if (GetInventory())
GetInventory().LockInventory(LOCK_FROM_SCRIPT);
CloseInventoryMenu();
GetGame().GetMission().AddActiveInputExcludes({"ladderclimbing"});
}
override void OnCommandLadderFinish()
{
TryHideItemInHands(false, true);
if (GetInventory())
GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
GetGame().GetMission().RemoveActiveInputExcludes({"ladderclimbing"});
}
override void OnCommandFallStart()
{
m_AnimCommandStarting = HumanMoveCommandID.CommandFall;
if (GetInventory())
GetInventory().LockInventory(LOCK_FROM_SCRIPT);
CloseInventoryMenu();
AbortWeaponEvent();
GetWeaponManager().DelayedRefreshAnimationState(10);
RequestHandAnimationStateRefresh();
}
override void OnCommandFallFinish()
{
if (GetInventory())
GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
GetWeaponManager().RefreshAnimationState();
}
override void OnCommandClimbStart()
{
m_AnimCommandStarting = HumanMoveCommandID.CommandClimb;
if (GetInventory())
GetInventory().LockInventory(LOCK_FROM_SCRIPT);
CloseInventoryMenu();
AbortWeaponEvent();
GetWeaponManager().DelayedRefreshAnimationState(10);
RequestHandAnimationStateRefresh();
}
override void OnCommandClimbFinish()
{
if (GetInventory())
GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
GetWeaponManager().RefreshAnimationState();
}
override void OnCommandVehicleStart()
{
m_AnimCommandStarting = HumanMoveCommandID.CommandVehicle;
if (GetInventory())
GetInventory().LockInventory(LOCK_FROM_SCRIPT);
CloseInventoryMenu();
ItemBase itemInHand = GetItemInHands();
EntityAI itemOnHead = FindAttachmentBySlotName("Headgear");
if (itemInHand && itemInHand.GetCompEM())
itemInHand.GetCompEM().SwitchOff();
TryHideItemInHands(true);
if (itemOnHead && itemOnHead.GetCompEM())
itemOnHead.GetCompEM().SwitchOff();
HumanCommandVehicle hcv = GetCommand_Vehicle();
if (hcv && hcv.GetVehicleSeat() == DayZPlayerConstants.VEHICLESEAT_DRIVER)
OnVehicleSeatDriverEnter();
GetGame().GetMission().AddActiveInputExcludes({"vehicledriving"});
}
override void OnCommandVehicleFinish()
{
if (GetInventory())
GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
TryHideItemInHands(false, true);
if (m_IsVehicleSeatDriver)
OnVehicleSeatDriverLeft();
GetGame().GetMission().RemoveActiveInputExcludes({"vehicledriving"});
}
override void OnCommandMelee2Start()
{
m_AnimCommandStarting = HumanMoveCommandID.CommandMelee2;
m_IsFighting = true;
AbortWeaponEvent();
GetWeaponManager().DelayedRefreshAnimationState(10);
RequestHandAnimationStateRefresh();
}
override void OnCommandMelee2Finish()
{
RunFightBlendTimer();
GetWeaponManager().RefreshAnimationState();
}
override void OnCommandDeathStart()
{
m_AnimCommandStarting = HumanMoveCommandID.CommandDeath;
AbortWeaponEvent();
GetWeaponManager().DelayedRefreshAnimationState(10);
RequestHandAnimationStateRefresh();
}
override void OnJumpStart()
{
m_ActionManager.OnJumpStart();
AbortWeaponEvent();
GetWeaponManager().DelayedRefreshAnimationState(10);
RequestHandAnimationStateRefresh();
CloseMapEx(true);
}
override void OnJumpEnd(int pLandType = 0)
{
if (m_PresenceNotifier)
{
switch (pLandType)
{
case HumanCommandFall.LANDTYPE_NONE:
case HumanCommandFall.LANDTYPE_LIGHT:
m_PresenceNotifier.ProcessEvent(EPresenceNotifierNoiseEventType.LAND_LIGHT);
break;
case HumanCommandFall.LANDTYPE_MEDIUM:
case HumanCommandFall.LANDTYPE_HEAVY:
m_PresenceNotifier.ProcessEvent(EPresenceNotifierNoiseEventType.LAND_HEAVY);
break;
}
}
GetWeaponManager().RefreshAnimationState();
}
bool IsStance(int stance, int stanceMask)
{
return ((1 << stance) & stanceMask) != 0;
}
override void OnStanceChange(int previousStance, int newStance)
{
int prone = DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE;
int notProne = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_RAISEDERECT | DayZPlayerConstants.STANCEMASK_RAISEDCROUCH;
if (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_PRONE) && IsStance(newStance, DayZPlayerConstants.STANCEMASK_ERECT))
m_SprintedTimePerStanceMin = PlayerConstants.FULL_SPRINT_DELAY_FROM_PRONE;
if (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_PRONE) && IsStance(previousStance, DayZPlayerConstants.STANCEMASK_CROUCH) || (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_CROUCH) && IsStance(newStance, DayZPlayerConstants.STANCEMASK_ERECT)))
m_SprintedTimePerStanceMin = PlayerConstants.FULL_SPRINT_DELAY_FROM_CROUCH;
if ((IsStance(previousStance, prone) && IsStance(newStance, notProne)) || (IsStance(previousStance, notProne) && IsStance(newStance, prone)))
{
AbortWeaponEvent();
GetWeaponManager().RefreshAnimationState();
}
}
override bool CanChangeStance(int previousStance, int newStance)
{
// Check if the player is playing a throwing animation
if (GetThrowing().IsThrowingAnimationPlaying())
{
return false;
}
// don't allow base stance change, only raised hands change
if (IsRolling())
{
if (Math.AbsInt(previousStance - newStance) == 3)
return true;
return false;
}
// Check if the player is going to crouch or raised crouch
if (newStance == DayZPlayerConstants.STANCEIDX_CROUCH || newStance == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
{
return GetCurrentWaterLevel() <= GetDayZPlayerType().CommandSwimSettingsW().m_fToErectLevel;
}
// Check if the player is going to prone
if (newStance == DayZPlayerConstants.STANCEIDX_PRONE || newStance == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
{
return GetCurrentWaterLevel() <= GetDayZPlayerType().CommandSwimSettingsW().m_fToCrouchLevel;
}
// The player can change stance if none of the conditions above are met
return true;
}
override void OnCommandMoveStart()
{
if (GetGame().IsServer())
{
//In case player changes stance through a different command, we refresh the anim overrides
int prone = DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE;
if (!IsPlayerInStance(prone))
{
m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
ForceUpdateInjuredState();
}
}
}
override bool CanRoll()
{
if (!CanConsumeStamina(EStaminaConsumers.ROLL))
return false;
if (IsInFBEmoteState() || m_EmoteManager.m_MenuEmote)
{
return false;
}
return IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE) && GetCommand_Move() && !GetCommand_Move().IsOnBack();
}
override void OnRollStart(bool isToTheRight)
{
DepleteStamina(EStaminaModifiers.ROLL);
if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
m_ShockHandler.SetShock(PlayerConstants.BROKEN_LEGS_ROLL_SHOCK);
}
override void OnRollFinish()
{
}
void OnJumpOutVehicleFinish(float carSpeed)
{
string surfaceType;
int liquidType;
GetGame().SurfaceUnderObject(this, surfaceType, liquidType);
}
void OnVehicleSwitchSeat(int seatIndex)
{
if (seatIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
{
OnVehicleSeatDriverEnter();
}
else
{
OnVehicleSeatDriverLeft();
}
}
void OnVehicleSeatDriverEnter()
{
m_IsVehicleSeatDriver = true;
if (m_Hud)
m_Hud.ShowVehicleInfo();
}
void OnVehicleSeatDriverLeft()
{
m_IsVehicleSeatDriver = false;
if (m_Hud)
m_Hud.HideVehicleInfo();
}
override void OnThrowingModeChange(bool change_to_enabled)
{
if (change_to_enabled)
{
PlacingCancelLocal();
PlacingCancelServer();
}
}
override void EOnFrame(IEntity other, float timeSlice)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
#ifndef NO_GUI
m_Hud.Update(timeSlice);
m_Hud.ToggleHeatBufferPlusSign(m_HasHeatBuffer);
if (IsControlledPlayer() && m_EffectWidgets && m_EffectWidgets.IsAnyEffectRunning())
{
m_EffectWidgets.Update(timeSlice);
}
#endif
if (m_UndergroundHandler)
m_UndergroundHandler.Tick(timeSlice);
}
}
override void EOnPostFrame(IEntity other, int extra)
{
float delta_time = (GetGame().GetTime() - m_LastPostFrameTickTime) / 1000;
m_LastPostFrameTickTime = GetGame().GetTime();
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
if (GetDamageDealtEffect())
{
if (IsAlive())
GetDamageDealtEffect().Update(delta_time);
else
delete GetDamageDealtEffect();
}
if (m_EffectRadial)
{
if (IsAlive())
{
m_EffectRadial.Update(delta_time);
}
else
m_EffectRadial = null;
}
if (GetFlashbangEffect())
{
if (IsAlive())
{
GetFlashbangEffect().Update(delta_time);
}
else
{
GetFlashbangEffect().Stop();
delete GetFlashbangEffect();
}
}
if (GetShockEffect())
{
if (IsAlive())
GetShockEffect().Update(delta_time);
else
delete GetShockEffect();
}
m_InventoryActionHandler.OnUpdate();
}
#ifdef DIAG_DEVELOPER
DiagOnPostFrame(other, extra);
#endif
}
#ifdef DIAG_DEVELOPER
protected void DiagOnPostFrame(IEntity other, int extra)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
if (m_WeaponDebug)
{
m_WeaponDebug.OnPostFrameUpdate();
}
if (GetBleedingManagerRemote())
{
GetBleedingManagerRemote().OnUpdate();
}
if (m_MeleeCombat)
{
if (DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG))
{
m_MeleeDebug = true;
m_MeleeCombat.Debug(GetItemInHands(), m_MeleeCombat.GetHitType());
}
else if (!DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG) && m_MeleeDebug)
{
m_MeleeDebug = false;
m_MeleeCombat.Debug(GetItemInHands(), m_MeleeCombat.GetHitType());
}
}
if (DiagMenu.GetBool(DiagMenuIDs.SOUNDS_ITEM_IMPACT_SOUNDS))
InventoryItem.DrawImpacts();
if (GetPluginManager())
{
PluginDrawCheckerboard drawCheckerboard = PluginDrawCheckerboard.Cast(GetPluginManager().GetPluginByType(PluginDrawCheckerboard));
if (drawCheckerboard && !drawCheckerboard.IsActive())
{
drawCheckerboard.ShowWidgets(DiagMenu.GetBool(DiagMenuIDs.MISC_DRAW_CHECKERBOARD));
}
}
if (m_PresenceNotifier)
{
m_PresenceNotifier.EnableDebug(DiagMenu.GetBool(DiagMenuIDs.MISC_PRESENCE_NOTIFIER_DBG));
}
if (DiagMenu.GetBool(DiagMenuIDs.TRIGGER_PLAYER_DEBUG))
{
vector minmax[2];
GetCollisionBox(minmax);
int color = COLOR_RED_A;
if (m_IsInsideTrigger)
color = COLOR_GREEN_A;
Shape dbgShape = Debug.DrawBoxEx(minmax[0], minmax[1], color, ShapeFlags.TRANSP|ShapeFlags.NOZWRITE|ShapeFlags.ONCE);
vector mat[4];
GetTransform(mat);
dbgShape.CreateMatrix(mat);
dbgShape.SetMatrix(mat);
}
}
if (m_Environment && m_Environment.m_Debug)
{
#ifdef SERVER
EnvDebugData envDebugData = m_Environment.GetEnvDebugData();
GetGame().RPCSingleParam(this, ERPCs.DIAG_MISC_ENVIRONMENT_DEBUG_DATA, envDebugData, false, GetIdentity());
#else
m_Environment.ShowEnvDebugPlayerInfo(DiagMenu.GetBool(DiagMenuIDs.MISC_ENVIRONMENT_DEBUG));
#endif
}
if (m_FallDamage && m_FallDamage.m_Debug)
{
#ifdef SERVER
FallDamageDebugData fallDamageDebugData = m_FallDamage.GetFallDamageDebugData();
GetGame().RPCSingleParam(this, ERPCs.DIAG_MISC_FALLDAMAGE_DEBUG_DATA, fallDamageDebugData, false, GetIdentity());
#else
m_FallDamage.ShowFallDamageDebugInfo(DiagMenu.GetBool(DiagMenuIDs.MISC_FALLDAMAGE_DEBUG));
#endif
}
}
override void OnEnterTrigger(ScriptedEntity trigger)
{
super.OnEnterTrigger(trigger);
++m_IsInsideTrigger;
}
override void OnLeaveTrigger(ScriptedEntity trigger)
{
super.OnLeaveTrigger(trigger);
--m_IsInsideTrigger;
}
#endif
void StaminaHUDNotifier(bool show)
{
if (m_Hud)
m_Hud.SetStaminaBarVisibility(show);
}
override void DepleteStamina(EStaminaModifiers modifier, float dT = -1)
{
if (GetStaminaHandler())
GetStaminaHandler().DepleteStamina(modifier,dT);
}
override bool CanConsumeStamina(EStaminaConsumers consumer)
{
if (!GetStaminaHandler()) return false;
bool val = (GetStaminaHandler().HasEnoughStaminaFor(consumer) /*&& !IsOverloaded()*/ && !IsRestrained() && !IsInFBEmoteState());
if (!val)
StaminaHUDNotifier(false);
return val;
}
override bool CanStartConsumingStamina(EStaminaConsumers consumer)
{
if (!GetStaminaHandler()) return false;
bool val = (GetStaminaHandler().HasEnoughStaminaToStart(consumer) && !IsRestrained() && !IsInFBEmoteState());
if (!val)
StaminaHUDNotifier(false);
return val;
}
//! DEPRECATED
bool HasStaminaRemaining()
{
if (!GetStaminaHandler())
return false;
return GetStaminaHandler().GetStamina() > 0;
}
override bool CanClimb(int climbType, SHumanCommandClimbResult climbRes)
{
if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
{
return false;
}
if (climbType == 1 && !CanConsumeStamina(EStaminaConsumers.VAULT))
return false;
if (climbType == 2 && (!CanConsumeStamina(EStaminaConsumers.CLIMB) || GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS))
return false;
if (climbType > 0 && m_InjuryHandler && m_InjuryHandler.GetInjuryAnimValue() >= InjuryAnimValues.LVL3)
return false;
return super.CanClimb(climbType,climbRes);
}
override bool CanJump()
{
if (GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS)
{
return false;
}
if (!CanConsumeStamina(EStaminaConsumers.JUMP))
return false;
//! disables jump when player is significantly injured
if (m_InjuryHandler && m_InjuryHandler.GetInjuryAnimValue() >= InjuryAnimValues.LVL3)
return false;
if (IsInFBEmoteState() || m_EmoteManager.m_MenuEmote)
{
return false;
}
return super.CanJump();
}
bool IsJumpInProgress()
{
return m_JumpClimb.m_bIsJumpInProgress;
}
bool IsTargetInActiveRefresherRange(EntityAI target)
{
array<vector> temp = new array<vector>;
temp = GetGame().GetMission().GetActiveRefresherLocations();
int count = temp.Count();
if (count > 0)
{
vector pos = target.GetPosition();
for (int i = 0; i < count; i++)
{
if (vector.Distance(pos,temp.Get(i)) < GameConstants.REFRESHER_RADIUS)
return true;
}
return false;
}
else
{
return false;
}
}
void RequestHandAnimationStateRefresh()
{
if ((GetGame().IsMultiplayer() && GetGame().IsServer()))
{
m_RefreshAnimStateIdx++;
if (m_RefreshAnimStateIdx > 3)
m_RefreshAnimStateIdx = 0;
SetSynchDirty();
}
}
void RefreshHandAnimationState(int delay = 0)
{
if (delay == 0)
{
GetItemAccessor().OnItemInHandsChanged(true);
GetItemAccessor().ResetWeaponInHands();
}
else
{
GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(RefreshHandAnimationState,delay,false,0);
}
}
// -------------------------------------------------------------------------
// USER ACTIONS
// -------------------------------------------------------------------------
bool IsFacingTarget(Object target)
{
vector pdir = GetDirection();
vector ptv = target.GetPosition() - GetPosition();
pdir.Normalize();
ptv.Normalize();
if (Math.AbsFloat(pdir[0]-ptv[0]) < 0.5 && Math.AbsFloat(pdir[2]-ptv[2]) < 0.5)
{
return true;
}
return false;
}
//---------------------------------------------------------
void OnQuickBarSingleUse(int slotClicked)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
return;
if (m_AreHandsLocked)
return; //Player is in the short window of time after interrupting placement of an item and before getting it back in hands
if (GetInventory().IsInventoryLocked() || IsEmotePlaying())
return;
if (GetThrowing().IsThrowingModeEnabled() || GetThrowing().IsThrowingAnimationPlaying())
return;
if (IsRaised() || GetCommand_Melee() || IsSwimming() || IsClimbingLadder() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
return;
if (GetDayZPlayerInventory().IsProcessing() || IsItemsToDelete())
return;
if (GetActionManager().GetRunningAction() != null)
return;
if (GetWeaponManager() && GetWeaponManager().IsRunning())
return;
if (!ScriptInputUserData.CanStoreInputUserData())
return;
//TODO MW change locking method
//if (GetDayZPlayerInventory().HasLockedHands())
// return;
EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);//GetEntityInQuickBar(slotClicked - 1);
if (!quickBarEntity)
return;
Magazine mag;
Weapon_Base wpn;
if (Class.CastTo(mag, quickBarEntity) && Class.CastTo(wpn, mag.GetHierarchyParent()))
return;
EntityAI inHandEntity = GetHumanInventory().GetEntityInHands();
if (!GetDayZPlayerInventory().IsIdle())
return; // player is already performing some animation
InventoryLocation handInventoryLocation = new InventoryLocation;
handInventoryLocation.SetHands(this,quickBarEntity);
if (this.GetInventory().HasInventoryReservation(quickBarEntity, handInventoryLocation))
return;
if (inHandEntity == quickBarEntity)
{
if (GetHumanInventory().CanRemoveEntityInHands())
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveMoveItemFromHandsToInventory HND=" + Object.GetDebugName(inHandEntity));
PredictiveMoveItemFromHandsToInventory();
}
}
else
{
InventoryLocation invLocQBItem = new InventoryLocation;
quickBarEntity.GetInventory().GetCurrentInventoryLocation(invLocQBItem);
if (GetInventory().HasInventoryReservation(quickBarEntity,invLocQBItem))
return;
if (inHandEntity)
{
InventoryLocation Reserved_Item_il = new InventoryLocation;
InventoryLocation inHandEntityFSwapDst = new InventoryLocation;
inHandEntity.GetInventory().GetCurrentInventoryLocation(inHandEntityFSwapDst);
int index = GetHumanInventory().FindUserReservedLocationIndex(inHandEntity);
if (index >= 0)
GetHumanInventory().GetUserReservedLocation(index, Reserved_Item_il);
if (Reserved_Item_il)
inHandEntityFSwapDst.CopyLocationFrom(Reserved_Item_il, true);
if (index < 0 && GameInventory.CanSwapEntitiesEx(quickBarEntity, inHandEntity))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] PredictiveSwapEntities QB=" + Object.GetDebugName(quickBarEntity) + " HND=" + Object.GetDebugName(inHandEntity));
PredictiveSwapEntities(quickBarEntity, inHandEntity);
}
else if (GameInventory.CanForceSwapEntitiesEx(quickBarEntity, handInventoryLocation, inHandEntity, inHandEntityFSwapDst))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Swap - PredictiveForceSwapEntities HND=" + Object.GetDebugName(inHandEntity) + " QB=" + Object.GetDebugName(quickBarEntity) + " fswap_dst=" + InventoryLocation.DumpToStringNullSafe(inHandEntityFSwapDst));
PredictiveForceSwapEntities(quickBarEntity, inHandEntity, inHandEntityFSwapDst);
}
}
else
{
if (GetInventory().HasInventoryReservation(quickBarEntity,handInventoryLocation))
return;
if (GetInventory().CanAddEntityIntoHands(quickBarEntity))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveTakeEntityToHands QB=" + Object.GetDebugName(quickBarEntity));
PredictiveTakeEntityToHands(quickBarEntity);
}
}
}
}
//---------------------------------------------------------
void OnQuickBarContinuousUseStart(int slotClicked)
{
if (GetInventory().IsInventoryLocked())
return;
if (IsSwimming() || IsClimbingLadder() || GetCommand_Melee() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
return;
ItemBase quickBarItem = ItemBase.Cast(GetQuickBarEntity(slotClicked - 1));
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
ItemBase itemInHands = ItemBase.Cast(GetHumanInventory().GetEntityInHands());
if (itemInHands != quickBarItem)
{
ActionManagerClient amc = ActionManagerClient.Cast(GetActionManager());
if (amc.CanPerformActionFromQuickbar(itemInHands, quickBarItem))
{
amc.PerformActionFromQuickbar(itemInHands, quickBarItem);
}
else
{
if (IsRaised() || GetCommand_Melee())
return;
amc.ForceTarget(quickBarItem);
m_QuickBarFT = true;
}
}
}
m_QuickBarHold = true;
}
//---------------------------------------------------------
void OnQuickBarContinuousUseEnd(int slotClicked)
{
if (m_QuickBarHold)
{
if ( GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
ActionManagerClient am = ActionManagerClient.Cast(GetActionManager());
if (m_ActionQBControl)
{
ActionBase action = am.GetRunningAction();
if (action)
{
if (!action.GetInput().IsActive())
{
am.EndActionInput();
}
}
}
if (m_QuickBarFT)
{
am.ClearForceTarget();
m_QuickBarFT = false;
}
}
}
m_QuickBarHold = false;
}
void SetActionEndInput(ActionBase action)
{
m_ActionQBControl = !action.GetInput().IsActive();
}
bool IsQBControl()
{
return m_ActionQBControl;
}
void ResetActionEndInput()
{
m_ActionQBControl = false;
}
//---------------------------------------------------------
// RADIAL QUICKBAR AND RELOAD ACTIONS
//---------------------------------------------------------
//the same functionality as normal quick bar slot key press
void RadialQuickBarSingleUse(int slotClicked)
{
OnQuickBarSingleUse(slotClicked);
}
//removed the need for holding down quick bar slot key
void RadialQuickBarCombine(int slotClicked)
{
EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);
EntityAI entity_in_hands = GetHumanInventory().GetEntityInHands();
ReloadWeapon(entity_in_hands, quickBarEntity);
}
//removed the need for holding down quick bar slot key
void QuickReloadWeapon(EntityAI weapon)
{
EntityAI magazine = GetMagazineToReload(weapon);
ReloadWeapon(weapon, magazine);
}
//Reload weapon with given magazine
void ReloadWeapon(EntityAI weapon, EntityAI magazine)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
ActionManagerClient mngr_client;
CastTo(mngr_client, GetActionManager());
if (mngr_client && FirearmActionLoadMultiBulletRadial.Cast(mngr_client.GetRunningAction()))
{
mngr_client.Interrupt();
}
else if (GetHumanInventory().GetEntityInHands()!= magazine)
{
Weapon_Base wpn;
Magazine mag;
Class.CastTo(wpn, weapon);
Class.CastTo(mag, magazine);
if (GetWeaponManager().CanUnjam(wpn))
{
GetWeaponManager().Unjam();
}
else if (GetWeaponManager().CanAttachMagazine(wpn, mag))
{
GetWeaponManager().AttachMagazine(mag);
}
else if (GetWeaponManager().CanSwapMagazine(wpn, mag))
{
GetWeaponManager().SwapMagazine(mag);
}
else if (GetWeaponManager().CanLoadBullet(wpn, mag))
{
//GetWeaponManager().LoadMultiBullet(mag);
ActionTarget atrg = new ActionTarget(mag, this, -1, vector.Zero, -1.0);
if (mngr_client && !mngr_client.GetRunningAction() && mngr_client.GetAction(FirearmActionLoadMultiBulletRadial).Can(this, atrg, wpn))
mngr_client.PerformActionStart(mngr_client.GetAction(FirearmActionLoadMultiBulletRadial), atrg, wpn);
}
}
}
}
//returns compatible magazine from player inventory with highest ammo count
EntityAI GetMagazineToReload(EntityAI weapon)
{
Weapon_Base weapon_base = Weapon_Base.Cast(weapon);
WeaponManager weapon_manager = GetWeaponManager();
EntityAI magazine_to_reload;
EntityAI ammo_magazine; //magazine
int last_ammo_magazine_count;
int ammo_magazine_count;
EntityAI ammo_pile; //ammo pile
int last_ammo_pile_count;
int ammo_pile_count;
//Get all magazines in (player) inventory
for (int att_i = 0; att_i < GetInventory().AttachmentCount(); ++att_i)
{
EntityAI attachment = GetInventory().GetAttachmentFromIndex(att_i);
ref CargoBase attachment_cargo = attachment.GetInventory().GetCargo();
if (attachment_cargo)
{
for (int cgo_i = 0; cgo_i < attachment_cargo.GetItemCount(); ++cgo_i)
{
EntityAI cargo_item = attachment_cargo.GetItem(cgo_i);
//check for proper magazine
if (cargo_item.IsMagazine())
{
Magazine magazine = Magazine.Cast(cargo_item);
ammo_pile_count = magazine.GetAmmoCount();
//magazines (get magazine with max ammo count)
if (weapon_manager.CanAttachMagazine(weapon_base, magazine) || weapon_manager.CanSwapMagazine(weapon_base, magazine))
{
if (ammo_pile_count > 0)
{
if (last_ammo_magazine_count == 0)
{
ammo_magazine = magazine;
last_ammo_magazine_count = ammo_pile_count;
}
else
{
if (last_ammo_magazine_count < ammo_pile_count)
{
ammo_magazine = magazine;
last_ammo_magazine_count = ammo_pile_count;
}
}
}
}
//bullets (get ammo pile with min ammo count)
else if (weapon_manager.CanLoadBullet(weapon_base, magazine))
{
if (ammo_pile_count > 0)
{
if (last_ammo_pile_count == 0)
{
ammo_pile = magazine;
last_ammo_pile_count = ammo_pile_count;
}
else
{
if (last_ammo_pile_count > ammo_pile_count)
{
ammo_pile = magazine;
last_ammo_pile_count = ammo_pile_count;
}
}
}
}
}
}
}
}
//prioritize magazine
if (ammo_magazine)
{
return ammo_magazine;
}
return ammo_pile;
}
//---------------------------------------------------------
//---------------------------------------------------------
void OnSpawnedFromConsole()
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
{
GetGame().GetMission().AddDummyPlayerToScheduler(this);
OnSelectPlayer();
}
}
//---------------------------------------------------------
//Obsolete
bool GetLiquidTendencyDrain()
{
return m_LiquidTendencyDrain;
}
//---------------------------------------------------------
//Obsolete
void SetLiquidTendencyDrain(bool state)
{
m_LiquidTendencyDrain = state;
}
//---------------------------------------------------------
//! DEPRECATED
bool GetFlagTendencyRaise()
{
return m_FlagRaisingTendency;
}
//---------------------------------------------------------
//! DEPRECATED
void SetFlagTendencyRaise(bool state)
{
m_FlagRaisingTendency = state;
}
override SoundOnVehicle PlaySound(string sound_name, float range, bool create_local = false)
{
return BetaSound.SaySound(this, sound_name, range, false);
}
float GetPlayerLoad()
{
return GetWeightEx();
}
bool IsOverloaded()
{
return GetWeightEx() >= OVERLOAD_LIMIT;
}
void SetPlayerLoad(float load)//Deprecated
{
m_CargoLoad = load;
//Print("m_CargoLoad: " + m_CargoLoad);
//Log(ToString(this) + "'s load weight is " + ftoa(m_CargoLoad) + " g.", LogTemplates.TEMPLATE_PLAYER_WEIGHT);
}
//Deprecated, will be overrid by other method calls (in order to ensure stamina calculation is properly set)
void AddPlayerLoad(float addedload)//Deprecated
{
float newload = GetPlayerLoad() + addedload;
SetPlayerLoad(newload);
// Do not need -> Log is in SetPlayerLoad
//PrintString(ToString(this) + "'s load weight is " + ToString(m_CargoLoad) + " g.");
}
bool IsItemInInventory(EntityAI entity)
{
return GetInventory().HasEntityInInventory(entity);
}
override bool NeedInventoryJunctureFromServer(notnull EntityAI item, EntityAI currParent, EntityAI newParent)
{
if (GetGame().IsMultiplayer())
{
DayZPlayerInstanceType t = GetInstanceType();
switch (t)
{
case DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER:
return false;
case DayZPlayerInstanceType.INSTANCETYPE_CLIENT:
case DayZPlayerInstanceType.INSTANCETYPE_SERVER:
case DayZPlayerInstanceType.INSTANCETYPE_AI_SERVER:
case DayZPlayerInstanceType.INSTANCETYPE_AI_REMOTE:
case DayZPlayerInstanceType.INSTANCETYPE_REMOTE:
return true; // Might help mitigate "megabugged" (desync)
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " NeedInventoryJunctureFromServer item=" + Object.GetDebugName(item) + " currPar=" + currParent + " newPar=" + newParent);
bool i_owned = GetHumanInventory().HasEntityInInventory(item);
bool cp_owned = false;
if (currParent)
cp_owned = GetHumanInventory().HasEntityInInventory(currParent);
bool np_owned = false;
if (newParent)
np_owned = GetHumanInventory().HasEntityInInventory(newParent);
bool all_owned = i_owned && cp_owned && (np_owned || (newParent == null));
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " NeedInventoryJunctureFromServer=" + !all_owned + " i_pwn=" + i_owned + " cp_pwn=" + cp_owned + " np_pwn=" + np_owned);
return !all_owned;
default:
Error("[syncinv] unsupported instance type t=" + t);
break;
}
}
return false;
}
override protected float GetWeightSpecialized(bool forceRecalc = false)
{
float totalWeight = super.GetWeightSpecialized(forceRecalc);
ItemBase itemHands = GetItemInHands();
if (itemHands) // adds weight of item carried in hands
{
totalWeight += itemHands.GetWeightEx(forceRecalc);
}
#ifdef DEVELOPER
if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
{
float itemInHandsWeight = totalWeight - super.GetWeightSpecialized(forceRecalc);
WeightDebugData dta = WeightDebug.GetWeightDebug(this);
dta.SetCalcDetails("TMan: " + (super.GetWeightSpecialized(forceRecalc)+ itemInHandsWeight) +"(contents weight[includes item in hands])");
}
#endif
return totalWeight;
}
void CalculateVisibilityForAI()
{
const int VISIBILITY_SLOTS_COUNT = 10;
int attcount = GetInventory().AttachmentCount();
float sumVisibility = 0;
float countVisibility = 0;
float visibilityMean = 0;
if (attcount > 0)
{
for (int att = 0; att < attcount; att++)
{
EntityAI attachment = GetInventory().GetAttachmentFromIndex(att);
if (attachment.IsClothing())
{
ClothingBase clothing;
Class.CastTo(clothing, attachment);
sumVisibility += clothing.GetItemVisibility();
countVisibility++;
}
}
visibilityMean = (sumVisibility + (VISIBILITY_SLOTS_COUNT - countVisibility)) / VISIBILITY_SLOTS_COUNT;
SetVisibilityCoef(visibilityMean);
}
else
{
visibilityMean = 1;
SetVisibilityCoef(visibilityMean);
}
}
void SetVisibilityCoef(float pVisibility)
{
m_VisibilityCoef = pVisibility;
}
float GetVisibilityCoef()
{
return m_VisibilityCoef;
}
int GetShakeLevel()
{
return m_Shakes;
}
EStatLevels GetStatLevelHealth()
{
float health = GetHealth("","");
return GetStatLevel(health, PlayerConstants.SL_HEALTH_CRITICAL, PlayerConstants.SL_HEALTH_LOW, PlayerConstants.SL_HEALTH_NORMAL, PlayerConstants.SL_HEALTH_HIGH);
}
EStatLevels GetStatLevelToxicity()
{
float toxicity = GetStatToxicity().Get();
return GetStatLevel(toxicity, PlayerConstants.SL_HEALTH_CRITICAL, PlayerConstants.SL_HEALTH_LOW, PlayerConstants.SL_HEALTH_NORMAL, PlayerConstants.SL_HEALTH_HIGH);
}
EStatLevels GetStatLevelBlood()
{
float blood = GetHealth("","Blood");
return GetStatLevel(blood, PlayerConstants.SL_BLOOD_CRITICAL, PlayerConstants.SL_BLOOD_LOW, PlayerConstants.SL_BLOOD_NORMAL, PlayerConstants.SL_BLOOD_HIGH);
}
EStatLevels GetStatLevelEnergy()
{
float energy = GetStatEnergy().Get();
return GetStatLevel(energy, PlayerConstants.SL_ENERGY_CRITICAL, PlayerConstants.SL_ENERGY_LOW, PlayerConstants.SL_ENERGY_NORMAL, PlayerConstants.SL_ENERGY_HIGH);
}
EStatLevels GetStatLevelWater()
{
float water = GetStatWater().Get();
return GetStatLevel(water, PlayerConstants.SL_WATER_CRITICAL, PlayerConstants.SL_WATER_LOW, PlayerConstants.SL_WATER_NORMAL, PlayerConstants.SL_WATER_HIGH);
}
//!returns player's immunity level
/*
EStatLevels GetImmunityLevel()
{
float immunity = GetImmunity();
EStatLevels level;
if (immunity > PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_HIGH)
{
level = EStatLevels.GREAT;
}
else if (immunity > PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_NORMAL)
{
level = EStatLevels.HIGH;
}
else if (immunity > PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_LOW)
{
level = EStatLevels.MEDIUM;
}
else if (immunity > PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_CRITICAL)
{
level = EStatLevels.LOW;
}
else
{
level = EStatLevels.CRITICAL;
}
if (m_ImmunityBoosted && level != EStatLevels.GREAT)
{
level--;
}
return level;
}
*/
EStatLevels GetImmunityLevel()
{
float immunity = GetImmunity();
if (m_ImmunityBoosted)
return EStatLevels.GREAT;
return GetStatLevel(immunity, PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_CRITICAL, PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_LOW, PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_NORMAL, PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_HIGH);
}
//-------------------------------------
float GetBordersImmunity()
{
float immunity = GetImmunity();
float immmunity_max = 1;
return GetStatLevelBorders(immunity, PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_CRITICAL, PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_LOW, PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_NORMAL, PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_HIGH, immmunity_max);
}
float GetStatBordersHealth()
{
float health = GetHealth("","");
float health_max = GetMaxHealth("","");
return GetStatLevelBorders(health, PlayerConstants.SL_HEALTH_CRITICAL, PlayerConstants.SL_HEALTH_LOW, PlayerConstants.SL_HEALTH_NORMAL, PlayerConstants.SL_HEALTH_HIGH, health_max);
}
float GetStatBordersToxicity()
{
float toxicity = GetStatToxicity().Get();
float toxicity_max = GetStatToxicity().GetMax();
return GetStatLevelBorders(toxicity, PlayerConstants.SL_HEALTH_CRITICAL, PlayerConstants.SL_HEALTH_LOW, PlayerConstants.SL_HEALTH_NORMAL, PlayerConstants.SL_HEALTH_HIGH, toxicity_max);
}
float GetStatBordersBlood()
{
float blood = GetHealth("","Blood");
float blood_max = GetMaxHealth("","Blood");
return GetStatLevelBorders(blood, PlayerConstants.SL_BLOOD_CRITICAL, PlayerConstants.SL_BLOOD_LOW, PlayerConstants.SL_BLOOD_NORMAL, PlayerConstants.SL_BLOOD_HIGH, blood_max);
}
float GetStatBordersEnergy()
{
float energy = GetStatEnergy().Get();
float energy_max = GetStatEnergy().GetMax();
return GetStatLevelBorders(energy, PlayerConstants.SL_ENERGY_CRITICAL, PlayerConstants.SL_ENERGY_LOW, PlayerConstants.SL_ENERGY_NORMAL, PlayerConstants.SL_ENERGY_HIGH, energy_max);
}
float GetStatBordersWater()
{
float water = GetStatWater().Get();
float water_max = GetStatWater().GetMax();
return GetStatLevelBorders(water, PlayerConstants.SL_WATER_CRITICAL, PlayerConstants.SL_WATER_LOW, PlayerConstants.SL_WATER_NORMAL, PlayerConstants.SL_WATER_HIGH, water_max);
}
//------------------------------------
float GetStatLevelBorders(float stat_value, float critical, float low, float normal, float high, float max)
{
if (stat_value <= critical)
{
return Math.InverseLerp(0, critical, stat_value);
}
if (stat_value <= low)
{
return Math.InverseLerp(critical, low, stat_value);
}
if (stat_value <= normal)
{
return Math.InverseLerp(low, normal, stat_value);
}
if (stat_value <= high)
{
return Math.InverseLerp(normal, high, stat_value);
}
return Math.InverseLerp(high, max, stat_value);
}
EStatLevels GetStatLevel(float stat_value, float critical, float low, float normal, float high)
{
if (stat_value <= critical)
{
return EStatLevels.CRITICAL;
}
if (stat_value <= low)
{
return EStatLevels.LOW;
}
if (stat_value <= normal)
{
return EStatLevels.MEDIUM;
}
if (stat_value <= high)
{
return EStatLevels.HIGH;
}
return EStatLevels.GREAT;
}
void SetImmunityBoosted(bool boosted)
{
m_ImmunityBoosted = boosted;
}
//!returns player's immunity strength between 0..1
float GetImmunity()
{
float immunity;
if (GetPlayerStats())
{
float max_health = GetMaxHealth("GlobalHealth", "Health") + 0.01;//addition to prevent divisioin by zero in case of some messup
float max_blood = GetMaxHealth("GlobalHealth", "Blood") + 0.01;//addition to prevent divisioin by zero in case of some messup
float energy_normalized = GetStatEnergy().Get() / PlayerConstants.SL_ENERGY_MAX;
float water_normalized = GetStatWater().Get() / PlayerConstants.SL_WATER_MAX;
float health_normalized = GetHealth("GlobalHealth", "Health") / max_health;
float blood_normalized = GetHealth("GlobalHealth", "Blood") / max_blood;
immunity = energy_normalized + water_normalized + health_normalized + blood_normalized;
immunity = immunity / 4;//avg
immunity = Math.Clamp(immunity,0,1);
}
return immunity;
}
bool IsSprinting()
{
return m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENT_SPRINT);
}
bool CanSprint()
{
ItemBase item = GetItemInHands();
if (IsRaised() || (item && item.IsHeavyBehaviour()))
return false;
if (item && GetThrowing() && GetThrowing().IsThrowingModeEnabled())
return false;
if (GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS)
return false;
return true;
}
bool IsInProne()
{
return m_MovementState.IsInProne();
}
bool IsInRasedProne()
{
return m_MovementState.IsInRaisedProne();
}
bool IsLeaning()
{
return m_MovementState.IsLeaning();
}
bool IsRolling()
{
return GetCommand_Move() && GetCommand_Move().IsInRoll());
}
/*
override bool IsRaised()
{
//GetMovementState(m_MovementState);
return m_MovementState.IsRaised();
}
*/
bool IsClimbing()
{
return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_CLIMB;
}
bool IsFalling()
{
return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_FALL;
}
override bool IsFighting()
{
return m_IsFighting;
}
bool IsEmotePlaying()
{
if (m_EmoteManager)
{
return m_EmoteManager.IsEmotePlaying();
}
else
{
return false;
}
}
override bool IsIgnoredByConstruction()
{
return IsRuined();
}
/*!
Returns whether the specified movement command(s) are starting the next frame.
Use caution when using this for anything player animation-related, some commands may require the movement state to be truly active (wait until next update)
*/
bool AnimCommandCheck(HumanMoveCommandID mask)
{
return m_AnimCommandStarting & mask;
}
void RunFightBlendTimer()
{
if (!m_FightEndBlendTimer)
m_FightEndBlendTimer = new Timer();
if (!m_FightEndBlendTimer.IsRunning())
{
m_FightEndBlendTimer.Run(PlayerConstants.MELEE2_MOVEMENT_BLEND_DELAY,this,"EndFighting");
}
}
void EndFighting()
{
m_IsFighting = false;
}
bool CheckMeleeItemDamage(ItemBase item)
{
//on-hit drop of melee weapons
//bayonets & buttstocks
if (item && item.GetHierarchyParent() && item.GetHierarchyParent().IsWeapon() && item.IsRuined()/*&& item.FindAttachmentBySlotName()*/)
{
PlayAttachmentDropSound();
return DropItem(item);
}
//handheld items themselves
if (item && item == GetItemInHands() && item.IsRuined())
{
return PredictiveDropEntity(item);
}
return false;
}
void PlayAttachmentDropSound()
{
//TODO
}
// -------------------------------------------------------------------------
override void RPC(int rpc_type, array<ref Param> params, bool guaranteed, PlayerIdentity recipient = NULL)
{
super.RPC(rpc_type, params, guaranteed, recipient);
}
// -------------------------------------------------------------------------
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
{
super.OnRPC(sender, rpc_type, ctx);
switch (rpc_type)
{
#ifndef SERVER
case ERPCs.RPC_SYNC_DISPLAY_STATUS:
if (GetVirtualHud())
{
GetVirtualHud().OnRPC(ctx);
}
break;
case ERPCs.RPC_PLAYER_SYMPTOM_ON:
if (GetSymptomManager())
{
GetSymptomManager().OnRPC(ERPCs.RPC_PLAYER_SYMPTOM_ON, ctx);
}
break;
case ERPCs.RPC_PLAYER_SYMPTOM_OFF:
if (GetSymptomManager())
{
GetSymptomManager().OnRPC(ERPCs.RPC_PLAYER_SYMPTOM_OFF, ctx);
}
break;
case ERPCs.RPC_DAMAGE_VALUE_SYNC:
if (m_TrasferValues)
m_TrasferValues.OnRPC(ctx);
break;
case ERPCs.RPC_USER_ACTION_MESSAGE:
if (!GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
break;
}
if (ctx.Read(m_UAParamMessage))
{
string actiontext = m_UAParamMessage.param1;
MessageAction(actiontext);
}
break;
case ERPCs.RPC_SOFT_SKILLS_SPECIALTY_SYNC:
ref Param1<float> p_synch = new Param1<float>(0);
ctx.Read(p_synch);
float specialty_level = p_synch.param1;
GetSoftSkillsManager().SetSpecialtyLevel(specialty_level);
break;
case ERPCs.RPC_SOFT_SKILLS_STATS_SYNC:
ref Param5<float, float, float, float, bool> p_debug_synch = new Param5<float, float ,float, float, bool>(0, 0, 0, 0, false);
ctx.Read(p_debug_synch);
float general_bonus_before = p_debug_synch.param1;
float general_bonus_after = p_debug_synch.param2;
float last_UA_value = p_debug_synch.param3;
float cooldown_value = p_debug_synch.param4;
float cooldown_active = p_debug_synch.param5;
GetSoftSkillsManager().SetGeneralBonusBefore(general_bonus_before);
GetSoftSkillsManager().SetGeneralBonusAfter(general_bonus_after);
GetSoftSkillsManager().SetLastUAValue(last_UA_value);
GetSoftSkillsManager().SetCoolDownValue(cooldown_value);
GetSoftSkillsManager().SetCoolDown(cooldown_active);
break;
case ERPCs.RPC_WARNING_ITEMDROP:
{
if (GetGame().IsClient() && GetGame().GetUIManager() && !GetGame().GetUIManager().FindMenu(MENU_WARNING_ITEMDROP))
{
GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_WARNING_ITEMDROP,null);
GetGame().GetMission().AddActiveInputExcludes({"menu"});
}
break;
}
case ERPCs.RPC_WARNING_TELEPORT:
{
if (GetGame().IsClient() && GetGame().GetUIManager() && !GetGame().GetUIManager().FindMenu(MENU_WARNING_TELEPORT))
{
GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(GetGame().GetUIManager().EnterScriptedMenu,MENU_WARNING_TELEPORT,null);
GetGame().GetMission().AddActiveInputExcludes({"menu"});
}
break;
}
case ERPCs.RPC_INIT_SET_QUICKBAR:
ref Param1<int> count = new Param1<int>(0);
if (ctx.Read(count));
{
for (int i = 0; i < count.param1 ; i++)
{
m_QuickBarBase.OnSetEntityRPC(ctx);
}
}
break;
case ERPCs.RPC_SYNC_THERMOMETER:
{
float value;
if (ctx.Read(value))
m_Hud.SetTemperature(value.ToString() + "#degrees_celsius");
break;
}
case ERPCs.RPC_CHECK_PULSE:
ctx.Read(CachedObjectsParams.PARAM1_INT);
EPulseType pulse;
if ((CachedObjectsParams.PARAM1_INT.param1 & ActionCheckPulse.TARGET_IRREGULAR_PULSE_BIT) == 0)
{
pulse = EPulseType.REGULAR;
}
else
{
pulse = EPulseType.IRREGULAR;
}
int blood_level = ~ActionCheckPulse.TARGET_IRREGULAR_PULSE_BIT & CachedObjectsParams.PARAM1_INT.param1;
if (m_CheckPulseLastTarget)
{
m_CheckPulseLastTarget.SetLastUAMessage(ActionCheckPulse.GetPulseMessage(pulse, blood_level));
}
break;
//! uses contants outside of ERPCs !!!!
//woodcutting
case PlantType.TREE_HARD:
SoundHardTreeFallingPlay();
break;
case PlantType.TREE_SOFT:
SoundSoftTreeFallingPlay();
break;
case PlantType.BUSH_HARD:
SoundHardBushFallingPlay();
break;
case PlantType.BUSH_SOFT:
SoundSoftBushFallingPlay();
break;
case ERPCs.RPC_DEBUG_MONITOR_FLT:
if (m_DebugMonitorValues)
{
m_DebugMonitorValues.OnRPCFloat(ctx);
}
break;
case ERPCs.RPC_DEBUG_MONITOR_STR:
if (m_DebugMonitorValues)
{
m_DebugMonitorValues.OnRPCString(ctx);
}
break;
#endif
/*
case ERPCs.RPC_CRAFTING_INVENTORY_INSTANT:
ref Param3<int, ItemBase, ItemBase> craftParam = new Param3<int, ItemBase, ItemBase>(-1, NULL, NULL);
if (ctx.Read(craftParam))
{
m_ModuleRecipesManager.PerformRecipeServer(craftParam.param1, craftParam.param2, craftParam.param3, this);
}
break;
*/
#ifdef DIAG_DEVELOPER
case ERPCs.DEV_RPC_AGENT_RESET:
{
bool val;
if (ctx.Read(val))
m_AgentPool.RemoveAllAgents();
break;
}
case ERPCs.DEV_PLAYER_DEBUG_REQUEST:
{
PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast(GetPlugin(PluginRemotePlayerDebugServer));
plugin_remote_server.OnRPC(ctx, this);
break;
}
case ERPCs.DEV_PLAYER_DEBUG_DATA:
{
PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
PluginDeveloper plugin_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
if (plugin_dev.m_ScriptConsole)
plugin_dev.m_ScriptConsole.OnRPCEx(rpc_type, ctx);
else
plugin_remote_client.OnRPC(ctx);
break;
}
case ERPCs.DEV_AGENT_GROW:
{
m_AgentPool.RemoteGrowRequestDebug(ctx);
break;
}
case ERPCs.RPC_ITEM_DIAG_CLOSE:
{
PluginItemDiagnostic mid = PluginItemDiagnostic.Cast(GetPlugin(PluginItemDiagnostic));
mid.StopWatchRequest(this);
break;
}
//! Universal Temperature Sources debug
case ERPCs.DEV_REQUEST_UTS_DEBUG:
{
PluginUniversalTemperatureSourceServer plugin_uts_server = PluginUniversalTemperatureSourceServer.Cast(GetPlugin(PluginUniversalTemperatureSourceServer));
plugin_uts_server.OnRPC(ctx, this);
break;
}
case ERPCs.DEV_UTS_DEBUG_DATA:
{
PluginUniversalTemperatureSourceClient plugin_uts_client = PluginUniversalTemperatureSourceClient.Cast(GetPlugin(PluginUniversalTemperatureSourceClient));
plugin_uts_client.OnRPC(ctx);
break;
}
//! ---
#endif
#ifdef DEVELOPER
case ERPCs.DEV_RPC_SERVER_SCRIPT:
{
//PluginItemDiagnostic plugin = PluginItemDiagnostic.Cast(GetPlugin(PluginItemDiagnostic));
//SetDebugDeveloper_item(plugin.GetWatchedItem(this));//!! needs to be inside DEVELOPER ifdef
if (ctx.Read(CachedObjectsParams.PARAM1_STRING))
{
_player = this;
string code = CachedObjectsParams.PARAM1_STRING.param1;
bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
CachedObjectsParams.PARAM1_BOOL.param1 = success;
RPCSingleParam(ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT, CachedObjectsParams.PARAM1_BOOL,true, GetIdentity());
}
break;
}
case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
{
PluginDeveloper dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
if (dev.m_ScriptConsole)
dev.m_ScriptConsole.OnRPCEx(rpc_type, ctx);
break;
}
case ERPCs.DEV_SET_DEV_ITEM:
{
Param1<EntityAI> ent = new Param1<EntityAI>(null);
if (ctx.Read(ent) && ent.param1)
{
PluginItemDiagnostic mid2 = PluginItemDiagnostic.Cast(GetPlugin(PluginItemDiagnostic));
mid2.RegisterDebugItem(ent.param1, this);
}
//SetDebugDeveloper_item(this);
break;
}
case ERPCs.RPC_ITEM_DIAG:
{
Param1<EntityAI> p1 = new Param1<EntityAI>(null);
if (ctx.Read(p1))
{
PluginItemDiagnostic plgn = PluginItemDiagnostic.Cast(GetPlugin(PluginItemDiagnostic));
plgn.OnRPC(p1.param1, ctx);
}
break;
}
#endif
}
#ifdef DIAG_DEVELOPER
PluginDeveloper module_rc = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
if (module_rc)
module_rc.OnRPC(this, rpc_type, ctx);
PluginDeveloperSync module_rcs = PluginDeveloperSync.Cast(GetPlugin(PluginDeveloperSync));
if (module_rcs)
module_rcs.OnRPC(this, rpc_type, ctx);
#ifdef SERVER
PluginDiagMenu plugin_diag_menu = PluginDiagMenu.Cast(GetPlugin(PluginDiagMenuServer));
#else
PluginDiagMenu plugin_diag_menu = PluginDiagMenu.Cast(GetPlugin(PluginDiagMenuClient));
#endif
if (plugin_diag_menu)
plugin_diag_menu.OnRPC(this, rpc_type, ctx);
#endif
}
override void OnGameplayDataHandlerSync()
{
super.OnGameplayDataHandlerSync();
UpdateLighting();
//Print("setting respawn to " + CfgGameplayHandler.GetDisableRespawnDialog());
GetGame().GetMission().SetRespawnModeClient(CfgGameplayHandler.GetDisableRespawnDialog());//TODO: maybe move to mission/game ?
SetHitPPEEnabled(CfgGameplayHandler.GetHitIndicationPPEEnabled());
}
void UpdateLighting()
{
Mission mission = GetGame().GetMission();
if (mission)
{
WorldLighting wLighting = mission.GetWorldLighting();
if (wLighting)
wLighting.SetGlobalLighting(CfgGameplayHandler.GetLightingConfig());
}
}
void SetContaminatedEffectEx(bool enable, int ppeIdx = -1, int aroundId = ParticleList.CONTAMINATED_AREA_GAS_AROUND, int tinyId = ParticleList.CONTAMINATED_AREA_GAS_TINY, string soundset = "", bool partDynaUpdate = false, int newBirthRate = 0)
{
if (enable) // enable
{
// We assume that if this is set to true the PPE is already active
if (m_ContaminatedAreaEffectEnabled == enable)
return;
if (aroundId !=0)
{
if (!m_ContaminatedAroundPlayer)
{
m_ContaminatedAroundPlayer = ParticleManager.GetInstance().PlayInWorld(aroundId, GetPosition());
}
// First entry in an area with dynamic tweaks to particles
if (partDynaUpdate)
{
m_ContaminatedAroundPlayer.SetParameter(0, EmitorParam.BIRTH_RATE, newBirthRate);
}
}
if (!m_ContaminatedAroundPlayerTiny && tinyId !=0)
{
m_ContaminatedAroundPlayerTiny = ParticleManager.GetInstance().PlayInWorld(tinyId, GetPosition());
}
if (ppeIdx != -1)
{
PPERequesterBase ppeRequester;
if (Class.CastTo(ppeRequester, PPERequesterBank.GetRequester(ppeIdx)))
ppeRequester.Start();
}
// We start playing the ambient sound
if (!m_AmbientContamination && soundset != "")
PlaySoundSetLoop(m_AmbientContamination, soundset, 0.1, 0.1);
}
else // disable
{
if (m_ContaminatedAroundPlayer)
{
m_ContaminatedAroundPlayer.Stop();
m_ContaminatedAroundPlayer = null;
}
if (m_ContaminatedAroundPlayerTiny)
{
m_ContaminatedAroundPlayerTiny.Stop();
m_ContaminatedAroundPlayerTiny = null;
}
if (ppeIdx != -1)
PPERequesterBank.GetRequester(ppeIdx).Stop(new Param1<bool>(true)); //fade out
// We stop the ambient sound
if (m_AmbientContamination)
StopSoundSet(m_AmbientContamination);
// We make sure to reset the state
}
m_ContaminatedAreaEffectEnabled = enable;
}
void SetContaminatedEffect(bool enable, int ppeIdx = -1, int aroundId = ParticleList.CONTAMINATED_AREA_GAS_AROUND, int tinyId = ParticleList.CONTAMINATED_AREA_GAS_TINY, bool partDynaUpdate = false, int newBirthRate = 0)
{
SetContaminatedEffectEx(enable, ppeIdx, aroundId, tinyId, "", partDynaUpdate, newBirthRate);
}
// -------------------------------------------------------------------------
void UpdateCorpseState()
{
UpdateCorpseStateVisual();
if (m_CorpseState > 0)
SetDecayEffects(Math.AbsInt(m_CorpseState));
else if (m_CorpseState < 0)
SetDecayEffects();//no params means remove the effects
m_CorpseStateLocal = m_CorpseState;
}
// -------------------------------------------------------------------------
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
{
super.EEHealthLevelChanged(oldLevel, newLevel, zone);
if (!GetGame().IsDedicatedServer())
{
if (newLevel == GameConstants.STATE_RUINED)
{
ClearLastUAMessage();
}
if (m_CorpseState != 0)
{
GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseState, 0, false);
}
}
}
// -------------------------------------------------------------------------
override void OnVariablesSynchronized()
{
super.OnVariablesSynchronized();
if (m_ModuleLifespan)
{
m_ModuleLifespan.SynchLifespanVisual(this, m_LifeSpanState, m_HasBloodyHandsVisible, m_HasBloodTypeVisible, m_BloodType);
if (m_LifespanLevelLocal != m_LifeSpanState) //client solution, lifespan level changed
{
m_LifespanLevelLocal = m_LifeSpanState;
UpdateHairSelectionVisibility();
}
}
CheckSoundEvent();
if (GetBleedingManagerRemote() && IsPlayerLoaded())
{
GetBleedingManagerRemote().OnVariablesSynchronized(GetBleedingBits());
}
if (m_CorpseStateLocal != m_CorpseState && (IsPlayerLoaded() || IsControlledPlayer()))
{
UpdateCorpseState();
}
if (m_RefreshAnimStateIdx != m_LocalRefreshAnimStateIdx)
{
RefreshHandAnimationState(396); //mean animation blend time
m_LocalRefreshAnimStateIdx = m_RefreshAnimStateIdx;
}
if (m_InsideEffectArea != m_InsideEffectAreaPrev)
{
if (m_InsideEffectArea)
{
OnPlayerIsNowInsideEffectAreaBeginClient();
}
else
{
OnPlayerIsNowInsideEffectAreaEndClient();
}
m_InsideEffectAreaPrev = m_InsideEffectArea;
}
//-------MODIFIERS START--------
if (m_SyncedModifiers != m_SyncedModifiersPrev)
{
int diff = (m_SyncedModifiers & ~m_SyncedModifiersPrev) | (~m_SyncedModifiers & m_SyncedModifiersPrev);//XOR gets us a mask for modifiers that changed by either deactivating, or activating
if (eModifierSyncIDs.MODIFIER_SYNC_DROWNING & diff)//has this modifier's status as active/inactive changed ?
{
if (eModifierSyncIDs.MODIFIER_SYNC_DROWNING & m_SyncedModifiers)//is this modifier currently active ? if so, it means it's been just activated
{
SetDrowning(true);
}
else
{
SetDrowning(false);
}
}
m_SyncedModifiersPrev = m_SyncedModifiers;
}
//-------MODIFIERS END--------
HandleBrokenLegsSync();
//! Remotely Activated Item Behaviour refresh on item is in hands
ItemBase itemHands = GetItemInHands();
if (itemHands)
{
RemotelyActivatedItemBehaviour raib = itemHands.GetRemotelyActivatedItemBehaviour();
if (raib)
{
raib.OnVariableSynchronized();
}
}
}
//! Checks whether modifier (which has syncing enabled) is currently active, works on both Client and Server
bool IsSyncedModifierActive(eModifierSyncIDs modifier)
{
return (m_SyncedModifiers & m_SyncedModifiersPrev);
}
void HandleBrokenLegsSync()
{
if (m_BrokenLegState != m_LocalBrokenState)
{
m_LocalBrokenState = m_BrokenLegState;
bool initial = (m_BrokenLegState < 0);
int state = GetBrokenLegs();
if (state == eBrokenLegs.BROKEN_LEGS)
{
//Print(m_BrokenLegState);
if (initial)// <0 values indicate initial activation
{
//Print("synced variables - inital activation of broken legs");
BreakLegSound();
}
else
{
//Print("synced variables - secondary activation of broken legs");
}
}
}
}
void FixAllInventoryItems()
{
array<EntityAI> items = new array<EntityAI>;
GetInventory().EnumerateInventory(InventoryTraversalType.INORDER, items);
foreach (EntityAI item : items)
{
item.SetHealthMax("","");
}
}
void OnInventoryMenuOpen()
{
}
void OnInventoryMenuClose()
{
}
//--------------------------------------------------------------------------
void OnSelectPlayer()
{
//Print("PlayerBase | OnSelectPlayer()");
m_PlayerSelected = true;
m_QuickBarBase.updateSlotsCount();
m_WeaponManager.SortMagazineAfterLoad();
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
{
PlayerIdentity identity = GetIdentity();
if (identity)
{
m_CachedPlayerID = identity.GetId();
m_CachedPlayerName = identity.GetName();
}
//! add callbacks for ai target system
SetAITargetCallbacks(new AITargetCallbacksPlayer(this));
array<ref Param> params = new array<ref Param>;
if (m_aQuickBarLoad)
{
int count = m_aQuickBarLoad.Count();
Param1<int> paramCount = new Param1<int>(count);
params.Insert(paramCount);
for (int i = 0; i < count; i++)
{
m_QuickBarBase.OnSetEntityNoSync(m_aQuickBarLoad.Get(i).param1,m_aQuickBarLoad.Get(i).param2);
params.Insert(m_aQuickBarLoad.Get(i));
}
if (count > 0 && GetGame().IsMultiplayer())
{
GetGame().RPC(this, ERPCs.RPC_INIT_SET_QUICKBAR, params, true, identity);
}
m_aQuickBarLoad = NULL;
}
GetSoftSkillsManager().InitSpecialty(GetStatSpecialty().Get());
GetModifiersManager().SetModifiers(true);
SetSynchDirty();
if (GetGame().IsMultiplayer())
{
//Drop item warning
if (m_ProcessUIWarning)
{
GetGame().RPCSingleParam(this, ERPCs.RPC_WARNING_ITEMDROP, null, true, identity);
m_ProcessUIWarning = false;
}
GetGame().GetMission().SyncRespawnModeInfo(identity);
}
}
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
{
m_ActionManager = new ActionManagerServer(this);
m_ConstructionActionData = new ConstructionActionData();
CheckForGag();
}
else if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
m_ActionManager = new ActionManagerClient(this);
m_CraftingManager = new CraftingManager(this,m_ModuleRecipesManager);
m_ConstructionActionData = new ConstructionActionData();
}
else if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER)
{
m_ActionManager = new ActionManagerServer(this);
}
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
//m_PlayerLightManager = new PlayerLightManager(this);
if (GetGame().GetMission())
{
GetGame().GetMission().ResetGUI();
// force update player
GetDayZGame().GetBacklit().UpdatePlayer(true);
}
m_DeathCheckTimer = new Timer();
m_DeathCheckTimer.Run(0.1, this, "CheckDeath", null, true);
PPEManagerStatic.GetPPEManager().StopAllEffects(PPERequesterCategory.ALL);
CheckForBurlap();
int characterCount = GetGame().GetMenuData().GetCharactersCount() - 1;
int idx = GetGame().GetMenuData().GetLastPlayedCharacter();
if (idx == GameConstants.DEFAULT_CHARACTER_MENU_ID || idx > characterCount)
{
GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(SetNewCharName);
}
GetGame().GetMission().EnableAllInputs(true);
m_PresenceNotifier = PluginPresenceNotifier.Cast(GetPlugin(PluginPresenceNotifier));
m_PresenceNotifier.Init(this);
OnGameplayDataHandlerSync();//only here for legacy reasons
}
#ifdef BOT
m_Bot = new Bot(this);
m_Bot.Start(true, new MyBotTrigger(this));
#endif
}
override void SimulateDeath(bool state)
{
super.SimulateDeath(state);
m_UndergroundHandler = null;
if (m_EffectWidgets)
{
m_EffectWidgets.StopAllEffects();
m_EffectWidgets.ClearSuspendRequests();
}
}
void SetNewCharName()
{
g_Game.GetMenuData().SaveCharacter(false, true);
g_Game.GetMenuData().SetCharacterName(g_Game.GetMenuData().GetLastPlayedCharacter(), g_Game.GetMenuDefaultCharacterData(false).GetCharacterName());
g_Game.GetMenuData().SaveCharactersLocal();
}
void CheckForBurlap()
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
BurlapSackCover attachment;
Class.CastTo(attachment, GetInventory().FindAttachment(InventorySlots.HEADGEAR));
PPERequester_BurlapSackEffects req;
if (Class.CastTo(req,PPERequesterBank.GetRequester(PPERequesterBank.REQ_BURLAPSACK)))
{
if (attachment)
{
req.Start();
}
else if (req.IsRequesterRunning())
{
PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Stop();
}
}
}
}
void CheckForGag()
{
#ifdef SERVER
Clothing item;
Class.CastTo(item, GetInventory().FindAttachment(InventorySlots.MASK));
if (!item)
{
Class.CastTo(item, GetInventory().FindAttachment(InventorySlots.HEADGEAR));
}
if (item && item.IsObstructingVoice())
{
item.MutePlayer(this,true);
}
else //should probably check for relevant types before removing mumbling and obstruction specifically..
{
GetGame().SetVoiceEffect(this, VoiceEffectMumbling, false);
GetGame().SetVoiceEffect(this, VoiceEffectObstruction, false);
}
#endif
}
void UpdateMaskBreathWidget(notnull MaskBase mask, bool is_start = false)
{
if (is_start)
m_EffectWidgets.ResetMaskUpdateCount();
float resistance = 0;
if (mask.HasIntegratedFilter() || mask.IsExternalFilterAttached())
resistance = 1 - mask.GetFilterQuantity01();
m_EffectWidgets.OnVoiceEvent(resistance);
m_EffectWidgets.IncreaseMaskUpdateCount();
}
// -------------------------------------------------------------------------
void OnVoiceEvent(PlayerSoundEventBase voice_event)
{
if (m_EffectWidgets)
{
MaskBase mask = MaskBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
if (mask)
{
UpdateMaskBreathWidget(mask, true);
//m_EffectWidgets.SetBreathIntensityStamina(GetStaminaHandler().GetStaminaCap(),GetStaminaHandler().GetStamina());
}
}
}
// -------------------------------------------------------------------------
//! called every cmd handler tick during a playback of PlayerSoundEvent, m_ProcessPlaybackEvent needs to be enabled on the PlayerSoundEvent
void OnVoiceEventPlayback(PlayerSoundEventBase voice_event, AbstractWave callback, float playback_time)
{
if (m_EffectWidgets)
{
MaskBase mask = MaskBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
if (mask)
{
if (m_EffectWidgets.m_MaskWidgetUpdateCount < 2 && callback.GetLength() > 2 && playback_time > 0.5 )
UpdateMaskBreathWidget(mask);
}
}
}
// -------------------------------------------------------------------------
override bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
{
if (super.OnInputUserDataProcess(userDataType, ctx))
return true;
if (m_QuickBarBase.OnInputUserDataProcess(userDataType, ctx))
return true;
if (m_WeaponManager.OnInputUserDataProcess(userDataType, ctx))
return true;
if (HandleRemoteItemManipulation(userDataType, ctx))
return true;
if (userDataType == INPUT_UDT_INVENTORY && GetHumanInventory().OnInputUserDataProcess(ctx))
return true;
if (TogglePlacingServer(userDataType, ctx))
return true;
if (ResetADSPlayerSync(userDataType, ctx))
return true;
string uid;
bool mute;
if (userDataType == INPUT_UDT_USER_MUTE_XBOX)
{
if (ctx.Read(uid) && ctx.Read(mute))
{
GetGame().MutePlayer(uid, GetIdentity().GetPlainId(), mute);
// commented because plainID should not be present in logs
//Print("Player: " + GetIdentity().GetId() + " set mute for " + uid + " to " + mute);
}
}
if (m_EmoteManager && userDataType == INPUT_UDT_GESTURE)
return m_EmoteManager.OnInputUserDataProcess(userDataType, ctx);
if (userDataType == INPUT_UDT_WEAPON_LIFT_EVENT)
return ReadLiftWeaponRequest(userDataType, ctx);
if (m_ActionManager)
return m_ActionManager.OnInputUserDataProcess(userDataType, ctx);
return false;
}
float GetHealthRegenSpeed()
{
float blood = GetHealth("GlobalHealth", "Blood");
float blood_scale_normalized = Math.InverseLerp(PlayerConstants.BLOOD_THRESHOLD_FATAL, GetMaxHealth("", "Blood"), blood);
blood_scale_normalized = Math.Clamp(blood_scale_normalized,0,1);
return Math.Lerp(PlayerConstants.HEALTH_REGEN_MIN, PlayerConstants.HEALTH_REGEN_MAX, blood_scale_normalized);
}
bool HandleRemoteItemManipulation(int userDataType, ParamsReadContext ctx)
{
if (userDataType == INPUT_UDT_ITEM_MANIPULATION)
{
int type = -1;
ItemBase item1 = null;
ItemBase item2 = null;
bool use_stack_max = false;
int slot_id = -1;
if (!ctx.Read(type))
return false;
if (type == 4)
{
if (!ctx.Read(item1))
return false;
InventoryLocation dst = new InventoryLocation;
if (dst.ReadFromContext(ctx))
{
//Print(InventoryLocation.DumpToStringNullSafe(dst));
bool dummy;
if (ctx.Read(dummy))
item1.SplitItemToInventoryLocation(dst);
else
item1.SplitIntoStackMaxToInventoryLocation(dst);
return true;
}
return false;
}
if (!ctx.Read(item1))
return false;
if (!ctx.Read(item2))
return false;
if (!ctx.Read(use_stack_max))
return false;
if (!ctx.Read(slot_id))
return false;
if (type == -1 && item1 && item2)//combine
{
item1.CombineItems(item2, use_stack_max);
}
else if (type == 1 && item1)
{
if (use_stack_max)
item1.SplitIntoStackMax(item2, slot_id, this);
else
item1.SplitItem(this);
}
else if (type == 2 && item1)
{
int row, col;
if (!ctx.Read(row))
return false;
if (!ctx.Read(col))
return false;
item1.SplitIntoStackMaxCargo(item2, slot_id, row, col);
}
else if (type == 3 && item1)
{
item1.SplitIntoStackMaxHands(this);
}
return true;
}
return false;
}
// -------------------------------------------------------------------------
ItemBase GetItemInHands()
{
if (GetHumanInventory())
{
return ItemBase.Cast(GetHumanInventory().GetEntityInHands());
}
return null;
}
//--------------------------------------------------------------------------
override EntityAI SpawnEntityOnGroundPos(string object_name, vector pos)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
{
bool is_AI = GetGame().IsKindOf(object_name, "DZ_LightAI");
if (is_AI)
{
return SpawnAI(object_name, pos);
}
else
{
InventoryLocation inv_loc = new InventoryLocation;
vector mtx[4];
Math3D.MatrixIdentity4(mtx);
mtx[3] = pos;
inv_loc.SetGround(NULL, mtx);
//return GetGame().SpawnEntity(object_name, inv_loc, ECE_PLACE_ON_SURFACE, RF_DEFAULT);
return EntityAI.Cast(GetGame().CreateObjectEx(object_name, inv_loc.GetPos(), ECE_PLACE_ON_SURFACE));
}
}
return null;
}
EntityAI SpawnEntityOnGroundOnCursorDir(string object_name, float distance)
{
vector position = GetPosition() + (GetDirection() * distance);
return SpawnEntityOnGroundPos(object_name, position);
}
EntityAI SpawnAI(string object_name, vector pos)
{
bool is_ai = GetGame().IsKindOf(object_name, "DZ_LightAI");
if (is_ai)
{
return EntityAI.Cast(GetGame().CreateObjectEx(object_name, pos, ECE_PLACE_ON_SURFACE|ECE_INITAI|ECE_EQUIP_ATTACHMENTS));
}
return NULL;
}
/**
\brief Spawn item on server side
\param object_name \p string Name of item class
\param spawn_type \int(const) Type of spawning const: SPAWNTYPE_GROUND, SPAWNTYPE_HANDS, SPAWNTYPE_INVENTORY
\param full_quantity \bool Spawn with full quantity of item
\param distance \float Distance of spawn position from player (Only if spawn_type = SPAWNTYPE_GROUND)
\returns \p ItemBase Spawned item
@code
PlayerBase player = GetGame().GetPlayer();
player.SpawnItem("Fruit_Apple", SPAWNTYPE_GROUND, true, 5);
@endcode
*/
/*EntityAI SpawnItem (string object_name, bool full_quantity, float distance = 0, bool usePosition = false, vector pos = "0 0 0", EntityAI attachmentObject = NULL)
{
EntityAI entity = NULL;
// Creat Object
bool is_ai = GetGame().IsKindOf(object_name, "DZ_LightAI");
vector item_position;
if (usePosition)
{
item_position = pos;
}
else
{
item_position = GetPosition() + (GetDirection() * distance);
}
entity = GetGame().CreateObject(object_name, item_position, false, is_ai);
if (!entity)
{
string s = "Cannot spawn entity: "+object_name;
Print(s);
//g_Game.GetUIManager().ShowDialog("Spawn error", "Cannot spawn item: "+object_name, 0, DBT_OK, DBB_YES, DMT_EXCLAMATION, this);
return NULL;
}
if (entity.IsInherited(ItemBase))
{
ItemBase item = entity;
// Set full quantity
if (full_quantity)
{
item.SetQuantity(item.GetQuantityMax());
}
// Spawn In Inventory
if (spawn_type == SPAWNTYPE_INVENTORY)
{
TakeItemToInventory(item);
}
// Spawn In Hands
if (spawn_type == SPAWNTYPE_HANDS)
{
TakeItemToHands(item);
}
// Spawn As Attachment
if (spawn_type == SPAWNTYPE_ATTACHMENT)
{
Object cursor_obj = GetCursorObject();
if (cursor_obj != NULL && cursor_obj.IsInherited(EntityAI))
{
EntityAI eai = (EntityAI)cursor_obj;
eai.TakeEntityAsAttachment(item);
}
else if (attachmentObject != NULL)
{
attachmentObject.TakeEntityAsAttachment(item);
}
}
}
return entity;
}*/
//--------------------------------------------------------------------------
bool DropItem(ItemBase item)
{
bool can_be_dropped = CanDropEntity(item);
if (can_be_dropped)
{
can_be_dropped = PredictiveDropEntity(item);
}
vector pos_spawn = GetPosition() + GetDirection();
pos_spawn[0] = pos_spawn[0] + Math.RandomFloat(-0.2, 0.2);
pos_spawn[2] = pos_spawn[2] + Math.RandomFloat(-0.2, 0.2);
item.SetPosition(pos_spawn);
item.PlaceOnSurface();
return can_be_dropped;
}
// -------------------------------------------------------------------------
/**
/brief Creates \p ItemBase in players inventory. If player dont have enough slots for new item, item will be created on the ground under player.
\param item_name \p string Class name of ItemBase in configs
\returns \p ItemBase Created item
@code
ItemBase item = g_Game.GetPlayer().CreateInInventory("Consumable_GardenLime", "cargo_weapon");
@endcode
*/
EntityAI CreateInInventory(string item_name, string cargo_type = "", bool full_quantity = false) // TODO: Create item in cargo
{
InventoryLocation inv_loc = new InventoryLocation;
if (GetInventory().FindFirstFreeLocationForNewEntity(item_name, FindInventoryLocationType.ANY, inv_loc))
{
return SpawnItemOnLocation(item_name, inv_loc, full_quantity);
}
return NULL;
}
// -------------------------------------------------------------------------
/**
/brief Creates copy of \p ItemBase in players inventory. If player dont have enough slots for new item, item will be created on the ground under player.
\param item_name \p string Class name of ItemBase in configs
\returns \p ItemBase Created item
@code
ItemBase item = g_Game.GetPlayer().CreateInInventory("Consumable_GardenLime", "cargo_weapon");
@endcode
*/
/*ItemBase CopyInventoryItem(ItemBase orig_item)
{
ItemBase item = ItemBase.Cast(GetInventory().CreateInInventory(orig_item.GetType()));
if (item == NULL)
{
return NULL;
}
// Copy of quantity
item.SetQuantity(orig_item.GetQuantity());
// Copy of damage
item.SetHealth("", "", orig_item.GetHealth("", ""));
return item;
}*/
ItemBase CreateCopyOfItemInInventory (ItemBase src)
{
InventoryLocation loc = new InventoryLocation;
string t = src.GetType();
if (GetInventory().FindFirstFreeLocationForNewEntity(t, FindInventoryLocationType.CARGO, loc))
{
bool locked = GetGame().HasInventoryJunctureDestination(this, loc);
if (locked)
{
Print("Warning: Split: CreateCopyOfItemInInventory - Cannot create entity at locked inventory at loc=" + InventoryLocation.DumpToStringNullSafe(loc));
return null;
}
ItemBase dst = ItemBase.Cast(GetInventory().LocationCreateLocalEntity(loc, t, ECE_IN_INVENTORY, RF_DEFAULT));
if (dst)
{
MiscGameplayFunctions.TransferItemProperties(src, dst);
GetGame().RemoteObjectTreeCreate(dst);
Print("CreateCopyOfItemInInventory - created " + dst.GetName() + " at loc=" + InventoryLocation.DumpToStringNullSafe(loc));
}
return dst;
}
return NULL;
}
ItemBase CreateCopyOfItemInInventoryOrGround(ItemBase src)
{
return CreateCopyOfItemInInventoryOrGroundEx(src, false);
}
ItemBase CreateCopyOfItemInInventoryOrGroundEx(ItemBase src, bool markItemAsSplitResult = false)
{
ItemBase dst = CreateCopyOfItemInInventory(src);
if (!dst)
{
dst = ItemBase.Cast(SpawnEntityOnGroundPos(src.GetType(), this.GetPosition()));
dst.PlaceOnSurface();
dst.SetResultOfSplit(markItemAsSplitResult);
MiscGameplayFunctions.TransferItemProperties(src, dst);
}
return dst;
}
// -------------------------------------------------------------------------
/**
colorStatusChannel
colorAction
colorFriendly
colorImportant
*/
void Message(string text, string style)
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
{
GetGame().ChatMP(this, text, style);
}
else
{
GetGame().Chat(text, style);
}
}
// -------------------------------------------------------------------------
void MessageStatus(string text)
{
Message(text, "colorStatusChannel");
}
// -------------------------------------------------------------------------
void MessageAction(string text)
{
Message(text, "colorAction");
}
// -------------------------------------------------------------------------
void MessageFriendly(string text)
{
Message(text, "colorFriendly");
}
// -------------------------------------------------------------------------
void MessageImportant(string text)
{
Message(text, "colorImportant");
}
void CloseInventoryMenu()
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
#ifndef NO_GUI
UIScriptedMenu menu = GetGame().GetUIManager().GetMenu();
if (menu && (menu.GetID() == MENU_INVENTORY || menu.GetID() == MENU_INSPECT))
{
GetGame().GetUIManager().CloseAll();
GetGame().GetMission().RemoveActiveInputExcludes({"inventory"},false);
GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
}
#endif
}
}
// -------------------------------------------------------------------------
/**
/brief Delete all items in inventory
\returns \p void
@code
PlayerBase player = GetGame().GetPlayer();
player.ClearInventory();
@endcode
*/
override void ClearInventory()
{
if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
{
GameInventory inv = PlayerBase.Cast(this).GetInventory();
array<EntityAI> items = new array<EntityAI>;
inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
for (int i = 0; i < items.Count(); i++)
{
ItemBase item = ItemBase.Cast(items.Get(i));
if (item)
{
GetGame().ObjectDelete(item);
}
}
ItemBase item_in_hands = ItemBase.Cast(GetHumanInventory().GetEntityInHands());
if (item_in_hands)
{
LocalDestroyEntityInHands();
}
}
}
//! Drops all clothes/wearables this character is carrying on themselves.
void DropAllItems()
{
array<EntityAI> itemsArray = new array<EntityAI>;
ItemBase item;
GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, itemsArray);
int count = itemsArray.Count();
for (int i = 0; i < itemsArray.Count(); i++)
{
Class.CastTo(item, itemsArray.Get(i));
if (item && !item.IsInherited(SurvivorBase))
{
ServerDropEntity(item);
}
}
}
string GetPlayerClass()
{
string type;
GetGame().ObjectGetType(this, type);
return type;
}
// --------------------------------------------------
// Lifespan
//---------------------------------------------------
void ShavePlayer()
{
SetLastShavedSeconds(StatGet(AnalyticsManagerServer.STAT_PLAYTIME));
m_ModuleLifespan.UpdateLifespan(this, true);
}
bool CanShave()
{
if (!HasCoveredFaceForShave() && GetLifeSpanState())
{
return true;
}
else
{
return false;
}
}
override void OnParticleEvent(string pEventType, string pUserString, int pUserInt)
{
super.OnParticleEvent(pEventType ,pUserString, pUserInt);
if (!GetGame().IsDedicatedServer())
{
if (pUserInt == 123456) // 123456 is ID for vomiting effect. The current implementation is WIP.
{
PlayerBase player = PlayerBase.Cast(this);
int boneIdx = player.GetBoneIndexByName("Head");
if (boneIdx != -1)
{
EffectParticle eff;
if (m_SyncedModifiers & eModifierSyncIDs.MODIFIER_SYNC_CONTAMINATION2)
{
eff = new EffVomitBlood();
}
else
{
eff = new EffVomit();
}
eff.SetDecalOwner(player);
eff.SetAutodestroy(true);
SEffectManager.PlayInWorld(eff, vector.Zero);
Particle p = eff.GetParticle();
player.AddChild(p, boneIdx);
}
}
}
}
bool CanSpawnBreathVaporEffect()
{
if (!ToDelete() && IsAlive() && !IsSwimming() && !m_IsDrowning)
{
return true;
}
return false;
}
void ProcessADDModifier()
{
if (m_AddModifier != -1)
{
HumanCommandAdditives ad = GetCommandModifier_Additives();
if (ad)
ad.StartModifier(m_AddModifier);
m_AddModifier = -1;
}
}
void SpawnBreathVaporEffect()
{
//Print("SpawnBreathVaporEffect:"+GetGame().GetTime());
int boneIdx = GetBoneIndexByName("Head");
if (boneIdx != -1)
{
Particle p;
switch (m_BreathVapour)
{
case 1:
p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_LIGHT, "-0.03 0.15 0");
break;
case 2:
p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_MEDIUM, "-0.03 0.15 0");
break;
case 3:
p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_HEAVY, "-0.03 0.15 0");
break;
default:
break;
}
if (p)
AddChild(p, boneIdx);
}
}
// returns 'true' if the player is submerged under water deep enough so that we consider him/her to be eligible for drowning, do note some other conditions may apply for actual drowning to be turned on
bool GetDrowningWaterLevelCheck()
{
int index = GetBoneIndexByName("head");
vector pos = GetBonePositionWS(index);
float depth = g_Game.GetWaterDepth(pos);
if (IsSwimming())
{
return depth > PlayerConstants.DROWNING_SWIMMING_THRESHOLD;
}
else if (IsUnconscious())
{
return depth > PlayerConstants.DROWNING_UNCONSCIOUS_THRESHOLD;
}
return depth > PlayerConstants.DROWNING_DEFAULT_THRESHOLD;
}
void SetLifeSpanStateVisible(int show_state)
{
bool state_changed;
if (show_state != m_LifeSpanState)
state_changed = true;
m_LifeSpanState = show_state;
SetSynchDirty();
if (state_changed) //server only, client solution in OnVariablesSynchronized()
{
//SendLifespanSyncEvent(m_LifeSpanState);
UpdateHairSelectionVisibility();
}
}
int GetLifeSpanState()
{
return m_LifeSpanState;
}
int GetLastShavedSeconds()
{
return m_LastShavedSeconds;
}
void SetLastShavedSeconds(int last_shaved_seconds)
{
m_LastShavedSeconds = last_shaved_seconds;
}
bool HasCoveredFaceForShave()
{
return IsExclusionFlagPresent(GetFaceCoverageShaveValues());
}
//! returns a set of face covering values
static set<int> GetFaceCoverageShaveValues()
{
set<int> ret = new set<int>;
ret.Insert(EAttExclusions.SHAVING_MASK_ATT_0);
ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
//ret.Insert(EAttExclusions.SHAVING_EYEWEAR_ATT_0);
return ret;
}
eBloodyHandsTypes HasBloodyHandsEx()
{
return m_HasBloodyHandsVisible;
}
bool HasBloodyHands()
{
return m_HasBloodyHandsVisible;
}
void SetBloodyHands(bool show)
{
SetBloodyHandsBase(show);
}
void SetBloodyHandsEx(eBloodyHandsTypes type)
{
SetBloodyHandsBase(type);
}
private void SetBloodyHandsBase(int type)
{
m_HasBloodyHandsVisible = type;
SetSynchDirty();
#ifdef DIAG_DEVELOPER
#ifndef SERVER
if (IsControlledPlayer())
{
bool enable = type;
DiagMenu.SetValue(DiagMenuIDs.LIFESPAN_BLOODY_HANDS, enable);
}
#endif
#endif
}
void SetBloodyHandsPenalty()
{
InsertAgent(eAgents.SALMONELLA, 1);
}
bool HasBloodTypeVisible()
{
return m_HasBloodTypeVisible;
}
void SetBloodTypeVisible(bool show)
{
m_HasBloodTypeVisible = show;
SetSynchDirty();
}
int GetBloodType()
{
return m_BloodType;
}
void SetBloodType(int blood_type)
{
m_BloodType = blood_type;
SetSynchDirty();
}
// --------------------------------------------------
// Soft Skills
//---------------------------------------------------
SoftSkillsManager GetSoftSkillsManager()
{
return m_SoftSkillsManager;
}
void CheckDeath()
{
if (IsPlayerSelected() && !IsAlive())
{
SimulateDeath(true);
m_DeathCheckTimer.Stop();
}
}
// -------------------------------------------------------------------------
// --------------------------------------------------
// AI Presence
//---------------------------------------------------
//! Return actual noise presence of player
int GetNoisePresenceInAI()
{
if (m_PresenceNotifier)
{
return m_PresenceNotifier.GetNoisePresence();
}
return 0;
}
// is a bit on in the persistent flags
bool IsPersistentFlag(PersistentFlag bit)
{
return (m_PersistentFlags & bit);
}
// turn on/off a bit in the persistent flag
void SetPersistentFlag(PersistentFlag bit, bool enable)
{
if (enable)//turn on bit
m_PersistentFlags = (m_PersistentFlags | bit);
else//turn off bit
m_PersistentFlags = ((~bit) & m_PersistentFlags);
}
// -------------------------------------------------------------------------
int GetStoreLoadVersion()
{
return m_StoreLoadVersion;
}
override void OnStoreSave(ParamsWriteContext ctx)
{
//Print("OnStoreSave");
if (GetGame().SaveVersion() < 102)
{
ctx.Write(ACT_STORE_SAVE_VERSION);//to be removed after we push 102+
}
super.OnStoreSave(ctx);
GetHumanInventory().OnStoreSave(ctx); // FSM of hands
OnStoreSaveLifespan(ctx);
if (GetDayZGame().IsServer() && GetDayZGame().IsMultiplayer())
{
GetPlayerStats().SaveStats(ctx);// save stats
m_ModifiersManager.OnStoreSave(ctx);// save modifiers
m_AgentPool.OnStoreSave(ctx);//save agents
GetSymptomManager().OnStoreSave(ctx);//save states
if (GetBleedingManagerServer())
{
GetBleedingManagerServer().OnStoreSave(ctx);//save bleeding sources
}
m_PlayerStomach.OnStoreSave(ctx);
ctx.Write(GetBrokenLegs());
//ctx.Write(m_LocalBrokenState);
SaveAreaPersistenceFlag(ctx);
HumanCommandLadder ladder = GetCommand_Ladder();
if (ladder)
{
ctx.Write(true);
ctx.Write(ladder.GetLogoutPosition());
}
else
{
ctx.Write(false);
}
ArrowManagerPlayer arrowManager = ArrowManagerPlayer.Cast(GetArrowManager());
arrowManager.Save(ctx);
}
}
void SaveAreaPersistenceFlag(ParamsWriteContext ctx)
{
if (GetModifiersManager())
SetPersistentFlag(PersistentFlag.AREA_PRESENCE, GetModifiersManager().IsModifierActive(eModifiers.MDF_AREAEXPOSURE));//set the flag for player's presence in contaminated area
ctx.Write(m_PersistentFlags);
}
override bool OnStoreLoad(ParamsReadContext ctx, int version)
{
//Print("---- PlayerBase OnStoreLoad START ----, version: "+version);
m_aQuickBarLoad = new array<ref Param2<EntityAI,int>>;
// todo :: this should be after base call !!!!
if (version < 102)//write removed in v. 102
{
if (!ctx.Read(m_StoreLoadVersion))
return false;
}
if (!super.OnStoreLoad(ctx, version))
return false;
// FSM of hands
if (!GetHumanInventory().OnStoreLoad(ctx, version))
return false;
if (!OnStoreLoadLifespan(ctx, version))
return false;
if (GetDayZGame().IsServer() && GetDayZGame().IsMultiplayer())
{
if (!GetPlayerStats().LoadStats(ctx, version)) // load stats
{
Print("---- failed to load PlayerStats ----");
return false;
}
if (version < m_ModifiersManager.GetStorageVersion())//load modifiers !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
{
Print("---- failed to load ModifiersManager, unsupported version ----");
return false;
}
else
{
if (!m_ModifiersManager.OnStoreLoad(ctx, version))
{
Print("---- failed to load ModifiersManager, read fail ----");
return false;
}
}
if (version < m_AgentPool.GetStorageVersion())//load agents !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
{
Print("---- failed to load AgentPool, unsupported version ----");
return false;
}
else
{
if (!m_AgentPool.OnStoreLoad(ctx, version))
{
Print("---- failed to load AgentPool, read fail ----");
return false;
}
}
if (version < GetSymptomManager().GetStorageVersion())//load symptoms !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
{
Print("---- failed to load SymptomManager, unsupported version ----");
return false;
}
else
{
if (!GetSymptomManager().OnStoreLoad(ctx, version))
{
Print("---- failed to load SymptomManager, read fail ----");
return false;
}
}
if (version < GetBleedingManagerServer().GetStorageVersion())//load bleeding manager !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
{
Print("---- failed to load BleedingManagerServer, unsupported version ----");
return false;
}
else
{
if (!GetBleedingManagerServer().OnStoreLoad(ctx, version))
{
Print("---- failed to load BleedingManagerServer, read fail ----");
return false;
}
}
if (version < m_PlayerStomach.GetStorageVersion())//load PlayerStomach !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
{
Print("---- failed to load PlayerStomach, unsupported version ----");
return false;
}
else
{
if (!m_PlayerStomach.OnStoreLoad(ctx, version))
{
Print("---- failed to load PlayerStomach, read fail ----");
return false;
}
}
//Check for broken leg value
if (version >= 116)
{
if (!ctx.Read(m_BrokenLegState))
{
return false;
}
if (version <= 126)// WHILE >= 116
{
if (!ctx.Read(m_LocalBrokenState))
{
return false;
}
}
}
//Check for broken leg value
if (version >= 125 && (!ctx.Read(m_PersistentFlags)))
{
Print("---- failed to load Persistent Flags, read fail ----");
return false;
}
if (version >= 131)
{
bool onLadder;
if (!ctx.Read(onLadder))
{
return false;
}
if (onLadder)
{
vector position;
if (!ctx.Read(position))
{
return false;
}
Hive hive = GetHive();
if (!hive || !hive.CharacterIsLoginPositionChanged(this))
{
SetPosition(position);
}
}
}
if (version >= 134)
{
ArrowManagerPlayer arrowManager = ArrowManagerPlayer.Cast(GetArrowManager());
arrowManager.Load(ctx);
}
}
Print("---- PlayerBase OnStoreLoad SUCCESS ----");
return true;
}
override void AfterStoreLoad()
{
GetHumanInventory().OnAfterStoreLoad();
if (m_EmoteManager)
{
m_EmoteManager.AfterStoreLoad();
}
}
void OnStoreSaveLifespan(ParamsWriteContext ctx)
{
ctx.Write(m_LifeSpanState);
ctx.Write(m_LastShavedSeconds);
ctx.Write(m_HasBloodyHandsVisible);
ctx.Write(m_HasBloodTypeVisible);
ctx.Write(m_BloodType);
}
bool OnStoreLoadLifespan(ParamsReadContext ctx, int version)
{
int lifespan_state = 0;
if (!ctx.Read(lifespan_state))
return false;
m_LifeSpanState = lifespan_state;
int last_shaved = 0;
if (!ctx.Read(last_shaved))
return false;
m_LastShavedSeconds = last_shaved;
if (version < 122)
{
bool bloody_hands_old;
if (!ctx.Read(bloody_hands_old))
return false;
m_HasBloodyHandsVisible = bloody_hands_old;
}
else
{
int bloody_hands = 0;
if (!ctx.Read(bloody_hands))
return false;
m_HasBloodyHandsVisible = bloody_hands;
}
bool blood_visible = false;
if (!ctx.Read(blood_visible))
return false;
m_HasBloodTypeVisible = blood_visible;
int blood_type = 0;
if (!ctx.Read(blood_type))
return false;
m_BloodType = blood_type;
return true;
}
vector m_PlayerOldPos;
void UpdatePlayerMeasures()
{
int hour, minute, second;
GetHourMinuteSecond(hour, minute, second);
float distance;
distance = StatGet(AnalyticsManagerServer.STAT_DISTANCE);
if (m_AnalyticsTimer)
{
StatsEventMeasuresData data = new StatsEventMeasuresData();
data.m_CharacterId = g_Game.GetDatabaseID();
data.m_TimeInterval = m_AnalyticsTimer.GetRemaining();
data.m_DaytimeHour = hour;
data.m_PositionStart = m_PlayerOldPos;
data.m_PositionEnd = GetPosition();
data.m_DistanceOnFoot = distance;
Analytics.PlayerMeasures(data);
}
m_PlayerOldPos = GetPosition();
}
void OnConnect()
{
Debug.Log("Player connected:"+this.ToString(),"Connect");
// analytics
GetGame().GetAnalyticsServer().OnPlayerConnect(this);
m_PlayerOldPos = GetPosition();
if (m_AnalyticsTimer)
m_AnalyticsTimer.Run(60, this, "UpdatePlayerMeasures", null, true);
//construction action data
ResetConstructionActionData();
}
void OnReconnect()
{
Debug.Log("Player reconnected:"+this.ToString(),"Reconnect");
//construction action data
ResetConstructionActionData();
}
void OnDisconnect()
{
Debug.Log("Player disconnected:"+this.ToString(),"Connect");
// analytics
// force update of the stats
// if player disconnect too soon, UpdatePlayersStats() is not called
GetGame().GetAnalyticsServer().OnPlayerDisconnect(this);
StatsEventDisconnectedData data = new StatsEventDisconnectedData();
data.m_CharacterId = g_Game.GetDatabaseID();
data.m_Reason = "Disconnected";
Analytics.PlayerDisconnected(data);
if (m_AnalyticsTimer)
m_AnalyticsTimer.Stop();
UpdatePlayerMeasures();
SetPlayerDisconnected(true);
}
void SetModifiers(bool enable)
{
GetModifiersManager().SetModifiers(enable);
}
bool Consume(ItemBase source, float amount, EConsumeType consume_type)
{
PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
int agents;
if (consume_type == EConsumeType.ENVIRO_POND || consume_type == EConsumeType.ENVIRO_WELL)
{
if (consume_type == EConsumeType.ENVIRO_POND)
{
agents = agents | eAgents.CHOLERA;
//plugin.TransmitAgents(NULL, this, AGT_WATER_POND, amount);
}
m_PlayerStomach.AddToStomach(Liquid.GetLiquidClassname(LIQUID_WATER), amount, 0 , agents);
return true;
}
Edible_Base edible_item = Edible_Base.Cast(source);
if (!edible_item)
{
return false;
}
agents = edible_item.GetAgents();
if (consume_type == EConsumeType.ITEM_SINGLE_TIME || consume_type == EConsumeType.ITEM_CONTINUOUS)
{
if (consume_type == EConsumeType.ITEM_SINGLE_TIME)
{
plugin.TransmitAgents(edible_item, this, AGT_UACTION_CONSUME, amount);
}
/*
else
{
plugin.TransmitAgents(edible_item, this, AGT_UACTION_TO_PLAYER, amount);
}
*/
if (edible_item.IsLiquidContainer())
{
int liquid_type = edible_item.GetLiquidType();
string liquidClassName = Liquid.GetLiquidClassname(liquid_type);
if (liquidClassName.Length() == 0)
Error("Error! Trying to add unknown liquid to stomach with item=" + Object.GetDebugName(edible_item) + " consume_type=" + consume_type + " liquid_type=" + liquid_type);
m_PlayerStomach.AddToStomach(liquidClassName, amount, 0, agents);
}
else
{
int food_stage_type;
if (edible_item.GetFoodStage())
{
food_stage_type = edible_item.GetFoodStage().GetFoodStageType();
}
m_PlayerStomach.AddToStomach(source.GetType(), amount, food_stage_type, agents);
}
edible_item.Consume(amount, this);
return true;
}
/*
if (consume_type == EConsumeType.ITEM_CONTINUOUS)
{
if (edible_item)
{
plugin.TransmitAgents(edible_item, this, AGT_UACTION_TO_PLAYER, amount);
edible_item.Consume(amount, this);
//ProcessNutritions(edible_item.GetNutritionalProfile(),amount);
m_PlayerStomach.AddToStomach(source.GetType(), amount, edible_item.GetNutritionalProfile());
return true;
}
}
*/
return false;
}
/*
void ProcessNutritions(NutritionalProfile profile, float consumedquantity)
{
float energy_per_unit = profile.GetEnergy() / 100;
float water_per_unit = profile.GetWaterContent() / 100;
float nutritions = profile.GetNutritionalIndex();
float fullness_index = profile.GetFullnessIndex();
float toxicity = profile.GetToxicity();
bool is_liquid = profile.IsLiquid();
if (consumedquantity > 0)
{
float water_consumed = consumedquantity * water_per_unit;
GetStatStomachVolume().Add(consumedquantity * fullness_index);
GetStatStomachEnergy().Add(consumedquantity * energy_per_unit);
GetStatStomachWater().Add(water_consumed);
GetStatToxicity().Add(consumedquantity * toxicity);
}
else
{
Print("ProcessNutritions - ZERO VOLUME! Fix config");
}
}
*/
void ShowUnconsciousScreen(bool show)
{
#ifndef NO_GUI
if (show)
{
GetGame().GetUIManager().ScreenFadeIn(0, "You are Unconscious", FadeColors.BLACK, FadeColors.WHITE);
PrintString("Fade in");
}
else
{
GetGame().GetUIManager().ScreenFadeOut(0);
PrintString("Fade out");
}
#endif
}
override void RequestSoundEventEx(EPlayerSoundEventID id, bool from_server_and_client = false, int param = 0)
{
if (from_server_and_client && GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
PlaySoundEventEx(id, false, false, param);
return;
}
SendSoundEventEx(id, param);
}
override void RequestSoundEvent(EPlayerSoundEventID id, bool from_server_and_client = false)
{
RequestSoundEventEx(id, from_server_and_client);
}
override protected void SendSoundEvent(EPlayerSoundEventID id)
{
SendSoundEventEx(id);
}
override protected void SendSoundEventEx(EPlayerSoundEventID id, int param = 0)
{
if (!GetGame().IsServer())
{
return;
}
m_SoundEvent = id;
m_SoundEventParam = param;
SetSynchDirty();
if (!GetGame().IsMultiplayer())
{
CheckSoundEvent();
}
//PrintString(GetGame().GetTime().ToString() + " Set SoundEvent, id:" + id.ToString());
}
void CheckZeroSoundEvent()
{
if (m_SoundEvent != 0 && m_SoundEventSent)
{
m_SoundEvent = 0;
m_SoundEventParam = 0;
m_SoundEventSent = false;
SetSynchDirty();
}
}
void CheckSendSoundEvent()
{
if (m_SoundEvent!= 0 && !m_SoundEventSent)
{
m_SoundEventSent = true;
}
}
override bool PlaySoundEvent(EPlayerSoundEventID id, bool from_anim_system = false, bool is_from_server = false)
{
return PlaySoundEventEx(id, from_anim_system, is_from_server);
}
override bool PlaySoundEventEx(EPlayerSoundEventID id, bool from_anim_system = false, bool is_from_server = false, int param = 0)
{
if (!m_PlayerSoundEventHandler)
return false;
return m_PlayerSoundEventHandler.PlayRequestEx(id, is_from_server, param);
}
PlayerSoundEventHandler GetPlayerSoundEventHandler()
{
return m_PlayerSoundEventHandler;
}
void OnBleedingBegin();
void OnBleedingEnd();
void OnBleedingSourceAdded()
{
m_BleedingSourceCount++;
if (IsControlledPlayer())
{
if (!GetGame().IsDedicatedServer())
{
DisplayElementBadge dis_elm = DisplayElementBadge.Cast(GetVirtualHud().GetElement(eDisplayElements.DELM_BADGE_BLEEDING));
if (dis_elm)
{
dis_elm.SetValue(GetBleedingSourceCount());
}
//Print("----------bleeding_SoundSet----------");
SEffectManager.PlaySoundOnObject("bleeding_SoundSet", this);
}
}
}
void OnBleedingSourceRemoved()
{
m_BleedingSourceCount--;
if (GetGame().IsServer())
{
ArrowManagerBase arrowManager = GetArrowManager();
if (GetBleedingSourceCount() > 0)
{
arrowManager.DropFirstArrow();
}
else
{
arrowManager.DropAllArrows();
}
}
if (IsControlledPlayer())
{
if (!GetGame().IsDedicatedServer())
{
//Print("GetBleedingSourceCount() "+GetBleedingSourceCount());
DisplayElementBadge dis_elm = DisplayElementBadge.Cast(GetVirtualHud().GetElement(eDisplayElements.DELM_BADGE_BLEEDING));
if (dis_elm)
{
dis_elm.SetValue(GetBleedingSourceCount());
}
}
}
}
void OnBleedingSourceRemovedEx(ItemBase item)
{
OnBleedingSourceRemoved();
}
int GetBleedingSourceCount()
{
return m_BleedingSourceCount;
}
// for debug purposes, should reset some systems like Modifiers, Stats, Damage etc.....
void ResetPlayer(bool set_max)
{
#ifdef DIAG_DEVELOPER
if (GetGame().IsServer() || !GetGame().IsMultiplayer())
{
GetStomach().ClearContents();
DamageSystem.ResetAllZones(this);
GetModifiersManager().ResetAll();
// bleeding sources
if (m_BleedingManagerServer)
m_BleedingManagerServer.RemoveAllSources();
// Stats
if (GetPlayerStats())
{
int bloodType = GetStatBloodType().Get();
GetPlayerStats().ResetAllStats();
GetStatBloodType().Set(bloodType);
}
// Agents
if (m_AgentPool)
m_AgentPool.RemoveAllAgents();
if (m_StaminaHandler)
m_StaminaHandler.SetStamina(GameConstants.STAMINA_MAX);
// uncon
if (IsUnconscious())
DayZPlayerSyncJunctures.SendPlayerUnconsciousness(this, false);
// set max
if (set_max)
{
GetStatWater().Set(GetStatWater().GetMax());
GetStatEnergy().Set(GetStatEnergy().GetMax());
}
// fix up inventory
FixAllInventoryItems();
//remove bloody hands
PluginLifespan moduleLifespan = PluginLifespan.Cast(GetPlugin(PluginLifespan));
moduleLifespan.UpdateBloodyHandsVisibilityEx(this, eBloodyHandsTypes.CLEAN);
if (GetArrowManager())
GetArrowManager().ClearArrows();
}
// client + single + server
HumanCommandVehicle vehCmd = GetCommand_Vehicle();
if (vehCmd)
{
CarScript car = CarScript.Cast(vehCmd.GetTransport());
if (car)
{
car.FixEntity();
}
}
#endif
}
void CheckSoundEvent()
{
if (m_SoundEvent != 0)
{
PlaySoundEventEx(m_SoundEvent, false, true,m_SoundEventParam);
m_SoundEvent = 0;
m_SoundEventParam = 0;
}
}
void TestSend()
{
if (GetGame().IsClient()) return;
RequestSoundEvent(1234);
//Math.RandomInt(1,4096)
}
void SetStaminaState(eStaminaState state)
{
if (state != m_StaminaState)
{
m_StaminaState = state;
//PrintString("m_StaminaState:"+m_StaminaState.ToString());
SetSynchDirty();
}
}
int GetStaminaState()
{
return m_StaminaState;
}
void UpdateQuickBarExtraSlots()
{
m_QuickBarBase.updateSlotsCount();
}
bool Save()
{
// saved player must be alive and not captive
if (GetPlayerState() == EPlayerStates.ALIVE && !IsRestrained())
{
GetHive().CharacterSave(this);
Debug.Log("Player "+this.ToString()+ " saved as alive");
return true;
}
return false;
}
// agent transfer
static ref array<Object> SPREAD_AGENTS_OBJECTS = new array<Object>;
static ref array<CargoBase> SPREAD_AGENTS_PROXY_CARGOS = new array<CargoBase>;
//! chance between [0..1] , distance in meters
void SpreadAgentsEx(float distance = 3,float chance = 0.25)
{
if (Math.RandomFloat01() > chance)
return;
GetGame().GetPlayers(m_ServerPlayers);
float dist_check = distance * distance;//make it sq
PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
foreach (Man target: m_ServerPlayers)
{
if (vector.DistanceSq(GetWorldPosition(), target.GetWorldPosition()) < dist_check && target != this)
{
plugin.TransmitAgents(this, target, AGT_AIRBOURNE_BIOLOGICAL, 1);
}
}
}
void SpreadAgents()//legacy method
{
SpreadAgentsEx(3,1);
}
//--------------------------------------------------------------------------------------------
override int GetAgents()
{
return m_AgentPool.GetAgents();
}
//--------------------------------------------------------------------------------------------
override void RemoveAgent(int agent_id) //removes a single agent type from the player agent pool
{
m_AgentPool.RemoveAgent(agent_id);
}
//--------------------------------------------------------------------------------------------
override void RemoveAllAgents()
{
m_AgentPool.RemoveAllAgents();
}
//--------------------------------------------------------------------------------------------
override void InsertAgent(int agent, float count = 1) //adds a single agent type to the player agent pool
{
m_AgentPool.AddAgent(agent,count);
}
//--------------------------------------------------------------------------------------------
int GetSingleAgentCount(int agent_id)
{
return m_AgentPool.GetSingleAgentCount(agent_id);
}
//--------------------------------------------------------------------------------------------
float GetSingleAgentCountNormalized(int agent_id)
{
int max_count = PluginTransmissionAgents.GetAgentMaxCount(agent_id);
return m_AgentPool.GetSingleAgentCount(agent_id) / max_count;
}
float GetTotalAgentCount()
{
return m_AgentPool.GetTotalAgentCount();
}
void PrintAgents()
{
m_AgentPool.PrintAgents();
}
void ImmuneSystemTick(float value, float deltaT)
{
m_AgentPool.ImmuneSystemTick(value, deltaT);
}
void AntibioticsAttack(float value)
{
m_AgentPool.AntibioticsAttack(value);
}
//Get aim (player crosshair) position
vector GetAimPosition()
{
float min_distance = 0.5; //min distance, default = 5m
vector from = GetGame().GetCurrentCameraPosition();
vector to = from + (GetGame().GetCurrentCameraDirection() * min_distance);
vector contactPos;
vector contactDir;
int contactComponent;
DayZPhysics.RaycastRV(from, to, contactPos, contactDir, contactComponent, NULL, NULL, NULL, false, true);
return contactPos;
}
bool CanEatAndDrink()
{
ItemBase mask = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
return (!mask || (mask && mask.AllowFoodConsumption()));
}
//get modifier manager
ModifiersManager GetModifiersManager()
{
return m_ModifiersManager;
}
PlayerStat<float> GetStatWater()
{
if (!m_StatWater && GetPlayerStats())
{
m_StatWater = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.WATER));
}
return m_StatWater;
}
PlayerStat<float> GetStatToxicity()
{
if (!m_StatToxicity && GetPlayerStats())
{
m_StatToxicity = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.TOXICITY));
}
return m_StatToxicity;
}
PlayerStat<float> GetStatEnergy()
{
if (!m_StatEnergy && GetPlayerStats())
{
m_StatEnergy = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.ENERGY));
}
return m_StatEnergy;
}
PlayerStat<float> GetStatHeatComfort()
{
if (!m_StatHeatComfort && GetPlayerStats())
{
m_StatHeatComfort = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.HEATCOMFORT));
}
return m_StatHeatComfort;
}
PlayerStat<float> GetStatTremor()
{
if (!m_StatTremor && GetPlayerStats())
{
m_StatTremor = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.TREMOR));
}
return m_StatTremor;
}
PlayerStat<int> GetStatWet()
{
if (!m_StatWet && GetPlayerStats())
{
m_StatWet = PlayerStat<int>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.WET));
}
return m_StatWet;
}
PlayerStat<float> GetStatDiet()
{
if (!m_StatDiet && GetPlayerStats())
{
m_StatDiet = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.DIET));
}
return m_StatDiet;
}
PlayerStat<float> GetStatStamina()
{
if (!m_StatStamina && GetPlayerStats())
{
m_StatStamina = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.STAMINA));
}
return m_StatStamina;
}
PlayerStat<float> GetStatSpecialty()
{
if (!m_StatSpecialty && GetPlayerStats())
{
m_StatSpecialty = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.SPECIALTY));
}
return m_StatSpecialty;
}
PlayerStat<int> GetStatBloodType()
{
if (!m_StatBloodType && GetPlayerStats())
{
m_StatBloodType = PlayerStat<int>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.BLOODTYPE));
}
return m_StatBloodType;
}
PlayerStat<float> GetStatHeatBuffer()
{
if (!m_StatHeatBuffer && GetPlayerStats())
{
m_StatHeatBuffer = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.HEATBUFFER));
}
return m_StatHeatBuffer;
}
void ToggleHeatBufferVisibility(bool show)
{
m_HasHeatBuffer = show;
SetSynchDirty();
}
//! UA Last Message
string GetLastUAMessage()
{
return m_UALastMessage;
}
void SetLastUAMessage(string pMsg)
{
m_UALastMessage = pMsg;
if (m_UALastMessageTimer.IsRunning())
{
m_UALastMessageTimer.Stop();
}
m_UALastMessageTimer.Run(PlayerConstants.LAST_UA_MSG_LIFETIME, this, "ClearLastUAMessage", null);
}
protected void ClearLastUAMessage()
{
if (m_UALastMessageTimer.IsRunning())
{
m_UALastMessageTimer.Stop();
}
m_UALastMessage = "";
}
//! -------------------------------------------------------------------------
//! Injured stat
//! update injured state immediately
void ForceUpdateInjuredState()
{
m_InjuryHandler.CheckValue(true);
}
// -------------------------------------------------------------------------
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
{
PluginTransmissionAgents pluginTransmissionAgents = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
string name;
int id;
map<int,string> agentList = pluginTransmissionAgents.GetSimpleAgentList();
for (int i = 0; i < agentList.Count(); i++)
{
name = agentList.GetElement(i);
id = agentList.GetKey(i);
outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DEBUG_AGENTS_RANGE_INJECT_START + id, "Inject " + name, Colors.WHITE));
outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DEBUG_AGENTS_RANGE_REMOVE_START + id, "Remove " + name, Colors.WHITE));
}
}
//-------------------------------------------------------------
//!
//! SyncJunctures
//!
override void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
{
super.OnSyncJuncture(pJunctureID, pCtx);
switch(pJunctureID)
{
case DayZPlayerSyncJunctures.SJ_INJURY:
eInjuryHandlerLevels level;
bool enable;
DayZPlayerSyncJunctures.ReadInjuryParams(pCtx, enable, level);
m_InjuryHandler.SetInjuryCommandParams(enable, level);
break;
case DayZPlayerSyncJunctures.SJ_PLAYER_STATES:
GetSymptomManager().SetAnimation(pCtx);
break;
case DayZPlayerSyncJunctures.SJ_QUICKBAR_SET_SHORTCUT:
OnQuickbarSetEntityRequest(pCtx);
break;
case DayZPlayerSyncJunctures.SJ_INVENTORY:
GetInventory().OnInventoryJunctureFromServer(pCtx);
break;
case DayZPlayerSyncJunctures.SJ_INVENTORY_REPAIR:
GetInventory().OnInventoryJunctureRepairFromServer(pCtx);
break;
case DayZPlayerSyncJunctures.SJ_INVENTORY_FAILURE:
GetInventory().OnInventoryJunctureFailureFromServer(pCtx);
break;
case DayZPlayerSyncJunctures.SJ_ACTION_INTERRUPT:
case DayZPlayerSyncJunctures.SJ_ACTION_ACK_ACCEPT:
case DayZPlayerSyncJunctures.SJ_ACTION_ACK_REJECT:
m_ActionManager.OnSyncJuncture(pJunctureID,pCtx);
break;
case DayZPlayerSyncJunctures.SJ_WEAPON_ACTION_ACK_ACCEPT:
case DayZPlayerSyncJunctures.SJ_WEAPON_ACTION_ACK_REJECT:
case DayZPlayerSyncJunctures.SJ_WEAPON_SET_JAMMING_CHANCE:
m_WeaponManager.OnSyncJuncture(pJunctureID,pCtx);
break;
case DayZPlayerSyncJunctures.SJ_UNCONSCIOUSNESS:
DayZPlayerSyncJunctures.ReadPlayerUnconsciousnessParams(pCtx, m_ShouldBeUnconscious);
break;
case DayZPlayerSyncJunctures.SJ_PLAYER_ADD_MODIFIER:
GetSymptomManager().SetAnimation(pCtx);
break;
case DayZPlayerSyncJunctures.SJ_KURU_REQUEST:
float amount;
if (DayZPlayerSyncJunctures.ReadKuruRequest(pCtx, amount))
{
if (GetAimingModel() && IsFireWeaponRaised())
{
GetAimingModel().RequestKuruShake(amount);
}
}
break;
case DayZPlayerSyncJunctures.SJ_GESTURE_REQUEST :
m_EmoteManager.OnSyncJuncture(pJunctureID, pCtx);
break;
case DayZPlayerSyncJunctures.SJ_WEAPON_LIFT:
SetLiftWeapon(pJunctureID, pCtx);
break;
case DayZPlayerSyncJunctures.SJ_ADS_RESET:
m_ResetADS = true;
break;
case DayZPlayerSyncJunctures.SJ_DELETE_ITEM:
SetToDelete(pCtx);
break;
case DayZPlayerSyncJunctures.SJ_BROKEN_LEGS:
m_BrokenLegsJunctureReceived = true;
DayZPlayerSyncJunctures.ReadBrokenLegsParamsEx(pCtx, m_BrokenLegState);
break;
case DayZPlayerSyncJunctures.SJ_SHOCK :
DayZPlayerSyncJunctures.ReadShockParams(pCtx, m_CurrentShock);
break;
case DayZPlayerSyncJunctures.SJ_STAMINA:
m_StaminaHandler.OnSyncJuncture(pJunctureID, pCtx);
break;
case DayZPlayerSyncJunctures.SJ_STAMINA_MISC:
m_StaminaHandler.OnSyncJuncture(pJunctureID, pCtx);
break;
#ifdef DEVELOPER
case DayZPlayerSyncJunctures.SJ_DEBUG_GET_IN_CAR:
EntityAI car;
DayZPlayerSyncJunctures.ReadGetInCarParams(pCtx, car);
SetGetInVehicleDebug(car);
break;
#endif
}
}
bool IsItemsToDelete()
{
return m_ItemsToDelete.Count() > 0;
}
void SetToDelete(ParamsReadContext pCtx)
{
EntityAI item;
pCtx.Read(item);
AddItemToDelete(item);
}
override void AddItemToDelete(EntityAI item)
{
if (item)
{
item.SetPrepareToDelete();
m_ItemsToDelete.Insert(item);
}
}
bool CanDeleteItems()
{
return !(IsEmotePlaying() || GetThrowing().IsThrowingAnimationPlaying() || GetDayZPlayerInventory().IsProcessing() || (GetActionManager() && GetActionManager().GetRunningAction()));
}
override void JunctureDeleteItem(EntityAI item)
{
DayZPlayerSyncJunctures.SendDeleteItem(this, item);
}
void UpdateDelete()
{
int count = m_ItemsToDelete.Count();
if (count > 0)
{
if (CanDeleteItems())
{
EntityAI itemToDelete;
if (GetGame().IsClient() && GetGame().IsMultiplayer())
{
InventoryLocation il = new InventoryLocation();
for (int i = count - 1; i >= 0 ; i--)
{
itemToDelete = m_ItemsToDelete.Get(i);
if (itemToDelete != null)
{
itemToDelete.GetInventory().GetCurrentInventoryLocation(il);
}
if (itemToDelete == null || (GetItemInHands() == null && il.GetType() == InventoryLocationType.UNKNOWN))
{
m_ItemsToDelete.Remove(i);
}
}
}
else
{
for (int j = count - 1; j >= 0 ; j--)
{
itemToDelete = m_ItemsToDelete.Get(j);
if (itemToDelete == null)
{
m_ItemsToDelete.Remove(j);
}
else
{
itemToDelete.Delete();
m_ItemsToDelete.Remove(j);
}
}
}
}
}
}
override bool HeadingModel(float pDt, SDayZPlayerHeadingModel pModel)
{
//! during fullbody gestures - disables character turning
if (GetEmoteManager().IsControllsLocked() || (GetActionManager() && GetActionManager().GetRunningAction() && GetActionManager().GetRunningAction().IsFullBody(this)))
{
HumanItemAccessor hia = GetItemAccessor();
HumanItemBehaviorCfg hibcfg = hia.GetItemInHandsBehaviourCfg();
if (hibcfg && hibcfg.m_StanceRotation[m_MovementState.m_iStanceIdx] == DayZPlayerConstants.ROTATION_DISABLE)
{
return DayZPlayerImplementHeading.NoHeading(pDt, pModel, m_fLastHeadingDiff);
}
else
{
m_fLastHeadingDiff = 0;
return DayZPlayerImplementHeading.ClampHeading(pDt, pModel, m_fLastHeadingDiff);
}
}
return super.HeadingModel(pDt, pModel);
}
override bool IsInventorySoftLocked()
{
return m_InventorySoftLockCount > 0;
}
//! 'soft lock' meaning inventory screen cannot be displayed, but mechanically, inventory operations are still possible
override void SetInventorySoftLock(bool status)
{
if (status)
m_InventorySoftLockCount++;
else
m_InventorySoftLockCount--;
if (m_InventorySoftLockCount < 0)
m_InventorySoftLockCount = 0;
m_InventorySoftLocked = IsInventorySoftLocked();
}
void SetLoadedQuickBarItemBind(EntityAI entity, int index)
{
if (m_aQuickBarLoad)
m_aQuickBarLoad.Insert(new Param2<EntityAI, int>(entity,index));
}
override bool IsLiftWeapon()
{
return m_LiftWeapon_player;
}
//Server
bool ReadLiftWeaponRequest(int userDataType, ParamsReadContext ctx)
{
bool state;
ctx.Read(state);
ScriptJunctureData pCtx = new ScriptJunctureData;
pCtx.Write(state);
SendSyncJuncture(DayZPlayerSyncJunctures.SJ_WEAPON_LIFT, pCtx);
return true;
}
void SetLiftWeapon(int pJunctureID, ParamsReadContext ctx)
{
bool state;
ctx.Read(state);
m_ProcessLiftWeaponState = state;
m_ProcessLiftWeapon = true;
//Print("SetLiftWeapon | STS: " + GetSimulationTimeStamp());
}
//! Client-side only
void SendLiftWeaponSync(bool state)
{
HumanCommandWeapons hcw;
//SP version
if (!GetGame().IsMultiplayer())
{
m_LiftWeapon_player = state;
hcw = GetCommandModifier_Weapons();
if (hcw)
hcw.LiftWeapon(state);
GetWeaponManager().OnLiftWeapon();
return;
}
ScriptInputUserData ctx = new ScriptInputUserData;
if (GetGame().IsMultiplayer() && GetGame().IsClient() && !ctx.CanStoreInputUserData())
{
//Print("ctx unavailable");
return;
}
else if (GetGame().IsMultiplayer() && GetGame().IsClient() && ctx.CanStoreInputUserData())
{
//Print("sending ECB cancel request");
ctx.Write(INPUT_UDT_WEAPON_LIFT_EVENT);
ctx.Write(state);
ctx.Send();
}
}
override void CheckLiftWeapon()
{
// lift weapon check
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
Weapon_Base weap;
if (Weapon_Base.CastTo(weap, GetItemInHands()))
{
bool limited = weap.LiftWeaponCheck(this);
if (limited && !m_LiftWeapon_player)
SendLiftWeaponSync(true);
else if (!limited && m_LiftWeapon_player)
SendLiftWeaponSync(false);
}
else if (m_LiftWeapon_player)
{
SendLiftWeaponSync(false);
}
}
}
override void ProcessLiftWeapon()
{
if (m_ProcessLiftWeapon)
{
HumanCommandWeapons hcw = GetCommandModifier_Weapons();
if (hcw)
hcw.LiftWeapon(m_ProcessLiftWeaponState);
GetWeaponManager().OnLiftWeapon();
m_LiftWeapon_player = m_ProcessLiftWeaponState;
m_ProcessLiftWeapon = false;
//Debug.Log("SimulationStamp_server: " + this.GetSimulationTimeStamp());
}
}
//! state 'true' == hide
override void HideClothing(ItemOptics optic, bool state)
{
super.HideClothing(optic, state);
array<int> clothingArray = new array<int>;
Clothing clothes;
if (state && DayZPlayerCameraOptics.Cast(m_CurrentCamera))
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
clothingArray.Insert(InventorySlots.BACK);
clothingArray.Insert(InventorySlots.SHOULDER);
clothingArray.Insert(InventorySlots.MELEE);
if (optic && optic.GetCurrentStepFOV() < GameConstants.DZPLAYER_CAMERA_FOV_IRONSIGHTS)
{
clothingArray.Insert(InventorySlots.BODY);
clothingArray.Insert(InventorySlots.VEST);
}
SetInvisibleRecursive(true,this,clothingArray);
}
}
//showing should be instant (called directly, not via CallLater)
else
{
if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
{
clothingArray = {InventorySlots.BACK,InventorySlots.BODY,InventorySlots.VEST,InventorySlots.SHOULDER,InventorySlots.MELEE};
SetInvisibleRecursive(false,this,clothingArray);
}
}
}
void RequestUnconsciousness(bool enable)
{
DayZPlayerSyncJunctures.SendPlayerUnconsciousness(this, enable);
}
override void SetDeathDarknessLevel(float duration, float tick_time)
{
super.SetDeathDarknessLevel(duration, tick_time);
if (IsControlledPlayer())
{
float actual_tick = tick_time;
if (GetDamageDealtEffect())
m_DamageDealtEffect = null;
if (GetFlashbangEffect())
m_FlashbangEffect = null;
float progress;
if (duration > 0)
progress = 1 - ((duration - m_DeathDarkeningCurrentTime) / duration);
m_DeathDarkeningCurrentTime += actual_tick;
if (!IsAlive() && IsPlayerSelected())
{
m_DeathDarkeningParam.param1 = progress;
PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Start(m_DeathDarkeningParam);
}
if (m_DeathDarkeningCurrentTime >= duration)
{
StopDeathDarkeningEffect();
}
}
else
{
StopDeathDarkeningEffect();
}
}
override bool IsInFBEmoteState()
{
if (!IsEmotePlaying())
return false;
if ((m_EmoteManager.m_Callback && m_EmoteManager.m_Callback.m_IsFullbody) || m_EmoteManager.m_IsSurrendered)
{
return true;
}
return false;
}
//! ends surrender, originally intended for surrender->restrained transitioning
void EndSurrenderRequest(SurrenderData data = null)
{
if (m_EmoteManager)
m_EmoteManager.EndSurrenderRequest(data);
}
bool IsSurrendered()
{
if (m_EmoteManager)
return m_EmoteManager.m_IsSurrendered;
return false;
}
bool IsPlayerLoaded()
{
return m_PlayerLoaded;
}
//disconnected, caused problems. Awaiting refactor
override void CheckAnimationOverrides()
{
//FB gesture slideposeangle override
if (IsInFBEmoteState() && IsControlledPlayer() && IsPlayerSelected())
{
OverrideSlidePoseAngle(Math.PI2);
}
else if (!IsInFBEmoteState() && IsControlledPlayer() && IsPlayerSelected())
{
OverrideSlidePoseAngle(m_OriginalSlidePoseAngle);
}
//+add more, if needed
}
/*void OnSurrenderEnd()
{
}*/
bool CanRedirectToWeaponManager (notnull EntityAI item, out bool isActionPossible)
{
isActionPossible = false;
Magazine mag = Magazine.Cast(item);
Weapon_Base wpn = Weapon_Base.Cast(item.GetHierarchyParent());
if (mag && wpn)
{
if (GetWeaponManager().CanDetachMagazine(wpn, mag))
{
//Print("[inv] PlayerBase.CanRedirectToWeaponManager OK, can detach mag=" + mag + " from wpn=" + wpn);
isActionPossible = true;
}
else
{
//Print("[inv] PlayerBase.CanRedirectToWeaponManager cannot detach mag=" + mag + " from wpn=" + wpn);
}
return true;
}
return false;
}
// Inventory actions with redirection to weapon manager
override bool PredictiveTakeEntityToTargetInventory (notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
{
bool can_detach;
if (CanRedirectToWeaponManager(item,can_detach))
{
InventoryLocation il = new InventoryLocation();
if (can_detach && target.GetInventory().FindFreeLocationFor(item, flags, il))
{
return GetWeaponManager().DetachMagazine(il);
}
return false;
}
return super.PredictiveTakeEntityToTargetInventory(target, flags, item);
}
override bool PredictiveTakeEntityToInventory (FindInventoryLocationType flags, notnull EntityAI item)
{
bool can_detach;
if (CanRedirectToWeaponManager(item,can_detach))
{
InventoryLocation il = new InventoryLocation();
if (can_detach && GetInventory().FindFreeLocationFor(item, flags, il))
{
return GetWeaponManager().DetachMagazine(il);
}
return false;
}
return super.PredictiveTakeEntityToInventory(flags, item);
}
override bool PredictiveTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
{
Weapon_Base parentWpn = Weapon_Base.Cast(target);
Magazine mag = Magazine.Cast(item);
if (parentWpn && mag)
{
if (GetWeaponManager().CanAttachMagazine(parentWpn, mag))
return GetWeaponManager().AttachMagazine(mag);
return false;
}
return super.PredictiveTakeEntityToTargetAttachment(target, item);
}
override bool PredictiveTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
{
Weapon_Base parentWpn = Weapon_Base.Cast(target);
Magazine mag = Magazine.Cast(item);
if (parentWpn && mag)
{
if (target.CanReceiveAttachment(item,slot) && GetWeaponManager().CanAttachMagazine(parentWpn, mag))
return GetWeaponManager().AttachMagazine(mag);
return false;
}
return super.PredictiveTakeEntityToTargetAttachmentEx(target, item,slot);
}
override bool PredictiveTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
{
bool can_detach;
if (CanRedirectToWeaponManager(item,can_detach))
{
InventoryLocation il = new InventoryLocation();
if (can_detach && target.GetInventory().FindFreeLocationFor(item, FindInventoryLocationType.CARGO, il))
{
return GetWeaponManager().DetachMagazine(il);
}
return false;
}
return super.PredictiveTakeEntityToTargetCargo(target,item);
}
override bool PredictiveTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
{
bool can_detach;
if (CanRedirectToWeaponManager(item, can_detach))
{
if (can_detach)
{
InventoryLocation dst = new InventoryLocation;
dst.SetCargoAuto(cargo, item, row, col, item.GetInventory().GetFlipCargo());
return GetWeaponManager().DetachMagazine(dst);
}
return false;
}
return super.PredictiveTakeEntityToTargetCargoEx (cargo, item, row, col);
}
override bool PredictiveDropEntity (notnull EntityAI item)
{
bool can_detach;
if (CanRedirectToWeaponManager(item,can_detach))
{
if (can_detach)
{
vector m4[4];
Math3D.MatrixIdentity4(m4);
//! We don't care if a valid transform couldn't be found, we just want to preferably use it instead of placing on the player
GameInventory.PrepareDropEntityPos(this, item, m4, false, GameConstants.INVENTORY_ENTITY_DROP_OVERLAP_DEPTH);
InventoryLocation il = new InventoryLocation;
il.SetGround(item, m4);
return GetWeaponManager().DetachMagazine(il);
}
return false;
}
return super.PredictiveDropEntity(item);
}
override bool PredictiveSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
{
ForceStandUpForHeavyItemsSwap(item1, item2);
//Print("PlayerBase | PredictiveSwapEntities");
Magazine swapmag1 = Magazine.Cast(item1);
Magazine swapmag2 = Magazine.Cast(item2);
if (swapmag1 && swapmag2)
{
Weapon_Base parentWpn;
if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
{
if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag2))
{
Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag1=" + swapmag1);
return GetWeaponManager().SwapMagazine(swapmag2);
}
else
{
Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
return false;
}
}
if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
{
if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag1))
{
Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag2=" + swapmag2);
return GetWeaponManager().SwapMagazine(swapmag1);
}
else
{
Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
return false;
}
}
}
EntityAI item_hands;
EntityAI item_ground;
if (IsSwapBetweenHandsAndGroundLargeItem(item1,item2,item_hands,item_ground) && !m_ActionManager.GetRunningAction())
{
ActionManagerClient mngr_client;
CastTo(mngr_client,m_ActionManager);
ActionTarget atrg = new ActionTarget(item_ground,null,-1,vector.Zero,-1.0);
if (mngr_client.GetAction(ActionSwapItemToHands).Can(this,atrg,ItemBase.Cast(item_hands)))
{
mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,ItemBase.Cast(item_hands));
return true;
}
return super.PredictiveSwapEntities(item1, item2);
}
else
return super.PredictiveSwapEntities(item1, item2);
}
override bool PredictiveForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
{
ForceStandUpForHeavyItemsSwap(item1, item2);
InventoryLocation il = new InventoryLocation;
if (item1.IsHeavyBehaviour() && item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND && !m_ActionManager.GetRunningAction())
{
//Print("override bool PredictiveForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)");
ActionManagerClient mngr_client;
CastTo(mngr_client,m_ActionManager);
ActionTarget atrg = new ActionTarget(item1,null,-1,vector.Zero,-1.0);
if (mngr_client.GetAction(ActionSwapItemToHands).Can(this,atrg,ItemBase.Cast(item2)))
{
mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,ItemBase.Cast(item2));
}
return true;
}
else
return super.PredictiveForceSwapEntities(item1, item2, item2_dst);
}
override void PredictiveTakeEntityToHands(EntityAI item)
{
if (item.IsHeavyBehaviour() && !m_ActionManager.GetRunningAction() && !item.GetHierarchyParent())
{
ActionManagerClient mngr_client;
if (CastTo(mngr_client,m_ActionManager))
{
ActionTarget atrg = new ActionTarget(item,null,-1,vector.Zero,-1.0);
if (mngr_client.GetAction(ActionTakeItemToHands).Can(this,atrg,null))
{
mngr_client.PerformActionStart(mngr_client.GetAction(ActionTakeItemToHands),atrg,null);
}
/*).Can(this,
mngr_client.ActionStart(mngr_client.GetAction(ActionTakeItemToHands),mngr_client.FindActionTarget(),null);
return;*/
}
}
else
super.PredictiveTakeEntityToHands(item);
}
override bool PredictiveTakeToDst (notnull InventoryLocation src, notnull InventoryLocation dst)
{
EntityAI item = src.GetItem();
if (item)
{
bool can_detach;
if (CanRedirectToWeaponManager(item,can_detach))
{
if (can_detach)
{
return GetWeaponManager().DetachMagazine(dst);
}
return false;
}
return super.PredictiveTakeToDst(src,dst);
}
return false;
}
bool IsSwapBetweenHandsAndGroundLargeItem(notnull EntityAI item1, notnull EntityAI item2, out EntityAI item_hands, out EntityAI item_ground)
{
InventoryLocation il = new InventoryLocation;
if (item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.HANDS)
item_hands = item1;
if (item2.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.HANDS)
item_hands = item2;
if (item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND)
item_ground = item1;
if (item2.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND)
item_ground = item2;
return item_hands && item_ground && item_ground.IsHeavyBehaviour();
}
//! Dynamic hair hiding
void SetHairLevelToHide(int level, bool state, bool was_debug = false)
{
if (was_debug && GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
return;
if (!m_CharactersHead)
{
ErrorEx("No valid head detected on character!");
return;
}
if (level == -1) //hide/show ALL
{
m_HideHairAnimated = !m_HideHairAnimated;
for (int i = 0; i < m_CharactersHead.m_HeadHairSelectionArray.Count(); ++i)
{
//m_CharactersHead.SetSimpleHiddenSelectionState(i,m_HideHairAnimated);
SelectionTranslation stt = SelectionTranslation.Cast(m_CharactersHead.m_HeadHairHidingStateMap.Get(i));
stt.SetSelectionState(m_HideHairAnimated);
m_CharactersHead.m_HeadHairHidingStateMap.Set(i, stt);
#ifdef DIAG_DEVELOPER
#ifndef SERVER
PluginDiagMenuClient diagmenu = PluginDiagMenuClient.Cast(GetPlugin(PluginDiagMenuClient));
diagmenu.m_HairHidingStateMap.Set(i, m_HideHairAnimated);
#endif
#endif
}
}
else //hide/show selected level only
{
bool switchState;
if (was_debug)
{
#ifdef DIAG_DEVELOPER
#ifndef SERVER
PluginDiagMenuClient diagmenuu = PluginDiagMenuClient.Cast(GetPlugin(PluginDiagMenuClient));
switchState = !diagmenuu.m_HairHidingStateMap.Get(level);
diagmenuu.m_HairHidingStateMap.Set(level, switchState);
#endif
#endif
}
else
{
switchState = !state;
}
//m_CharactersHead.SetSimpleHiddenSelectionState(level,switchState);
stt = SelectionTranslation.Cast(m_CharactersHead.m_HeadHairHidingStateMap.Get(level));
stt.SetSelectionState(switchState);
m_CharactersHead.m_HeadHairHidingStateMap.Set(level, stt); //nescessary?
}
}
void HideHairSelections(ItemBase item, bool state)
{
if (!item || !item.GetHeadHidingSelection() || !m_CharactersHead)
return;
int slot_id; //item currently attached (or detaching from) here
string slot_name; //item currently attached (or detaching from) here
string str
int idx = 0;
int i;
int count;
item.GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name);
if (item.HidesSelectionBySlot())
{
count = item.GetInventory().GetSlotIdCount();
for (i = 0; i < count; i++)
{
if (item.GetInventory().GetSlotId(i) == slot_id)
{
str = item.GetHeadHidingSelection().Get(i);
idx = m_CharactersHead.m_HeadHairSelectionArray.Find(str);
if (idx != -1)
SetHairLevelToHide(idx,state);
#ifdef DEVELOPER
else
Debug.Log("No valid selection '" + str + "' found on head of " + GetType() + ". Verify the p3d, model config, and the 'HAIR_HIDING_SELECTIONS' macro in basicDefines.");
#endif
}
}
}
else
{
count = item.GetHeadHidingSelection().Count();
for (i = 0; i < count; i++)
{
str = item.GetHeadHidingSelection().Get(i);
idx = m_CharactersHead.m_HeadHairSelectionArray.Find(str);
if (idx != -1)
SetHairLevelToHide(idx,state);
#ifdef DEVELOPER
else
Debug.Log("No valid selection '" + str + "' found on head of " + GetType() + ". Verify the p3d, model config, and the 'HAIR_HIDING_SELECTIONS' macro in basicDefines.");
#endif
}
}
UpdateHairSelectionVisibility();
}
void UpdateHairSelectionVisibility(bool was_debug = false)
{
if (!m_CharactersHead)
return;
bool shown;
bool exception_hidden = false;
int i;
int count = m_CharactersHead.m_HeadHairHidingStateMap.Count();
SelectionTranslation stt;
//hide/show beard
if (IsMale() && m_CharactersHead.GetBeardIndex() > -1 && !was_debug)
{
SetHairLevelToHide(m_CharactersHead.GetBeardIndex(),GetLifeSpanState() != LifeSpanState.BEARD_EXTRA);
}
//show all first
for (i = 0; i < count; i++)
{
m_CharactersHead.SetSimpleHiddenSelectionState(i,true);
}
//then carve it up
for (i = 0; i < count; i++)
{
stt = m_CharactersHead.m_HeadHairHidingStateMap.Get(i);
shown = stt.GetSelectionState();
if (!shown)
{
if (/*IsMale() && */!m_CharactersHead.IsHandlingException())
{
m_CharactersHead.SetSimpleHiddenSelectionState(i,shown);
UpdateTranslatedSelections(stt);
//Print("hidden idx: " + i);
}
else
{
exception_hidden = true;
}
}
}
//exceptions handled differently; hides hair
if (exception_hidden)
{
m_CharactersHead.SetSimpleHiddenSelectionState(m_CharactersHead.GetHairIndex(),false);
if (IsMale())
m_CharactersHead.SetSimpleHiddenSelectionState(m_CharactersHead.GetBeardIndex(),false);
}
}
void UpdateTranslatedSelections(SelectionTranslation stt)
{
int index;
array<int> translatedSelectinosArray = stt.GetTranslatedSelections();
for (int i = 0; i < translatedSelectinosArray.Count(); i++)
{
index = translatedSelectinosArray.Get(i);
//if (index > -1)
m_CharactersHead.SetSimpleHiddenSelectionState(index,false); //safe this way, only hiding/carving from shown parts
}
}
//! helper method for re-checking hairhiding on character load
void CheckHairClippingOnCharacterLoad()
{
ItemBase headgear = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.HEADGEAR));
ItemBase mask = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
HideHairSelections(headgear,true);
HideHairSelections(mask,true);
}
bool IsNVGWorking()
{
return m_ActiveNVTypes && m_ActiveNVTypes.Count() > 0;
}
bool IsNVGLowered()
{
return m_LoweredNVGHeadset;
}
int GetNVType()
{
if (!m_ActiveNVTypes || m_ActiveNVTypes.Count() == 0)
{
return NVTypes.NONE;
}
else
{
return m_ActiveNVTypes[m_ActiveNVTypes.Count() - 1];
}
}
array<int> GetNVTypesArray()
{
return m_ActiveNVTypes;
}
//!Deprecated
void SetNVGWorking(bool state)
{
//Deprecated, below is for legacy's sake
AddActiveNV(NVTypes.NV_GOGGLES);
}
void SetNVGLowered(bool state)
{
m_LoweredNVGHeadset = state;
}
void AddActiveNV(int type)
{
if (!m_ActiveNVTypes || (GetGame().IsMultiplayer() && GetGame().IsServer()))
{
#ifdef DEVELOPER
Error("AddActiveNV | illegal server-side call!");
#endif
return;
}
if (m_ActiveNVTypes.Find(type) == -1) //TODO - set instead?
m_ActiveNVTypes.Insert(type);
}
void RemoveActiveNV(int type)
{
if (!m_ActiveNVTypes || (GetGame().IsMultiplayer() && GetGame().IsServer()))
{
#ifdef DEVELOPER
Error("RemoveActiveNV | illegal server-side call!");
#endif
return;
}
if (m_ActiveNVTypes.Find(type) != -1) //TODO - set instead?
m_ActiveNVTypes.RemoveItem(type);
}
void ResetActiveNV()
{
m_ActiveNVTypes.Clear();
}
#ifdef DEVELOPER
override string GetDebugText()
{
string text = super.GetDebugText();
/*
text += "GetMovementTimeToStrafeJog:" + CfgGameplayHandler.GetMovementTimeToStrafeJog() + "\n";
text += "GetMovementTimeToStrafeSprint:" + CfgGameplayHandler.GetMovementTimeToStrafeSprint()+ "\n";
SHumanCommandMoveSettings moveSettings = GetDayZPlayerType().CommandMoveSettingsW();
if (moveSettings)
{
text += "hmcs.m_fDirFilterTimeout:" + moveSettings.m_fDirFilterTimeout + "\n";
text += "hmcs.m_fDirFilterSprintTimeout:" + moveSettings.m_fDirFilterSprintTimeout+ "\n";
}*/
return text;
}
void DEBUGRotateNVG()
{
NVGoggles nvg;
if (FindAttachmentBySlotName("Eyewear"))
{
nvg = NVGoggles.Cast(FindAttachmentBySlotName("Eyewear").FindAttachmentBySlotName("NVG"));
}
else if (FindAttachmentBySlotName("Headgear"))
{
nvg = NVGoggles.Cast(FindAttachmentBySlotName("Headgear").FindAttachmentBySlotName("NVG"));
}
if (nvg)
{
nvg.RotateGoggles(nvg.m_IsLowered);
}
}
#endif
void AdjustBandana(EntityAI item, string slot_name)
{
if (Bandana_ColorBase.Cast(item))
{
if (slot_name == "Headgear")
{
item.SetSimpleHiddenSelectionState(0,1);
item.SetSimpleHiddenSelectionState(1,0);
}
else if (slot_name == "Mask")
{
item.SetSimpleHiddenSelectionState(0,0);
item.SetSimpleHiddenSelectionState(1,1);
}
}
}
//client-side
void UpdateCorpseStateVisual()
{
//Print("---Prettying up corpses... | " + GetGame().GetTime() + " | " + this + " | " + GetType() + "---");
//Print("m_DecayedTexture = " + m_DecayedTexture);
int state = Math.AbsInt(m_CorpseState);//negative sign denotes a special meaning(state was forced to a live player), but we are only intetested in the positive value here
if (state == PlayerConstants.CORPSE_STATE_DECAYED)
{
EntityAI bodypart;
ItemBase item;
string path;
int idx;
int slot_id;
array<string> bodyparts = {"Gloves","Body","Legs","Feet"};
for (int i = 0; i < bodyparts.Count(); i++)
{
slot_id = InventorySlots.GetSlotIdFromString(bodyparts.Get(i));
bodypart = GetInventory().FindPlaceholderForSlot(slot_id);
item = ItemBase.Cast(GetInventory().FindAttachment(slot_id));
if (bodypart)
{
path = "cfgVehicles " + bodypart.GetType();
idx = bodypart.GetHiddenSelectionIndex("personality");
if (idx > -1)
{
bodypart.SetObjectTexture(idx,m_DecayedTexture);
}
}
if (item)
{
path = "cfgVehicles " + item.GetType();
idx = item.GetHiddenSelectionIndex("personality");
if (idx > -1)
{
item.SetObjectTexture(idx,m_DecayedTexture);
}
}
}
SetFaceTexture(m_DecayedTexture);
}
}
void SetDecayEffects(int effect = -1)
{
int boneIdx = GetBoneIndexByName("Spine2");
Particle p;
switch (effect)
{
case PlayerConstants.CORPSE_STATE_MEDIUM :
//play medium sound/flies particle
if (!m_FliesEff)
m_FliesEff = new EffSwarmingFlies();
if (m_FliesEff && !SEffectManager.IsEffectExist(m_FliesIndex))
{
m_FliesEff.SetDecalOwner(this);
m_FliesIndex = SEffectManager.PlayOnObject(m_FliesEff, this, "0 0.25 0");
p = m_FliesEff.GetParticle();
AddChild(p, boneIdx);
if (!m_SoundFliesEffect)
{
PlaySoundSetLoop(m_SoundFliesEffect, "Flies_SoundSet", 1.0, 1.0);
// ErrorEx("DbgFlies | CORPSE_STATE_MEDIUM | m_SoundFliesEffect created! " + m_SoundFliesEffect,ErrorExSeverity.INFO);
}
}
break;
case PlayerConstants.CORPSE_STATE_DECAYED :
//play serious sound/flies particle
if (!m_FliesEff)
m_FliesEff = new EffSwarmingFlies();
if (m_FliesEff && !SEffectManager.IsEffectExist(m_FliesIndex))
{
m_FliesEff.SetDecalOwner(this);
m_FliesIndex = SEffectManager.PlayOnObject(m_FliesEff, this, "0 0.25 0");
p = m_FliesEff.GetParticle();
AddChild(p, boneIdx);
if (!m_SoundFliesEffect)
{
PlaySoundSetLoop(m_SoundFliesEffect, "Flies_SoundSet", 1.0, 1.0);
// ErrorEx("DbgFlies | CORPSE_STATE_DECAYED | m_SoundFliesEffect created! " + m_SoundFliesEffect,ErrorExSeverity.INFO);
}
}
break;
//remove
default:
SEffectManager.DestroyEffect(m_FliesEff);
// ErrorEx("DbgFlies | StopSoundSet | exit 3 ",ErrorExSeverity.INFO);
StopSoundSet(m_SoundFliesEffect);
break;
}
}
void PreloadDecayTexture()
{
int idx;
int slot_id;
idx = GetHiddenSelectionIndex("decay_preload");
if (idx > -1)
{
SetObjectTexture(idx,m_DecayedTexture);
//Print("'decay_preload'" + m_DecayedTexture +" loaded on " + GetModelName());
}
else
{
//Print("No 'decay_preload' selection found on " + this);
}
}
void SetLastMapInfo(float scale, vector pos)
{
m_LastMapScale = scale;
m_LastMapPos = pos;
}
bool GetLastMapInfo(out float scale, out vector pos)
{
scale = m_LastMapScale;
pos = m_LastMapPos;
return m_LastMapScale != -1.0;
}
override bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only = true)
{
vector dir;
ItemBase item = ItemBase.Cast(entity);
if (GetItemInHands() == item) //from hands
{
//HOTFIX
return PredictiveDropEntity(item);
if (entity.ConfigGetString("physLayer") != "item_large" && heavy_item_only)
{
return PredictiveDropEntity(item);
}
else
{
dir = GetOrientation();
//item.m_ItemBeingDropped = true;
return GetHumanInventory().ThrowEntity(item,dir,0);
}
}
else //from anywhere else
{
ActionManagerClient mngr_client;
if (CastTo(mngr_client,m_ActionManager))
{
ActionTarget atrg = new ActionTarget(null, null, -1, vector.Zero, -1);
if (mngr_client.GetAction(ActionDropItemSimple).Can(this,atrg,item))
{
//Param1<bool> p1 = new Param1<bool>(false);
//p1.param1 = heavy_item_only;
mngr_client.PerformActionStart(mngr_client.GetAction(ActionDropItemSimple),atrg,item/*,p1*/);
return true;
}
return false;
}
else
return true;
}
}
override void SetProcessUIWarning(bool state)
{
m_ProcessUIWarning = state;
}
void dmgDebugPrint(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
{
/*Print("ProjectileDebugging | Damage Health: " + damageResult.GetDamage(dmgZone,"Health") + " | Component: " + component + " | Zone: " + dmgZone + "| Timestamp: " + GetSimulationTimeStamp());
Print("ProjectileDebugging | speedCoef: " + speedCoef);
Print("ProjectileDebugging | GetWorldTime(): " + GetWorldTime());
Print("-----------------------------------------------");*/
}
//Use this method to process additionnal dmg to legs specifically (must use the dmg system to fire relevant events)
//Legzone is a dummy to inflict damage once and NOT transfer damage to other zones. All leg zones will drop to 0 anyway
void DamageAllLegs(float inputDmg)
{
array<string> legZones = new array<string>;
legZones.Insert("LeftLeg");
legZones.Insert("RightLeg");
legZones.Insert("RightFoot");
legZones.Insert("LeftFoot");
for (int i = 0; i < legZones.Count(); i++)
{
DecreaseHealth(legZones[i],"",inputDmg);
}
}
//! tries to hide item in player's hands, some exceptions for various movement states
void TryHideItemInHands(bool hide, bool force = false)
{
if (!hide && ((!IsSwimming() && !IsClimbingLadder() && !IsInVehicle() && !AnimCommandCheck(HumanMoveCommandID.CommandSwim | HumanMoveCommandID.CommandLadder | HumanMoveCommandID.CommandVehicle)) || force))
{
GetItemAccessor().HideItemInHands(false);
}
else
{
GetItemAccessor().HideItemInHands(true);
}
}
//!
bool CheckAndExecuteStackSplit(FindInventoryLocationType flags, notnull EntityAI item, notnull EntityAI target)
{
float stackable = item.GetTargetQuantityMax();
if (!(stackable == 0 || stackable >= item.GetQuantity()))
{
InventoryLocation il = new InventoryLocation;
if (target && target.GetInventory().FindFreeLocationFor(item, flags, il))
{
ItemBase itemB;
if (CastTo(itemB, item))
{
itemB.SplitIntoStackMaxToInventoryLocationClient(il);
return true;
}
}
}
return false;
}
bool CheckAndExecuteStackSplitToInventoryLocation(InventoryLocation il, notnull EntityAI item)
{
float stackable = item.GetTargetQuantityMax();
if (!(stackable == 0 || stackable >= item.GetQuantity()))
{
ItemBase itemB;
if (CastTo(itemB, item))
{
itemB.SplitIntoStackMaxToInventoryLocationClient(il);
return true;
}
}
return false;
}
override protected bool TakeEntityToInventoryImpl(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
{
if (CheckAndExecuteStackSplit(flags, item, this))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Inv(SPLIT) item=" + GetDebugName(item));
return true;
}
return super.TakeEntityToInventoryImpl(mode, flags, item);
}
override protected bool TakeEntityToCargoImpl(InventoryMode mode, notnull EntityAI item)
{
if (CheckAndExecuteStackSplit(FindInventoryLocationType.CARGO, item, this))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Cgo(SPLIT) item=" +GetDebugName(item));
return true;
}
return super.TakeEntityToCargoImpl(mode, item);
}
override protected bool TakeEntityAsAttachmentImpl(InventoryMode mode, notnull EntityAI item)
{
if (CheckAndExecuteStackSplit(FindInventoryLocationType.ATTACHMENT, item, this))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Att(SPLIT) item=" + GetDebugName(item));
return true;
}
return super.TakeEntityAsAttachmentImpl(mode, item);
}
override void TakeEntityToHandsImpl(InventoryMode mode, EntityAI item)
{
if (CheckAndExecuteStackSplit(FindInventoryLocationType.HANDS, item, this))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Hands(SPLIT) item=" + GetDebugName(item));
return;
}
super.TakeEntityToHandsImpl(mode, item);
}
override protected bool TakeEntityToTargetInventoryImpl(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
{
if (CheckAndExecuteStackSplit(flags, item, target))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetInv(SPLIT) item=" + GetDebugName(item));
return true;
}
return super.TakeEntityToTargetInventoryImpl(mode, target, flags, item);
}
override protected bool TakeEntityToTargetCargoImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
{
if (CheckAndExecuteStackSplit(FindInventoryLocationType.CARGO, item, target))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetCgo(SPLIT) item=" + GetDebugName(item));
return true;
}
return super.TakeEntityToTargetCargoImpl(mode, target, item);
}
override protected bool TakeEntityToTargetAttachmentImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
{
if (CheckAndExecuteStackSplit(FindInventoryLocationType.ATTACHMENT, item, target))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetAtt(SPLIT) item=" + GetDebugName(item));
return true;
}
return super.TakeEntityToTargetAttachmentImpl(mode, target, item);
}
override protected bool TakeToDstImpl(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
{
if (CheckAndExecuteStackSplitToInventoryLocation(dst, dst.GetItem()))
{
if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Dst(SPLIT) item=" + GetDebugName(dst.GetItem()));
return true;
}
return super.TakeToDstImpl(mode, src, dst);
}
override vector GetCenter()
{
return GetBonePositionWS(GetBoneIndexByName("spine3"));
}
// contaminated areas - temp stuff
void ContaminatedParticleAdjustment()
{
if (GetCommand_Move() && m_ContaminatedAroundPlayer && m_ContaminatedAroundPlayerTiny)
{
float playerSpeed = GetCommand_Move().GetCurrentMovementSpeed();
//Print(playerSpeed);
// 1 - prone, crouch
// 2 - jog
// 3 - sprint
float particleLifetime = 5.25;
float particleSpeed = 0.25;
if (playerSpeed >= 1)
{
particleLifetime = 3.5;
particleSpeed = 3.25;
}
if (playerSpeed >= 2)
{
particleLifetime = 2.5;
particleSpeed = 5.25;
}
if (playerSpeed >= 3)
{
particleLifetime = 1.5;
particleSpeed = 8.25;
}
m_ContaminatedAroundPlayer.SetParameter(0, EmitorParam.LIFETIME, particleLifetime);
m_ContaminatedAroundPlayer.SetParameter(1, EmitorParam.LIFETIME, particleLifetime);
m_ContaminatedAroundPlayer.SetParameter(2, EmitorParam.LIFETIME, particleLifetime);
m_ContaminatedAroundPlayer.SetParameter(3, EmitorParam.LIFETIME, particleLifetime);
m_ContaminatedAroundPlayerTiny.SetParameter(0, EmitorParam.VELOCITY, particleSpeed);
vector transform[4];
GetTransform(transform);
m_ContaminatedAroundPlayer.SetTransform(transform);
m_ContaminatedAroundPlayerTiny.SetTransform(transform);
}
}
void HandleGlassesEffect()
{
if (!IsControlledPlayer())
return;
int i;
if (m_ProcessRemoveGlassesEffects)
{
for (i = 0; i < m_ProcessRemoveGlassesEffects.Count(); i++)
{
PPERequesterBank.GetRequester(m_ProcessRemoveGlassesEffects[i]).Stop();
}
m_ProcessRemoveGlassesEffects.Clear();
}
if (m_ProcessAddGlassesEffects)
{
for (i = 0; i < m_ProcessAddGlassesEffects.Count(); i++)
{
PPERequesterBank.GetRequester(m_ProcessAddGlassesEffects[i]).Start();
}
m_ProcessAddGlassesEffects.Clear();
}
}
override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
{
CachedObjectsArrays.ARRAY_STRING.Clear();
GetActionComponentNameList(componentIndex, CachedObjectsArrays.ARRAY_STRING, LOD.NAME_FIRE);
int pivot = componentIndex;
int newPivot = -1;
string compName;
for (int i = 0; i < CachedObjectsArrays.ARRAY_STRING.Count() && newPivot == -1; i++)
{
compName = CachedObjectsArrays.ARRAY_STRING.Get(i);
newPivot = GetBoneIndexByName(compName);
}
if (newPivot != -1)
{
pivot = newPivot;
}
vector parentTransMat[4];
vector arrowTransMat[4];
arrow.GetTransform(arrowTransMat);
if (pivot == -1)
{
GetTransformWS(parentTransMat);
}
else
{
vector rotMatrix[3];
Math3D.YawPitchRollMatrix(closeBoneRotWS * Math.RAD2DEG,rotMatrix);
parentTransMat[0] = rotMatrix[0];
parentTransMat[1] = rotMatrix[1];
parentTransMat[2] = rotMatrix[2];
parentTransMat[3] = closeBonePosWS;
}
Math3D.MatrixInvMultiply4(parentTransMat, arrowTransMat, arrowTransMat);
Math3D.MatrixOrthogonalize4(arrowTransMat);
arrow.SetTransform(arrowTransMat);
AddChild(arrow, pivot);
#ifdef SERVER
// creating bleeding source
BleedingSourcesManagerServer bleedingManager = GetBleedingManagerServer();
if (bleedingManager)
{
if (!bleedingManager.AttemptAddBleedingSourceBySelection(compName))
bleedingManager.AttemptAddBleedingSourceBySelection("Pelvis");//fallback, if we can't attach bleeding source to the fallback location because there already is another one, it's fine, we are just trying make sure there is at least one
}
#endif
}
override bool IsManagingArrows()
{
return true;
}
string GetCachedName()
{
return m_CachedPlayerName;
}
string GetCachedID()
{
return m_CachedPlayerID;
}
}
#ifdef DEVELOPER
PlayerBase _player;
#endif
|