Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UTGame.UTPawn


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658
01659
01660
01661
01662
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722
01723
01724
01725
01726
01727
01728
01729
01730
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795
01796
01797
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818
01819
01820
01821
01822
01823
01824
01825
01826
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061
02062
02063
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106
02107
02108
02109
02110
02111
02112
02113
02114
02115
02116
02117
02118
02119
02120
02121
02122
02123
02124
02125
02126
02127
02128
02129
02130
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169
02170
02171
02172
02173
02174
02175
02176
02177
02178
02179
02180
02181
02182
02183
02184
02185
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237
02238
02239
02240
02241
02242
02243
02244
02245
02246
02247
02248
02249
02250
02251
02252
02253
02254
02255
02256
02257
02258
02259
02260
02261
02262
02263
02264
02265
02266
02267
02268
02269
02270
02271
02272
02273
02274
02275
02276
02277
02278
02279
02280
02281
02282
02283
02284
02285
02286
02287
02288
02289
02290
02291
02292
02293
02294
02295
02296
02297
02298
02299
02300
02301
02302
02303
02304
02305
02306
02307
02308
02309
02310
02311
02312
02313
02314
02315
02316
02317
02318
02319
02320
02321
02322
02323
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337
02338
02339
02340
02341
02342
02343
02344
02345
02346
02347
02348
02349
02350
02351
02352
02353
02354
02355
02356
02357
02358
02359
02360
02361
02362
02363
02364
02365
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378
02379
02380
02381
02382
02383
02384
02385
02386
02387
02388
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398
02399
02400
02401
02402
02403
02404
02405
02406
02407
02408
02409
02410
02411
02412
02413
02414
02415
02416
02417
02418
02419
02420
02421
02422
02423
02424
02425
02426
02427
02428
02429
02430
02431
02432
02433
02434
02435
02436
02437
02438
02439
02440
02441
02442
02443
02444
02445
02446
02447
02448
02449
02450
02451
02452
02453
02454
02455
02456
02457
02458
02459
02460
02461
02462
02463
02464
02465
02466
02467
02468
02469
02470
02471
02472
02473
02474
02475
02476
02477
02478
02479
02480
02481
02482
02483
02484
02485
02486
02487
02488
02489
02490
02491
02492
02493
02494
02495
02496
02497
02498
02499
02500
02501
02502
02503
02504
02505
02506
02507
02508
02509
02510
02511
02512
02513
02514
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560
02561
02562
02563
02564
02565
02566
02567
02568
02569
02570
02571
02572
02573
02574
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586
02587
02588
02589
02590
02591
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606
02607
02608
02609
02610
02611
02612
02613
02614
02615
02616
02617
02618
02619
02620
02621
02622
02623
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636
02637
02638
02639
02640
02641
02642
02643
02644
02645
02646
02647
02648
02649
02650
02651
02652
02653
02654
02655
02656
02657
02658
02659
02660
02661
02662
02663
02664
02665
02666
02667
02668
02669
02670
02671
02672
02673
02674
02675
02676
02677
02678
02679
02680
02681
02682
02683
02684
02685
02686
02687
02688
02689
02690
02691
02692
02693
02694
02695
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705
02706
02707
02708
02709
02710
02711
02712
02713
02714
02715
02716
02717
02718
02719
02720
02721
02722
02723
02724
02725
02726
02727
02728
02729
02730
02731
02732
02733
02734
02735
02736
02737
02738
02739
02740
02741
02742
02743
02744
02745
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760
02761
02762
02763
02764
02765
02766
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781
02782
02783
02784
02785
02786
02787
02788
02789
02790
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801
02802
02803
02804
02805
02806
02807
02808
02809
02810
02811
02812
02813
02814
02815
02816
02817
02818
02819
02820
02821
02822
02823
02824
02825
02826
02827
02828
02829
02830
02831
02832
02833
02834
02835
02836
02837
02838
02839
02840
02841
02842
02843
02844
02845
02846
02847
02848
02849
02850
02851
02852
02853
02854
02855
02856
02857
02858
02859
02860
02861
02862
02863
02864
02865
02866
02867
02868
02869
02870
02871
02872
02873
02874
02875
02876
02877
02878
02879
02880
02881
02882
02883
02884
02885
02886
02887
02888
02889
02890
02891
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905
02906
02907
02908
02909
02910
02911
02912
02913
02914
02915
02916
02917
02918
02919
02920
02921
02922
02923
02924
02925
02926
02927
02928
02929
02930
02931
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943
02944
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955
02956
02957
02958
02959
02960
02961
02962
02963
02964
02965
02966
02967
02968
02969
02970
02971
02972
02973
02974
02975
02976
02977
02978
02979
02980
02981
02982
02983
02984
02985
02986
02987
02988
02989
02990
02991
02992
02993
02994
02995
02996
02997
02998
02999
03000
03001
03002
03003
03004
03005
03006
03007
03008
03009
03010
03011
03012
03013
03014
03015
03016
03017
03018
03019
03020
03021
03022
03023
03024
03025
03026
03027
03028
03029
03030
03031
03032
03033
03034
03035
03036
03037
03038
03039
03040
03041
03042
03043
03044
03045
03046
03047
03048
03049
03050
03051
03052
03053
03054
03055
03056
03057
03058
03059
03060
03061
03062
03063
03064
03065
03066
03067
03068
03069
03070
03071
03072
03073
03074
03075
03076
03077
03078
03079
03080
03081
03082
03083
03084
03085
03086
03087
03088
03089
03090
03091
03092
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112
03113
03114
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151
03152
03153
03154
03155
03156
03157
03158
03159
03160
03161
03162
03163
03164
03165
03166
03167
03168
03169
03170
03171
03172
03173
03174
03175
03176
03177
03178
03179
03180
03181
03182
03183
03184
03185
03186
03187
03188
03189
03190
03191
03192
03193
03194
03195
03196
03197
03198
03199
03200
03201
03202
03203
03204
03205
03206
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217
03218
03219
03220
03221
03222
03223
03224
03225
03226
03227
03228
03229
03230
03231
03232
03233
03234
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251
03252
03253
03254
03255
03256
03257
03258
03259
03260
03261
03262
03263
03264
03265
03266
03267
03268
03269
03270
03271
03272
03273
03274
03275
03276
03277
03278
03279
03280
03281
03282
03283
03284
03285
03286
03287
03288
03289
03290
03291
03292
03293
03294
03295
03296
03297
03298
03299
03300
03301
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311
03312
03313
03314
03315
03316
03317
03318
03319
03320
03321
03322
03323
03324
03325
03326
03327
03328
03329
03330
03331
03332
03333
03334
03335
03336
03337
03338
03339
03340
03341
03342
03343
03344
03345
03346
03347
03348
03349
03350
03351
03352
03353
03354
03355
03356
03357
03358
03359
03360
03361
03362
03363
03364
03365
03366
03367
03368
03369
03370
03371
03372
03373
03374
03375
03376
03377
03378
03379
03380
03381
03382
03383
03384
03385
03386
03387
03388
03389
03390
03391
03392
03393
03394
03395
03396
03397
03398
03399
03400
03401
03402
03403
03404
03405
03406
03407
03408
03409
03410
03411
03412
03413
03414
03415
03416
03417
03418
03419
03420
03421
03422
03423
03424
03425
03426
03427
03428
03429
03430
03431
03432
03433
03434
03435
03436
03437
03438
03439
03440
03441
03442
03443
03444
03445
03446
03447
03448
03449
03450
03451
03452
03453
03454
03455
03456
03457
03458
03459
03460
03461
03462
03463
03464
03465
03466
03467
03468
03469
03470
03471
03472
03473
03474
03475
03476
03477
03478
03479
03480
03481
03482
03483
03484
03485
03486
03487
03488
03489
03490
03491
03492
03493
03494
03495
03496
03497
03498
03499
03500
03501
03502
03503
03504
03505
03506
03507
03508
03509
03510
03511
03512
03513
03514
03515
03516
03517
03518
03519
03520
03521
03522
03523
03524
03525
03526
03527
03528
03529
03530
03531
03532
03533
03534
03535
03536
03537
03538
03539
03540
03541
03542
03543
03544
03545
03546
03547
03548
03549
03550
03551
03552
03553
03554
03555
03556
03557
03558
03559
03560
03561
03562
03563
03564
03565
03566
03567
03568
03569
03570
03571
03572
03573
03574
03575
03576
03577
03578
03579
03580
03581
03582
03583
03584
03585
03586
03587
03588
03589
03590
03591
03592
03593
03594
03595
03596
03597
03598
03599
03600
03601
03602
03603
03604
03605
03606
03607
03608
03609
03610
03611
03612
03613
03614
03615
03616
03617
03618
03619
03620
03621
03622
03623
03624
03625
03626
03627
03628
03629
03630
03631
03632
03633
03634
03635
03636
03637
03638
03639
03640
03641
03642
03643
03644
03645
03646
03647
03648
03649
03650
03651
03652
03653
03654
03655
03656
03657
03658
03659
03660
03661
03662
03663
03664
03665
03666
03667
03668
03669
03670
03671
03672
03673
03674
03675
03676
03677
03678
03679
03680
03681
03682
03683
03684
03685
03686
03687
03688
03689
03690
03691
03692
03693
03694
03695
03696
03697
03698
03699
03700
03701
03702
03703
03704
03705
03706
03707
03708
03709
03710
03711
03712
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726
03727
03728
03729
03730
03731
03732
03733
03734
03735
03736
03737
03738
03739
03740
03741
03742
03743
03744
03745
03746
03747
03748
03749
03750
03751
03752
03753
03754
03755
03756
03757
03758
03759
03760
03761
03762
03763
03764
03765
03766
03767
03768
03769
03770
03771
03772
03773
03774
03775
03776
03777
03778
03779
03780
03781
03782
03783
03784
03785
03786
03787
03788
03789
03790
03791
03792
03793
03794
03795
03796
03797
03798
03799
03800
03801
03802
03803
03804
03805
03806
03807
03808
03809
03810
03811
03812
03813
03814
03815
03816
03817
03818
03819
03820
03821
03822
03823
03824
03825
03826
03827
03828
03829
03830
03831
03832
03833
03834
03835
03836
03837
03838
03839
03840
03841
03842
03843
03844
03845
03846
03847
03848
03849
03850
03851
03852
03853
03854
03855
03856
03857
03858
03859
03860
03861
03862
03863
03864
03865
03866
03867
03868
03869
03870
03871
03872
03873
03874
03875
03876
03877
03878
03879
03880
03881
03882
03883
03884
03885
03886
03887
03888
03889
03890
03891
03892
03893
03894
03895
03896
03897
03898
03899
03900
03901
03902
03903
03904
03905
03906
03907
03908
03909
03910
03911
03912
03913
03914
03915
03916
03917
03918
03919
03920
03921
03922
03923
03924
03925
03926
03927
03928
03929
03930
03931
03932
03933
03934
03935
03936
03937
03938
03939
03940
03941
03942
03943
03944
03945
03946
03947
03948
03949
03950
03951
03952
03953
03954
03955
03956
03957
03958
03959
03960
03961
03962
03963
03964
03965
03966
03967
03968
03969
03970
03971
03972
03973
03974
03975
03976
03977
03978
03979
03980
03981
03982
03983
03984
03985
03986
03987
03988
03989
03990
03991
03992
03993
03994
03995
03996
03997
03998
03999
04000
04001
04002
04003
04004
04005
04006
04007
04008
04009
04010
04011
04012
04013
04014
04015
04016
04017
04018
04019
04020
04021
04022
04023
04024
04025
04026
04027
04028
04029
04030
04031
04032
04033
04034
04035
04036
04037
04038
04039
04040
04041
04042
04043
04044
04045
04046
04047
04048
04049
04050
04051
04052
04053
04054
04055
04056
04057
04058
04059
04060
04061
04062
04063
04064
04065
04066
04067
04068
04069
04070
04071
04072
04073
04074
04075
04076
04077
04078
04079
04080
04081
04082
04083
04084
04085
04086
04087
04088
04089
04090
04091
04092
04093
04094
04095
04096
04097
04098
04099
04100
04101
04102
04103
04104
04105
04106
04107
04108
04109
04110
04111
04112
04113
04114
04115
04116
04117
04118
04119
04120
04121
04122
04123
04124
04125
04126
04127
04128
04129
04130
04131
04132
04133
04134
04135
04136
04137
04138
04139
04140
04141
04142
04143
04144
04145
04146
04147
04148
04149
04150
04151
04152
04153
04154
04155
04156
04157
04158
04159
04160
04161
04162
04163
04164
04165
04166
04167
04168
04169
04170
04171
04172
04173
04174
04175
04176
04177
04178
04179
04180
04181
04182
04183
04184
04185
04186
04187
04188
04189
04190
04191
04192
04193
04194
04195
04196
04197
04198
04199
04200
04201
04202
04203
04204
04205
04206
04207
04208
04209
04210
04211
04212
04213
04214
04215
04216
04217
04218
04219
04220
04221
04222
04223
04224
04225
04226
04227
04228
04229
04230
04231
04232
04233
04234
04235
04236
04237
04238
04239
04240
04241
04242
04243
04244
04245
04246
04247
04248
04249
04250
04251
04252
04253
04254
04255
04256
04257
04258
04259
04260
04261
04262
04263
04264
04265
04266
04267
04268
04269
04270
04271
04272
04273
04274
04275
04276
04277
04278
04279
04280
04281
04282
04283
04284
04285
04286
04287
04288
04289
04290
04291
04292
04293
04294
04295
04296
04297
04298
04299
04300
04301
04302
04303
04304
04305
04306
04307
04308
04309
04310
04311
04312
04313
04314
04315
04316
04317
04318
04319
04320
04321
04322
04323
04324
04325
04326
04327
04328
04329
04330
04331
04332
04333
04334
04335
04336
04337
04338
04339
04340
04341
04342
04343
04344
04345
04346
04347
04348
04349
04350
04351
04352
04353
04354
04355
04356
04357
04358
04359
04360
04361
04362
04363
04364
04365
04366
04367
04368
04369
04370
04371
04372
04373
04374
04375
04376
04377
04378
04379
04380
04381
04382
04383
04384
04385
04386
04387
04388
04389
04390
04391
04392
04393
04394
04395
04396
04397
04398
04399
04400
04401
04402
04403
04404
04405
04406
04407
04408
04409
04410
04411
04412
04413
04414
04415
04416
04417
04418
04419
04420
04421
04422
04423
04424
04425
04426
04427
04428
04429
04430
04431
04432
04433
04434
04435
04436
04437
04438
04439
04440
04441
04442
04443
04444
04445
04446
04447
04448
04449
04450
04451
04452
04453
04454
04455
04456
04457
04458
04459
04460
04461
04462
04463
04464
04465
04466
04467
04468
04469
04470
04471
04472
04473
04474
04475
04476
04477
04478
04479
04480
04481
04482
04483
04484
04485
04486
04487
04488
04489
04490
04491
04492
04493
04494
04495
04496
04497
04498
04499
04500
04501
04502
04503
04504
04505
04506
04507
04508
04509
04510
04511
04512
04513
04514
04515
04516
04517
04518
04519
04520
04521
04522
04523
04524
04525
04526
04527
04528
04529
04530
04531
04532
04533
04534
04535
04536
04537
04538
04539
04540
04541
04542
04543
04544
04545
04546
04547
04548
04549
04550
04551
04552
04553
04554
04555
04556
04557
04558
04559
04560
04561
04562
04563
04564
04565
04566
04567
04568
04569
04570
04571
04572
04573
04574
04575
04576
04577
04578
04579
04580
04581
04582
04583
04584
04585
04586
04587
04588
04589
04590
04591
04592
04593
04594
04595
04596
04597
04598
04599
04600
04601
04602
04603
04604
04605
04606
04607
04608
04609
04610
04611
04612
04613
04614
04615
04616
04617
04618
04619
04620
04621
04622
04623
04624
04625
04626
04627
04628
04629
04630
04631
04632
04633
04634
04635
04636
04637
04638
04639
04640
04641
04642
04643
04644
04645
04646
04647
04648
04649
04650
04651
04652
04653
04654
04655
04656
04657
04658
04659
04660
04661
04662
04663
04664
04665
04666
04667
04668
04669
04670
04671
04672
04673
04674
04675
04676
04677
04678
04679
04680
04681
04682
04683
04684
04685
04686
04687
04688
04689
04690
04691
04692
04693
04694
04695
04696
04697
04698
04699
04700
04701
04702
04703
04704
04705
04706
04707
04708
04709
04710
04711
04712
04713
04714
04715
04716
04717
04718
04719
04720
04721
04722
04723
04724
04725
04726
04727
04728
04729
04730
04731
04732
04733
04734
04735
04736
04737
04738
04739
04740
04741
04742
04743
04744
04745
04746
04747
04748
04749
04750
04751
04752
04753
04754
04755
04756
04757
04758
04759
04760
04761
04762
04763
04764
04765
04766
04767
04768
04769
04770
04771
04772
04773
04774
04775
04776
04777
04778
04779
04780
04781
04782
04783
04784
04785
04786
04787
04788
04789
04790
04791
04792
04793
04794
04795
04796
04797
04798
04799
04800
04801
04802
04803
04804
04805
04806
04807
04808
04809
04810
04811
04812
04813
04814
04815
04816
04817
04818
04819
04820
04821
04822
04823
04824
04825
04826
04827
04828
04829
04830
04831
04832
04833
04834
04835
04836
04837
04838
04839
04840
04841
04842
04843
04844
04845
04846
04847
04848
04849
04850
04851
04852
04853
04854
04855
04856
04857
04858
04859
04860
04861
04862
04863
04864
04865
04866
04867
04868
04869
04870
04871
04872
04873
04874
04875
04876
04877
04878
04879
04880
04881
04882
04883
04884
04885
04886
04887
04888
04889
04890
04891
04892
04893
04894
04895
04896
04897
04898
04899
04900
04901
04902
04903
04904
04905
04906
04907
04908
04909
04910
04911
04912
04913
04914
04915
04916
04917
04918
04919
04920
04921
04922
04923
04924
04925
04926
04927
04928
04929
04930
04931
04932
04933
04934
04935
04936
04937
04938
04939
04940
04941
04942
04943
04944
04945
04946
04947
04948
04949
04950
04951
04952
04953
04954
04955
04956
04957
04958
04959
04960
04961
04962
04963
04964
04965
04966
04967
04968
04969
04970
04971
04972
04973
04974
04975
04976
04977
04978
04979
04980
04981
04982
04983
04984
04985
04986
04987
04988
04989
04990
04991
04992
04993
04994
04995
04996
04997
04998
04999
05000
05001
05002
05003
05004
05005
05006
05007
05008
05009
05010
05011
05012
05013
05014
05015
05016
05017
05018
05019
05020
05021
05022
05023
05024
05025
05026
05027
05028
05029
05030
05031
05032
05033
05034
05035
05036
05037
05038
05039
05040
05041
05042
05043
05044
05045
05046
05047
05048
05049
05050
05051
05052
05053
05054
05055
05056
05057
05058
05059
05060
05061
05062
05063
05064
05065
05066
05067
05068
05069
05070
05071
05072
05073
05074
05075
05076
05077
05078
05079
05080
05081
05082
05083
05084
05085
05086
05087
05088
05089
05090
05091
05092
05093
05094
05095
05096
05097
05098
05099
05100
05101
05102
05103
05104
05105
05106
05107
05108
05109
05110
05111
05112
05113
05114
05115
05116
05117
05118
05119
05120
05121
05122
05123
05124
05125
05126
05127
05128
05129
05130
05131
05132
05133
05134
05135
05136
05137
05138
05139
05140
05141
05142
05143
05144
05145
05146
05147
05148
05149
05150
05151
05152
05153
05154
05155
05156
05157
05158
05159
05160
05161
05162
05163
05164
05165
05166
05167
05168
05169
05170
05171
05172
05173
05174
05175
05176
05177
05178
05179
05180
05181
05182
05183
05184
05185
05186
05187
05188
05189
05190
05191
05192
05193
05194
05195
05196
05197
05198
05199
05200
05201
05202
05203
05204
05205
05206
05207
05208
05209
05210
05211
05212
05213
05214
05215
05216
05217
05218
05219
05220
05221
05222
05223
05224
05225
05226
05227
05228
05229
05230
05231
05232
05233
05234
05235
05236
05237
05238
05239
05240
05241
05242
05243
05244
05245
05246
05247
05248
05249
05250
05251
05252
05253
05254
05255
05256
05257
05258
05259
05260
05261
05262
05263
05264
05265
05266
05267
05268
05269
05270
05271
05272
05273
05274
05275
05276
05277
05278
05279
05280
05281
05282
05283
05284
05285
05286
05287
05288
05289
05290
05291
05292
05293
05294
05295
05296
05297
05298
05299
05300
05301
05302
05303
05304
05305
05306
05307
05308
05309
05310
05311
05312
05313
05314
05315
05316
05317
05318
05319
05320
05321
05322
05323
05324
05325
05326
05327
05328
05329
05330
05331
05332
05333
05334
05335
05336
05337
05338
05339
05340
05341
05342
05343
05344
05345
05346
05347
05348
05349
05350
05351
05352
05353
05354
05355
05356
05357
05358
05359
05360
05361
05362
05363
05364
05365
05366
05367
05368
05369
05370
05371
05372
05373
05374
05375
05376
05377
05378
05379
05380
05381
05382
05383
05384
05385
05386
05387
05388
05389
05390
05391
05392
05393
05394
05395
05396
05397
05398
05399
05400
05401
05402
05403
05404
05405
05406
05407
05408
05409
05410
05411
05412
05413
05414
05415
05416
05417
05418
05419
05420
05421
05422
05423
05424
05425
05426
05427
05428
05429
05430
05431
05432
05433
05434
05435
05436
05437
05438
05439
05440
05441
05442
05443
05444
05445
05446
05447
05448
05449
05450
05451
05452
05453
05454
05455
05456
05457
05458
05459
05460
05461
05462
05463
05464
05465
05466
05467
05468
05469
05470
05471
05472
05473
05474
05475
05476
05477
05478
05479
05480
05481
05482
05483
05484
05485
05486
05487
05488
05489
05490
05491
05492
05493
05494
05495
05496
05497
05498
05499
05500
05501
05502
05503
05504
05505
05506
05507
05508
05509
05510
05511
05512
05513
05514
05515
05516
05517
05518
05519
05520
05521
05522
05523
05524
05525
05526
05527
05528
05529
05530
05531
05532
05533
05534
05535
05536
05537
05538
05539
05540
05541
05542
05543
05544
05545
05546
05547
05548
05549
05550
05551
05552
05553
05554
05555
05556
05557
05558
05559
05560
05561
05562
05563
05564
05565
05566
05567
05568
05569
05570
05571
05572
05573
05574
05575
05576
05577
05578
05579
05580
05581
05582
05583
05584
05585
05586
05587
05588
05589
05590
05591
05592
05593
05594
05595
05596
05597
05598
05599
05600
05601
05602
05603
05604
05605
05606
05607
05608
05609
05610
05611
05612
05613
05614
05615
05616
05617
05618
05619
05620
05621
05622
05623
05624
05625
05626
05627
05628
05629
05630
05631
05632
05633
05634
05635
05636
05637
05638
05639
05640
05641
05642
05643
05644
05645
05646
05647
05648
05649
05650
05651
05652
05653
05654
05655
05656
05657
05658
05659
05660
05661
05662
05663
05664
05665
05666
05667
05668
05669
05670
05671
05672
05673
05674
05675
05676
05677
05678
05679
05680
05681
05682
05683
05684
05685
05686
05687
05688
05689
05690
05691
05692
05693
05694
05695
05696
05697
05698
05699
05700
05701
05702
05703
05704
05705
05706
05707
05708
05709
05710
05711
05712
05713
05714
05715
05716
05717
05718
05719
05720
05721
05722
05723
05724
05725
05726
05727
05728
05729
05730
05731
05732
05733
05734
05735
05736
05737
05738
05739
05740
05741
05742
05743
05744
05745
05746
05747
05748
05749
05750
05751
05752
05753
05754
05755
05756
05757
05758
05759
05760
05761
05762
05763
05764
05765
05766
05767
05768
05769
05770
05771
05772
05773
05774
05775
05776
05777
05778
05779
05780
05781
05782
05783
05784
05785
05786
05787
05788
05789
05790
05791
05792
05793
05794
05795
05796
05797
05798
05799
05800
05801
05802
05803
05804
05805
05806
05807
05808
05809
05810
05811
05812
05813
05814
05815
05816
05817
05818
05819
05820
05821
05822
05823
05824
05825
05826
05827
05828
05829
05830
05831
05832
05833
05834
05835
05836
05837
05838
05839
05840
05841
05842
05843
05844
05845
05846
05847
05848
05849
05850
05851
05852
05853
05854
05855
05856
05857
05858
05859
05860
05861
05862
05863
05864
05865
05866
05867
05868
05869
05870
05871
05872
05873
05874
05875
05876
05877
05878
05879
05880
05881
05882
05883
05884
05885
05886
05887
05888
05889
05890
05891
05892
05893
05894
05895
05896
05897
05898
05899
05900
05901
05902
05903
05904
05905
05906
05907
05908
05909
05910
05911
05912
05913
05914
05915
05916
05917
05918
05919
05920
05921
05922
05923
05924
05925
05926
05927
05928
05929
05930
05931
05932
05933
05934
05935
05936
05937
05938
05939
05940
05941
05942
05943
05944
05945
05946
05947
05948
05949
05950
05951
05952
05953
05954
05955
05956
05957
05958
05959
05960
05961
05962
05963
05964
05965
05966
05967
05968
05969
05970
05971
05972
05973
05974
05975
05976
05977
05978
05979
05980
05981
05982
05983
05984
05985
05986
05987
05988
05989
05990
05991
05992
05993
05994
05995
05996
05997
05998
05999
06000
06001
06002
06003
06004
06005
06006
06007
06008
06009
06010
06011
06012
06013
06014
06015
06016
06017
06018
06019
06020
06021
06022
06023
06024
06025
06026
06027
06028
06029
06030
06031
06032
06033
06034
06035
06036
06037
06038
06039
06040
06041
06042
06043
06044
06045
06046
06047
06048
06049
06050
06051
06052
06053
06054
06055
06056
06057
06058
06059
06060
06061
06062
06063
06064
06065
06066
06067
06068
06069
06070
06071
06072
06073
06074
06075
06076
06077
06078
06079
06080
06081
06082
06083
06084
06085
06086
06087
06088
06089
06090
06091
06092
06093
06094
06095
06096
06097
06098
06099
06100
06101
06102
06103
06104
06105
06106
06107
06108
06109
06110
06111
06112
06113
06114
06115
06116
06117
06118
06119
06120
06121
06122
06123
06124
06125
06126
06127
06128
06129
06130
06131
06132
06133
06134
06135
06136
06137
06138
06139
06140
06141
06142
06143
06144
06145
06146
06147
06148
06149
06150
06151
06152
06153
06154
06155
06156
06157
06158
06159
06160
06161
06162
06163
06164
06165
06166
06167
06168
06169
06170
06171
06172
06173
06174
06175
06176
06177
06178
06179
06180
06181
06182
06183
06184
06185
06186
06187
06188
06189
06190
06191
06192
06193
06194
06195
06196
06197
06198
06199
06200
06201
06202
06203
06204
06205
06206
06207
06208
06209
06210
06211
06212
06213
06214
06215
06216
06217
06218
06219
06220
06221
06222
06223
06224
06225
06226
06227
06228
06229
06230
06231
06232
06233
06234
06235
06236
06237
06238
06239
06240
06241
06242
06243
06244
06245
06246
06247
06248
06249
06250
06251
06252
06253
06254
06255
06256
06257
06258
06259
06260
06261
06262
06263
06264
06265
06266
06267
06268
06269
06270
06271
06272
06273
06274
06275
06276
06277
06278
06279
06280
06281
06282
06283
06284
06285
06286
06287
06288
06289
06290
06291
06292
06293
06294
06295
06296
06297
06298
06299
06300
06301
06302
06303
06304
06305
06306
06307
06308
06309
06310
06311
06312
06313
06314
06315
06316
06317
06318
06319
06320
06321
06322
06323
06324
06325
06326
06327
06328
06329
06330
06331
06332
06333
06334
06335
06336
06337
06338
06339
06340
06341
06342
06343
06344
06345
06346
06347
06348
06349
06350
06351
06352
06353
06354
06355
06356
06357
06358
06359
06360
06361
06362
06363
06364
06365
06366
06367
06368
06369
06370
06371
06372
06373
06374
06375
06376
06377
06378
06379
06380
06381
06382
06383
06384
06385
06386
06387
06388
06389
06390
06391
06392
06393
06394
06395
06396
06397
06398
06399
06400
06401
06402
06403
06404
06405
06406
06407
06408
06409
06410
06411
06412
06413
06414
06415
06416
06417
06418
06419
06420
06421
06422
06423
06424
06425
06426
06427
06428
06429
06430
06431
06432
06433
06434
06435
06436
06437
06438
06439
06440
06441
06442
06443
06444
06445
06446
06447
06448
06449
06450
06451
06452
06453
06454
06455
06456
06457
06458
06459
06460
06461
06462
06463
06464
06465
06466
06467
06468
06469
06470
06471
06472
06473
06474
06475
06476
06477
06478
06479
06480
06481
06482
06483
06484
06485
06486
06487
06488
06489
06490
06491
06492
06493
06494
06495
06496
06497
06498
06499
06500
06501
06502
06503
06504
06505
06506
06507
06508
06509
06510
06511
06512
06513
06514
06515
06516
06517
06518
06519
06520
06521
06522
06523
06524
06525
06526
06527
06528
06529
06530
06531
06532
06533
06534
06535
06536
06537
06538
06539
06540
06541
06542
06543
06544
06545
06546
06547
06548
06549
06550
06551
06552
06553
06554
06555
06556
06557
06558
06559
06560
06561
06562
06563
06564
06565
06566
06567
06568
06569
06570
06571
06572
06573
06574
06575
06576
06577
06578
06579
06580
06581
06582
06583
06584
06585
06586
06587
06588
06589
06590
06591
06592
06593
06594
06595
06596
06597
06598
06599
06600
06601
06602
06603
06604
06605
06606
06607
06608
06609
06610
06611
06612
06613
06614
06615
06616
06617
06618
06619
06620
06621
06622
06623
06624
06625
06626
06627
06628
06629
06630
06631
06632
06633
06634
06635
06636
06637
06638
06639
06640
06641
06642
06643
06644
06645
06646
06647
06648
06649
06650
06651
06652
06653
06654
06655
06656
06657
06658
06659
06660
06661
06662
06663
06664
06665
06666
/**
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 */
class UTPawn extends GamePawn
	config(Game)
	dependson(UTWeaponAttachment)
	dependson(UTEmitter)
	dependson(UTFamilyInfo)
	native
	nativereplication
	notplaceable;

var		bool	bFixedView;
var		bool	bIsTyping;				// play typing anim if idle
var		bool	bSpawnDone;				// true when spawn protection has been deactivated
var		bool	bSpawnIn;
var		bool	bShieldAbsorb;			// set true when shield absorbs damage
var		bool	bDodging;				// true while in air after dodging
var		bool	bNoJumpAdjust;			// set to tell controller not to modify velocity of a jump/fall
var		bool	bStopOnDoubleLanding;
var		bool	bReadyToDoubleJump;
var		bool	bIsInvulnerable;
var		bool	bJustDroppedOrb;		// if orb dropped because knocked off hoverboard

/** whether this Pawn is invisible. Affects AI and also causes shadows to be disabled */
var repnotify bool bIsInvisible;

/** true when in ragdoll due to feign death */
var repnotify bool bFeigningDeath;
/** count of failed unfeign attempts - kill pawn if too many */
var int UnfeignFailedCount;

/** true while playing feign death recovery animation */
var bool bPlayingFeignDeathRecovery;
/** true when feign death activation forced (e.g. knocked off hoverboard) */
var bool bForcedFeignDeath;

/** The pawn's light environment */
var DynamicLightEnvironmentComponent LightEnvironment;

/** anim node used for feign death recovery animations */
var AnimNodeBlend FeignDeathBlend;

/** Slot node used for playing full body anims. */
var AnimNodeSlot FullBodyAnimSlot;

/** Slot node used for playing animations only on the top half. */
var AnimNodeSlot TopHalfAnimSlot;

var(DeathAnim)	float	DeathHipLinSpring;
var(DeathAnim)	float	DeathHipLinDamp;
var(DeathAnim)	float	DeathHipAngSpring;
var(DeathAnim)	float	DeathHipAngDamp;

/** World time that we started the death animation */
var				float	StartDeathAnimTime;
/** Type of damage that started the death anim */
var				class<UTDamageType> DeathAnimDamageType;
/** Time that we took damage of type DeathAnimDamageType. */
var				float	TimeLastTookDeathAnimDamage;

/** Struct used for communicating info to play an emote from server to clients. */
struct native PlayEmoteInfo
{
	var	name	EmoteTag;
	var int		EmoteID;
	var bool	bNewData;
};

/** Used to replicate on emote to play. */
var repnotify PlayEmoteInfo EmoteRepInfo;

/** Last time emote was played. */
var	float	LastEmoteTime;

/** Controls how often you can send an emote. */
var float	MinTimeBetweenEmotes;

/** Duration of current emote */
var float   CurrentEmoteDuration;


/** Struct used for communicating info to play an emote from server to clients. */
struct native PlayAnimInfo
{
	var name AnimName;
	var bool bLooping;
	var bool bNewData;
};

/** Used to replicate on emote to play. */
var repnotify PlayAnimInfo AnimRepInfo;


var	bool		bUpdateEyeheight;		/** if true, UpdateEyeheight will get called every tick */
var	globalconfig bool bWeaponBob;
var bool		bJustLanded;			/** used by eyeheight adjustment.  True if pawn recently landed from a fall */
var bool		bLandRecovery;			/** used by eyeheight adjustment. True if pawn recovering (eyeheight increasing) after lowering from a landing */

var bool	bComponentDebug;

/** Use to replicate to clients when someone goes through a big teleportation. */
var repnotify byte BigTeleportCount;

/*********************************************************************************************
 Camera related properties
********************************************************************************************* */
var vector 	FixedViewLoc;
var rotator FixedViewRot;
var float CameraScale, CurrentCameraScale; /** multiplier to default camera distance */
var float CameraScaleMin, CameraScaleMax;

/** Stop death camera using OldCameraPosition if true */
var bool bStopDeathCamera;

/** OldCameraPosition saved when dead for use if fall below killz */
var vector OldCameraPosition;

/** used to smoothly adjust camera z offset in third person */
var float CameraZOffset;

/** If true, use end of match "Hero" camera */
var bool bWinnerCam;

/** Used for end of match "Hero" camera */
var(HeroCamera) float HeroCameraScale;

/** Used for end of match "Hero" camera */
var(HeroCamera) int HeroCameraPitch;

var		bool	bCanDoubleJump;
var		bool	bRequiresDoubleJump;		/** set by suggestjumpvelocity() */
var		float	DodgeSpeed;
var		float	DodgeSpeedZ;
var		eDoubleClickDir CurrentDir;
var		int		MultiJumpRemaining;
var		int		MultiDodgeRemaining;	// Not strictly supported, more an exploit fix
var		int		MaxMultiJump;
var		int		MaxMultiDodge;
var		int		MultiJumpBoost;
var		float	MaxDoubleJumpHeight;
var		float	SlopeBoostFriction;			// which materials allow slope boosting
var()	float	DoubleJumpEyeHeight;
var		float	DoubleJumpThreshold;
var		int		MaxLeanRoll;		/** how much pawn should lean into turns */
var		float	DefaultAirControl;
var		float	DodgeResetTime;			// Limits the time between one dodge finishing and another beginning
var		float	DodgeResetTimestamp;

/** view bob properties */
var	globalconfig	float	Bob;
var					float	LandBob;
var					float	JumpBob;
var					float	AppliedBob;
var					float	bobtime;
var					vector	WalkBob;

/** when a body in feign death's velocity is less than this, it is considered to be at rest (allowing the player to get up) */
var float FeignDeathBodyAtRestSpeed;
/** speed at which physics is blended out when bPlayingFeignDeathRecovery is true (amount subtracted from PhysicsWeight per second) */
var float FeignDeathPhysicsBlendOutSpeed;

/** when we entered feign death; used to increase FeignDeathBodyAtRestSpeed over time so we get up in a reasonable amount of time */
var float FeignDeathStartTime;

/** When feign death recovery started.  Used to pull feign death camera into body during recovery */
var float FeignDeathRecoveryStartTime;

var int  SuperHealthMax;					/** Maximum allowable boosted health */

var int	 Twisting;  // 0 = Not twisting, 1=twisting Left, -1 = Twisting Right

var class<UTPawnSoundGroup> SoundGroupClass;

/** This pawn's current family info **/
var class<UTFamilyInfo> CurrFamilyInfo;


/** bio death effect - updates BioEffectName parameter in the mesh's materials from 0 to 10 over BioBurnAwayTime
 * activated BioBurnAway particle system on death, deactivates it when BioBurnAwayTime expires
 * could easily be overridden by a custom death effect to use other effects/materials, @see UTDmgType_BioGoo
 */
var bool bKilledByBio;
var ParticleSystemComponent BioBurnAway;
var float BioBurnAwayTime;
var name BioEffectName;

/** bones to set fixed when doing the physics take hit effects */
var array<name> TakeHitPhysicsFixedBones;

/** Array of bodies that should not have joint drive applied. */
var array<name> NoDriveBodies;

/** A mesh that plays for the dying player in first person; e.g. Spidermine face-attac
 * this is just a convenient holder for the component that can be added by the DamageType; the DamageType itself handles setting it up
 * using UTDamageType::CalcDeathCamera() (when is has bSpecialDeathCamera set to true)
 */
var SkeletalMeshComponent FirstPersonDeathVisionMesh;
/** Light environment for FirstPersonDeathVisionMesh */
var LightEnvironmentComponent FirstPersonDeathVisionLightEnvironment;
/** True when the FirstPersonDeathVisionMesh has been initialized */
var bool bSetupDeathLight;

/** Whether this pawn can play a falling impact. Set to false upon the fall, but getting up should reset it */
var bool bCanPlayFallingImpacts;
/** time above bool was set to true (for time out)*/
var float StartFallImpactTime;
/** name of the torso bone for playing impacts*/
var name TorsoBoneName;
/** sound to be played by Falling Impact*/
var SoundCue FallImpactSound;
/** Speed change that must be realized to trigger a fall sound*/
var float FallSpeedThreshold;

/** replicated information on a hit we've taken */
struct native TakeHitInfo
{
	/** the amount of damage */
	var int Damage;
	/** the location of the hit */
	var vector HitLocation;
	/** how much momentum was imparted */
	var vector Momentum;
	/** the damage type we were hit with */
	var class<DamageType> DamageType;
	/** the bone that was hit on our Mesh (if any) */
	var name HitBone;
};
var repnotify TakeHitInfo LastTakeHitInfo;
/** stop considering LastTakeHitInfo for replication when world time passes this (so we don't replicate out-of-date hits when pawns become relevant) */
var float LastTakeHitTimeout;
/** if set, blend Mesh PhysicsWeight to 0.0 in C++ and call TakeHitBlendedOut() event when finished */
var bool bBlendOutTakeHitPhysics;
/** speed at which physics is blended out when bBlendOutTakeHitPhysics is true (amount subtracted from PhysicsWeight per second) */
var float TakeHitPhysicsBlendOutSpeed;

/** Controller vibration for taking falling damage. */
var ForceFeedbackWaveform FallingDamageWaveForm;

/** Controller vibration for feigning death. */
var ForceFeedbackWaveform FeignDeathWaveForm;

/*********************************************************************************************
 Aiming
 ********************************************************************************************* */

/** Current yaw of the mesh root. This essentially lags behind the actual Pawn rotation yaw. */
var int	RootYaw;

/** Output - how quickly RootYaw is changing (unreal rot units per second). */
var float RootYawSpeed;

/** How far RootYaw differs from Rotation.Yaw before it is rotated to catch up. */
var() int	MaxYawAim;

/** 2D vector indicating aim direction relative to Pawn rotation. +/-1.0 indicating 180 degrees. */
var vector2D CurrentSkelAim;

var SkelControlSingleBone	RootRotControl;
var	AnimNodeAimOffset		AimNode;
var GameSkelCtrl_Recoil		GunRecoilNode;
var GameSkelCtrl_Recoil		LeftRecoilNode;
var GameSkelCtrl_Recoil		RightRecoilNode;

/** Used for smoothing client aiming pitch */
var float SavedAimPitch;

/*********************************************************************************************
  Gibs
********************************************************************************************* */

/** Track damage accumulated during a tick - used for gibbing determination */
var float AccumulateDamage;

/** Tick time for which damage is being accumulated */
var float AccumulationTime;

/** whether or not we have been gibbed already */
var bool bGibbed;

/** whether or not we have been decapitated already */
var bool bHeadGibbed;

/* Replicated when torn off body should gib */
var bool bTearOffGibs;

/*********************************************************************************************
 Hoverboard
********************************************************************************************* */
var		bool			bHasHoverboard;
var		float			LastHoverboardTime;
var		float			MinHoverboardInterval;
var		bool			bIsHoverboardAnimPawn;

/** Node used for blending between driving and non-driving state. */
var		UTAnimBlendByDriving DrivingNode;

/** Node used for blending between different types of vehicle. */
var		UTAnimBlendByVehicle VehicleNode;

/** Node used for various hoverboarding actions. */
var		UTAnimBlendByHoverboarding HoverboardingNode;

/*********************************************************************************************
 Armor
********************************************************************************************* */
var float ShieldBeltArmor;
var float VestArmor;
var float ThighpadArmor;
var float HelmetArmor;
/** class to spawn if shield belt is stolen; should be set by pickup that adds ShieldBeltArmor */
var class<UTDroppedItemPickup> ShieldBeltPickupClass;

/*********************************************************************************************
 Weapon / Firing
********************************************************************************************* */

var bool bArmsAttached;
var UTSkeletalMeshComponent ArmsMesh[2]; // left and right arms, respectively.
var UTSkeletalMeshComponent ArmsOverlay[2];

/** Holds the class type of the current weapon attachment.  Replicated to all clients. */
var	repnotify	class<UTWeaponAttachment>	CurrentWeaponAttachmentClass;
/** This holds the local copy of the current attachment.  This "attachment" actor will exist independantly on all clients */
var				UTWeaponAttachment			CurrentWeaponAttachment;
/** client side flag indicating whether attachment should be visible - primarily used when spawning the initial weapon attachment
 * as events that change its visibility might have happened before we received a CurrentWeaponAttachmentClass
 * to spawn and call the visibility functions on
 */
var bool bWeaponAttachmentVisible;

/** WeaponSocket contains the name of the socket used for attaching weapons to this pawn. */
var name WeaponSocket, WeaponSocket2;

/** Socket to find the feet */
var name PawnEffectSockets[2];

/** whether we are dual-wielding our current weapon, passed to attachment to set up second mesh/anims */
var repnotify bool bDualWielding;
/** set when pawn is putting away its current weapon, for playing 3p animations - access with Set/GetPuttingDownWeapon() */
var protected repnotify bool bPuttingDownWeapon;

var repnotify float FireRateMultiplier; /** affects firing rate of all weapons held by this pawn. */

/** These values are used for determining headshots */
var float			HeadOffset;
var float           HeadRadius;
var float           HeadHeight;
var name			HeadBone;
var repnotify float HeadScale;
/** We need to save a reference to the headshot neck attachment for the case of:  Headshot then gibbed  so we can hide this **/
var protected StaticMeshComponent HeadshotNeckAttachment;

var class<Actor> TransInEffects[2];
var class<Actor> TransOutEffects[2];
var	LinearColor  TranslocateColor[2];
/** camera anim played when spawned/teleported */
var CameraAnim TransCameraAnim[3];

/** pawn ambient sound (for powerups and such) */
var protected AudioComponent PawnAmbientSound;
/** ambient cue played on PawnAmbientSound component; automatically replicated and played on clients. Access via SetPawnAmbientSound() / GetPawnAmbientSound() */
var protected repnotify SoundCue PawnAmbientSoundCue;

/** separate replicated ambient sound for weapon firing - access via SetWeaponAmbientSound() / GetWeaponAmbientSound() */
var protected AudioComponent WeaponAmbientSound;
var protected repnotify SoundCue WeaponAmbientSoundCue;

var SoundCue ArmorHitSound;
/** sound played when initially spawning in */
var SoundCue SpawnSound;
/** sound played when we teleport */
var SoundCue TeleportSound;

/** Set when pawn died on listen server, but was hidden rather than ragdolling (for replication purposes) */
var bool bHideOnListenServer;

/*********************************************************************************************
  Overlay system

  UTPawns support 2 separate overlay systems.   The first is a simple colorizer that can be used to
  apply a color to the pawn's skin.  This is accessed via the
********************************************************************************************* */

/** How long will it take for the current Body Material to fade out */
var float BodyMatFadeDuration;

/** how much time is left on this material */
var float RemainingBodyMatDuration;

/** This variable is used for replication of the value to remove clients */
var repnotify float ClientBodyMatDuration;

/** This is the color that will be applied */
var LinearColor BodyMatColor;

/** Replicate BodyMatColor as rotator to save bandwidth */
var repnotify rotator CompressedBodyMatColor;

/** This is the current Body Material Color with any fading applied in */
var LinearColor CurrentBodyMatColor;

/** This is the color that will be applied when a pawn is first spawned in and is covered by protection */
var	LinearColor SpawnProtectionColor;

/** material parameter containing damage overlay color */
var name DamageParameterName;
/** material parameter containing color saturation multiplier (for reducing to account for zoom) */
var name SaturationParameterName;

/** This is the actual Material Instance that is used to affect the colors */
var protected array<MaterialInstanceConstant> BodyMaterialInstances;

/** material that is overlayed on the pawn via a separate slightly larger scaled version of the pawn's mesh
 * Use SetOverlayMaterial()  / GetOverlayMaterial() to access. */
var protected repnotify MaterialInterface OverlayMaterialInstance;

/** mesh for overlay - should not be added to Components array in defaultproperties */
var protected SkeletalMeshComponent OverlayMesh;

/** The weapon overlay meshes need to be controlled by the pawn due to replication.  We use */
/** a bitmask to describe what effect needs to be overlay.  								*/
/**																							*/
/** 0x00 = No Overlays																		*/
/** bit 0 (0x01) = Damage Amp																*/
/** bit 1 (0x02) = Berserk																	*/
/**																							*/
/** Use SetWeaponOverlayFlag() / ClearWeaponOverlayFlag to adjust							*/

var repnotify byte WeaponOverlayFlags;

/** True if XRay effect is current */
var bool bXRayEffectActive;
/** Damage multiplier for when XRay effect is Active */ 
var float XRayEffectDamageMult;

var LightEnvironmentComponent XRayEffectLightEnvironment;

/*********************************************************************************************
* Team beacons
********************************************************************************************* */
var(TeamBeacon) float      TeamBeaconMaxDist;
var(TeamBeacon) float      TeamBeaconPlayerInfoMaxDist;
var(TeamBeacon) Texture    SpeakingBeaconTexture;

/** Last time trace test check for drawing postrender beacon was performed */
var float LastPostRenderTraceTime;

/** true is last trace test check for drawing postrender beacon succeeded */
var bool bPostRenderTraceSucceeded;

/** If true, call postrenderfor() even if on different team */
var bool bPostRenderOtherTeam;

/*********************************************************************************************
* HUD Icon
********************************************************************************************* */
var vector HUDLocation;
var float MapSize;
var TextureCoordinates IconCoords;	/** Coordiates of the icon associated with this object */
/*********************************************************************************************
* Pain
********************************************************************************************* */
const MINTIMEBETWEENPAINSOUNDS=0.35;
var			float		LastPainSound;
var float DeathTime;
var int LookYaw;	// The Yaw Used to looking around
var float RagdollLifespan;
var UTProjectile AttachedProj;

/*********************************************************************************************
* Foot placement IK system
********************************************************************************************* */
var name			LeftFootBone, RightFootBone;
var name			LeftFootControlName, RightFootControlName;
var float			BaseTranslationOffset;
var float			CrouchTranslationOffset;
var float			OldLocationZ;
var	bool			bEnableFootPlacement;
var const float		ZSmoothingRate;
/** if the pawn is farther than this away from the viewer, foot placement is skipped */
var float MaxFootPlacementDistSquared;
/** cached references to skeletal controllers for foot placement */
var SkelControlFootPlacement LeftLegControl, RightLegControl;

/** cached references to skeletal control for hand IK */
var SkelControlLimb			LeftHandIK;
var SkelControlLimb			RightHandIK;

/** Max distance from listener to play footstep sounds */
var float MaxFootstepDistSq;

/** Max distance from listener to play jump/land sounds */
var float MaxJumpSoundDistSq;

/** Translation applied to skeletalmesh when swimming */
var(Swimming) float SwimmingZOffset;
/** Speed to apply swimming z translation. */
var(Swimming) float SwimmingZOffsetSpeed;

var float CrouchMeshZOffset;

/*********************************************************************************************
* Custom gravity support
********************************************************************************************* */
var float CustomGravityScaling;		// scaling factor for this pawn's gravity - reset when pawn lands/changes physics modes
var bool bNotifyStopFalling;		// if true, StoppedFalling() is called when the physics mode changes from falling

/*********************************************************************************************
* Skin swapping support
********************************************************************************************* */
var repnotify Material ReplicatedBodyMaterial;

var array<UTBot> Trackers;

/** type of vehicle spawned when activating the hoverboard */
var class<UTVehicle> HoverboardClass;

/** base vehicle pawn is in, used when the pawn is driving a UTWeaponPawn as those don't get replicated to non-owning clients */
struct native DrivenWeaponPawnInfo
{
	/** base vehicle we're in */
	var UTVehicle BaseVehicle;
	/** seat of that vehicle */
	var byte SeatIndex;
	/** ref to PRI since our PlayerReplicationInfo variable will be None while in a vehicle */
	var PlayerReplicationInfo PRI;
};
var repnotify DrivenWeaponPawnInfo DrivenWeaponPawn, LastDrivenWeaponPawn;
/** reference WeaponPawn spawned on non-owning clients for code that checks for DrivenVehicle */
var UTClientSideWeaponPawn ClientSideWeaponPawn;

/** set on client when valid team info is received; future changes are then ignored unless this gets reset first
 * this is used to prevent the problem where someone changes teams and their old dying pawn changes color
 * because the team change was received before the pawn's dying
 * NOTE: Disused as it caused other problems, and doesn't fix the problem it's supposed to
 */
var bool bReceivedValidTeam;

/*********************************************************************************************
 * Hud Widgets
********************************************************************************************* */

/** The default overlay to use when not in a team game */
var MaterialInterface ShieldBeltMaterialInstance;
/** A collection of overlays to use in team games */
var MaterialInterface ShieldBeltTeamMaterialInstances[4];

/** default mesh, materials, and family when custom character mesh has not yet been constructed */
var class<UTFamilyInfo> DefaultFamily;
var SkeletalMesh DefaultMesh;
var Texture DefaultHeadPortrait;
var array<MaterialInterface> DefaultTeamMaterials;
var array<MaterialInterface> DefaultTeamHeadMaterials;
var array<Texture> DefaultTeamHeadPortrait;

/** If true, head size will change based on ratio of kills to deaths */
var bool bKillsAffectHead;

/** Mirrors the # of charges available to jump boots */
var int JumpBootCharge;

/** Mesh scaling default */
var float DefaultMeshScale;
/** currently desired scale of the hero (switches between crouched and default) */
var float DesiredMeshScale;

struct QuickPickCell
{
	var bool 				bDrawCell;
	var Texture2D   		Icon;
	var TextureCoordinates 	IconCoords;
	var float 				Weight;
};

/** last time Pawn was falling and had non-zero velocity
 * used to detect a rare bug where pawns get just barely embedded in a mesh and fall forever
 */
var float StartedFallingTime;

var name TauntNames[6];

/* Aura system (benefits to hero teammates) */
var float AuraRadius;
var float LastAuraCheckTime;
/** Indicates if this pawn is a hero. Not replicated */
var bool bClientIsHero;
/** Indicates if this pawn is performing a hero melee attack. Not replicated */
var bool bClientInHeroMelee;

/** Shown on HUD if superhero */
var float HeroStartTime;

/** standing collision size */
var float DefaultRadius, DefaultHeight;

/** AI hint - currently carrying slow field powerup */
var bool bHasSlowField;

/** whether pawn can ragdoll (feigning or forced) */
var bool bCanRagDoll;

/** Previous replicated velocity - used for leaning on clients */
var vector OldReplicatedVelocity;

/** Darkmatch Hack */
var PointLightComponent DarkMatchLight;

/** List of spidermines chasing me - used for aiming help vs spidermines on console */
var array<UTProj_SpiderMineBase> SpiderChasers;

/** Used to limit voice taunt frequency */
var float NextTauntTime;

/** Used to syncrhonize the players weapon at the start of serverside demo playback */
var repnotify Weapon DemoWeapon;

// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)

replication
{
	// replicated properties
	if ( bNetOwner && bNetDirty )
		ShieldBeltArmor, HelmetArmor, VestArmor, ThighpadArmor, bHasHoverboard, FireRateMultiplier;
	if ( bNetDirty )
		bFeigningDeath, CurrentWeaponAttachmentClass, bIsTyping, CompressedBodyMatColor, ClientBodyMatDuration,
		HeadScale, PawnAmbientSoundCue, WeaponAmbientSoundCue, ReplicatedBodyMaterial, OverlayMaterialInstance,
		WeaponOverlayFlags, CustomGravityScaling, bIsInvisible, BigTeleportCount;
	if(bNetDirty && WorldInfo.TimeSeconds - LastEmoteTime <= MinTimeBetweenEmotes)
		EmoteRepInfo;
	if (bNetDirty && WorldInfo.TimeSeconds < LastTakeHitTimeout)
		LastTakeHitInfo;
	if (bNetDirty && !bNetOwner)
		DrivenWeaponPawn, bDualWielding, bPuttingDownWeapon;
	// variable sent to all clients when Pawn has been torn off. (bTearOff)
	if( bTearOff && bNetDirty && (Role==ROLE_Authority) )
		bTearOffGibs;

	if (bNetInitial && bDemoRecording)
		DemoWeapon;
}

native function GetBoundingCylinder(out float CollisionRadius, out float CollisionHeight) const;

native function RestorePreRagdollCollisionComponent();

/** Util that makes sure the overlay component is last in the AllComponents array. */
native function EnsureOverlayComponentLast();

native simulated function vector GetTargetLocation(optional actor RequestedBy, optional bool bRequestAlternateLoc) const;

/*************************************************************
/ * Hero system stubs
*/
final native function bool HeroFits(UTPawn P, float NewRadius, float NewHeight);

final native function SetMaxStepHeight(float NewMaxStepHeight);

simulated function ActivateHero();

simulated event bool IsHero()
{
	return false;
}

/** Accessor to make sure we always get a valid UTPRI */
simulated function UTPlayerReplicationInfo GetUTPlayerReplicationInfo()
{
	local UTPlayerReplicationInfo UTPRI;

	UTPRI = UTPlayerReplicationInfo(PlayerReplicationInfo);
	if (UTPRI == None)
	{
		if (DrivenVehicle != None)
		{
			UTPRI = UTPlayerReplicationInfo(DrivenVehicle.PlayerReplicationInfo);
		}
	}

	return UTPRI;
}

event StoppedFalling()
{
	CustomGravityScaling = 1.0;
	bNotifyStopFalling = false;
}

simulated event FellOutOfWorld(class<DamageType> dmgType)
{
    super.FellOutOfWorld(DmgType);
    bStopDeathCamera = true;
}

event HeadVolumeChange(PhysicsVolume newHeadVolume)
{
	if ( (WorldInfo.NetMode == NM_Client) || (Controller == None) )
		return;
	if (HeadVolume != None && HeadVolume.bWaterVolume)
	{
		if ( !newHeadVolume.bWaterVolume || (UTSpaceVolume(newHeadVolume) != None) )
		{
			if ( Controller.bIsPlayer && (BreathTime > 0) && (BreathTime < 8) )
				Gasp();
			BreathTime = -1.0;
		}
	}
	else if ( newHeadVolume != None && newHeadVolume.bWaterVolume && (UTSpaceVolume(newHeadVolume) == None) )
	{
		BreathTime = UnderWaterTime;
	}
}

/**
@RETURN true if pawn is invisible to AI
*/
native function bool IsInvisible();

/** PoweredUp()
returns true if pawn has game play advantages, as defined by specific game implementation
*/
function bool PoweredUp()
{
	return ( (DamageScaling > 1) || (FireRateMultiplier < 1) || bIsInvulnerable );
}

/** InCombat()
returns true if pawn is currently in combat, as defined by specific game implementation.
*/
function bool InCombat()
{
	return (WorldInfo.TimeSeconds - LastPainSound < 1) && !PhysicsVolume.bPainCausing;
}

/** function used to update where icon for this actor should be rendered on the HUD
 *  @param NewHUDLocation is a vector whose X and Y components are the X and Y components of this actor's icon's 2D position on the HUD
 */
simulated native function SetHUDLocation(vector NewHUDLocation);

simulated function RenderMapIcon(UTMapInfo MP, Canvas Canvas, UTPlayerController PlayerOwner, LinearColor FinalColor)
{
	MP.DrawRotatedTile(Canvas, class'UTHUD'.default.IconHudTexture, HUDLocation, Rotation.Yaw, MapSize, IconCoords, FinalColor);
}

/**
SuggestJumpVelocity()
returns true if succesful jump from start to destination is possible
returns a suggested initial falling velocity in JumpVelocity
Uses GroundSpeed and JumpZ as limits
*/
native function bool SuggestJumpVelocity(out vector JumpVelocity, vector Destination, vector Start);

/**
 * UTPawns not allowed to set bIsWalking true
 */
event SetWalking( bool bNewIsWalking )
{
}

simulated function ClearBodyMatColor()
{
	RemainingBodyMatDuration = 0;
	ClientBodyMatDuration = 0;
	BodyMatFadeDuration = 0;
}

simulated function SetBodyMatColor(LinearColor NewBodyMatColor, float NewOverlayDuration)
{
	// set if you want to be able to test in a level and not be tossed around nor have damage effects on screen making it impossible to see what is going on
	if( !AffectedByHitEffects() )
	{
		return;
	}

	RemainingBodyMatDuration = NewOverlayDuration;
	ClientBodyMatDuration = RemainingBodyMatDuration;
	BodyMatFadeDuration = 0.5 * RemainingBodyMatDuration;
	BodyMatColor = NewBodyMatColor;
	CompressedBodyMatColor.Pitch = 256.0 * BodyMatColor.R;
	CompressedBodyMatColor.Yaw = 256.0 * BodyMatColor.G;
	CompressedBodyMatColor.Roll = 256.0 * BodyMatColor.B;

	CurrentBodyMatColor = BodyMatColor;
	CurrentBodyMatColor.R += 1;				// make sure CurrentBodyMatColor differs from BodyMatColor to force update
	VerifyBodyMaterialInstance();
}

simulated event ClearXRayEffect()
{
	local class<UTFamilyInfo> FamilyInfo;

	FamilyInfo = GetFamilyInfo();

	// Clear the x-ray effect
	bXRayEffectActive = false;
	SetSkin(None);
	if( FamilyInfo != None &&
		FamilyInfo.default.DeathMeshSkelMesh != None )
	{
		if ( !IsInState('Dying') )
		{
			OverlayMesh.SetSkeletalMesh( FamilyInfo.default.MasterSkeleton );
		}
	}
	SetOverlayMaterial( None );
	DetachComponent(XRayEffectLightEnvironment);
}

simulated function SetXRayEffect(bool bTurnOn, optional Material XRayInvisMaterial )
{
	local int i;
	local class<UTFamilyInfo> FamilyInfo;

	FamilyInfo = GetFamilyInfo();
	if( !AffectedByHitEffects() )
	{
		return;
	}

	if( !bTurnOn )
	{
		ClearXRayEffect();
		return;
	}

	// Enable the x-ray effect
	bXRayEffectActive = true;
	if ( XRayInvisMaterial != None )
	{
		SetSkin( XRayInvisMaterial );
	}
	if( FamilyInfo != None &&
		FamilyInfo.default.DeathMeshSkelMesh != None )
	{
		OverlayMesh.SetSkeletalMesh( FamilyInfo.default.DeathMeshSkelMesh, True );
		for (i = 0; i < OverlayMesh.SkeletalMesh.Materials.Length; i++)
		{
			OverlayMesh.SetMaterial(i, FamilyInfo.default.DeathMeshSkelMesh.Materials[i]);
		}
		XRayEffectLightEnvironment.SetEnabled(true);
		OverlayMesh.SetLightEnvironment(XRayEffectLightEnvironment);
		AttachComponent(XRayEffectLightEnvironment);

		// attach the overlay mesh
		if (!OverlayMesh.bAttached)
		{
			AttachComponent(OverlayMesh);
		}
	}
	else
	{
		SetOverlayMaterial( GetShieldMaterialInstance(WorldInfo.Game.bTeamGame) );
	}
}

simulated function SetInvisible(bool bNowInvisible)
{
	bIsInvisible = bNowInvisible;

	if (WorldInfo.NetMode != NM_DedicatedServer)
	{
		if (bIsInvisible)
		{
			Mesh.CastShadow = false;
			Mesh.bCastDynamicShadow = false;
			ReattachMesh();
		}
		else
		{
			UpdateShadowSettings(!class'Engine'.static.IsSplitScreen() && class'UTPlayerController'.default.PawnShadowMode == SHADOW_All);
		}
	}
}

/**
 * SetSkin is used to apply a single material to the entire model, including any applicable attachments.
 * NOTE: Attachments (ie: the weapons) need to handle resetting their default skin if NewMaterinal = NONE
 *
 * @Param	NewMaterial		The material to apply
 */

simulated function SetSkin(Material NewMaterial)
{
	local int i;

	// Replicate the Material to remote clients
	ReplicatedBodyMaterial = NewMaterial;

	if (VerifyBodyMaterialInstance())		// Make sure we have setup the BodyMaterialInstances array
	{
		// Propagate it to the 3rd person weapon attachment
		if (CurrentWeaponAttachment != None)
		{
			CurrentWeaponAttachment.SetSkin(NewMaterial);
		}

		// Propagate it to the 1st person weapon
		if (UTWeapon(Weapon) != None)
		{
			UTWeapon(Weapon).SetSkin(NewMaterial);
		}

		// Set the skin
		if (NewMaterial == None)
		{
			for (i = 0; i < Mesh.SkeletalMesh.Materials.length; i++)
			{
				Mesh.SetMaterial(i, BodyMaterialInstances[i]);
			}
		}
		else
		{
			for (i = 0; i < Mesh.SkeletalMesh.Materials.length; i++)
			{
				Mesh.SetMaterial(i, NewMaterial);
			}
		}

		SetArmsSkin(NewMaterial);
	}
}

simulated protected function SetArmsSkin(MaterialInterface NewMaterial)
{
	local int i,Cnt;
	local UTPlayerReplicationInfo PRI;

	// if no material specified, grab default from PRI (if that's None too, use mesh default)
	if (NewMaterial == None)
	{
		PRI = UTPlayerReplicationInfo(PlayerReplicationInfo);
		if (PRI == None && DrivenVehicle != None)
		{
			PRI = UTPlayerReplicationInfo(DrivenVehicle.PlayerReplicationInfo);
		}
		if (PRI != None)
		{
			NewMaterial = PRI.FirstPersonArmMaterial;
		}
	}

	if ( NewMaterial == None )	// Clear the materials
	{
		if(default.ArmsMesh[0] != none && ArmsMesh[0] != none)
		{
			if( default.ArmsMesh[0].Materials.Length > 0)
			{
				Cnt = Default.ArmsMesh[0].Materials.Length;
				for(i=0;i<Cnt;i++)
				{
					ArmsMesh[0].SetMaterial(i,Default.ArmsMesh[0].GetMaterial(i) );
				}
			}
			else if(ArmsMesh[0].Materials.Length > 0)
			{
				Cnt = ArmsMesh[0].Materials.Length;
				for(i=0;i<Cnt;i++)
				{
					ArmsMesh[0].SetMaterial(i,none);
				}
			}
		}

		if(default.ArmsMesh[1] != none && ArmsMesh[1] != none)
		{
			if( default.ArmsMesh[1].Materials.Length > 0)
			{
				Cnt = Default.ArmsMesh[1].Materials.Length;
				for(i=0;i<Cnt;i++)
				{
					ArmsMesh[1].SetMaterial(i,Default.ArmsMesh[1].GetMaterial(i) );
				}
			}
			else if(ArmsMesh[1].Materials.Length > 0)
			{
				Cnt = ArmsMesh[1].Materials.Length;
				for(i=0;i<Cnt;i++)
				{
					ArmsMesh[1].SetMaterial(i,none);
				}
			}
		}
	}
	else
	{
		if ((default.ArmsMesh[0] != none && ArmsMesh[0] != none) && (default.ArmsMesh[0].Materials.Length > 0 || ArmsMesh[0].GetNumElements() > 0))
		{
			Cnt = default.ArmsMesh[0].Materials.Length > 0 ? default.ArmsMesh[0].Materials.Length : ArmsMesh[0].GetNumElements();
			for(i=0; i<Cnt;i++)
			{
				ArmsMesh[0].SetMaterial(i,NewMaterial);
			}
		}
		if ((default.ArmsMesh[1] != none && ArmsMesh[1] != none) && (default.ArmsMesh[1].Materials.Length > 0 || ArmsMesh[1].GetNumElements() > 0))
		{
			Cnt = default.ArmsMesh[1].Materials.Length > 0 ? default.ArmsMesh[1].Materials.Length : ArmsMesh[1].GetNumElements();
			for(i=0; i<Cnt;i++)
			{
				ArmsMesh[1].SetMaterial(i,NewMaterial);
			}
		}
	}
}
/**
 * This function will verify that the BodyMaterialInstance variable is setup and ready to go.  This is a key
 * component for the BodyMat overlay system
 */

simulated function bool VerifyBodyMaterialInstance()
{
	local int i;

	if (WorldInfo.NetMode != NM_DedicatedServer && Mesh != None && BodyMaterialInstances.length < Mesh.GetNumElements())
	{
		// set up material instances (for overlay effects)
		BodyMaterialInstances.length = Mesh.GetNumElements();
		for (i = 0; i < BodyMaterialInstances.length; i++)
		{
			if (BodyMaterialInstances[i] == None)
			{
				BodyMaterialInstances[i] = Mesh.CreateAndSetMaterialInstanceConstant(i);
			}
		}
	}
	return (BodyMaterialInstances.length > 0);
}

/** Set various properties for this UTPawn based on  */
simulated function SetInfoFromFamily(class<UTFamilyInfo> Info, SkeletalMesh SkelMesh)
{
	local int i;
	local bool bMeshChanged;

	// AnimSets
	Mesh.AnimSets = Info.default.AnimSets;

	// Mesh
	bMeshChanged = (Mesh.SkeletalMesh != SkelMesh);
	Mesh.SetSkeletalMesh(SkelMesh);

	// PhysicsAsset
	// Force it to re-initialise if the skeletal mesh has changed (might be flappy bones etc).
	Mesh.SetPhysicsAsset(Info.default.PhysAsset, bMeshChanged);

	// Make sure bEnableFullAnimWeightBodies is only TRUE if it needs to be (PhysicsAsset has flappy bits)
	Mesh.bEnableFullAnimWeightBodies = FALSE;
	for(i=0; i<Mesh.PhysicsAsset.BodySetup.length && !Mesh.bEnableFullAnimWeightBodies; i++)
	{
		// See if a bone has bAlwaysFullAnimWeight set and also
		if( Mesh.PhysicsAsset.BodySetup[i].bAlwaysFullAnimWeight &&
			Mesh.MatchRefBone(Mesh.PhysicsAsset.BodySetup[i].BoneName) != INDEX_NONE)
		{
			Mesh.bEnableFullAnimWeightBodies = TRUE;
		}
	}

	// Bone names
	LeftFootBone = Info.default.LeftFootBone;
	RightFootBone = Info.default.RightFootBone;
	TakeHitPhysicsFixedBones = Info.default.TakeHitPhysicsFixedBones;

	// sounds
	SoundGroupClass = Info.default.SoundGroupClass;

	// set my famliy info!
	CurrFamilyInfo = Info;
	
	DefaultMeshScale = CurrFamilyInfo.Default.DefaultMeshScale;
	Mesh.SetScale(DefaultMeshScale);
	BaseTranslationOffset = CurrFamilyInfo.Default.BaseTranslationOffset;
	CrouchTranslationOffset = BaseTranslationOffset + CylinderComponent.Default.CollisionHeight - CrouchHeight;
}

simulated function SetPawnRBChannels(bool bRagdollMode)
{
	if(bRagdollMode)
	{
		Mesh.SetRBChannel(RBCC_Pawn);
		Mesh.SetRBCollidesWithChannel(RBCC_Default,TRUE);
		Mesh.SetRBCollidesWithChannel(RBCC_Pawn,TRUE);
		Mesh.SetRBCollidesWithChannel(RBCC_Vehicle,TRUE);
		Mesh.SetRBCollidesWithChannel(RBCC_Untitled3,FALSE);
	}
	else
	{
		Mesh.SetRBChannel(RBCC_Untitled3);
		Mesh.SetRBCollidesWithChannel(RBCC_Default,FALSE);
		Mesh.SetRBCollidesWithChannel(RBCC_Pawn,FALSE);
		Mesh.SetRBCollidesWithChannel(RBCC_Vehicle,FALSE);
		Mesh.SetRBCollidesWithChannel(RBCC_Untitled3,TRUE);
	}
}

simulated function ResetCharPhysState()
{
	local UTVehicle UTV;

	if(Mesh.PhysicsAssetInstance != None)
	{
		// Now set up the physics based on what we are currently doing.
		if(Physics == PHYS_RigidBody)
		{
			// Ragdoll case
			Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
			SetPawnRBChannels(TRUE);
			SetHandIKEnabled(FALSE);
		}
		else
		{
			// Normal case
			Mesh.PhysicsAssetInstance.SetAllBodiesFixed(TRUE);
			Mesh.PhysicsAssetInstance.SetFullAnimWeightBonesFixed(FALSE, Mesh);
			SetPawnRBChannels(FALSE);
			SetHandIKEnabled(TRUE);

			// Allow vehicles to do any specific modifications to driver
			if(DrivenVehicle != None)
			{
				UTV = UTVehicle(DrivenVehicle);
				if(UTV != None)
				{
					UTV.OnDriverPhysicsAssetChanged(self);
				}
			}
		}
	}
}

simulated function NotifyTeamChanged()
{
	local UTPlayerReplicationInfo PRI;
	local byte TeamNum;
	local bool bMeshChanged, bPhysicsAssetChanged;
	local PhysicsAsset OldPhysAsset;
	local int i;
	local class<UTFamilyInfo> Family;

	// set mesh to the one in the PRI, or default for this team if not found
	PRI = UTPlayerReplicationInfo(PlayerReplicationInfo);
	if (PRI == None && DrivenVehicle != None)
	{
		PRI = UTPlayerReplicationInfo(DrivenVehicle.PlayerReplicationInfo);
	}
	if (PRI != None)
	{
		if ( (PRI.Team != None) && !IsHumanControlled() || !IsLocallyControlled()  )
		{
			LightEnvironment.LightDesaturation = 1.0;
		}
		else if ( IsHumanControlled() && IsLocallyControlled() )
		{
			LightEnvironment.AmbientGlow.R = 0.0;
			LightEnvironment.AmbientGlow.G = 0.0;
			LightEnvironment.AmbientGlow.B = 0.0;
		}
		if ( left(WorldInfo.GetMapName(), 9) ~= "DARKMATCH" )
		{
			LightEnvironment.AmbientGlow.R = 0.0;
			LightEnvironment.AmbientGlow.G = 0.0;
			LightEnvironment.AmbientGlow.B = 0.0;

			// HACK - dynamic light in DarkMatch
			if ( IsHumanControlled() && IsLocallyControlled() )
			//&& !WorldInfo.IsConsoleBuild(CONSOLE_PS3)
			{
	        	DarkMatchLight = new(Outer) class'UTDarkmatchLight';
	        	AttachComponent(DarkMatchLight);
			}
		}

		Family = class'UTCustomChar_Data'.static.FindFamilyInfo(PRI.CharacterData.FamilyID);
		if (PRI.CharacterMesh != None && PRI.CharacterMesh != DefaultMesh)
		{
			bMeshChanged = (PRI.CharacterMesh != Mesh.SkeletalMesh);
			OldPhysAsset = Mesh.PhysicsAsset;

			SetInfoFromFamily(Family, PRI.CharacterMesh);

			if(Mesh.PhysicsAsset != OldPhysAsset)
			{
				bPhysicsAssetChanged = TRUE;
			}

			if (OverlayMesh != None)
			{
				OverlayMesh.SetSkeletalMesh(PRI.CharacterMesh);
			}

			if (WorldInfo.NetMode != NM_DedicatedServer)
			{
				VerifyBodyMaterialInstance();
				BodyMaterialInstances[0].SetParent(PRI.CharacterMesh.Materials[0]);
				if (PRI.CharacterMesh.Materials.length > 1)
				{
					BodyMaterialInstances[1].SetParent(PRI.CharacterMesh.Materials[1]);
				}
			}
		}
		else
		{
			// force proper LOD levels for default mesh (hack code fix)
			for ( i=0; i<DefaultMesh.LODInfo.Length; i++ )
			{
				DefaultMesh.LODInfo[i].DisplayFactor = FMax(0.0, 0.6 - 0.2*i);
			}

			bMeshChanged = (DefaultMesh != Mesh.SkeletalMesh);
			OldPhysAsset = Mesh.PhysicsAsset;

			SetInfoFromFamily(DefaultFamily, DefaultMesh);
			// exception: always use the sounds for the intended character
			// so that even if the server doesn't construct the mesh, the owning client still gets the correct sounds
			// (of course, players who see the default character will then have wrong sounds,
			// but this is both less likely to happen and less likely to be noticed when it does)

			// JG: actually - we always want the soundgroup to match the mesh - your own effects are not replicated from server
			//if (Family != None)
			//{
			//	SoundGroupClass = Family.default.SoundGroupClass;
			//}

			if(Mesh.PhysicsAsset != OldPhysAsset)
			{
				bPhysicsAssetChanged = TRUE;
			}

			if (OverlayMesh != None)
			{
				OverlayMesh.SetSkeletalMesh(DefaultMesh);
			}

			if (WorldInfo.NetMode != NM_DedicatedServer)
			{
				TeamNum = GetTeamNum();
				VerifyBodyMaterialInstance();
				BodyMaterialInstances[0].SetParent((TeamNum < DefaultTeamHeadMaterials.length) ? DefaultTeamHeadMaterials[TeamNum] : DefaultMesh.Materials[0]);
				BodyMaterialInstances[1].SetParent((TeamNum < DefaultTeamMaterials.length) ? DefaultTeamMaterials[TeamNum] : DefaultMesh.Materials[1]);

				// Assign fallback portrait.
				PRI.CharPortrait = (TeamNum < DefaultTeamHeadPortrait.length) ? DefaultTeamHeadPortrait[TeamNum] : DefaultHeadPortrait;
			}
		}

		if (bMeshChanged && WorldInfo.NetMode != NM_DedicatedServer)
		{
			// refresh weapon attachment
			if (CurrentWeaponAttachmentClass != None)
			{
				// recreate weapon attachment in case the socket on the new mesh is in a different place
				if (CurrentWeaponAttachment != None)
				{
					CurrentWeaponAttachment.DetachFrom(Mesh);
					CurrentWeaponAttachment.Destroy();
					CurrentWeaponAttachment = None;
				}
				WeaponAttachmentChanged();
			}
			// refresh overlay
			if (OverlayMaterialInstance != None)
			{
				SetOverlayMaterial(OverlayMaterialInstance);
			}
		}

		// Make sure physics is in the correct state.
		if(bPhysicsAssetChanged || bMeshChanged)
		{
			// Rebuild array of bodies to not apply joint drive to.
			NoDriveBodies.length = 0;
			for( i=0; i<Mesh.PhysicsAsset.BodySetup.Length; i++)
			{
				if(Mesh.PhysicsAsset.BodySetup[i].bAlwaysFullAnimWeight)
				{
					NoDriveBodies.AddItem(Mesh.PhysicsAsset.BodySetup[i].BoneName);
				}
			}

			// Reset physics state.
			bIsHoverboardAnimPawn = FALSE;
			ResetCharPhysState();
		}

		// Update first person arms
		NotifyArmMeshChanged(PRI);
	}

	SetTeamColor();
}

/** Updates first person arm meshes when the mesh they should be using changes
 * UTPRI - the PRI to use (might have come from vehicle pawn is driving instead of itself)
 */
simulated function NotifyArmMeshChanged(UTPlayerReplicationInfo UTPRI)
{
	// failsafe to make sure local player got arms
	if ( IsLocallyControlled() && IsHumanControlled() && UTPRI.FirstPersonArmMesh == None &&
		UTGameReplicationInfo(WorldInfo.GRI) != None && UTGameReplicationInfo(WorldInfo.GRI).CharStatus.Find('PRI', UTPRI) == INDEX_NONE )
	{
		UTGameReplicationInfo(WorldInfo.GRI).ProcessCharacterData(UTPRI);
	}

	// Arms
	ArmsMesh[0].SetSkeletalMesh(UTPRI.FirstPersonArmMesh);
	ArmsMesh[1].SetSkeletalMesh(UTPRI.FirstPersonArmMesh);
	if (ArmsOverlay[0] != None)
	{
		ArmsOverlay[0].SetSkeletalMesh(UTPRI.FirstPersonArmMesh);
	}
	if (ArmsOverlay[1] != None)
	{
		ArmsOverlay[1].SetSkeletalMesh(UTPRI.FirstPersonArmMesh);
	}
	SetArmsSkin(ReplicatedBodyMaterial);
}

/**
 * When a pawn's team is set or replicated, SetTeamColor is called.  By default, this will setup
 * any required material parameters.
 */
simulated function SetTeamColor()
{
	local int i;
	local UTPlayerReplicationInfo PRI;
	local LinearColor EColor, TeamColor;

	if ( PlayerReplicationInfo != None )
	{
		PRI = UTPlayerReplicationInfo(PlayerReplicationInfo);
	}
	else if ( DrivenVehicle != None )
	{
		PRI = UTPlayerReplicationInfo(DrivenVehicle.PlayerReplicationInfo);
	}
	if ( PRI == None )
		return;

	if ( PRI.Team == None )
	{
		if ( VerifyBodyMaterialInstance() )
		{
			EColor = GetFamilyInfo().default.NonTeamEmissiveColor;
			TeamColor = GetFamilyInfo().default.NonTeamTintColor;
			for (i = 0; i < BodyMaterialInstances.length; i++)
			{
				BodyMaterialInstances[i].SetVectorParameterValue('Char_TeamColor', TeamColor);
				BodyMaterialInstances[i].SetVectorParameterValue('Char_Emissive_Color', EColor);
			}
		}
	}
	else if (VerifyBodyMaterialInstance())
	{
		if ( PRI.Team.TeamIndex == 0 )
		{
            //Check colors in UTCustomChar.cpp if you change these
			EColor		= MakeLinearColor(10.f,0.2f,0.2f,0.f);
			TeamColor	= MakeLinearColor(8.0f,0.1f,0.1f,0.f);

			for (i = 0; i < BodyMaterialInstances.length; i++)
			{
				BodyMaterialInstances[i].SetVectorParameterValue('Char_TeamColor', TeamColor);
				BodyMaterialInstances[i].SetVectorParameterValue('Char_Emissive_Color', EColor);
			}
		}
		else
		{
            //Check colors in UTCustomChar.cpp if you change these
			EColor		= MakeLinearColor(1.f,1.f,10.f,0.f);
			TeamColor	= MakeLinearColor(0.5f,1.f,10.f,0.f);

			for (i = 0; i < BodyMaterialInstances.length; i++)
			{
				BodyMaterialInstances[i].SetVectorParameterValue('Char_TeamColor', TeamColor);
				BodyMaterialInstances[i].SetVectorParameterValue('Char_Emissive_Color', EColor);
			}
		}
	}
}

exec function ShowCompDebug()
{
	bComponentDebug = !bComponentDebug;
}

simulated function PostBeginPlay()
{
	local rotator R;
	local PlayerController PC;

	StartedFallingTime = WorldInfo.TimeSeconds;

	Super.PostBeginPlay();

	if (Mesh != None)
	{
		BaseTranslationOffset = Mesh.Translation.Z;
		CrouchTranslationOffset = Mesh.Translation.Z + CylinderComponent.CollisionHeight - CrouchHeight;
		OverlayMesh.SetParentAnimComponent(Mesh);
	}
	if (WorldInfo.NetMode != NM_DedicatedServer && ArmsMesh[0] != none)
	{
		CreateOverlayArmsMesh();
	}

	bCanDoubleJump = CanMultiJump();

	// Zero out Pitch and Roll
	R.Yaw = Rotation.Yaw;
	SetRotation(R);

	// add to local HUD's post-rendered list
	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if ( UTHUD(PC.MyHUD) != None )
		{
			UTHUD(PC.MyHUD).AddPostRenderedActor(self);
		}
	}

	if ( WorldInfo.NetMode != NM_DedicatedServer )
	{
		UpdateShadowSettings(class'UTPlayerController'.default.PawnShadowMode == SHADOW_All);
	}

	CheckGameClass();
}

/** customize based on gameclass
  */
simulated function CheckGameClass()
{
	if ( WorldInfo.GRI == None || WorldInfo.GRI.GameClass == None )
	{
		// check again later for valid gameclass
		SetTimer(3.0+2.0*FRand(), false, 'CheckGameClass');
	}
	else if ( (class<UTGame>(WorldInfo.GRI.GameClass) != None) && class<UTGame>(WorldInfo.GRI.GameClass).Default.bShouldPostRenderEnemyPawns )
	{
		bPostRenderOtherTeam = true;
		if ( !class<UTGame>(WorldInfo.GRI.GameClass).Default.bTeamGame )
		{
			TeamBeaconMaxDist = class<UTGame>(WorldInfo.GRI.GameClass).Default.DMBeaconMaxDist;
			if ( left(WorldInfo.GetMapName(), 9) ~= "DARKMATCH" )
			{	
				TeamBeaconMaxDist *= 0.25;
			}
		}
	}
}

simulated function UpdateShadowSettings(bool bWantShadow)
{
	local bool bNewCastShadow, bNewCastDynamicShadow;

	if (Mesh != None)
	{
		bNewCastShadow = default.Mesh.CastShadow && bWantShadow;
		bNewCastDynamicShadow = default.Mesh.bCastDynamicShadow && bWantShadow;
		if (bNewCastShadow != Mesh.CastShadow || bNewCastDynamicShadow != Mesh.bCastDynamicShadow)
		{
			// if there is a pending Attach then this will set the shadow immediately as the flags have changed an a reattached has occurred
			Mesh.CastShadow = bNewCastShadow;
			Mesh.bCastDynamicShadow = bNewCastDynamicShadow;

			// defer if we can do so without it being noticeable
			if (LastRenderTime < WorldInfo.TimeSeconds - 1.0)
			{
				SetTimer(0.1 + FRand() * 0.5, false, 'ReattachMesh');
			}
			else
			{
				ReattachMesh();
			}
		}
	}
}

/** reattaches the mesh component, because settings were updated */
simulated function ReattachMesh()
{
	DetachComponent(Mesh);
	AttachComponent(Mesh);
	EnsureOverlayComponentLast();
}

simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
	if (SkelComp == Mesh)
	{
		LeftLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(LeftFootControlName));
		RightLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(RightFootControlName));
		FeignDeathBlend = AnimNodeBlend(Mesh.FindAnimNode('FeignDeathBlend'));
		FullBodyAnimSlot = AnimNodeSlot(Mesh.FindAnimNode('FullBodySlot'));
		TopHalfAnimSlot = AnimNodeSlot(Mesh.FindAnimNode('TopHalfSlot'));

		LeftHandIK = SkelControlLimb( mesh.FindSkelControl('LeftHandIK') );

		RightHandIK = SkelControlLimb( mesh.FindSkelControl('RightHandIK') );

		RootRotControl = SkelControlSingleBone( mesh.FindSkelControl('RootRot') );
		AimNode = AnimNodeAimOffset( mesh.FindAnimNode('AimNode') );
		GunRecoilNode = GameSkelCtrl_Recoil( mesh.FindSkelControl('GunRecoilNode') );
		LeftRecoilNode = GameSkelCtrl_Recoil( mesh.FindSkelControl('LeftRecoilNode') );
		RightRecoilNode = GameSkelCtrl_Recoil( mesh.FindSkelControl('RightRecoilNode') );

		DrivingNode = UTAnimBlendByDriving( mesh.FindAnimNode('DrivingNode') );
		VehicleNode = UTAnimBlendByVehicle( mesh.FindAnimNode('VehicleNode') );
		HoverboardingNode = UTAnimBlendByHoverboarding( mesh.FindAnimNode('Hoverboarding') );
	}
}

/** Enable or disable IK that keeps hands on IK bones. */
simulated function SetHandIKEnabled(bool bEnabled)
{
	if (WorldInfo.NetMode != NM_DedicatedServer && Mesh.Animations != None)
	{
		if (bEnabled)
		{
			LeftHandIK.SetSkelControlStrength(1.0, 0.0);
			RightHandIK.SetSkelControlStrength(1.0, 0.0);
		}
		else
		{
			LeftHandIK.SetSkelControlStrength(0.0, 0.0);
			RightHandIK.SetSkelControlStrength(0.0, 0.0);
		}
	}
}

/** Util for scaling running anims etc. */
simulated function SetAnimRateScale(float RateScale)
{
	Mesh.GlobalAnimRateScale = RateScale;
}

/** Change the type of weapon animation we are playing. */
simulated function SetWeapAnimType(UTWeaponAttachment.EWeapAnimType AnimType)
{
	if (AimNode != None)
	{
		switch(AnimType)
		{
			case EWAT_Default:
				AimNode.SetActiveProfileByName('Default');
				break;
			case EWAT_Pistol:
				AimNode.SetActiveProfileByName('SinglePistol');
				break;
			case EWAT_DualPistols:
				AimNode.SetActiveProfileByName('DualPistols');
				break;
			case EWAT_ShoulderRocket:
				AimNode.SetActiveProfileByName('ShoulderRocket');
				break;
			case EWAT_Stinger:
				AimNode.SetActiveProfileByName('Stinger');
				break;
		}
	}
}

/**
 * This will trace against the world and leave a blood splatter decal.
 *
 * This is used for having a back spray / exit wound blood effect on the wall behind us.
 **/
simulated function LeaveABloodSplatterDecal( vector HitLoc, vector HitNorm )
{
	local Actor TraceActor;
	local vector out_HitLocation;
	local vector out_HitNormal;
	local vector TraceDest;
	local vector TraceStart;
	local vector TraceExtent;
	local TraceHitInfo HitInfo;
	local MaterialInstanceTimeVarying MITV_Decal;

	TraceStart = HitLoc;
	HitNorm.Z *= 0.5;
	TraceDest =  HitLoc  + 300 * Normal(HitNorm);

	TraceActor = Trace( out_HitLocation, out_HitNormal, TraceDest, TraceStart, false, TraceExtent, HitInfo, TRACEFLAG_PhysicsVolumes );

	if (TraceActor != None && TraceActor.bWorldGeometry)
	{
		// we might want to move this to the UTFamilyInfo
		MITV_Decal = new(Outer) class'MaterialInstanceTimeVarying';
		MITV_Decal.SetParent( GetFamilyInfo().default.BloodSplatterDecalMaterial );

		WorldInfo.MyDecalManager.SpawnDecal(MITV_Decal, out_HitLocation, rotator(-out_HitNormal), 100, 100, 50, false,, HitInfo.HitComponent, true, false, HitInfo.BoneName, HitInfo.Item, HitInfo.LevelIndex);
		MITV_Decal.SetScalarStartTime( class'UTGib'.default.DecalDissolveParamName, class'UTGib'.default.DecalWaitTimeBeforeDissolve );
	}
}


/**
 * Performs an Emote command.  This is typically an action that
 * tells the bots to do something.  It is server-side only
 *
 * @Param EInfo 		The emote we are working with
 * @Param PlayerID		The ID of the player this emote is directed at.  255 = All Players
 */
function PerformEmoteCommand(EmoteInfo EInfo, int PlayerID)
{
	local array<UTPlayerReplicationInfo> PRIs;
	local UTPlayerReplicationInfo BotPRI;
	local UTBot Bot;
	local int i;
	local bool bShouldAck;
	local Controller Sender;

	Sender = Controller;
	if (Sender == None && DrivenVehicle != None)
	{
		Sender = DrivenVehicle.Controller;
	}
	if (Sender != None)
	{
		if ( EInfo.Command == 'DropFlag' )
		{
			for (i=0;i<WorldInfo.GRI.PRIArray.Length;i++)
			{
				BotPRI = UTPlayerReplicationInfo(WorldInfo.GRI.PRIArray[i]);
				if ( BotPRI.bHasFlag && WorldInfo.GRI.OnSameTeam(BotPRI,self) )
				{
					Bot = UTBot(BotPRI.Owner);
					if ( Bot != none )
					{
						Bot.SetBotOrders(EInfo.Command, Sender, true);
						return;
					}
				}
			}
			return;
		}
		
		// If we require a player for this command, look it up
		if ( EInfo.bRequiresPlayer || EInfo.CategoryName == 'Order' )
		{
			// Itterate over the PRI array
			for (i=0;i<WorldInfo.GRI.PRIArray.Length;i++)
			{
				// If we are looking for all players or just this player and it matches
				if (PlayerID == 255 || WorldInfo.GRI.PRIArray[i].PlayerID == PlayerID)
				{
					// Only send to bots
					if ( UTBot(WorldInfo.GRI.PRIArray[i].Owner) != none )
					{
						// If we are on the same team
						if ( WorldInfo.GRI.OnSameTeam(WorldInfo.GRI.PRIArray[i], Sender) )
						{
							PRIs[PRIs.Length] = UTPlayerReplicationInfo(WorldInfo.GRI.PRIArray[i]);
						}
					}
				}
			}

			// Quick out if we didn't find targets

			if ( PRIs.Length == 0 )
			{
				return;
			}
		}
		else	// See with our own just to have the loop work
		{
			PRIs[0] = UTPlayerReplicationInfo(PlayerReplicationInfo);
		}

		// Give the command to the bot...
		if ( EInfo.Command != '' )
		{
			bShouldAck = true;
				for (i=0;i<PRIs.Length;i++)
				{
					if ( (PlayerID == 255) || (PRIs[i].PlayerID == PlayerID) )
					{
						Bot = UTBot(PRIs[i].Owner);
						if ( Bot != none )
						{
							//`log("### Command:"@EInfo.Command@"to"@PRIs[i].PlayerName);
							Bot.SetBotOrders(EInfo.Command, Sender, bShouldAck);
							bShouldAck = false;
							if ( PlayerID != 255 )
							{
								break;
							}
						}
					}
				}
			}
		}
}


/** Play an emote given a category and index within that category. */
simulated function DoPlayEmote(name InEmoteTag, int InPlayerID)
{
	local UTPlayerReplicationInfo UTPRI;
	local class<UTFamilyInfo> FamilyInfo;
	local int EmoteIndex;
	local EmoteInfo EInfo;

	UTPRI = UTPlayerReplicationInfo(PlayerReplicationInfo);
	if (UTPRI == None && DrivenVehicle != None)
	{
		UTPRI = UTPlayerReplicationInfo(DrivenVehicle.PlayerReplicationInfo);
	}
	if(UTPRI != None)
	{
		// Find the family we belong to (if we need to)
		if( CurrFamilyInfo != none )
		{
			FamilyInfo = CurrFamilyInfo;
		}
		else
		{
			FamilyInfo = class'UTCustomChar_Data'.static.FindFamilyInfo(UTPRI.CharacterData.FamilyID);
		}

		// If we couldn't find it (or empty), use the default
		if(FamilyInfo == None)
		{
			FamilyInfo = DefaultFamily;
		}

		EmoteIndex = FamilyInfo.static.GetEmoteIndex(InEmoteTag);

		if (EmoteIndex != INDEX_None)
		{

			EInfo = FamilyInfo.default.FamilyEmotes[EmoteIndex];

			// If on server..
			if (Role == ROLE_Authority)
			{
				// Perform any commands associated with this Emote if authoritative
				if(EInfo.Command != '')
				{
					PerformEmoteCommand(EInfo, InPlayerID);
				}
			}

			// If this isn't a dedicated server, perform the emote
			if(Health > 0 && WorldInfo.NetMode != NM_DedicatedServer && UTPRI != None && !IsInState('FeigningDeath'))
			{
				// Play the anim in correct slot
				if(EInfo.EmoteAnim != '')
				{
					// HACK! Krall anim spelt wrong :(
					if(FamilyInfo == class'UTFamilyInfo_Krall_Male' && EInfo.EmoteAnim == 'Taunt_UB_ComeHere')
					{
						EInfo.EmoteAnim = 'Taunt_UB_ComeHear';
					}

					if(EInfo.bTopHalfEmote || DrivenVehicle != None || (Abs(VSizeSq(Velocity)) > 0.01 && !bClientInHeroMelee))
					{
						//Top half emotes don't have any problem blending with walking, so perform them here.
						if(TopHalfAnimSlot != None)
						{
							TopHalfAnimSlot.PlayCustomAnim(EInfo.EmoteAnim, 1.0, 0.2, 0.2, FALSE, TRUE);
						}
					}
					else
					{
						//Full body emotes are played on both slots so that we can turn off the full body if the pawn starts moving
						//and still get the top half
						if(TopHalfAnimSlot != None)
						{
							TopHalfAnimSlot.PlayCustomAnim(EInfo.EmoteAnim, 1.0, 0.2, 0.2, FALSE, TRUE);
						}

						if(FullBodyAnimSlot != None)
						{
							FullBodyAnimSlot.PlayCustomAnim(EInfo.EmoteAnim, 1.0, 0.2, 0.2, FALSE, TRUE);
							CurrentEmoteDuration = AnimNodeSequence(FullBodyAnimSlot.Children[1].Anim).AnimSeq.SequenceLength;
						}
					}
				}
			}
		}
	}
}

reliable server function ServerPlayEmote(name InEmoteTag, int InPlayerID)
{
	local UTPlayerReplicationInfo UTPRI;
	local Controller C;

	EmoteRepInfo.EmoteTag = InEmoteTag;
	EmoteRepInfo.bNewData = !EmoteRepInfo.bNewData;

	// Play an appropriate voice taunt.
	if(WorldInfo.TimeSeconds - LastEmoteTime > MinTimeBetweenEmotes)
	{
		UTPRI = UTPlayerReplicationInfo(PlayerReplicationInfo);
		C = Controller;
		if (UTPRI == None && DrivenVehicle != None)
		{
			UTPRI = UTPlayerReplicationInfo(DrivenVehicle.PlayerReplicationInfo);
			C = DrivenVehicle.Controller;
		}
		if ( (UTPRI != None) && (UTBot(C) == None) && (InEmoteTag != 'MeleeA') )
		{
			if ( WorldInfo.TimeSeconds > NextTauntTime )
			{
				UTPRI.VoiceClass.static.SendVoiceForTauntAnim(C, InEmoteTag, InPlayerID != -1);
				if ( WorldInfo.Game.NumPlayers > 1 )
				{
					NextTauntTime = WorldInfo.TimeSeconds + 1.0 + FMax(0.0, 8.0 - WorldInfo.TimeSeconds + NextTauntTime);
				}
			}
		}
	}

	DoPlayEmote(InEmoteTag, InPlayerID);

	LastEmoteTime = WorldInfo.TimeSeconds;
}

exec simulated function PlayEmote(name InEmoteTag, int InPlayerID)
{
	// If it has been long enough since the last emote, play one now
	if(WorldInfo.TimeSeconds - LastEmoteTime > MinTimeBetweenEmotes)
	{
		ServerPlayEmote(InEmoteTag, InPlayerID);
		LastEmoteTime = WorldInfo.TimeSeconds;
	}
}

function OnPlayAnim( UTSeqAct_PlayAnim InAction )
{
	ServerPlayAnim( InAction.AnimName, InAction.bLooping );
}

reliable server function ServerPlayAnim( name AnimName, bool bLooping )
{
	AnimRepInfo.AnimName = AnimName;
	AnimRepInfo.bLooping = bLooping;
	AnimRepInfo.bNewData = !AnimRepInfo.bNewData;

	DoPlayAnim( AnimRepInfo );
}

reliable server function DoPlayAnim( PlayAnimInfo TheAnimRepInfo )
{
	if( FullBodyAnimSlot != None )
	{
		FullBodyAnimSlot.PlayCustomAnim( TheAnimRepInfo.AnimName, 1.0, 0.2, 0.2, TheAnimRepInfo.bLooping, TRUE );
	}
}

function SpawnDefaultController()
{
	local UTGame Game;
	local UTBot Bot;
	local CharacterInfo EmptyBotInfo;

	Super.SpawnDefaultController();

	Game = UTGame(WorldInfo.Game);
	Bot = UTBot(Controller);
	if (Game != None && Bot != None)
	{
		Game.InitializeBot(Bot, Game.GetBotTeam(), EmptyBotInfo);
	}
}

simulated function vector WeaponBob(float BobDamping, float JumpDamping)
{
	Local Vector WBob;

	WBob = BobDamping * WalkBob;
	WBob.Z = (0.45 + 0.55 * BobDamping)*WalkBob.Z;
	if ( !bWeaponBob )
	{
		WBob *= 2.5;
	}
	WBob.Z += JumpDamping *(LandBob - JumpBob);
	return WBob;
}

/** TurnOff()
Freeze pawn - stop sounds, animations, physics, weapon firing
*/
simulated function TurnOff()
{
	super.TurnOff();
	PawnAmbientSound.Stop();
	ClearTimer('FeignDeathDelayTimer');
}

//==============
// Encroachment
event bool EncroachingOn( actor Other )
{
	if ( (Vehicle(Other) != None) && (Weapon != None) && Weapon.IsA('UTTranslauncher') )
		return true;

	return Super.EncroachingOn(Other);
}

event EncroachedBy(Actor Other)
{
	local UTPawn P;

	// don't get telefragged by non-vehicle ragdolls and pawns feigning death
	P = UTPawn(Other);
	if (P == None || (!P.IsInState('FeigningDeath') && P.Physics != PHYS_RigidBody))
	{
		Super.EncroachedBy(Other);
	}
}

function gibbedBy(actor Other)
{
	local Pawn P;
	local UTWeap_Translocator TL;

	if ( Role < ROLE_Authority )
		return;

	P = Pawn(Other);
	if ( P != None )
	{
		TL = UTWeap_Translocator(P.Weapon);
		if ( (TL != None) && TL.bTranslocationInProgress )
		{
			Died(Pawn(Other).Controller, class'UTDmgType_Telefrag', Location);
		}
		else
		{
		Died(Pawn(Other).Controller, class'UTDmgType_Encroached', Location);
		}
	}
	else
	{
		Died(None, class'UTDmgType_Encroached', Location);
}
}

//Base change - if new base is pawn or decoration, damage based on relative mass and old velocity
// Also, non-players will jump off pawns immediately
function JumpOffPawn()
{
	Super.JumpOffPawn();
	bNoJumpAdjust = true;
	if ( UTBot(Controller) != None )
		UTBot(Controller).SetFall();
}

/** Called when pawn cylinder embedded in another pawn.  (Collision bug that needs to be fixed).
*/
event StuckOnPawn(Pawn OtherPawn)
{
	if( UTPawn(OtherPawn) != None )
	{
		TakeDamage( 10, None,Location, vect(0,0,0) , class'DmgType_Crushed');
		ForceRagdoll();
	}
}

event Falling()
{
	if ( UTBot(Controller) != None )
		UTBot(Controller).SetFall();
}

function AddVelocity( vector NewVelocity, vector HitLocation, class<DamageType> DamageType, optional TraceHitInfo HitInfo )
{
	local bool bRagdoll;

	if (!bIgnoreForces && !IsZero(NewVelocity))
	{
		if (Physics == PHYS_Falling && UTBot(Controller) != None)
		{
			UTBot(Controller).ImpactVelocity += NewVelocity;
		}

		if ( Role == ROLE_Authority && Physics == PHYS_Walking && DrivenVehicle == None && Vehicle(Base) != None
			&& VSize(Base.Velocity) > GroundSpeed )
		{
			bRagdoll = true;
		}

		Super.AddVelocity(NewVelocity, HitLocation, DamageType, HitInfo);

		// wait until velocity is applied before sending to ragdoll so that new velocity is used to start the physics
		if (bRagdoll)
		{
			ForceRagdoll();
		}
	}
}

function bool Died(Controller Killer, class<DamageType> damageType, vector HitLocation)
{
	if (Super.Died(Killer, DamageType, HitLocation))
	{
		StartFallImpactTime = WorldInfo.TimeSeconds;
		bCanPlayFallingImpacts=true;
		if(ArmsMesh[0] != none)
		{
			ArmsMesh[0].SetHidden(true);
			if(ArmsOverlay[0] != none)
			{
				ArmsOverlay[0].SetHidden(true);
			}
		}
		if(ArmsMesh[1] != none)
		{
			ArmsMesh[1].SetHidden(true);
			if(ArmsOverlay[1] != none)
			{
				ArmsOverlay[1].SetHidden(true);
			}
		}
		SetPawnAmbientSound(None);
		SetWeaponAmbientSound(None);
		return true;
	}
	return false;
}

simulated function StartFire(byte FireModeNum)
{
	// firing cancels feign death
	if (bFeigningDeath)
	{
		FeignDeath();
	}
	else
	{
		Super.StartFire(FireModeNum);
	}
}

function bool StopFiring()
{
	return StopWeaponFiring();
}

function bool BotFire(bool bFinished)
{
	local UTWeapon Weap;
	local UTBot Bot;

	Weap = UTWeapon(Weapon);
	if (Weap == None || (!Weap.ReadyToFire(bFinished) && !Weap.IsFiring()))
	{
		return false;
	}

	Bot = UTBot(Controller);
	if (Bot != None && Bot.ScriptedFireMode != 255)
	{
		StartFire(Bot.ScriptedFireMode);
	}
	else
	{
		StartFire(ChooseFireMode());
	}
	return true;
}

/** returns true if this pawn wants to force a special attack (for AI) */
function bool ForceSpecialAttack(Pawn EnemyPawn)
{
	return false;
}

function bool StopWeaponFiring()
{
	local int i;
	local bool bResult;
	local UTWeapon UTWeap;

	UTWeap = UTWeapon(Weapon);
	if (UTWeap != None)
	{
		UTWeap.ClientEndFire(0);
		UTWeap.ClientEndFire(1);
		UTWeap.ServerStopFire(0);
		UTWeap.ServerStopFire(1);
		bResult = true;
	}

	if (InvManager != None)
	{
		for (i = 0; i < InvManager.PendingFire.length; i++)
		{
			if (InvManager.PendingFire[i] > 0)
			{
				bResult = true;
				InvManager.PendingFire[i] = 0;
			}
		}
	}

	return bResult;
}

function byte ChooseFireMode()
{
	if ( UTWeapon(Weapon) != None )
	{
		return UTWeapon(Weapon).BestMode();
	}
	return 0;
}

function bool RecommendLongRangedAttack()
{
	if ( Weapon != None )
		return Weapon.RecommendLongRangedAttack();
	return false;
}


function float RangedAttackTime()
{
	if ( UTWeapon(Weapon) != None )
		return UTWeapon(Weapon).RangedAttackTime();
	return 0;
}

simulated function float GetEyeHeight()
{
	if ( !IsLocallyControlled() )
		return BaseEyeHeight;
	else
		return EyeHeight;
}

function PlayVictoryAnimation()
{
	ServerPlayEmote(TauntNames[Rand(6)], -1);
}

function OnHealDamage(SeqAct_HealDamage Action)
{
	local UTSeqAct_HealDamage UTHealAction;

	UTHealAction = UTSeqAct_HealDamage(Action);
	GiveHealth(Action.HealAmount, (UTHealAction != None && UTHealAction.bSuperHeal) ? SuperHealthMax : HealthMax);
}

simulated native function NativePostRenderFor(PlayerController PC, Canvas Canvas, vector CameraPosition, vector CameraDir);

simulated function string GetScreenName()
{
	return PlayerReplicationInfo.GetPlayerAlias();
}

/**
PostRenderFor()
Hook to allow pawns to render HUD overlays for themselves.
Called only if pawn was rendered this tick.
Assumes that appropriate font has already been set
@todo FIXMESTEVE - special beacon when speaking (SpeakingBeaconTexture)
*/
simulated event PostRenderFor(PlayerController PC, Canvas Canvas, vector CameraPosition, vector CameraDir)
{
	local vector ScreenLoc;
	local UTWeapon Weap;
	local UTHUD HUD;

	screenLoc = Canvas.Project(Location + GetCollisionHeight()*vect(0,0,1));
	// make sure not clipped out
	if (screenLoc.X < 0 ||
		screenLoc.X >= Canvas.ClipX ||
		screenLoc.Y < 0 ||
		screenLoc.Y >= Canvas.ClipY)
	{
		return;
	}

	if ( (!bPostRenderOtherTeam || bFeigningDeath) && !WorldInfo.GRI.OnSameTeam(self, PC) )
	{
		// maybe change to action music if close enough
		if ( WorldInfo.TimeSeconds - LastPostRenderTraceTime > 0.5 )
		{
			if ( !UTPlayerController(PC).AlreadyInActionMusic() && (VSize(CameraPosition - Location) < VSize(PC.ViewTarget.Location - Location)) && !IsInvisible() )
			{
				// check whether close enough to crosshair
				if ( (Abs(screenLoc.X - 0.5*Canvas.ClipX) < 0.1 * Canvas.ClipX)
					&& (Abs(screenLoc.Y - 0.5*Canvas.ClipY) < 0.1 * Canvas.ClipY) )
				{
					// periodically make sure really visible using traces
					if ( FastTrace(Location, CameraPosition,, true)
									|| FastTrace(Location+GetCollisionHeight()*vect(0,0,1), CameraPosition,, true) )
					{
						UTPlayerController(PC).ClientMusicEvent(0);;
					}
				}
			}
			LastPostRenderTraceTime = WorldInfo.TimeSeconds + 0.2*FRand();
		}
		return;
	}

	// make sure not behind weapon
	if ( UTPawn(PC.Pawn) != None )
	{
		Weap = UTWeapon(UTPawn(PC.Pawn).Weapon);
		if ( (Weap != None) && Weap.CoversScreenSpace(screenLoc, Canvas) )
		{
			return;
		}
	}
	else if ( (UTVehicle_Hoverboard(PC.Pawn) != None) && UTVehicle_Hoverboard(PC.Pawn).CoversScreenSpace(screenLoc, Canvas) )
	{
		return;
	}

	// periodically make sure really visible using traces
	if ( WorldInfo.TimeSeconds - LastPostRenderTraceTime > 0.5 )
	{
		LastPostRenderTraceTime = WorldInfo.TimeSeconds + 0.2*FRand();
		bPostRenderTraceSucceeded = FastTrace(Location, CameraPosition)
									|| FastTrace(Location+GetCollisionHeight()*vect(0,0,1), CameraPosition);
	}
	if ( !bPostRenderTraceSucceeded )
	{
		return;
	}

	HUD = UTHUD(PC.MyHUD);
	if ( HUD != None )
	{
		HUD.DrawPlayerBeacon(self, Canvas, CameraPosition, ScreenLoc);
		if ( !HUD.bCrosshairOnFriendly
		&& (Abs(screenLoc.X - 0.5*Canvas.ClipX) < 0.1 * Canvas.ClipX)
		&& (screenLoc.Y <= 0.5*Canvas.ClipY) )
	{
		// check if top to bottom crosses center of screen
		screenLoc = Canvas.Project(Location - GetCollisionHeight()*vect(0,0,1));
		if ( screenLoc.Y >= 0.5*Canvas.ClipY )
		{
			HUD.bCrosshairOnFriendly = true;
		}
	}
}
}


simulated function FaceRotation(rotator NewRotation, float DeltaTime)
{
	if ( Physics == PHYS_Ladder )
	{
		NewRotation = OnLadder.Walldir;
	}
	else if ( (Physics == PHYS_Walking) || (Physics == PHYS_Falling) )
	{
		NewRotation.Pitch = 0;
	}
	NewRotation.Roll = Rotation.Roll;
	SetRotation(NewRotation);
}

/* UpdateEyeHeight()
* Update player eye position, based on smoothing view while moving up and down stairs, and adding view bobs for landing and taking steps.
* Called every tick only if bUpdateEyeHeight==true.
*/
event UpdateEyeHeight( float DeltaTime )
{
	local float smooth, MaxEyeHeight, OldEyeHeight, Speed2D, OldBobTime;
	local Actor HitActor;
	local vector HitLocation,HitNormal, X, Y, Z;
	local int m,n;

	if ( bTearOff )
	{
		// no eyeheight updates if dead
		EyeHeight = Default.BaseEyeheight;
		bUpdateEyeHeight = false;
		return;
	}

	if ( abs(Location.Z - OldZ) > 15 )
	{
		// if position difference too great, don't do smooth land recovery
		bJustLanded = false;
		bLandRecovery = false;
	}

	if ( !bJustLanded )
	{
		// normal walking around
		// smooth eye position changes while going up/down stairs
		smooth = FMin(0.9, 10.0 * DeltaTime/CustomTimeDilation);
		LandBob *= (1 - smooth);
		if( Physics == PHYS_Walking || Physics==PHYS_Spider || Controller.IsInState('PlayerSwimming') )
		{
			OldEyeHeight = EyeHeight;
			EyeHeight = FMax((EyeHeight - Location.Z + OldZ) * (1 - smooth) + BaseEyeHeight * smooth,
								-0.5 * CylinderComponent.CollisionHeight);
		}
		else
		{
			EyeHeight = EyeHeight * ( 1 - smooth) + BaseEyeHeight * smooth;
		}
	}
	else if ( bLandRecovery )
	{
		// return eyeheight back up to full height
		smooth = FMin(0.9, 9.0 * DeltaTime);
		OldEyeHeight = EyeHeight;
		LandBob *= (1 - smooth);
		// linear interpolation at end
		if ( Eyeheight > 0.9 * BaseEyeHeight )
		{
			Eyeheight = Eyeheight + 0.15*BaseEyeheight*Smooth;  // 0.15 = (1-0.75)*0.6
		}
		else
			EyeHeight = EyeHeight * (1 - 0.6*smooth) + BaseEyeHeight*0.6*smooth;
		if ( Eyeheight >= BaseEyeheight)
		{
			bJustLanded = false;
			bLandRecovery = false;
			Eyeheight = BaseEyeheight;
		}
	}
	else
	{
		// drop eyeheight a bit on landing
		smooth = FMin(0.65, 8.0 * DeltaTime);
		OldEyeHeight = EyeHeight;
		EyeHeight = EyeHeight * (1 - 1.5*smooth);
		LandBob += 0.08 * (OldEyeHeight - Eyeheight);
		if ( (Eyeheight < 0.25 * BaseEyeheight + 1) || (LandBob > 2.4)  )
		{
			bLandRecovery = true;
			Eyeheight = 0.25 * BaseEyeheight + 1;
		}
	}

	// don't bob if disabled, or just landed
	if( bJustLanded || !bUpdateEyeheight )
	{
		BobTime = 0;
		WalkBob = Vect(0,0,0);
	}
	else
	{
		// add some weapon bob based on jumping
		if ( Velocity.Z > 0 )
		{
		  JumpBob = FMax(-1.5, JumpBob - 0.03 * DeltaTime * FMin(Velocity.Z,300));
		}
		else
		{
		  JumpBob *= (1 -  FMin(1.0, 8.0 * DeltaTime));
		}

		// Add walk bob to movement
		OldBobTime = BobTime;
		Bob = FClamp(Bob, -0.05, 0.05);

		if (Physics == PHYS_Walking )
		{
		  GetAxes(Rotation,X,Y,Z);
		  Speed2D = VSize(Velocity);
		  if ( Speed2D < 10 )
			  BobTime += 0.2 * DeltaTime;
		  else
			  BobTime += DeltaTime * (0.3 + 0.7 * Speed2D/GroundSpeed);
		  WalkBob = Y * Bob * Speed2D * sin(8 * BobTime);
		  AppliedBob = AppliedBob * (1 - FMin(1, 16 * deltatime));
		  WalkBob.Z = AppliedBob;
		  if ( Speed2D > 10 )
			  WalkBob.Z = WalkBob.Z + 0.75 * Bob * Speed2D * sin(16 * BobTime);
		}
		else if ( Physics == PHYS_Swimming )
		{
		  GetAxes(Rotation,X,Y,Z);
		  BobTime += DeltaTime;
		  Speed2D = Sqrt(Velocity.X * Velocity.X + Velocity.Y * Velocity.Y);
		  WalkBob = Y * Bob *  0.5 * Speed2D * sin(4.0 * BobTime);
		  WalkBob.Z = Bob * 1.5 * Speed2D * sin(8.0 * BobTime);
		}
		else
		{
		  BobTime = 0;
		  WalkBob = WalkBob * (1 - FMin(1, 8 * deltatime));
		}

		if ( (Physics == PHYS_Walking) && (VSizeSq(Velocity) > 100) && IsFirstPerson() )
		{
			m = int(0.5 * Pi + 9.0 * OldBobTime/Pi);
			n = int(0.5 * Pi + 9.0 * BobTime/Pi);

			if ( (m != n) && !bIsWalking && !bIsCrouched )
			{
			  ActuallyPlayFootStepSound(0);
			}
		}
		if ( !bWeaponBob )
		{
			WalkBob *= 0.1;
		}
	}
	if ( (CylinderComponent.CollisionHeight - Eyeheight < 12) && IsFirstPerson() )
	{
	  // desired eye position is above collision box
	  // check to make sure that viewpoint doesn't penetrate another actor
		// min clip distance 12
	  HitActor = trace(HitLocation,HitNormal, Location + WalkBob + (MaxStepHeight + CylinderComponent.CollisionHeight) * vect(0,0,1),
					  Location + WalkBob, true, vect(12,12,12),, TRACEFLAG_Blocking);
	  MaxEyeHeight = (HitActor == None) ? CylinderComponent.CollisionHeight + MaxStepHeight : HitLocation.Z - Location.Z;
	  Eyeheight = FMin(Eyeheight, MaxEyeHeight);
	}
}

/* GetPawnViewLocation()
Called by PlayerController to determine camera position in first person view.  Returns
the location at which to place the camera
*/
simulated function Vector GetPawnViewLocation()
{
	if ( bUpdateEyeHeight )
		return Location + EyeHeight * vect(0,0,1) + WalkBob;
	else
		return Location + BaseEyeHeight * vect(0,0,1);
}

/* BecomeViewTarget
	Called by Camera when this actor becomes its ViewTarget */
simulated event BecomeViewTarget( PlayerController PC )
{
	local UTPlayerController UTPC;
	local UTWeapon UTWeap;

	Super.BecomeViewTarget(PC);

	if (LocalPlayer(PC.Player) != None)
	{
		PawnAmbientSound.bAllowSpatialization = false;
		WeaponAmbientSound.bAllowSpatialization = false;

		bArmsAttached = true;
		AttachComponent(ArmsMesh[0]);
		UTWeap = UTWeapon(Weapon);
		if (UTWeap != None)
		{
			if (UTWeap.bUsesOffhand)
			{
				AttachComponent(ArmsMesh[1]);
			}
		}

		UTPC = UTPlayerController(PC);
		if (UTPC != None)
		{
			SetMeshVisibility(UTPC.bBehindView);
		}
		else
		{
			SetMeshVisibility(true);
		}
		bUpdateEyeHeight = true;
	}
}

/* EndViewTarget
	Called by Camera when this actor becomes its ViewTarget */
simulated event EndViewTarget( PlayerController PC )
{
	PawnAmbientSound.bAllowSpatialization = true;
	WeaponAmbientSound.bAllowSpatialization = true;

	if (LocalPlayer(PC.Player) != None)
	{
		SetMeshVisibility(true);
		bArmsAttached=false;
		DetachComponent(ArmsMesh[0]);
		DetachComponent(ArmsMesh[1]);
	}
}

simulated function SetWeaponVisibility(bool bWeaponVisible)
{
	local UTWeapon Weap;
	local AnimNodeSequence WeaponAnimNode, ArmAnimNode;
	local int i;

	Weap = UTWeapon(Weapon);
	if (Weap != None)
	{
		Weap.ChangeVisibility(bWeaponVisible);

		// make the arm animations copy the current weapon anim
		WeaponAnimNode = Weap.GetWeaponAnimNodeSeq();
		if (WeaponAnimNode != None)
		{
			for (i = 0; i < ArrayCount(ArmsMesh); i++)
			{
				if (ArmsMesh[i].bAttached)
				{
					ArmAnimNode = AnimNodeSequence(ArmsMesh[i].Animations);
					if (ArmAnimNode != None)
					{
						ArmAnimNode.SetAnim(WeaponAnimNode.AnimSeqName);
						ArmAnimNode.PlayAnim(WeaponAnimNode.bLooping, WeaponAnimNode.Rate, WeaponAnimNode.CurrentTime);
					}
				}
			}
		}
	}
}

simulated function SetWeaponAttachmentVisibility(bool bAttachmentVisible)
{
	bWeaponAttachmentVisible = bAttachmentVisible;
	if (CurrentWeaponAttachment != None )
	{
		CurrentWeaponAttachment.ChangeVisibility(bAttachmentVisible);
	}
}

/** sets whether or not the owner of this pawn can see it */
simulated function SetMeshVisibility(bool bVisible)
{
	local UTCarriedObject Flag;

	// Handle the main player mesh
	if (Mesh != None)
	{
		Mesh.SetOwnerNoSee(!bVisible);
	}

	SetOverlayVisibility(bVisible);

	// Handle any weapons they might have
	SetWeaponVisibility(!bVisible);

	// realign any attached flags
	foreach BasedActors(class'UTCarriedObject', Flag)
	{
		HoldGameObject(Flag);
	}
}

exec function FixedView(string VisibleMeshes)
{
	local bool bVisibleMeshes;
	local float fov;

	if (WorldInfo.NetMode == NM_Standalone)
	{
		if (VisibleMeshes != "")
		{
			bVisibleMeshes = ( VisibleMeshes ~= "yes" || VisibleMeshes~="true" || VisibleMeshes~="1" );

			if (VisibleMeshes ~= "default")
				bVisibleMeshes = !IsFirstPerson();

			SetMeshVisibility(bVisibleMeshes);
		}

		if (!bFixedView)
			CalcCamera( 0.0f, FixedViewLoc, FixedViewRot, fov );

		bFixedView = !bFixedView;
		LogInternal("FixedView:" @ bFixedView);
	}
}

function DeactivateSpawnProtection()
{
	if ( Role < ROLE_Authority )
		return;
	if ( !bSpawnDone )
	{
		bSpawnDone = true;
		if (WorldInfo.TimeSeconds - SpawnTime < UTGame(WorldInfo.Game).SpawnProtectionTime)
		{
			bSpawnIn = true;
			if (BodyMatColor == SpawnProtectionColor)
			{
				ClearBodyMatColor();
			}
			SpawnTime = WorldInfo.TimeSeconds - UTGame(WorldInfo.Game).SpawnProtectionTime - 1;
		}
		SpawnTime = -100000;
	}
}

function DoTranslocate(vector PrevLocation)
{
	local int TeamNum;

	if ( (PlayerReplicationInfo != None) && (PlayerReplicationInfo.Team != None) )
	{
		TeamNum = PlayerReplicationInfo.Team.TeamIndex;
	}

	PlayTeleportEffect(false, true);
	DoTranslocateOut(PrevLocation,TeamNum);

	BigTeleportCount++;
	PostBigTeleport();
}

function PlayTeleportEffect(bool bOut, bool bSound)
{
	local int TeamNum, TransCamIndx;
	local UTPlayerController PC;

	if ( (PlayerReplicationInfo != None) && (PlayerReplicationInfo.Team != None) )
	{
		TeamNum = PlayerReplicationInfo.Team.TeamIndex;
	}
	if ( !bSpawnIn && (WorldInfo.TimeSeconds - SpawnTime < UTGame(WorldInfo.Game).SpawnProtectionTime) )
	{
		bSpawnIn = true;
		SetBodyMatColor( SpawnProtectionColor, UTGame(WorldInfo.Game).SpawnProtectionTime );
		SpawnTransEffect(TeamNum);
		if (bSound)
		{
			PlaySound(SpawnSound);
		}
	}
	else
	{
		SetBodyMatColor( TranslocateColor[TeamNum], 1.0 );
		SpawnTransEffect(TeamNum);
		if (bSound)
		{
			PlaySound(TeleportSound);
		}
	}

	if (bOut)
	{
		PC = UTPlayerController(Controller);
		if (PC != None)
		{
			if ( !WorldInfo.Game.bTeamGame || PlayerReplicationInfo == None || PlayerReplicationInfo.Team == None
				|| PlayerReplicationInfo.Team.TeamIndex > 1 )
			{
				TransCamIndx = 2;
			}
			else
			{
				TransCamIndx = TeamNum;
			}
			PC.ClientPlayCameraAnim(TransCameraAnim[TransCamIndx], 1.0f);
		}
	}
	Super.PlayTeleportEffect( bOut, bSound );
}

function SpawnTransEffect(int TeamNum)
{
	if (TransInEffects[0] != None)
	{
		Spawn(TransInEffects[TeamNum],self,,Location + GetCollisionHeight() * vect(0,0,0.75));
	}
}

function DoTranslocateOut(Vector PrevLocation, int TeamNum)
{
	local UTEmit_TransLocateOut TLEffect;

	if ( TransOutEffects[0] == None )
		return;

	TLEffect = UTEmit_TranslocateOut( Spawn(TransOutEffects[TeamNum], self,, PrevLocation, rotator(Location - PrevLocation)) );

	if (TLEffect != none && TLEffect.CollisionComponent != none)
	{
		TLEffect.CollisionComponent.SetActorCollision(true, false);
	}
}

simulated event StartDriving(Vehicle V)
{
	local UTWeaponPawn WeaponPawn;
	local UTWeapon UTWeap;
	local UTVehicleBase VBase;

	Super.StartDriving(V);

	DeactivateSpawnProtection();

	UTWeap = UTWeapon(Weapon);
	if (UTWeap != None)
	{
		StopWeaponFiring();
		UTWeap.HolderEnteredVehicle();
	}

	SetWeaponVisibility(false);
	SetWeaponAmbientSound(None);

	SetTeamColor();

	if (Role == ROLE_Authority)
	{
		// if we're driving a UTWeaponPawn, fill in the DrivenWeaponPawn info for remote clients
		WeaponPawn = UTWeaponPawn(V);
		if (WeaponPawn != None && WeaponPawn.MyVehicle != None && WeaponPawn.MySeatIndex != INDEX_NONE)
		{
			DrivenWeaponPawn.BaseVehicle = WeaponPawn.MyVehicle;
			DrivenWeaponPawn.SeatIndex = WeaponPawn.MySeatIndex;
			DrivenWeaponPawn.PRI = PlayerReplicationInfo;
		}
	}

	if (WorldInfo.NetMode != NM_DedicatedServer && WeaponOverlayFlags > 0)
	{
		VBase = UTVehicleBase(V);
		if (VBase != None)
		{
			VBase.ApplyWeaponEffects(WeaponOverlayFlags);
		}
	}

	if (CurrFamilyInfo != None)
	{
		Mesh.SetScale(CurrFamilyInfo.default.DrivingDrawScale);
	}
}

/**
 * StartDriving() and StopDriving() also called on clients
 * on transitions of DrivenVehicle variable.
 * Network: ALL
 */
simulated event StopDriving(Vehicle V)
{
	local DrivenWeaponPawnInfo EmptyWeaponPawnInfo;
	local UTVehicleBase VBase;
	local UTInventoryManager UTInv;

	Mesh.SetLightEnvironment(LightEnvironment);
	Mesh.SetScale(DefaultMeshScale);

	// ignore on non-owning client if we still have valid DrivenWeaponPawn
	if (Role < ROLE_Authority && DrivenWeaponPawn.BaseVehicle != None && !IsLocallyControlled())
	{
		// restore DrivenVehicle reference
		DrivenVehicle = ClientSideWeaponPawn;
	}
	else
	{
		if ( (Role == ROLE_Authority) && (PlayerController(Controller) != None) && (UTVehicle(V) != None) )
			UTVehicle(V).PlayerStartTime = WorldInfo.TimeSeconds + 12;
		Super.StopDriving(V);

		// don't allow pawn to double jump on exit (if was jumping when entered)
		MultiJumpRemaining = 0;

		SetWeaponVisibility(IsFirstPerson());
		bIgnoreForces = ( (UTGame(WorldInfo.Game) != None) && UTGame(WorldInfo.Game).bDemoMode && (PlayerController(Controller) != None) );

		if ( Weapon != None )
		{
			Weapon.GotoState('WeaponEquipping');
		}
		if (Role == ROLE_Authority)
		{
			DrivenWeaponPawn = EmptyWeaponPawnInfo;

			// verify whether need to force switch to deployable
			UTInv = UTInventoryManager(InvManager);
			if ( UTInv != None )
			{
				UTInv.ForceDeployableSwitch();
			}
		}
	}

	if (WorldInfo.NetMode != NM_DedicatedServer)
	{
		VBase = UTVehicleBase(V);
		if (VBase != None)
		{
			VBase.ApplyWeaponEffects(0);
		}
	}
}

simulated function ClientReStart()
{
	local rotator AdjustedRotation;

	Super.ClientRestart();

	if (Controller != None)
	{
		AdjustedRotation = Controller.Rotation;
		AdjustedRotation.Roll = 0;
		Controller.SetRotation(AdjustedRotation);
	}
}

//=============================================================================
// Armor interface.

/** GetShieldStrength()
returns total armor value currently held by this pawn (not including helmet).
*/
function int GetShieldStrength()
{
	return ShieldBeltArmor + VestArmor + ThighpadArmor + HelmetArmor;
}

/** AbsorbDamage()
reduce damage and remove shields based on the absorption rate.
returns the remaining armor strength.
*/
function int AbsorbDamage(out int Damage, int CurrentShieldStrength, float AbsorptionRate)
{
	local int MaxAbsorbedDamage;

	MaxAbsorbedDamage = Min(Damage * AbsorptionRate, CurrentShieldStrength);
	Damage -= MaxAbsorbedDamage;
	return CurrentShieldStrength - MaxAbsorbedDamage;
}


/** ShieldAbsorb()
returns the resultant amount of damage after shields have absorbed what they can
*/
function int ShieldAbsorb( int Damage )
{
	if ( Health <= 0 )
	{
		return damage;
	}

	// shield belt absorbs 100% of damage
	if ( ShieldBeltArmor > 0 )
	{
		bShieldAbsorb = true;
		ShieldBeltArmor = AbsorbDamage(Damage, ShieldBeltArmor, 1.0);
		if (ShieldBeltArmor == 0)
		{
			SetOverlayMaterial(None);
		}
		if ( Damage == 0 )
		{
			SetBodyMatColor(SpawnProtectionColor, 1.0);
			PlaySound(ArmorHitSound);
			return 0;
		}
	}

	// vest absorbs 75% of damage
	if ( VestArmor > 0 )
	{
		bShieldAbsorb = true;
		VestArmor = AbsorbDamage(Damage, VestArmor, 0.75);
		if ( Damage == 0 )
		{
			return 0;
		}
	}

	// thighpads absorb 50% of damage
	if ( ThighpadArmor > 0 )
	{
		bShieldAbsorb = true;
		ThighpadArmor = AbsorbDamage(Damage, ThighpadArmor, 0.5);
		if ( Damage == 0 )
		{
			return 0;
		}
	}

	// helmet absorbs 20% of damage
	if ( HelmetArmor > 0 )
	{
		bShieldAbsorb = true;
		HelmetArmor = AbsorbDamage(Damage, HelmetArmor, 0.5);
		if ( Damage == 0 )
		{
			return 0;
		}
	}

	return Damage;
}

/* AdjustDamage()
adjust damage based on inventory, other attributes
*/
function AdjustDamage( out int inDamage, out Vector momentum, Controller instigatedBy, Vector hitlocation, class<DamageType> damageType, optional TraceHitInfo HitInfo )
{
	local int PreDamage;

	if ( bIsInvulnerable )
		inDamage = 0;

	if ( UTWeapon(Weapon) != None )
	{
		UTWeapon(Weapon).AdjustPlayerDamage( inDamage, InstigatedBy, HitLocation, Momentum, DamageType );
	}

	// If x-ray effect is active, use the damage multiplier
	if ( bXRayEffectActive )
	{
		inDamage *= XRayEffectDamageMult;
	}
	if( DamageType.default.bArmorStops && (inDamage > 0) )
	{
		PreDamage = inDamage;
		inDamage = ShieldAbsorb(inDamage);

		// still show damage effect on HUD if damage completely absorbed
		if ( (inDamage == 0) && (Controller != None) )
		{
			Controller.NotifyTakeHit(InstigatedBy, HitLocation, Min(PreDamage,10), DamageType, Momentum);
		}
	}
}

//=============================================================================

function DropFlag()
{
	if ( UTPlayerReplicationInfo(PlayerReplicationInfo)==None || !PlayerReplicationInfo.bHasFlag )
		return;

	UTPlayerReplicationInfo(PlayerReplicationInfo).GetFlag().Drop();
	bJustDroppedOrb = true;
}

/** HoldGameObject()
* Attach GameObject to mesh.
* @param GameObj : Game object to hold
*/
simulated event HoldGameObject(UTCarriedObject UTGameObj)
{
	UTGameObj.SetHardAttach(UTGameObj.default.bHardAttach);
	UTGameObj.bIgnoreBaseRotation = UTGameObj.default.bIgnoreBaseRotation;

	if ( class'Engine'.static.IsSplitScreen() )
	{
		if ( UTGameObj.GameObjBone3P != '' )
		{
			UTGameObj.SetBase(self,,Mesh,UTGameObj.GameObjBone3P);
		}
		else
		{
			UTGameObj.SetBase(self);
		}
		UTGameObj.SetRelativeRotation(UTGameObj.GameObjRot3P);
		UTGameObj.SetRelativeLocation(UTGameObj.GameObjOffset3P);
	}
	else if (IsFirstPerson())
	{
		UTGameObj.SetBase(self);
		UTGameObj.SetRelativeRotation(UTGameObj.GameObjRot1P);
		UTGameObj.SetRelativeLocation(UTGameObj.GameObjOffset1P);
	}
	else
	{
		if ( UTGameObj.GameObjBone3P != '' )
		{
			UTGameObj.SetBase(self,,Mesh,UTGameObj.GameObjBone3P);
		}
		else
		{
			UTGameObj.SetBase(self);
		}
		UTGameObj.SetRelativeRotation(UTGameObj.GameObjRot3P);
		UTGameObj.SetRelativeLocation(UTGameObj.GameObjOffset3P);
	}
}

function bool GiveHealth(int HealAmount, int HealMax)
{
	if (Health < HealMax)
	{
		Health = Min(HealMax, Health + HealAmount);
		return true;
	}
	return false;
}

/**
 * Overridden to return the actual player name from this Pawn's
 * PlayerReplicationInfo (PRI) if available.
 */
function String GetDebugName()
{
	// return the actual player name from the PRI if available
	if (PlayerReplicationInfo != None)
	{
		return "";
	}
	// otherwise return the formatted object name
	return GetItemName(string(self));
}

simulated event PlayFootStepSound(int FootDown)
{
	local PlayerController PC;

	if ( !IsFirstPerson() )
	{
		ForEach LocalPlayerControllers(class'PlayerController', PC)
		{
			if ( (PC.ViewTarget != None) && (VSizeSq(PC.ViewTarget.Location - Location) < MaxFootstepDistSq) )
			{
				ActuallyPlayFootstepSound(FootDown);
				return;
			}
		}
	}
}

/**
 * Handles actual playing of sound.  Separated from PlayFootstepSound so we can
 * ignore footstep sound notifies in first person.
 */
simulated function ActuallyPlayFootstepSound(int FootDown)
{
	local SoundCue FootSound;

	FootSound = SoundGroupClass.static.GetFootstepSound(FootDown, GetMaterialBelowFeet());
	if (FootSound != None)
	{
		PlaySound(FootSound, false, true,,, true);
	}
}

simulated function name GetMaterialBelowFeet()
{
	local vector HitLocation, HitNormal;
	local TraceHitInfo HitInfo;
	local UTPhysicalMaterialProperty PhysicalProperty;
	local actor HitActor;
	local float TraceDist;

	TraceDist = 1.5 * GetCollisionHeight();

	HitActor = Trace(HitLocation, HitNormal, Location - TraceDist*vect(0,0,1), Location, false,, HitInfo, TRACEFLAG_PhysicsVolumes);
	if ( WaterVolume(HitActor) != None )
	{
		return (Location.Z - HitLocation.Z < 0.33*TraceDist) ? 'Water' : 'ShallowWater';
	}
	if (HitInfo.PhysMaterial != None)
	{
		PhysicalProperty = UTPhysicalMaterialProperty(HitInfo.PhysMaterial.GetPhysicalMaterialProperty(class'UTPhysicalMaterialProperty'));
		if (PhysicalProperty != None)
		{
			return PhysicalProperty.MaterialType;
		}
	}
	return '';

}
event PlayLandingSound()
{
	local PlayerController PC;

	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if ( (PC.ViewTarget != None) && (VSizeSq(PC.ViewTarget.Location - Location) < MaxJumpSoundDistSq) )
		{
			PlaySound(SoundGroupClass.static.GetLandSound(GetMaterialBelowFeet()));
			return;
		}
	}
}

event PlayJumpingSound()
{
	local PlayerController PC;

	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if ( (PC.ViewTarget != None) && (VSizeSq(PC.ViewTarget.Location - Location) < MaxJumpSoundDistSq) )
		{
			PlaySound(SoundGroupClass.static.GetJumpSound(GetMaterialBelowFeet()));
			return;
		}
	}
}

/** @return whether or not we should gib due to damage from the passed in damagetype */
simulated function bool ShouldGib(class<UTDamageType> UTDamageType)
{
	return ( (Mesh != None) && (bTearOffGibs || UTDamageType.Static.ShouldGib(self)) );
}

/** spawn a special gib for this pawn's head and sets it as the ViewTarget for any players that were viewing this pawn */
simulated function SpawnHeadGib(class<UTDamageType> UTDamageType, vector HitLocation)
{
	local UTGib Gib;
	local UTPlayerController PC;
	local class<UTEmitCameraEffect> CameraEffect;
	local vector ViewLocation;
	local rotator ViewRotation;
	local PlayerReplicationInfo OldRealViewTarget;
	local class<UTFamilyInfo> FamilyInfo;

	if ( class'GameInfo'.Static.UseLowGore(WorldInfo) )
	{
		bHeadGibbed = true;
		return;
	}

	if (!bHeadGibbed)
	{
		// create separate actor for the head so it can bounce around independently
		if ( HitLocation == Location )
		{
			HitLocation = Location + vector(Rotation);
		}

		FamilyInfo = CurrFamilyInfo;
		Gib = SpawnGib(CurrFamilyInfo.default.HeadGib.GibClass, FamilyInfo.default.HeadGib.BoneName, UTDamageType, HitLocation, false);

		if (Gib != None)
		{
			Gib.SetRotation(Rotation);
			Gib.SetTexturesToBeResident( Gib.LifeSpan );
			SetHeadScale(0.f);
			WorldInfo.MyEmitterPool.SpawnEmitter(FamilyInfo.default.HeadShotEffect, Gib.Location, rotator(vect(0,0,1)), Gib);

			foreach LocalPlayerControllers(class'UTPlayerController', PC)
			{
				if (PC.ViewTarget == self)
				{
					// save RealViewTarget for spectating so that this transition doesn't affect it
					OldRealViewTarget = PC.RealViewTarget;
					if (UTDamageType.default.bHeadGibCamera && (PC.UsingFirstPersonCamera() || !PC.IsInState('BaseSpectating')))
					{
						PC.SetViewTarget(Gib);

						CameraEffect = UTDamageType.static.GetDeathCameraEffectVictim(self);
						if (CameraEffect != None)
						{
							PC.ClientSpawnCameraEffect(CameraEffect);
						}
					}
					else
					{
						PC.GetPlayerViewPoint(ViewLocation, ViewRotation);
						PC.SetViewTarget(PC);
						PC.SetLocation(ViewLocation);
						PC.SetRotation(ViewRotation);
					}
					PC.RealViewTarget = OldRealViewTarget;
				}
			}

			bHeadGibbed = true;
		}
	}
}

simulated function UTGib SpawnGib(class<UTGib> GibClass, name BoneName, class<UTDamageType> UTDamageType, vector HitLocation, bool bSpinGib)
{
	local UTGib Gib;
	local rotator SpawnRot;
	local int SavedPitch;
	local float GibPerterbation;
	local rotator VelRotation;
	local vector X, Y, Z;

	SpawnRot = QuatToRotator(Mesh.GetBoneQuaternion(BoneName));

	// @todo fixmesteve temp workaround for gib orientation problem
	SavedPitch = SpawnRot.Pitch;
	SpawnRot.Pitch = SpawnRot.Yaw;
	SpawnRot.Yaw = SavedPitch;
	Gib = Spawn(GibClass, self,, Mesh.GetBoneLocation(BoneName), SpawnRot);

	if ( Gib != None )
	{
		// add initial impulse
		GibPerterbation = UTDamageType.default.GibPerterbation * 32768.0;
		VelRotation = rotator(Gib.Location - HitLocation);
		VelRotation.Pitch += (FRand() * 2.0 * GibPerterbation) - GibPerterbation;
		VelRotation.Yaw += (FRand() * 2.0 * GibPerterbation) - GibPerterbation;
		VelRotation.Roll += (FRand() * 2.0 * GibPerterbation) - GibPerterbation;
		GetAxes(VelRotation, X, Y, Z);

		Gib.Velocity = Velocity + Z * ( FRand() * 50 ) ;
		Gib.GibMeshComp.WakeRigidBody();
		Gib.GibMeshComp.SetRBLinearVelocity(Gib.Velocity, false);
		if ( bSpinGib )
		{
			Gib.GibMeshComp.SetRBAngularVelocity(VRand() * 50, false);
		}

		// let damagetype spawn any additional effects
		UTDamageType.static.SpawnGibEffects(Gib);
		Gib.LifeSpan = Gib.LifeSpan + (2.0 * FRand());
	}

	return Gib;
}

/** spawns gibs and hides the pawn's mesh */
simulated function SpawnGibs(class<UTDamageType> UTDamageType, vector HitLocation)
{
	local int i;
	local bool bSpawnHighDetail;
	local GibInfo GibInfo;

	// make sure client gibs me too
	bTearOffGibs = true;

	if ( !bGibbed )
	{
		if ( WorldInfo.NetMode == NM_DedicatedServer )
		{
			bGibbed = true;
			return;
		}

		// play sound
		if(WorldInfo.TimeSeconds - DeathTime < 0.35) // had to have just died to do a death scream.
		{
			SoundGroupClass.static.PlayGibSound(self);
		}
		SoundGroupClass.static.PlayBodyExplosion(self); // the body sounds can go off any time

		SpawnHeadGib(UTDamageType, HitLocation);

		// if we had one of these attached we need to hide it (e.g. headshotted and then gibbed)
		if( HeadshotNeckAttachment != none )
		{
			HeadshotNeckAttachment.SetHidden(true);
		}

		// gib particles
		if (GetFamilyInfo().default.GibExplosionTemplate != None && EffectIsRelevant(Location, false, 7000))
		{
			WorldInfo.MyEmitterPool.SpawnEmitter(GetFamilyInfo().default.GibExplosionTemplate, Location, Rotation);
			// spawn all other gibs
			bSpawnHighDetail = !WorldInfo.bDropDetail && (Worldinfo.TimeSeconds - LastRenderTime < 1);
			for (i = 0; i < CurrFamilyInfo.default.Gibs.length; i++)
			{
				GibInfo = CurrFamilyInfo.default.Gibs[i];

				if ( bSpawnHighDetail || !GibInfo.bHighDetailOnly )
				{
					SpawnGib(GibInfo.GibClass, GibInfo.BoneName, UTDamageType, HitLocation, true);
				}
			}
		}

		// if standalone or client, destroy here
		if ( WorldInfo.NetMode != NM_DedicatedServer && !WorldInfo.IsRecordingDemo() &&
			((WorldInfo.NetMode != NM_ListenServer) || (WorldInfo.Game.NumPlayers + WorldInfo.Game.NumSpectators < 2)) )
		{
			Destroy();
		}
		else
		{
			TurnOffPawn();
		}

		bGibbed = true;
	}
}

simulated function TurnOffPawn()
{
	// hide everything, turn off collision
	if (Physics == PHYS_RigidBody)
	{
		Mesh.SetHasPhysicsAssetInstance(FALSE);
		Mesh.PhysicsWeight = 0.f;
		SetPhysics(PHYS_None);
	}
	if (!IsInState('Dying')) // so we don't restart Begin label and possibly play dying sound again
	{
		GotoState('Dying');
	}
	SetPhysics(PHYS_None);
	SetCollision(false, false);
	//@warning: can't set bHidden - that will make us lose net relevancy to everyone
	Mesh.SetHidden(true);
	if (OverlayMesh != None)
	{
		OverlayMesh.SetHidden(true);
	}
}

/**
 * Responsible for playing any death effects, animations, etc.
 *
 * @param 	DamageType - type of damage responsible for this pawn's death
 *
 * @param	HitLoc - location of the final shot
 */
simulated function PlayDying(class<DamageType> DamageType, vector HitLoc)
{
	local vector ApplyImpulse, ShotDir;
	local TraceHitInfo HitInfo;
	local PlayerController PC;
	local bool bPlayersRagdoll, bUseHipSpring;
	local class<UTDamageType> UTDamageType;
	local RB_BodyInstance HipBodyInst;
	local int HipBoneIndex;
	local matrix HipMatrix;
	local class<UTEmitCameraEffect> CameraEffect;
	local name HeadShotSocketName;
	local SkeletalMeshSocket SMS;

	if ( DarkMatchLight != None )
	{
		DarkMatchLight.SetEnabled(false);
		DarkMatchLight = None;
	}

	bCanTeleport = false;
	bReplicateMovement = false;
	bTearOff = true;
	bPlayedDeath = true;
	bForcedFeignDeath = false;
	bPlayingFeignDeathRecovery = false;

	HitDamageType = DamageType; // these are replicated to other clients
	TakeHitLocation = HitLoc;

	// make sure I don't have an active weaponattachment
	CurrentWeaponAttachmentClass = None;
	WeaponAttachmentChanged();

	if ( WorldInfo.NetMode == NM_DedicatedServer )
	{
 		UTDamageType = class<UTDamageType>(DamageType);
		// tell clients whether to gib
		bTearOffGibs = (UTDamageType != None && ShouldGib(UTDamageType));
		bGibbed = bGibbed || bTearOffGibs;
		GotoState('Dying');
		return;
	}

	// Is this the local player's ragdoll?
	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if( pc.ViewTarget == self )
		{
			if ( UTHud(pc.MyHud)!=none )
				UTHud(pc.MyHud).DisplayHit(HitLoc, 100, DamageType);
			bPlayersRagdoll = true;
			break;
		}
	}
	if ( (WorldInfo.TimeSeconds - LastRenderTime > 3) && !bPlayersRagdoll )
	{
		if (WorldInfo.NetMode == NM_ListenServer || WorldInfo.IsRecordingDemo())
		{
			if (WorldInfo.Game.NumPlayers + WorldInfo.Game.NumSpectators < 2 && !WorldInfo.IsRecordingDemo())
			{
				Destroy();
				return;
			}
			bHideOnListenServer = true;

			// check if should gib (for clients)
			UTDamageType = class<UTDamageType>(DamageType);
			if (UTDamageType != None && ShouldGib(UTDamageType))
			{
				bTearOffGibs = true;
				bGibbed = true;
			}
			TurnOffPawn();
			return;
		}
		else
		{
			// if we were not just controlling this pawn,
			// and it has not been rendered in 3 seconds, just destroy it.
			Destroy();
			return;
		}
	}

	UTDamageType = class<UTDamageType>(DamageType);
	if (UTDamageType != None && !class'GameInfo'.static.UseLowGore(WorldInfo) && ShouldGib(UTDamageType))
	{
		SpawnGibs(UTDamageType, HitLoc);
	}
	else
	{
		CheckHitInfo( HitInfo, Mesh, Normal(TearOffMomentum), TakeHitLocation );

		// check to see if we should do a CustomDamage Effect
		if( UTDamageType != None )
		{
			if( UTDamageType.default.bUseDamageBasedDeathEffects )
			{
				UTDamageType.static.DoCustomDamageEffects(self, UTDamageType, HitInfo, TakeHitLocation);
			}

			if( UTPlayerController(PC) != none )
			{
				CameraEffect = UTDamageType.static.GetDeathCameraEffectVictim(self);
				if (CameraEffect != None)
				{
					UTPlayerController(PC).ClientSpawnCameraEffect(CameraEffect);
				}
			}
		}

		bBlendOutTakeHitPhysics = false;

		// Turn off hand IK when dead.
		SetHandIKEnabled(false);

		// if we had some other rigid body thing going on, cancel it
		if (Physics == PHYS_RigidBody)
		{
			//@note: Falling instead of None so Velocity/Acceleration don't get cleared
			setPhysics(PHYS_Falling);
		}

		PreRagdollCollisionComponent = CollisionComponent;
		CollisionComponent = Mesh;

		Mesh.MinDistFactorForKinematicUpdate = 0.f;

		// If we had stopped updating kinematic bodies on this character due to distance from camera, force an update of bones now.
		if( Mesh.bNotUpdatingKinematicDueToDistance )
		{
			Mesh.ForceSkelUpdate();
			Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
		}

		Mesh.PhysicsWeight = 1.0;

		if(UTDamageType != None && UTDamageType.default.DeathAnim != '' && (FRand() > 0.5) )
		{
			// Don't want to use stop player and use hip-spring if in the air (eg PHYS_Falling)
			if(Physics == PHYS_Walking && UTDamageType.default.bAnimateHipsForDeathAnim)
			{
				SetPhysics(PHYS_None);
				bUseHipSpring=true;
			}
			else
			{
				SetPhysics(PHYS_RigidBody);
				// We only want to turn on 'ragdoll' collision when we are not using a hip spring, otherwise we could push stuff around.
				SetPawnRBChannels(TRUE);
			}

			if ( Mesh.PhysicsAssetInstance != None )
			{
				Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
	
				// Turn on angular motors on skeleton.
				Mesh.bUpdateJointsFromAnimation = TRUE;
				Mesh.PhysicsAssetInstance.SetNamedMotorsAngularPositionDrive(false, false, NoDriveBodies, Mesh, true);
				Mesh.PhysicsAssetInstance.SetAngularDriveScale(1.0f, 1.0f, 0.0f);
	
				// If desired, turn on hip spring to keep physics character upright
				if(bUseHipSpring)
				{
					HipBodyInst = Mesh.PhysicsAssetInstance.FindBodyInstance('b_Hips', Mesh.PhysicsAsset);
					HipBoneIndex = Mesh.MatchRefBone('b_Hips');
					HipMatrix = Mesh.GetBoneMatrix(HipBoneIndex);
					HipBodyInst.SetBoneSpringParams(DeathHipLinSpring, DeathHipLinDamp, DeathHipAngSpring, DeathHipAngDamp);
					HipBodyInst.bMakeSpringToBaseCollisionComponent = FALSE;
					HipBodyInst.EnableBoneSpring(TRUE, TRUE, HipMatrix);
					HipBodyInst.bDisableOnOverextension = TRUE;
					HipBodyInst.OverextensionThreshold = 100.f;
				}
			}

			FullBodyAnimSlot.PlayCustomAnim(UTDamageType.default.DeathAnim, UTDamageType.default.DeathAnimRate, 0.05, -1.0, false, false);
			SetTimer(0.1, true, 'DoingDeathAnim');
			StartDeathAnimTime = WorldInfo.TimeSeconds;
			TimeLastTookDeathAnimDamage = WorldInfo.TimeSeconds;
			DeathAnimDamageType = UTDamageType;
		}
		else
		{
			SetPhysics(PHYS_RigidBody);
			Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
			SetPawnRBChannels(TRUE);

			if( TearOffMomentum != vect(0,0,0) )
			{
				ShotDir = normal(TearOffMomentum);
				ApplyImpulse = ShotDir * DamageType.default.KDamageImpulse;

				// If not moving downwards - give extra upward kick
				if ( Velocity.Z > -10 )
				{
					ApplyImpulse += Vect(0,0,1)*DamageType.default.KDeathUpKick;
				}
				Mesh.AddImpulse(ApplyImpulse, TakeHitLocation, HitInfo.BoneName, true);
			}
		}
		GotoState('Dying');

		if (WorldInfo.NetMode != NM_DedicatedServer && UTDamageType != None && UTDamageType.default.bSeversHead && !bDeleteMe)
		{
			SpawnHeadGib(UTDamageType, HitLoc);

			if ( !class'GameInfo'.Static.UseLowGore(WorldInfo) )
			{
				HeadShotSocketName = GetFamilyInfo().default.HeadShotGoreSocketName;
				SMS = Mesh.GetSocketByName( HeadShotSocketName );
				if( SMS != none )
				{
					HeadshotNeckAttachment = new(self) class'StaticMeshComponent';
					HeadshotNeckAttachment.SetActorCollision( FALSE, FALSE );
					HeadshotNeckAttachment.SetBlockRigidBody( FALSE );
					HeadshotNeckAttachment.SetScale(0.5);

					Mesh.AttachComponentToSocket( HeadshotNeckAttachment, HeadShotSocketName );
					HeadshotNeckAttachment.SetStaticMesh( GetFamilyInfo().default.HeadShotNeckGoreAttachment );
					HeadshotNeckAttachment.SetLightEnvironment( LightEnvironment );
				}
			}
		}
	}
}

simulated function DoingDeathAnim()
{
	local RB_BodyInstance HipBodyInst;
	local matrix DummyMatrix;
	local AnimNodeSequence SlotSeqNode;
	local float TimeSinceDeathAnimStart, MotorScale;
	local bool bStopAnim;


	if(DeathAnimDamageType.default.MotorDecayTime != 0.0)
	{
		TimeSinceDeathAnimStart = WorldInfo.TimeSeconds - StartDeathAnimTime;
		MotorScale = 1.0 - (TimeSinceDeathAnimStart/DeathAnimDamageType.default.MotorDecayTime);

		// If motors are scaled to zero, stop death anim
		if(MotorScale <= 0.0)
		{
			bStopAnim = TRUE;
		}
		// If non-zero, scale motor strengths
		else
		{
			Mesh.PhysicsAssetInstance.SetAngularDriveScale(MotorScale, MotorScale, 0.0f);
		}
	}

	// If we want to stop animation after a certain
	if( DeathAnimDamageType != None &&
		DeathAnimDamageType.default.StopAnimAfterDamageInterval != 0.0 &&
		(WorldInfo.TimeSeconds - TimeLastTookDeathAnimDamage) > DeathAnimDamageType.default.StopAnimAfterDamageInterval )
	{
		bStopAnim = TRUE;
	}


	// If done playing custom death anim - turn off bone motors.
	SlotSeqNode = AnimNodeSequence(FullBodyAnimSlot.Children[1].Anim);
	if(!SlotSeqNode.bPlaying || bStopAnim)
	{
		SetPhysics(PHYS_RigidBody);
		Mesh.PhysicsAssetInstance.SetAllMotorsAngularPositionDrive(false, false);
		HipBodyInst = Mesh.PhysicsAssetInstance.FindBodyInstance('b_Hips', Mesh.PhysicsAsset);
		HipBodyInst.EnableBoneSpring(FALSE, FALSE, DummyMatrix);

		// Ensure we have ragdoll collision on at this point
		SetPawnRBChannels(TRUE);

		ClearTimer('DoingDeathAnim');
		DeathAnimDamageType = None;
	}
}

simulated event Destroyed()
{
	local PlayerController PC;
	local Actor A;

	Super.Destroyed();

	foreach BasedActors(class'Actor', A)
	{
		A.PawnBaseDied();
	}

	// remove from local HUD's post-rendered list
	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if ( UTHUD(PC.MyHUD) != None )
		{
			UTHUD(PC.MyHUD).RemovePostRenderedActor(self);
		}
	}

	if (CurrentWeaponAttachment != None)
	{
		CurrentWeaponAttachment.DetachFrom(Mesh);
		CurrentWeaponAttachment.Destroy();
	}
}


function AddDefaultInventory()
{
	Controller.ClientSwitchToBestWeapon();
}

/**
  * Add a new spidermine to the list of spidermines currently chasing me.  Used for aiming help on console
  */
function AddSpiderChaser(UTProj_SpiderMineBase NewChaser)
{
	local int i;

	for ( i=0; i<SpiderChasers.Length; i++ )
	{
		if ( SpiderChasers[i] == NewChaser )
		{
			return;
		}
	}

	for ( i=0; i<SpiderChasers.Length; i++ )
	{
		if ( (SpiderChasers[i] == None) || SpiderChasers[i].bDeleteMe || (SpiderChasers[i].TargetPawn != self) )
		{
			SpiderChasers[i] = NewChaser;
			return;
		}
	}
	SpiderChasers[SpiderChasers.Length] = NewChaser;
}

/**
 *	Calculate camera view point, when viewing this pawn.
 *
 * @param	fDeltaTime	delta time seconds since last update
 * @param	out_CamLoc	Camera Location
 * @param	out_CamRot	Camera Rotation
 * @param	out_FOV		Field of View
 *
 * @return	true if Pawn should provide the camera point of view.
 */
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
	local PlayerController PC;
	local bool bIsFirstPerson, bUseBlendedRot;
	local rotator BlendedTargetViewRotation;

	// Handle the fixed camera
	if (bFixedView)
	{
		out_CamLoc = FixedViewLoc;
		out_CamRot = FixedViewRot;
	}
	else
	{
		bIsFirstPerson = true;
		ForEach LocalPlayerControllers(class'PlayerController', PC)
		{
			if ( PC.ViewTarget == self )
			{
				if ( !PC.UsingFirstPersonCamera() )
				{
					bIsFirstPerson = false;
				}
				else if ( WorldInfo.bWithinDemoPlayback )
				{
					bUseBlendedRot = true;
					BlendedTargetViewRotation = PC.BlendedTargetViewRotation;
				}
				break;
			}
		}
		if ( bIsFirstPerson )	
		{
			// By default, we view through the Pawn's eyes..
			GetActorEyesViewPoint( out_CamLoc, out_CamRot );
			if ( bUseBlendedRot )
			{
				out_CamRot = BlendedTargetViewRotation;
			}
		}
		else
		{
			// Handle BehindView
			CalcThirdPersonCam(fDeltaTime, out_CamLoc, out_CamRot, out_FOV);
		}

		if ( UTWeapon(Weapon) != none)
		{
			UTWeapon(Weapon).WeaponCalcCamera(fDeltaTime, out_CamLoc, out_CamRot);
		}
	}

	return true;
}

simulated function SetThirdPersonCamera(bool bNewBehindView)
{
	if ( bNewBehindView )
	{
		CurrentCameraScale = 1.0;
		CameraZOffset = GetCollisionHeight() + Mesh.Translation.Z;
	}
	SetMeshVisibility(bNewBehindView);
}


/** Used by PlayerController.FindGoodView() in RoundEnded State */
simulated function FindGoodEndView(PlayerController InPC, out Rotator GoodRotation)
{
	local rotator ViewRotation;
	local int tries;
	local float bestdist, newdist;
	local UTPlayerController PC;

	PC = UTPlayerController(InPC);

	bWinnerCam = true;
	SetHeroCam(GoodRotation);
	GoodRotation.Pitch = HeroCameraPitch;
	ViewRotation = GoodRotation;
	ViewRotation.Yaw = Rotation.Yaw + 32768 + 8192;
	if ( TryNewCamRot(PC, ViewRotation, newdist) )
	{
		GoodRotation = ViewRotation;
		return;
	}

	ViewRotation = GoodRotation;
	ViewRotation.Yaw = Rotation.Yaw + 32768 - 8192;
	if ( TryNewCamRot(PC, ViewRotation, newdist) )
	{
		GoodRotation = ViewRotation;
		return;
	}

	// failed with Hero cam
	ViewRotation.Pitch = 56000;
	tries = 0;
	bestdist = 0.0;
	CameraScale = Default.CameraScale;
	CurrentCameraScale = Default.CameraScale;
	for (tries=0; tries<16; tries++)
	{
		if ( TryNewCamRot(PC, ViewRotation, newdist) )
		{
			GoodRotation = ViewRotation;
			return;
		}

		if (newdist > bestdist)
		{
			bestdist = newdist;
			GoodRotation = ViewRotation;
		}
		ViewRotation.Yaw += 4096;
	}
}

simulated function bool TryNewCamRot(UTPlayerController PC, rotator ViewRotation, out float CamDist)
{
	local vector cameraLoc;
	local rotator cameraRot;
	local float FOVAngle;

	cameraLoc = Location;
	cameraRot = ViewRotation;
	if ( CalcThirdPersonCam(0, cameraLoc, cameraRot, FOVAngle) )
	{
		CamDist = VSize(cameraLoc - Location - vect(0,0,1)*CameraZOffset);
		return true;
	}
	CamDist = VSize(cameraLoc - Location - vect(0,0,1)*CameraZOffset);
	return false;
}

simulated function SetHeroCam(out rotator out_CamRot)
{
	if ( IsHero() )
	{
		CameraScale = 8.0;
		CurrentCameraScale = CameraScale;
	}
	else
	{
		CameraScale = HeroCameraScale;
		CurrentCameraScale = HeroCameraScale;
	}

	// Increase the Z offset in splitscreen to keep the winner's face onscreen
	if ( class'Engine'.static.IsSplitScreen() )
	{
		CameraZOffset = 25.0;
	}
	else
	{
		CameraZOffset = 0.0;
	}
}

simulated function bool CalcThirdPersonCam( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
	local vector CamStart, HitLocation, HitNormal, CamDir;
	local float DesiredCameraZOffset;

	ModifyRotForDebugFreeCam(out_CamRot);

	CamStart = Location;

	if ( Role == ROLE_SimulatedProxy )
	{
		CamStart += MeshTranslationOffset;
	}

	if ( bWinnerCam )
	{
		// use "hero" cam
		SetHeroCam(out_CamRot);
	}
	else
	{
		DesiredCameraZOffset = (Health > 0) ? 1.5 * GetCollisionHeight() + Mesh.Translation.Z : 0.f;
		CameraZOffset = (fDeltaTime < 0.2) ? DesiredCameraZOffset * 5 * fDeltaTime + (1 - 5*fDeltaTime) * CameraZOffset : DesiredCameraZOffset;
	}
	CamStart.Z += CameraZOffset;
	CamDir = Vector(out_CamRot) * GetCollisionRadius() * CurrentCameraScale;

	if ( (Health <= 0) || bFeigningDeath )
	{
		// adjust camera position to make sure it's not clipping into world
		// @todo fixmesteve.  Note that you can still get clipping if FindSpot fails (happens rarely)
		FindSpot(GetCollisionExtent(),CamStart);
	}
	if (CurrentCameraScale < CameraScale)
	{
		CurrentCameraScale = FMin(CameraScale, CurrentCameraScale + 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
	}
	else if (CurrentCameraScale > CameraScale)
	{
		CurrentCameraScale = FMax(CameraScale, CurrentCameraScale - 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
	}
	if (CamDir.Z > GetCollisionHeight())
	{
		CamDir *= square(cos(out_CamRot.Pitch * 0.0000958738)); // 0.0000958738 = 2*PI/65536
	}
	out_CamLoc = CamStart - CamDir;
	if (Trace(HitLocation, HitNormal, out_CamLoc, CamStart, false, vect(12,12,12)) != None)
	{
		out_CamLoc = HitLocation;
		return false;
	}
	return true;
}

/**
 * Return world location to start a weapon fire trace from.
 *
 * @return	World location where to start weapon fire traces from
 */
simulated function Vector GetWeaponStartTraceLocation(optional Weapon CurrentWeapon)
{
	if ( IsHero() )
	{
		// Instant fire traces for Heroes should start at the center of the 3rd person camera
		return Super.GetWeaponStartTraceLocation(CurrentWeapon);
	}
	return GetPawnViewLocation();
}

//=============================================
// Jumping functionality

function bool Dodge(eDoubleClickDir DoubleClickMove)
{
	local vector X,Y,Z, TraceStart, TraceEnd, Dir, Cross, HitLocation, HitNormal;
	local Actor HitActor;
	local rotator TurnRot;

	if (MultiDodgeRemaining <= 0 || DodgeResetTimestamp > WorldInfo.TimeSeconds || bIsCrouched || bWantsToCrouch ||
		(Physics != PHYS_Walking && Physics != PHYS_Falling))
	{
		return false;
	}

	TurnRot.Yaw = Rotation.Yaw;
	GetAxes(TurnRot,X,Y,Z);

	if ( Physics == PHYS_Falling )
	{
		if (DoubleClickMove == DCLICK_Forward)
			TraceEnd = -X;
		else if (DoubleClickMove == DCLICK_Back)
			TraceEnd = X;
		else if (DoubleClickMove == DCLICK_Left)
			TraceEnd = Y;
		else if (DoubleClickMove == DCLICK_Right)
			TraceEnd = -Y;
		TraceStart = Location - (CylinderComponent.CollisionHeight - 16)*Vect(0,0,1) + TraceEnd*(CylinderComponent.CollisionRadius-16);
		TraceEnd = TraceStart + TraceEnd*40.0;
		HitActor = Trace(HitLocation, HitNormal, TraceEnd, TraceStart, false, vect(16,16,16));

		if ( (HitActor == None) || (HitNormal.Z < -0.1) )
			 return false;
		if (  !HitActor.bWorldGeometry )
		{
			if ( !HitActor.bBlockActors )
				return false;
			if ( (Pawn(HitActor) != None) && (Vehicle(HitActor) == None) )
				return false;
		}
	}
	if (DoubleClickMove == DCLICK_Forward)
	{
		Dir = X;
		Cross = Y;
	}
	else if (DoubleClickMove == DCLICK_Back)
	{
		Dir = -1 * X;
		Cross = Y;
	}
	else if (DoubleClickMove == DCLICK_Left)
	{
		Dir = -1 * Y;
		Cross = X;
	}
	else if (DoubleClickMove == DCLICK_Right)
	{
		Dir = Y;
		Cross = X;
	}
	if ( AIController(Controller) != None )
		Cross = vect(0,0,0);
	return PerformDodge(DoubleClickMove, Dir,Cross);
}

/* BotDodge()
returns appropriate vector for dodge in direction Dir (which should be normalized)
*/
function vector BotDodge(Vector Dir)
{
	local vector Vel;

	Vel = DodgeSpeed*Dir;
	Vel.Z = DodgeSpeedZ;
	return Vel;
}

function bool PerformDodge(eDoubleClickDir DoubleClickMove, vector Dir, vector Cross)
{
	local float VelocityZ;

	if ( Physics == PHYS_Falling )
	{
		TakeFallingDamage();
	}

	bDodging = true;
	--MultiDodgeRemaining;

	bReadyToDoubleJump = (JumpBootCharge > 0);
	VelocityZ = Velocity.Z;
	Velocity = DodgeSpeed*Dir + (Velocity Dot Cross)*Cross;

	if ( VelocityZ < -200 )
		Velocity.Z = VelocityZ + DodgeSpeedZ;
	else
		Velocity.Z = DodgeSpeedZ;

	CurrentDir = DoubleClickMove;
	SetPhysics(PHYS_Falling);
	SoundGroupClass.Static.PlayDodgeSound(self);
	return true;
}

function DoDoubleJump( bool bUpdating )
{
	if ( !bIsCrouched && !bWantsToCrouch )
	{
		if ( !IsLocallyControlled() || AIController(Controller) != None )
		{
			MultiJumpRemaining -= 1;
		}
		Velocity.Z = JumpZ + MultiJumpBoost;
		InvManager.OwnerEvent('MultiJump');
		SetPhysics(PHYS_Falling);
		BaseEyeHeight = DoubleJumpEyeHeight;
		if (!bUpdating)
		{
			SoundGroupClass.Static.PlayDoubleJumpSound(self);
		}
	}
}

function Gasp()
{
	SoundGroupClass.Static.PlayGaspSound(self);
}

function bool DoJump( bool bUpdating )
{
	// This extra jump allows a jumping or dodging pawn to jump again mid-air
	// (via thrusters). The pawn must be within +/- DoubleJumpThreshold velocity units of the
	// apex of the jump to do this special move.
	if ( !bUpdating && CanDoubleJump()&& (Abs(Velocity.Z) < DoubleJumpThreshold) && IsLocallyControlled() )
	{
		if ( PlayerController(Controller) != None )
			PlayerController(Controller).bDoubleJump = true;
		DoDoubleJump(bUpdating);
		MultiJumpRemaining -= 1;
		return true;
	}

	if (bJumpCapable && !bIsCrouched && !bWantsToCrouch && (Physics == PHYS_Walking || Physics == PHYS_Ladder || Physics == PHYS_Spider))
	{
		if ( Physics == PHYS_Spider )
			Velocity = JumpZ * Floor;
		else if ( Physics == PHYS_Ladder )
			Velocity.Z = 0;
		else if ( bIsWalking )
			Velocity.Z = Default.JumpZ;
		else
			Velocity.Z = JumpZ;
		if (Base != None && !Base.bWorldGeometry && Base.Velocity.Z > 0.f)
		{
			if ( (WorldInfo.WorldGravityZ != WorldInfo.DefaultGravityZ) && (GetGravityZ() == WorldInfo.WorldGravityZ) )
			{
				Velocity.Z += Base.Velocity.Z * sqrt(GetGravityZ()/WorldInfo.DefaultGravityZ);
			}
			else
			{
				Velocity.Z += Base.Velocity.Z;
			}
		}
		SetPhysics(PHYS_Falling);
		bReadyToDoubleJump = true;
		bDodging = false;
		if ( !bUpdating )
		    PlayJumpingSound();
		return true;
	}
	return false;
}

event Landed(vector HitNormal, actor FloorActor)
{
	local vector Impulse;

	Super.Landed(HitNormal, FloorActor);

	// adds impulses to vehicles and dynamicSMActors (e.g. KActors)
	Impulse.Z = Velocity.Z * 4.0f; // 4.0f works well for landing on a Scorpion
	if (UTVehicle(FloorActor) != None)
	{
		UTVehicle(FloorActor).Mesh.AddImpulse(Impulse, Location);
	}
	else if (DynamicSMActor(FloorActor) != None)
	{
		DynamicSMActor(FloorActor).StaticMeshComponent.AddImpulse(Impulse, Location);
	}

	if ( Velocity.Z < -200 )
	{
		OldZ = Location.Z;
		bJustLanded = bUpdateEyeHeight && (Controller != None) && Controller.LandingShake();
	}

	if (InvManager != None)
	{
		InvManager.OwnerEvent('Landed');
	}
	if ((MultiJumpRemaining < MaxMultiJump && bStopOnDoubleLanding) || bDodging || Velocity.Z < -2 * JumpZ)
	{
		// slow player down if double jump landing
		Velocity.X *= 0.1;
		Velocity.Y *= 0.1;
	}

	AirControl = DefaultAirControl;
	MultiJumpRemaining = MaxMultiJump;
	MultiDodgeRemaining = MaxMultiDodge;
	bDodging = false;
	bReadyToDoubleJump = false;
	if (UTBot(Controller) != None)
	{
		UTBot(Controller).ImpactVelocity = vect(0,0,0);
	}

	if(!bHidden)
	{
		PlayLandingSound();
	}
	if (Velocity.Z < -MaxFallSpeed)
	{
		SoundGroupClass.Static.PlayFallingDamageLandSound(self);
	}
	else if (Velocity.Z < MaxFallSpeed * -0.5)
	{
		SoundGroupClass.Static.PlayLandSound(self);
	}

	SetBaseEyeheight();
}

function JumpOutOfWater(vector jumpDir)
{
	bReadyToDoubleJump = true;
	bDodging = false;
	Super.JumpOutOfWater(jumpDir);
}

function bool CanDoubleJump()
{
	return ( (MultiJumpRemaining > 0) && (Physics == PHYS_Falling) && (bReadyToDoubleJump || (UTBot(Controller) != None)) );
}

function bool CanMultiJump()
{
	return ( MaxMultiJump > 0 );
}

function PlayDyingSound()
{
	SoundGroupClass.Static.PlayDyingSound(self);
}

simulated function DisplayDebug(HUD HUD, out float out_YL, out float out_YPos)
{
	local int i,j;
	local PrimitiveComponent P;
	local string s;
	local float xl,yl;

	Super.DisplayDebug(HUD, out_YL, out_YPos);

	if (HUD.ShouldDisplayDebug('twist'))
	{
		Hud.Canvas.SetDrawColor(255,255,200);
		Hud.Canvas.SetPos(4,out_YPos);
		Hud.Canvas.DrawText(""$Self$" - "@Rotation@" RootYaw:"@RootYaw@" CurrentSkelAim"@CurrentSkelAim.X@CurrentSkelAim.Y);
		out_YPos += out_YL;
	}

	if (!bComponentDebug)
		return;

	Hud.Canvas.SetDrawColor(255,255,128,255);

	for (i=0;i<Mesh.Attachments.Length;i++)
	{
	    HUD.Canvas.SetPos(4,out_YPos);

	    s = ""$Mesh.Attachments[i].Component;
		Hud.Canvas.Strlen(s,xl,yl);
		j = len(s);
		while ( xl > (Hud.Canvas.ClipX*0.5) && j>10)
		{
			j--;
			s = Right(S,j);
			Hud.Canvas.StrLen(s,xl,yl);
		}

		HUD.Canvas.DrawText("Attachment"@i@" = "@Mesh.Attachments[i].BoneName@s);
	    out_YPos += out_YL;

	    P = PrimitiveComponent(Mesh.Attachments[i].Component);
	    if (P!=None)
	    {
			HUD.Canvas.SetPos(24,out_YPos);
			HUD.Canvas.DrawText("Component = "@P.Owner@P.HiddenGame@P.bOnlyOwnerSee@P.bOwnerNoSee);
			out_YPos += out_YL;

			s = ""$P;
			Hud.Canvas.Strlen(s,xl,yl);
			j = len(s);
			while ( xl > (Hud.Canvas.ClipX*0.5) && j>10)
			{
				j--;
				s = Right(S,j);
				Hud.Canvas.StrLen(s,xl,yl);
			}

			HUD.Canvas.SetPos(24,out_YPos);
			HUD.Canvas.DrawText("Component = "@s);
			out_YPos += out_YL;
		}
	}

	out_YPos += out_YL*2;
	HUD.Canvas.SetPos(24,out_YPos);
	HUD.Canvas.DrawText("Driven Vehicle = "@DrivenVehicle);
	out_YPos += out_YL;


}

/** starts playing the given sound via the PawnAmbientSound AudioComponent and sets PawnAmbientSoundCue for replicating to clients
 *  @param NewAmbientSound the new sound to play, or None to stop any ambient that was playing
 */
simulated function SetPawnAmbientSound(SoundCue NewAmbientSound)
{
	// if the component is already playing this sound, don't restart it
	if (NewAmbientSound != PawnAmbientSound.SoundCue)
	{
		PawnAmbientSoundCue = NewAmbientSound;
		PawnAmbientSound.Stop();
		PawnAmbientSound.SoundCue = NewAmbientSound;
		if (NewAmbientSound != None)
		{
			PawnAmbientSound.Play();
		}
	}
}

simulated function SoundCue GetPawnAmbientSound()
{
	return PawnAmbientSoundCue;
}

/** starts playing the given sound via the WeaponAmbientSound AudioComponent and sets WeaponAmbientSoundCue for replicating to clients
 *  @param NewAmbientSound the new sound to play, or None to stop any ambient that was playing
 */
simulated function SetWeaponAmbientSound(SoundCue NewAmbientSound)
{
	// if the component is already playing this sound, don't restart it
	if (NewAmbientSound != WeaponAmbientSound.SoundCue)
	{
		WeaponAmbientSoundCue = NewAmbientSound;
		WeaponAmbientSound.Stop();
		WeaponAmbientSound.SoundCue = NewAmbientSound;
		if (NewAmbientSound != None)
		{
			WeaponAmbientSound.Play();
		}
	}
}

simulated function SoundCue GetWeaponAmbientSound()
{
	return WeaponAmbientSoundCue;
}

simulated function CreateOverlayArmsMesh()
{
	local int i;

	for (i = 0; i < ArrayCount(ArmsMesh); i++)
	{
		if (ArmsMesh[i] != None)
		{
			ArmsOverlay[i] = new(outer) ArmsMesh[i].Class(ArmsMesh[i]);
			if (ArmsOverlay[i] != None)
			{
				ArmsOverlay[i].bTransformFromAnimParent = 0;
				ArmsOverlay[i].CastShadow = false;
				ArmsOverlay[i].SetParentAnimComponent(ArmsMesh[i]);
				ArmsOverlay[i].SetHidden(ArmsMesh[i].HiddenGame);
			}
		}
	}
}
/**
 * Apply a given overlay material to the overlay mesh.
 *
 * @Param	NewOverlay		The material to overlay
 */
simulated function SetOverlayMaterial(MaterialInterface NewOverlay)
{
	local int i;

	// If we are authoratative, then setup replication of the new overlay
	if (Role == ROLE_Authority)
	{
		OverlayMaterialInstance = NewOverlay;
	}

	if (Mesh.SkeletalMesh != None)
	{
		if (NewOverlay != None)
		{
			for (i = 0; i < OverlayMesh.SkeletalMesh.Materials.Length; i++)
			{
				OverlayMesh.SetMaterial(i, OverlayMaterialInstance);
			}

			// attach the overlay mesh
			if (!OverlayMesh.bAttached)
			{
				AttachComponent(OverlayMesh);
			}

			if (ArmsOverlay[0] != None)
			{
				if( ArmsOverlay[0].SkeletalMesh != None )
				{
					for (i = 0; i < ArmsOverlay[0].SkeletalMesh.Materials.length; i++)
					{
						ArmsOverlay[0].SetMaterial(i, OverlayMaterialInstance);
					}
				}

				if( ArmsOverlay[1].SkeletalMesh != None )
				{
					for (i = 0; i < ArmsOverlay[1].SkeletalMesh.Materials.length; i++)
					{
						ArmsOverlay[1].SetMaterial(i, OverlayMaterialInstance);
					}
				}

				if (!ArmsOverlay[0].bAttached)
				{
					AttachComponent(ArmsOverlay[0]);
					if(UTWeapon(Weapon) != none && UTWeapon(Weapon).bUsesOffhand)
					{
						AttachComponent(ArmsOverlay[1]);
					}
				}
				ArmsOverlay[0].SetHidden(ArmsMesh[0].HiddenGame);
			}
		}
		else if (OverlayMesh.bAttached)
		{
			if (ShieldBeltArmor > 0)
			{
				// reapply shield belt overlay
				SetOverlayMaterial(GetShieldMaterialInstance(WorldInfo.Game.bTeamGame));
			}
			else
			{
				DetachComponent(OverlayMesh);
				if (ArmsOverlay[0] != None && ArmsOverlay[0].bAttached)
				{
					DetachComponent(ArmsOverlay[0]);
					DetachComponent(ArmsOverlay[1]);
				}
			}
		}
	}
}

/**
* @Returns the material to use for an overlay
*/
simulated function MaterialInterface GetShieldMaterialInstance(bool bTeamGame)
{
	return (bTeamGame ? default.ShieldBeltTeamMaterialInstances[GetTeamNum()] : default.ShieldBeltMaterialInstance);
}


/**
 * This function allows you to access the overlay material stack.
 *
 * @returns the requested material instance
 */
simulated function MaterialInterface GetOverlayMaterial()
{
	return OverlayMaterialInstance;
}

function SetWeaponOverlayFlag(byte FlagToSet)
{
	ApplyWeaponOverlayFlags(WeaponOverlayFlags | (1 << FlagToSet));
}

function ClearWeaponOverlayFlag(byte FlagToClear)
{
	ApplyWeaponOverlayFlags(WeaponOverlayFlags & ( 0xFF ^ (1 << FlagToClear)) );
}

/**
 * This function is a pass-through to the weapon/weapon attachment that is used to set the various overlays
 */

simulated function ApplyWeaponOverlayFlags(byte NewFlags)
{
	local UTWeapon Weap;
	local UTVehicleBase VBase;

	if (Role == ROLE_Authority)
	{
		WeaponOverlayFlags = NewFlags;
	}

	if ( WorldInfo.NetMode != NM_DedicatedServer )
	{
		Weap = UTWeapon(Weapon);
		if ( Weap != none)
		{
			Weap.SetWeaponOverlayFlags(self);
		}

		if ( CurrentWeaponAttachment != none )
		{
			CurrentWeaponAttachment.SetWeaponOverlayFlags(self);
		}

		VBase = UTVehicleBase(DrivenVehicle);
		if (VBase != None)
		{
			VBase.ApplyWeaponEffects(WeaponOverlayFlags);
		}
	}
}


/** called when bPlayingFeignDeathRecovery and interpolating our Mesh's PhysicsWeight to 0 has completed
 *	starts the recovery anim playing
 */
simulated event StartFeignDeathRecoveryAnim()
{
	local UTWeapon UTWeap;

	// we're done with the ragdoll, so get rid of it
	RestorePreRagdollCollisionComponent();
	Mesh.PhysicsWeight = 0.f;
	Mesh.MinDistFactorForKinematicUpdate = default.Mesh.MinDistFactorForKinematicUpdate;
	Mesh.PhysicsAssetInstance.SetAllBodiesFixed(TRUE);
	Mesh.PhysicsAssetInstance.SetFullAnimWeightBonesFixed(FALSE, Mesh);
	SetPawnRBChannels(FALSE);
	Mesh.bUpdateKinematicBonesFromAnimation=TRUE;

	// Turn collision on for cylinder and off for skelmeshcomp
	CylinderComponent.SetActorCollision(true, true);
	Mesh.SetActorCollision(false, false);
	Mesh.SetTraceBlocking(false, false);

	Mesh.SetTickGroup(TG_PreAsyncWork);

	if (Physics == PHYS_RigidBody)
	{
		setPhysics(PHYS_Falling);
	}

	UTWeap = UTWeapon(Weapon);
	if (UTWeap != None)
	{
		UTWeap.PlayWeaponEquip();
	}

	if (FeignDeathBlend != None && FeignDeathBlend.Children[1].Anim != None)
	{
		FeignDeathBlend.Children[1].Anim.PlayAnim(false, 1.1);
	}
	else
	{
		// failed to find recovery node, so just pop out of ragdoll
		bNoWeaponFiring = default.bNoWeaponFiring;
		GotoState('Auto');
	}
}

/** prevents player from getting out of feign death until the body has come to rest */
function FeignDeathDelayTimer()
{
	if ( (WorldInfo.TimeSeconds - FeignDeathStartTime > 1.0)
		&& (PhysicsVolume.bWaterVolume || (VSize(Velocity) < 4.0 * FeignDeathBodyAtRestSpeed * (WorldInfo.TimeSeconds - FeignDeathStartTime))) )
	{
		// clear timer, so we can come out of feign death
		ClearTimer('FeignDeathDelayTimer');
		// automatically get up if we were forced into it
		if (bFeigningDeath && bForcedFeignDeath)
		{
			bFeigningDeath = false;
			PlayFeignDeath();
		}
	}
}

simulated function PlayFeignDeath()
{
	local vector FeignLocation, HitLocation, HitNormal, TraceEnd, Impulse;
	local rotator NewRotation;
	local UTWeapon UTWeap;
	local UTVehicle V;
	local Controller Killer;
	local float UnFeignZAdjust;

	if (bFeigningDeath)
	{
		StartFallImpactTime = WorldInfo.TimeSeconds;
		bCanPlayFallingImpacts=true;
		GotoState('FeigningDeath');

		// if we had some other rigid body thing going on, cancel it
		if (Physics == PHYS_RigidBody)
		{
			//@note: Falling instead of None so Velocity/Acceleration don't get cleared
			setPhysics(PHYS_Falling);
		}

		// Ensure we are always updating kinematic
		Mesh.MinDistFactorForKinematicUpdate = 0.0;

		SetPawnRBChannels(TRUE);
		Mesh.ForceSkelUpdate();

		// Move into post so that we are hitting physics from last frame, rather than animated from this
		Mesh.SetTickGroup(TG_PostAsyncWork);

		bBlendOutTakeHitPhysics = false;

		PreRagdollCollisionComponent = CollisionComponent;
		CollisionComponent = Mesh;

		// Turn collision on for skelmeshcomp and off for cylinder
		CylinderComponent.SetActorCollision(false, false);
		Mesh.SetActorCollision(true, true);
		Mesh.SetTraceBlocking(true, true);

		SetPhysics(PHYS_RigidBody);
		Mesh.PhysicsWeight = 1.0;

		// If we had stopped updating kinematic bodies on this character due to distance from camera, force an update of bones now.
		if( Mesh.bNotUpdatingKinematicDueToDistance )
		{
			Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
		}

		Mesh.PhysicsAssetInstance.SetAllBodiesFixed(FALSE);
		Mesh.bUpdateKinematicBonesFromAnimation=FALSE;

		FeignDeathStartTime = WorldInfo.TimeSeconds;
		// reset mesh translation since adjustment code isn't executed on the server
		// but the ragdoll code uses the translation so we need them to match up for the
		// most accurate simulation
		Mesh.SetTranslation(vect(0,0,1) * BaseTranslationOffset);
		// we'll use the rigid body collision to check for falling damage
		Mesh.ScriptRigidBodyCollisionThreshold = MaxFallSpeed;
		Mesh.SetNotifyRigidBodyCollision(true);
		Mesh.WakeRigidBody();

		if (Role == ROLE_Authority)
		{
			SetTimer(0.15, true, 'FeignDeathDelayTimer');
		}
	}
	else
	{
		// fit cylinder collision into location, crouching if necessary
		FeignLocation = Location;
		CollisionComponent = PreRagdollCollisionComponent;
		TraceEnd = Location + vect(0,0,1) * GetCollisionHeight();
		if (Trace(HitLocation, HitNormal, TraceEnd, Location, true, GetCollisionExtent()) == None )
		{
			HitLocation = TraceEnd;
		}
		if ( !SetFeignEndLocation(HitLocation, FeignLocation) )
		{
			CollisionComponent = Mesh;
			SetLocation(FeignLocation);
			bFeigningDeath = true;
			Impulse = VRand();
			Impulse.Z = 0.5;
			Mesh.AddImpulse(800.0*Impulse, Location);
			UnfeignFailedCount++;
			if ( UnFeignfailedCount > 4 )
			{
				Suicide();
			}
			return;
		}

		// Calculate how far we just moved the actor up.
		UnFeignZAdjust = Location.Z - FeignLocation.Z;
		// If its positive, move back down by that amount until it hits the floor
		if(UnFeignZAdjust > 0.0)
		{
			moveSmooth(vect(0,0,-1) * UnFeignZAdjust);
		}

		UnfeignFailedCount = 0;

		CollisionComponent = Mesh;

		bPlayingFeignDeathRecovery = true;
		FeignDeathRecoveryStartTime = WorldInfo.TimeSeconds;

		// don't need collision events anymore
		Mesh.SetNotifyRigidBodyCollision(false);
		// don't allow player to move while animation is in progress
		SetPhysics(PHYS_None);

		if (Role == ROLE_Authority)
		{
			// if cylinder is penetrating a vehicle, kill the pawn to prevent exploits
			CollisionComponent = PreRagdollCollisionComponent;
			foreach CollidingActors(class'UTVehicle', V, GetCollisionRadius(),, true)
			{
				if (IsOverlapping(V))
				{
					if (V.Class == HoverboardClass)
					{
						// don't want to kill pawn in this case, so push vehicle away instead
						Impulse = VRand() * V.GroundSpeed;
						Impulse.Z = 500.0;
						V.Mesh.AddImpulse(Impulse,,, true);
					}
					else
					{
						CollisionComponent = Mesh;
						if (V.Controller != None)
						{
							Killer = V.Controller;
						}
						else if (V.Instigator != None)
						{
							Killer = V.Instigator.Controller;
						}
						Died(Killer, V.RanOverDamageType, Location);
						return;
					}
				}
			}
			CollisionComponent = Mesh;
		}

		// find getup animation, and freeze it at the first frame
		if ( (FeignDeathBlend != None) && !bIsCrouched )
		{
			// physics weight interpolated to 0 in C++, then StartFeignDeathRecoveryAnim() is called
			Mesh.PhysicsWeight = 1.0;
			FeignDeathBlend.SetBlendTarget(1.0, 0.0);
			// force rotation to match the body's direction so the blend to the getup animation looks more natural
			NewRotation = Rotation;
			NewRotation.Yaw = rotator(Mesh.GetBoneAxis('b_Hips', AXIS_X)).Yaw;
			// flip it around if the head is facing upwards, since the animation for that makes the character
			// end up facing in the opposite direction that its body is pointing on the ground
			// FIXME: generalize this somehow (stick it in the AnimNode, I guess...)
			if (Mesh.GetBoneAxis(HeadBone, AXIS_Y).Z < 0.0)
			{
				NewRotation.Yaw += 32768;
			}
			SetRotation(NewRotation);
		}
		else
		{
			// failed to find recovery node, so just pop out of ragdoll
			RestorePreRagdollCollisionComponent();
			Mesh.PhysicsWeight = 0.f;
			Mesh.PhysicsAssetInstance.SetAllBodiesFixed(TRUE);
			Mesh.bUpdateKinematicBonesFromAnimation=TRUE;
			Mesh.MinDistFactorForKinematicUpdate = default.Mesh.MinDistFactorForKinematicUpdate;
			SetPawnRBChannels(FALSE);

			if (Physics == PHYS_RigidBody)
			{
				setPhysics(PHYS_Falling);
			}

			UTWeap = UTWeapon(Weapon);
			if (UTWeap != None)
			{
				UTWeap.PlayWeaponEquip();
			}
			GotoState('Auto');
		}
	}
}

simulated function bool SetFeignEndLocation(vector HitLocation, vector FeignLocation)
{
	local vector NewDest;

	if ( SetLocation(HitLocation) && CheckValidLocation(FeignLocation) )
	{
		return true;
	}

	// try crouching
	ForceCrouch();
	if ( SetLocation(HitLocation) && CheckValidLocation(FeignLocation) )
	{
		return true;
	}

	newdest = HitLocation + GetCollisionRadius() * vect(1,1,0);
	if ( SetLocation(newdest) && CheckValidLocation(FeignLocation) )
		return true;
	newdest = HitLocation + GetCollisionRadius() * vect(1,-1,0);
	if ( SetLocation(newdest) && CheckValidLocation(FeignLocation) )
		return true;
	newdest = HitLocation + GetCollisionRadius() * vect(-1,1,0);
	if ( SetLocation(newdest) && CheckValidLocation(FeignLocation) )
		return true;
	newdest = HitLocation + GetCollisionRadius() * vect(-1,-1,0);
	if ( SetLocation(newdest) && CheckValidLocation(FeignLocation) )
		return true;

	return false;
}

/**
  * Make sure location pawn ended up at out of feign death is valid (not through a wall)
  */
simulated function bool CheckValidLocation(vector FeignLocation)
{
	local vector HitLocation, HitNormal, DestFinalZ;

	// try trace down to dest
	if (Trace(HitLocation, HitNormal, Location, FeignLocation, false, vect(10,10,10),, TRACEFLAG_Bullet) == None)
	{
		return true;
	}

	// try trace straight up, then sideways to final location
	DestFinalZ = FeignLocation;
	FeignLocation.Z = Location.Z;
	if ( Trace(HitLocation, HitNormal, DestFinalZ, FeignLocation, false, vect(10,10,10)) == None &&
		Trace(HitLocation, HitNormal, Location, DestFinalZ, false, vect(10,10,10),, TRACEFLAG_Bullet) == None )
	{
		return true;
	}
	return false;
}


reliable server function ServerFeignDeath()
{
	if (bCanRagdoll && Role == ROLE_Authority && !WorldInfo.Game.IsInState('MatchOver') && DrivenVehicle == None && Controller != None && !bFeigningDeath)
	{
		bFeigningDeath = true;
		PlayFeignDeath();
	}
}

exec simulated function FeignDeath()
{
	ServerFeignDeath();
}

/** force the player to ragdoll, automatically getting up when the body comes to rest
 * (basically, force activate the feign death code)
 */
function ForceRagdoll()
{
	if ( bCanRagdoll )
	{
		bFeigningDeath = true;
		bForcedFeignDeath = true;
		PlayFeignDeath();
	}
}

simulated function FiringModeUpdated(bool bViaReplication)
{
	super.FiringModeUpdated(bViaReplication);
	if(CurrentWeaponAttachment != none)
	{
		CurrentWeaponAttachment.FireModeUpdated(FiringMode, bViaReplication);
	}
}

/**
  * Called by Bighead mutator when spawned, and also if bKillsAffectHead when kill someone
  */
function SetBigHead()
{
	bKillsAffectHead = true;
	if ( PlayerReplicationInfo != None )
	{
		SetHeadScale(FClamp((5+PlayerReplicationInfo.Kills)/(5+PlayerReplicationInfo.Deaths), 0.75, 2.0));
	}
}

/** called when FireRateMultiplier is changed to update weapon timers */
simulated function FireRateChanged()
{
	if (Weapon != None && Weapon.IsTimerActive('RefireCheckTimer'))
	{
		// make currently firing weapon slow down firing rate
		Weapon.ClearTimer('RefireCheckTimer');
		Weapon.TimeWeaponFiring(Weapon.CurrentFireMode);
	}
	if (DrivenVehicle != None && DrivenVehicle.Weapon != None && DrivenVehicle.Weapon.IsTimerActive('RefireCheckTimer'))
	{
		// make currently firing vehicle weapon slow down firing rate
		DrivenVehicle.Weapon.ClearTimer('RefireCheckTimer');
		DrivenVehicle.Weapon.TimeWeaponFiring(DrivenVehicle.Weapon.CurrentFireMode);
	}
}

/**
 * Check on various replicated data and act accordingly.
 */
simulated event ReplicatedEvent(name VarName)
{
	if ( VarName == 'Controller' && Controller != None )
	{
		// Reset the weapon when you get the controller and
		// make sure it has ammo.
		if (UTWeapon(Weapon) != None)
		{
			UTWeapon(Weapon).ClientEndFire(0);
			UTWeapon(Weapon).ClientEndFire(1);
			if ( !Weapon.HasAnyAmmo() )
			{
				Weapon.WeaponEmpty();
			}
		}
	}
	// If CurrentWeaponAttachmentClass has changed, the player has switched weapons and
	// will need to update itself accordingly.
	else if ( VarName == 'CurrentWeaponAttachmentClass' )
	{
		WeaponAttachmentChanged();
		return;
	}
	else if ( VarName == 'CompressedBodyMatColor' )
	{
		BodyMatColor.R = CompressedBodyMatColor.Pitch/256.0;
		BodyMatColor.G = CompressedBodyMatColor.Yaw/256.0;
		BodyMatColor.B = CompressedBodyMatColor.Roll/256.0;
	}
	else if ( VarName == 'ClientBodyMatDuration' )
	{
		SetBodyMatColor(BodyMatColor,ClientBodyMatDuration);
	}
	else if ( VarName == 'HeadScale' )
	{
		SetHeadScale(HeadScale);
	}
	else if (VarName == 'PawnAmbientSoundCue')
	{
		SetPawnAmbientSound(PawnAmbientSoundCue);
	}
	else if (VarName == 'WeaponAmbientSoundCue')
	{
		SetWeaponAmbientSound(WeaponAmbientSoundCue);
	}
	else if (VarName == 'ReplicatedBodyMaterial')
	{
		SetSkin(ReplicatedBodyMaterial);
	}
	else if (VarName == 'OverlayMaterialInstance')
	{
		SetOverlayMaterial(OverlayMaterialInstance);
	}
	else if (VarName == 'bFeigningDeath')
	{
		PlayFeignDeath();
	}
	else if (VarName == 'WeaponOverlayFlags')
	{
		ApplyWeaponOverlayFlags(WeaponOverlayFlags);
	}
	else if (VarName == 'LastTakeHitInfo')
	{
		PlayTakeHitEffects();
	}
	else if (VarName == 'DrivenWeaponPawn')
	{
		if (DrivenWeaponPawn.BaseVehicle != LastDrivenWeaponPawn.BaseVehicle || DrivenWeaponPawn.SeatIndex != LastDrivenWeaponPawn.SeatIndex)
		{
			if (DrivenWeaponPawn.BaseVehicle != None)
			{
				// create a client side pawn to drive
				if (ClientSideWeaponPawn == None || ClientSideWeaponPawn.bDeleteMe)
				{
					ClientSideWeaponPawn = Spawn(class'UTClientSideWeaponPawn', DrivenWeaponPawn.BaseVehicle);
				}
				ClientSideWeaponPawn.MyVehicle = DrivenWeaponPawn.BaseVehicle;
				ClientSideWeaponPawn.MySeatIndex = DrivenWeaponPawn.SeatIndex;
				StartDriving(ClientSideWeaponPawn);
			}
			else if (ClientSideWeaponPawn != None && ClientSideWeaponPawn == DrivenVehicle)
			{
				StopDriving(ClientSideWeaponPawn);
			}
		}
		if (ClientSideWeaponPawn != None && ClientSideWeaponPawn == DrivenVehicle && ClientSideWeaponPawn.PlayerReplicationInfo != DrivenWeaponPawn.PRI)
		{
			ClientSideWeaponPawn.PlayerReplicationInfo = DrivenWeaponPawn.PRI;
			ClientSideWeaponPawn.NotifyTeamChanged();
		}
		LastDrivenWeaponPawn = DrivenWeaponPawn;
	}
	else if (VarName == 'bDualWielding')
	{
		if (CurrentWeaponAttachment != None)
		{
			CurrentWeaponAttachment.SetDualWielding(bDualWielding);
		}
	}
	else if (VarName == 'bPuttingDownWeapon')
	{
		SetPuttingDownWeapon(bPuttingDownWeapon);
	}
	else if (VarName == 'EmoteRepInfo')
	{
		LastEmoteTime = WorldInfo.TimeSeconds;
		DoPlayEmote(EmoteRepInfo.EmoteTag, EmoteRepInfo.EmoteID);
	}
	else if (VarName == 'AnimRepInfo')
	{
		DoPlayAnim( AnimRepInfo );
	}
	else if (VarName == 'bIsInvisible')
	{
		SetInvisible(bIsInvisible);
	}
	else if (VarName == 'BigTeleportCount')
	{
		PostBigTeleport();
	}
	else if (VarName == 'FireRateMultiplier')
	{
		FireRateChanged();
	}
	else if (VarName == 'DemoWeapon')
	{
		if (InvManager != none)
			InvManager.ClientSyncWeapon(DemoWeapon);
	}
	else
	{
		Super.ReplicatedEvent(VarName);
	}
}

simulated event SetHeadScale(float NewScale)
{
	local SkelControlBase SkelControl;
	local class<UTFamilyInfo> Family;

	HeadScale = NewScale;
	if ( (class'GameInfo'.Static.UseLowGore(WorldInfo)) && (HeadScale < 0.1) )
	{
		return;
	}
	SkelControl = Mesh.FindSkelControl('HeadControl');
	if (SkelControl != None)
	{
		SkelControl.BoneScale = NewScale;
		SkelControl.IgnoreAtOrAboveLOD = 1000;
	}

	Family = GetFamilyInfo();
	// all females, all liandri, all necris SKIP neck scale
	if (PlayerReplicationInfo != None && !(PlayerReplicationInfo.bIsFemale || Family == class'UTFamilyInfo_Necris_Male' || Family == class'UTFamilyInfo_Liandri_Male'))
	{
		// we need to scale the neck bone also as otherwise the head piece leaves a point and doesn't show the neck cavity
		SkelControl = Mesh.FindSkelControl('NeckControl');
		if (SkelControl != None)
		{
			// NeckScale should only ever between 0 or 1
			SkelControl.BoneScale = FClamp( NewScale, 0.f, 1.0f );
			SkelControl.IgnoreAtOrAboveLOD = 1000;
		}
	}
}

/** sets the value of bPuttingDownWeapon and plays any appropriate animations for the change */
simulated function SetPuttingDownWeapon(bool bNowPuttingDownWeapon)
{
	if (bPuttingDownWeapon != bNowPuttingDownWeapon || Role < ROLE_Authority)
	{
		bPuttingDownWeapon = bNowPuttingDownWeapon;
		if (CurrentWeaponAttachment != None)
		{
			CurrentWeaponAttachment.SetPuttingDownWeapon(bPuttingDownWeapon);
		}
	}
}

/** @return the value of bPuttingDownWeapon */
simulated function bool GetPuttingDownWeapon()
{
	return bPuttingDownWeapon;
}

/**
 * We override TakeDamage and allow the weapon to modify it
 * @See Pawn.TakeDamage
 */
event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
	local int OldHealth;

	// Attached Bio glob instigator always gets kill credit
	if (AttachedProj != None && !AttachedProj.bDeleteMe && AttachedProj.InstigatorController != None)
	{
		EventInstigator = AttachedProj.InstigatorController;
	}

	// reduce rocket jumping
	if (EventInstigator == Controller)
	{
		momentum *= 0.6;
	}

	// accumulate damage taken in a single tick
	if ( AccumulationTime != WorldInfo.TimeSeconds )
	{
		AccumulateDamage = 0;
		AccumulationTime = WorldInfo.TimeSeconds;
	}
    OldHealth = Health;
	AccumulateDamage += Damage;
	Super.TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
	AccumulateDamage = AccumulateDamage + OldHealth - Health - Damage;
}

/**
 * Called when a pawn's weapon has fired and is responsibile for
 * delegating the creation off all of the different effects.
 *
 * bViaReplication denotes if this call in as the result of the
 * flashcount/flashlocation being replicated.  It's used filter out
 * when to make the effects.
 */

simulated function WeaponFired( bool bViaReplication, optional vector HitLocation)
{
	if (CurrentWeaponAttachment != None)
	{
		if ( !IsFirstPerson() )
		{
			CurrentWeaponAttachment.ThirdPersonFireEffects(HitLocation);
		}
		else
		{
			CurrentWeaponAttachment.FirstPersonFireEffects(Weapon, HitLocation);
	                if ( class'Engine'.static.IsSplitScreen() && CurrentWeaponAttachment.EffectIsRelevant(CurrentWeaponAttachment.Location,false,CurrentWeaponAttachment.MaxFireEffectDistance) )
	                {
                		// third person animations only (no particles)				
				CurrentWeaponAttachment.SplitScreenEffects(HitLocation);
		                // third person muzzle flash
		                CurrentWeaponAttachment.CauseMuzzleFlash();
	                }
		}

		if ( HitLocation != Vect(0,0,0) && (WorldInfo.NetMode == NM_ListenServer || WorldInfo.NetMode == NM_Standalone || bViaReplication) )
		{
			CurrentWeaponAttachment.PlayImpactEffects(HitLocation);
		}
	}
}

simulated function WeaponStoppedFiring( bool bViaReplication )
{
	if (CurrentWeaponAttachment != None)
	{
		// always call function for both viewpoints, as during the delay between calling EndFire() on the weapon
		// and it actually stopping, we might have switched viewpoints (e.g. this commonly happens when entering a vehicle)
		CurrentWeaponAttachment.StopThirdPersonFireEffects();
		CurrentWeaponAttachment.StopFirstPersonFireEffects(Weapon);
	}
}

/**
 * Called when a weapon is changed and is responsible for making sure
 * the new weapon respects the current pawn's states/etc.
 */

simulated function WeaponChanged(UTWeapon NewWeapon)
{
	local UTSkeletalMeshComponent UTSkel;

	// Make sure the new weapon respects behindview
	if (NewWeapon.Mesh != None)
	{
		NewWeapon.Mesh.SetHidden(!IsFirstPerson());
		UTSkel = UTSkeletalMeshComponent(NewWeapon.Mesh);
		if (UTSkel != none)
		{
			ArmsMesh[0].SetFOV(UTSkel.FOV);
			ArmsMesh[1].SetFOV(UTSkel.FOV);
			ArmsMesh[0].SetScale(UTSkel.Scale);
			ArmsMesh[1].SetScale(UTSkel.Scale);
			if (ArmsOverlay[0] != None)
			{
				ArmsOverlay[0].SetScale(UTSkel.Scale);
				ArmsOverlay[1].SetScale(UTSkel.Scale);
				ArmsOverlay[0].SetFOV(UTSkel.FOV);
				ArmsOverlay[1].SetFOV(UTSkel.FOV);
			}
			NewWeapon.PlayWeaponEquip();
		}
	}
}

/**
 * Called when there is a need to change the weapon attachment (either via
 * replication or locally if controlled.
 */
simulated function WeaponAttachmentChanged()
{
	if ((CurrentWeaponAttachment == None || CurrentWeaponAttachment.Class != CurrentWeaponAttachmentClass) && Mesh.SkeletalMesh != None)
	{
		// Detach/Destroy the current attachment if we have one
		if (CurrentWeaponAttachment!=None)
		{
			CurrentWeaponAttachment.DetachFrom(Mesh);
			CurrentWeaponAttachment.Destroy();
		}

		// Create the new Attachment.
		if (CurrentWeaponAttachmentClass!=None)
		{
			CurrentWeaponAttachment = Spawn(CurrentWeaponAttachmentClass,self);
			CurrentWeaponAttachment.Instigator = self;
		}
		else
			CurrentWeaponAttachment = none;

		// If all is good, attach it to the Pawn's Mesh.
		if (CurrentWeaponAttachment != None)
		{
			CurrentWeaponAttachment.AttachTo(self);
			CurrentWeaponAttachment.SetSkin(ReplicatedBodyMaterial);
			CurrentWeaponAttachment.SetDualWielding(bDualWielding);
			CurrentWeaponAttachment.ChangeVisibility(bWeaponAttachmentVisible);
		}
	}
}

function PlayHit(float Damage, Controller InstigatedBy, vector HitLocation, class<DamageType> damageType, vector Momentum, TraceHitInfo HitInfo)
{
	local UTPlayerController Hearer;
	local class<UTDamageType> UTDamage;
	local bool bSetMomentumForClients;

	if ( InstigatedBy != None && (class<UTDamageType>(DamageType) != None) && class<UTDamageType>(DamageType).default.bDirectDamage )
	{
		Hearer = UTPlayerController(InstigatedBy);
		if (Hearer != None)
		{
			Hearer.bAcuteHearing = true;
		}
	}

	if (WorldInfo.TimeSeconds - LastPainSound >= MinTimeBetweenPainSounds)
	{
		LastPainSound = WorldInfo.TimeSeconds;

		if (Damage > 0 && Health > 0)
		{

			if ( DamageType == class'UTDmgType_Drowned' )
			{
				SoundGroupClass.static.PlayDrownSound(self);
			}
			else
			{
				SoundGroupClass.static.PlayTakeHitSound(self, Damage);
			}
		}
	}

	if ( Health <= 0 && PhysicsVolume.bDestructive && (WaterVolume(PhysicsVolume) != None) && (WaterVolume(PhysicsVolume).ExitActor != None) )
	{
		Spawn(WaterVolume(PhysicsVolume).ExitActor);
	}

	Super.PlayHit(Damage, InstigatedBy, HitLocation, DamageType, Momentum, HitInfo);

	if (Hearer != None)
	{
		Hearer.bAcuteHearing = false;
	}

	if (Damage > 0 || (Controller != None && Controller.bGodMode))
	{
		UTDamage = class<UTDamageType>(DamageType);

		CheckHitInfo( HitInfo, Mesh, Normal(Momentum), HitLocation );

		// play serverside effects
		if (bShieldAbsorb)
		{
			SetBodyMatColor(SpawnProtectionColor, 1.0);
			PlaySound(ArmorHitSound);
			bShieldAbsorb = false;
			return;
		}
		else
		{
			if (UTDamage != None && UTDamage.default.DamageOverlayTime > 0.0)
			{
				SetBodyMatColor(UTDamage.default.DamageBodyMatColor, UTDamage.default.DamageOverlayTime);
			}
		}

		LastTakeHitInfo.Damage = Damage;
		LastTakeHitInfo.HitLocation = HitLocation;
		if ( (DamageType != None) && DamageType.default.bCausesBloodSplatterDecals
			&& !class'Engine'.static.IsSplitScreen() && (WorldInfo.GetDetailMode() != DM_Low) && !WorldInfo.bDropDetail
			&& (PlayerController(InstigatedBy) != None) && (InstigatedBy.Pawn != None) && IsZero(Momentum) )
		{
			if ( InstigatedBy.IsLocalPlayerController() )
			{
				LastTakeHitInfo.Momentum = InstigatedBy.Pawn.Location - HitLocation;
			}
			else
			{
				bSetMomentumForClients = true;
			}
		}
		else
		{
		LastTakeHitInfo.Momentum = Momentum;
		}
		LastTakeHitInfo.DamageType = DamageType;
		LastTakeHitInfo.HitBone = HitInfo.BoneName;
		LastTakeHitTimeout = WorldInfo.TimeSeconds + ( (UTDamage != None) ? UTDamage.static.GetHitEffectDuration(self, Damage)
									: class'UTDamageType'.static.GetHitEffectDuration(self, Damage) );

		// play clientside effects
		PlayTakeHitEffects();

		if ( bSetMomentumForClients )
		{
			LastTakeHitInfo.Momentum = InstigatedBy.Pawn.Location - HitLocation;
		}
	}
}

/** plays clientside hit effects using the data in LastTakeHitInfo */
simulated function PlayTakeHitEffects()
{
	local class<UTDamageType> UTDamage;
	local vector BloodMomentum;
	local UTEmit_HitEffect HitEffect;
	local ParticleSystem BloodTemplate;

	// set if you want to be able to test in a level and not be tossed around nor have damage effects on screen making it impossible to see what is going on
	if( !AffectedByHitEffects() )
	{
		return;
	}

	if (EffectIsRelevant(Location, false))
	{
		if (LastTakeHitInfo.DamageType.default.bCausesBloodSplatterDecals && !IsZero(LastTakeHitInfo.Momentum) && !class'GameInfo'.Static.UseLowGore(WorldInfo) )
		{
			LeaveABloodSplatterDecal( LastTakeHitInfo.HitLocation, LastTakeHitInfo.Momentum );
		}

		if (!IsFirstPerson() || class'Engine'.static.IsSplitScreen() )
		{
			if ( LastTakeHitInfo.DamageType.default.bCausesBlood && !class'GameInfo'.Static.UseLowGore(WorldInfo) )
			{
				BloodTemplate = class'UTEmitter'.static.GetTemplateForDistance(GetFamilyInfo().default.BloodEffects, LastTakeHitInfo.HitLocation, WorldInfo);
				if (BloodTemplate != None)
				{
					BloodMomentum = Normal(-1.0 * LastTakeHitInfo.Momentum) + (0.5 * VRand());
					HitEffect = Spawn(GetFamilyInfo().default.BloodEmitterClass, self,, LastTakeHitInfo.HitLocation, rotator(BloodMomentum));
					HitEffect.SetTemplate(BloodTemplate, true);
					HitEffect.AttachTo(self, LastTakeHitInfo.HitBone);
				}
			}

			if ( !Mesh.bNotUpdatingKinematicDueToDistance )
			{
				// physics based takehit animations
				UTDamage = class<UTDamageType>(LastTakeHitInfo.DamageType);
				if (UTDamage != None)
				{
					UTDamage.static.SpawnHitEffect(self, LastTakeHitInfo.Damage, LastTakeHitInfo.Momentum, LastTakeHitInfo.HitBone, LastTakeHitInfo.HitLocation);
				}
			}
		}
	}
}

/** called when bBlendOutTakeHitPhysics is true and our Mesh's PhysicsWeight has reached 0.0 */
simulated event TakeHitBlendedOut()
{
	Mesh.PhysicsWeight = 0.0;
	Mesh.PhysicsAssetInstance.SetAllBodiesFixed(TRUE);
}

reliable server function ServerHoverboard()
{
	local UTVehicle Board;
	local vector Start, End, HitLoc, HitNorm;
	local actor HitActor;
	local TraceHitInfo HitInfo;
	local bool bInDeepWater;

	// Do a line check to see if we are too deep in water
	Start = Location;
	End = Location - vect(0,0,15);
	HitActor = Trace(HitLoc, HitNorm, End, Start, false, vect(0,0,0), HitInfo, TRACEFLAG_PhysicsVolumes);
	if(HitActor != None && WaterVolume(HitActor) != None)
	{
		bInDeepWater = TRUE;
	}

	if ( bHasHoverboard && !bIsCrouched && (DrivenVehicle == None) && 
		 !PhysicsVolume.bWaterVolume && (WorldInfo.TimeSeconds - LastHoverboardTime > MinHoverboardInterval) && 
		 (Physics != PHYS_Swimming) &&  !bInDeepWater && !IsHero() )
	{
		LastHoverboardTime = WorldInfo.TimeSeconds;
		//Temp turn off collision
		SetCollision(false, false);
		Board = Spawn(HoverboardClass);
		if (Board != None && !Board.bDeleteMe)
		{
			// make sure it didn't get spawned on the other side of a wall
			if (!FastTrace(Board.Location, Location) || !Board.TryToDrive(self))
			{
				Board.Destroy();
				SetCollision(true, true);
			}
		}
		else
		{
			SetCollision(true, true);
		}
	}
}

function OnUseHoverboard(UTSeqAct_UseHoverboard Action)
{
	bHasHoverboard = true;
	ServerHoverboard();
	Action.Hoverboard = UTVehicle(DrivenVehicle);
}

simulated function SwitchWeapon(byte NewGroup)
{
	if (NewGroup == 0 && bHasHoverboard && DrivenVehicle == None)
	{
		if ( WorldInfo.TimeSeconds - LastHoverboardTime > MinHoverboardInterval )
		{
			ServerHoverboard();
			LastHoverboardTime = WorldInfo.TimeSeconds;
		}
		return;
	}

	if (UTInventoryManager(InvManager) != None)
	{
		UTInventoryManager(InvManager).SwitchWeapon(NewGroup);
	}
}

function TakeDrowningDamage()
{
	TakeDamage(5, None, Location + GetCollisionHeight() * vect(0,0,0.5)+ 0.7 * GetCollisionRadius() * vector(Controller.Rotation), vect(0,0,0), class'UTDmgType_Drowned');
}

/** TakeHeadShot()
 * @param	Impact - impact information (where the shot hit)
 * @param	HeadShotDamageType - damagetype to use if this is a headshot
 * @param	HeadDamage - amount of damage the weapon causes if this is a headshot
 * @param	AdditionalScale - head sphere scaling for head hit determination
 * @return		true if pawn handled this as a headshot, in which case the weapon doesn't need to cause damage to the pawn.
*/
function bool TakeHeadShot(const out ImpactInfo Impact, class<UTDamageType> HeadShotDamageType, int HeadDamage, float AdditionalScale, controller InstigatingController)
{
	if(IsLocationOnHead(Impact, AdditionalScale))
	{
		if ( HelmetArmor > 0 )
		{
			HelmetArmor = 0;
			bShieldAbsorb = true;
			Spawn(class'UTEmit_HeadShotHelmet',,,Impact.HitLocation);
		}
		else
		{
			TakeDamage(HeadDamage, InstigatingController, Impact.HitLocation, Impact.RayDir, HeadShotDamageType, Impact.HitInfo);
		}
		return true;
	}
	return false;
}

function bool IsLocationOnHead(const out ImpactInfo Impact, float AdditionalScale)
{
	local vector HeadLocation;
	local float Distance;

	if (HeadBone == '')
	{
		return False;
	}

	Mesh.ForceSkelUpdate();
	HeadLocation = Mesh.GetBoneLocation(HeadBone) + vect(0,0,1) * HeadHeight;

	// Find distance from head location to bullet vector
	Distance = PointDistToLine(HeadLocation, Impact.RayDir, Impact.HitLocation);

	return ( Distance < (HeadRadius * HeadScale * AdditionalScale) );
}

simulated function ModifyRotForDebugFreeCam(out rotator out_CamRot)
{
	local UTPlayerController UPC;

	UPC = UTPlayerController(Controller);
	//`log(GetFuncName()@self@UPC@Controller@UPC.bDebugFreeCam@DrivenVehicle);

	if ( (UPC == None) && (DrivenVehicle != None) )
	{
		UPC = UTPlayerController(DrivenVehicle.Controller);
	}

	if (UPC != None)
	{
		if (UPC.bDebugFreeCam)
		{
	//		`log(GetFuncName()@"setting rot");
			out_CamRot = UPC.DebugFreeCamRot;
		}
	}
}

simulated function bool IsFirstPerson()
{
	local PlayerController PC;

	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if ( (PC.ViewTarget == self) && PC.UsingFirstPersonCamera() )
			return true;
	}
	return false;
}

/** moves the camera in or out one */
simulated function AdjustCameraScale(bool bMoveCameraIn)
{
	if ( !IsFirstPerson() )
	{
		CameraScale = FClamp(CameraScale + (bMoveCameraIn ? -1.0 : 1.0), CameraScaleMin, CameraScaleMax);
	}
}

simulated event rotator GetViewRotation()
{
	local rotator Result;

	//@FIXME: eventually bot Rotation.Pitch will be nonzero?
	if (UTBot(Controller) != None)
	{
		Result = Controller.Rotation;
		Result.Pitch = rotator(Controller.FocalPoint - Location).Pitch;
		return Result;
	}
	else
	{
		return Super.GetViewRotation();
	}
}

simulated event TornOff()
{
	local class<UTDamageType> UTDamage;

   	Super.TornOff();

	SetPawnAmbientSound(None);
	SetWeaponAmbientSound(None);

	UTDamage = class<UTDamageType>(HitDamageType);

	if ( UTDamage != None)
	{
		if ( UTDamage.default.DamageOverlayTime > 0 )
		{
			SetBodyMatColor(UTDamage.default.DamageBodyMatColor, UTDamage.default.DamageOverlayTime);
		}
		UTDamage.Static.PawnTornOff(self);
	}
}

simulated function SetOverlayVisibility(bool bVisible)
{
	OverlayMesh.SetOwnerNoSee(!bVisible);
}

simulated function TakeFallingDamage()
{
	local UTPlayerController UTPC;

	Super.TakeFallingDamage();

	if (Velocity.Z < -0.5 * MaxFallSpeed)
	{
		UTPC = UTPlayerController(Controller);
		if(UTPC != None && LocalPlayer(UTPC.Player) != None)
		{
			UTPC.ClientPlayForceFeedbackWaveform(FallingDamageWaveForm);
		}
	}
}

simulated event RigidBodyCollision( PrimitiveComponent HitComponent, PrimitiveComponent OtherComponent,
					const out CollisionImpactData RigidCollisionData, int ContactIndex )
{
	// only check fall damage for Z axis collisions
	if (Abs(RigidCollisionData.ContactInfos[0].ContactNormal.Z) > 0.5)
	{
		Velocity = Mesh.GetRootBodyInstance().PreviousVelocity;
		TakeFallingDamage();
		// zero out the z velocity on the body now so that we don't get stacked collisions
		Velocity.Z = 0.0;
		Mesh.SetRBLinearVelocity(Velocity, false);
		Mesh.GetRootBodyInstance().PreviousVelocity = Velocity;
		Mesh.GetRootBodyInstance().Velocity = Velocity;
	}
}

/** Called when an SVehicle wheel physically contacts this Pawn. We kill it! */
event OnRanOver(SVehicle Vehicle, PrimitiveComponent RunOverComponent, int WheelIndex)
{
	local UTVehicle UTV;

	if(Role == ROLE_Authority)
	{
		UTV = UTVehicle(Vehicle);
		if(UTV != None)
		{
			TakeDamage( 10000, UTV.Controller, Location, vect(0,0,0), UTV.RanOverDamageType, , Vehicle);
		}
	}
}

/** called when we have been stuck falling for a long time with zero velocity
 * and couldn't find a place to move to get out of it
 */
event StuckFalling()
{
	if (AIController(Controller) != None)
	{
		Suicide();
	}
	else
	{
		StartedFallingTime = WorldInfo.TimeSeconds;
	}
}

/** Kismet hook for kicking a Pawn out of a vehicle */
function OnExitVehicle(UTSeqAct_ExitVehicle Action)
{
	if (DrivenVehicle != None)
	{
		DrivenVehicle.DriverLeave(true);
	}
}

/** Kismet hook for enabling/disabling infinite ammo for this Pawn */
function OnInfiniteAmmo(UTSeqAct_InfiniteAmmo Action)
{
	local UTInventoryManager UTInvManager;

	UTInvManager = UTInventoryManager(InvManager);
	if (UTInvManager != None)
	{
		UTInvManager.bInfiniteAmmo = Action.bInfiniteAmmo;
	}
}

/**
 * Toss active weapon using default settings (location+velocity).
 */
function ThrowActiveWeapon()
{
	local Weapon TossedGun;

	// to get more dual enforcer opportunities, throw out enforcer when kill player on hoverboard or with impact hammer or translocator.
	if ( Health <= 0 )
	{
		if ( (Weapon == None) || !Weapon.bCanThrow )
		{
			// throw out enforcer instead
			TossedGun = Weapon(FindInventoryType(class'UTGame.UTWeap_Enforcer'));
			if ( (TossedGun != None) && TossedGun.CanThrow() )
			{
				TossWeapon(TossedGun);
			}
			return;
		}
	}
	if ( Weapon != None )
	{
		TossWeapon(Weapon);
	}
}

function PossessedBy(Controller C, bool bVehicleTransition)
{
	Super.PossessedBy(C, bVehicleTransition);
	NotifyTeamChanged();
}

function bool NeedToTurn(vector targ)
{
	local vector LookDir, AimDir;
	local UTBot B;
	local float RequiredAim;

	LookDir = Vector(Rotation);
	LookDir.Z = 0;
	LookDir = Normal(LookDir);
	AimDir = targ - Location;
	AimDir.Z = 0;
	AimDir = Normal(AimDir);

	RequiredAim = 0.93;
	B = UTBot(Controller);
	if (B != None)
	{
		RequiredAim += 0.0085 * FClamp(B.Skill, 0.0, 7.0);
	}
	return ((LookDir Dot AimDir) < RequiredAim);
}

/**
 * Event called from native code when Pawn stops crouching.
 * Called on non owned Pawns through bIsCrouched replication.
 * Network: ALL
 *
 * @param	HeightAdjust	height difference in unreal units between default collision height, and actual crouched cylinder height.
 */
simulated event EndCrouch(float HeightAdjust)
{
	Super.EndCrouch(HeightAdjust);

	// offset mesh by height adjustment
	CrouchMeshZOffset = 0.0;
}

/**
 * Event called from native code when Pawn starts crouching.
 * Called on non owned Pawns through bIsCrouched replication.
 * Network: ALL
 *
 * @param	HeightAdjust	height difference in unreal units between default collision height, and actual crouched cylinder height.
 */
simulated event StartCrouch(float HeightAdjust)
{
	Super.StartCrouch(HeightAdjust);

	// offset mesh by height adjustment
	CrouchMeshZOffset = HeightAdjust;
}

simulated function GetQuickPickCells(UTHud Hud, out array<QuickPickCell> Cells, out int CurrentWeaponIndex)
{
	local inventory Inv;
	local UTWeapon Weap;
	local int i;
	if (InvManager != none )
	{
		Inv = InvManager.InventoryChain;
		while ( Inv != none )
		{
			Weap = UTWeapon(Inv);
			if ( Weap != none && Weap.HasAnyAmmo() && Weap.QuickPickGroup>=0 && Weap.QuickPickGroup < 8 )
			{
				// Init the cell array one the first weapon

				if (Cells.Length < 8)
				{
					Cells.Length = 8;
					for (i=0;i<8;i++)
					{
						Cells[i].bDrawCell = true;
					}
				}

				if (Weap.QuickPickWeight > Cells[Weap.QuickPickGroup].Weight || Weap == Weapon)
				{
					Cells[Weap.QuickPickGroup].Icon = Hud.AltHudTexture;
					Cells[Weap.QuickPickGroup].IconCoords = Weap.IconCoordinates;
					Cells[Weap.QuickPickGroup].bDrawCell = true;
					Cells[Weap.QuickPickGroup].Weight = Weap.QuickPickWeight;
					if (Weap == Weapon)
					{
						CurrentWeaponIndex = Weap.QuickPickGroup;
					}
				}
			}
			Inv = Inv.Inventory;
		}
	}
}

simulated function QuickPick(int Quad)
{
	local inventory Inv;
	local UTWeapon Weap, Best;
	if (InvManager != none )
	{
		Inv = InvManager.InventoryChain;
		while ( Inv != none )
		{
			Weap = UTWeapon(Inv);
			if ( Weap != none && Weap.HasAnyAmmo() && Weap.QuickPickGroup == Quad )
			{
				if ( Best == none || Weap.QuickPickWeight > Best.QuickPickWeight )
				{
					Best = Weap;
				}
			}
			Inv = Inv.Inventory;
		}

		if ( Best != none && Best != weapon && Best != InvManager.PendingWeapon )
		{
			LogInternal("### Best:"@Best);
			InvManager.SetCurrentWeapon(Best);
		}
	}



}

state FeigningDeath
{
	ignores ServerHoverboard, SwitchWeapon, QuickPick, FaceRotation, ForceRagdoll, AdjustCameraScale, SetMovementPhysics;

	exec simulated function FeignDeath()
	{
		if (bFeigningDeath)
		{
			Global.FeignDeath();
		}
	}

	reliable server function ServerFeignDeath()
	{
		if (Role == ROLE_Authority && !WorldInfo.GRI.bMatchIsOver && !IsTimerActive('FeignDeathDelayTimer') && bFeigningDeath)
		{
			bFeigningDeath = false;
			PlayFeignDeath();
		}
	}

	event bool EncroachingOn(Actor Other)
	{
		if ( ForcedDirVolume(Other) != None )
		{
			if ( ForcedDirVolume(Other).bBlockPawns && Other.ContainsPoint(Location) )
			{
				TakeDamage(10000, Controller, Location, vect(0,0,0), class'DmgType_Crushed');
			}		
		}
		// don't abort moves in ragdoll
		return false;
	}

	simulated function bool CanThrowWeapon()
	{
		return false;
	}

	simulated function Tick(float DeltaTime)
	{
		local rotator NewRotation;

		if (bPlayingFeignDeathRecovery && PlayerController(Controller) != None)
		{
			// interpolate Controller yaw to our yaw so that we don't get our rotation snapped around when we get out of feign death
			NewRotation = Controller.Rotation;
			NewRotation.Yaw = RInterpTo(NewRotation, Rotation, DeltaTime, 2.0).Yaw;
			Controller.SetRotation(NewRotation);

			if ( WorldInfo.TimeSeconds - FeignDeathRecoveryStartTime > 0.8 )
			{
				CameraScale = 1.0;
			}
		}
	}

	simulated function bool CalcThirdPersonCam( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
	{
		local vector CamStart, HitLocation, HitNormal, CamDir;
		local RB_BodyInstance RootBodyInst;
		local matrix RootBodyTM;

		if (CurrentCameraScale < CameraScale)
		{
			CurrentCameraScale = FMin(CameraScale, CurrentCameraScale + 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
		}
		else if (CurrentCameraScale > CameraScale)
		{
			CurrentCameraScale = FMax(CameraScale, CurrentCameraScale - 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
		}

//		CamStart = Mesh.Bounds.Origin + vect(0,0,1) * BaseEyeHeight; (Replaced with below due to Bounds being updated 2x per frame which can result in jitter-cam
		CamStart = Mesh.GetPosition();
		if(Mesh.PhysicsAssetInstance != None)
		{
			RootBodyInst = Mesh.PhysicsAssetInstance.Bodies[Mesh.PhysicsAssetInstance.RootBodyIndex];
			if(RootBodyInst.IsValidBodyInstance())
			{
				RootBodyTM = RootBodyInst.GetUnrealWorldTM();
				CamStart.X = RootBodyTM.WPlane.X;
				CamStart.Y = RootBodyTM.WPlane.Y;
				CamStart.Z = RootBodyTM.WPlane.Z;
			}
		}
		CamStart += vect(0,0,1) * BaseEyeHeight;

		CamDir = vector(out_CamRot) * GetCollisionRadius() * CurrentCameraScale;
//		`log("Mesh"@Mesh.Bounds.Origin@" --- Base Eye Height "@BaseEyeHeight);

		if (CamDir.Z > GetCollisionHeight())
		{
			CamDir *= square(cos(out_CamRot.Pitch * 0.0000958738)); // 0.0000958738 = 2*PI/65536
		}
		out_CamLoc = CamStart - CamDir;
		if (Trace(HitLocation, HitNormal, out_CamLoc, CamStart, false, vect(12,12,12)) != None)
		{
			out_CamLoc = HitLocation;
		}
		return true;
	}

	simulated event OnAnimEnd(AnimNodeSequence SeqNode, float PlayedTime, float ExcessTime)
	{
		if (Physics != PHYS_RigidBody && !bPlayingFeignDeathRecovery)
		{
			// blend out of feign death animation
			if (FeignDeathBlend != None)
			{
				FeignDeathBlend.SetBlendTarget(0.0, 0.5);
			}
			GotoState('Auto');
		}
	}

	simulated event BeginState(name PreviousStateName)
	{
		local UTPlayerController PC;
		local UTWeapon UTWeap;

		if ( DarkMatchLight != None )
		{
			DarkMatchLight.SetEnabled(false);
		}
		PC = UTPlayerController(Controller);

		bCanPickupInventory = false;
		StopFiring();
		bNoWeaponFiring = true;

		UTWeap = UTWeapon(Weapon);
		if (UTWeap != None)
		{
			UTWeap.PlayWeaponPutDown();
		}
		if(UTWeap != none && PC != none)
		{
			PC.EndZoom();
		}

		if (PC != None)
		{
			PC.SetBehindView(true);
			CurrentCameraScale = 1.5;
			CameraScale = 2.25;

			if(LocalPlayer(PC.Player) != None)
			{
				PC.ClientPlayForceFeedbackWaveform(FeignDeathWaveForm);
			}
		}

		DropFlag();
	}

	simulated function EndState(name NextStateName)
	{
		local UTPlayerController PC;
		local UTPawn P;
		local Actor A;
		
		if (NextStateName != 'Dying')
		{
			if ( DarkMatchLight != None )
			{
				DarkMatchLight.SetEnabled(true);
			}
			bNoWeaponFiring = default.bNoWeaponFiring;
			bCanPickupInventory = default.bCanPickupInventory;
		
			ForEach TouchingActors(class'Actor', A)
			{
				if ( (DroppedPickup(A) != None)
					|| (PickupFactory(A) != None)
					|| (UTCarriedObject(A) != None) )
				{
					A.Touch(self, CylinderComponent, A.Location, Normal(Location - A.Location));
				}
			}
			Global.SetMovementPhysics();
			PC = UTPlayerController(Controller);
			if (PC != None)
			{
				PC.SetBehindView(PC.default.bBehindView);
			}

			CurrentCameraScale = default.CurrentCameraScale;
			CameraScale = default.CameraScale;
			bForcedFeignDeath = false;
			bPlayingFeignDeathRecovery = false;

			// jump away from other feigning death pawns to make sure we don't get stuck
			foreach TouchingActors(class'UTPawn', P)
			{
				if (P.IsInState('FeigningDeath'))
				{
					JumpOffPawn();
				}
			}
		}
	}
}

simulated State Dying
{
ignores OnAnimEnd, Bump, HitWall, HeadVolumeChange, PhysicsVolumeChange, Falling, BreathTimer, StartFeignDeathRecoveryAnim, ForceRagdoll, FellOutOfWorld;

	exec simulated function FeignDeath();
	reliable server function ServerFeignDeath();

	event bool EncroachingOn(Actor Other)
	{
		// don't abort moves in ragdoll
		return false;
	}

	event Timer()
	{
		local PlayerController PC;
		local bool bBehindAllPlayers;
		local vector ViewLocation;
		local rotator ViewRotation;

		// let the dead bodies stay if the game is over
		if (WorldInfo.GRI != None && WorldInfo.GRI.bMatchIsOver)
		{
			LifeSpan = 0.0;
			return;
		}

		if ( !PlayerCanSeeMe() )
		{
			Destroy();
			return;
		}
		// go away if not viewtarget
		//@todo FIXMESTEVE - use drop detail, get rid of backup visibility check
		bBehindAllPlayers = true;
		ForEach LocalPlayerControllers(class'PlayerController', PC)
		{
			if ( (PC.ViewTarget == self) || (PC.ViewTarget == Base) )
			{
				if ( LifeSpan < 3.5 )
					LifeSpan = 3.5;
				SetTimer(2.0, false);
				return;
			}

			PC.GetPlayerViewPoint( ViewLocation, ViewRotation );
			if ( ((Location - ViewLocation) dot vector(ViewRotation) > 0) )
			{
				bBehindAllPlayers = false;
				break;
			}
		}
		if ( bBehindAllPlayers )
		{
			Destroy();
			return;
		}
		SetTimer(2.0, false);
	}

	/**
	*	Calculate camera view point, when viewing this pawn.
	*
	* @param	fDeltaTime	delta time seconds since last update
	* @param	out_CamLoc	Camera Location
	* @param	out_CamRot	Camera Rotation
	* @param	out_FOV		Field of View
	*
	* @return	true if Pawn should provide the camera point of view.
	*/
	simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
	{
		local vector LookAt;
		local class<UTDamageType> UTDamage;

		UTDamage = class<UTDamageType>(HitDamageType);
		if (UTDamage == None || !UTDamage.default.bSpecialDeathCamera)
		{

 			CalcThirdPersonCam(fDeltaTime, out_CamLoc, out_CamRot, out_FOV);
			bStopDeathCamera = bStopDeathCamera || (out_CamLoc.Z < WorldInfo.KillZ);
			if ( bStopDeathCamera && (OldCameraPosition != vect(0,0,0)) )
			{
					// Don't allow camera to go below killz, by re-using old camera position once dead pawn falls below killz
				out_CamLoc = OldCameraPosition;
				LookAt = Location;
					CameraZOffset = (fDeltaTime < 0.2) ? (1 - 5*fDeltaTime) * CameraZOffset : 0.0;
					LookAt.Z += CameraZOffset;
				out_CamRot = rotator(LookAt - out_CamLoc);
			}
			OldCameraPosition = out_CamLoc;
			return true;
		}
		else
		{
			UTDamage.static.CalcDeathCamera(self, fDeltaTime, out_CamLoc, out_CamRot, out_FOV);
			
			// If necessary, initialize the light environment for FirstPersonDeathVisionMesh
			// This is performed here because we cannot modify UTGameContent for UT3G
			if ( (WorldInfo.NetMode != NM_DedicatedServer) && !bSetupDeathLight && FirstPersonDeathVisionMesh != None && FirstPersonDeathVisionLightEnvironment != None)
			{
				FirstPersonDeathVisionLightEnvironment.SetEnabled(true);
				FirstPersonDeathVisionMesh.SetLightEnvironment(FirstPersonDeathVisionLightEnvironment);
				AttachComponent(FirstPersonDeathVisionLightEnvironment);
				bSetupDeathLight = true;
			}

			return true;
		}
	}

	simulated event Landed(vector HitNormal, Actor FloorActor)
	{
		local vector BounceDir;

		if( Velocity.Z < -500 )
		{
			BounceDir = 0.5 * (Velocity - 2.0*HitNormal*(Velocity dot HitNormal));
			TakeDamage( (1-Velocity.Z/30), Controller, Location, BounceDir, class'DmgType_Crushed');
		}
	}

	simulated event TakeDamage(int Damage, Controller InstigatedBy, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
	{
		local Vector shotDir, ApplyImpulse,BloodMomentum;
		local class<UTDamageType> UTDamage;
		local UTEmit_HitEffect HitEffect;

		if ( class'GameInfo'.Static.UseLowGore(WorldInfo) )
		{
			if ( !bGibbed )
			{
				UTDamage = class<UTDamageType>(DamageType);
				if (UTDamage != None && ShouldGib(UTDamage))
				{
					bTearOffGibs = true;
					bGibbed = true;
				}
			}
			return;
		}

		// When playing death anim, we keep track of how long since we took that kind of damage.
		if(DeathAnimDamageType != None)
		{
			if(DamageType == DeathAnimDamageType)
			{
				TimeLastTookDeathAnimDamage = WorldInfo.TimeSeconds;
			}
		}

		if (!bGibbed && (InstigatedBy != None || EffectIsRelevant(Location, true, 0)))
		{
			UTDamage = class<UTDamageType>(DamageType);

			// accumulate damage taken in a single tick
			if ( AccumulationTime != WorldInfo.TimeSeconds )
			{
				AccumulateDamage = 0;
				AccumulationTime = WorldInfo.TimeSeconds;
			}
			AccumulateDamage += Damage;

			Health -= Damage;
			if (UTDamage != None && ShouldGib(UTDamage))
			{
				if ( bHideOnListenServer || (WorldInfo.NetMode == NM_DedicatedServer) )
				{
					bTearOffGibs = true;
					bGibbed = true;
					return;
				}
				SpawnGibs(UTDamage, HitLocation);
			}
			else if ( !bHideOnListenServer && (WorldInfo.NetMode != NM_DedicatedServer) )
			{
				CheckHitInfo( HitInfo, Mesh, Normal(Momentum), HitLocation );
				if ( UTDamage != None )
				{
					UTDamage.Static.SpawnHitEffect(self, Damage, Momentum, HitInfo.BoneName, HitLocation);
				}
				if ( DamageType.default.bCausesBlood && !class'GameInfo'.Static.UseLowGore(WorldInfo)
					&& ((PlayerController(Controller) == None) || (WorldInfo.NetMode != NM_Standalone)) )
				{
					BloodMomentum = Momentum;
					if ( BloodMomentum.Z > 0 )
						BloodMomentum.Z *= 0.5;
					HitEffect = Spawn(GetFamilyInfo().default.BloodEmitterClass,self,, HitLocation, rotator(BloodMomentum));
					HitEffect.AttachTo(Self,HitInfo.BoneName);
				}

				if ( (UTDamage != None) && (UTDamage.default.DamageOverlayTime > 0) && (UTDamage.default.DamageBodyMatColor != class'UTDamageType'.default.DamageBodyMatColor) )
				{
					SetBodyMatColor(UTDamage.default.DamageBodyMatColor, UTDamage.default.DamageOverlayTime);
				}

				if( (Physics != PHYS_RigidBody) || (Momentum == vect(0,0,0)) || (HitInfo.BoneName == '') )
					return;

				shotDir = Normal(Momentum);
				ApplyImpulse = (DamageType.Default.KDamageImpulse * shotDir);

				if( (UTDamage != None) && UTDamage.Default.bThrowRagdoll && (Velocity.Z > -10) )
				{
					ApplyImpulse += Vect(0,0,1)*DamageType.default.KDeathUpKick;
				}
				// AddImpulse() will only wake up the body for the bone we hit, so force the others to wake up
				Mesh.WakeRigidBody();
				Mesh.AddImpulse(ApplyImpulse, HitLocation, HitInfo.BoneName, true);
			}
		}
	}

	simulated function BeginState(Name PreviousStateName)
	{
		Super.BeginState(PreviousStateName);
		CustomGravityScaling = 1.0;
		DeathTime = WorldInfo.TimeSeconds;
		CylinderComponent.SetActorCollision(false, false);

		if ( bTearOff && (bHideOnListenServer || (WorldInfo.NetMode == NM_DedicatedServer)) )
			LifeSpan = 1.0;
		else
		{
			if ( Mesh != None )
			{
				Mesh.SetTraceBlocking(true, true);
				Mesh.SetActorCollision(true, false);

				// Move into post so that we are hitting physics from last frame, rather than animated from this
				Mesh.SetTickGroup(TG_PostAsyncWork);
			}
			SetTimer(2.0, false);
			LifeSpan = RagDollLifeSpan;
		}
	}

	simulated function EndState(Name NextStateName)
	{
		bSetupDeathLight = false;
		if ( WorldInfo.NetMode != NM_DedicatedServer )
		{
			DetachComponent(FirstPersonDeathVisionLightEnvironment);
		}
		Super.EndState(NextStateName);
	}
}

/** This will determine and then return the FamilyInfo for this pawn **/
simulated function class<UTFamilyInfo> GetFamilyInfo()
{
	local class<UTFamilyInfo> FamilyInfo;
	local UTPlayerReplicationInfo UTPRI;

	// Find the family we belong to (if we need to)
	if( CurrFamilyInfo != none )
	{
		FamilyInfo = CurrFamilyInfo;
	}
	else
	{
		UTPRI = UTPlayerReplicationInfo(PlayerReplicationInfo);
		if( UTPRI != None )
		{
			FamilyInfo = class'UTCustomChar_Data'.static.FindFamilyInfo(UTPRI.CharacterData.FamilyID);
		}
	}

	// If we couldn't find it (or empty), use the default
	if(FamilyInfo == None)
	{
		FamilyInfo = DefaultFamily;
	}

	return FamilyInfo;
}

simulated function PostTeleport(Teleporter OutTeleporter)
{
	Super.PostTeleport(OutTeleporter);

	BigTeleportCount++;
	PostBigTeleport();
}

/** Called when teleporting using either a teleporter or a translocator */
simulated function PostBigTeleport()
{
	ForceUpdateComponents();
	Mesh.UpdateRBBonesFromSpaceBases(TRUE, TRUE);
}

exec function AngDriveSpring(float Spring)
{
	Mesh.PhysicsAssetInstance.SetAngularDriveScale(Spring, Mesh.PhysicsAssetInstance.AngularDampingScale, 0.0f);

	LogInternal("Angular Spring scaled by "$Spring);
}

exec function AngDriveDAmp(float Damp)
{
	Mesh.PhysicsAssetInstance.SetAngularDriveScale(Mesh.PhysicsAssetInstance.AngularSpringScale, Damp, 0.0f);

	LogInternal("Angular Damp scaled by "$Damp);
}

exec function LinDriveSpring(float Spring, float Damp)
{
	Mesh.PhysicsAssetInstance.SetLinearDriveScale(Spring, Mesh.PhysicsAssetInstance.LinearDampingScale, 0.0f);

	LogInternal("Linear Spring scaled by "$Spring);
}

exec function LinDriveDAmp(float Spring, float Damp)
{
	Mesh.PhysicsAssetInstance.SetLinearDriveScale(Mesh.PhysicsAssetInstance.LinearSpringScale, Damp, 0.0f);

	LogInternal("Linear Damp scaled by"$Damp);
}

exec function BackSpring(float LinSpring)
{
	local RB_BodyInstance BodyInst;
	local RB_BodySetup BodySetup;
	local int i;

	for(i=0; i<Mesh.PhysicsAsset.BodySetup.Length; i++)
	{
		BodyInst = Mesh.PhysicsAssetInstance.Bodies[i];
		BodySetup = Mesh.PhysicsAsset.BodySetup[i];

		if (BodySetup.BoneName == 'b_Spine2')
		{
			BodyInst.SetBoneSpringParams(LinSpring, BodyInst.BoneLinearDamping, 0.1*LinSpring, BodyInst.BoneAngularDamping);
		}
	}

	//`log("Hip Spring set to "$LinSpring);
}

exec function BackDamp(float LinDamp)
{
	local RB_BodyInstance BodyInst;
	local RB_BodySetup BodySetup;
	local int i;

	for(i=0; i<Mesh.PhysicsAsset.BodySetup.Length; i++)
	{
		BodyInst = Mesh.PhysicsAssetInstance.Bodies[i];
		BodySetup = Mesh.PhysicsAsset.BodySetup[i];

		if (BodySetup.BoneName == 'b_Spine2')
		{
			BodyInst.SetBoneSpringParams(BodyInst.BoneLinearSpring, LinDamp, BodyInst.BoneAngularDamping, LinDamp);
		}
	}

	//`log("Hip Damp set to "$LinDamp);
}

exec function HandSpring(float LinSpring)
{
	local RB_BodyInstance BodyInst;
	local RB_BodySetup BodySetup;
	local int i;

	for(i=0; i<Mesh.PhysicsAsset.BodySetup.Length; i++)
	{
		BodyInst = Mesh.PhysicsAssetInstance.Bodies[i];
		BodySetup = Mesh.PhysicsAsset.BodySetup[i];

		if (BodySetup.BoneName == 'b_RightHand' || BodySetup.BoneName == 'b_LeftHand')
		{
			BodyInst.SetBoneSpringParams(LinSpring, BodyInst.BoneLinearDamping, 0.1*LinSpring, BodyInst.BoneAngularDamping);
		}
	}

	//`log("Hip Spring set to "$LinSpring);
}

exec function HandDamp(float LinDamp)
{
	local RB_BodyInstance BodyInst;
	local RB_BodySetup BodySetup;
	local int i;

	for(i=0; i<Mesh.PhysicsAsset.BodySetup.Length; i++)
	{
		BodyInst = Mesh.PhysicsAssetInstance.Bodies[i];
		BodySetup = Mesh.PhysicsAsset.BodySetup[i];

		if (BodySetup.BoneName == 'b_RightHand' || BodySetup.BoneName == 'b_LeftHand')
		{
			BodyInst.SetBoneSpringParams(BodyInst.BoneLinearSpring, LinDamp, BodyInst.BoneAngularDamping, LinDamp);
		}
	}

	//`log("Hip Damp set to "$LinDamp);
}

function bool BecomeHero()
{
	return false;
}

function bool PerformMeleeAttack()
{
	return false;
}

simulated function ToggleMelee()
{
	if ( Weapon != None )
	{
		if ( Weapon.bMeleeWeapon )
		{
			UTInventoryManager(InvManager).SwitchToPreviousWeapon();
		}
		else if ( UTPlayerController(Controller) != None )
		{
			UTPlayerController(Controller).SwitchWeapon(1);
		}
	}
}

defaultproperties
{
   bStopOnDoubleLanding=True
   bWeaponBob=True
   bCanDoubleJump=True
   bWeaponAttachmentVisible=True
   bEnableFootPlacement=True
   bCanRagDoll=True
   Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment ObjName=MyLightEnvironment Archetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent'
      AmbientShadowColor=(R=0.300000,G=0.300000,B=0.300000,A=1.000000)
      AmbientGlow=(R=0.300000,G=0.300000,B=0.300000,A=1.000000)
      ModShadowFadeoutTime=1.000000
      Name="MyLightEnvironment"
      ObjectArchetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent'
   End Object
   LightEnvironment=MyLightEnvironment
   DeathHipLinSpring=10000.000000
   DeathHipLinDamp=500.000000
   DeathHipAngSpring=10000.000000
   DeathHipAngDamp=500.000000
   MinTimeBetweenEmotes=1.000000
   CameraScale=9.000000
   CurrentCameraScale=1.000000
   CameraScaleMin=3.000000
   CameraScaleMax=40.000000
   HeroCameraScale=6.000000
   HeroCameraPitch=6000
   DodgeSpeed=600.000000
   DodgeSpeedZ=295.000000
   MultiJumpRemaining=1
   MultiDodgeRemaining=1
   MaxMultiJump=1
   MaxMultiDodge=1
   MultiJumpBoost=-45
   MaxDoubleJumpHeight=87.000000
   SlopeBoostFriction=0.200000
   DoubleJumpEyeHeight=43.000000
   DoubleJumpThreshold=160.000000
   MaxLeanRoll=5000
   DefaultAirControl=0.350000
   DodgeResetTime=0.350000
   Bob=0.010000
   FeignDeathBodyAtRestSpeed=12.000000
   FeignDeathPhysicsBlendOutSpeed=2.000000
   SuperHealthMax=199
   SoundGroupClass=Class'UTGame.UTPawnSoundGroup'
   Begin Object Class=ParticleSystemComponent Name=GooDeath ObjName=GooDeath Archetype=ParticleSystemComponent'Engine.Default__ParticleSystemComponent'
      Template=ParticleSystem'WP_BioRifle.Particles.P_WP_Biorifle_DeathBurn'
      bAutoActivate=False
      Name="GooDeath"
      ObjectArchetype=ParticleSystemComponent'Engine.Default__ParticleSystemComponent'
   End Object
   BioBurnAway=GooDeath
   BioBurnAwayTime=3.500000
   BioEffectName="BioRifleDeathBurnTime"
   Begin Object Class=DynamicLightEnvironmentComponent Name=DeathVisionLightEnv ObjName=DeathVisionLightEnv Archetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent'
      AmbientGlow=(R=0.200000,G=0.200000,B=0.200000,A=1.000000)
      bCastShadows=False
      bDynamic=False
      Name="DeathVisionLightEnv"
      ObjectArchetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent'
   End Object
   FirstPersonDeathVisionLightEnvironment=DeathVisionLightEnv
   TorsoBoneName="b_Spine2"
   FallImpactSound=SoundCue'A_Character_BodyImpacts.BodyImpacts.A_Character_BodyImpact_BodyFall_Cue'
   FallSpeedThreshold=125.000000
   TakeHitPhysicsBlendOutSpeed=0.500000
   FallingDamageWaveForm=ForceFeedbackWaveform'UTGame.Default__UTPawn:ForceFeedbackWaveformFall'
   FeignDeathWaveForm=ForceFeedbackWaveform'UTGame.Default__UTPawn:ForceFeedbackWaveformFeignDeath'
   MaxYawAim=7000
   MinHoverboardInterval=0.700000
   Begin Object Class=UTSkeletalMeshComponent Name=FirstPersonArms ObjName=FirstPersonArms Archetype=UTSkeletalMeshComponent'UTGame.Default__UTSkeletalMeshComponent'
      FOV=55.000000
      Begin Object Class=AnimNodeSequence Name=MeshSequenceA ObjName=MeshSequenceA Archetype=AnimNodeSequence'Engine.Default__AnimNodeSequence'
         Name="MeshSequenceA"
         ObjectArchetype=AnimNodeSequence'Engine.Default__AnimNodeSequence'
      End Object
      Animations=AnimNodeSequence'UTGame.Default__UTPawn:MeshSequenceA'
      bUpdateSkelWhenNotRendered=False
      bIgnoreControllersWhenNotRendered=True
      bSyncActorLocationToRootRigidBody=False
      bOverrideAttachmentOwnerVisibility=True
      DepthPriorityGroup=SDPG_Foreground
      bOnlyOwnerSee=True
      CastShadow=False
      AbsoluteRotation=True
      AbsoluteScale=True
      TickGroup=TG_DuringAsyncWork
      Name="FirstPersonArms"
      ObjectArchetype=UTSkeletalMeshComponent'UTGame.Default__UTSkeletalMeshComponent'
   End Object
   ArmsMesh(0)=FirstPersonArms
   Begin Object Class=UTSkeletalMeshComponent Name=FirstPersonArms2 ObjName=FirstPersonArms2 Archetype=UTSkeletalMeshComponent'UTGame.Default__UTSkeletalMeshComponent'
      FOV=55.000000
      Begin Object Class=AnimNodeSequence Name=MeshSequenceB ObjName=MeshSequenceB Archetype=AnimNodeSequence'Engine.Default__AnimNodeSequence'
         Name="MeshSequenceB"
         ObjectArchetype=AnimNodeSequence'Engine.Default__AnimNodeSequence'
      End Object
      Animations=AnimNodeSequence'UTGame.Default__UTPawn:MeshSequenceB'
      bUpdateSkelWhenNotRendered=False
      bIgnoreControllersWhenNotRendered=True
      bSyncActorLocationToRootRigidBody=False
      bOverrideAttachmentOwnerVisibility=True
      DepthPriorityGroup=SDPG_Foreground
      HiddenGame=True
      bOnlyOwnerSee=True
      CastShadow=False
      Scale3D=(X=1.000000,Y=-1.000000,Z=1.000000)
      AbsoluteRotation=True
      AbsoluteScale=True
      TickGroup=TG_DuringAsyncWork
      Name="FirstPersonArms2"
      ObjectArchetype=UTSkeletalMeshComponent'UTGame.Default__UTSkeletalMeshComponent'
   End Object
   ArmsMesh(1)=FirstPersonArms2
   WeaponSocket="WeaponPoint"
   WeaponSocket2="DualWeaponPoint"
   PawnEffectSockets(0)="L_JB"
   PawnEffectSockets(1)="R_JB"
   FireRateMultiplier=1.000000
   HeadOffset=32.000000
   HeadRadius=9.000000
   HeadHeight=5.000000
   HeadBone="b_Head"
   HeadScale=1.000000
   TransInEffects(0)=Class'UTGame.UTEmit_TransLocateOutRed'
   TransInEffects(1)=Class'UTGame.UTEmit_TransLocateOut'
   TransOutEffects(0)=Class'UTGame.UTEmit_TransLocateOutRed'
   TransOutEffects(1)=Class'UTGame.UTEmit_TransLocateOut'
   TranslocateColor(0)=(R=20.000000,G=0.000000,B=0.000000,A=1.000000)
   TranslocateColor(1)=(R=0.000000,G=0.000000,B=20.000000,A=1.000000)
   TransCameraAnim(0)=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN_Red'
   TransCameraAnim(1)=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN_Blue'
   TransCameraAnim(2)=CameraAnim'Envy_Effects.Camera_Shakes.C_Res_IN'
   Begin Object Class=UTAmbientSoundComponent Name=AmbientSoundComponent ObjName=AmbientSoundComponent Archetype=UTAmbientSoundComponent'UTGame.Default__UTAmbientSoundComponent'
      Name="AmbientSoundComponent"
      ObjectArchetype=UTAmbientSoundComponent'UTGame.Default__UTAmbientSoundComponent'
   End Object
   PawnAmbientSound=AmbientSoundComponent
   Begin Object Class=UTAmbientSoundComponent Name=AmbientSoundComponent2 ObjName=AmbientSoundComponent2 Archetype=UTAmbientSoundComponent'UTGame.Default__UTAmbientSoundComponent'
      Name="AmbientSoundComponent2"
      ObjectArchetype=UTAmbientSoundComponent'UTGame.Default__UTAmbientSoundComponent'
   End Object
   WeaponAmbientSound=AmbientSoundComponent2
   ArmorHitSound=SoundCue'A_Gameplay.Gameplay.A_Gameplay_ArmorHitCue'
   SpawnSound=SoundCue'A_Gameplay.A_Gameplay_PlayerSpawn01Cue'
   TeleportSound=SoundCue'A_Weapon_Translocator.Translocator.A_Weapon_Translocator_Teleport_Cue'
   BodyMatColor=(R=0.000000,G=0.000000,B=0.000000,A=1.000000)
   CurrentBodyMatColor=(R=0.000000,G=0.000000,B=0.000000,A=1.000000)
   SpawnProtectionColor=(R=40.000000,G=40.000000,B=0.000000,A=1.000000)
   DamageParameterName="DamageOverlay"
   SaturationParameterName="Char_DistSatRangeMultiplier"
   Begin Object Class=SkeletalMeshComponent Name=OverlayMeshComponent0 ObjName=OverlayMeshComponent0 Archetype=SkeletalMeshComponent'Engine.Default__SkeletalMeshComponent'
      bUpdateSkelWhenNotRendered=False
      bOverrideAttachmentOwnerVisibility=True
      bOwnerNoSee=True
      bUseAsOccluder=False
      CastShadow=False
      Scale=1.015000
      TickGroup=TG_PostAsyncWork
      Name="OverlayMeshComponent0"
      ObjectArchetype=SkeletalMeshComponent'Engine.Default__SkeletalMeshComponent'
   End Object
   OverlayMesh=OverlayMeshComponent0
   XRayEffectDamageMult=5.000000
   Begin Object Class=DynamicLightEnvironmentComponent Name=XRayEffectLightEnv ObjName=XRayEffectLightEnv Archetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent'
      AmbientShadowColor=(R=0.500000,G=0.500000,B=0.500000,A=1.000000)
      AmbientGlow=(R=40.000000,G=40.000000,B=40.000000,A=1.000000)
      ModShadowFadeoutTime=1.000000
      Name="XRayEffectLightEnv"
      ObjectArchetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent'
   End Object
   XRayEffectLightEnvironment=XRayEffectLightEnv
   TeamBeaconMaxDist=3000.000000
   TeamBeaconPlayerInfoMaxDist=3000.000000
   MapSize=1.000000
   IconCoords=(U=657.000000,V=129.000000,UL=68.000000,VL=58.000000)
   LastPainSound=-1000.000000
   RagdollLifespan=18.000000
   LeftFootControlName="LeftFootControl"
   RightFootControlName="RightFootControl"
   BaseTranslationOffset=6.000000
   MaxFootPlacementDistSquared=56250000.000000
   MaxFootstepDistSq=9000000.000000
   MaxJumpSoundDistSq=16000000.000000
   SwimmingZOffset=-30.000000
   SwimmingZOffsetSpeed=45.000000
   CustomGravityScaling=1.000000
   HoverboardClass=Class'UTGame.UTVehicle_Hoverboard'
   ShieldBeltMaterialInstance=Material'PICKUPS.Armor_ShieldBelt.M_ShieldBelt_Overlay'
   ShieldBeltTeamMaterialInstances(0)=Material'PICKUPS.Armor_ShieldBelt.M_ShieldBelt_Red'
   ShieldBeltTeamMaterialInstances(1)=Material'PICKUPS.Armor_ShieldBelt.M_ShieldBelt_Blue'
   ShieldBeltTeamMaterialInstances(2)=Material'PICKUPS.Armor_ShieldBelt.M_ShieldBelt_Red'
   ShieldBeltTeamMaterialInstances(3)=Material'PICKUPS.Armor_ShieldBelt.M_ShieldBelt_Blue'
   DefaultFamily=Class'UTGame.UTFamilyInfo_Ironguard_Male'
   DefaultMesh=SkeletalMesh'CH_IronGuard_Male.Mesh.SK_CH_IronGuard_MaleA'
   DefaultHeadPortrait=Texture2D'CH_IronGuard_Headshot.T_IronGuard_HeadShot_DM'
   DefaultTeamMaterials(0)=MaterialInstanceConstant'CH_IronGuard_Male.Materials.MI_CH_IronG_Mbody01_VRed'
   DefaultTeamMaterials(1)=MaterialInstanceConstant'CH_IronGuard_Male.Materials.MI_CH_IronG_Mbody01_VBlue'
   DefaultTeamHeadMaterials(0)=MaterialInstanceConstant'CH_IronGuard_Male.Materials.MI_CH_IronG_MHead01_VRed'
   DefaultTeamHeadMaterials(1)=MaterialInstanceConstant'CH_IronGuard_Male.Materials.MI_CH_IronG_MHead01_VBlue'
   DefaultTeamHeadPortrait(0)=Texture2D'CH_IronGuard_Headshot.T_IronGuard_HeadShot_Red'
   DefaultTeamHeadPortrait(1)=Texture2D'CH_IronGuard_Headshot.T_IronGuard_HeadShot_Blue'
   DefaultMeshScale=1.075000
   TauntNames(0)="TauntA"
   TauntNames(1)="TauntB"
   TauntNames(2)="TauntC"
   TauntNames(3)="TauntD"
   TauntNames(4)="TauntE"
   TauntNames(5)="TauntF"
   DefaultRadius=21.000000
   DefaultHeight=44.000000
   MaxStepHeight=26.000000
   MaxJumpHeight=49.000000
   WalkableFloorZ=0.780000
   bCanCrouch=True
   bCanSwim=True
   bCanClimbLadders=True
   bCanStrafe=True
   bCanPickupInventory=True
   bMuffledHearing=True
   bRunPhysicsWithNoController=True
   CrouchHeight=29.000000
   CrouchRadius=21.000000
   SightRadius=12000.000000
   Buoyancy=0.990000
   MeleeRange=20.000000
   GroundSpeed=440.000000
   WaterSpeed=220.000000
   AirSpeed=440.000000
   JumpZ=322.000000
   AirControl=0.350000
   WalkingPct=0.400000
   CrouchedPct=0.400000
   MaxFallSpeed=1250.000000
   AIMaxFallSpeedFactor=1.100000
   BaseEyeHeight=38.000000
   EyeHeight=38.000000
   UnderWaterTime=20.000000
   ControllerClass=Class'UTGame.UTBot'
   Begin Object Class=SkeletalMeshComponent Name=WPawnSkeletalMeshComponent ObjName=WPawnSkeletalMeshComponent Archetype=SkeletalMeshComponent'Engine.Default__SkeletalMeshComponent'
      AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
      MinDistFactorForKinematicUpdate=0.200000
      bUpdateSkelWhenNotRendered=False
      bIgnoreControllersWhenNotRendered=True
      bHasPhysicsAssetInstance=True
      bEnableFullAnimWeightBodies=True
      bOverrideAttachmentOwnerVisibility=True
      bChartDistanceFactor=True
      bCacheAnimSequenceNodes=False
      LightEnvironment=DynamicLightEnvironmentComponent'UTGame.Default__UTPawn:MyLightEnvironment'
      bOwnerNoSee=True
      bUseAsOccluder=False
      BlockRigidBody=True
      RBChannel=RBCC_Untitled3
      RBCollideWithChannels=(Untitled3=True)
      RBDominanceGroup=20
      Translation=(X=0.000000,Y=0.000000,Z=8.000000)
      Scale=1.075000
      Name="WPawnSkeletalMeshComponent"
      ObjectArchetype=SkeletalMeshComponent'Engine.Default__SkeletalMeshComponent'
   End Object
   Mesh=WPawnSkeletalMeshComponent
   Begin Object Class=CylinderComponent Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'GameFramework.Default__GamePawn:CollisionCylinder'
      CollisionHeight=44.000000
      CollisionRadius=21.000000
      ObjectArchetype=CylinderComponent'GameFramework.Default__GamePawn:CollisionCylinder'
   End Object
   CylinderComponent=CollisionCylinder
   AlwaysRelevantDistanceSquared=1960000.000000
   ViewPitchMin=-18000.000000
   ViewPitchMax=18000.000000
   InventoryManagerClass=Class'UTGame.UTInventoryManager'
   Components(0)=CollisionCylinder
   Begin Object Class=ArrowComponent Name=Arrow ObjName=Arrow Archetype=ArrowComponent'GameFramework.Default__GamePawn:Arrow'
      ObjectArchetype=ArrowComponent'GameFramework.Default__GamePawn:Arrow'
   End Object
   Components(1)=Arrow
   Components(2)=MyLightEnvironment
   Components(3)=WPawnSkeletalMeshComponent
   Components(4)=AmbientSoundComponent
   Components(5)=AmbientSoundComponent2
   bReplicateRigidBodyLocation=True
   bPhysRigidBodyOutOfWorldCheck=True
   CollisionComponent=CollisionCylinder
   MinDistForNetRBCorrection=5.000000
   Name="Default__UTPawn"
   ObjectArchetype=GamePawn'GameFramework.Default__GamePawn'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:20.000 - Creation time: sk 18-3-2018 10:01:23.492 - Created with UnCodeX