Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 00572 00573 00574 00575 00576 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 00588 00589 00590 00591 00592 00593 00594 00595 00596 00597 00598 00599 00600 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 00613 00614 00615 00616 00617 00618 00619 00620 00621 00622 00623 00624 00625 00626 00627 00628 00629 00630 00631 00632 00633 00634 00635 00636 00637 00638 00639 00640 00641 00642 00643 00644 00645 00646 00647 00648 00649 00650 00651 00652 00653 00654 00655 00656 00657 00658 00659 00660 00661 00662 00663 00664 00665 00666 00667 00668 00669 00670 00671 00672 00673 00674 00675 00676 00677 00678 00679 00680 00681 00682 00683 00684 00685 00686 00687 00688 00689 00690 00691 00692 00693 00694 00695 00696 00697 00698 00699 00700 00701 00702 00703 00704 00705 00706 00707 00708 00709 00710 00711 00712 00713 00714 00715 00716 00717 00718 00719 00720 00721 00722 00723 00724 00725 00726 00727 00728 00729 00730 00731 00732 00733 00734 00735 00736 00737 00738 00739 00740 00741 00742 00743 00744 00745 00746 00747 00748 00749 00750 00751 00752 00753 00754 00755 00756 00757 00758 00759 00760 00761 00762 00763 00764 00765 00766 00767 00768 00769 00770 00771 00772 00773 00774 00775 00776 00777 00778 00779 00780 00781 00782 00783 00784 00785 00786 00787 00788 00789 00790 00791 00792 00793 00794 00795 00796 00797 00798 00799 00800 00801 00802 00803 00804 00805 00806 00807 00808 00809 00810 00811 00812 00813 00814 00815 00816 00817 00818 00819 00820 00821 00822 00823 00824 00825 00826 00827 00828 00829 00830 00831 00832 00833 00834 00835 00836 00837 00838 00839 00840 00841 00842 00843 00844 00845 00846 00847 00848 00849 00850 00851 00852 00853 00854 00855 00856 00857 00858 00859 00860 00861 00862 00863 00864 00865 00866 00867 00868 00869 00870 00871 00872 00873 00874 00875 00876 00877 00878 00879 00880 00881 00882 00883 00884 00885 00886 00887 00888 00889 00890 00891 00892 00893 00894 00895 00896 00897 00898 00899 00900 00901 00902 00903 00904 00905 00906 00907 00908 00909 00910 00911 00912 00913 00914 00915 00916 00917 00918 00919 00920 00921 00922 00923 00924 00925 00926 00927 00928 00929 00930 00931 00932 00933 00934 00935 00936 00937 00938 00939 00940 00941 00942 00943 00944 00945 00946 00947 00948 00949 00950 00951 00952 00953 00954 00955 00956 00957 00958 00959 00960 00961 00962 00963 00964 00965 00966 00967 00968 00969 00970 00971 00972 00973 00974 00975 00976 00977 00978 00979 00980 00981 00982 00983 00984 00985 00986 00987 00988 00989 00990 00991 00992 00993 00994 00995 00996 00997 00998 00999 01000 01001 01002 01003 01004 01005 01006 01007 01008 01009 01010 01011 01012 01013 01014 01015 01016 01017 01018 01019 01020 01021 01022 01023 01024 01025 01026 01027 01028 01029 01030 01031 01032 01033 01034 01035 01036 01037 01038 01039 01040 01041 01042 01043 01044 01045 01046 01047 01048 01049 01050 01051 01052 01053 01054 01055 01056 01057 01058 01059 01060 01061 01062 01063 01064 01065 01066 01067 01068 01069 01070 01071 01072 01073 01074 01075 01076 01077 01078 01079 01080 01081 01082 01083 01084 01085 01086 01087 01088 01089 01090 01091 01092 01093 01094 01095 01096 01097 01098 01099 01100 01101 01102 01103 01104 01105 01106 01107 01108 01109 01110 01111 01112 01113 01114 01115 01116 01117 01118 01119 01120 01121 01122 01123 01124 01125 01126 01127 01128 01129 01130 01131 01132 01133 01134 01135 01136 01137 01138 01139 01140 01141 01142 01143 01144 01145 01146 01147 01148 01149 01150 01151 01152 01153 01154 01155 01156 01157 01158 01159 01160 01161 01162 01163 01164 01165 01166 01167 01168 01169 01170 01171 01172 01173 01174 01175 01176 01177 01178 01179 01180 01181 01182 01183 01184 01185 01186 01187 01188 01189 01190 01191 01192 01193 01194 01195 01196 01197 01198 01199 01200 01201 01202 01203 01204 01205 01206 01207 01208 01209 01210 01211 01212 01213 01214 01215 01216 01217 01218 01219 01220 01221 01222 01223 01224 01225 01226 01227 01228 01229 01230 01231 01232 01233 01234 01235 01236 01237 01238 01239 01240 01241 01242 01243 01244 01245 01246 01247 01248 01249 01250 01251 01252 01253 01254 01255 01256 01257 01258 01259 01260 01261 01262 01263 01264 01265 01266 01267 01268 01269 01270 01271 01272 01273 01274 01275 01276 01277 01278 01279 01280 01281 01282 01283 01284 01285 01286 01287 01288 01289 01290 01291 01292 01293 01294 01295 01296 01297 01298 01299 01300 01301 01302 01303 01304 01305 01306 01307 01308 01309 01310 01311 01312 01313 01314 01315 01316 01317 01318 01319 01320 01321 01322 01323 01324 01325 01326 01327 01328 01329 01330 01331 01332 01333 01334 01335 01336 01337 01338 01339 01340 01341 01342 01343 01344 01345 01346 01347 01348 01349 01350 01351 01352 01353 01354 01355 01356 01357 01358 01359 01360 01361 01362 01363 01364 01365 01366 01367 01368 01369 01370 01371 01372 01373 01374 01375 01376 01377 01378 01379 01380 01381 01382 01383 01384 01385 01386 01387 01388 01389 01390 01391 01392 01393 01394 01395 01396 01397 01398 01399 01400 01401 01402 01403 01404 01405 01406 01407 01408 01409 01410 01411 01412 01413 01414 01415 01416 01417 01418 01419 01420 01421 01422 01423 01424 01425 01426 01427 01428 01429 01430 01431 01432 01433 01434 01435 01436 01437 01438 01439 01440 01441 01442 01443 01444 01445 01446 01447 01448 01449 01450 01451 01452 01453 01454 01455 01456 01457 01458 01459 01460 01461 01462 01463 01464 01465 01466 01467 01468 01469 01470 01471 01472 01473 01474 01475 01476 01477 01478 01479 01480 01481 01482 01483 01484 01485 01486 01487 01488 01489 01490 01491 01492 01493 01494 01495 01496 01497 01498 01499 01500 01501 01502 01503 01504 01505 01506 01507 01508 01509 01510 01511 01512 01513 01514 01515 01516 01517 01518 01519 01520 01521 01522 01523 01524 01525 01526 01527 01528 01529 01530 01531 01532 01533 01534 01535 01536 01537 01538 01539 01540 01541 01542 01543 01544 01545 01546 01547 01548 01549 01550 01551 01552 01553 01554 01555 01556 01557 01558 01559 01560 01561 01562 01563 01564 01565 01566 01567 01568 01569 01570 01571 01572 01573 01574 01575 01576 01577 01578 01579 01580 01581 01582 01583 01584 01585 01586 01587 01588 01589 01590 01591 01592 01593 01594 01595 01596 01597 01598 01599 01600 01601 01602 01603 01604 01605 01606 01607 01608 01609 01610 01611 01612 01613 01614 01615 01616 01617 01618 01619 01620 01621 01622 01623 01624 01625 01626 01627 01628 01629 01630 01631 01632 01633 01634 01635 01636 01637 01638 01639 01640 01641 01642 01643 01644 01645 01646 01647 01648 01649 01650 01651 01652 01653 01654 01655 01656 01657 01658 01659 01660 01661 01662 01663 01664 01665 01666 01667 01668 01669 01670 01671 01672 01673 01674 01675 01676 01677 01678 01679 01680 01681 01682 01683 01684 01685 01686 01687 01688 01689 01690 01691 01692 01693 01694 01695 01696 01697 01698 01699 01700 01701 01702 01703 01704 01705 01706 01707 01708 01709 01710 01711 01712 01713 01714 01715 01716 01717 01718 01719 01720 01721 01722 01723 01724 01725 01726 01727 01728 01729 01730 01731 01732 01733 01734 01735 01736 01737 01738 01739 01740 01741 01742 01743 01744 01745 01746 01747 01748 01749 01750 01751 01752 01753 01754 01755 01756 01757 01758 01759 01760 01761 01762 01763 01764 01765 01766 01767 01768 01769 01770 01771 01772 01773 01774 01775 01776 01777 01778 01779 01780 01781 01782 01783 01784 01785 01786 01787 01788 01789 01790 01791 01792 01793 01794 01795 01796 01797 01798 01799 01800 01801 01802 01803 01804 01805 01806 01807 01808 01809 01810 01811 01812 01813 01814 01815 01816 01817 01818 01819 01820 01821 01822 01823 01824 01825 01826 01827 01828 01829 01830 01831 01832 01833 01834 01835 01836 01837 01838 01839 01840 01841 01842 01843 01844 01845 01846 01847 01848 01849 01850 01851 01852 01853 01854 01855 01856 01857 01858 01859 01860 01861 01862 01863 01864 01865 01866 01867 01868 01869 01870 01871 01872 01873 01874 01875 01876 01877 01878 01879 01880 01881 01882 01883 01884 01885 01886 01887 01888 01889 01890 01891 01892 01893 01894 01895 01896 01897 01898 01899 01900 01901 01902 01903 01904 01905 01906 01907 01908 01909 01910 01911 01912 01913 01914 01915 01916 01917 01918 01919 01920 01921 01922 01923 01924 01925 01926 01927 01928 01929 01930 01931 01932 01933 01934 01935 01936 01937 01938 01939 01940 01941 01942 01943 01944 01945 01946 01947 01948 01949 01950 01951 01952 01953 01954 01955 01956 01957 01958 01959 01960 01961 01962 01963 01964 01965 01966 01967 01968 01969 01970 01971 01972 01973 01974 01975 01976 01977 01978 01979 01980 01981 01982 01983 01984 01985 01986 01987 01988 01989 01990 01991 01992 01993 01994 01995 01996 01997 01998 01999 02000 02001 02002 02003 02004 02005 02006 02007 02008 02009 02010 02011 02012 02013 02014 02015 02016 02017 02018 02019 02020 02021 02022 02023 02024 02025 02026 02027 02028 02029 02030 02031 02032 02033 02034 02035 02036 02037 02038 02039 02040 02041 02042 02043 02044 02045 02046 02047 02048 02049 02050 02051 02052 02053 02054 02055 02056 02057 02058 02059 02060 02061 02062 02063 02064 02065 02066 02067 02068 02069 02070 02071 02072 02073 02074 02075 02076 02077 02078 02079 02080 02081 02082 02083 02084 02085 02086 02087 02088 02089 02090 02091 02092 02093 02094 02095 02096 02097 02098 02099 02100 02101 02102 02103 02104 02105 02106 02107 02108 02109 02110 02111 02112 02113 02114 02115 02116 02117 02118 02119 02120 02121 02122 02123 02124 02125 02126 02127 02128 02129 02130 02131 02132 02133 02134 02135 02136 02137 02138 02139 02140 02141 02142 02143 02144 02145 02146 02147 02148 02149 02150 02151 02152 02153 02154 02155 02156 02157 02158 02159 02160 02161 02162 02163 02164 02165 02166 02167 02168 02169 02170 02171 02172 02173 02174 02175 02176 02177 02178 02179 02180 02181 02182 02183 02184 02185 02186 02187 02188 02189 02190 02191 02192 02193 02194 02195 02196 02197 02198 02199 02200 02201 02202 02203 02204 02205 02206 02207 02208 02209 02210 02211 02212 02213 02214 02215 02216 02217 02218 02219 02220 02221 02222 02223 02224 02225 02226 02227 02228 02229 02230 02231 02232 02233 02234 02235 02236 02237 02238 02239 02240 02241 02242 02243 02244 02245 02246 02247 02248 02249 02250 02251 02252 02253 02254 02255 02256 02257 02258 02259 02260 02261 02262 02263 02264 02265 02266 02267 02268 02269 02270 02271 02272 02273 02274 02275 02276 02277 02278 02279 02280 02281 02282 02283 02284 02285 02286 02287 02288 02289 02290 02291 02292 02293 02294 02295 02296 02297 02298 02299 02300 02301 02302 02303 02304 02305 02306 02307 02308 02309 02310 02311 02312 02313 02314 02315 02316 02317 02318 02319 02320 02321 02322 02323 02324 02325 02326 02327 02328 02329 02330 02331 02332 02333 02334 02335 02336 02337 02338 02339 02340 02341 02342 02343 02344 02345 02346 02347 02348 02349 02350 02351 02352 02353 02354 02355 02356 02357 02358 02359 02360 02361 02362 02363 02364 02365 02366 02367 02368 02369 02370 02371 02372 02373 02374 02375 02376 02377 02378 02379 02380 02381 02382 02383 02384 02385 02386 02387 02388 02389 02390 02391 02392 02393 02394 02395 02396 02397 02398 02399 02400 02401 02402 02403 02404 02405 02406 02407 02408 02409 02410 02411 02412 02413 02414 02415 02416 02417 02418 02419 02420 02421 02422 02423 02424 02425 02426 02427 02428 02429 02430 02431 02432 02433 02434 02435 02436 02437 02438 02439 02440 02441 02442 02443 02444 02445 02446 02447 02448 02449 02450 02451 02452 02453 02454 02455 02456 02457 02458 02459 02460 02461 02462 02463 02464 02465 02466 02467 02468 02469 02470 02471 02472 02473 02474 02475 02476 02477 02478 02479 02480 02481 02482 02483 02484 02485 02486 02487 02488 02489 02490 02491 02492 02493 02494 02495 02496 02497 02498 02499 02500 02501 02502 02503 02504 02505 02506 02507 02508 02509 02510 02511 02512 02513 02514 02515 02516 02517 02518 02519 02520 02521 02522 02523 02524 02525 02526 02527 02528 02529 02530 02531 02532 02533 02534 02535 02536 02537 02538 02539 02540 02541 02542 02543 02544 02545 02546 02547 02548 02549 02550 02551 02552 02553 02554 02555 02556 02557 02558 02559 02560 02561 02562 02563 02564 02565 02566 02567 02568 02569 02570 02571 02572 02573 02574 02575 02576 02577 02578 02579 02580 02581 02582 02583 02584 02585 02586 02587 02588 02589 02590 02591 02592 02593 02594 02595 02596 02597 02598 02599 02600 02601 02602 02603 02604 02605 02606 02607 02608 02609 02610 02611 02612 02613 02614 02615 02616 02617 02618 02619 02620 02621 02622 02623 02624 02625 02626 02627 02628 02629 02630 02631 02632 02633 02634 02635 02636 02637 02638 02639 02640 02641 02642 02643 02644 02645 02646 02647 02648 02649 02650 02651 02652 02653 02654 02655 02656 02657 02658 02659 02660 02661 02662 02663 02664 02665 02666 02667 02668 02669 02670 02671 02672 02673 02674 02675 02676 02677 02678 02679 02680 02681 02682 02683 02684 02685 02686 02687 02688 02689 02690 02691 02692 02693 02694 02695 02696 02697 02698 02699 02700 02701 02702 02703 02704 02705 02706 02707 02708 02709 02710 02711 02712 02713 02714 02715 02716 02717 02718 02719 02720 02721 02722 02723 02724 02725 02726 02727 02728 02729 02730 02731 02732 02733 02734 02735 02736 02737 02738 02739 02740 02741 02742 02743 02744 02745 02746 02747 02748 02749 02750 02751 02752 02753 02754 02755 02756 02757 02758 02759 02760 02761 02762 02763 02764 02765 02766 02767 02768 02769 02770 02771 02772 02773 02774 02775 02776 02777 02778 02779 02780 02781 02782 02783 02784 02785 02786 02787 02788 02789 02790 02791 02792 02793 02794 02795 02796 02797 02798 02799 02800 02801 02802 02803 02804 02805 02806 02807 02808 02809 02810 02811 02812 02813 02814 02815 02816 02817 02818 02819 02820 02821 02822 02823 02824 02825 02826 02827 02828 02829 02830 02831 02832 02833 02834 02835 02836 02837 02838 02839 02840 02841 02842 02843 02844 02845 02846 02847 02848 02849 02850 02851 02852 02853 02854 02855 02856 02857 02858 02859 02860 02861 02862 02863 02864 02865 02866 02867 02868 02869 02870 02871 02872 02873 02874 02875 02876 02877 02878 02879 02880 02881 02882 02883 02884 02885 02886 02887 02888 02889 02890 02891 02892 02893 02894 02895 02896 02897 02898 02899 02900 02901 02902 02903 02904 02905 02906 02907 02908 02909 02910 02911 02912 02913 02914 02915 02916 02917 02918 02919 02920 02921 02922 02923 02924 02925 02926 02927 02928 02929 02930 02931 02932 02933 02934 02935 02936 02937 02938 02939 02940 02941 02942 02943 02944 02945 02946 02947 02948 02949 02950 02951 02952 02953 02954 02955 02956 02957 02958 02959 02960 02961 02962 02963 02964 02965 02966 02967 02968 02969 02970 02971 02972 02973 02974 02975 02976 02977 02978 02979 02980 02981 02982 02983 02984 02985 02986 02987 02988 02989 02990 02991 02992 02993 02994 02995 02996 02997 02998 02999 03000 03001 03002 03003 03004 03005 03006 03007 03008 03009 03010 03011 03012 03013 03014 03015 03016 03017 03018 03019 03020 03021 03022 03023 03024 03025 03026 03027 03028 03029 03030 03031 03032 03033 03034 03035 03036 03037 03038 03039 03040 03041 03042 03043 03044 03045 03046 03047 03048 03049 03050 03051 03052 03053 03054 03055 03056 03057 03058 03059 03060 03061 03062 03063 03064 03065 03066 03067 03068 03069 03070 03071 03072 03073 03074 03075 03076 03077 03078 03079 03080 03081 03082 03083 03084 03085 03086 03087 03088 03089 03090 03091 03092 03093 03094 03095 03096 03097 03098 03099 03100 03101 03102 03103 03104 03105 03106 03107 03108 03109 03110 03111 03112 03113 03114 03115 03116 03117 03118 03119 03120 03121 03122 03123 03124 03125 03126 03127 03128 03129 03130 03131 03132 03133 03134 03135 03136 03137 03138 03139 03140 03141 03142 03143 03144 03145 03146 03147 03148 03149 03150 03151 03152 03153 03154 03155 03156 03157 03158 03159 03160 03161 03162 03163 03164 03165 03166 03167 03168 03169 03170 03171 03172 03173 03174 03175 03176 03177 03178 03179 03180 03181 03182 03183 03184 03185 03186 03187 03188 03189 03190 03191 03192 03193 03194 03195 03196 03197 03198 03199 03200 03201 03202 03203 03204 03205 03206 03207 03208 03209 03210 03211 03212 03213 03214 03215 03216 03217 03218 03219 03220 03221 03222 03223 03224 03225 03226 03227 03228 03229 03230 03231 03232 03233 03234 03235 03236 03237 03238 03239 03240 03241 03242 03243 03244 03245 03246 03247 03248 03249 03250 03251 03252 03253 03254 03255 03256 03257 03258 03259 03260 03261 03262 03263 03264 03265 03266 03267 03268 03269 03270 03271 03272 03273 03274 03275 03276 03277 03278 03279 03280 03281 03282 03283 03284 03285 03286 03287 03288 03289 03290 03291 03292 03293 03294 03295 03296 03297 03298 03299 03300 03301 03302 03303 03304 03305 03306 03307 03308 03309 03310 03311 03312 03313 03314 03315 03316 03317 03318 03319 03320 03321 03322 03323 03324 03325 03326 03327 03328 03329 03330 03331 03332 03333 03334 03335 03336 03337 03338 03339 03340 03341 03342 03343 03344 03345 03346 03347 03348 03349 03350 03351 03352 03353 03354 03355 03356 03357 03358 |
//============================================================================= // GameInfo. // // The GameInfo defines the game being played: the game rules, scoring, what actors // are allowed to exist in this game type, and who may enter the game. While the // GameInfo class is the public interface, much of this functionality is delegated // to several classes to allow easy modification of specific game components. These // classes include GameInfo, AccessControl, Mutator, BroadcastHandler, and GameRules. // A GameInfo actor is instantiated when the level is initialized for gameplay (in // C++ UGameEngine::LoadMap() ). The class of this GameInfo actor is determined by // (in order) either the URL ?game=xxx, or the // DefaultGame entry in the game's .ini file (in the Engine.Engine section), unless // its a network game in which case the DefaultServerGame entry is used. // The GameType used can be overridden in the GameInfo script event SetGameType(), called // on the game class picked by the above process. // // Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. //============================================================================= class GameInfo extends Info config(Game) native; //----------------------------------------------------------------------------- // Variables. var bool bRestartLevel; // Level should be restarted when player dies var bool bPauseable; // Whether the game is pauseable. var bool bTeamGame; // This is a team game. var bool bGameEnded; // set when game ends var bool bOverTime; var bool bDelayedStart; var bool bWaitingToStartMatch; var globalconfig bool bChangeLevels; var bool bAlreadyChanged; var bool bLoggingGame; // Does this gametype log? var globalconfig bool bAdminCanPause; var bool bGameRestarted; var bool bLevelChange; // level transition in progress var globalconfig bool bKickLiveIdlers; // if true, even playercontrollers with pawns can be kicked for idling /** If the server doesn't hear a response regarding a cd hash key request, kick them */ var globalconfig bool bKickMissingCDHashKeys; /** Timeout value while waiting for a response to teh cd hash key request */ var globalconfig float TimeToWaitForHashKey; /** Whether this match is going to use arbitration or not */ var bool bUsingArbitration; /** * Whether the arbitrated handshaking has occurred or not. * * NOTE: The code will reject new connections once handshaking has started */ var bool bHasArbitratedHandshakeBegun; /** Whether the arbitrated handshaking has occurred or not. */ var bool bNeedsEndGameHandshake; /** Whether the arbitrated handshaking has completed or not. */ var bool bIsEndGameHandshakeComplete; /** Used to indicate when an arbitrated match has started its end sequence */ var bool bHasEndGameHandshakeBegun; /** Whether the game expects a fixed player start for profiling. */ var bool bFixedPlayerStart; /** Whether the game is currently in automated perf test mode. */ var bool bAutomatedPerfTesting; /** Amount of time remaining before match ends -- used for auto performance test shutdown */ var int AutomatedPerfRemainingTime; /** This will auto continue to the next round. Very useful doing soak testing and testing traveling to next level **/ var bool bAutoContinueToNextRound; /** Whether game is doing a fly through or not. This is separate from automatedPerfTesting which is going to probably spawn bots / effects **/ var bool bDoingAFlyThrough; /** * Whether or not this game should check for fragmentation. This can be used to have a specific game type check for fragmentation at some point * (e.g. start/end of match, time period) **/ var bool bCheckingForFragmentation; /** * Whether or not this game should check for memory leaks **/ var bool bCheckingForMemLeaks; /** This is the BugIt String Data. Other info should be stored here **/ /** Currently stores the location string form **/ var string BugLocString; /** Currently stores the rotation in string form **/ var string BugRotString; /** * List of player controllers we're awaiting handshakes with * * NOTE: Any PC in this list that does not complete the handshake within * ArbitrationHandshakeTimeout will be kicked from the match */ var array<PlayerController> PendingArbitrationPCs; /** * Holds the list of players that passed handshaking and require finalization * of arbitration data written to the online subsystem */ var array<PlayerController> ArbitrationPCs; /** Amount of time a client can take for arbitration handshaking before being kicked */ var globalconfig float ArbitrationHandshakeTimeout; var globalconfig float GameDifficulty; var globalconfig int GoreLevel; // 0=Normal, increasing values=less gore var float GameSpeed; // Scale applied to game rate. var class<Pawn> DefaultPawnClass; // user interface var class<Scoreboard> ScoreBoardType; // Type of class<Menu> to use for scoreboards. var class<HUD> HUDType; // HUD class this game uses. var globalconfig int MaxSpectators; // Maximum number of spectators allowed by this server. var int MaxSpectatorsAllowed; // Maximum number of spectators ever allowed (MaxSpectators is clamped to this in initgame() var int NumSpectators; // Current number of spectators. var globalconfig int MaxPlayers; // Maximum number of players allowed by this server. var int MaxPlayersAllowed; // Maximum number of players ever allowed (MaxSPlayers is clamped to this in initgame() var int NumPlayers; // number of human players var int NumBots; // number of non-human players (AI controlled but participating as a player) /** number of players that are still travelling from a previous map */ var int NumTravellingPlayers; var int CurrentID; // used to assign unique PlayerIDs to each PlayerReplicationInfo var localized string DefaultPlayerName; var localized string GameName; var float FearCostFallOff; // how fast the FearCost in NavigationPoints falls off var bool bDoFearCostFallOff; // If true, FearCost will fall off over time in NavigationPoints. Reset to false once all reach FearCosts reach 0. var config int GoalScore; // what score is needed to end the match var config int MaxLives; // max number of lives for match, unless overruled by level's GameDetails var config int TimeLimit; // time limit in minutes // Message classes. var class<LocalMessage> DeathMessageClass; var class<GameMessage> GameMessageClass; //------------------------------------- // GameInfo components var Mutator BaseMutator; // linked list of Mutators (for modifying actors as they enter the game) var class<AccessControl> AccessControlClass; var AccessControl AccessControl; // AccessControl controls whether players can enter and/or become admins var GameRules GameRulesModifiers; // linked list of modifier classes which affect game rules var class<BroadcastHandler> BroadcastHandlerClass; var BroadcastHandler BroadcastHandler; // handles message (text and localized) broadcasts var class<PlayerController> PlayerControllerClass; // type of player controller to spawn for players logging in var class<PlayerReplicationInfo> PlayerReplicationInfoClass; /** Name of DialogueManager class */ var String DialogueManagerClass; /** Pointer to Manager */ var DialogueManager DialogueManager; // ReplicationInfo var() class<GameReplicationInfo> GameReplicationInfoClass; var GameReplicationInfo GameReplicationInfo; var globalconfig float MaxIdleTime; // maximum time players are allowed to idle before being kicked /** if > 0, maximum time in seconds players are allowed to take travelling to a new map before they are kicked */ var globalconfig float MaxClientTravelTime; // speed hack detection var globalconfig float MaxTimeMargin; var globalconfig float TimeMarginSlack; var globalconfig float MinTimeMargin; var array<PlayerReplicationInfo> InactivePRIArray; /** PRIs of players who have left game (saved in case they reconnect) */ /** The list of delegates to check before unpausing a game */ var array<delegate<CanUnpause> > Pausers; /** Cached online subsystem variable */ var OnlineSubsystem OnlineSub; /** Cached online game interface variable */ var OnlineGameInterface GameInterface; /** Cached online game settings object */ var OnlineGameSettings GameSettings; /** Class sent to clients to use to create and hold their stats */ var class<OnlineStatsWrite> OnlineStatsWriteClass; /** perform map travels using SeamlessTravel() which loads in the background and doesn't disconnect clients * @see WorldInfo::SeamlessTravel() */ var bool bUseSeamlessTravel; var globalconfig bool bForceNoSeamlessTravel; /** Base copy of cover changes that need to be replicated to clients on join */ var protected CoverReplicator CoverReplicatorBase; /** Tracks whether the server can travel due to a critical network error or not */ var bool bHasNetworkError; /** Whether this game type requires voice to be push to talk or not */ var const bool bRequiresPushToTalk; /** The class to use when registering dedicated servers with the online service */ var const class<OnlineGameSettings> OnlineGameSettingsClass; /** The options to apply for dedicated server when it starts to register */ var string ServerOptions; /** Contains the friend id of the currently logging in player as a workaround for ChangeTeams function prototype */ var UniqueNetId CurrentFriendId; /** Current adjusted net speed - Used for dynamically managing netspeed for listen servers*/ var int AdjustedNetSpeed; /** Last time netspeed was updated for server (by client entering or leaving) */ var float LastNetSpeedUpdateTime; /** Total available bandwidth for listen server, split dynamically across net connections */ var globalconfig int TotalNetBandwidth; /** Minimum bandwidth dynamically set per connection */ var globalconfig int MinDynamicBandwidth; /** Maximum bandwidth dynamically set per connection */ var globalconfig int MaxDynamicBandwidth; /** Prevents excessive log spam from the Gamespy auto-reconnect code */ var float LastAutoReconnectMessageTime; var bool bDisableGamespyLogs; /** Whether or not to accept additional splitscreen players */ var globalconfig bool bAllowSplitscreenPlayers; /** The maximum numer of additional splitscreen connections per-player */ var globalconfig int MaxChildConnections; // (cpptext) // (cpptext) // (cpptext) // (cpptext) // (cpptext) // (cpptext) // (cpptext) // (cpptext) // (cpptext) // (cpptext) // (cpptext) // (cpptext) //------------------------------------------------------------------------------ // Engine notifications. event PreBeginPlay() { if (GameInterface != None) { // Grab the current game settings object out GameSettings = GameInterface.GetGameSettings(); if (GameSettings != None) { // Check for an arbitrated match bUsingArbitration = GameSettings.bUsesArbitration; } } AdjustedNetSpeed = MaxDynamicBandwidth; SetGameSpeed(GameSpeed); GameReplicationInfo = Spawn(GameReplicationInfoClass); WorldInfo.GRI = GameReplicationInfo; // Send over whether this is an arbitrated match or not GameReplicationInfo.bIsArbitrated = bUsingArbitration; InitGameReplicationInfo(); if( DialogueManagerClass != "" ) { DialogueManager = Spawn( class<DialogueManager>(DynamicLoadObject( DialogueManagerClass, class'Class' )) ); } } function BeginPlay() { // Save modified URL values as defaults SaveConfig(); } function string FindPlayerByID( int PlayerID ) { local PlayerReplicationInfo PRI; PRI = GameReplicationInfo.FindPlayerByID(PlayerID); if ( PRI != None ) return PRI.PlayerName; return ""; } static function bool UseLowGore(WorldInfo WI) { return (Default.GoreLevel > 0) && (WI.NetMode != NM_DedicatedServer); } function CoverReplicator GetCoverReplicator() { if (CoverReplicatorBase == None && WorldInfo.NetMode != NM_Standalone) { CoverReplicatorBase = Spawn(class'CoverReplicator'); } return CoverReplicatorBase; } event PostBeginPlay() { if ( MaxIdleTime > 0 ) { MaxIdleTime = FMax(MaxIdleTime, 20); } if (WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.NetMode == NM_ListenServer) { // Update any online advertised settings UpdateGameSettings(); } } /* Reset() - reset actor to initial state - used when restarting level without reloading. @note: GameInfo::Reset() called after all other actors have been reset */ function Reset() { super.Reset(); bGameEnded = false; bOverTime = false; InitGameReplicationInfo(); } /** @return true if ActorToReset should have Reset() called on it while restarting the game, false if the GameInfo will manually reset it or if the actor does not need to be reset */ function bool ShouldReset(Actor ActorToReset) { return true; } /** Resets level by calling Reset() on all actors */ function ResetLevel() { local Controller C; local Actor A; local Sequence GameSeq; local array<SequenceObject> AllSeqEvents; local int i; LogInternal("Reset" @ self); // Reset ALL controllers first foreach WorldInfo.AllControllers(class'Controller', C) { if ( PlayerController(C) != None ) { PlayerController(C).ClientReset(); } C.Reset(); } // Reset all actors (except controllers, the GameInfo, and any other actors specified by ShouldReset()) foreach AllActors(class'Actor', A) { if (A != self && !A.IsA('Controller') && ShouldReset(A)) { A.Reset(); } } // reset the GameInfo Reset(); // reset Kismet and activate any Level Reset events GameSeq = WorldInfo.GetGameSequence(); if (GameSeq != None) { // reset the game sequence GameSeq.Reset(); // find any Level Reset events that exist GameSeq.FindSeqObjectsByClass(class'SeqEvent_LevelReset', true, AllSeqEvents); // activate them for (i = 0; i < AllSeqEvents.Length; i++) { SeqEvent_LevelReset(AllSeqEvents[i]).CheckActivate(WorldInfo, None); } } } event Timer() { BroadcastHandler.UpdateSentText(); // Update navigation point fear cost fall off. if ( bDoFearCostFallOff ) { DoNavFearCostFallOff(); } if( ( bAutomatedPerfTesting ) && ( AutomatedPerfRemainingTime > 0 ) && ( bAutoContinueToNextRound == FALSE ) ) { AutomatedPerfRemainingTime--; if( AutomatedPerfRemainingTime <= 0 ) { // Exit at the end of the match if automated perf testing is enabled. ConsoleCommand("EXIT"); } } } /** Update navigation point fear cost fall off. */ final native function DoNavFearCostFallOff(); /** notification when a NavigationPoint becomes blocked or unblocked */ function NotifyNavigationChanged(NavigationPoint N); // Called when game shutsdown. event GameEnding() { if (OnlineSub != None) { if (OnlineSub.SystemInterface != None) { OnlineSub.SystemInterface.ClearConnectionStatusChangeDelegate(OnConnectionStatusChange); } } } /* KickIdler() called if if ( (Pawn != None) || (PlayerReplicationInfo.bOnlySpectator && (ViewTarget != self)) || (WorldInfo.Pauser != None) || WorldInfo.Game.bWaitingToStartMatch || WorldInfo.Game.bGameEnded ) { LastActiveTime = WorldInfo.TimeSeconds; } else if ( (WorldInfo.Game.MaxIdleTime > 0) && (WorldInfo.TimeSeconds - LastActiveTime > WorldInfo.Game.MaxIdleTime) ) KickIdler(self); */ event KickIdler(PlayerController PC) { LogInternal("Kicking idle player "$PC.PlayerReplicationInfo.GetPlayerAlias()); AccessControl.KickPlayer(PC, AccessControl.IdleKickReason); } //------------------------------------------------------------------------------ // Replication function InitGameReplicationInfo() { GameReplicationInfo.GameClass = Class; GameReplicationInfo.MaxLives = MaxLives; } native function string GetNetworkNumber(); function int GetNumPlayers() { return NumPlayers + NumTravellingPlayers; } native function int CurrentPlayerCount(); //------------------------------------------------------------------------------ // Misc. // Return the server's port number. function int GetServerPort() { local string S; local int i; // Figure out the server's port. S = WorldInfo.GetAddressURL(); i = InStr( S, ":" ); assert(i>=0); return int(Mid(S,i+1)); } /** * Default delegate that provides an implementation for those that don't have * special needs other than a toggle */ delegate bool CanUnpause() { return true; } /** * Adds the delegate to the list if the player controller has the right to pause * the game. The delegate is called to see if it is ok to unpause the game, e.g. * the reason the game was paused has been cleared. * * @param PC the player controller to check for admin privs * @param CanUnpauseDelegate the delegate to query when checking for unpause */ function bool SetPause(PlayerController PC, optional delegate<CanUnpause> CanUnpauseDelegate) { local int FoundIndex; if (bPauseable || (bAdminCanPause && AccessControl.IsAdmin(PC)) || WorldInfo.NetMode == NM_Standalone) { // Don't add the delegate twice (no need) FoundIndex = Pausers.Find(CanUnpauseDelegate); if (FoundIndex == INDEX_NONE) { // Not in the list so add it for querying FoundIndex = Pausers.Length; Pausers.Length = FoundIndex + 1; Pausers[FoundIndex] = CanUnpauseDelegate; } // Let the first one in "own" the pause state if (WorldInfo.Pauser == None) { WorldInfo.Pauser = PC.PlayerReplicationInfo; } return true; } return false; } /** * Checks the list of delegates to determine if the pausing can be cleared. If * the delegate says it's ok to unpause, that delegate is removed from the list * and the rest are checked. The game is considered unpaused when the list is * empty. */ function ClearPause() { local int Index; local delegate<CanUnpause> CanUnpauseCriteriaMet; for (Index = 0; Index < Pausers.Length; Index++) { CanUnpauseCriteriaMet = Pausers[Index]; if (CanUnpauseCriteriaMet()) { Pausers.Remove(Index,1); Index--; } } // Clear the pause state if the list is empty if (Pausers.Length == 0) { WorldInfo.Pauser = None; } } /** * Dumps the pause delegate list to track down who has the game paused */ function DebugPause() { local int Index; local delegate<CanUnpause> CanUnpauseCriteriaMet; for (Index = 0; Index < Pausers.Length; Index++) { CanUnpauseCriteriaMet = Pausers[Index]; if (CanUnpauseCriteriaMet()) { LogInternal("Pauser in index "$Index$" thinks it's ok to unpause"); } else { LogInternal("Pauser in index "$Index$" thinks the game should remain paused"); } } } //------------------------------------------------------------------------------ // Game parameters. // // Set gameplay speed. // function SetGameSpeed( Float T ) { GameSpeed = FMax(T, 0.1); WorldInfo.TimeDilation = GameSpeed; SetTimer(WorldInfo.TimeDilation, true); } //------------------------------------------------------------------------------ // Player start functions // // Grab the next option from a string. // static function bool GrabOption( out string Options, out string Result ) { if( Left(Options,1)=="?" ) { // Get result. Result = Mid(Options,1); if( InStr(Result,"?")>=0 ) Result = Left( Result, InStr(Result,"?") ); // Update options. Options = Mid(Options,1); if( InStr(Options,"?")>=0 ) Options = Mid( Options, InStr(Options,"?") ); else Options = ""; return true; } else return false; } // // Break up a key=value pair into its key and value. // static function GetKeyValue( string Pair, out string Key, out string Value ) { if( InStr(Pair,"=")>=0 ) { Key = Left(Pair,InStr(Pair,"=")); Value = Mid(Pair,InStr(Pair,"=")+1); } else { Key = Pair; Value = ""; } } /* ParseOption() Find an option in the options string and return it. */ static function string ParseOption( string Options, string InKey ) { local string Pair, Key, Value; while( GrabOption( Options, Pair ) ) { GetKeyValue( Pair, Key, Value ); if( Key ~= InKey ) return Value; } return ""; } // // HasOption - return true if the option is specified on the command line. // static function bool HasOption( string Options, string InKey ) { local string Pair, Key, Value; while( GrabOption( Options, Pair ) ) { GetKeyValue( Pair, Key, Value ); if( Key ~= InKey ) return true; } return false; } static function int GetIntOption( string Options, string ParseString, int CurrentValue) { local string InOpt; InOpt = ParseOption( Options, ParseString ); if ( InOpt != "" ) { return int(InOpt); } return CurrentValue; } static event class<GameInfo> SetGameType(string MapName, string Options) { return Default.Class; } /* Initialize the game. The GameInfo's InitGame() function is called before any other scripts (including PreBeginPlay() ), and is used by the GameInfo to initialize parameters and spawn its helper classes. Warning: this is called before actors' PreBeginPlay. */ event InitGame( string Options, out string ErrorMessage ) { local string InOpt, LeftOpt; local int pos; local class<AccessControl> ACClass; MaxPlayers = Clamp(GetIntOption( Options, "MaxPlayers", MaxPlayers ),0,MaxPlayersAllowed); MaxSpectators = Clamp(GetIntOption( Options, "MaxSpectators", MaxSpectators ),0,MaxSpectatorsAllowed); GameDifficulty = FMax(0,GetIntOption(Options, "Difficulty", GameDifficulty)); InOpt = ParseOption( Options, "GameSpeed"); if( InOpt != "" ) { LogInternal("GameSpeed"@InOpt); SetGameSpeed(float(InOpt)); } TimeLimit = Max(0,GetIntOption( Options, "TimeLimit", TimeLimit )); AutomatedPerfRemainingTime = 60 * TimeLimit; BroadcastHandler = spawn(BroadcastHandlerClass); InOpt = ParseOption( Options, "AccessControl"); if( InOpt != "" ) { ACClass = class<AccessControl>(DynamicLoadObject(InOpt, class'Class')); } if ( ACClass == None ) { ACClass = AccessControlClass; } LeftOpt = ParseOption( Options, "AdminName" ); InOpt = ParseOption( Options, "AdminPassword"); /* @FIXME: this is a compiler error, "can't set defaults of non-config properties". Fix or remove at some point. if( LeftOpt!="" && InOpt!="" ) ACClass.default.bDontAddDefaultAdmin = true; */ // Only spawn access control if we are a server if (WorldInfo.NetMode == NM_ListenServer || WorldInfo.NetMode == NM_DedicatedServer ) { AccessControl = Spawn(ACClass); if ( AccessControl != None && InOpt != "" ) { AccessControl.SetAdminPassword(InOpt); } } InOpt = ParseOption( Options, "Mutator"); if ( InOpt != "" ) { LogInternal("Mutators"@InOpt); while ( InOpt != "" ) { pos = InStr(InOpt,","); if ( pos > 0 ) { LeftOpt = Left(InOpt, pos); InOpt = Right(InOpt, Len(InOpt) - pos - 1); } else { LeftOpt = InOpt; InOpt = ""; } AddMutator(LeftOpt, true); } } InOpt = ParseOption( Options, "GamePassword"); if( InOpt != "" && AccessControl != None) { AccessControl.SetGamePassWord(InOpt); LogInternal("GamePassword" @ InOpt); } bAutomatedPerfTesting = ( ParseOption( Options, "AutomatedPerfTesting" ) ~= "1" ); bFixedPlayerStart = ( ParseOption( Options, "FixedPlayerStart" ) ~= "1" ); bDoingAFlyThrough = ( ParseOption( Options, "causeevent" ) ~= "FlyThrough" ); bCheckingForFragmentation = ( ParseOption( Options, "CheckingForFragmentation" ) ~= "1" ); bCheckingForMemLeaks = ( ParseOption( Options, "CheckingForMemLeaks" ) ~= "1" ); BugLocString = ParseOption(Options, "BugLoc"); BugRotString = ParseOption(Options, "BugRot"); if (BaseMutator != none) { BaseMutator.InitMutator(Options, ErrorMessage); } // Cache a pointer to the online subsystem OnlineSub = class'GameEngine'.static.GetOnlineSubsystem(); if (OnlineSub != None) { // And grab one for the game interface since it will be used often GameInterface = OnlineSub.GameInterface; } // Cache this so it can be used later by async processes ServerOptions = Options; if (WorldInfo.NetMode != NM_Standalone && // Don't register the session if the UI already has OnlineSub != None && OnlineSub.GameInterface != None && GameInterface.GetGameSettings() == None) { // If there isn't a login to process, immediately register the server // Otherwise the server will be registered when the login completes if (ProcessServerLogin() == false) { RegisterServer(); } } } function AddMutator(string mutname, optional bool bUserAdded) { local class<Mutator> mutClass; local Mutator mut; local int i; if ( !Static.AllowMutator(MutName) ) return; mutClass = class<Mutator>(DynamicLoadObject(mutname, class'Class')); if (mutClass == None) return; if (mutClass.Default.GroupNames.length > 0 && BaseMutator != None) { // make sure no mutators with same groupname for (mut = BaseMutator; mut != None; mut = mut.NextMutator) { for (i = 0; i < mut.GroupNames.length; i++) { if (mutClass.default.GroupNames.Find(mut.GroupNames[i]) != INDEX_NONE) { LogInternal("Not adding "$mutClass$" because already have a mutator in the same group - "$mut); return; } } } } // make sure this mutator is not added already for ( mut=BaseMutator; mut!=None; mut=mut.NextMutator ) if ( mut.Class == mutClass ) { LogInternal("Not adding "$mutClass$" because this mutator is already added - "$mut); return; } mut = Spawn(mutClass); // mc, beware of mut being none if (mut == None) return; // Meant to verify if this mutator was from Command Line parameters or added from other Actors mut.bUserAdded = bUserAdded; if (BaseMutator == None) { BaseMutator = mut; } else { BaseMutator.AddMutator(mut); } } function AddGameRules(class<GameRules> GRClass) { if ( GRClass != None ) { if ( GameRulesModifiers == None ) GameRulesModifiers = Spawn(GRClass); else GameRulesModifiers.AddGameRules(Spawn(GRClass)); } } /* RemoveMutator() Remove a mutator from the mutator list */ function RemoveMutator( Mutator MutatorToRemove ) { local Mutator M; // remove from mutator list if ( BaseMutator == MutatorToRemove ) { BaseMutator = MutatorToRemove.NextMutator; } else if ( BaseMutator != None ) { for ( M=BaseMutator; M!=None; M=M.NextMutator ) { if ( M.NextMutator == MutatorToRemove ) { M.NextMutator = MutatorToRemove.NextMutator; break; } } } } // // Return beacon text for serverbeacon. // event string GetBeaconText() { return WorldInfo.ComputerName $ " " $ Left(WorldInfo.Title,24) $ "\\t" $ GetNumPlayers() $ "/" $ MaxPlayers; } /* ProcessServerTravel() Optional handling of ServerTravel for network games. */ function ProcessServerTravel(string URL, optional bool bAbsolute) { local PlayerController P, LocalPlayer; local bool bSeamless; local string NextMap; local Guid NextMapGuid; local int OptionStart; bLevelChange = true; // force an old style load screen if the server has been up for a long time so that TimeSeconds doesn't overflow and break everything bSeamless = (!bForceNoSeamlessTravel && bUseSeamlessTravel && WorldInfo.TimeSeconds < 172800.0f); // 172800 seconds == 48 hours if (InStr(Caps(URL), "?RESTART") != INDEX_NONE) { NextMap = string(WorldInfo.GetPackageName()); } else { OptionStart = InStr(URL, "?"); if (OptionStart == INDEX_NONE) { NextMap = URL; } else { NextMap = Left(URL, OptionStart); } } NextMapGuid = GetPackageGuid(name(NextMap)); // Notify clients we're switching level and give them time to receive. // We call PreClientTravel directly on any local PlayerPawns (ie listen server) LogInternal("ProcessServerTravel:"@URL); foreach WorldInfo.AllControllers(class'PlayerController', P) { if (NetConnection(P.Player) != None) { P.ClientSetTravelGuid(NextMapGuid); if (bSeamless) P.ClientSeamlessTravel(NextMap); else P.ClientTravel(NextMap, TRAVEL_Relative, False); } else { LocalPlayer = P; P.PreClientTravel(); } } if (WorldInfo.NetMode == NM_ListenServer && LocalPlayer != None) { WorldInfo.NextURL = WorldInfo.NextURL $"?Team="$LocalPlayer.GetDefaultURL("Team") $"?Name="$LocalPlayer.GetDefaultURL("Name") $"?Class="$LocalPlayer.GetDefaultURL("Class") $"?Character="$LocalPlayer.GetDefaultURL("Character"); } if (bSeamless) { WorldInfo.SeamlessTravel(WorldInfo.NextURL, bAbsolute); WorldInfo.NextURL = ""; } // Switch immediately if not networking. else if (WorldInfo.NetMode != NM_DedicatedServer && WorldInfo.NetMode != NM_ListenServer) { WorldInfo.NextSwitchCountdown = 0.0; } } /** * Called from the WorldInfo when travelling fails */ function TravelFailed(string TravelURL, string Error, optional string ErrorCode); function bool RequiresPassword() { return ( (AccessControl != None) && AccessControl.RequiresPassword() ); } // // Accept or reject a player on the server. // Fails login if you set the Error to a non-empty string. // event PreLogin(string Options, string Address, out string ErrorMessage) { local bool bSpectator; local bool bPerfTesting; // Check for an arbitrated match in progress and kick if needed if (WorldInfo.NetMode != NM_Standalone && bUsingArbitration && bHasArbitratedHandshakeBegun) { //@todo joeg -- Put proper error message in here ErrorMessage = GameMessageClass.Default.ArbitrationMessage; return; } bPerfTesting = ( ParseOption( Options, "AutomatedPerfTesting" ) ~= "1" ); bSpectator = bPerfTesting || ( ParseOption( Options, "SpectatorOnly" ) ~= "1" ); if (AccessControl != None) { AccessControl.PreLogin(Options, Address, ErrorMessage, bSpectator); } } function bool AtCapacity(bool bSpectator) { if ( WorldInfo.NetMode == NM_Standalone ) return false; if ( bSpectator ) return ( (NumSpectators >= MaxSpectators) && ((WorldInfo.NetMode != NM_ListenServer) || (NumPlayers > 0)) ); else return ( (MaxPlayers>0) && (GetNumPlayers() >= MaxPlayers) ); } native final function int GetNextPlayerID(); // // Log a player in. // Fails login if you set the Error string. // PreLogin is called before Login, but significant game time may pass before // Login is called, especially if content is downloaded. // event PlayerController Login ( string Portal, string Options, out string ErrorMessage ) { local NavigationPoint StartSpot; local PlayerController NewPlayer; local string InName, InCharacter/*, InAdminName*/, InPassword; local byte InTeam; local bool bSpectator, bAdmin, bPerfTesting; local rotator SpawnRotation; local string FriendOptStr; local UniqueNetId FriendNetId, ZeroNetId; bAdmin = false; // Kick the player if they joined during the handshake process if (bUsingArbitration && bHasArbitratedHandshakeBegun) { ErrorMessage = "Engine.GameMessage.MaxedOutMessage"; return None; } if ( BaseMutator != None ) BaseMutator.ModifyLogin(Portal, Options); bPerfTesting = ( ParseOption( Options, "AutomatedPerfTesting" ) ~= "1" ); bSpectator = bPerfTesting || ( ParseOption( Options, "SpectatorOnly" ) ~= "1" ); // Get URL options. InName = Left(ParseOption ( Options, "Name"), 20); InTeam = GetIntOption( Options, "Team", 255 ); // default to "no team" //InAdminName= ParseOption ( Options, "AdminName"); InPassword = ParseOption ( Options, "Password" ); //InChecksum = ParseOption ( Options, "Checksum" ); if ( AccessControl != None ) { bAdmin = AccessControl.ParseAdminOptions(Options); } // Make sure there is capacity except for admins. (This might have changed since the PreLogin call). if ( !bAdmin && AtCapacity(bSpectator) ) { ErrorMessage = "Engine.GameMessage.MaxedOutMessage"; return None; } // If admin, force spectate mode if the server already full of reg. players if ( bAdmin && AtCapacity(false) ) { bSpectator = true; } //UT3G - Friend Following, put a friend on the same team if specified FriendOptStr = ParseOption( Options, "Friend" ); if (FriendOptStr != "") { class'OnlineSubsystem'.static.StringToUniqueNetId(FriendOptStr, FriendNetId); if (FriendNetId != ZeroNetId) { InTeam = PickFriendTeam(InTeam,None,FriendNetId); CurrentFriendId = FriendNetId; } else { InTeam = PickTeam(InTeam,None); } } else { // Pick a team (if need teams) InTeam = PickTeam(InTeam,None); } // Find a start spot. StartSpot = FindPlayerStart( None, InTeam, Portal ); if( StartSpot == None ) { ErrorMessage = GameMessageClass.Default.FailedPlaceMessage; return None; } SpawnRotation.Yaw = StartSpot.Rotation.Yaw; NewPlayer = spawn(PlayerControllerClass,,,StartSpot.Location,SpawnRotation); // Handle spawn failure. if( NewPlayer == None ) { LogInternal("Couldn't spawn player controller of class "$PlayerControllerClass); ErrorMessage = GameMessageClass.Default.FailedSpawnMessage; return None; } NewPlayer.StartSpot = StartSpot; // Set the player's ID. NewPlayer.PlayerReplicationInfo.PlayerID = GetNextPlayerID(); // Store the friend net id, if around if (FriendNetId != ZeroNetId) { NewPlayer.PlayerReplicationInfo.FriendFollowedId = FriendNetId; } // Init player's name if( InName=="" ) { InName=DefaultPlayerName$NewPlayer.PlayerReplicationInfo.PlayerID; } ChangeName( NewPlayer, InName, false ); InCharacter = ParseOption(Options, "Character"); NewPlayer.SetCharacter(InCharacter); if ( bSpectator || NewPlayer.PlayerReplicationInfo.bOnlySpectator || !ChangeTeam(newPlayer, InTeam, false) ) { NewPlayer.GotoState('Spectating'); NewPlayer.PlayerReplicationInfo.bOnlySpectator = true; NewPlayer.PlayerReplicationInfo.bIsSpectator = true; NewPlayer.PlayerReplicationInfo.bOutOfLives = true; return NewPlayer; } //always reset this back to zero CurrentFriendId = ZeroNetId; // perform auto-login if admin password/name was passed on the url if ( AccessControl != None && AccessControl.AdminLogin(NewPlayer, InPassword) ) { AccessControl.AdminEntered(NewPlayer); } // if delayed start, don't give a pawn to the player yet // Normal for multiplayer games if ( bDelayedStart ) { NewPlayer.GotoState('PlayerWaiting'); return NewPlayer; } return newPlayer; } /* StartMatch() Start the game - inform all actors that the match is starting, and spawn player pawns */ function StartMatch() { local Actor A; // tell all actors the game is starting ForEach AllActors(class'Actor', A) { A.MatchStarting(); } // start human players first StartHumans(); // start AI players StartBots(); bWaitingToStartMatch = false; StartOnlineGame(); // fire off any level startup events WorldInfo.NotifyMatchStarted(); } /** * Tells the online system to start the game and waits for the callback. Tells * each connected client to register their */ function StartOnlineGame() { if (GameInterface != None) { // Register the start callback so that the stat guid can be read GameInterface.AddStartOnlineGameCompleteDelegate(OnStartOnlineGameComplete); // Start the game locally and wait for it to complete GameInterface.StartOnlineGame(); } else { // Notify all clients that the match has begun GameReplicationInfo.StartMatch(); } } /** * Callback when the start completes * * @param bWasSuccessful true if it worked, false otherwise */ function OnStartOnlineGameComplete(bool bWasSuccessful) { local PlayerController PC; local string StatGuid; GameInterface.ClearStartOnlineGameCompleteDelegate(OnStartOnlineGameComplete); if (bWasSuccessful && OnlineSub.StatsInterface != None) { // Get the stat guid for the server StatGuid = OnlineSub.StatsInterface.GetHostStatGuid(); if (StatGuid != "") { // Send the stat guid to all clients foreach WorldInfo.AllControllers(class'PlayerController',PC) { if (PC.IsLocalPlayerController() == false) { PC.ClientRegisterHostStatGuid(StatGuid); } } } } // Notify all clients that the match has begun GameReplicationInfo.StartMatch(); } function StartHumans() { local PlayerController P; foreach WorldInfo.AllControllers(class'PlayerController', P) { if (P.Pawn == None) { if ( bGameEnded ) { return; // telefrag ended the game with ridiculous frag limit } else if (P.CanRestartPlayer()) { RestartPlayer(P); } } } } function StartBots() { local Controller P; foreach WorldInfo.AllControllers(class'Controller', P) { if (P.bIsPlayer && !P.IsA('PlayerController')) { if (WorldInfo.NetMode == NM_Standalone) { RestartPlayer(P); } else { P.GotoState('Dead','MPStart'); } } } } // // Restart a player. // function RestartPlayer(Controller NewPlayer) { local NavigationPoint startSpot; local int TeamNum, Idx; local array<SequenceObject> Events; local SeqEvent_PlayerSpawned SpawnedEvent; if( bRestartLevel && WorldInfo.NetMode!=NM_DedicatedServer && WorldInfo.NetMode!=NM_ListenServer ) { WarnInternal("bRestartLevel && !server, abort from RestartPlayer"@WorldInfo.NetMode); return; } // figure out the team number and find the start spot TeamNum = ((NewPlayer.PlayerReplicationInfo == None) || (NewPlayer.PlayerReplicationInfo.Team == None)) ? 255 : NewPlayer.PlayerReplicationInfo.Team.TeamIndex; StartSpot = FindPlayerStart(NewPlayer, TeamNum); // if a start spot wasn't found, if (startSpot == None) { // check for a previously assigned spot if (NewPlayer.StartSpot != None) { StartSpot = NewPlayer.StartSpot; WarnInternal("Player start not found, using last start spot"); } else { // otherwise abort WarnInternal("Player start not found, failed to restart player"); return; } } // try to create a pawn to use of the default class for this player if (NewPlayer.Pawn == None) { NewPlayer.Pawn = SpawnDefaultPawnFor(NewPlayer, StartSpot); } if (NewPlayer.Pawn == None) { LogInternal("failed to spawn player at "$StartSpot); NewPlayer.GotoState('Dead'); if ( PlayerController(NewPlayer) != None ) { PlayerController(NewPlayer).ClientGotoState('Dead','Begin'); } } else { // initialize and start it up NewPlayer.Pawn.SetAnchor(startSpot); if ( PlayerController(NewPlayer) != None ) { PlayerController(NewPlayer).TimeMargin = -0.1; startSpot.AnchoredPawn = None; // SetAnchor() will set this since IsHumanControlled() won't return true for the Pawn yet } NewPlayer.Pawn.LastStartSpot = PlayerStart(startSpot); NewPlayer.Pawn.LastStartTime = WorldInfo.TimeSeconds; NewPlayer.Possess(NewPlayer.Pawn, false); NewPlayer.Pawn.PlayTeleportEffect(true, true); NewPlayer.ClientSetRotation(NewPlayer.Pawn.Rotation); if (!WorldInfo.bNoDefaultInventoryForPlayer) { AddDefaultInventory(NewPlayer.Pawn); } SetPlayerDefaults(NewPlayer.Pawn); // activate spawned events if (WorldInfo.GetGameSequence() != None) { WorldInfo.GetGameSequence().FindSeqObjectsByClass(class'SeqEvent_PlayerSpawned',TRUE,Events); for (Idx = 0; Idx < Events.Length; Idx++) { SpawnedEvent = SeqEvent_PlayerSpawned(Events[Idx]); if (SpawnedEvent != None && SpawnedEvent.CheckActivate(NewPlayer,NewPlayer)) { SpawnedEvent.SpawnPoint = startSpot; SpawnedEvent.PopulateLinkedVariableValues(); } } } } } /** * Returns a pawn of the default pawn class * * @param NewPlayer - Controller for whom this pawn is spawned * @param StartSpot - PlayerStart at which to spawn pawn * * @return pawn */ function Pawn SpawnDefaultPawnFor(Controller NewPlayer, NavigationPoint StartSpot) { local class<Pawn> DefaultPlayerClass; local Rotator StartRotation; local Pawn ResultPawn; DefaultPlayerClass = GetDefaultPlayerClass(NewPlayer); // don't allow pawn to be spawned with any pitch or roll StartRotation.Yaw = StartSpot.Rotation.Yaw; ResultPawn = Spawn(DefaultPlayerClass,,,StartSpot.Location,StartRotation); if ( ResultPawn == None ) { LogInternal("Couldn't spawn player of type "$DefaultPlayerClass$" at "$StartSpot); } return ResultPawn; } /** * Returns the default pawn class for the specified controller, * * @param C - controller to figure out pawn class for * * @return default pawn class */ function class<Pawn> GetDefaultPlayerClass(Controller C) { // default to the game specified pawn class return DefaultPawnClass; } /** replicates the current level streaming status to the given PlayerController */ function ReplicateStreamingStatus(PlayerController PC) { local int LevelIndex; local LevelStreaming TheLevel; // don't do this for local players or players after the first on a splitscreen client if (LocalPlayer(PC.Player) == None && ChildConnection(PC.Player) == None) { // if we've loaded levels via CommitMapChange() that aren't normally in the StreamingLevels array, tell the client about that if (WorldInfo.CommittedLevelNames.length > 0) { for (LevelIndex = 0; LevelIndex < WorldInfo.CommittedLevelNames.length; LevelIndex++) { PC.ClientPrepareMapChange(WorldInfo.CommittedLevelNames[LevelIndex], LevelIndex == 0, LevelIndex == WorldInfo.CommittedLevelNames.length - 1); } // tell the client to commit the levels immediately PC.ClientCommitMapChange(); } if (WorldInfo.StreamingLevels.length > 0) { // Tell the player controller the current streaming level status for (LevelIndex = 0; LevelIndex < WorldInfo.StreamingLevels.Length; LevelIndex++) { // streamingServer TheLevel = WorldInfo.StreamingLevels[LevelIndex]; if( TheLevel != none ) { LogInternal("levelStatus: " $ TheLevel.PackageName $ " " $ TheLevel.bShouldBeVisible $ " " $ TheLevel.bIsVisible $ " " $ TheLevel.bShouldBeLoaded $ " " $ TheLevel.LoadedLevel $ " " $ TheLevel.bHasLoadRequestPending $ " " ) ; PC.ClientUpdateLevelStreamingStatus( TheLevel.PackageName, TheLevel.bShouldBeLoaded, TheLevel.bShouldBeVisible, TheLevel.bShouldBlockOnLoad); } } PC.ClientFlushLevelStreaming(); } // if we're preparing to load different levels using PrepareMapChange() inform the client about that now if (WorldInfo.PreparingLevelNames.length > 0) { for (LevelIndex = 0; LevelIndex < WorldInfo.PreparingLevelNames.length; LevelIndex++) { PC.ClientPrepareMapChange(WorldInfo.PreparingLevelNames[LevelIndex], LevelIndex == 0, LevelIndex == WorldInfo.PreparingLevelNames.length - 1); } // DO NOT commit these changes yet - we'll send that when we're done preparing them } } } // // Called after a successful login. This is the first place // it is safe to call replicated functions on the PlayerController. // event PostLogin( PlayerController NewPlayer ) { local string Address; local string StatGuid; local int pos; // update player count if (NewPlayer.PlayerReplicationInfo.bOnlySpectator) { NumSpectators++; } else if (WorldInfo.IsInSeamlessTravel() || NewPlayer.HasClientLoadedCurrentWorld()) { NumPlayers++; } else { NumTravellingPlayers++; } // Tell the online subsystem the number of players in the game UpdateGameSettingsCounts(); // save network address for re-associating with reconnecting player, after stripping out port number Address = NewPlayer.GetPlayerNetworkAddress(); pos = InStr(Address,":"); NewPlayer.PlayerReplicationInfo.SavedNetworkAddress = (pos > 0) ? left(Address,pos) : Address; // check if this player is reconnecting and already has PRI FindInactivePRI(NewPlayer); if ( !bDelayedStart ) { // start match, or let player enter, immediately bRestartLevel = false; // let player spawn once in levels that must be restarted after every death if ( bWaitingToStartMatch ) StartMatch(); else RestartPlayer(newPlayer); bRestartLevel = Default.bRestartLevel; } // tell client what hud and scoreboard to use NewPlayer.SetHUD( HudType, ScoreboardType ); if ( NewPlayer.Pawn != None ) NewPlayer.Pawn.ClientSetRotation(NewPlayer.Pawn.Rotation); NewPlayer.ClientCapBandwidth(NewPlayer.Player.CurrentNetSpeed); UpdateNetSpeeds(); if ( BaseMutator != None ) BaseMutator.NotifyLogin(NewPlayer); ReplicateStreamingStatus(NewPlayer); // tell the player about the music, if any NewPlayer.ServerSendMusicInfo(); // see if we need to spawn a CoverReplicator for this player if (CoverReplicatorBase != None) { NewPlayer.SpawnCoverReplicator(); } // Set the rich presence strings on the client (has to be done there) NewPlayer.ClientSetOnlineStatus(); // Tell the new player the stat guid if (GameReplicationInfo.bMatchHasBegun && OnlineSub != None && OnlineSub.StatsInterface != None) { // Get the stat guid for the server StatGuid = OnlineSub.StatsInterface.GetHostStatGuid(); if (StatGuid != "") { NewPlayer.ClientRegisterHostStatGuid(StatGuid); } } // Tell the player to disable voice by default and use the push to talk method if (bRequiresPushToTalk) { NewPlayer.ClientStopNetworkedVoice(); } else { NewPlayer.ClientStartNetworkedVoice(); } if (NewPlayer.PlayerReplicationInfo.bOnlySpectator) { NewPlayer.ClientGotoState('Spectating'); } } function UpdateNetSpeeds() { local int NewNetSpeed; local PlayerController PC; if ( (WorldInfo.NetMode == NM_DedicatedServer) || (WorldInfo.NetMode == NM_Standalone) || ((OnlineSub != None) && (OnlineSub.GameInterface != None) && (OnlineSub.GameInterface.GetGameSettings() != None)&& OnlineSub.GameInterface.GetGameSettings().bIsLanMatch) ) { return; } if ( WorldInfo.TimeSeconds - LastNetSpeedUpdateTime < 1.0 ) { SetTimer(1.0, false, 'UpdateNetSpeeds'); return; } LastNetSpeedUpdateTime = WorldInfo.TimeSeconds; NewNetSpeed = CalculatedNetSpeed(); LogInternal("New Dynamic NetSpeed "$NewNetSpeed$" vs old "$AdjustedNetSpeed); if ( AdjustedNetSpeed != NewNetSpeed ) { AdjustedNetSpeed = NewNetSpeed; ForEach WorldInfo.AllControllers(class'PlayerController', PC) { PC.SetNetSpeed(Min(AdjustedNetSpeed, PC.MaxClientNetSpeed)); } } } function int CalculatedNetSpeed() { return Clamp(TotalNetBandwidth/Max(NumPlayers,1), MinDynamicBandwidth, MaxDynamicBandwidth); } /** * Engine is shutting down. */ event PreExit(); // // Player exits. // function Logout( Controller Exiting ) { local PlayerController PC; local int PCIndex; PC = PlayerController(Exiting); if ( PC != None ) { //FIXMESTEVE if ( AccessControl.AdminLogout( PlayerController(Exiting) ) ) // AccessControl.AdminExited( PlayerController(Exiting) ); if ( PC.PlayerReplicationInfo.bOnlySpectator ) { NumSpectators--; } else { if (WorldInfo.IsInSeamlessTravel() || PC.HasClientLoadedCurrentWorld()) { NumPlayers--; } else { NumTravellingPlayers--; } // Tell the online subsystem the number of players in the game UpdateGameSettingsCounts(); } // This person has left during an arbitration period if (bUsingArbitration && bHasArbitratedHandshakeBegun && !bHasEndGameHandshakeBegun) { LogInternal("Player "$PC.PlayerReplicationInfo.GetPlayerAlias()$" has dropped"); } // If there is a game unregister this remote player if (WorldInfo.NetMode != NM_Standalone && GameInterface != None && GameInterface.GetGameSettings() != None) { // Unregister the player from the session GameInterface.UnregisterPlayer(PC.PlayerReplicationInfo.UniqueId); } // Remove from the arbitrated PC list if in an arbitrated match if (bUsingArbitration) { // Find the PC in the list and remove it if found PCIndex = ArbitrationPCs.Find(PC); if (PCIndex != INDEX_NONE) { ArbitrationPCs.Remove(PCIndex,1); } } } //notify mutators that a player exited if (BaseMutator != None) { BaseMutator.NotifyLogout(Exiting); } UpdateNetSpeeds(); } // // Examine the passed player's inventory, and accept or discard each item. // AcceptInventory needs to gracefully handle the case of some inventory // being accepted but other inventory not being accepted (such as the default // weapon). There are several things that can go wrong: A weapon's // AmmoType not being accepted but the weapon being accepted -- the weapon // should be killed off. Or the player's selected inventory item, active // weapon, etc. not being accepted, leaving the player weaponless or leaving // the HUD inventory rendering messed up (AcceptInventory should pick another // applicable weapon/item as current). // event AcceptInventory(pawn PlayerPawn) { //default accept all inventory except default weapon (spawned explicitly) } // // Spawn any default inventory for the player. // event AddDefaultInventory(Pawn P) { // Allow the pawn itself to modify its inventory P.AddDefaultInventory(); if ( P.InvManager == None ) { WarnInternal("GameInfo::AddDefaultInventory - P.InvManager == None"); } } /* Mutate() Pass an input string to the mutator list. Used by PlayerController.Mutate(), intended to allow mutators to have input exec functions (by binding mutate xxx to keys) */ function Mutate(string MutateString, PlayerController Sender) { if ( BaseMutator != None ) BaseMutator.Mutate(MutateString, Sender); } /* SetPlayerDefaults() first make sure pawn properties are back to default, then give mutators an opportunity to modify them */ function SetPlayerDefaults(Pawn PlayerPawn) { PlayerPawn.AirControl = PlayerPawn.Default.AirControl; PlayerPawn.GroundSpeed = PlayerPawn.Default.GroundSpeed; PlayerPawn.WaterSpeed = PlayerPawn.Default.WaterSpeed; PlayerPawn.AirSpeed = PlayerPawn.Default.AirSpeed; PlayerPawn.Acceleration = PlayerPawn.Default.Acceleration; PlayerPawn.AccelRate = PlayerPawn.Default.AccelRate; PlayerPawn.JumpZ = PlayerPawn.Default.JumpZ; if ( BaseMutator != None ) BaseMutator.ModifyPlayer(PlayerPawn); PlayerPawn.PhysicsVolume.ModifyPlayer(PlayerPawn); } function NotifyKilled(Controller Killer, Controller Killed, Pawn KilledPawn ) { local Controller C; foreach WorldInfo.AllControllers(class'Controller', C) { C.NotifyKilled(Killer, Killed, KilledPawn); } } function Killed( Controller Killer, Controller KilledPlayer, Pawn KilledPawn, class<DamageType> damageType ) { if( KilledPlayer != None && KilledPlayer.bIsPlayer ) { KilledPlayer.PlayerReplicationInfo.Deaths += 1; KilledPlayer.PlayerReplicationInfo.SetNetUpdateTime(FMin(KilledPlayer.PlayerReplicationInfo.NetUpdateTime, WorldInfo.TimeSeconds + 0.3 * FRand())); BroadcastDeathMessage(Killer, KilledPlayer, damageType); } if( KilledPlayer != None ) { ScoreKill(Killer, KilledPlayer); } DiscardInventory(KilledPawn, Killer); NotifyKilled(Killer, KilledPlayer, KilledPawn); } function bool PreventDeath(Pawn KilledPawn, Controller Killer, class<DamageType> damageType, vector HitLocation) { if ( GameRulesModifiers == None ) return false; return GameRulesModifiers.PreventDeath(KilledPawn,Killer, damageType,HitLocation); } function BroadcastDeathMessage(Controller Killer, Controller Other, class<DamageType> damageType) { if ( (Killer == Other) || (Killer == None) ) { BroadcastLocalized(self, DeathMessageClass, 1, None, Other.PlayerReplicationInfo, damageType); } else { BroadcastLocalized(self, DeathMessageClass, 0, Killer.PlayerReplicationInfo, Other.PlayerReplicationInfo, damageType); } } // `k = Owner's PlayerName (Killer) // `o = Other's PlayerName (Victim) static function string ParseKillMessage( string KillerName, string VictimName, string DeathMessage ) { return Repl(Repl(DeathMessage,"`k",KillerName),"`o",VictimName); } function Kick( string S ) { if (AccessControl != None) AccessControl.Kick(S); } function KickBan( string S ) { if (AccessControl != None) AccessControl.KickBan(S); } function SessionBan(string S) { if (AccessControl != none) AccessControl.SessionBan(S); } //------------------------------------------------------------------------------------- // Level gameplay modification. // // Return whether Viewer is allowed to spectate from the // point of view of ViewTarget. // function bool CanSpectate( PlayerController Viewer, PlayerReplicationInfo ViewTarget ) { return true; } /* ReduceDamage: Use reduce damage for teamplay modifications, etc. */ function ReduceDamage( out int Damage, pawn injured, Controller instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType ) { local int OriginalDamage; OriginalDamage = Damage; if ( injured.PhysicsVolume.bNeutralZone || injured.InGodMode() ) { Damage = 0; return; } else if ( (damage > 0) && (injured.InvManager != None) ) // then check if carrying items that can reduce damage injured.InvManager.ModifyDamage( Damage, instigatedBy, HitLocation, Momentum, DamageType ); if ( GameRulesModifiers != None ) GameRulesModifiers.NetDamage( OriginalDamage, Damage,injured,instigatedBy,HitLocation,Momentum,DamageType ); } /* CheckRelevance() returns true if actor is relevant to this game and should not be destroyed. Called in Actor.PreBeginPlay(), intended to allow mutators to remove or replace actors being spawned */ function bool CheckRelevance(Actor Other) { if ( BaseMutator == None ) return true; return BaseMutator.CheckRelevance(Other); } // // Return whether an item should respawn. // function bool ShouldRespawn( PickupFactory Other ) { return ( WorldInfo.NetMode != NM_Standalone ); } /** PickupQuery: * Called when pawn has a chance to pick Item up (i.e. when * the pawn touches a weapon pickup). Should return true if * he wants to pick it up, false if he does not want it. * @param Other the Pawn that wants the item * @param ItemClass the Inventory class the Pawn can pick up * @param Pickup the Actor containing that item (this may be a PickupFactory or it may be a DroppedPickup) * @return whether or not the Pickup actor should give its item to Other */ function bool PickupQuery(Pawn Other, class<Inventory> ItemClass, Actor Pickup) { local byte bAllowPickup; if (GameRulesModifiers != None && GameRulesModifiers.OverridePickupQuery(Other, ItemClass, Pickup, bAllowPickup)) { return bool(bAllowPickup); } if ( Other.InvManager == None ) { return false; } else { return Other.InvManager.HandlePickupQuery(ItemClass, Pickup); } } /* DiscardInventory: Discard a player's inventory after he dies. */ function DiscardInventory( Pawn Other, optional controller Killer ) { if ( Other.InvManager != None ) Other.InvManager.DiscardInventory(); } /* Try to change a player's name. */ function ChangeName( Controller Other, coerce string S, bool bNameChange ) { if( S == "" ) { return; } Other.PlayerReplicationInfo.SetPlayerName(S); } /* Return whether a team change is allowed. */ function bool ChangeTeam(Controller Other, int N, bool bNewTeam) { return true; } /* Return a picked team number if none was specified */ function byte PickTeam(byte Current, Controller C) { return Current; } function byte PickFriendTeam(byte Current, Controller C, UniqueNetId FriendNetId) { return Current; } /* Send a player to a URL. */ function SendPlayer( PlayerController aPlayer, string URL ) { aPlayer.ClientTravel( URL, TRAVEL_Relative ); } /** @return the map we should travel to for the next game */ function string GetNextMap(); /** * Returns true if we want to travel_absolute */ function bool GetTravelType() { return false; } /* Restart the game. */ function RestartGame() { local string NextMap; // If we are using arbitration and haven't done the end game handshaking, // do that process first and then come back here afterward if (bUsingArbitration) { if (bIsEndGameHandshakeComplete) { // All arbitrated matches must exit after one match NotifyArbitratedMatchEnd(); } return; } if ( (GameRulesModifiers != None) && GameRulesModifiers.HandleRestartGame() ) return; if ( bGameRestarted ) return; bGameRestarted = true; // these server travels should all be relative to the current URL if ( bChangeLevels && !bAlreadyChanged ) { // get the next map and start the transition bAlreadyChanged = true; NextMap = GetNextMap(); if (NextMap != "") { WorldInfo.ServerTravel(NextMap,GetTravelType()); return; } } WorldInfo.ServerTravel("?Restart",GetTravelType()); } //========================================================================== // Message broadcasting functions (handled by the BroadCastHandler) event Broadcast( Actor Sender, coerce string Msg, optional name Type ) { BroadcastHandler.Broadcast(Sender,Msg,Type); } function BroadcastTeam( Controller Sender, coerce string Msg, optional name Type ) { BroadcastHandler.BroadcastTeam(Sender,Msg,Type); } /* Broadcast a localized message to all players. Most message deal with 0 to 2 related PRIs. The LocalMessage class defines how the PRI's and optional actor are used. */ event BroadcastLocalized( actor Sender, class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject ) { BroadcastHandler.AllowBroadcastLocalized(Sender,Message,Switch,RelatedPRI_1,RelatedPRI_2,OptionalObject); } /* Broadcast a localized message to all players on a team. Most message deal with 0 to 2 related PRIs. The LocalMessage class defines how the PRI's and optional actor are used. */ event BroadcastLocalizedTeam( int TeamIndex, actor Sender, class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject ) { BroadcastHandler.AllowBroadcastLocalizedTeam(TeamIndex, Sender,Message,Switch,RelatedPRI_1,RelatedPRI_2,OptionalObject); } //========================================================================== function bool CheckModifiedEndGame(PlayerReplicationInfo Winner, string Reason) { return ( (GameRulesModifiers != None) && !GameRulesModifiers.CheckEndGame(Winner, Reason) ); } function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason) { local Controller P; if ( CheckModifiedEndGame(Winner, Reason) ) return false; // all player cameras focus on winner or final scene (picked by gamerules) foreach WorldInfo.AllControllers(class'Controller', P) { P.GameHasEnded(); } return true; } /** * Overload this method so that your game writes out stats */ function WriteOnlineStats(); /** * Overload this method so that your game writes out player scores */ function WriteOnlinePlayerScores() { local int Index; local array<OnlinePlayerScore> PlayerScores; if (OnlineSub != None && OnlineSub.StatsInterface != None) { // Allocate an entry for all players PlayerScores.Length = GameReplicationInfo.PRIArray.Length; // Iterate through the players building their score data for (Index = 0; Index < GameReplicationInfo.PRIArray.Length; Index++) { // Build the skill data for this player PlayerScores[Index].PlayerId = GameReplicationInfo.PRIArray[Index].UniqueId; if (bTeamGame) { PlayerScores[Index].TeamId = GameReplicationInfo.PRIArray[Index].Team.TeamIndex; PlayerScores[Index].Score = GameReplicationInfo.PRIArray[Index].Team.Score; } else { PlayerScores[Index].TeamId = Index; PlayerScores[Index].Score = GameReplicationInfo.PRIArray[Index].Score; } } // Now write out the scores OnlineSub.StatsInterface.WriteOnlinePlayerScores(PlayerScores); } } /* End of game. */ function EndGame( PlayerReplicationInfo Winner, string Reason ) { local int Index; // don't end game if not really ready if ( !CheckEndGame(Winner, Reason) ) { bOverTime = true; return; } // The non-arbitrated route, the server writes all stats if (!bUsingArbitration) { // Write out any online stats WriteOnlineStats(); // Write the player data used in determining skill ratings WriteOnlinePlayerScores(); // Have clients end their games GameReplicationInfo.EndGame(); // Server is handled here GameInterface.EndOnlineGame(); } // Arbitrated matches require all participants to report stats // This is handled in the end game handshaking process else { GameReplicationInfo.bMatchIsOver = true; if (bNeedsEndGameHandshake) { // Iterate through the inactive list and send them to the clients for (Index = 0; Index < InactivePRIArray.Length; Index++) { InactivePRIArray[Index].bIsInactive = true; InactivePRIArray[Index].RemoteRole = InactivePRIArray[Index].default.RemoteRole; } // Delay a bit so that replication can happen before processing SetTimer(2.0,false,'ProcessEndGameHandshake'); bNeedsEndGameHandshake = false; bIsEndGameHandshakeComplete = false; } } bGameEnded = true; } /** returns whether the given Controller StartSpot property should be used as the spawn location for its Pawn */ function bool ShouldSpawnAtStartSpot(Controller Player) { return ( WorldInfo.NetMode == NM_Standalone && Player != None && Player.StartSpot != None && (bWaitingToStartMatch || (Player.PlayerReplicationInfo != None && Player.PlayerReplicationInfo.bWaitingPlayer)) ); } /** FindPlayerStart() * Return the 'best' player start for this player to start from. PlayerStarts are rated by RatePlayerStart(). * @param Player is the controller for whom we are choosing a playerstart * @param InTeam specifies the Player's team (if the player hasn't joined a team yet) * @param IncomingName specifies the tag of a teleporter to use as the Playerstart * @returns NavigationPoint chosen as player start (usually a PlayerStart) */ function NavigationPoint FindPlayerStart( Controller Player, optional byte InTeam, optional string IncomingName ) { local NavigationPoint N, BestStart; local Teleporter Tel; // allow GameRulesModifiers to override playerstart selection if ( GameRulesModifiers != None ) { N = GameRulesModifiers.FindPlayerStart(Player,InTeam,incomingName); if ( N != None ) return N; } // if incoming start is specified, then just use it if( incomingName!="" ) { ForEach WorldInfo.AllNavigationPoints( class 'Teleporter', Tel ) if( string(Tel.Tag)~=incomingName ) return Tel; } // always pick StartSpot at start of match if ( ShouldSpawnAtStartSpot(Player) && (PlayerStart(Player.StartSpot) == None || RatePlayerStart(PlayerStart(Player.StartSpot), InTeam, Player) >= 0.0) ) { return Player.StartSpot; } BestStart = ChoosePlayerStart(Player, InTeam); if ( (BestStart == None) && (Player == None) ) { // no playerstart found, so pick any NavigationPoint to keep player from failing to enter game LogInternal("Warning - PATHS NOT DEFINED or NO PLAYERSTART with positive rating"); ForEach AllActors( class 'NavigationPoint', N ) { BestStart = N; break; } } return BestStart; } /** ChoosePlayerStart() * Return the 'best' player start for this player to start from. PlayerStarts are rated by RatePlayerStart(). * @param Player is the controller for whom we are choosing a playerstart * @param InTeam specifies the Player's team (if the player hasn't joined a team yet) * @returns NavigationPoint chosen as player start (usually a PlayerStart) */ function PlayerStart ChoosePlayerStart( Controller Player, optional byte InTeam ) { local PlayerStart P, BestStart; local float BestRating, NewRating; local byte Team; // use InTeam if player doesn't have a team yet Team = ( (Player != None) && (Player.PlayerReplicationInfo != None) && (Player.PlayerReplicationInfo.Team != None) ) ? byte(Player.PlayerReplicationInfo.Team.TeamIndex) : InTeam; // Find best playerstart foreach WorldInfo.AllNavigationPoints(class'PlayerStart', P) { NewRating = RatePlayerStart(P,Team,Player); if ( NewRating > BestRating ) { BestRating = NewRating; BestStart = P; } } return BestStart; } /** RatePlayerStart() * Return a score representing how desireable a playerstart is. * @param P is the playerstart being rated * @param Team is the team of the player choosing the playerstart * @param Player is the controller choosing the playerstart * @returns playerstart score */ function float RatePlayerStart(PlayerStart P, byte Team, Controller Player) { if ( !P.bEnabled ) return 10; return ( P.bPrimaryStart ? 100 : 20 ); } function AddObjectiveScore(PlayerReplicationInfo Scorer, Int Score) { if ( Scorer != None ) { Scorer.Score += Score; } if ( GameRulesModifiers != None ) GameRulesModifiers.ScoreObjective(Scorer,Score); } function ScoreObjective(PlayerReplicationInfo Scorer, Int Score) { AddObjectiveScore(Scorer, Score); CheckScore(Scorer); } /* CheckScore() see if this score means the game ends */ function bool CheckScore(PlayerReplicationInfo Scorer) { return true; } function ScoreKill(Controller Killer, Controller Other) { if( (killer == Other) || (killer == None) ) { if ( (Other!=None) && (Other.PlayerReplicationInfo != None) ) { Other.PlayerReplicationInfo.Score -= 1; Other.PlayerReplicationInfo.bForceNetUpdate = TRUE; } } else if ( killer.PlayerReplicationInfo != None ) { Killer.PlayerReplicationInfo.Score += 1; Killer.PlayerReplicationInfo.bForceNetUpdate = TRUE; Killer.PlayerReplicationInfo.Kills++; } if ( GameRulesModifiers != None ) GameRulesModifiers.ScoreKill(Killer, Other); if ( (Killer != None) || (MaxLives > 0) ) { CheckScore(Killer.PlayerReplicationInfo); } } /** * For subclasses which don't call GameInfo.ScoreKill() */ function ModifyScoreKill(Controller Killer, Controller Other) { if ( GameRulesModifiers != None ) GameRulesModifiers.ScoreKill(Killer, Other); } // - Parse out % vars for various messages static function string ParseMessageString(Controller Who, String Message) { return Message; } function DriverEnteredVehicle(Vehicle V, Pawn P) { if ( BaseMutator != None ) BaseMutator.DriverEnteredVehicle(V, P); } function bool CanLeaveVehicle(Vehicle V, Pawn P) { if ( BaseMutator == None ) return true; return BaseMutator.CanLeaveVehicle(V, P); } function DriverLeftVehicle(Vehicle V, Pawn P) { if ( BaseMutator != None ) BaseMutator.DriverLeftVehicle(V, P); } exec function KillBots(); function bool PlayerCanRestartGame( PlayerController aPlayer ) { return true; } // Player Can be restarted ? function bool PlayerCanRestart( PlayerController aPlayer ) { return true; } // Returns whether a mutator should be allowed with this gametype static function bool AllowMutator( string MutatorClassName ) { return !class'WorldInfo'.static.IsDemoBuild(); } function bool AllowCheats(PlayerController P) { return ( WorldInfo.NetMode == NM_Standalone ); } /** * Called from C++'s CommitMapChange before unloading previous level * @param PreviousMapName Name of the previous persistent level * @param NextMapName Name of the persistent level being streamed to */ event PreCommitMapChange(string PreviousMapName, string NextMapName); /** * Called from C++'s CommitMapChange after unloading previous level and loading new level+sublevels */ event PostCommitMapChange(); /** AddInactivePRI() * Add PRI to the inactive list, remove from the active list */ function AddInactivePRI(PlayerReplicationInfo PRI, PlayerController PC) { local int i; local PlayerReplicationInfo NewPRI; local bool bIsConsole; // don't store if it's an old PRI from the previous level or if it's a spectator if (!PRI.bFromPreviousLevel && !PRI.bOnlySpectator) { NewPRI = PRI.Duplicate(); WorldInfo.GRI.RemovePRI(NewPRI); // make PRI inactive NewPRI.RemoteRole = ROLE_None; // delete after 5 minutes NewPRI.LifeSpan = 300; // On console, we have to check the unique net id as network address isn't valid bIsConsole = WorldInfo.IsConsoleBuild(); // make sure no duplicates for (i=0; i<InactivePRIArray.Length; i++) { if ( (InactivePRIArray[i] == None) || InactivePRIArray[i].bDeleteMe || //@todo joeg -- Change this once the PC master server is issuing net ids (!bIsConsole && (InactivePRIArray[i].SavedNetworkAddress == NewPRI.SavedNetworkAddress)) || (bIsConsole && InactivePRIArray[i].AreUniqueNetIdsEqual(NewPRI)) ) { InactivePRIArray.Remove(i,1); i--; } } InactivePRIArray[InactivePRIArray.Length] = NewPRI; // cap at 16 saved PRIs if ( InactivePRIArray.Length > 16 ) { InactivePRIArray.Remove(0, InactivePRIArray.Length - 16); } } PRI.Destroy(); // Readjust the skill rating now that this player has left RecalculateSkillRating(); } /** FindInactivePRI() * returns the PRI associated with this re-entering player */ function bool FindInactivePRI(PlayerController PC) { local string NewNetworkAddress, NewName; local int i; local PlayerReplicationInfo OldPRI; local bool bIsConsole; // don't bother for spectators if (PC.PlayerReplicationInfo.bOnlySpectator) { return false; } // On console, we have to check the unique net id as network address isn't valid bIsConsole = WorldInfo.IsConsoleBuild(); NewNetworkAddress = PC.PlayerReplicationInfo.SavedNetworkAddress; NewName = PC.PlayerReplicationInfo.PlayerName; for (i=0; i<InactivePRIArray.Length; i++) { if ( (InactivePRIArray[i] == None) || InactivePRIArray[i].bDeleteMe ) { InactivePRIArray.Remove(i,1); i--; } //@todo joeg -- Change this once the PC master server is issuing net ids else if ( (bIsConsole && InactivePRIArray[i].AreUniqueNetIdsEqual(PC.PlayerReplicationInfo)) || (!bIsConsole && (InactivePRIArray[i].SavedNetworkAddress ~= NewNetworkAddress) && (InactivePRIArray[i].PlayerName ~= NewName)) ) { // found it! OldPRI = PC.PlayerReplicationInfo; PC.PlayerReplicationInfo = InactivePRIArray[i]; PC.PlayerReplicationInfo.SetOwner(PC); PC.PlayerReplicationInfo.RemoteRole = ROLE_SimulatedProxy; PC.PlayerReplicationInfo.Lifespan = 0; OverridePRI(PC, OldPRI); WorldInfo.GRI.AddPRI(PC.PlayerReplicationInfo); InactivePRIArray.Remove(i,1); OldPRI.Destroy(); return true; } } return false; } /** OverridePRI() * override as needed properties of NewPRI with properties from OldPRI which were assigned during the login process */ function OverridePRI(PlayerController PC, PlayerReplicationInfo OldPRI) { PC.PlayerReplicationInfo.OverrideWith(OldPRI); } /** called on server during seamless level transitions to get the list of Actors that should be moved into the new level * PlayerControllers, Role < ROLE_Authority Actors, and any non-Actors that are inside an Actor that is in the list * (i.e. Object.Outer == Actor in the list) * are all autmoatically moved regardless of whether they're included here * only dynamic (!bStatic and !bNoDelete) actors in the PersistentLevel may be moved (this includes all actors spawned during gameplay) * this is called for both parts of the transition because actors might change while in the middle (e.g. players might join or leave the game) * @see also PlayerController::GetSeamlessTravelActorList() (the function that's called on clients) * @param bToEntry true if we are going from old level -> entry, false if we are going from entry -> new level * @param ActorList (out) list of actors to maintain */ event GetSeamlessTravelActorList(bool bToEntry, out array<Actor> ActorList) { local int i; // always keep PlayerReplicationInfos and TeamInfos, so that after we restart we can keep players on the same team, etc for (i = 0; i < WorldInfo.GRI.PRIArray.Length; i++) { WorldInfo.GRI.PRIArray[i].bFromPreviousLevel = true; WorldInfo.GRI.PRIArray[i].bFromPreviousLevel_Replicated = true; ActorList[ActorList.length] = WorldInfo.GRI.PRIArray[i]; } if (bToEntry) { // keep general game state until we transition to the final destination ActorList[ActorList.length] = WorldInfo.GRI; if (BroadcastHandler != None) { ActorList[ActorList.length] = BroadcastHandler; } } if (BaseMutator != None) { BaseMutator.GetSeamlessTravelActorList(bToEntry, ActorList); } } /** used to swap a viewport/connection's PlayerControllers when seamless travelling and the new gametype's * controller class is different than the previous * includes network handling * @param OldPC - the old PC that should be discarded * @param NewPC - the new PC that should be used for the player */ native final function SwapPlayerControllers(PlayerController OldPC, PlayerController NewPC); /** called after a seamless level transition has been completed on the *new* GameInfo * used to reinitialize players already in the game as they won't have *Login() called on them */ event PostSeamlessTravel() { local Controller C; // handle players that are already loaded foreach WorldInfo.AllControllers(class'Controller', C) { if (C.bIsPlayer) { if (PlayerController(C) == None) { HandleSeamlessTravelPlayer(C); } else { if (!C.PlayerReplicationInfo.bOnlySpectator) { NumTravellingPlayers++; } if (PlayerController(C).HasClientLoadedCurrentWorld()) { HandleSeamlessTravelPlayer(C); } else if (MaxClientTravelTime > 0) { C.SetTimer(MaxClientTravelTime, false, 'ClientTravelTimeExpired'); } } } } if (bWaitingToStartMatch && !bDelayedStart && NumPlayers + NumBots > 0) { StartMatch(); } if (WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.NetMode == NM_ListenServer) { // Update any online advertised settings UpdateGameSettings(); } } /** * Used to update any changes in game settings that need to be published to * players that are searching for games */ function UpdateGameSettings(); /** handles reinitializing players that remained through a seamless level transition * called from C++ for players that finished loading after the server * @param C the Controller to handle */ event HandleSeamlessTravelPlayer(out Controller C) { local rotator StartRotation; local NavigationPoint StartSpot; local PlayerController PC, NewPC; local PlayerReplicationInfo OldPRI; LogInternal(">> GameInfo::HandleSeamlessTravelPlayer:" @ C,'SeamlessTravel'); PC = PlayerController(C); if (PC != None && PC.Class != PlayerControllerClass) { if (PC.Player != None) { // we need to spawn a new PlayerController to replace the old one NewPC = Spawn(PlayerControllerClass,,, PC.Location, PC.Rotation); if (NewPC == None) { WarnInternal("Failed to spawn new PlayerController for" @ PC.GetHumanReadableName() @ "(old class" @ PC.Class $ ")"); PC.Destroy(); return; } else { PC.CleanUpAudioComponents(); PC.SeamlessTravelTo(NewPC); NewPC.SeamlessTravelFrom(PC); SwapPlayerControllers(PC, NewPC); PC = NewPC; C = NewPC; } } else { PC.Destroy(); } } else { if (PC != none) PC.bPendingNotifyLoadedWorld = False; C.ClearTimer('ClientTravelTimeExpired'); // clear out data that was only for the previous game C.PlayerReplicationInfo.Reset(); // create a new PRI and copy over info; this is necessary because the old gametype may have used a different PRI class OldPRI = C.PlayerReplicationInfo; C.InitPlayerReplicationInfo(); OldPRI.SeamlessTravelTo(C.PlayerReplicationInfo); // we don't need the old PRI anymore //@fixme: need a way to replace PRIs that doesn't cause incorrect "player left the game"/"player entered the game" messages OldPRI.Destroy(); } // get rid of team if this is not a team game if (!bTeamGame && C.PlayerReplicationInfo.Team != None) { C.PlayerReplicationInfo.Team.Destroy(); C.PlayerReplicationInfo.Team = None; } // Find a start spot. StartSpot = FindPlayerStart(C, C.GetTeamNum()); if (StartSpot == None) { WarnInternal(GameMessageClass.Default.FailedPlaceMessage); } else { StartRotation.Yaw = StartSpot.Rotation.Yaw; C.SetLocation(StartSpot.Location); C.SetRotation(StartRotation); } C.StartSpot = StartSpot; if (PC != None) { PC.CleanUpAudioComponents(); // tell the player controller to register its data stores again PC.ClientInitializeDataStores(); PC.SetViewTarget(PC); if (PC.PlayerReplicationInfo.bOnlySpectator) { PC.GotoState('Spectating'); PC.ClientGotoState('Spectating'); // needed because Spectating state doesn't send client adjustments PC.PlayerReplicationInfo.bIsSpectator = true; PC.PlayerReplicationInfo.bOutOfLives = true; NumSpectators++; } else { NumPlayers++; NumTravellingPlayers--; PC.GotoState('PlayerWaiting'); } // tell client what hud and scoreboard to use PC.SetHUD(HudType, ScoreboardType); ReplicateStreamingStatus(PC); // tell the player about the music, if any PC.ServerSendMusicInfo(); // see if we need to spawn a CoverReplicator for this player if (CoverReplicatorBase != None) { PC.SpawnCoverReplicator(); } // Set the rich presence strings on the client (has to be done there) PC.ClientSetOnlineStatus(); } else { NumBots++; C.GotoState('RoundEnded'); } if (BaseMutator != None) { BaseMutator.NotifyLogin(C); } LogInternal("<< GameInfo::HandleSeamlessTravelPlayer:" @ C,'SeamlessTravel'); } /** * Updates the online subsystem's information for player counts so that * LAN matches can show the correct player counts */ function UpdateGameSettingsCounts() { if (GameSettings != None && GameSettings.bIsLanMatch) { // Update the number of open slots available GameSettings.NumOpenPublicConnections = GameSettings.NumPublicConnections - GetNumPlayers(); if (GameSettings.NumOpenPublicConnections < 0) { GameSettings.NumOpenPublicConnections = 0; } } } /** * This is a base (empty) implementation of the completion notification * * @param PC the player controller to mark as done * @param bWasSuccessful whether the PC was able to register for arbitration or not */ function ProcessClientRegistrationCompletion(PlayerController PC,bool bWasSuccessful); /** * Empty implementation of the code that kicks off async registration */ function StartArbitrationRegistration(); /** * Empty implementation of the code that starts an arbitrated match */ function StartArbitratedMatch(); /** * Empty implementation of the code that registers the server for arbitration */ function RegisterServerForArbitration(); /** * Empty implementation of the code that handles the callback for completion */ function ArbitrationRegistrationComplete(bool bWasSuccessful); function bool MatchIsInProgress() { return true; } /** * This state is used to change the flow of start/end match to handle arbitration * * Basic flow of events: * Server prepares to start the match and tells all clients to register arbitration * Clients register with arbitration and tell the server when they are done * Server checks for all clients to be registered and kicks any clients if * they don't register in time. * Server registers with arbitration and the match begins * * Match ends and the server tells connected clients to write arbitrated stats * Clients write stats and notifies server of completion * Server writes stats and ends the match */ auto State PendingMatch { function bool MatchIsInProgress() { return false; } /** * Tells all of the currently connected clients to register with arbitration. * The clients will call back to the server once they have done so, which * will tell this state to see if it is time for the server to register with * arbitration. */ function StartMatch() { if (bUsingArbitration) { StartArbitrationRegistration(); } else { Global.StartMatch(); } } /** * Kicks off the async tasks of having the clients register with * arbitration before the server does. Sets a timeout for when * all slow to respond clients get kicked */ function StartArbitrationRegistration() { local PlayerController PC; local UniqueNetId HostId; if (!bHasArbitratedHandshakeBegun) { // Tell PreLogin() to reject new connections bHasArbitratedHandshakeBegun = true; // Find the host's net id foreach LocalPlayerControllers(class'PlayerController', PC) { HostId = PC.PlayerReplicationInfo.UniqueId; break; } PendingArbitrationPCs.Length = 0; // Iterate the controller list and tell them to register with arbitration foreach WorldInfo.AllControllers(class'PlayerController', PC) { // Skip notifying local PCs as they are handled automatically if (!PC.IsLocalPlayerController()) { PC.ClientSetHostUniqueId(HostId); PC.ClientRegisterForArbitration(); // Add to the pending list PendingArbitrationPCs[PendingArbitrationPCs.Length] = PC; } else { // Add them as having completed arbitration ArbitrationPCs[ArbitrationPCs.Length] = PC; } } // Start the kick timer SetTimer(ArbitrationHandshakeTimeout,false,'ArbitrationTimeout'); } } /** * Does the registration for the server. This must be done last as it * includes all the players info from their registration */ function RegisterServerForArbitration() { if (GameInterface != None) { GameInterface.AddArbitrationRegistrationCompleteDelegate(ArbitrationRegistrationComplete); GameInterface.RegisterForArbitration(); } else { // Fake as working without subsystem ArbitrationRegistrationComplete(true); } } /** * Callback from the server that starts the match if the registration was * successful. If not, it goes back to the menu * * @param bWasSuccessful whether the registration worked or not */ function ArbitrationRegistrationComplete(bool bWasSuccessful) { // Clear the delegate so we don't leak with GC GameInterface.AddArbitrationRegistrationCompleteDelegate(ArbitrationRegistrationComplete); if (bWasSuccessful) { // Start the match StartArbitratedMatch(); } else { ConsoleCommand("Disconnect"); } } /** * Handles kicking any clients that haven't completed handshaking */ function ArbitrationTimeout() { local int Index; // Kick any pending players for (Index = 0; Index < PendingArbitrationPCs.Length; Index++) { AccessControl.KickPlayer(PendingArbitrationPCs[Index],GameMessageClass.Default.MaxedOutMessage); } PendingArbitrationPCs.Length = 0; // Do the server registration now that any remaining clients are kicked RegisterServerForArbitration(); } function StartArbitratedMatch() { bNeedsEndGameHandshake = true; // Start the match Global.StartMatch(); } /** * Removes the player controller from the pending list. Kicks that PC if it * failed to register for arbitration. Starts the match if all clients have * completed their registration * * @param PC the player controller to mark as done * @param bWasSuccessful whether the PC was able to register for arbitration or not */ function ProcessClientRegistrationCompletion(PlayerController PC,bool bWasSuccessful) { local int FoundIndex; if (!bUsingArbitration) return; // Search for the specified PC and remove if found FoundIndex = PendingArbitrationPCs.Find(PC); if (FoundIndex != INDEX_NONE) { PendingArbitrationPCs.Remove(FoundIndex,1); if (bWasSuccessful) { // Add to the completed list ArbitrationPCs[ArbitrationPCs.Length] = PC; } else { AccessControl.KickPlayer(PC,GameMessageClass.Default.MaxedOutMessage); } } // Start the match if all clients have responded if (PendingArbitrationPCs.Length == 0) { // Clear the kick timer SetTimer(0,false,'ArbitrationTimeout'); RegisterServerForArbitration(); } } event EndState(name NextStateName) { // Clear the kick timer SetTimer(0,false,'ArbitrationTimeout'); if( GameInterface != None ) { GameInterface.ClearArbitrationRegistrationCompleteDelegate(ArbitrationRegistrationComplete); } } } /** * Iterates the arbitrated PCs list and tells them to write their end of * game data to arbitration */ function ProcessEndGameHandshake() { local int Index; bHasEndGameHandshakeBegun = true; // Iterate the controller list and tell them to register with arbitration for (Index = 0; Index < ArbitrationPCs.Length; Index++) { if (!ArbitrationPCs[Index].bDeleteMe) { // Tell the client to write stats out ArbitrationPCs[Index].ClientWriteArbitrationEndGameData(OnlineStatsWriteClass); // Add to the pending list PendingArbitrationPCs[PendingArbitrationPCs.Length] = ArbitrationPCs[Index]; } } // If we aren't waiting for any clients to process data, do our processing now if (PendingArbitrationPCs.Length == 0) { ServerWriteArbitrationEndGameData(); } else { SetTimer(5.0,false,'ServerWriteArbitrationEndGameData'); } } /** * Removes the specified client from the pending list and tells the game to * restart once all clients have notified * * @param PC the player controller that completed the write */ function ProcessClientDataWriteCompletion(PlayerController PC) { local int FoundIndex; if (!bUsingArbitration) return; // Search for the specified PC and remove if found FoundIndex = PendingArbitrationPCs.Find(PC); if (FoundIndex != INDEX_NONE) { PendingArbitrationPCs.Remove(FoundIndex,1); } // If all clients have responded, tell the server to write its data which // will then restart the game upon completion if (PendingArbitrationPCs.Length == 0) { ServerWriteArbitrationEndGameData(); } } /** * Commits arbitration data for the server and restarts the match */ function ServerWriteArbitrationEndGameData() { if (!bHasEndGameHandshakeBegun) return; SetTimer(0.0,false,'ServerWriteArbitrationEndGameData'); // Write all of the game stats WriteOnlineStats(); // Write out any player scoring data WriteOnlinePlayerScores(); // Now finalize the data before closing the session down if (GameInterface != None) { // Force the flush of the stats GameInterface.EndOnlineGame(); } // Clean up handshaking state bIsEndGameHandshakeComplete = true; PendingArbitrationPCs.Length = 0; ArbitrationPCs.Length = 0; // Start the next match RestartGame(); } /** * Tells all clients to disconnect and then goes to the menu */ function NotifyArbitratedMatchEnd() { local PlayerController PC; // Iterate through the controllers telling them to disconnect foreach WorldInfo.AllControllers(class'PlayerController',PC) { if (PC.IsLocalPlayerController() == false) { PC.ClientArbitratedMatchEnded(); } } // Iterate through local controllers telling them to disconnect foreach WorldInfo.AllControllers(class'PlayerController',PC) { if (PC.IsLocalPlayerController()) { PC.ClientArbitratedMatchEnded(); } } } /** * Used to notify the game type that it is ok to update a player's gameplay * specific muting information now. The playercontroller needs to notify * the server when it is possible to do so or the unique net id will be * incorrect and the muting not work. * * @param PC the playercontroller that is ready for updates */ function UpdateGameplayMuteList(PlayerController PC); /** * Used by the game type to update the advertised skill for this game */ function RecalculateSkillRating() { local int Index; local array<UniqueNetId> Players; local UniqueNetId ZeroId; if (WorldInfo.NetMode != NM_Standalone && OnlineSub != None && OnlineSub.GameInterface != None) { // Iterate through the players adding their unique id for skill calculation for (Index = 0; Index < GameReplicationInfo.PRIArray.Length; Index++) { if (ZeroId != GameReplicationInfo.PRIArray[Index].UniqueId) { Players[Players.Length] = GameReplicationInfo.PRIArray[Index].UniqueId; } } // Update the skill rating with the list of players OnlineSub.GameInterface.RecalculateSkillRating(Players); } } /** Called when this PC is in cinematic mode, and its matinee is cancelled by the user. */ event MatineeCancelled(); /** * Checks for the login parameters being passed on the command line. If * present, it does an async login before starting the dedicated server * registration process * * @return true if the login is in progress, false otherwise */ function bool ProcessServerLogin() { if (OnlineSub != None) { if (OnlineSub.PlayerInterface != None) { OnlineSub.PlayerInterface.AddLoginChangeDelegate(OnLoginChange); OnlineSub.PlayerInterface.AddLoginFailedDelegate(0,OnLoginFailed); OnlineSub.SystemInterface.AddConnectionStatusChangeDelegate(OnConnectionStatusChange); // Check the command line for login information and login async if (OnlineSub.PlayerInterface.AutoLogin() == false) { ClearAutoLoginDelegates(); return false; } return true; } } return false; } /** * Clears the login delegates once the login process has passed or failed */ function ClearAutoLoginDelegates() { if (OnlineSub.PlayerInterface != None) { OnlineSub.PlayerInterface.ClearLoginChangeDelegate(OnLoginChange); OnlineSub.PlayerInterface.ClearLoginFailedDelegate(0,OnLoginFailed); } } /** * Called if the autologin fails * * @param LocalUserNum the controller number of the associated user * @param ErrorCode the async error code that occurred */ function OnLoginFailed(byte LocalUserNum,EOnlineServerConnectionStatus ErrorCode) { ClearAutoLoginDelegates(); EnableAutoReconnect(); } /** * Used to tell the game when the autologin has completed */ function OnLoginChange() { ClearAutoLoginDelegates(); // The login has completed so start the dedicated server RegisterServer(); } /** * Registers the dedicated server with the online service */ function RegisterServer() { if (OnlineGameSettingsClass != None && OnlineSub != None && OnlineSub.GameInterface != None) { // Create the default settings to get the standard settings to advertise GameSettings = new OnlineGameSettingsClass; // Serialize any custom settings from the URL GameSettings.UpdateFromURL(ServerOptions, self); // Register the delegate so we can see when it's done OnlineSub.GameInterface.AddCreateOnlineGameCompleteDelegate(OnServerCreateComplete); // Now kick off the async publish if ( !OnlineSub.GameInterface.CreateOnlineGame(0,GameSettings) ) { OnlineSub.GameInterface.ClearCreateOnlineGameCompleteDelegate(OnServerCreateComplete); } } else if (!bDisableGamespyLogs) { WarnInternal("No game settings to register with the online service. Game won't be advertised"); } } /** * Notifies us of the game being registered successfully or not * * @param bWasSuccessful flag telling us whether it worked or not */ function OnServerCreateComplete(bool bWasSuccessful) { OnlineSub.GameInterface.ClearCreateOnlineGameCompleteDelegate(OnServerCreateComplete); if (bWasSuccessful == false) { /* if (GameSettings.bIsLanMatch == false) { `Warn("Failed to register game with online service. Registering as a LAN match"); // Force to be a LAN match GameSettings.bIsLanMatch = true; // Register the delegate so we can see when it's done OnlineSub.GameInterface.AddCreateOnlineGameCompleteDelegate(OnServerCreateComplete); // Now kick off the async publish if ( !OnlineSub.GameInterface.CreateOnlineGame(0,GameSettings) ) { OnlineSub.GameInterface.ClearCreateOnlineGameCompleteDelegate(OnServerCreateComplete); } } else { `Warn("Failed to register game with online service. Game won't be advertised"); } */ if (!bDisableGamespyLogs) LogInternal("Failed to register game with online service"); EnableAutoReconnect(); } else { UpdateGameSettings(); } } /** * Delegate fired when the online server connection state changes * * @param ConnectionStatus the new connection status */ function OnConnectionStatusChange(EOnlineServerConnectionStatus ConnectionStatus) { // Any error other than we are connected means destroy the game if (ConnectionStatus != OSCS_Connected && GameSettings != none) { // Set the destroy delegate so we can know when that is complete OnlineSub.GameInterface.AddDestroyOnlineGameCompleteDelegate(OnDestroyOnlineGameComplete); // Now we can destroy the game if (!bDisableGamespyLogs) LogInternal("GameInfo::OnConnectionStatusChange() - Destroying Online Game"); if ( !OnlineSub.GameInterface.DestroyOnlineGame() ) { OnDestroyOnlineGameComplete(true); } } } function OnDestroyOnlineGameComplete(bool bWasSuccessful) { if (!bDisableGamespyLogs) LogInternal("GameInfo::OnDestroyOnlineGameComplete() bWasSuccesful:"@bWasSuccessful); if (OnlineSub != None && OnlineSub.GameInterface != None) OnlineSub.GameInterface.ClearDestroyOnlineGameCompleteDelegate(OnDestroyOnlineGameComplete); //Clear the cache GameSettings = None; // Automatically reconnect in the event of an unwanted disconnect (this is ignored if the current game is over) EnableAutoReconnect(); } function EnableAutoReconnect() { if (WorldInfo.NetMode == NM_DedicatedServer && OnlineSub.CanAutoLogin()) SetTimer(30.0,, 'AttemptReconnect'); } function AttemptReconnect() { local ELoginStatus LoginStatus; if (WorldInfo.NetMode != NM_DedicatedServer || OnlineSub == none || OnlineSub.PlayerInterface == none || bGameEnded) return; LoginStatus = OnlineSub.PlayerInterface.GetLoginStatus(0); if (LoginStatus == LS_UsingLocalProfile) return; // Log messages are delayed in order to prevent log spam if (WorldInfo.RealTimeSeconds > LastAutoReconnectMessageTime) { LastAutoReconnectMessageTime = WorldInfo.RealTimeSeconds + 300; LogInternal("Attempting to re-register the game with the online service"); } else { bDisableGamespyLogs = True; } // First check that the server is logged in to Gamespy, and attempt to autologin if not; otherwise, attempt to directly register the server if (LoginStatus == LS_NotLoggedIn) ProcessServerLogin(); else RegisterServer(); SetTimer(5.0,, 'ResetLog'); } function ResetLog() { bDisableGamespyLogs = False; } defaultproperties { bRestartLevel=True bPauseable=True bDelayedStart=True bChangeLevels=True TimeToWaitForHashKey=45.000000 GameDifficulty=1.000000 GameSpeed=1.000000 HUDType=Class'Engine.HUD' MaxSpectators=2 MaxSpectatorsAllowed=32 MaxPlayers=32 MaxPlayersAllowed=32 CurrentID=1 DefaultPlayerName="Player" GameName="Game" FearCostFallOff=0.950000 DeathMessageClass=Class'Engine.LocalMessage' GameMessageClass=Class'Engine.GameMessage' AccessControlClass=Class'Engine.AccessControl' BroadcastHandlerClass=Class'Engine.BroadcastHandler' PlayerControllerClass=Class'Engine.PlayerController' PlayerReplicationInfoClass=Class'Engine.PlayerReplicationInfo' GameReplicationInfoClass=Class'Engine.GameReplicationInfo' TimeMarginSlack=1.350000 MinTimeMargin=-1.000000 TotalNetBandwidth=32000 MinDynamicBandwidth=4000 MaxDynamicBandwidth=7000 MaxChildConnections=1 CollisionType=COLLIDE_CustomDefault Name="Default__GameInfo" ObjectArchetype=Info'Engine.Default__Info' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |