forked from ShakaUVM/CustomTF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCOUT.QC
1214 lines (1068 loc) · 30.7 KB
/
SCOUT.QC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*====================================================
SCOUT.QC
TeamFortress v2.5 29/2/97
Craig Hauser 26/3/00
======================================================
Functions for the SCOUT class and associated weaponry
======================================================*/
// Functions outside this file
// Functions inside this file
// Concussion Grenade Functions
void() ConcussionGrenadeTouch;
void() ConcussionGrenadeExplode;
void() ConcussionGrenadeTimer;
// Scanner Functions
void(float scanrange,float inAuto) TeamFortress_Scan;
void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusBounce;
entity(entity scanner, float scanrange, float enemies, float friends) T_RadiusScan;
//void(entity pl, string s1) CenterPrint;
void(entity pl, float fTime, string s1) StatusPrint;
// OfN External
//void(entity tfield, float timedisable) DisableField;
void(entity ent) MuzzleFlash;
#ifdef OLD_FLASH
//=========================================================================
// Touch Function for Flash Grenade
void() FlashGrenadeTouch =
{
// If the Flash Grenade hits a player, it just bounces off
sound (self, #CHAN_WEAPON, "weapons/bounce.wav", 1, #ATTN_NORM);
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
#ifdef NET_SERVER
#define SMOOTH_FLASH 1
#else
#define SMOOTH_FLASH 0.1
#endif
void() FlashTimer =
{
local entity te;
te = self.owner;
if (!te.is_connected) //WK Safety, now that we call this to clean up after death
return;
te.FlashTime = te.FlashTime - #SMOOTH_FLASH;
if (te.FlashTime < 4)
{
te.FlashTime = 0;
stuffcmd(te, "v_cshift 0\n");
stuffcmd(te, "r_norefresh 0;wait;echo;wait;echo;wait;echo;wait;echo\n"); //WK
// OfN- now we use the centerprint replacement
//centerprint(te,"Your eyes finally clear\n");
StatusPrint(te,2,"Your eyes finally clear\n");
return;
}
local string st;
st = ftos(te.FlashTime * 15); //WK Multiplier 10
stuffcmd(te, "v_cshift ");
stuffcmd(te, st);
stuffcmd(te, " ");
stuffcmd(te, st);
stuffcmd(te, " ");
stuffcmd(te, st);
stuffcmd(te, " ");
stuffcmd(te, st);
stuffcmd(te, "\n");
if (te.FlashTime > 15 || (te.FlashTime < 12 && te.FlashTime > 11) || (te.FlashTime < 9 && te.FlashTime > 7) || te.FlashTime < 5)
if (self.heat != 1) {
StatusPrint(te,2,"Your eyes burn\n with the pain\n of \n glowing phosphor\n \n \n");
stuffcmd(te, "r_norefresh 1;wait;echo;wait;echo;wait;echo;wait;echo\n");
self.heat = 1;
}
else
if (self.heat != 0) {
StatusPrint(te,2,"Your eyes water\n and momentarily lessen\n the \n Indescribable Pain\n \n \n");
stuffcmd(te, "r_norefresh 0;wait;echo;wait;echo;wait;echo;wait;echo\n");
self.heat = 0;
}
self.nextthink = time + #SMOOTH_FLASH;
};
//=========================================================================
// Flash Grenade explode function, for when the PRIMETIME runs out
void() FlashGrenadeExplode =
{
//local float expsize;
local entity te;//, oldself;
self.effects = self.effects | #EF_BRIGHTLIGHT;
WriteByte (#MSG_BROADCAST, #SVC_TEMPENTITY);
WriteByte (#MSG_BROADCAST, #TE_TAREXPLOSION);
WriteCoord (#MSG_BROADCAST, self.origin_x);
WriteCoord (#MSG_BROADCAST, self.origin_y);
WriteCoord (#MSG_BROADCAST, self.origin_z);
#ifdef QUAKE_WORLD
multicast (self.origin, #MULTICAST_PHS);
#endif
// Find all people in area
te = findradius(self.origin, 200);
while (te)
{
// Player?
if (te.classname == "player" && te.health > 0)
{
// Damage player and explode
deathmsg = #DMSG_GREN_FLASH;
TF_T_Damage(te, self, self.owner, 60, 0, #TF_TD_FIRE);
if (te.health > 0)
{
if (te.FlashTime == 0)
{
// create flash timer
newmis = spawn();
newmis.classname = "timer";
newmis.netname = "flashtimer";
newmis.team_no = self.owner.team_no;
newmis.owner = te;
newmis.think = FlashTimer;
newmis.nextthink = time + 1;
newmis.heat = 1;
}
te.FlashTime = 16; //WK 24 for non-owners
local string st;
st = ftos(te.FlashTime * 15);
stuffcmd(te, "v_cshift ");
stuffcmd(te, st);
stuffcmd(te, " ");
stuffcmd(te, st);
stuffcmd(te, " ");
stuffcmd(te, st);
stuffcmd(te, " ");
stuffcmd(te, st);
stuffcmd(te, "\n");
stuffcmd(te, "r_norefresh 1;wait;echo;wait;echo;wait;echo;wait;echo\n"); //WK
StatusPrint(te,2,"Your eyes burn\n with the pain\n of \n glowing phosphor\n \n \n");
}
}
te = te.chain;
}
#ifdef QUAKE_WORLD
dremove(self);
#else
BecomeExplosion();
#endif
};
#else // Psionic/Flash
//=========================================================================
// Touch Function for Psionic Grenade
void() PsionicGrenadeTouch =
{
// If the psionic Grenade hits a player, it just bounces off
sound (self, #CHAN_WEAPON, "weapons/bounce.wav", 1, #ATTN_NORM);
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
void() PsionicTimer =
{
local entity te;
te = self.owner;
if (!te.is_connected) //WK Safety, now that we call this to clean up after death
{
dremove(self);
return;
}
if (te.tfstate & #TFSTATE_PSIONIZED)
{
te.tfstate = te.tfstate - #TFSTATE_PSIONIZED;
if (te.health > 0)
{
if (te.classname == "player")
{
if (random()<0.5)
sound(te,#CHAN_VOICE,"player/gasp1.wav",1,#ATTN_NORM);
else
sound(te,#CHAN_VOICE,"player/gasp2.wav",1,#ATTN_NORM);
TeamFortress_SetSpeed(te);
sprint(te,#PRINT_HIGH,"Your psionic state is now restored\n");
}
}
}
dremove(self);
};
//=========================================================================
// Psionic Grenade explode function, for when the PRIMETIME runs out
void() PsionicGrenadeExplode =
{
local entity te, te2;
local float psionicstime;
local string desc;
if (self.netname == "special_mine")
{
psionicstime = #MINE_PSIONICS_TIME;
desc = "mine";
}
else
{
psionicstime = #PSIONICS_TIME;
desc = "grenade";
}
self.effects = self.effects | #EF_BRIGHTLIGHT;
WriteByte (#MSG_BROADCAST, #SVC_TEMPENTITY);
WriteByte (#MSG_BROADCAST, #TE_TAREXPLOSION);
WriteCoord (#MSG_BROADCAST, self.origin_x);
WriteCoord (#MSG_BROADCAST, self.origin_y);
WriteCoord (#MSG_BROADCAST, self.origin_z);
#ifdef QUAKE_WORLD
multicast (self.origin, #MULTICAST_PHS);
#endif
// TODO: explosion sound?
// Find all people/sentries in area
te = findradius(self.origin, #PSIONIC_EXPLOSIONRANGE);
while (te)
{
// Player?
if (te.classname == "player")
{
if (te.health > 0)
if (te.is_connected)
if (!(te.#runes & #RUNE_RESIS))
if (!(te.done_custom & #CUSTOM_BUILDING)) // skip ppl customizing
if (te.playerclass != #PC_UNDEFINED) // skip observers
if (te.invincible_finished <= time)
{
// report our success on hiting some1
if (te == self.owner)
sprint(self.owner,#PRINT_HIGH,"Your psionic ",desc," affects yourself!\n");
else
sprint(self.owner,#PRINT_HIGH,"Your psionic ",desc," affects ",te.netname,"!\n");
if (random()<0.5)
sound(te,#CHAN_VOICE,"player/drown1.wav",1,#ATTN_NORM);
else
sound(te,#CHAN_VOICE,"player/drown2.wav",1,#ATTN_NORM);
te2 = SpawnSprite(1,#SPRITE_ABLAST,te.origin,'0 0 0',#SPRITEMOVE_UP,0.1);
if (te2)
{
te2.effects = #EF_DIMLIGHT;
if (te.team_no == 1)
te2.effects = #EF_DIMLIGHT | #EF_BLUE;
else if (te.team_no == 2)
te2.effects = #EF_DIMLIGHT | #EF_RED;
}
MuzzleFlash(te);
if (te.tfstate & #TFSTATE_PSIONIZED) // already psionized
{
// find the timer for psionics
local entity psion;
psion = find(world,netname,"psionictimer");
while (psion != world)
{
if (psion.owner == te)
{
// reset time
psion.nextthink = time + psionicstime;
}
psion = find(psion,netname,"psionictimer");
}
sprint(te,#PRINT_HIGH,"You receive another psionic discharge!\n");
}
else // not psionized yet
{
if (!(te.job & #JOB_PSION)) { //Can't psionize a psion
// create psionic timer
newmis = spawn();
newmis.classname = "timer";
newmis.netname = "psionictimer";
newmis.team_no = self.owner.team_no;
newmis.owner = te;
newmis.think = PsionicTimer;
newmis.nextthink = time + psionicstime;
te.tfstate = te.tfstate | #TFSTATE_PSIONIZED;
te.button0 = 0;
te.button1 = 0;
te.button2 = 0;
te.fire_held_down = #FALSE;
te.heat = 0;
local entity oself;
oself = self;
self = te;
if (self.current_weapon == #WEAP_ASSAULT_CANNON && self.fire_held_down)
{
stuffcmd(self, "-attack;v_idlescale 0\n");
self.tfstate = self.tfstate - (self.tfstate & #TFSTATE_CANT_MOVE);
self.weaponframe = 0;
self.count = 1;
player_assaultcannondown1();
}
else
player_run();
self = oself;
sprint(te,#PRINT_HIGH,"Your body accepts a psionic discharge!\n");
TeamFortress_SetSpeed(te);
}
}
}
}
te = te.chain;
}
#ifdef QUAKE_WORLD
dremove(self);
#else
BecomeExplosion();
#endif
};
#endif // Psionic/Flash
//=========================================================================
// Touch function for a concussion grenade
void() ConcussionGrenadeTouch =
{
// concussion grenades bounce off other players now
sound (self, #CHAN_WEAPON, "weapons/bounce.wav", 1, #ATTN_NORM); // bounce sound
if (self.velocity == '0 0 0')
self.avelocity = '0 0 0';
};
//=========================================================================
// Concussion grenade explosion function
void() ConcussionGrenadeExplode =
{
T_RadiusBounce (self, self.owner, 240, world);
WriteByte (#MSG_BROADCAST, #SVC_TEMPENTITY);
WriteByte (#MSG_BROADCAST, #TE_EXPLOSION);
WriteCoord (#MSG_BROADCAST, self.origin_x);
WriteCoord (#MSG_BROADCAST, self.origin_y);
WriteCoord (#MSG_BROADCAST, self.origin_z);
#ifdef QUAKE_WORLD
multicast (self.origin, #MULTICAST_PHS);
dremove(self);
#else
BecomeExplosion ();
#endif
};
//=========================================================================
// Concussion grenade timer to remove idlescale
void() ConcussionGrenadeTimer =
{
local string st;
if (self.owner.invincible_finished > time)
{
stuffcmd(self.owner, "v_idlescale 0\n");
dremove(self);
return;
}
// Bubble
newmis = spawn();
setmodel (newmis, "progs/s_bubble.spr");
setorigin (newmis, self.owner.origin);
newmis.movetype = #MOVETYPE_NOCLIP;
newmis.solid = #SOLID_NOT;
newmis.velocity = '0 0 15';
newmis.nextthink = time + 0.5;
newmis.think = bubble_bob;
newmis.touch = bubble_remove;
newmis.classname = "bubble";
newmis.frame = 0;
newmis.cnt = 0;
setsize(newmis, '-8 -8 -8', '8 8 8');
self.health = self.health - #GR_CONCUSS_DEC;
// medic recovers twice as fast
// WK ...and so do thieves and gymnasts
if (self.owner.weapons_carried & #WEAP_MEDIKIT) //WK
self.health = self.health - #GR_CONCUSS_DEC;
if (self.owner.cutf_items & #CUTF_STEALTH)
self.health = self.health - #GR_CONCUSS_DEC;
if (self.owner.cutf_items & #CUTF_GYMNAST)
self.health = self.health - #GR_CONCUSS_DEC;
if (!(self.owner.tfstate & #TFSTATE_CONCUSSIONED)) //WK 8/4/7 Conc was cured
self.health = 0;
if (self.health < 0)
self.health = 0;
self.nextthink = time + #GR_CONCUSS_TIME;
st = ftos(self.health);
stuffcmd(self.owner, "v_idlescale ");
stuffcmd(self.owner, st);
stuffcmd(self.owner, "\n");
if (self.health == 0) {
self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & #TFSTATE_CONCUSSIONED); //WK 8/4/7
dremove(self);
}
};
//=========================================================================
// Handles the scanner function for Scouts
void(float scanrange,float inAuto) TeamFortress_Scan =
{
local string power;
local entity list;
local float scen, scfr;
local vector lightningvec;
// added in for the direction scanner code
local float enemy_detected;
local float any_detected;
//local vector vf, vr, e; // transformed versions of v_forward, v_right and the enemy vector
//local float res1, res2, res3; // for the vector work
//local float vf_e_angle, vr_e_angle; // results
// prevent scan impulse from triggering anything else
self.impulse = 0;
self.last_impulse = 0;
if (self.classname == "player")
{
if (!(self.tf_items & #NIT_SCANNER))
return;
// If Impulse is #TF_SCAN_ENEMY, toggle Scanning for Enemies
if (scanrange == #TF_SCAN_ENEMY)
{
if (self.tf_items_flags & #NIT_SCANNER_ENEMY)
{
sprint (self, #PRINT_HIGH, "Enemy Scanning disabled.\n");
self.tf_items_flags = self.tf_items_flags - #NIT_SCANNER_ENEMY;
return;
}
sprint (self, #PRINT_HIGH, "Enemy Scanning enabled.\n");
self.tf_items_flags = self.tf_items_flags | #NIT_SCANNER_ENEMY;
return;
}
// If Impulse is #TF_SCAN_FRIENDLY, toggle Scanning for Friendlies
if (scanrange == #TF_SCAN_FRIENDLY)
{
if (self.tf_items_flags & #NIT_SCANNER_FRIENDLY)
{
sprint (self, #PRINT_HIGH, "Friendly Scanning disabled.\n");
self.tf_items_flags = self.tf_items_flags - #NIT_SCANNER_FRIENDLY;
return;
}
sprint (self, #PRINT_HIGH, "Friendly Scanning enabled.\n");
self.tf_items_flags = self.tf_items_flags | #NIT_SCANNER_FRIENDLY;
return;
}
// If the user doesn't have as many cells as he/she specified, just
// use as many as they've got.
/* local float scancost;
scancost = ceil(scanrange / 20);
if (scancost > self.ammo_cells)
{
scanrange = self.ammo_cells * 20;
scancost = self.ammo_cells;
}
if (scanrange <= 0)
{
sprint(self, #PRINT_HIGH, "No cells.\n");
return;
}
*/
if (scanrange > #NIT_SCANNER_MAXCELL)
scanrange = #NIT_SCANNER_MAXCELL;
scen = 0;
scfr = 0;
// Set the Scanner flags
if (self.tf_items_flags & #NIT_SCANNER_ENEMY)
scen = 1;
if (self.tf_items_flags & #NIT_SCANNER_FRIENDLY)
scfr = 1;
// If no entity type is enabled, don't scan
if ((scen == 0) && (scfr == 0))
{
sprint(self, #PRINT_HIGH, "All scanner functions are disabled.\nEnable with 'scane' or 'scanf'.\n");
return;
}
// Use up cells to power the scanner
// additions:
// altered this so scanner could be more easily tested
//WK self.ammo_cells = self.ammo_cells - scancost;
scanrange = scanrange * #NIT_SCANNER_POWER;
if (!inAuto) { //WK Only sprint() if not autoscanner
sprint (self, #PRINT_HIGH, "Range: ");
power = ftos(ceil(scanrange));
sprint (self, #PRINT_HIGH, power);
sprint (self, #PRINT_HIGH, ". Scanning...\n");
}
// Get the list of entities the scanner finds
list = T_RadiusScan(self, scanrange, scen, scfr);
}
// Base Defence scanning code here
// Reset the entity counts
scen = 0;
scfr = 0;
// the vectors v_forward and v_right are required to
// 'triangulate' the enemies position
makevectors(self.v_angle);
// Walk the list
// For now, just count the entities.
// In the future, we'll display bearings :)
// additions: the future is now!
while (list)
{
if (list != self)
{
// sets the enemy_detected flag to #TRUE if not on your team, #FALSE if so
any_detected = #TRUE; // this flag is set to false if bogie is moving
// too slow to be detected (and velocity checking is on)
if (vlen(list.origin - self.origin) <= scanrange) //CH Secondary check NEEDED!!!
{
// If this scanner is a motion detector, don't record
// object that don't have the required velocity to be detected.
if (self.tf_items_flags & #NIT_SCANNER_MOVEMENT)
{
if (vlen(list.velocity) > #NIT_SCANNER_MIN_MOVEMENT)
{
/*if (list.classname == "monster_demon1" && list.health > 0) //Because they dont have teams
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
else if (list.classname == "monster_army" && list.health > 0) //Because they dont have teams
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
else if (list.classname == "monster_shambler" && list.health > 0) //Because they dont have teams
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
//- OfN -
else if (list.classname == "monster_wizard" && list.health > 0) //Because they dont have teams
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}*/
if (IsMonster(list))
{
if (list.health > 0)
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
}
else if (list.classname == "item_tfgoal" && list.owned_by > 0 && list.team_no > 0 && self.team_no > 0) //Because they use owned_by
{
if (list.owned_by == self.team_no && list.team_no != self.team_no)
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else if (list.owned_by == self.team_no && list.team_no == self.team_no)
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else if (list.owned_by != self.team_no && list.team_no == self.team_no)
{
scen = scen + 1;
enemy_detected = #TRUE;
}
else
any_detected = #FALSE;
}
else if ((list.classname == "player" || list.classname == "building_sentrygun" || list.classname == "building_tesla" || list.classname == "building_teleporter") && list.health > 0 && !(list.cutf_items & #CUTF_JAMMER))
{
if (Teammate(list, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
else
{
any_detected = #FALSE;
}
}
else
{
any_detected = #FALSE;
}
}
else
{
if (IsMonster(list))
{
if (list.health > 0)
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
}
/*if (list.classname == "monster_demon1" && list.health > 0) //Because they dont have teams
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
if (list.classname == "monster_army" && list.health > 0) //Because they dont have teams
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
if (list.classname == "monster_shambler" && list.health > 0) //Because they dont have teams
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
//- OfN -
if (list.classname == "monster_wizard" && list.health > 0) //Because they dont have teams
{
if (Teammate(list.real_owner, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}*/
else if (list.classname == "item_tfgoal" && list.owned_by > 0 && list.team_no > 0 && self.team_no > 0) //Because they use owned_by
{
if (list.owned_by == self.team_no && list.team_no != self.team_no)
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else if (list.owned_by == self.team_no && list.team_no == self.team_no)
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else if (list.owned_by != self.team_no && list.team_no == self.team_no)
{
scen = scen + 1;
enemy_detected = #TRUE;
}
else
any_detected = #FALSE;
}
else if ((list.classname == "player" || list.classname == "building_sentrygun" || list.classname == "building_tesla" || list.classname == "building_teleporter") && list.health > 0 && !(list.cutf_items & #CUTF_JAMMER))
{
if (Teammate(list, self))
{
scfr = scfr + 1;
enemy_detected = #FALSE;
}
else
{
scen = scen + 1;
enemy_detected = #TRUE;
}
}
else
{
any_detected = #FALSE;
}
}
}
else
{
any_detected = #FALSE;
}
// this displays the direction of the detected player
// using the cosine rule to find the angle
// cos theta = A.B divided by |A||B|
// it should return a value between 1 and -1
if (any_detected)
{
// Get the unit vector
lightningvec = normalize(list.origin - self.origin);
lightningvec = lightningvec * (vlen(list.origin - self.origin) / 5);
lightningvec = lightningvec + self.origin;
// Create the Lightning
msg_entity = self;
WriteByte (#MSG_ONE, #SVC_TEMPENTITY);
WriteByte (#MSG_ONE, #TE_LIGHTNING1);
WriteEntity (#MSG_ONE, self);
WriteCoord (#MSG_ONE, self.origin_x);
WriteCoord (#MSG_ONE, self.origin_y);
WriteCoord (#MSG_ONE, self.origin_z + 8);
WriteCoord (#MSG_ONE, lightningvec_x);
WriteCoord (#MSG_ONE, lightningvec_y);
WriteCoord (#MSG_ONE, lightningvec_z + 8);
self.scaned = list; //CH for the sbar
if (!inAuto)
{
self.StatusRefreshTime = time + 0.2;
self.StatusBarScreen = 5;
}
} // end if(any_detected)
}
list = list.linked_list;
}
// Display the counts
// For Base Defences, it will display the counts to all team members
if ((scen == 0) && (scfr == 0) && (!inAuto))
{
sprint (self, #PRINT_HIGH, "No blips.\n");
return;
}
// Update ammo levels
//W_SetCurrentAmmo ();
return;
};
//=========================================================================
// Acts just like T_RadiusDamage, but doesn't damage things, just pushes them away
// from the explosion at a speed relative to the distance from the explosion's origin.
void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusBounce =
{
local float points;
local entity head, te;
local vector org;
//local string st;
head = findradius(inflictor.origin, bounce+40);
while (head)
{
if (head != ignore)
{
if (head.takedamage && head.health > 0)
{
org = head.origin + (head.mins + head.maxs)*0.5;
points = 0.5*vlen (org - inflictor.origin);
if (points < 0)
points = 0;
points = bounce - points;
if (head.cutf_items & #CUTF_GYMNAST)
points = points * 2;
if (!IsBuilding(head) && points > 0)
{
// Bounce!!
head.velocity = org - inflictor.origin;
head.velocity = head.velocity * (points / 20);
if (head.classname != "player")
{
if(head.flags & #FL_ONGROUND)
head.flags = head.flags - #FL_ONGROUND;
}
else
{
if (!(head.#runes & #RUNE_RESIS))
{
//WK Add cheat immunity since they fly
makeImmune(head,time+3);
// Concuss 'em!!
// If they are already concussed, set the concussion back up
// Try to find a concusstimer entity for this player
te = find(world, classname, "timer");
while (((te.owner != head) || (te.think != ConcussionGrenadeTimer)) && (te != world))
te = find(te, classname, "timer");
if (te != world)
{
stuffcmd(head,"v_idlescale 100\n");
te.health = 100;
te.nextthink = time + #GR_CONCUSS_TIME;
}
else
{
stuffcmd(head,"v_idlescale 100\n");
stuffcmd(head,"bf\n");
head.tfstate = head.tfstate | #TFSTATE_CONCUSSIONED; //WK 8/4/7 Fixed this flag not being set
// Create a timer entity
te = spawn();
te.nextthink = time + #GR_CONCUSS_TIME;
te.think = ConcussionGrenadeTimer;
te.team_no = attacker.team_no;
te.classname = "timer";
te.owner = head;
te.health = 100;
}
}
}
}
}
}
head = head.chain;
}
};
//CH checks a player and returns True of False
float(entity scan, entity targ, float enemies, float friends) Scanner_Check_Player =
{
if (targ.playerclass == #PC_UNDEFINED) {
return #FALSE;
}
else if (targ.done_custom & #CUSTOM_BUILDING) {
return #FALSE;
}
else if (targ.health <= 0) {
return #FALSE;
}
else if (!targ.is_connected) {
return #FALSE;
}
else if (targ == scan) {
return #FALSE;
}
else if (targ.flags & #FL_NOTARGET) {
return #FALSE;
}
else if (targ.cutf_items & #CUTF_JAMMER)
return #FALSE;
//CH ALL NEW CHECKS ABOVE THIS LINE
if (teamplay)
{
if ( friends && Teammate(targ, scan) )
return #TRUE;
if ( enemies && !Teammate(targ, scan) )
return #TRUE;
}
else
return #TRUE;
return #FALSE;
};
//=========================================================================
// Returns a list of players within a radius around the origin, like findradius,
// except that some parsing of the list can be done based on the parameters passed in.
// Make sure you check that the return value is not NULL b4 using it.
entity(entity scanner, float scanrange, float enemies, float friends) T_RadiusScan =
{
local entity head;
local entity list_head;
local entity list;
local float gotatarget;
head = findradius(scanner.origin, scanrange+40);
while (head)