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 |
// ============================================================================ // Jailbreak // Copyright 2002 by Mychaeel <mychaeel@planetjailbreak.com> // $Id: Jailbreak.uc,v 1.160 2012-12-06 21:14:05 wormbo Exp $ // // Jailbreak game type. // ============================================================================ class Jailbreak extends xTeamGame notplaceable; // ============================================================================ // Properties // ============================================================================ var() const editconst string Build; // ============================================================================ // Configuration // ============================================================================ var config string Addons; var config bool bEnableJailFights; var config bool bEnableScreens; var config bool bEnableSpectatorDeathCam; var config bool bFavorHumansForArena; var config bool bJailNewcomers; var config bool bDisallowEscaping; var config bool bReverseSwitchColors; var config bool bEnableJBMapFixes; var config bool bNoJailKill; var config bool bUseLevelRecommendedMinPlayers; var config bool bEnableWebScoreboard; var config bool bEnableWebAdminExtension; var config string WebScoreboardClass; var config string WebScoreboardPath; // ============================================================================ // Localization // ============================================================================ var(LoadingHints) localized array<string> TextHintJailbreak; var localized string TextDescriptionEnableJailFights; var localized string TextDescriptionFavorHumansForArena; var localized string TextDescriptionJailNewcomers; var localized string TextDescriptionDisallowEscaping; var localized string TextDescriptionEnableJBMapFixes; var localized string TextDescriptionNoJailKill; var localized string TextDescriptionUseLevelRecommendedMinPlayers; var localized string TextWebAdminEnableJailFights; var localized string TextWebAdminFavorHumansForArena; var localized string TextWebAdminJailNewcomers; var localized string TextWebAdminDisallowEscaping; var localized string TextWebAdminEnableJBMapFixes; var localized string TextWebAdminNoJailKill; var localized string TextWebAdminUseLevelRecommendedMinPlayers; var localized string TextWebAdminPrefixAddon; // ============================================================================ // Properties // ============================================================================ var(LoadingScreens) array<string> LoadingScreens; // ============================================================================ // Variables // ============================================================================ var private JBTagPlayer firstTagPlayerInactive; // disconnected player chain var private float TimeExecution; // time for pending execution var private float TimeRestart; // time for pending round restart var private JBInfoJail JailExecution; // jail viewed during execution var private float TimeEventFired; // time of last fired singular event var private array<name> ListEventFired; // singular events fired this tick var private float TimeReleaseMessagePlayed[2]; // time of last played release message var private float DilationTimePrev; // last synchronized time dilation var transient CacheManager.MutatorRecord MutatorRecord; // for web admin hack var private transient JBTagPlayer TagPlayerRestart; // player being restarted var private bool bGiveTrans; var bool bArenaMutatorActive; // add a shieldgun to a prisoner's inventory // ============================================================================ // InitGame // // Initializes the game and interprets Jailbreak-specific parameters. Load // JBToolbox2 and apply the MapFixes if wanted. // ============================================================================ event InitGame(string Options, out string Error) { local int iCharSeparator; local string OptionAddon; local string OptionJailFights; local string OptionFavorHumansForArena; local string OptionJailNewcomers; local string OptionDisallowEscaping; local string OptionEnableJBMapFixes; local string OptionNoJailKill; local string NameAddon; Super.InitGame(Options, Error); if (bUseLevelRecommendedMinPlayers && (Level.NetMode == NM_DedicatedServer || Level.NetMode == NM_ListenServer) && (BotMode & 12) == 4) { // force at least the minimum recommended player count, but without exceeding the maximum player count MinPlayers = Min(Max(MinPlayers, Level.IdealPlayerCountMin), MaxPlayers); } // Due to mapvote replacing ',' with '?' in the options, // the ?addon=... parameter also accepts '!' as separator. if (HasOption(Options, "Addon")) OptionAddon = Repl(ParseOption(Options, "Addon"), "!", ","); else OptionAddon = Addons; while (OptionAddon != "") { iCharSeparator = InStr(OptionAddon, ","); if (iCharSeparator < 0) iCharSeparator = Len(OptionAddon); NameAddon = Left(OptionAddon, iCharSeparator); OptionAddon = Mid(OptionAddon, iCharSeparator + 1); // To save space in the URL, add-on names don't need to be // fully qualified, if their class and package name are identical. if (InStr(NameAddon, ".") == -1) NameAddon $= "." $ NameAddon; Log("Add Jailbreak add-on" @ NameAddon); AddMutator(NameAddon, True); } OptionJailFights = ParseOption(Options, "JailFights"); if (OptionJailFights != "") bEnableJailFights = bool(OptionJailFights); OptionFavorHumansForArena = ParseOption(Options, "FavorHumansForArena"); if (OptionFavorHumansForArena != "") bFavorHumansForArena = bool(OptionFavorHumansForArena); OptionJailNewcomers = ParseOption(Options, "JailNewcomers"); if (OptionJailNewcomers != "") bJailNewcomers = bool(OptionJailNewcomers); OptionDisallowEscaping = ParseOption(Options, "DisallowEscaping"); if (OptionDisallowEscaping != "") bDisallowEscaping = bool(OptionDisallowEscaping); OptionEnableJBMapFixes = ParseOption(Options, "EnableJBMapFixes"); if (OptionEnableJBMapFixes != "") bDisallowEscaping = bool(OptionEnableJBMapFixes); OptionNoJailKill = ParseOption(Options, "NoJailKill"); if (OptionNoJailKill != "") bNoJailKill = bool(OptionNoJailKill); bForceRespawn = True; bTeamScoreRounds = False; MaxLives = 0; // Make sure this is available all the time, // because it's required for the login menu and map fixes. AddToPackageMap("JBToolbox2"); // Spawn our map fixing info object. if (bEnableJBMapFixes) Spawn(class<Actor>(DynamicLoadObject("JBToolbox2.JBGameRulesMapFixes", class'Class'))); } // ============================================================================ // AddMutator // // Loads and adds a mutator to the mutator list. Works like its inherited // version, but checks whether the given mutator is loaded already first; by // doing that it never happens that any of the default add-ons are loaded // several times. // ============================================================================ function AddMutator(string NameMutator, optional bool bUserAdded) { local Mutator thisMutator; for (thisMutator = BaseMutator; thisMutator != None; thisMutator = thisMutator.NextMutator) if (string(thisMutator.Class) ~= NameMutator) return; Super.AddMutator(NameMutator, bUserAdded); } // ============================================================================ // WantsPickups // // Prevents bots from trying to pick up inventory when they're jailfighting. // ============================================================================ function bool WantsPickups(Bot Bot) { return !class'JBBotSquadJail'.static.IsPlayerFighting(Bot); } // ============================================================================ // GetLoadingHint // // Used to hook into the loading screen. Replaces the image there by one of // our own loading images. Tries to use the image matching the loaded map. If // the loaded map contains a MyLevel texture named LoadingScreen, uses that. // ============================================================================ static function string GetLoadingHint(PlayerController PlayerController, string MapName, Color ColorHint) { local int iLoadingScreen; local string NameLoadingScreen; local Material MaterialLoadingScreen; local UT2K4ServerLoading UT2K4ServerLoading; // look for full map name match for (iLoadingScreen = 0; iLoadingScreen < Default.LoadingScreens.Length; iLoadingScreen++) { NameLoadingScreen = GetItemName(Default.LoadingScreens[iLoadingScreen]); if (NameLoadingScreen ~= Mid(MapName, 3) || (NameLoadingScreen $ "-Gold") ~= Mid(MapName, 3)) { MaterialLoadingScreen = Material(DynamicLoadObject(Default.LoadingScreens[iLoadingScreen], Class'Material', False)); break; } } // otherwise look for embedded loading screen if (MaterialLoadingScreen == None) MaterialLoadingScreen = Material(DynamicLoadObject(MapName $ ".LoadingScreen", Class'Material', True)); // otherwise load random loading screen if (MaterialLoadingScreen == None) { iLoadingScreen = Rand(Default.LoadingScreens.Length); MaterialLoadingScreen = Material(DynamicLoadObject(Default.LoadingScreens[iLoadingScreen], Class'Material', False)); } if (Texture(MaterialLoadingScreen) != None) Texture(MaterialLoadingScreen).LODSet = LODSET_Interface; foreach PlayerController.AllObjects(Class'UT2K4ServerLoading', UT2K4ServerLoading) DrawOpImage(UT2K4ServerLoading.Operations[0]).Image = MaterialLoadingScreen; return Super.GetLoadingHint(PlayerController, MapName, ColorHint); } // ============================================================================ // GetAllLoadHints // // Returns hints for this game type. // ============================================================================ static function array<string> GetAllLoadHints(optional bool bThisClassOnly) { local int iHint; local array<string> Hints; if (!bThisClassOnly || Default.TextHintJailbreak.Length == 0) Hints = Super.GetAllLoadHints(); for (iHint = 0; iHint < Default.TextHintJailbreak.Length; iHint++) Hints[Hints.Length] = Default.TextHintJailbreak[iHint]; return Hints; } // ============================================================================ // FillPlayInfo // // Returns at once without adding anything to the PlayInfo if called from the // server browser as a workaround for people not being able to join games from // other game types after selecting Jailbreak because the Jailbreak package is // still loaded. Otherwise, adds Jailbreak-specific settings to the PlayInfo. // ============================================================================ static function FillPlayInfo(PlayInfo PlayInfo) { local UT2K4ServerBrowser UT2K4ServerBrowser; foreach Default.Class.AllObjects(Class'UT2K4ServerBrowser', UT2K4ServerBrowser) if (UT2K4ServerBrowser.FilterInfo == PlayInfo) return; // ignore because called from server browser Super.FillPlayInfo(PlayInfo); PlayInfo.AddSetting(default.GameName, "bEnableJailFights", default.TextWebAdminEnableJailFights, 0, 60, "Check"); PlayInfo.AddSetting(default.GameName, "bFavorHumansForArena", default.TextWebAdminFavorHumansForArena, 0, 60, "Check"); PlayInfo.AddSetting(default.GameName, "bJailNewcomers", default.TextWebAdminJailNewcomers, 0, 60, "Check"); PlayInfo.AddSetting(default.GameName, "bDisallowEscaping", default.TextWebAdminDisallowEscaping, 0, 60, "Check"); PlayInfo.AddSetting(default.GameName, "bEnableJBMapFixes", default.TextWebAdminEnableJBMapFixes, 0, 60, "Check"); PlayInfo.AddSetting(default.GameName, "bNoJailKill", default.TextWebAdminNoJailKill, 0, 60, "Check"); PlayInfo.AddSetting(default.GameName, "bUseLevelRecommendedMinPlayers", default.TextWebAdminUseLevelRecommendedMinPlayers, 0, 60, "Check",,, True); // multiplayer only! } // ============================================================================ // GetDescriptionText // // Returns hints for Jailbreak options. Also hooks the Add-Ons tab into the // menu system. // ============================================================================ static event string GetDescriptionText(string Property) { Class'JBGUIHook'.Static.Hook(); if (Property ~= "bEnableJailFights") return Default.TextDescriptionEnableJailFights; if (Property ~= "bFavorHumansForArena") return Default.TextDescriptionFavorHumansForArena; if (Property ~= "bJailNewcomers") return default.TextDescriptionJailNewcomers; if (Property ~= "bDisallowEscaping") return default.TextDescriptionDisallowEscaping; if (Property ~= "bEnableJBMapFixes") return default.TextDescriptionEnableJBMapFixes; if (Property ~= "bNoJailKill") return default.TextDescriptionNoJailKill; if (Property ~= "bUseLevelRecommendedMinPlayers") return default.TextDescriptionUseLevelRecommendedMinPlayers; return Super.GetDescriptionText(Property); } // ============================================================================ // GetServerDetails // // Adds the Jailbreak build number and web scoreboard URL to server details. // ============================================================================ function GetServerDetails(out ServerResponseLine ServerState) { local int iServerInfo; local string WebScoreboardAddress; local WebApplication WebApplicationScoreboard; Super.GetServerDetails(ServerState); iServerInfo = ServerState.ServerInfo.Length; ServerState.ServerInfo.Insert(iServerInfo, 1); ServerState.ServerInfo[iServerInfo].Key = "Build"; ServerState.ServerInfo[iServerInfo].Value = Build; foreach AllObjects(Class'WebApplication', WebApplicationScoreboard) if (string(WebApplicationScoreboard.Class) ~= WebScoreboardClass) break; if (WebApplicationScoreboard != None) { WebScoreboardAddress = Mid(WebApplicationScoreboard.WebServer.ServerURL, 7); if (Right(WebScoreboardAddress, 3) == ":80") WebScoreboardAddress = Left(WebScoreboardAddress, Len(WebScoreboardAddress) - 3); WebScoreboardAddress = WebScoreboardAddress $ WebScoreboardPath; iServerInfo = ServerState.ServerInfo.Length; ServerState.ServerInfo.Insert(iServerInfo, 1); ServerState.ServerInfo[iServerInfo].Key = "WebScoreboard"; ServerState.ServerInfo[iServerInfo].Value = WebScoreboardAddress; } } // ============================================================================ // AcceptPlayInfoProperty // // Hides several properties from the web admin interface that don't apply for // Jailbreak games. // ============================================================================ static event bool AcceptPlayInfoProperty(string Property) { if (Property ~= "MaxLives" || Property ~= "bForceRespawn" || Property ~= "bTeamScoreRounds") return False; return Super.AcceptPlayInfoProperty(Property); } // ============================================================================ // ReadAddonsForWebAdmin // // Reads the list of Jailbreak Add-Ons and adds them to the mutators list of // the web admin interface. // ============================================================================ function ReadAddonsForWebAdmin() { local int iClassAddon; local int iInfoAddon; local string NameClassAddon; local Class<JBAddon> ClassAddon; local Mutator thisMutator; local UTServerAdmin UTServerAdmin; if (!bEnableWebAdminExtension) return; foreach AllObjects(Class'UTServerAdmin', UTServerAdmin) break; if (UTServerAdmin == None) return; // web admin not running while (True) { NameClassAddon = GetNextInt("JBAddon", iClassAddon++); if (NameClassAddon == "") break; ClassAddon = Class<JBAddon>(DynamicLoadObject(NameClassAddon, Class'Class', True)); if (ClassAddon == None || ClassAddon.Default.FriendlyName == Class'JBAddon'.Default.FriendlyName) continue; // workaround for the MutatorRecord struct members being marked constant SetPropertyText("MutatorRecord", "(" $ "ClassName" $ "=\"" $ NameClassAddon $ "\"," $ "FriendlyName" $ "=\"" $ TextWebAdminPrefixAddon @ ClassAddon.Default.FriendlyName $ "\"," $ "Description" $ "=\"" $ ClassAddon.Default.Description $ "\"," $ "GroupName" $ "=\"" $ ClassAddon.Default.GroupName $ "\")"); iInfoAddon = UTServerAdmin.AllMutators.Length; UTServerAdmin.AllMutators[iInfoAddon] = MutatorRecord; for (thisMutator = BaseMutator; thisMutator != None; thisMutator = thisMutator.NextMutator) if (thisMutator.bUserAdded && thisMutator.Class == ClassAddon) UTServerAdmin.AIncMutators.Add(string(iInfoAddon), MutatorRecord.FriendlyName); UTServerAdmin.AExcMutators.Add(string(iInfoAddon), MutatorRecord.ClassName); } // reinitialize webadmin PlayInfo for default options query handler UTServerAdmin.SetGamePI(""); } // ============================================================================ // SetupWebScoreboard // // Sets up the Jailbreak Web Scoreboard if the web server is running. // ============================================================================ function SetupWebScoreboard() { local int iWebApplication; local WebServer WebServer; local WebApplication WebApplicationScoreboard; local Class<WebApplication> ClassWebApplicationScoreboard; if (!bEnableWebScoreboard) return; foreach DynamicActors(Class'WebServer', WebServer) break; if (WebServer == None) return; // web server not running for (iWebApplication = 0; iWebApplication < ArrayCount(WebServer.ApplicationObjects); iWebApplication++) if (WebServer.ApplicationObjects[iWebApplication] == None) break; if (iWebApplication >= ArrayCount(WebServer.ApplicationObjects)) return; // no empty application slot found ClassWebApplicationScoreboard = Class<WebApplication>(DynamicLoadObject(WebScoreboardClass, Class'Class', True)); if (ClassWebApplicationScoreboard == None) return; WebApplicationScoreboard = new(None) ClassWebApplicationScoreboard; WebApplicationScoreboard.Level = Level; WebApplicationScoreboard.WebServer = WebServer; WebApplicationScoreboard.Path = WebScoreboardPath; WebApplicationScoreboard.Init(); WebServer.ApplicationObjects[iWebApplication] = WebApplicationScoreboard; WebServer.ApplicationPaths [iWebApplication] = WebScoreboardPath; } // ============================================================================ // PostBeginPlay // // Sets our own version of LoginMenuClass if the original is still used. // Spawns JBTagTeam actors for both teams. Reads the add-on list for the web // admin interface. Sets up the Jailbreak Web Scoreboard. Spawns JBMapFixes. // Calls InitAddon for all already registered add-ons. // ============================================================================ event PostBeginPlay() { local Mutator thisMutator; Super.PostBeginPlay(); if (LoginMenuClass == class'TeamGame'.default.LoginMenuClass) ResetConfig("LoginMenuClass"); Class'JBTagTeam'.Static.SpawnFor(Teams[0]); Class'JBTagTeam'.Static.SpawnFor(Teams[1]); ReadAddonsForWebAdmin(); SetupWebScoreboard(); for (thisMutator = BaseMutator; thisMutator != None; thisMutator = thisMutator.NextMutator) if (JBAddon(thisMutator) != None) JBAddon(thisMutator).InitAddon(); } // ============================================================================ // PostLogin // // Spawns a JBTagClient actor for every new client and registers new players. // This must happen in PostLogin rather than implicitly by ChangeTeam since // GetPlayerIDHash does not return the correct value prior to PostLogin. // ============================================================================ event PostLogin(PlayerController PlayerControllerLogin) { Class'JBTagClient'.Static.SpawnFor(PlayerControllerLogin); if (PlayerControllerLogin.PlayerReplicationInfo.Team != None) RegisterPlayer(PlayerControllerLogin); Super.PostLogin(PlayerControllerLogin); } // ============================================================================ // RegisterPlayer // // Registers the given player for active gameplay. Called whenever a player // joins or switches teams or when a bot is spawned. Note that this function // will be called more than once during the lifetime of a player. // ============================================================================ function RegisterPlayer(Controller Controller) { local JBTagPlayer thisTagPlayer; local JBTagPlayer TagPlayerRegistering; if ( PlayerController(Controller) != None && Class'JBTagClient'.Static.FindFor(PlayerController(Controller)) == None) return; // player login not finished yet, waiting for PostLogin if (Class'JBTagPlayer'.Static.FindFor(Controller.PlayerReplicationInfo) != None) return; // has been registered before already if (Controller != None && Controller.PlayerReplicationInfo != None && Controller.PlayerReplicationInfo.Team != None) { for (thisTagPlayer = firstTagPlayerInactive; thisTagPlayer != None; thisTagPlayer = thisTagPlayer.nextTag) if (thisTagPlayer.BelongsTo(Controller)) break; if (thisTagPlayer != None) { TagPlayerRegistering = thisTagPlayer; if (firstTagPlayerInactive == TagPlayerRegistering) firstTagPlayerInactive = firstTagPlayerInactive.nextTag; else for (thisTagPlayer = firstTagPlayerInactive; thisTagPlayer.nextTag != None; thisTagPlayer = thisTagPlayer.nextTag) if (thisTagPlayer.nextTag == TagPlayerRegistering) thisTagPlayer.nextTag = TagPlayerRegistering.nextTag; TagPlayerRegistering.SetOwner(Controller.PlayerReplicationInfo); TagPlayerRegistering.Register(); } else { Class'JBTagPlayer'.Static.SpawnFor(Controller.PlayerReplicationInfo); } } } // ============================================================================ // UnregisterPlayer // // Unregisters the given player from active gameplay; called both when leaving // the game or switching to spectator mode. // ============================================================================ function UnregisterPlayer(Controller Controller) { local JBTagPlayer TagPlayerUnregistering; if (Controller.PlayerReplicationInfo != None) ReAssessTeam(Controller.PlayerReplicationInfo.Team); if (PlayerController(Controller) != None) { TagPlayerUnregistering = Class'JBTagPlayer'.Static.FindFor(Controller.PlayerReplicationInfo); if (TagPlayerUnregistering != None) { TagPlayerUnregistering.Unregister(); TagPlayerUnregistering.nextTag = firstTagPlayerInactive; firstTagPlayerInactive = TagPlayerUnregistering; } } else { Class'JBTagPlayer'.Static.DestroyFor(Controller.PlayerReplicationInfo); } } // ============================================================================ // NeedPlayers // // Adds a bot when teams are not balanced even if the total number of players // currently exceeds the minimum number normally filled up by bots. // ============================================================================ function bool NeedPlayers() { if (Super.NeedPlayers()) return True; if (!bBalanceTeams || NumBots > 0 || NumPlayers <= 1 || NumPlayers % 2 == 0) return False; return (Abs(CountPlayersTotal(Teams[0]) - CountPlayersTotal(Teams[1])) == 1); } // ============================================================================ // TooManyBots // // Does not remove the last bot if teams are currently balanced. // ============================================================================ function bool TooManyBots(Controller BotToRemove) { if (Super.TooManyBots(BotToRemove)) if (!bBalanceTeams || NumBots > 1) return True; else return (CountPlayersTotal(Teams[0]) != CountPlayersTotal(Teams[1])); return False; } // ============================================================================ // SpawnBot // // Registers every bot as an active player and fills the OrderNames slots used // for the custom team tactics submenu of the speech menu. // ============================================================================ function Bot SpawnBot(optional string NameBot) { local int iOrderNameTactics; local Bot BotSpawned; local JBGameReplicationInfo InfoGame; BotSpawned = Super.SpawnBot(NameBot); if (BotSpawned == None) return None; RegisterPlayer(BotSpawned); InfoGame = JBGameReplicationInfo(GameReplicationInfo); for (iOrderNameTactics = 0; iOrderNameTactics < ArrayCount(InfoGame.OrderNameTactics); iOrderNameTactics++) BotSpawned.OrderNames[InfoGame.OrderNameTactics[iOrderNameTactics].iOrderName] = InfoGame.OrderNameTactics[iOrderNameTactics].OrderName; return BotSpawned; } // ============================================================================ // InitPlacedBot // // Only gives actual bots a team, as opposed to other scripted controllers. // ============================================================================ function InitPlacedBot(Controller Controller, RosterEntry RosterEntry) { if (Bot(Controller) != None) Super.InitPlacedBot(Controller, RosterEntry); } // ============================================================================ // AllowBecomeActivePlayer // // Disallows the transition from spectator to active player at any time except // before and during active gameplay. // ============================================================================ function bool AllowBecomeActivePlayer(PlayerController PlayerController) { if (!IsInState('PendingMatch') && !IsInState('MatchInProgress')) return False; return Super.AllowBecomeActivePlayer(PlayerController); } // ============================================================================ // BecomeSpectator // // Unregisters the given player when they switch to spectator mode. Disallows // this transition at any time except before and during active gameplay. // ============================================================================ function bool BecomeSpectator(PlayerController PlayerController) { if (!IsInState('PendingMatch') && !IsInState('MatchInProgress')) { PlayerController.ReceiveLocalizedMessage(GameMessageClass, 12); return False; } if (!Super.BecomeSpectator(PlayerController)) return False; UnregisterPlayer(PlayerController); return True; } // ============================================================================ // ChangeTeam // // Changes the given player's team. Reassesses both teams involved in the // change if it is successful. // ============================================================================ function bool ChangeTeam(Controller Controller, int iTeam, bool bNewTeam) { local TeamInfo TeamBefore; if (Controller.PlayerReplicationInfo != None) TeamBefore = Controller.PlayerReplicationInfo.Team; if (Super.ChangeTeam(Controller, iTeam, bNewTeam)) { RegisterPlayer(Controller); ReAssessTeam(TeamBefore); ReAssessTeam(Controller.PlayerReplicationInfo.Team); return True; } return False; } // ============================================================================ // ReAssessTeam // // If all members of the given team are bots, sets its team tactics to auto. // ============================================================================ function ReAssessTeam(TeamInfo Team) { local Controller thisController; if (Team == None) return; for (thisController = Level.ControllerList; thisController != None; thisController = thisController.NextController) if (PlayerController(thisController) != None && thisController.PlayerReplicationInfo != None && thisController.PlayerReplicationInfo.Team == Team) return; JBBotTeam(UnrealTeamInfo(Team).AI).SetTactics('Auto'); } // ============================================================================ // SpawnWait // // Don't wait too long to respawn bots in jail if there are many bots. // ============================================================================ function float SpawnWait(AIController B) { if (B.PlayerReplicationInfo.bOutOfLives) return 999; return FRand() * Sqrt(NumBots); } // ============================================================================ // Logout // // Unregisters the exiting player from active gameplay and removes their // JBTagClient actor if a human player is exiting the game. // ============================================================================ function Logout(Controller ControllerExiting) { UnregisterPlayer(ControllerExiting); if (PlayerController(ControllerExiting) != None) Class'JBTagClient'.Static.DestroyFor(PlayerController(ControllerExiting)); Super.Logout(ControllerExiting); } // ============================================================================ // GetDefenderNum // // Hack fix to make VehicleTeam work in ASVehicleFactory. The other actors // which use GetDefenderTeam still work too. // ============================================================================ function int GetDefenderNum() { return 1; } // ============================================================================ // GetFirstJBGameRules // // Finds the first JBGameRules actor in the GameRules chain. Returns None if // none is found. // ============================================================================ function JBGameRules GetFirstJBGameRules() { local GameRules thisGameRules; for (thisGameRules = GameRulesModifiers; thisGameRules != None; thisGameRules = thisGameRules.NextGameRules) if (JBGameRules(thisGameRules) != None) return JBGameRules(thisGameRules); return None; } // ============================================================================ // FindPlayerStart // // Finds out where the restarted player should be spawned at and communicates // it to the RatePlayerStart function. // ============================================================================ function NavigationPoint FindPlayerStart(Controller Controller, optional byte iTeam, optional string Teleporter) { if (Controller == None) TagPlayerRestart = None; else TagPlayerRestart = Class'JBTagPlayer'.Static.FindFor(Controller.PlayerReplicationInfo); return Super.FindPlayerStart(Controller, iTeam, Teleporter); } // ============================================================================ // RatePlayerStart // // Returns a negative value for all starts that are inappropriate for the // given player's scheduled respawn area. Take Priority in account for jails. // ============================================================================ function float RatePlayerStart(NavigationPoint NavigationPoint, byte iTeam, Controller Controller) { local JBInfoJail Jail; local bool bContainedInJail; bContainedInJail = ContainsActorJail(NavigationPoint, Jail); if (TagPlayerRestart == None) { if (bContainedInJail || ContainsActorArena(NavigationPoint)) return -20000000; // prefer spawn-fragging over jail or arena else return Super.RatePlayerStart(NavigationPoint, iTeam, Controller); } if (TagPlayerRestart.IsStartValid(NavigationPoint)) { if (TagPlayerRestart.IsStartPreferred(NavigationPoint)) return InternalRatePlayerStart(NavigationPoint, iTeam, Controller) + 10000000; // Prefer jails with a lower priority above those with a higher one. if (Jail != None) return InternalRatePlayerStart(NavigationPoint, iTeam, Controller) + Jail.RateJail(); return InternalRatePlayerStart(NavigationPoint, iTeam, Controller); } return -20000000; // prefer spawn-fragging over inappropriate start spots } // ============================================================================ // InternalRatePlayerStart // // Reimplementation of TeamGame's and DeathMatch's RatePlayerStart, that only // reduces the rating of a spawn spot if nearby players are opponents. // Additionally it also allows other navigation points as alternative spawn // locations, if there's a PlayerStart of the corresponding team nearby. // Assumes TagPlayerRestart being valid. // ============================================================================ function float InternalRatePlayerStart(NavigationPoint N, byte Team, Controller Player) { local PlayerStart P, O; local float Score, NextDist, BestDist; local Controller OtherPlayer; local GameObjective thisObjective; if (Player != None) Team = Player.GetTeamNum(); Score = 3000 * FRand(); //randomize P = PlayerStart(N); if (P == None) { Score -= 2000000; // find nearby PlayerStart only for selected types of navigation points if (N.IsA('PathNode') && !N.IsA('HoverPathNode') && !N.IsA('FlyingPathNode') || N.IsA('JumpDest') && !N.IsA('GameObjective') || N.IsA('AssaultPath') || N.IsA('LiftExit') || N.IsA('AIMarker') || N.IsA('InventorySpot')) { foreach RadiusActors(class'PlayerStart', O, 1000, N.Location) { NextDist = VSize(O.Location - N.Location); if (O.TeamNumber == Team) Score -= 100 * Sqrt(VSize(N.Location - O.Location)); else Score += 100 * Sqrt(VSize(N.Location - O.Location)); if ((P == None || BestDist > NextDist) && TagPlayerRestart.IsStartValid(O)) { P = O; BestDist = NextDist; } } if (P != None && !ContainsActorJail(N)) { for (thisObjective = Teams[0].AI.Objectives; thisObjective != None; thisObjective = thisObjective.nextObjective) { if (thisObjective.DefenderTeamIndex == Team) Score -= 1000 * Sqrt(VSize(N.Location - thisObjective.Location)); else Score += 1000 * Sqrt(VSize(N.Location - thisObjective.Location)); } } if (InventorySpot(N) != None && InventorySpot(N).markedItem != None && !InventorySpot(N).markedItem.IsInState('Disabled')) Score -= 1000000; } } if (P == None || !P.bEnabled || N.PhysicsVolume.bWaterVolume) return Score-10000000; if (bSpawnInTeamArea && Team != P.TeamNumber) return Score-9000000; //assess candidate if (P.bPrimaryStart) Score += 10000000; else Score += 5000000; if (N == LastStartSpot || N == LastPlayerStartSpot) Score -= 10000.0; for (OtherPlayer = Level.ControllerList; OtherPlayer != None; OtherPlayer = OtherPlayer.NextController) { if (OtherPlayer.bIsPlayer && OtherPlayer.Pawn != None) { if (OtherPlayer.Pawn.Region.Zone == N.Region.Zone) Score -= 1500; NextDist = VSize(OtherPlayer.Pawn.Location - N.Location); if (NextDist < OtherPlayer.Pawn.CollisionRadius + OtherPlayer.Pawn.CollisionHeight) return -10000.0; else if (NextDist < 3000 && FastTrace(N.Location, OtherPlayer.Pawn.Location)) Score -= (10000.0 - NextDist); else if (NumPlayers + NumBots == 2) { Score += 2 * VSize(OtherPlayer.Pawn.Location - N.Location); if (FastTrace(N.Location, OtherPlayer.Pawn.Location)) Score -= 10000; } } } return FMax(Score, 5); } // ============================================================================ // SetPlayerDefaults // // Removes spawn protection for arena players. // ============================================================================ function SetPlayerDefaults(Pawn PawnPlayer) { local JBTagPlayer TagPlayer; TagPlayer = Class'JBTagPlayer'.Static.FindFor(PawnPlayer.PlayerReplicationInfo); if (TagPlayer != None && TagPlayer.GetArenaPending() != None) PawnPlayer.DeactivateSpawnProtection(); Super.SetPlayerDefaults(PawnPlayer); } // ============================================================================ // AddGameSpecificInventory // // Adds game-specific inventory. Skips the translocator if the player has // restarted in jail. Note that this does not apply when the player has died // in freedom and has just respawned in jail for the first time; this case is // handled by JBTagPlayer.NotifyJailEntered. // ============================================================================ function AddGameSpecificInventory(Pawn PawnPlayer) { local JBTagPlayer TagPlayer; TagPlayer = Class'JBTagPlayer'.Static.FindFor(PawnPlayer.PlayerReplicationInfo); bGiveTrans = TagPlayer == None || !TagPlayer.IsInJail(); Super.AddGameSpecificInventory(PawnPlayer); } // ============================================================================ // AllowTransloc // // Returns False if the translocator shouldn't be given to the player. // ============================================================================ function bool AllowTransloc() { return bGiveTrans && Super.AllowTransloc(); } // ============================================================================ // PickupQuery // // Prevents arena combatants from picking up adrenaline. // ============================================================================ function bool PickupQuery(Pawn PawnPlayer, Pickup Pickup) { local JBTagPlayer TagPlayer; if (AdrenalinePickup(Pickup) != None) { TagPlayer = Class'JBTagPlayer'.Static.FindFor(PawnPlayer.PlayerReplicationInfo); if (TagPlayer != None && TagPlayer.IsInArena()) return False; } return Super.PickupQuery(PawnPlayer, Pickup); } // ============================================================================ // ReduceDamage // // Applies several rules on who may inflict damage on whom: // // * Players in an arena cannot be damaged by anyone except themselves and // their opponents. // // * Players in jail can damage anybody, but not players in the same jail // unless they both are currently engaged in a jail fight. In that case // they get full damage regardless of current friendly fire settings. // // ============================================================================ function int ReduceDamage(int Damage, Pawn PawnVictim, Pawn PawnInstigator, vector LocationHit, out vector MomentumHit, Class<DamageType> ClassDamageType) { local JBTagPlayer TagPlayerInstigator; local JBTagPlayer TagPlayerVictim; local xPawn xPawnVictim; // No instigator or himself. if (PawnInstigator == None || PawnInstigator.Controller == PawnVictim.Controller) return Super.ReduceDamage(Damage, PawnVictim, PawnInstigator, LocationHit, MomentumHit, ClassDamageType); TagPlayerInstigator = Class'JBTagPlayer'.Static.FindFor(PawnInstigator.PlayerReplicationInfo); TagPlayerVictim = Class'JBTagPlayer'.Static.FindFor(PawnVictim .PlayerReplicationInfo); // No tag found for the instigator or the victim. if (TagPlayerInstigator == None || TagPlayerVictim == None) return Super.ReduceDamage(Damage, PawnVictim, PawnInstigator, LocationHit, MomentumHit, ClassDamageType); // Arena players only receive damage from players from the same arena. if (TagPlayerVictim.GetArena() != TagPlayerInstigator.GetArena()) { MomentumHit = vect(0,0,0); return 0; } // Concerns jail fighting. if (TagPlayerVictim.IsInJail() && TagPlayerVictim.GetJail() == TagPlayerInstigator.GetJail() && !TagPlayerVictim.GetJail().IsReleaseActive(PawnVictim.PlayerReplicationInfo.Team)) if (bEnableJailFights && !PawnVictim.Controller.bGodMode && Class'JBBotSquadJail'.Static.IsPlayerFighting(TagPlayerInstigator.GetController(), True) && Class'JBBotSquadJail'.Static.IsPlayerFighting(TagPlayerVictim .GetController(), True)) return Damage; else { MomentumHit = vect(0,0,0); return 0; } // NoJailKill implementation - Nullify damage and momentum. if (Jailbreak(Level.Game).bNoJailKill && TagPlayerInstigator.IsInJail()) { MomentumHit = vect(0,0,0); // Visual feedback: the victim lights up. xPawnVictim = xPawn(PawnVictim); PawnVictim.PlaySound(Sound'WeaponSounds.BaseImpactAndExplosions.BShieldReflection', SLOT_Pain, TransientSoundVolume*2,, 400); switch (xPawnVictim.PlayerReplicationInfo.Team.TeamIndex) { case 0: xPawnVictim.SetOverlayMaterial(Shader'XGameShaders.PlayerShaders.PlayerTransRed', xPawnVictim.ShieldHitMatTime, False); break; case 1: xPawnVictim.SetOverlayMaterial(Shader'XGameShaders.PlayerShaders.PlayerTrans' , xPawnVictim.ShieldHitMatTime, False); break; } return 0; } return Super.ReduceDamage(Damage, PawnVictim, PawnInstigator, LocationHit, MomentumHit, ClassDamageType); } // ============================================================================ // PreventDeath // // Removes the killed player's weapon if the player was killed in jail or in // an arena fight. Prevents that the weapon is auto-tossed around. // ============================================================================ function bool PreventDeath(Pawn PawnVictim, Controller ControllerKiller, Class<DamageType> ClassDamageType, vector LocationHit) { local JBTagPlayer TagPlayerVictim; if (Super.PreventDeath(PawnVictim, ControllerKiller, ClassDamageType, LocationHit)) return True; TagPlayerVictim = Class'JBTagPlayer'.Static.FindFor(PawnVictim.PlayerReplicationInfo); if (TagPlayerVictim != None && !TagPlayerVictim.IsFree()) PawnVictim.Weapon = None; return False; } // ============================================================================ // Killed // // Sets the killed player's restart time with a short delay for effect. If the // victim was killed in jail, forwards further handling to a special function // instead of the default handling. // ============================================================================ function Killed(Controller ControllerKiller, Controller ControllerVictim, Pawn PawnVictim, Class<DamageType> ClassDamageType) { local JBTagPlayer TagPlayerVictim; if (ControllerVictim != None) TagPlayerVictim = Class'JBTagPlayer'.Static.FindFor(ControllerVictim.PlayerReplicationInfo); if (TagPlayerVictim != None && TagPlayerVictim.IsInJail()) { KilledInJail(ControllerKiller, ControllerVictim, PawnVictim, ClassDamageType); return; } if (TagPlayerVictim != None) TagPlayerVictim.TimeRestart = Level.TimeSeconds + 2.0; Super.Killed(ControllerKiller, ControllerVictim, PawnVictim, ClassDamageType); } // ============================================================================ // KilledInJail // // Called when a player is killed in jail. Unlike the normal Killed event, // skips all statistics and spree logging and does not award adrenaline. // ============================================================================ function KilledInJail(Controller ControllerKiller, Controller ControllerVictim, Pawn PawnVictim, Class<DamageType> ClassDamageType) { local bool bEnemyKill; if (ControllerKiller != None && UnrealPlayer(ControllerKiller) != None) { bEnemyKill = ControllerKiller.GetTeamNum() != ControllerVictim.GetTeamNum() || Class'JBBotSquadJail'.Static.IsPlayerFighting(ControllerKiller, True); UnrealPlayer(ControllerKiller).LogMultiKills(0, bEnemyKill); } BroadcastDeathMessage(ControllerKiller, ControllerVictim, ClassDamageType); if (ControllerVictim != None) ScoreKill(ControllerKiller, ControllerVictim); DiscardInventory(PawnVictim); NotifyKilled(ControllerKiller, ControllerVictim, PawnVictim); } // ============================================================================ // ScoreKill // // Translates kills into ScorePlayer calls according to Jailbreak rules. // ============================================================================ function ScoreKill(Controller ControllerKiller, Controller ControllerVictim) { local float DistanceRelease; local float DistanceReleaseMin; local TeamInfo TeamKiller; local TeamInfo TeamVictim; local JBTagObjective firstTagObjective; local JBTagObjective thisTagObjective; local JBTagPlayer TagPlayerVictim; if (GameRulesModifiers != None) GameRulesModifiers.ScoreKill(ControllerKiller, ControllerVictim); ScoreKillAdjust(ControllerKiller, ControllerVictim); ScoreKillTaunt (ControllerKiller, ControllerVictim); TagPlayerVictim = Class'JBTagPlayer'.Static.FindFor(ControllerVictim.PlayerReplicationInfo); if (TagPlayerVictim == None || TagPlayerVictim.IsInJail()) return; if (ControllerKiller == None || ControllerKiller == ControllerVictim) ScorePlayer(ControllerVictim, 'Suicide'); else if (SameTeam(ControllerKiller, ControllerVictim)) ScorePlayer(ControllerKiller, 'Teamkill'); else if (TagPlayerVictim != None && TagPlayerVictim.IsInArena()) ScorePlayer(ControllerKiller, 'ArenaAttack'); else { TeamKiller = ControllerKiller.PlayerReplicationInfo.Team; TeamVictim = ControllerVictim.PlayerReplicationInfo.Team; DistanceReleaseMin = -1.0; firstTagObjective = JBGameReplicationInfo(GameReplicationInfo).firstTagObjective; for (thisTagObjective = firstTagObjective; thisTagObjective != None; thisTagObjective = thisTagObjective.nextTag) if (thisTagObjective.GetObjective().DefenderTeamIndex == TeamKiller.TeamIndex) { DistanceRelease = VSize(thisTagObjective.GetObjective().Location - ControllerVictim.Pawn.Location); if (DistanceReleaseMin < 0.0 || DistanceReleaseMin > DistanceRelease) DistanceReleaseMin = DistanceRelease; } if (DistanceReleaseMin > 0.0) { if (DistanceReleaseMin < 1024.0) ScorePlayer(ControllerKiller, 'Defense'); else ScorePlayer(ControllerKiller, 'Attack'); if (DistanceReleaseMin < 512.0 && CountPlayersFree(TeamVictim) == 1 && !IsReleaseActive(TeamVictim)) BroadcastLocalizedMessage(MessageClass, 700); } ControllerKiller.PlayerReplicationInfo.Kills += 1; } } // ============================================================================ // ScoreKillAdjust // // Performs bot skill adjustments as implemented in ScoreKill in DeathMatch. // ============================================================================ function ScoreKillAdjust(Controller ControllerKiller, Controller ControllerVictim) { if (bAdjustSkill) { if (AIController(ControllerKiller) != None && PlayerController(ControllerVictim) != None) AdjustSkill(AIController(ControllerKiller), PlayerController(ControllerVictim), True); if (AIController(ControllerVictim) != None && PlayerController(ControllerKiller) != None) AdjustSkill(AIController(ControllerVictim), PlayerController(ControllerKiller), False); } } // ============================================================================ // ScoreKillTaunt // // Performs auto-taunts as implemented in ScoreKill in DeathMatch. // ============================================================================ function ScoreKillTaunt(Controller ControllerKiller, Controller ControllerVictim) { local bool bNoHumanOnly; if (bAllowTaunts && ControllerKiller != None && ControllerKiller.PlayerReplicationInfo != None && // don't try to taunt for sentinels. ControllerKiller != ControllerVictim && SameTeam(ControllerKiller, ControllerVictim) && ControllerKiller.AutoTaunt() && ControllerKiller.PlayerReplicationInfo.VoiceType != None) { bNoHumanOnly = PlayerController(ControllerKiller) == None; ControllerKiller.SendMessage( ControllerVictim.PlayerReplicationInfo, 'AutoTaunt', ControllerKiller.PlayerReplicationInfo.VoiceType.Static.PickRandomTauntFor(ControllerKiller, False, bNoHumanOnly), 10, 'Global'); } } // ============================================================================ // ScorePlayer // // Adds points to the given player's score according to the given game event. // ============================================================================ function ScorePlayer(Controller Controller, name Event) { local JBTagPlayer TagPlayer; TagPlayer = Class'JBTagPlayer'.Static.FindFor(Controller.PlayerReplicationInfo); if (TagPlayer == None) return; switch (Event) { case 'Suicide': ScoreObjective(Controller.PlayerReplicationInfo, -1); break; case 'Teamkill': ScoreObjective(Controller.PlayerReplicationInfo, -1); break; case 'Attack': ScoreObjective(Controller.PlayerReplicationInfo, +1); TagPlayer.ScorePartialAttack += 1; break; case 'Defense': ScoreObjective(Controller.PlayerReplicationInfo, +2); TagPlayer.ScorePartialDefense += 1; break; case 'Release': ScoreObjective(Controller.PlayerReplicationInfo, +1); TagPlayer.ScorePartialRelease += 1; break; case 'Capture': ScoreObjective(Controller.PlayerReplicationInfo, +1); break; case 'ArenaAttack': ScoreObjective(Controller.PlayerReplicationInfo, +2); break; } switch (Event) { case 'Defense': Controller.AwardAdrenaline(ADR_MinorBonus); break; case 'Release': Controller.AwardAdrenaline(ADR_MinorBonus); break; case 'ArenaVictory': Controller.AwardAdrenaline(ADR_MinorBonus); break; } } // ============================================================================ // BroadcastDeathMessage // // Broadcasts death messages concerning suicides or kills in jail only to all // jailed players of that team. // ============================================================================ function BroadcastDeathMessage(Controller ControllerKiller, Controller ControllerVictim, Class<DamageType> DamageType) { local int SwitchMessage; local JBTagPlayer firstTagPlayer; local JBTagPlayer thisTagPlayer; local JBTagPlayer TagPlayerKiller; local JBTagPlayer TagPlayerVictim; local PlayerReplicationInfo PlayerReplicationInfoKiller; local PlayerReplicationInfo PlayerReplicationInfoVictim; if (ControllerKiller != None) TagPlayerKiller = Class'JBTagPlayer'.Static.FindFor(ControllerKiller.PlayerReplicationInfo); TagPlayerVictim = Class'JBTagPlayer'.Static.FindFor(ControllerVictim.PlayerReplicationInfo); if (TagPlayerVictim != None && TagPlayerVictim.IsInJail() && (TagPlayerKiller == None || TagPlayerKiller.IsInJail())) { if (ControllerKiller != None) PlayerReplicationInfoKiller = ControllerKiller.PlayerReplicationInfo; PlayerReplicationInfoVictim = ControllerVictim.PlayerReplicationInfo; if (ControllerKiller == None || ControllerKiller == ControllerVictim) SwitchMessage = 1; // suicide else SwitchMessage = 0; // homicide firstTagPlayer = JBGameReplicationInfo(GameReplicationInfo).firstTagPlayer; for (thisTagPlayer = firstTagPlayer; thisTagPlayer != None; thisTagPlayer = thisTagPlayer.nextTag) if (thisTagPlayer.GetJail() == TagPlayerVictim.GetJail() && PlayerController(thisTagPlayer.GetController()) != None) BroadcastHandler.BroadcastLocalized( Self, PlayerController(thisTagPlayer.GetController()), DeathMessageClass, SwitchMessage, PlayerReplicationInfoKiller, PlayerReplicationInfoVictim, DamageType); } else { Super.BroadcastDeathMessage(ControllerKiller, ControllerVictim, DamageType); } } // ============================================================================ // BroadcastLocalizedMessage // // Broadcasts a localized message to all players. makes a check in addons to // see if they have any objections against particular message being displayed // ============================================================================ event BroadcastLocalizedMessage( class<LocalMessage> MessageClass, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject ) { local JBGameRules firstJBGameRules; firstJBGameRules = Jailbreak(Level.Game).GetFirstJBGameRules(); if (firstJBGameRules != None && !firstJBGameRules.CanBroadcast(MessageClass, switch, RelatedPRI_1, RelatedPRI_2, OptionalObject)) return; Level.Game.BroadcastLocalized( self, MessageClass, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject ); } // ============================================================================ // DriverEnteredVehicle // // Called when a player enters a vehicle. Sets the view target of all other // players currently spectating this player to the vehicle. // ============================================================================ function DriverEnteredVehicle(Vehicle Vehicle, Pawn PawnDriver) { local Controller thisController; for (thisController = Level.ControllerList; thisController != None; thisController = thisController.nextController) if (PlayerController(thisController) != None && PlayerController(thisController).Pawn != Vehicle && PlayerController(thisController).ViewTarget == PawnDriver) { PlayerController(thisController). SetViewTarget(Vehicle); PlayerController(thisController).ClientSetViewTarget(Vehicle); } Super.DriverEnteredVehicle(Vehicle, PawnDriver); } // ============================================================================ // DriverLeftVehicle // // Called when a player leaves a vehicle. Sets the view target of all other // players currently spectating the vehicle to the player. // ============================================================================ function DriverLeftVehicle(Vehicle Vehicle, Pawn PawnDriver) { local Controller thisController; for (thisController = Level.ControllerList; thisController != None; thisController = thisController.nextController) if (PlayerController(thisController) != None && PlayerController(thisController).Pawn != PawnDriver && PlayerController(thisController).ViewTarget == Vehicle) { PlayerController(thisController). SetViewTarget(PawnDriver); PlayerController(thisController).ClientSetViewTarget(PawnDriver); } Super.DriverLeftVehicle(Vehicle, PawnDriver); } // ============================================================================ // CanSpectate // // Checks and returns whether the given player can spectate from the given new // view target. Only allows players to spectate other actual players. // ============================================================================ function bool CanSpectate(PlayerController PlayerViewer, bool bOnlySpectator, Actor ViewTarget) { if (Pawn(ViewTarget) != None && Class'JBTagPlayer'.Static.FindFor(Pawn(ViewTarget).PlayerReplicationInfo) == None) return False; return Super.CanSpectate(PlayerViewer, bOnlySpectator, ViewTarget); } // ============================================================================ // CanFireEvent // // Checks whether the given event has been fired already within this tick and // returns True if not, False otherwise. Thus makes sure that certain events // are only fired once per tick. // ============================================================================ function bool CanFireEvent(name EventFire, optional bool bFire) { local int iEventFired; if (TimeEventFired < Level.TimeSeconds) ListEventFired.Length = 0; for (iEventFired = 0; iEventFired < ListEventFired.Length; iEventFired++) if (ListEventFired[iEventFired] == EventFire) return False; if (bFire) { ListEventFired[ListEventFired.Length] = EventFire; TimeEventFired = Level.TimeSeconds; } return True; } // ============================================================================ // CanPlayReleaseMessage // // Returns true if the release message for the specified team has already been // played within this tick. // ============================================================================ function bool CanPlayReleaseMessage(int TeamIndex) { return TimeReleaseMessagePlayed[TeamIndex] < Level.TimeSeconds; } // ============================================================================ // PlayingReleaseMessage // // Sets the tick in which the release message for the specified team was played // ============================================================================ function PlayingReleaseMessage(int TeamIndex) { TimeReleaseMessagePlayed[TeamIndex] = Level.TimeSeconds; } // ============================================================================ // ContainsActorJail // // Iterates over all jails and returns whether one of them contains the given // actor (and optionally which of them). // ============================================================================ function bool ContainsActorJail(Actor Actor, optional out JBInfoJail Jail) { local JBInfoJail firstJail; firstJail = JBGameReplicationInfo(GameReplicationInfo).firstJail; for (Jail = firstJail; Jail != None; Jail = Jail.nextJail) if (Jail.ContainsActor(Actor)) return True; return False; } // ============================================================================ // ContainsActorArena // // Iterates over all arenas and returns whether one of them contains the given // actor (and optionally which of them). // ============================================================================ function bool ContainsActorArena(Actor Actor, optional out JBInfoArena Arena) { local JBInfoArena firstArena; firstArena = JBGameReplicationInfo(GameReplicationInfo).firstArena; for (Arena = firstArena; Arena != None; Arena = Arena.nextArena) if (Arena.ContainsActor(Actor)) return True; return False; } // ============================================================================ // CountPlayersFree // CountPlayersJailed // CountPlayersArena // CountPlayersTotal // // Forwarded to the corresponding functions in JBTagTeam. // ============================================================================ function int CountPlayersFree (TeamInfo Team) { return Class'JBTagTeam'.Static.FindFor(Team).CountPlayersFree (); } function int CountPlayersJailed(TeamInfo Team) { return Class'JBTagTeam'.Static.FindFor(Team).CountPlayersJailed(); } function int CountPlayersArena (TeamInfo Team) { return Class'JBTagTeam'.Static.FindFor(Team).CountPlayersArena (); } function int CountPlayersTotal (TeamInfo Team) { return Class'JBTagTeam'.Static.FindFor(Team).CountPlayersTotal (); } // ============================================================================ // IsCaptured // // Returns whether the given team has been captured. // ============================================================================ function bool IsCaptured(TeamInfo Team) { if (CountPlayersTotal(Team) == 0) return False; return CountPlayersJailed(Team) == CountPlayersTotal(Team); } // ============================================================================ // FindJailExecution // // Finds the jail which contains most players from the executed team. Used to // select which camera array to activate for the execution sequence. // ============================================================================ function JBInfoJail FindJailExecution(TeamInfo TeamExecuted) { local int nPlayersJailed; local int nPlayersJailedBest; local JBInfoJail firstJail; local JBInfoJail thisJail; local JBInfoJail JailBest; firstJail = JBGameReplicationInfo(Level.Game.GameReplicationInfo).firstJail; for (thisJail = firstJail; thisJail != None; thisJail = thisJail.nextJail) { nPlayersJailed = thisJail.CountPlayers(TeamExecuted); if (JailBest == None || nPlayersJailed > nPlayersJailedBest) { JailBest = thisJail; nPlayersJailedBest = nPlayersJailed; } } return JailBest; } // ============================================================================ // RestartAll // // Restarts all players in freedom. // ============================================================================ function RestartAll() { local JBTagPlayer firstTagPlayer; local JBTagPlayer thisTagPlayer; local JBTagPlayer nextTagPlayer; firstTagPlayer = JBGameReplicationInfo(GameReplicationInfo).firstTagPlayer; for (thisTagPlayer = firstTagPlayer; thisTagPlayer != None; thisTagPlayer = nextTagPlayer) { nextTagPlayer = thisTagPlayer.nextTag; thisTagPlayer.RestartInFreedom(); } } // ============================================================================ // RestartTeam // // Restarts all players of the given team in freedom. // ============================================================================ function RestartTeam(TeamInfo Team) { local JBTagPlayer firstTagPlayer; local JBTagPlayer thisTagPlayer; local JBTagPlayer nextTagPlayer; firstTagPlayer = JBGameReplicationInfo(GameReplicationInfo).firstTagPlayer; for (thisTagPlayer = firstTagPlayer; thisTagPlayer != None; thisTagPlayer = nextTagPlayer) { nextTagPlayer = thisTagPlayer.nextTag; if (thisTagPlayer.GetTeam() == Team) thisTagPlayer.RestartInFreedom(); } } // ============================================================================ // RestartPlayers // // Restarts only free or non-free players in freedom. // ============================================================================ function RestartPlayers(bool bFree) { local JBTagPlayer firstTagPlayer; local JBTagPlayer thisTagPlayer; local JBTagPlayer nextTagPlayer; firstTagPlayer = JBGameReplicationInfo(GameReplicationInfo).firstTagPlayer; for (thisTagPlayer = firstTagPlayer; thisTagPlayer != None; thisTagPlayer = nextTagPlayer) { nextTagPlayer = thisTagPlayer.nextTag; if (bFree == thisTagPlayer.IsFree()) thisTagPlayer.RestartInFreedom(); } } // ============================================================================ // GetDefaultPlayerClass // // Unlike the inherited method, returns the default Pawn class for the given // controller rather than the DefaultPlayerClassName class. Serves only to // avoid log messages that say that abstract Pawn cannot be spawned. // ============================================================================ function Class<Pawn> GetDefaultPlayerClass(Controller Controller) { local Class<Pawn> ClassPawn; ClassPawn = Super.GetDefaultPlayerClass(Controller); if (ClassPawn == Class'Pawn' && Controller.PawnClass != None) return Controller.PawnClass; return ClassPawn; } // ============================================================================ // IsReleaseActive // // Checks whether a release is active for the given team. // ============================================================================ function bool IsReleaseActive(TeamInfo Team) { local JBInfoJail firstJail; local JBInfoJail thisJail; firstJail = JBGameReplicationInfo(GameReplicationInfo).firstJail; for (thisJail = firstJail; thisJail != None; thisJail = thisJail.nextJail) if (thisJail.IsReleaseActive(Team)) return True; return False; } // ============================================================================ // ExecutionInit // // Checks how many teams are captured. If none, fails. If more than one, // announces a tie and starts a new round. If exactly one, commits execution. // Can only be called in the default state. // ============================================================================ function bool ExecutionInit() { local bool bFoundCaptured; local int iTeam; local TeamInfo Team; local TeamInfo TeamCaptured; if (IsInState('MatchInProgress')) { for (iTeam = 0; iTeam < ArrayCount(Teams); iTeam++) { Team = Teams[iTeam]; if (!IsCaptured(Team)) continue; if (bFoundCaptured) { RestartAll(); BroadcastLocalizedMessage(MessageClass, 300); JBGameReplicationInfo(GameReplicationInfo).AddCapture(ElapsedTime, None); return False; } bFoundCaptured = True; TeamCaptured = Team; } if (!bFoundCaptured || IsReleaseActive(TeamCaptured) || CountPlayersArena(OtherTeam(TeamCaptured)) > 0) return False; ExecutionCommit(TeamCaptured); return True; } else { Log("Warning: Cannot initiate execution while in state" @ GetStateName()); return False; } } // ============================================================================ // ExecutionCommit // // Prepares and commits a team's execution. Selects a jail to view during the // execution sequence, deactivates all camera and third-person views, respawns // all other players, scores and announces the capture. // ============================================================================ function ExecutionCommit(TeamInfo TeamExecuted) { local Controller thisController; local JBInfoJail firstJail; local JBInfoJail thisJail; local JBGameRules firstJBGameRules; local TeamInfo TeamCapturer; local JBTagPlayer firstTagPlayer; local JBTagPlayer thisTagPlayer; if (IsInState('MatchInProgress')) { GotoState('Executing'); firstTagPlayer = JBGameReplicationInfo(GameReplicationInfo).firstTagPlayer; for (thisTagPlayer = firstTagPlayer; thisTagPlayer != None; thisTagPlayer = thisTagPlayer.nextTag) if (thisTagPlayer.GetTeam() != TeamExecuted) thisTagPlayer.SaveSpree(); BroadcastLocalizedMessage(MessageClass, 100, , , TeamExecuted); JBGameReplicationInfo(GameReplicationInfo).AddCapture(ElapsedTime, TeamExecuted); for (thisController = Level.ControllerList; thisController != None; thisController = thisController.NextController) if (thisController.PlayerReplicationInfo != None && thisController.PlayerReplicationInfo.Team != TeamExecuted) ScorePlayer(thisController, 'Capture'); for (thisController = Level.ControllerList; thisController != None; thisController = thisController.NextController) if (PlayerController(thisController) != None) ResetViewTarget(PlayerController(thisController)); JailExecution = FindJailExecution(TeamExecuted); if (bEnableSpectatorDeathCam) for (thisController = Level.ControllerList; thisController != None; thisController = thisController.NextController) if (thisController.PlayerReplicationInfo != None && thisController.PlayerReplicationInfo.bOnlySpectator) JailExecution.ActivateCameraFor(thisController); TeamCapturer = OtherTeam(TeamExecuted); TeamCapturer.Score += 1; RestartTeam(TeamCapturer); firstJail = JBGameReplicationInfo(GameReplicationInfo).firstJail; for (thisJail = firstJail; thisJail != None; thisJail = thisJail.nextJail) thisJail.ExecutionInit(); firstJBGameRules = GetFirstJBGameRules(); if (firstJBGameRules != None) firstJBGameRules.NotifyExecutionCommit(TeamExecuted); if (GameStats != None){ if (TeamExecuted.TeamIndex == 0) GameStats.TeamScoreEvent(1,1,"round_win"); else if (TeamExecuted.TeamIndex == 1) GameStats.TeamScoreEvent(0,1,"round_win"); } } else { Log("Warning: Cannot commit execution while in state" @ GetStateName()); } } // ============================================================================ // ExecutionEnd // // Goes to the default state and restarts all players in the game in freedom. // Can only be called in state Executing. // ============================================================================ function ExecutionEnd() { local Controller thisController; local JBInfoJail firstJail; local JBInfoJail thisJail; local JBGameRules firstJBGameRules; if (IsInState('Executing')) { firstJail = JBGameReplicationInfo(GameReplicationInfo).firstJail; for (thisJail = firstJail; thisJail != None; thisJail = thisJail.nextJail) { if (thisJail.IsInState('ExecutionStarting')) thisJail.GotoState('ExecutionFallback'); thisJail.ExecutionEnd(); } firstJBGameRules = GetFirstJBGameRules(); if (firstJBGameRules != None) firstJBGameRules.NotifyExecutionEnd(); GotoState('MatchInProgress'); RestartAll(); if (bEnableSpectatorDeathCam) for (thisController = Level.ControllerList; thisController != None; thisController = thisController.NextController) if (thisController.PlayerReplicationInfo != None && thisController.PlayerReplicationInfo.bOnlySpectator) ResetViewTarget(PlayerController(thisController)); if ((Teams[0].Score >= GoalScore || Teams[1].Score >= GoalScore) && GoalScore > 0) EndGame(None, "TeamScoreLimit"); else if (bOverTime) EndGame(None, "TimeLimit"); } else { Log("Warning: Cannot end execution while in state" @ GetStateName()); } } // ============================================================================ // ResetViewTarget // // Resets the given player's view to normal first-person view. // ============================================================================ static function ResetViewTarget(PlayerController PlayerController) { if (JBCamera(PlayerController.ViewTarget) != None) JBCamera(PlayerController.ViewTarget).DeactivateFor(PlayerController); if (PlayerController.ViewTarget != PlayerController && PlayerController.ViewTarget != PlayerController.Pawn) { PlayerController.SetViewTarget(PlayerController.Pawn); PlayerController.bBehindView = False; PlayerController.ClientSetViewTarget(PlayerController.ViewTarget); PlayerController.ClientSetBehindView(PlayerController.bBehindView); } } // ============================================================================ // CheckEndGame // // Restores the PlayerReplicationInfo of the winning bot in order to ensure // that the bot is displayed with the correct mesh and skin. // ============================================================================ function bool CheckEndGame(PlayerReplicationInfo PlayerReplicationInfoWinner, string Reason) { if (!Super.CheckEndGame(PlayerReplicationInfoWinner, Reason)) return False; if (xPawn(EndGameFocus) != None && xPawn(EndGameFocus).PlayerReplicationInfo == None) xPawn(EndGameFocus).PlayerReplicationInfo = xPawn(EndGameFocus).OldController.PlayerReplicationInfo; return True; } // ============================================================================ // PlayStartupMessage // // Plays specialized messages for the start-of-game and overtime announcements. // ============================================================================ function PlayStartupMessage() { switch (StartupStage) { case 5: BroadcastLocalizedMessage(MessageClass, 900); return; case 7: BroadcastLocalizedMessage(MessageClass, 910); break; } Super.PlayStartupMessage(); } // ============================================================================ // PlayEndOfMatchMessage // // Plays the audio message when the game ends. // ============================================================================ function PlayEndOfMatchMessage() { local TeamInfo TeamWinner; if (Teams[0].Score > Teams[1].Score) TeamWinner = Teams[0]; else TeamWinner = Teams[1]; BroadcastLocalizedMessage(MessageClass, 920, , , TeamWinner); } // ============================================================================ // SetGrammar // // Specifies the grammar file to load for speech recognition. // ============================================================================ event SetGrammar() { LoadSRGrammar("JB"); } // ============================================================================ // ParseVoiceCommand // // Parses Jailbreak-specific voice commands in addition to the default ones // provided by any team game. // ============================================================================ function ParseVoiceCommand(PlayerController PlayerControllerSender, string Command) { local string Tactics; local JBTagClient TagClientSender; if (Left (Command, 8) == "TACTICS ") Tactics = Mid (Command, 8); else if (Right(Command, 8) == " TACTICS" ) Tactics = Left(Command, Len(Command) - 8); if (Tactics != "") { TagClientSender = Class'JBTagClient'.Static.FindFor(PlayerControllerSender); switch (Tactics) { case "AUTO": TagClientSender.ExecTeamTactics('auto'); break; case "UP": TagClientSender.ExecTeamTactics('up'); break; case "DOWN": TagClientSender.ExecTeamTactics('down'); break; case "SUICIDAL": TagClientSender.ExecTeamTactics('suicidal'); break; case "AGGRESSIVE": TagClientSender.ExecTeamTactics('aggressive'); break; case "NORMAL": TagClientSender.ExecTeamTactics('normal'); break; case "DEFENSIVE": TagClientSender.ExecTeamTactics('defensive'); break; case "EVASIVE": TagClientSender.ExecTeamTactics('evasive'); break; } } else { Super.ParseVoiceCommand(PlayerControllerSender, Command); } } // ============================================================================ // state MatchInProgress // // Normal gameplay in progress. // ============================================================================ state MatchInProgress { // ================================================================ // BeginState // // Only calls the superclass function if this state is entered the // first time. Resets the orders for all bots, and restarts the // client-side match time counters. // ================================================================ event BeginState() { local JBTagPlayer firstTagPlayer; local JBTagPlayer thisTagPlayer; local JBGameReplicationInfo InfoGame; local JBGameRules firstJBGameRules; if (bWaitingToStartMatch) Super.BeginState(); JBBotTeam(Teams[0].AI).ResetOrders(); JBBotTeam(Teams[1].AI).ResetOrders(); firstJBGameRules = GetFirstJBGameRules(); if (firstJBGameRules != None) firstJBGameRules.NotifyRound(); InfoGame = JBGameReplicationInfo(Level.Game.GameReplicationInfo); firstTagPlayer = InfoGame.firstTagPlayer; for (thisTagPlayer = firstTagPlayer; thisTagPlayer != None; thisTagPlayer = thisTagPlayer.nextTag) thisTagPlayer.NotifyRound(); for (thisTagPlayer = firstTagPlayerInactive; thisTagPlayer != None; thisTagPlayer = thisTagPlayer.nextTag) thisTagPlayer.NotifyRound(); InfoGame.StartMatchTimer(); InfoGame.SynchronizeMatchTimer(ElapsedTime); RespawnPickups(); } // ================================================================ // RespawnPickups // // Respawns all pickups and resets the initial spawning delay for // super pickups. Respawns vehicles and powers up turrets. // ================================================================ function RespawnPickups() { local Pickup thisPickup; local xPickupBase thisPickupBase; local SVehicleFactory thisSVehicleFactory; local ONSStationaryWeaponPawn thisStationaryWeaponPawn; foreach DynamicActors(Class'Pickup', thisPickup) thisPickup.Reset(); foreach AllActors(Class'xPickupBase', thisPickupBase) thisPickupBase.TurnOn(); foreach DynamicActors(Class'SVehicleFactory', thisSVehicleFactory) thisSVehicleFactory.Reset(); foreach DynamicActors(Class'ONSStationaryWeaponPawn', thisStationaryWeaponPawn) thisStationaryWeaponPawn.bPowered = True; } // ================================================================ // Timer // // Periodically checks whether at least one team is completely // jailed and sets TimeExecution if so. If TimeExecution is set // and has passed, resets it and calls the ExecutionInit function. // Synchronizes the client match timers. // ================================================================ event Timer() { local bool bSynchronizeTime; local int iTeam; local JBGameReplicationInfo InfoGame; bSynchronizeTime = ElapsedTime % 30 == 0 || ElapsedTime != GameReplicationInfo.ElapsedTime || DilationTimePrev != Level.TimeDilation; Super.Timer(); if (TimeExecution == 0.0) { for (iTeam = 0; iTeam < ArrayCount(Teams); iTeam++) if (IsCaptured(Teams[iTeam])) TimeExecution = Level.TimeSeconds + 1.0; } else if (Level.TimeSeconds > TimeExecution) { TimeExecution = 0.0; ExecutionInit(); } // switched to another state while executing Timer bSynchronizeTime = bSynchronizeTime || !IsInState('MatchInProgress'); if (bSynchronizeTime) { InfoGame = JBGameReplicationInfo(GameReplicationInfo); InfoGame.SynchronizeMatchTimer(ElapsedTime); DilationTimePrev = Level.TimeDilation; } } // ================================================================ // RestartPlayer // // Keeps players un-spawned until they have control over their // pawns. Otherwise, notifies both bot teams of the respawn. // ================================================================ function RestartPlayer(Controller Controller) { local JBTagPlayer TagPlayer; // do not spawn players until they have control over their pawn if (Controller == None || PlayerController(Controller) != None && Controller.PlayerReplicationInfo != None && Viewport(PlayerController(Controller).Player) == None && !Controller.PlayerReplicationInfo.bReceivedPing) return; TagPlayer = Class'JBTagPlayer'.Static.FindFor(Controller.PlayerReplicationInfo); if (TagPlayer.TimeRestart > Level.TimeSeconds) return; global.RestartPlayer(Controller); if (Controller == None || Controller.Pawn == None) return; // restart failed if (TagPlayer != None) TagPlayer.NotifyRestarted(); JBBotTeam(Teams[0].AI).NotifySpawn(Controller); JBBotTeam(Teams[1].AI).NotifySpawn(Controller); } // ================================================================ // EndState // // Interrupts the client-side match time counters. // ================================================================ event EndState() { local JBGameReplicationInfo InfoGame; InfoGame = JBGameReplicationInfo(GameReplicationInfo); InfoGame.StopMatchTimer(); } } // state MatchInProgress // ============================================================================ // state Executing // // The game is currently executing a team. During that time, players cannot // spawn in the game. // ============================================================================ state Executing { ignores BroadcastDeathMessage; // no death messages during execution ignores CheckEndGame; // game cannot end during execution // ================================================================ // BeginState // // Sets the bIsExecuting flag in JBGameReplicationInfo. // ================================================================ event BeginState() { JBGameReplicationInfo(GameReplicationInfo).bIsExecuting = True; } // ================================================================ // Timer // // Checks whether there are still players alive in jail. If not, // sets TimeRestart for a brief delay. If TimeRestart is set and // has passed, resets TimeRestart and calls ExecutionEnd. // ================================================================ event Timer() { local int iTeam; local int nPlayersJailed; local JBTagPlayer firstTagPlayer; local JBTagPlayer thisTagPlayer; if (TimeRestart == 0.0) { for (iTeam = 0; iTeam < ArrayCount(Teams); iTeam++) nPlayersJailed += CountPlayersJailed(Teams[iTeam]); if (nPlayersJailed == 0) TimeRestart = Level.TimeSeconds + 1.0; } else if (Level.TimeSeconds > TimeRestart) { TimeRestart = 0.0; ExecutionEnd(); } firstTagPlayer = JBGameReplicationInfo(Level.Game.GameReplicationInfo).firstTagPlayer; for (thisTagPlayer = firstTagPlayer; thisTagPlayer != None; thisTagPlayer = thisTagPlayer.nextTag) if (thisTagPlayer.TimeRestart <= Level.TimeSeconds && thisTagPlayer.IsInJail() && thisTagPlayer.GetPawn() == None) thisTagPlayer.RestartInFreedom(); } // ================================================================ // RestartPlayer // // Puts the given player in spectator mode and activates the // execution cam for him or her. // ================================================================ function RestartPlayer(Controller Controller) { local JBTagPlayer TagPlayer; JailExecution.ActivateCameraFor(Controller); TagPlayer = Class'JBTagPlayer'.Static.FindFor(Controller.PlayerReplicationInfo); TagPlayer.NotifyRestarted(); } // ================================================================ // EndState // // Resets the bIsExecuting flag in JBGameReplicationInfo. // ================================================================ event EndState() { JBGameReplicationInfo(GameReplicationInfo).bIsExecuting = False; } } // state Executing // ============================================================================ // state MatchOver // // Match has ended, and players are viewing the winning player. // ============================================================================ state MatchOver { // ================================================================ // Timer // // Puts all players on behind view. // ================================================================ event Timer() { local Controller thisController; Super.Timer(); if (EndGameFocus != None) for (thisController = Level.ControllerList; thisController != None; thisController = thisController.NextController) if (PlayerController(thisController) != None) PlayerController(thisController).ClientSetBehindView(True); } } // state MatchOver // ============================================================================ // PrecacheGameTextures // // Precache HUD and scoreboard textures. // ============================================================================ static function PrecacheGameTextures(LevelInfo myLevel) { class'xTeamGame'.static.PrecacheGameTextures(myLevel); myLevel.AddPrecacheMaterial(Material'SpriteWidgetHud'); myLevel.AddPrecacheMaterial(Material'SpriteWidgetScores'); myLevel.AddPrecacheMaterial(Material'ArenaBeacon'); myLevel.AddPrecacheMaterial(Material'HUDContent.NoEntry'); } // ============================================================================ // Defaults // ============================================================================ defaultproperties { Build = "%%%%-%%-%% %%:%%" ScreenShotName = "JBTexPreview.Preview" Description = "Two teams face off to send the other team's players to jail by fragging them. When all members of a team are in jail, the opposing team scores a point. Fight your way into the enemy base to release your teammates!" LoadingScreens[ 0] = "JBTexLoading.Addien-Dwy" LoadingScreens[ 1] = "JBTexLoading.Arlon" LoadingScreens[ 2] = "JBTexLoading.Aswan" LoadingScreens[ 3] = "JBTexLoading.BabylonTemple" LoadingScreens[ 4] = "JBTexLoading.CastleBreak" LoadingScreens[ 5] = "JBTexLoading.Cavern" LoadingScreens[ 6] = "JBTexLoading.Conduit" LoadingScreens[ 7] = "JBTexLoading.Cosmos" LoadingScreens[ 8] = "JBTexLoading.Heights" LoadingScreens[ 9] = "JBTexLoading.IndusRage2" LoadingScreens[10] = "JBTexLoading.MoonCraters" LoadingScreens[11] = "JBTexLoading.NoSense" LoadingScreens[12] = "JBTexLoading.Oasis" LoadingScreens[13] = "JBTexLoading.Poseidon" LoadingScreens[14] = "JBTexLoading.SavoIsland" LoadingScreens[15] = "JBTexLoading.Solamander" LoadingScreens[16] = "JBTexLoading.SubZero" TextHintJailbreak[ 0] = "Watch the compass dots: The faster they pulse, the more players can be released by the corresponding switch." TextHintJailbreak[ 1] = "Use %PREVWEAPON% and %NEXTWEAPON% to switch view points when watching through a surveillance camera." TextHintJailbreak[ 2] = "You can stand on teammates while they're crouching. Look out for jail escape routes requiring this cooperation!" TextHintJailbreak[ 3] = "Some jails have hidden escape routes. You may have to stand on a crouching teammate to reach them." TextHintJailbreak[ 4] = "There may be more than one release switch for your team. The faster a compass dot pulses, the more players can be released through the corresponding switch." TextHintJailbreak[ 5] = "Sometimes it is better to hide away from the enemy team than to give them an easy capture." TextHintJailbreak[ 6] = "If you killed the last free enemy, you can taunt the enemy team on the celebration screen during the execution sequence." TextHintJailbreak[ 7] = "Bored in jail? You can fight your teammates for fun with the Shield Gun without any penalties." TextHintJailbreak[ 8] = "Some jails contain monitors for surveillance cameras showing important spots in the map. Approach one of them to activate the camera." TextHintJailbreak[ 9] = "When you're jailed, you may be chosen for an arena match with a jailed enemy. Win the match to gain your freedom!" TextHintJailbreak[10] = "When an arena match is going on, press %ARENACAM% to watch a live feed!" TextHintJailbreak[11] = "Use %TEAMTACTICS UP% to increase and %TEAMTACTICS DOWN% to decrease the overall aggressiveness of the bots on your team." TextHintJailbreak[12] = "The Jailbreak scoreboard shows the whereabouts of you and your teammates on a panorama minimap." TextHintJailbreak[13] = "You can see what your human teammates are up to on the Jailbreak scoreboard: It shows whether they are attacking, defending or roaming the map." TextHintJailbreak[14] = "The red, yellow and green bars next to each player name in the Jailbreak scoreboard show that player's attack kills, defense kills and released teammates." TextHintJailbreak[15] = "The markers on the clock in the upper right corner of the Jailbreak scoreboard indicate team captures." TextHintJailbreak[16] = "Don't try to cheat by reconnecting to the server while you're in jail! The game will turn you into a llama (quite literally) and give other players bonus points for hunting you down." TextHintJailbreak[17] = "Don't attack protected players who were just released from jail. You might get llamaized for it!" TextDescriptionEnableJailFights = "Allows jail inmates to fight each other with their Shield Guns for fun." TextDescriptionFavorHumansForArena = "Always selects human players over bots for arena fights." TextDescriptionJailNewcomers = "New players who join during the game will be jailed." TextDescriptionDisallowEscaping = "Disallow players from leaving jail without being released or entering the arena." TextDescriptionEnableJBMapFixes = "Fixes a couple of small bugs in a few maps. Also adds a new execution to some." TextDescriptionNoJailKill = "Jailed players can no longer hurt enemies." TextDescriptionUseLevelRecommendedMinPlayers = "Bots are added automatically to reach the minimum recommended player count." TextWebAdminEnableJailFights = "Allow Jail Fights" TextWebAdminFavorHumansForArena = "Favor Humans For Arena" TextWebAdminJailNewcomers = "Jail Newcomers" TextWebAdminDisallowEscaping = "Disallow Escaping" TextWebAdminEnableJBMapFixes = "Enable Map Fixes" TextWebAdminNoJailKill = "No Jail Kills" TextWebAdminUseLevelRecommendedMinPlayers = "Use Level Recommended Min. Players" TextWebAdminPrefixAddon = "Jailbreak:" GIPropsDisplayText(6) = "Capture Limit" WebScoreboardClass = "Jailbreak.JBWebApplicationScoreboard" WebScoreboardPath = "/scoreboard" Addons = "JBAddonAvenger.JBAddonAvenger,JBAddonCelebration.JBAddonCelebration,JBAddonLlama.JBAddonLlama,JBAddonProtection.JBAddonProtection,JBAddonJailFightTally.JBAddonJailFightTally" bEnableJailFights = True bEnableScreens = True bEnableSpectatorDeathCam = True bFavorHumansForArena = False bJailNewcomers = False bDisallowEscaping = False bEnableJBMapFixes = True bNoJailKill = False bUseLevelRecommendedMinPlayers = True bEnableWebScoreboard = True bEnableWebAdminExtension = True GoalScore = 5 Acronym = "JB" MapPrefix = "JB" BeaconName = "JB" GameName = "Jailbreak" HUDType = "Jailbreak.JBInterfaceHud" ScoreBoardType = "Jailbreak.JBInterfaceScores" MapListType = "Jailbreak.JBMapList" HUDSettingsMenu = "Jailbreak.JBGUICustomHUDMenu" LoginMenuClass = "JBToolbox2.JBLoginMenu" MessageClass = Class'JBLocalMessage' GameReplicationInfoClass = Class'JBGameReplicationInfo' TeamAIType[0] = Class'JBBotTeam' TeamAIType[1] = Class'JBBotTeam' PathWhisps[0] = "Jailbreak.JBRedWhisp" PathWhisps[1] = "Jailbreak.JBBlueWhisp" bSpawnInTeamArea = True bScoreTeamKills = False bAllowVehicles = True MutatorClass = "Jailbreak.JBMutator" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |