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 |
/** * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. */ class UTPlayerReplicationInfo extends PlayerReplicationInfo native nativereplication dependson(UTCustomChar_Data); var bool bHolding; var databinding int spree; var databinding int MultiKillLevel; var float LastKillTime; var UTLinkedReplicationInfo CustomReplicationInfo; // for use by mod authors var UTSquadAI Squad; var private UTCarriedObject HasFlag; var class<UTVoice> VoiceClass; var repnotify UTGameObjective StartObjective; var UTGameObjective TemporaryStartObjective; var UTPlayerReplicationInfo LastKillerPRI; /** Used for revenge reward, and for avoiding respawning near killer */ var color DefaultHudColor; /** Set when pawn with this PRI has been rendered on HUD map, to avoid drawing it twice */ var bool bHUDRendered; /** Replicated class of pawn controlled by owner of this PRI. Replicated when drawing HUD Map */ var class<Pawn> HUDPawnClass; var vector HUDLocation, HUDPawnLocation; var byte HUDPawnYaw; var MaterialInstanceConstant HUDMaterialInstance; /** Determines which character this player will be in the single player game */ var int SinglePlayerCharacterIndex; /** data for the character this player is using */ var repnotify CustomCharData CharacterData; /** the mesh constructed from the above data */ var SkeletalMesh CharacterMesh; /** Texture of render of custom character head. */ var Texture CharPortrait; var MaterialInstanceConstant RedHeadMIC; var MaterialInstanceConstant RedBodyMIC; var MaterialInstanceConstant BlueHeadMIC; var MaterialInstanceConstant BlueBodyMIC; /** Mesh to use for first person arms. Should only be present for local players! */ var SkeletalMesh FirstPersonArmMesh; /** Material applied to first person arms. Should only be present for local players! */ var MaterialInterface FirstPersonArmMaterial; /** result of GetTeamNum() as of the last time we constructed the mesh for this player */ var byte CharacterMeshTeamNum; /** last time we called ProcessCharacterData() from ReplicatedEvent() (to avoid calling it multiple times at once and clobbering stuff) */ var float LastReceivedCharacterDataTime; /** set if the mesh/portrait were taken from another PRI (didn't construct our own) */ var bool bUsingReplacementCharacter; /** counter used in native replication to detect whether the server has sent the latest character data to each client * should be incremented whenever CharacterData changes */ var byte CharacterDataChangeCount; /** * The clan tag for this player */ var databinding string ClanTag; struct native IntStat { var name StatName; var int StatValue; }; /** holds all kill stats (this player's kills, sorted by weapon/damagetype) */ var Array<IntStat> KillStats; /** holds all death stats (this player's deaths instigated by another player, sorted by weapon/damagetype)*/ var Array<IntStat> DeathStats; /** holds all suicide stats (this player's suicides, sorted by weapon/damagetype)*/ var Array<IntStat> SuicideStats; /** holds event stats (mostly reward announcer related */ var Array<IntStat> EventStats; /** holds node captured/built/healed and core damaged/destroyed stats */ var Array<IntStat> NodeStats; /** Stats of vehicles killed by this player */ var Array<IntStat> VehicleKillStats; /** Armor, health, and powerups picked up by this player */ var Array<IntStat> PickupStats; // Pickup Flags var bool bAllPickupsFoundThisMap; var Array<INT> PickupFlags; struct native TimeStat { var name StatName; var float TotalTime; var float CurrentStart; }; /** Time spent driving, sorted by vehicle */ var Array<TimeStat> DrivingStats; /** Time spent holding powerups and flag/orb */ var Array<TimeStat> PowerupTimeStats; /** this class is used to cache the character data temporarily when this PRI is destroyed */ var class<UTProcessedCharacterCache> CharacterCacheClass; /** indicates that this is a bot spawned only to precache a custom character. It should be destroyed when the game begins * but the character data should stay around to be used by something spawned later (usually a character spawned by Kismet in the level) */ var bool bPrecachedBot; var localized string OrdersString[8]; var byte OrdersIndex; /************************************ * Hero related variables ************************************/ var float HeroThreshold; var bool bHasBeenHero; /** Voice to use for TTS. */ var transient ETTSSpeaker TTSSpeaker; /** Weapon award (most kills) at end of match - can reference by class since some aren't always loaded for console */ var int WeaponAwardIndex; /** Used for weapon award calculation */ var int WeaponAwardKills; // (cpptext) // (cpptext) // (cpptext) // (cpptext) replication { if (bNetDirty) CustomReplicationInfo, bHolding, Squad, OrdersIndex, ClanTag, SinglePlayerCharacterIndex; if ( bNetOwner && ROLE==ROLE_Authority ) StartObjective; if ( !bNetOwner ) // && UTPlayerController(ReplicationViewer).bViewingMap (if so, in C++ HUDLocationRep = HUDLocation, HUDPawnClass updated too); HUDPawnClass, HUDPawnLocation, HUDPawnYaw; if (bNetDirty) // && CharacterDataChangeCount != Recent->CharacterDataChangeCount CharacterData; if (bNetInitial) bPrecachedBot; } simulated event Destroyed() { local UTProcessedCharacterCache CharacterCache; local UTGameReplicationInfo GRI; Super.Destroyed(); // listen server/standalone can copy the mesh/etc data using CopyProperties(), so only need the cache on client if (!bUsingReplacementCharacter) { if ((WorldInfo.NetMode == NM_Client || bPrecachedBot) && CharacterCacheClass != None && CharacterCacheClass.static.ShouldCacheCharacter(self)) { CharacterCache = Spawn(CharacterCacheClass); CharacterCache.CachePRICharacter(self); if (bPrecachedBot) { CharacterCache.LifeSpan = 0.0; } } else if (CharacterMesh != None) { GRI = UTGameReplicationInfo(WorldInfo.GRI); if (GRI != None) { GRI.TotalPlayersSetToProcess--; } } } } simulated function bool ShouldBroadCastWelcomeMessage() { local UTGame Game; Game = UTGame(WorldInfo.Game); return (!bBot || Game == None || Game.SinglePlayerMissionID == INDEX_NONE) && Super.ShouldBroadcastWelcomeMessage(); } function int IncrementKillStat(name NewStatName) { local int i, Len; local IntStat NewStat; // Check if we should increment "Arachnophobia" achievement progress // We are doing this here because we cannot modify UTGameContent scripts for UT3Gold if (NewStatName == 'KILLS_SPIDERMINE' && UTPlayerController(Owner) != None && UTTeamGame(WorldInfo.Game) == None && UTDeathmatch(WorldInfo.Game) != None) { UTPlayerController(Owner).ClientUpdateAchievement(EUTA_UT3GOLD_Arachnophobia, 1); } Len = KillStats.Length; for (i=0; i<Len; i++ ) { if ( KillStats[i].StatName == NewStatName ) { KillStats[i].StatValue++; return KillStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = 1; KillStats[Len] = NewStat; UpdateEventStatAchievements(NewStatName); // need to track the roadkill award which is a kill stat return 1; } function int IncrementDeathStat(name NewStatName) { local int i, Len; local IntStat NewStat; Len = DeathStats.Length; for (i=0; i<Len; i++ ) { if ( DeathStats[i].StatName == NewStatName ) { DeathStats[i].StatValue++; return DeathStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = 1; DeathStats[Len] = NewStat; return 1; } function int IncrementSuicideStat(name NewStatName) { local int i, Len; local IntStat NewStat; Len = SuicideStats.Length; for (i=0; i<Len; i++ ) { if ( SuicideStats[i].StatName == NewStatName ) { SuicideStats[i].StatValue++; return SuicideStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = 1; SuicideStats[Len] = NewStat; return 1; } function UpdateEventStatAchievements(name StatName) { local UTPlayerController PC; PC = UTPlayerController(Owner); if (PC != None && UTGame(WorldInfo.Game).IsMPOrHardBotsGame()) { if (StatName == 'REWARD_HEADHUNTER') { PC.ClientUpdateAchievement(EUTA_WEAPON_BrainSurgeon, 1); } else if (StatName == 'REWARD_COMBOKING') { PC.ClientUpdateAchievement(EUTA_WEAPON_DontTaseMeBro, 1); } else if (StatName == 'REWARD_BIOHAZARD') { PC.ClientUpdateAchievement(EUTA_WEAPON_GooGod, 1); } else if (StatName == 'REWARD_GUNSLINGER') { PC.ClientUpdateAchievement(EUTA_WEAPON_Pistolero, 1); } else if (StatName == 'REWARD_BLUESTREAK') { PC.ClientUpdateAchievement(EUTA_WEAPON_ShardOMatic, 1); } else if (StatName == 'REWARD_JACKHAMMER') { PC.ClientUpdateAchievement(EUTA_WEAPON_Hammerhead, 1); } else if (StatName == 'REWARD_SHAFTMASTER') { PC.ClientUpdateAchievement(EUTA_WEAPON_StrongestLink, 1); } else if (StatName == 'REWARD_BIGGAMEHUNTER') { PC.ClientUpdateAchievement(EUTA_WEAPON_BigGameHunter, 1); } else if (StatName == 'REWARD_ROCKETSCIENTIST') { PC.ClientUpdateAchievement(EUTA_WEAPON_HaveANiceDay, 0); } else if (StatName == 'REWARD_FLAKMASTER') { PC.ClientUpdateAchievement(EUTA_WEAPON_HaveANiceDay, 1); } else if (StatName == 'SPREE_KILLINGSPREE') { PC.ClientUpdateAchievement(EUTA_HUMILIATION_SerialKiller, 1); } else if (StatName == 'MULTIKILL_MONSTERKILL') { PC.ClientUpdateAchievement(EUTA_HUMILIATION_SirSlaysALot, 1); } else if (StatName == 'EVENT_FIRSTBLOOD') { PC.ClientUpdateAchievement(EUTA_HUMILIATION_OffToAGoodStart, 1); } else if (StatName == 'EVENT_ENDSPREE') { PC.ClientUpdateAchievement(EUTA_HUMILIATION_KillJoy, 1); } else if (StatName == 'EVENT_RANOVERKILLS') { PC.ClientUpdateAchievement(EUTA_VEHICLE_Armadillo, 1); } else if (StatName == 'EVENT_TOPGUN') { PC.ClientUpdateAchievement(EUTA_VEHICLE_Ace, 1); } else if (StatName == 'EVENT_BULLSEYE') { PC.ClientUpdateAchievement(EUTA_VEHICLE_Deathwish, 1); } else if (StatName == 'EVENT_HATTRICK') { PC.ClientUpdateAchievement(EUTA_GAME_HatTrick, 1); } else if (StatName == 'EVENT_RETURNEDORB') { PC.ClientUpdateAchievement(EUTA_GAME_BeingAHero, 1); } } } function int IncrementEventStat(name NewStatName) { local int i, Len; local IntStat NewStat; //`log("Increment Event Stat "$NewStatName); Len = EventStats.Length; for (i=0; i<Len; i++ ) { if ( EventStats[i].StatName == NewStatName ) { // this is the only one we count more than once per match if (NewStatName == 'EVENT_RETURNEDORB') { UpdateEventStatAchievements(NewStatName); } EventStats[i].StatValue++; return EventStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = 1; EventStats[Len] = NewStat; UpdateEventStatAchievements(NewStatName); return 1; } function int AddToEventStat(name NewStatName, int Amount) { local int i, Len; local IntStat NewStat; Len = EventStats.Length; for (i=0; i<Len; i++ ) { if ( EventStats[i].StatName == NewStatName ) { EventStats[i].StatValue += Amount; return EventStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = Amount; EventStats[Len] = NewStat; return Amount; } function int IncrementNodeStat(name NewStatName) { local int i, Len; local IntStat NewStat; Len = NodeStats.Length; for (i=0; i<Len; i++ ) { if ( NodeStats[i].StatName == NewStatName ) { NodeStats[i].StatValue++; return NodeStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = 1; NodeStats[Len] = NewStat; return 1; } function int AddToNodeStat(name NewStatName, int Amount) { local int i, Len; local IntStat NewStat; Len = NodeStats.Length; for (i=0; i<Len; i++ ) { if ( NodeStats[i].StatName == NewStatName ) { NodeStats[i].StatValue += Amount; return NodeStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = Amount; NodeStats[Len] = NewStat; return Amount; } function StartDrivingStat(name NewStatName) { local int i, Len; local TimeStat NewStat; Len = DrivingStats.Length; for (i=0; i<Len; i++ ) { if ( DrivingStats[i].StatName == NewStatName ) { DrivingStats[i].CurrentStart = WorldInfo.TimeSeconds; return; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.CurrentStart = WorldInfo.TimeSeconds; DrivingStats[Len] = NewStat; return; } function StopDrivingStat(name NewStatName) { local int i, Len; Len = DrivingStats.Length; for (i=0; i<Len; i++ ) { if ( DrivingStats[i].StatName == NewStatName ) { DrivingStats[i].TotalTime = DrivingStats[i].TotalTime + WorldInfo.TimeSeconds - DrivingStats[i].CurrentStart; return; } } // didn't find it - just fail WarnInternal("Stopped driving stat "$NewStatName$" without starting it"); return; } function int IncrementVehicleKillStat(name NewStatName) { local int i, Len; local IntStat NewStat; Len = VehicleKillStats.Length; for (i=0; i<Len; i++ ) { if ( VehicleKillStats[i].StatName == NewStatName ) { VehicleKillStats[i].StatValue++; return VehicleKillStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = 1; VehicleKillStats[Len] = NewStat; return 1; } function int IncrementPickupStat(name NewStatName) { local int i, Len; local IntStat NewStat; Len = PickupStats.Length; for (i=0; i<Len; i++ ) { if ( PickupStats[i].StatName == NewStatName ) { PickupStats[i].StatValue++; return PickupStats[i].StatValue; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.StatValue = 1; PickupStats[Len] = NewStat; return 1; } function int UpdatePickupFlags(int index) { local int Len, Offset, BitIndex; if (index >=0 && !bAllPickupsFoundThisMap && Owner != None && UTPlayerController(Owner) != None) { // find where this bit will be in 32 bit values Offset = index / 32; BitIndex = index % 32; Len = PickupFlags.Length; if (Offset+1 > Len) { // grow the array if we need to PickupFlags.Length = Offset + 1; } // mark this pickup as taken if ((PickupFlags[Offset] | (1<<BitIndex)) != PickupFlags[Offset]) { PickupFlags[Offset] = PickupFlags[Offset] | (1<<BitIndex); //`log("Picked up pickup "$index$" resolved to Offset "$Offset$", BitIndex "$BitIndex$" : PickupFlags["$Offset$"] = "$PickupFlags[Offset]); if (class'UTDeathmatch'.static.CheckLikeTheBackOfMyHandAchievement(UTPlayerController(Owner), UTGame(WorldInfo.Game).NextPickupIndex-1)) { ClientOnAllPickupsTaken(); //Server knows we have all pickups bAllPickupsFoundThisMap = true; } } } return 1; } function StartPowerupTimeStat(name NewStatName) { local int i, Len; local TimeStat NewStat; Len = PowerupTimeStats.Length; for (i=0; i<Len; i++ ) { if ( PowerupTimeStats[i].StatName == NewStatName ) { PowerupTimeStats[i].CurrentStart = WorldInfo.TimeSeconds; return; } } // didn't find it - add a new one NewStat.StatName = NewStatName; NewStat.CurrentStart = WorldInfo.TimeSeconds; PowerupTimeStats[Len] = NewStat; return; } function UpdatePowerupAchievements(name StatName, int time) { local UTPlayerController PC; PC = UTPlayerController(Owner); if (PC != None && UTGame(WorldInfo.Game).IsMPOrHardBotsGame()) { if (StatName == 'POWERUPTIME_BERSERK') { PC.ClientUpdateAchievement(EUTA_POWERUP_SeeingRed, time); } if (StatName == 'POWERUPTIME_INVISIBILITY') { PC.ClientUpdateAchievement(EUTA_POWERUP_NeverSawItComing, time); } if (StatName == 'POWERUPTIME_INVULNERABILITY') { PC.ClientUpdateAchievement(EUTA_POWERUP_SurvivalFittest, time); } if (StatName == 'POWERUPTIME_UDAMAGE') { PC.ClientUpdateAchievement(EUTA_POWERUP_DeliveringTheHurt, time); } if (StatName == 'POWERUPTIME_SLOWFIELD') { PC.ClientUpdateAchievement(EUTA_UT3GOLD_TheSlowLane, time); } } } function StopPowerupTimeStat(name NewStatName) { local int i, Len, TimeDelta; Len = PowerupTimeStats.Length; for (i=0; i<Len; i++ ) { if (PowerupTimeStats[i].StatName == NewStatName) { if (PowerupTimeStats[i].CurrentStart >= 0.0) { TimeDelta = WorldInfo.TimeSeconds - PowerupTimeStats[i].CurrentStart + 0.5; UpdatePowerupAchievements(NewStatName, TimeDelta); PowerupTimeStats[i].TotalTime = PowerupTimeStats[i].TotalTime + TimeDelta; //Mark the current start in case we call stop twice PowerupTimeStats[i].CurrentStart = -1.0; } return; } } // didn't find it - just fail WarnInternal("Stopped powerup time stat "$NewStatName$" without starting it"); return; } simulated function RenderMapIcon(UTMapInfo MP, Canvas Canvas, UTPlayerController HUDPlayerOwner, LinearColor FinalColor) { local class<UTVehicle> VClass; local class<UTPawn> PClass; local float MapSize; local TextureCoordinates UVs; if ( HUDPawnClass == None ) { return; } PClass = class<UTPawn>(HUDPawnClass); if ( PClass != None ) { MapSize = PClass.Default.MapSize; UVs = PClass.Default.IconCoords; } else { VClass = class<UTVehicle>(HUDPawnClass); if ( VClass != None ) { MapSize = VClass.Default.MapSize; UVs = VClass.Default.IconCoords; } else { LogInternal(PlayerName$" PRI has bad pawn class "$HUDPawnClass); return; } } Canvas.SetPos(HUDLocation.X - 0.5*MapSize* MP.MapScale, HUDLocation.Y - 0.5* MapSize* MP.MapScale * Canvas.ClipY / Canvas.ClipX); MP.DrawRotatedTile(Canvas,class'UTHUD'.default.IconHudTexture, HUDLocation, HUDPawnYaw, MapSize, UVs, FinalColor); } function UpdatePlayerLocation() { local UTBot B; local UTPlayerController PC; local name BotOrders; B = UTBot(Owner); if ( B != None ) { BotOrders = B.GetOrders(); if ( BotOrders == 'ATTACK' ) { OrdersIndex = 2; } else if ( BotOrders == 'DEFEND' ) { OrdersIndex = 3; } else if ( BotOrders == 'FOLLOW' ) { OrdersIndex = 6; } else if ( BotOrders == 'HOLD' ) { OrdersIndex = 7; } else { OrdersIndex = 0; } return; } PC = UTPlayerController(Owner); if ( PC != None ) { OrdersIndex = PC.AutoObjectivePreference; } } simulated function string GetLocationName() { return OrdersString[OrdersIndex]; } reliable server function SetStartObjective(UTGameObjective Objective, bool bTemporary) { if ( Objective == None || Objective.ValidSpawnPointFor(Team.TeamIndex)) { // make sure old StartSpot isn't used by the spawning code since it might not be valid for the new start objective Controller(Owner).StartSpot = None; if (bTemporary) { TemporaryStartObjective = Objective; } else { StartObjective = Objective; } } } function UTGameObjective GetStartObjective() { local UTBot B; local UTGameObjective SelectedPC; SelectedPC = TemporaryStartObjective; TemporaryStartObjective = None; if (SelectedPC != None && SelectedPC.ValidSpawnPointFor(Team.TeamIndex)) { return SelectedPC; } else { B = UTBot(Owner); if (B != None && B.Squad != None) { return B.Squad.GetStartObjective(B); } else { return (StartObjective != None && StartObjective.ValidSpawnPointFor(Team.TeamIndex)) ? StartObjective : None; } } } function SetFlag(UTCarriedObject NewFlag) { HasFlag = NewFlag; bHasFlag = (HasFlag != None); } function UTCarriedObject GetFlag() { return HasFlag; } simulated function bool IsHero() { return false; } simulated function bool CanBeHero() { return false; } simulated function float GetHeroMeter() { return 0.0f; } function int GetNumCoins() { return 0; } function ResetHero(); function IncrementHeroMeter(float AddedValue, optional class<UTDamageType> DamageType); function CheckHeroMeter(); function bool TriggerHero() { return false; } function AddCoins(int Coins); // Deprecated function LogMultiKills(bool bEnemyKill); // Deprecated function IncrementSpree(); function IncrementKills(bool bEnemyKill, class<UTDamageType> DamageType) { if ( bEnemyKill ) { IncrementHeroMeter(1.0, DamageType); if ( WorldInfo.TimeSeconds - LastKillTime < 4 ) { IncrementHeroMeter(1.0, DamageType); MultiKillLevel++; IncrementEventStat(class'UTLeaderboardWriteDM'.Default.MULTIKILL[Min(MultiKillLevel-1, 4)]); } else { MultiKillLevel = 0; } LastKillTime = WorldInfo.TimeSeconds; spree++; if ( spree > 4 ) { IncrementHeroMeter(1.0, DamageType); UTGame(WorldInfo.Game).NotifySpree(self, spree); } } else { MultiKillLevel = 0; } } /* Reset() reset actor to initial state - used when restarting level without reloading. */ function Reset() { Super.Reset(); SetFlag(None); Spree = 0; KillStats.length = 0; DeathStats.length = 0; SuicideStats.length = 0; EventStats.length = 0; NodeStats.length = 0; VehicleKillStats.length = 0; PickupStats.length = 0; DrivingStats.length = 0; PowerupTimeStats.length = 0; PickupFlags.length = 0; bHasBeenHero = false; } simulated function string GetCallSign() { return PlayerName; } /* epic =============================================== * ::OverrideWith Get overridden properties from old PRI */ function OverrideWith(PlayerReplicationInfo PRI) { local UTPlayerReplicationInfo UTPRI; Super.OverrideWith(PRI); UTPRI = UTPlayerReplicationInfo(PRI); if ( UTPRI == None ) return; } /* epic =============================================== * ::CopyProperties Copy properties which need to be saved in inactive PRI */ function CopyProperties(PlayerReplicationInfo PRI) { local UTPlayerReplicationInfo UTPRI; Super.CopyProperties(PRI); UTPRI = UTPlayerReplicationInfo(PRI); if ( UTPRI == None ) return; UTPRI.CustomReplicationInfo = CustomReplicationInfo; UTPRI.CharacterData = CharacterData; UTPRI.bIsFemale = bIsFemale; UTPRI.CharacterDataChangeCount++; UTPRI.KillStats = KillStats; UTPRI.DeathStats = DeathStats; UTPRI.SuicideStats = SuicideStats; } function SeamlessTravelTo(PlayerReplicationInfo NewPRI) { local UTPlayerReplicationInfo UTPRI; local UTGameReplicationInfo GRI; Super.SeamlessTravelTo(NewPRI); // copy constructed character data directly UTPRI = UTPlayerReplicationInfo(NewPRI); if (UTPRI != None) { UTPRI.CharacterMesh = CharacterMesh; //Save the materials also so we can switch teams (server only) UTPRI.RedBodyMIC = RedBodyMIC; UTPRI.RedHeadMIC = RedHeadMIC; UTPRI.BlueBodyMIC = BlueBodyMIC; UTPRI.BlueHeadMIC = BlueHeadMIC; UTPRI.CharPortrait = CharPortrait; UTPRI.VoiceClass = VoiceClass; UTPRI.SinglePlayerCharacterIndex = SinglePlayerCharacterIndex; UTPRI.bUsingReplacementCharacter = bUsingReplacementCharacter; UTPRI.FirstPersonArmMesh = FirstPersonArmMesh; UTPRI.FirstPersonArmMaterial = FirstPersonArmMaterial; // increment GRI's counter if a mesh persisted //@warning: this assumes a new GRI is created after each travel and that happens before calling this function if (!UTPRI.bUsingReplacementCharacter && UTPRI.CharacterMesh != None) { GRI = UTGameReplicationInfo(WorldInfo.GRI); if (GRI != None) { GRI.TotalPlayersSetToProcess++; } } } } /********************************************************************************************** Teleporting *********************************************************************************************/ /** * The function is used to setup the conditions that allow a teleport. It also defers to the gameinfo * * @Param DestinationActor The actor to teleport to * @param OwnerPawn returns the pawn owned by the controlling owner casts to UTPawn * * @returns True if the teleport is allowed */ function bool AllowClientToTeleport(Actor DestinationActor, out UTPawn OwnerPawn) { local Controller OwnerC; OwnerC = Controller(Owner); // `log("##"@OwnerC@DestinationActor@UTGame(WorldInfo.Game).AllowClientToTeleport(Self, DestinationActor)); if ( OwnerC != none && DestinationActor != None && UTGame(WorldInfo.Game) != none && UTGame(WorldInfo.Game).AllowClientToTeleport(Self, DestinationActor) ) { // Cast the Pawn as we know we need it. OwnerPawn = UTPawn(OwnerC.Pawn); if ( OwnerPawn != none ) { if (bHasFlag) { GetFlag().Drop(); } return true; } } return false; } /** * This function is used to teleport directly to actor. Currently, only 2 types of actors * support teleporting. UTGameObjectives and UTVehicle_Leviathans. * * @param DestinationActor This is the Actor the player is trying to teleport to */ server reliable function ServerTeleportToActor(Actor DestinationActor) { local UTPawn OwnedPawn; local UTOnslaughtNodeObjective DestObj; local UTOnslaughtNodeTeleporter Teleporter; local int i; local UTVehicle_Leviathan Levi; if ( AllowClientToTeleport(DestinationActor, OwnedPawn) ) { // Handle teleporting to Game Objectives if ( UTGameObjective(DestinationActor) != none ) { Teleporter = UTOnslaughtNodeTeleporter(OwnedPawn.Base); if ( Teleporter != none ) { DestObj = UTOnslaughtNodeObjective(DestinationActor); if ( DestObj != none ) { for (i=0;i<DestObj.NodeTeleporters.Length;i++) { if ( DestObj.NodeTeleporters[i] == Teleporter ) { // FIXME: Add a message about the failure return; } } } } UTGameObjective(DestinationActor).TeleportTo( OwnedPawn ); } // Handle Leviathans (but only if the current gametype allows that) else if (UTVehicle_Leviathan(DestinationActor) != none && UTOnslaughtGame(WorldInfo.Game) != none) { Levi = UTVehicle_Leviathan(DestinationActor); if ( Levi.AnySeatAvailable() ) { Levi.TryToDrive(OwnedPawn); } else { Levi.PlaceExitingDriver(OwnedPawn); } } } } simulated event color GetHudColor() { if ( Team != none ) { return Team.GetHudColor(); } else { return DefaultHudColor; } } simulated event ReplicatedEvent(name VarName) { local UTGameReplicationInfo UTGRI; if ( VarName == 'Team' ) { if (LastReceivedCharacterDataTime != WorldInfo.TimeSeconds && GetTeamNum() != CharacterMeshTeamNum) { // try to recreate custom character mesh as they are team specific UTGRI = UTGameReplicationInfo(WorldInfo.GRI); if (UTGRI != none) { UTGRI.ProcessCharacterData(self, IsLocalPlayerPRI()); LastReceivedCharacterDataTime = WorldInfo.TimeSeconds; } } Super.ReplicatedEvent(VarName); } else if (VarName == 'CharacterData') { if (LastReceivedCharacterDataTime != WorldInfo.TimeSeconds) { UTGRI = UTGameReplicationInfo(WorldInfo.GRI); if (UTGRI != None) { UTGRI.ProcessCharacterData(self); LastReceivedCharacterDataTime = WorldInfo.TimeSeconds; } } } else { Super.ReplicatedEvent(VarName); } } /** triggers custom mesh creation only if we didn't get one * this is used on a timer to retry after a delay when we don't think we have all the necessary info */ simulated function RetryProcessCharacterData() { local UTGameReplicationInfo GRI; if (CharacterMesh == None) { GRI = UTGameReplicationInfo(WorldInfo.GRI); if (GRI != None) { GRI.ProcessCharacterData(self); } } } /** Called by custom character code when building player mesh to create team-coloured texture. */ simulated function string GetCustomCharTeamString() { if (Team != None) { if (Team.TeamIndex == 0) { return "VRed"; } else if (Team.TeamIndex == 1) { return "VBlue"; } } return "V01"; } simulated function string GetCustomCharOtherTeamString() { if (Team != None) { if (Team.TeamIndex == 0) { return "VBlue"; } else if (Team.TeamIndex == 1) { return "VRed"; } } return "V01"; } /** sets character data, triggering an update for the local player and any clients */ function SetCharacterData(const out CustomCharData NewData) { local UTGameReplicationInfo GRI; local UTGame UTG; // If we don't want custom characters (or this is PIE) - skip this part. UTG = UTGame(WorldInfo.Game); if ((UTG == None || !UTG.bNoCustomCharacters) && !WorldInfo.IsPlayInEditor() && NewData != CharacterData) { CharacterData = NewData; CharacterDataChangeCount++; bForceNetUpdate = TRUE; if (WorldInfo.NetMode != NM_DedicatedServer) { GRI = UTGameReplicationInfo(WorldInfo.GRI); if (GRI != None) { GRI.ProcessCharacterData(self); } } } } /** Save the materials off the supplied mesh as the 'other' team materials. */ simulated function SetOtherTeamSkin(SkeletalMesh NewSkelMesh) { if (Team != None && NewSkelMesh != None) { if (Team.TeamIndex == 0) { assert(BlueHeadMIC == None); BlueHeadMIC = MaterialInstanceConstant(NewSkelMesh.Materials[0]); BlueBodyMIC = MaterialInstanceConstant(NewSkelMesh.Materials[1]); } else if (Team.TeamIndex == 1) { assert(RedHeadMIC == None); RedHeadMIC = MaterialInstanceConstant(NewSkelMesh.Materials[0]); RedBodyMIC = MaterialInstanceConstant(NewSkelMesh.Materials[1]); } } } simulated native function SetCharMeshMaterial(int MatIndex, MaterialInstanceConstant MIC); /** Util to swamp the team skin colour on a custom character mesh. */ simulated function bool UpdateCustomTeamSkin() { local Pawn P; if(Team != None && IsLocalPlayerPRI()) { if (Team.TeamIndex == 0 && RedBodyMIC != None) { SetCharMeshMaterial(0, RedHeadMIC); SetCharMeshMaterial(1, RedBodyMIC); } else if (Team.TeamIndex == 1 && BlueBodyMIC != None) { SetCharMeshMaterial(0, BlueHeadMIC); SetCharMeshMaterial(1, BlueBodyMIC); } else { return FALSE; } foreach WorldInfo.AllPawns(class'Pawn', P) { if (P.PlayerReplicationInfo == self || (P.DrivenVehicle != None && P.DrivenVehicle.PlayerReplicationInfo == self)) { P.NotifyTeamChanged(); } } CharacterMeshTeamNum = Team.TeamIndex; return TRUE; } return FALSE; } /** Accessor that sets the custom character mesh to use for this PRI, and updates instance of player in map if there is one. */ simulated function SetCharacterMesh(SkeletalMesh NewSkelMesh, optional bool bIsReplacement) { local Pawn P; local UTGameReplicationInfo GRI; local class<UTFamilyInfo> FamilyInfoClass; if (CharacterMesh != NewSkelMesh) { CharacterMesh = NewSkelMesh; bIsFemale = FALSE; VoiceClass = default.VoiceClass; RedHeadMIC = None; RedBodyMIC = None; BlueHeadMIC = None; BlueBodyMIC = None; if (CharacterMesh == None) { if (!bUsingReplacementCharacter) { GRI = UTGameReplicationInfo(WorldInfo.GRI); if (GRI != None) { GRI.TotalPlayersSetToProcess--; } } } else { if(GetTeamNum() == 0) { RedHeadMIC = MaterialInstanceConstant(CharacterMesh.Materials[0]); RedBodyMIC = MaterialInstanceConstant(CharacterMesh.Materials[1]); } else { BlueHeadMIC = MaterialInstanceConstant(CharacterMesh.Materials[0]); BlueBodyMIC = MaterialInstanceConstant(CharacterMesh.Materials[1]); } // set sex and voice if( CharacterData.FamilyID != "" && CharacterData.FamilyID != "NONE" ) { // We have decent family, look in info class FamilyInfoClass = class'UTCustomChar_Data'.static.FindFamilyInfo(CharacterData.FamilyID); if(FamilyInfoClass != None) { bIsFemale = FamilyInfoClass.default.bIsFemale; VoiceClass = FamilyInfoClass.static.GetVoiceClass(CharacterData); } } } bUsingReplacementCharacter = bIsReplacement; // a little hacky, relies on presumption that enum vals 0-3 are male, 4-8 are female if (bIsFemale) { TTSSpeaker = ETTSSpeaker(Rand(4)); } else { TTSSpeaker = ETTSSpeaker(Rand(5) + 4); } foreach WorldInfo.AllPawns(class'Pawn', P) { if (P.PlayerReplicationInfo == self || (P.DrivenVehicle != None && P.DrivenVehicle.PlayerReplicationInfo == self)) { P.NotifyTeamChanged(); } } } CharacterMeshTeamNum = GetTeamNum(); } /** Assign a arm mesh and material to this PRI, and updates and instance of player in the map accordingly. */ simulated function SetFirstPersonArmInfo(SkeletalMesh ArmMesh, MaterialInterface ArmMaterial) { local UTPawn UTP; FirstPersonArmMesh = ArmMesh; FirstPersonArmMaterial = ArmMaterial; foreach WorldInfo.AllPawns(class'UTPawn', UTP) { if (UTP.PlayerReplicationInfo == self || (UTP.DrivenVehicle != None && UTP.DrivenVehicle.PlayerReplicationInfo == self)) { UTP.NotifyArmMeshChanged(self); } } } reliable simulated client function ShowMidGameMenu(bool bInitial) { if ( !AttemptMidGameMenu() ) { SetTimer(0.2,true,'AttemptMidGameMenu'); } } simulated function bool AttemptMidGameMenu() { local UTPlayerController PlayerOwner; local UTGameReplicationInfo GRI; PlayerOwner = UTPlayerController(Owner); if ( PlayerOwner != none ) { GRI = UTGameReplicationInfo(WorldInfo.GRI); if (GRI != none) { GRI.ShowMidGameMenu(PlayerOwner,'ScoreTab',true); if ( GRI.CurrentMidGameMenu != none ) { GRI.CurrentMidGameMenu.bInitial = true; } ClearTimer('AttemptMidGameMenu'); return true; } } return false; } /** Called when all pickups on a map have been touched in one playthrough **/ function client reliable simulated ClientOnAllPickupsTaken() { local string FinalMsg; //Client knows from LoadProfileSettings whether we have finished this map already if (!bAllPickupsFoundThisMap) { bAllPickupsFoundThisMap = true; FinalMsg = Localize("ToastMessages","AllPickupsOneMap","UTGameUI"); // Display toast class'UTUIScene'.static.ShowOnlineToast(FinalMsg); // UTPlayerController(Owner).SaveProfile(); } } defaultproperties { LastKillTime=-5.000000 VoiceClass=Class'UTGame.UTVoice_DefaultMale' DefaultHudColor=(B=255,G=255,R=64,A=255) CharacterMeshTeamNum=255 SinglePlayerCharacterIndex=-1 CharPortrait=Texture2D'CH_IronGuard_Headshot.T_IronGuard_HeadShot_DM' CharacterCacheClass=Class'UTGame.UTProcessedCharacterCache' HeroThreshold=20.000000 WeaponAwardIndex=-1 StringUnknown="Midfield" Name="Default__UTPlayerReplicationInfo" ObjectArchetype=PlayerReplicationInfo'Engine.Default__PlayerReplicationInfo' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |