2 XavioR's Team Fortress Map Entities conversion
\r
5 // Things needed to be added (probably):
\r
12 .float if_item_has_moved;
\r
13 .float if_item_hasnt_moved;
\r
14 .float remove_spawnpoint;
\r
15 .float restore_spawnpoint;
\r
16 .float remove_spawngroup;
\r
17 .float restore_spawngroup;
\r
18 .float display_item_status1;
\r
19 .float display_item_status2;
\r
20 .float display_item_status3;
\r
21 .float display_item_status4;
\r
22 .string team_str_home;
\r
23 .string team_str_moved;
\r
24 .string team_str_carried;
\r
25 .string non_team_str_home;
\r
26 .string non_team_str_moved;
\r
27 .string non_team_str_carried;
\r
28 .float ex_skill_min;
\r
29 .float ex_skill_max;
\r
30 .float increase_team1;
\r
31 .float increase_team2;
\r
32 .float increase_team3;
\r
33 .float increase_team4;
\r
36 // Temp defs that need to be moved to TFDefs
\r
38 .string team_broadcast;
\r
39 .string non_team_broadcast;
\r
40 .string owners_team_broadcast;
\r
41 .string netname_broadcast;
\r
42 .string netname_team_broadcast;
\r
43 .string netname_non_team_broadcast;
\r
44 .string netname_owners_team_broadcast;
\r
46 .string non_team_drop;
\r
47 .string netname_team_drop;
\r
48 .string netname_non_team_drop;
\r
49 string team_menu_string/* = ""*/;
\r
52 float item_list_bit;
\r
54 .float dont_do_triggerwork;
\r
76 // Temp defs that need functions
\r
80 .float h_i_g, r_i_g, a_s, a_n, a_r, a_c, rv_s_h, rs_s_h, rv_gr, rs_gr, rs_g;
\r
82 .vector goal_min, goal_max;
\r
86 void(float tno, float scoretoadd) TeamFortress_TeamIncreaseScore;
\r
87 void(float all) TeamFortress_TeamShowScores;
\r
88 float() TeamFortress_TeamGetWinner;
\r
90 // Functions to handle entity placement when spawned
\r
91 void() TF_PlaceItem;
\r
92 void() TF_StartItem;
\r
93 void() TF_PlaceGoal;
\r
94 void() TF_StartGoal;
\r
96 // Spawn functions for all Map Entities
\r
97 float() CheckExistence;
\r
98 void() info_tfdetect;
\r
99 void() info_player_teamspawn;
\r
100 void() info_tfgoal;
\r
101 void() info_tfgoal_timer;
\r
102 void() item_tfgoal;
\r
104 // AutoDetection Function
\r
105 void(entity AD) ParseTFDetect;
\r
107 // Generic Functions
\r
108 entity(float ino) Finditem;
\r
109 entity(float gno) Findgoal;
\r
110 entity(float gno) Findteamspawn;
\r
111 void(entity Goal) InactivateGoal;
\r
112 void(entity Goal) RestoreGoal;
\r
113 void(entity Goal) RemoveGoal;
\r
114 float(entity Goal, entity Player, entity AP) IsAffectedBy;
\r
115 //void(entity Goal, entity Player, entity AP, float addb) Apply_Results;
\r
116 //float(entity Goal, entity AP) APMeetsCriteria;
\r
117 void(entity Goal) SetupRespawn;
\r
119 void(entity Goal, entity AP) DoGoalWork;
\r
120 void(entity Goal, entity AP) DoGroupWork;
\r
121 void(entity Item, entity AP) DoItemGroupWork;
\r
122 void(entity Goal, entity AP) DoTriggerWork;
\r
123 void(entity Goal, entity AP, float addb) DoResults;
\r
124 //void(entity Goal, entity Player) RemoveResults;
\r
127 void() tfgoal_touch;
\r
128 void() info_tfgoal_use;
\r
130 // Timer Goal Functions
\r
131 void() tfgoal_timer_tick;
\r
134 void() item_tfgoal_touch;
\r
135 void(entity Item, entity AP, entity Goal) tfgoalitem_GiveToPlayer;
\r
136 void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer;
\r
137 void() tfgoalitem_remove;
\r
138 void(entity Item) tfgoalitem_drop;
\r
139 void(entity Item) tfgoalitem_checkgoalreturn;
\r
141 void(entity Goal, entity Player, entity Item) DisplayItemStatus;
\r
143 // CTF Support Functions
\r
144 void() CTF_FlagCheck;
\r
147 void () TF_PlaceItem;
\r
148 void () TF_StartItem;
\r
149 void () TF_PlaceGoal;
\r
150 void () TF_StartGoal;
\r
151 //void () TF_PlaceCamp;
\r
152 //void () TF_StartCamp;
\r
153 void () info_tfdetect;
\r
154 //void () info_tfnocamp;
\r
155 void () info_player_teamspawn;
\r
156 void () info_tfgoal;
\r
157 void () info_tfgoal_timer;
\r
158 void () item_tfgoal;
\r
159 entity (float gno) Findgoal;
\r
160 entity (float gno) Findteamspawn;
\r
161 void (entity Goal) InactivateGoal;
\r
162 void (entity Goal) RestoreGoal;
\r
163 void (entity Goal) RemoveGoal;
\r
164 float (entity Goal,entity Player,entity AP) IsAffectedBy;
\r
165 void (entity Goal,entity Player,entity AP,float addb) Apply_Results;
\r
166 float (entity Goal,entity AP) APMeetsCriteria;
\r
167 void (entity Goal) SetupRespawn;
\r
169 void (entity Item,entity AP) DoItemGroupWork;
\r
170 void (entity Goal,entity AP) DoTriggerWork;
\r
171 void (entity Goal,entity Player) RemoveResults;
\r
172 void () info_tfgoal_use;
\r
173 void () tfgoal_timer_tick;
\r
174 void () item_tfgoal_touch;
\r
175 void () tfgoalitem_remove;
\r
176 void (entity Item) tfgoalitem_drop;
\r
177 void (entity Item) tfgoalitem_checkgoalreturn;
\r
178 void () ReturnItem;
\r
183 if ( (prematch) )// && (self.owner.items & 131072) )
\r
185 T_Damage (self.owner, self.owner, self.owner, 500);
\r
188 makevectors(self.owner.v_angle);
\r
189 setorigin(self, self.owner.origin - v_forward * 25 + '0 0 20');
\r
190 self.angles_x = self.owner.angles_z;
\r
191 self.angles_y = self.owner.angles_y + 90;
\r
192 self.angles_z = 0 - self.owner.angles_x;
\r
193 self.nextthink = time + 0.010000;
\r
194 self.think = MoveFlag;
\r
195 if (self.owner.deadflag)
\r
198 //self.movetype = 10;
\r
199 //self.velocity = '0 0 100';
\r
201 self.owner.effects = self.owner.effects - (self.owner.effects & 128);
\r
202 self.owner.effects = self.owner.effects - (self.owner.effects & 64);
\r
205 if (!(self.owner.items & 131072) && !(self.owner.items & 262144))
\r
207 self.owner.effects = self.owner.effects - (self.owner.effects & 128);
\r
208 self.owner.effects = self.owner.effects - (self.owner.effects & 64);
\r
213 void (entity Goal) UpdateAbbreviations =
\r
215 if ((Goal.has_abbreviated == 0))
\r
217 if (((Goal.g_a != 0) && (Goal.goal_activation == 0)))
\r
219 Goal.goal_activation = Goal.g_a;
\r
221 if (((Goal.g_e != 0) && (Goal.goal_effects == 0)))
\r
223 Goal.goal_effects = Goal.g_e;
\r
225 if (((Goal.g_e != 0) && (Goal.goal_effects == 0)))
\r
227 Goal.goal_effects = Goal.g_e;
\r
229 if (((Goal.h_i_g != 0) && (Goal.has_item_from_group == 0)))
\r
231 Goal.has_item_from_group = Goal.h_i_g;
\r
233 if (((Goal.hn_i_g != 0) && (Goal.hasnt_item_from_group == 0)))
\r
235 Goal.hasnt_item_from_group = Goal.hn_i_g;
\r
237 if (((Goal.r_i_g != 0) && (Goal.remove_item_group == 0)))
\r
239 Goal.remove_item_group = Goal.r_i_g;
\r
241 if (((Goal.a_s != 0) && (Goal.ammo_shells == 0)))
\r
243 Goal.ammo_shells = Goal.a_s;
\r
245 if (((Goal.a_n != 0) && (Goal.ammo_nails == 0)))
\r
247 Goal.ammo_nails = Goal.a_n;
\r
249 if (((Goal.a_r != 0) && (Goal.ammo_rockets == 0)))
\r
251 Goal.ammo_rockets = Goal.a_r;
\r
253 if (((Goal.a_c != 0) && (Goal.ammo_cells == 0)))
\r
255 Goal.ammo_cells = Goal.a_c;
\r
257 if (((Goal.rv_s_h != 0) && (Goal.remove_spawngroup == 0)))
\r
259 Goal.remove_spawngroup = Goal.rv_s_h;
\r
261 if (((Goal.rs_s_h != 0) && (Goal.restore_spawngroup == 0)))
\r
263 Goal.restore_spawngroup = Goal.rs_s_h;
\r
265 if (((Goal.rv_gr != 0) && (Goal.remove_group_no == 0)))
\r
267 Goal.remove_group_no = Goal.rv_gr;
\r
269 if (((Goal.rs_gr != 0) && (Goal.restore_group_no == 0)))
\r
271 Goal.restore_group_no = Goal.rs_gr;
\r
273 if (((Goal.rv_g != 0) && (Goal.remove_goal_no == 0)))
\r
275 Goal.remove_goal_no = Goal.rv_g;
\r
277 if (((Goal.rs_g != 0) && (Goal.restore_goal_no == 0)))
\r
279 Goal.restore_goal_no = Goal.rs_g;
\r
281 if ((Goal.t_s_h != string_null))
\r
283 Goal.team_str_home = Goal.t_s_h;
\r
285 if ((Goal.t_s_m != string_null))
\r
287 Goal.team_str_moved = Goal.t_s_m;
\r
289 if ((Goal.t_s_c != string_null))
\r
291 Goal.team_str_carried = Goal.t_s_c;
\r
293 if ((Goal.n_s_h != string_null))
\r
295 Goal.non_team_str_home = Goal.n_s_h;
\r
297 if ((Goal.n_s_m != string_null))
\r
299 Goal.non_team_str_moved = Goal.n_s_m;
\r
301 if ((Goal.n_s_c != string_null))
\r
303 Goal.non_team_str_carried = Goal.n_s_c;
\r
305 if ((Goal.b_b != string_null))
\r
307 Goal.broadcast = Goal.b_b;
\r
309 if ((Goal.b_t != string_null))
\r
311 Goal.team_broadcast = Goal.b_t;
\r
313 if ((Goal.b_n != string_null))
\r
315 Goal.non_team_broadcast = Goal.b_n;
\r
317 if ((Goal.b_o != string_null))
\r
319 Goal.owners_team_broadcast = Goal.b_o;
\r
321 if ((Goal.n_b != string_null))
\r
323 Goal.netname_broadcast = Goal.n_b;
\r
325 if ((Goal.n_t != string_null))
\r
327 Goal.netname_team_broadcast = Goal.n_t;
\r
329 if ((Goal.n_n != string_null))
\r
331 Goal.netname_non_team_broadcast = Goal.n_n;
\r
333 if ((Goal.n_o != string_null))
\r
335 Goal.netname_owners_team_broadcast = Goal.n_o;
\r
337 if ((Goal.d_t != string_null))
\r
339 Goal.team_drop = Goal.d_t;
\r
341 if ((Goal.d_n != string_null))
\r
343 Goal.non_team_drop = Goal.d_n;
\r
345 if ((Goal.d_n_t != string_null))
\r
347 Goal.netname_team_drop = Goal.d_n_t;
\r
349 if ((Goal.d_n_n != string_null))
\r
351 Goal.netname_non_team_drop = Goal.d_n_n;
\r
353 if ((flagem_checked == 0))
\r
355 if ((cvar ("temp1") & 4096))
\r
357 toggleflags = (toggleflags | 4096);
\r
359 if ((cvar ("temp1") & 8192))
\r
361 toggleflags = (toggleflags | 8192);
\r
363 flagem_checked = 1;
\r
365 if (((toggleflags & 4096) && !(toggleflags & 8192)))
\r
367 if ((((Goal.mdl == "progs/b_s_key.mdl") || (Goal.mdl == "progs/m_s_key.mdl")) || (Goal.mdl == "progs/w_s_key.mdl")))
\r
369 Goal.mdl = "progs/tf_flag.mdl";
\r
374 if ((((Goal.mdl == "progs/b_g_key.mdl") || (Goal.mdl == "progs/m_g_key.mdl")) || (Goal.mdl == "progs/w_g_key.mdl")))
\r
376 Goal.mdl = "progs/tf_flag.mdl";
\r
381 if ((toggleflags & 8192))
\r
383 if ((((Goal.mdl == "progs/b_s_key.mdl") || (Goal.mdl == "progs/m_s_key.mdl")) || (Goal.mdl == "progs/w_s_key.mdl")))
\r
385 Goal.mdl = "progs/tf_stan.mdl";
\r
390 if ((((Goal.mdl == "progs/b_g_key.mdl") || (Goal.mdl == "progs/m_g_key.mdl")) || (Goal.mdl == "progs/w_g_key.mdl")))
\r
392 Goal.mdl = "progs/tf_stan.mdl";
\r
397 if ((Goal.mdl == "progs/tf_flag.mdl"))
\r
399 Goal.mdl = "progs/tf_stan.mdl";
\r
404 Goal.has_abbreviated = 1;
\r
408 void () TF_PlaceItem =
\r
410 self.flags = 256.000000;
\r
411 self.movetype = 0.000000;
\r
412 self.velocity = '0.000000 0.000000 0.000000';
\r
413 self.oldorigin = self.origin;
\r
414 if ((self.goal_activation & 512.000000))
\r
416 self.effects = (self.effects | 8.000000);
\r
418 if ((item_list_bit == 0.000000))
\r
420 item_list_bit = 1.000000;
\r
422 self.item_list = item_list_bit;
\r
423 item_list_bit = item_list_bit * 2.000000;
\r
426 void () TF_StartItem =
\r
429 UpdateAbbreviations (self);
\r
430 self.nextthink = (time + 0.200000);
\r
431 self.think = TF_PlaceItem;
\r
432 if ((self.goal_state == 3.000000))
\r
438 void () TF_PlaceGoal =
\r
440 if ((self.classname != "info_tfgoal_timer"))
\r
442 if ((self.goal_activation & 1.000000))
\r
444 self.touch = tfgoal_touch;
\r
449 self.think = tfgoal_timer_tick;
\r
450 self.nextthink = (time + self.search_time);
\r
451 self.classname = "info_tfgoal";
\r
453 self.flags = 256.000000;
\r
454 self.movetype = 0.000000;
\r
455 self.velocity = '0.000000 0.000000 0.000000';
\r
456 self.oldorigin = self.origin;
\r
459 void () TF_StartGoal =
\r
462 UpdateAbbreviations (self);
\r
463 self.nextthink = (time + 0.200000);
\r
464 self.think = TF_PlaceGoal;
\r
465 self.use = info_tfgoal_use;
\r
466 if ((self.goal_state == 3.000000))
\r
472 float() CheckExistence =
\r
475 UpdateAbbreviations (self);
\r
476 if ((self.ex_skill_min && (skill <= self.ex_skill_min)))
\r
482 if ((self.ex_skill_max && (skill >= self.ex_skill_max)))
\r
490 /* // ORIG NETQUAKETF INFO_TFDETECT
\r
491 void () info_tfdetect =
\r
493 UpdateAbbreviations (self);
\r
497 /*void () info_tfdetect =
\r
502 UpdateAbbreviations (self);
\r
505 te = find (world,classname,"countdown");
\r
511 st = infokey (world,"time"); // Unfortunately DP Engine doesnt support this (qw funct)
\r
517 newmis.classname = "countdown";
\r
518 newmis.no_grenades_1 = 0;
\r
519 st = infokey (world,"timelimit");
\r
520 newmis.health = stof(st);
\r
521 newmis.think = review_timeleft;
\r
522 newmis.nextthink = (time + 1);
\r
525 // MESSAGE DISP CODE
\r
526 if (haltloop1 != 1)
\r
528 local string msg1timer;
\r
530 msg1timer = infokey (world, "svmsg1");
\r
531 msg1time = stof(msg1timer);
\r
535 display_message ();
\r
540 if (haltloop2 != 1)
\r
542 local string msg2timer;
\r
544 msg2timer = infokey (world, "svmsg2");
\r
545 msg2time = stof(msg2timer);
\r
549 pre_messagetimer2 ();
\r
554 if (haltloop3 != 1)
\r
556 local string msg3timer;
\r
558 msg3timer = infokey (world, "svmsg3");
\r
559 msg3time = stof(msg3timer);
\r
563 pre_messagetimer3 ();
\r
567 if (quotestart != 1) {
\r
571 // Auto Level-change fix
\r
574 /* Gold. this is the old info_tfdetect... new one is above*/
\r
575 void() info_tfdetect =
\r
577 UpdateAbbreviations(self);
\r
578 /*gold. next 6 lines are part of plexi's code for the "timeleft" command.
\r
580 newmis.classname = "countdown";
\r
581 newmis.netname = "countdown";
\r
582 newmis.no_grenades_1 = 0;
\r
583 newmis.think = review_timeleft;
\r
584 newmis.nextthink = (time + 1);*/
\r
587 void() info_player_teamspawn =
\r
590 if (CheckExistence() == 0)
\r
595 if (number_of_teams < self.team_no)
\r
597 number_of_teams = self.team_no;
\r
599 if (self.team_no <= 0)
\r
601 dprint("no team_no associated with info_player_teamspawn\n");
\r
604 if (self.items != 0)
\r
606 te = Finditem(self.items);
\r
609 dprint("info_player_teamspawn specifies a GoalItem that does not exist\n");
\r
613 if (self.team_no == 1)
\r
615 self.team_str_home = "ts1";
\r
619 if (self.team_no == 2)
\r
621 self.team_str_home = "ts2";
\r
625 if (self.team_no == 3)
\r
627 self.team_str_home = "ts3";
\r
631 if (self.team_no == 4)
\r
633 self.team_str_home = "ts4";
\r
642 self.classname = "info_player_teamspawn";
\r
643 info_player_teamspawn();
\r
646 void() info_tfgoal =
\r
648 if (CheckExistence() == 0)
\r
655 precache_model(self.mdl);
\r
656 precache_model2(self.mdl);
\r
657 setmodel(self, self.mdl);
\r
661 precache_sound(self.noise);
\r
662 precache_sound2(self.noise);
\r
666 if (self.mdl == "progs/backpack.mdl")
\r
668 precache_sound("items/backpack.wav");
\r
669 precache_sound2("items/backpack.wav");
\r
670 self.noise = "items/backpack.wav";
\r
673 precache_sound("items/protect.wav");
\r
674 precache_sound("items/protect2.wav");
\r
675 precache_sound("items/protect3.wav");
\r
676 precache_sound("items/suit.wav");
\r
677 precache_sound("items/suit2.wav");
\r
678 precache_sound("items/inv1.wav");
\r
679 precache_sound("items/inv2.wav");
\r
680 precache_sound("items/inv3.wav");
\r
681 precache_sound("items/damage.wav");
\r
682 precache_sound("items/damage2.wav");
\r
683 precache_sound("items/damage3.wav");
\r
685 if (self.goal_state == 0)
\r
687 self.goal_state = 2;
\r
689 if (self.goal_min != '0 0 0')
\r
691 setsize(self, self.goal_min, self.goal_max);
\r
695 setsize(self, '-16 -16 -24', '16 16 32');
\r
702 self.classname = "info_tfgoal";
\r
706 void() info_tfgoal_timer =
\r
708 if (CheckExistence() == 0)
\r
715 precache_model(self.mdl);
\r
716 precache_model2(self.mdl);
\r
717 setmodel(self, self.mdl);
\r
721 precache_sound(self.noise);
\r
722 precache_sound2(self.noise);
\r
724 if (self.search_time <= 0)
\r
726 dprint("Timer Goal created with no specified time.\n");
\r
730 if (self.goal_state == 0)
\r
732 self.goal_state = 2;
\r
734 setsize(self, '-16 -16 -24', '16 16 32');
\r
740 self.classname = "info_tfgoal_timer";
\r
741 info_tfgoal_timer();
\r
744 void() item_tfgoal =
\r
746 if (CheckExistence() == 0)
\r
753 precache_model(self.mdl);
\r
754 precache_model2(self.mdl);
\r
755 setmodel(self, self.mdl);
\r
760 setmodel(self, "");
\r
762 precache_sound2("items/itembk2.wav");
\r
765 precache_sound(self.noise);
\r
766 precache_sound2(self.noise);
\r
768 self.touch = item_tfgoal_touch;
\r
769 if (self.goal_state == 0)
\r
771 self.goal_state = 2;
\r
774 setorigin(self, self.origin);
\r
775 if (!(self.netname))
\r
777 self.netname = "goalitem";
\r
779 if (self.pausetime <= 0)
\r
781 self.pausetime = 60;
\r
783 if (self.delay != 0 && self.pausetime == 0)
\r
785 self.pausetime = self.delay;
\r
787 setsize(self, '-16 -16 -24', '16 16 32');
\r
791 void (entity AD) ParseTFDetect =
\r
793 if ((AD.team_broadcast != string_null))
\r
795 team_menu_string = AD.team_broadcast;
\r
797 localcmd (AD.message);
\r
798 cvar_set ("sv_maxspeed", "500");
\r
799 team1lives = AD.ammo_shells;
\r
800 team2lives = AD.ammo_nails;
\r
801 team3lives = AD.ammo_rockets;
\r
802 team4lives = AD.ammo_cells;
\r
803 if ((team1lives == 0))
\r
807 if ((team2lives == 0))
\r
811 if ((team3lives == 0))
\r
815 if ((team4lives == 0))
\r
819 /*if ((AD.hook_out == 1)) // Hook always allowed, right?
\r
823 team1maxplayers = AD.ammo_medikit;
\r
824 team2maxplayers = AD.ammo_detpack;
\r
825 team3maxplayers = AD.maxammo_medikit;
\r
826 team4maxplayers = AD.maxammo_detpack;
\r
827 if ((team1maxplayers == 0))
\r
829 team1maxplayers = 100;
\r
831 if ((team2maxplayers == 0))
\r
833 team2maxplayers = 100;
\r
835 if ((team3maxplayers == 0))
\r
837 team3maxplayers = 100;
\r
839 if ((team4maxplayers == 0))
\r
841 team4maxplayers = 100;
\r
843 illegalclasses = AD.playerclass;
\r
844 // illegalclasses = AD.class;
\r
845 illegalclasses1 = AD.maxammo_shells;
\r
846 illegalclasses2 = AD.maxammo_nails;
\r
847 illegalclasses3 = AD.maxammo_rockets;
\r
848 illegalclasses4 = AD.maxammo_cells;
\r
850 if ((illegalclasses1 == -1))
\r
852 illegalclasses1 = 0;
\r
853 civilianteams = (civilianteams | 1);
\r
855 if ((illegalclasses2 == -1))
\r
857 illegalclasses2 = 0;
\r
858 civilianteams = (civilianteams | 2);
\r
860 if ((illegalclasses3 == -1))
\r
862 illegalclasses3 = 0;
\r
863 civilianteams = (civilianteams | 4);
\r
865 if ((illegalclasses4 == -1))
\r
867 illegalclasses4 = 0;
\r
868 civilianteams = (civilianteams | 8);
\r
872 entity(float ino) Finditem =
\r
876 tg = find(world, classname, "item_tfgoal");
\r
879 if (tg.goal_no == ino)
\r
883 tg = find(tg, classname, "item_tfgoal");
\r
885 dprint("Could not find an item with a goal_no of ");
\r
892 /*entity(float gno) Findgoal = // moved to tffunctions
\r
896 tg = find(world, classname, "info_tfgoal");
\r
899 if (tg.goal_no == gno)
\r
903 tg = find(tg, classname, "info_tfgoal");
\r
905 dprint("Could not find a goal with a goal_no of ");
\r
911 entity(float gno) Findteamspawn =
\r
915 tg = find(world, classname, "info_player_teamspawn");
\r
918 if (tg.goal_no == gno)
\r
922 tg = find(tg, classname, "info_player_teamspawn");
\r
924 dprint("Could not find a Teamspawn with a goal_no of ");
\r
930 void(entity Goal) InactivateGoal =
\r
932 if (Goal.goal_state == 1)
\r
934 if (Goal.search_time == 0)
\r
938 Goal.goal_state = 2;
\r
939 if (Goal.mdl != string_null)
\r
941 setmodel(Goal, Goal.mdl);
\r
946 void(entity Goal) RestoreGoal =
\r
948 if (Goal.goal_state == 3)
\r
950 if (Goal.search_time == 0)
\r
956 Goal.nextthink = time + Goal.search_time;
\r
958 Goal.goal_state = 2;
\r
959 if (Goal.mdl != string_null)
\r
961 setmodel(Goal, Goal.mdl);
\r
966 void(entity Goal) RemoveGoal =
\r
969 Goal.goal_state = 3;
\r
970 if (Goal.mdl != string_null)
\r
972 setmodel(Goal, string_null);
\r
976 float(entity Goal, entity Player, entity AP) IsAffectedBy =
\r
979 //if (Player.playerclass == 0)
\r
980 if (Player.class == 0)
\r
984 if (Goal.goal_effects & 32)
\r
986 genv = pointcontents(Goal.origin);
\r
987 if (pointcontents(Player.origin) != genv)
\r
992 if (Goal.t_length != 0)
\r
994 if (vlen(Goal.origin - Player.origin) <= Goal.t_length)
\r
996 if (Goal.goal_effects & 16)
\r
998 traceline(Goal.origin, Player.origin, 1, Goal);
\r
999 if (trace_fraction == 1)
\r
1010 if (Goal.classname != "info_tfgoal_timer")
\r
1012 if (Goal.goal_effects & 1 && Player == AP)
\r
1016 if (Goal.goal_effects & 2 && AP.team_no == Player.team_no)
\r
1020 if (Goal.goal_effects & 4 && AP.team_no != Player.team_no)
\r
1024 if (Goal.goal_effects & 8 && Player != AP)
\r
1029 if (Goal.maxammo_shells != 0 && Player.team_no == Goal.maxammo_shells)
\r
1033 if (Goal.maxammo_nails != 0 && Player.team_no != Goal.maxammo_shells)
\r
1040 void(entity Goal, entity Player, entity AP, float addb) Apply_Results =
\r
1042 local entity oldself;
\r
1044 local entity oldte;
\r
1046 stuffcmd(Player, "bf\n");
\r
1047 if (Goal.classname == "item_tfgoal")
\r
1049 Player.item_list = Player.item_list | Goal.item_list;
\r
1053 if (Goal.count != 0)
\r
1055 if (Player.team_no > 0)
\r
1057 TeamFortress_TeamIncreaseScore(Player.team_no, Goal.count);
\r
1058 TeamFortress_TeamShowScores(2);
\r
1064 if (Player.health > 0)
\r
1066 if (Goal.health > 0)
\r
1068 T_Heal(Player, Goal.health, 0);
\r
1070 if (Goal.health < 0)
\r
1072 if (0 - Player.health > Goal.health)
\r
1074 Player.armorvalue = 0;
\r
1075 T_Damage(Player, Goal, Goal, Player.health + 1);
\r
1079 oa = Player.armorvalue;
\r
1080 Player.armorvalue = 0;
\r
1081 T_Damage(Player, Goal, Goal, 0 - Goal.health);
\r
1082 Player.armorvalue = oa;
\r
1086 if (Player.health > 0)
\r
1088 if (Goal.armortype)
\r
1091 // Player.armortype = Goal.armortype; // Armor type needs to be tweaked in this game
\r
1093 Player.armorvalue = Player.armorvalue + Goal.armorvalue;
\r
1094 if (Goal.armorclass)
\r
1096 Player.armorclass = Goal.armorclass;
\r
1098 if (Goal.gravity > 0)
\r
1100 Player.gravity = Goal.gravity;
\r
1102 Player.ammo_shells = Player.ammo_shells + Goal.ammo_shells;
\r
1103 Player.ammo_nails = Player.ammo_nails + Goal.ammo_nails;
\r
1104 Player.ammo_rockets = Player.ammo_rockets + Goal.ammo_rockets;
\r
1105 Player.ammo_cells = Player.ammo_cells + Goal.ammo_cells;
\r
1106 Player.ammo_medikit = Player.ammo_medikit + Goal.ammo_medikit;
\r
1107 Player.ammo_detpack = Player.ammo_detpack + Goal.ammo_detpack;
\r
1108 Player.no_grenades_1 = Player.no_grenades_1 + Goal.no_grenades_1;
\r
1109 Player.no_grenades_2 = Player.no_grenades_2 + Goal.no_grenades_2;
\r
1110 if (Player.no_grenades_1 > 4)
\r
1112 Player.no_grenades_1 = 4;
\r
1114 if (Player.no_grenades_2 > 4)
\r
1116 Player.no_grenades_2 = 4;
\r
1118 if (Player.ammo_detpack > Player.maxammo_detpack)
\r
1120 Player.ammo_detpack = Player.maxammo_detpack;
\r
1122 if (Goal.invincible_finished > 0)
\r
1124 Player.items = Player.items | 1048576;
\r
1125 Player.invincible_time = 1;
\r
1126 Player.invincible_finished = time + Goal.invincible_finished;
\r
1127 if (Goal.classname == "item_tfgoal")
\r
1129 Player.tfstate = Player.tfstate | 32;
\r
1130 Player.invincible_finished = time + 666;
\r
1133 /*if (Goal.invisible_finished > 0) // NexTF doesnt support invisibility?
\r
1135 Player.items = Player.items | 524288;
\r
1136 Player.invisible_time = 1;
\r
1137 Player.invisible_finished = time + Goal.invisible_finished;
\r
1138 if (Goal.classname == "item_tfgoal")
\r
1140 Player.tfstate = Player.tfstate | 64;
\r
1141 Player.invisible_finished = time + 666;
\r
1144 if (Goal.super_damage_finished > 0)
\r
1146 Player.items = Player.items | 4194304;
\r
1147 Player.super_time = 1;
\r
1148 Player.super_damage_finished = time + Goal.super_damage_finished;
\r
1149 if (Goal.classname == "item_tfgoal")
\r
1151 Player.tfstate = Player.tfstate | 128;
\r
1152 Player.super_damage_finished = time + 666;
\r
1155 if (Goal.radsuit_finished > 0)
\r
1157 Player.items = Player.items | 2097152;
\r
1158 Player.rad_time = 1;
\r
1159 Player.radsuit_finished = time + Goal.radsuit_finished;
\r
1160 if (Goal.classname == "item_tfgoal")
\r
1162 Player.tfstate = Player.tfstate | 256;
\r
1163 Player.radsuit_finished = time + 666;
\r
1167 Player.lives = Player.lives + Goal.lives;
\r
1168 Player.real_frags = /*Player.real_frags + */Goal.frags + Player.frags; // Fixed?
\r
1169 if (!(toggleflags & 128))
\r
1171 Player.frags = Player.real_frags;
\r
1176 TeamFortress_CheckClassStats();
\r
1177 //W_SetCurrentAmmo(); // This is automatic in nexuiz right?
\r
1180 //if (Player.playerclass == 8 && (Goal.goal_result & 16)) // In nextf, spy class is "2"
\r
1181 if (Player.class == 2 && (Goal.goal_result & 16))
\r
1183 self.immune_to_check = time + 4;
\r
1184 //Spy_RemoveDisguise(Player); // Wazat -- help [incomplete]
\r
1186 if (Goal.items != 0 && Goal.classname != "item_tfgoal")
\r
1188 te = Finditem(Goal.items);
\r
1191 tfgoalitem_GiveToPlayer(te, Player, Goal);
\r
1194 if (Goal.axhitme != 0)
\r
1196 te = Finditem(Goal.axhitme);
\r
1197 if (te.owner == Player)
\r
1199 tfgoalitem_RemoveFromPlayer(te, Player, 1);
\r
1202 if (Goal.remove_item_group != 0)
\r
1204 te = find(world, classname, "item_tfgoal");
\r
1207 if (te.group_no == Goal.remove_item_group && te.owner == AP)
\r
1210 te = find(te, classname, "item_tfgoal");
\r
1211 tfgoalitem_RemoveFromPlayer(oldte, Player, 1);
\r
1215 te = find(te, classname, "item_tfgoal");
\r
1219 if (Goal.display_item_status1 != 0)
\r
1221 te = Finditem(Goal.display_item_status1);
\r
1224 DisplayItemStatus(Goal, Player, te);
\r
1228 sprint(Player,"Item is missing.\n");
\r
1231 if (Goal.display_item_status2 != 0)
\r
1233 te = Finditem(Goal.display_item_status2);
\r
1236 DisplayItemStatus(Goal, Player, te);
\r
1240 sprint(Player,"Item is missing.\n");
\r
1243 if (Goal.display_item_status3 != 0)
\r
1245 te = Finditem(Goal.display_item_status3);
\r
1248 DisplayItemStatus(Goal, Player, te);
\r
1252 sprint(Player,"Item is missing.\n");
\r
1255 if (Goal.display_item_status4 != 0)
\r
1257 te = Finditem(Goal.display_item_status4);
\r
1260 DisplayItemStatus(Goal, Player, te);
\r
1264 sprint(Player,"Item is missing.\n");
\r
1267 /*if (Player.autodiscard) //Not a function in NexTF
\r
1271 TeamFortress_Discard ();
\r
1276 void(entity Goal, entity Player) RemoveResults =
\r
1278 local entity oldself;
\r
1280 local float puinvin;
\r
1281 local float puinvis;
\r
1282 local float puquad;
\r
1283 local float purad;
\r
1284 if (Goal.classname == "item_tfgoal")
\r
1286 if (!(Player.item_list & Goal.item_list))
\r
1290 if (Goal.goal_activation & 1024)
\r
1294 Player.item_list = Player.item_list - (Player.item_list & Goal.item_list);
\r
1296 if (Goal.health > 0)
\r
1298 TF_T_Damage(Player, Goal, Goal, Goal.health, 1, 0);
\r
1300 if (Goal.health < 0)
\r
1302 T_Heal(Player, 0 - Goal.health, 0);
\r
1304 Player.lives = Player.lives - Goal.lives;
\r
1305 Player.armortype = Player.armortype - Goal.armortype;
\r
1306 Player.armorvalue = Player.armorvalue - Goal.armorvalue;
\r
1307 Player.armorclass = Player.armorclass - (Player.armorclass & Goal.armorclass);
\r
1308 Player.real_frags = Player.real_frags - Goal.frags;
\r
1309 if (!(toggleflags & 128))
\r
1311 Player.frags = Player.real_frags;
\r
1313 Player.ammo_shells = Player.ammo_shells - Goal.ammo_shells;
\r
1314 Player.ammo_nails = Player.ammo_nails - Goal.ammo_nails;
\r
1315 Player.ammo_rockets = Player.ammo_rockets - Goal.ammo_rockets;
\r
1316 Player.ammo_cells = Player.ammo_cells - Goal.ammo_cells;
\r
1317 Player.ammo_medikit = Player.ammo_medikit - Goal.ammo_medikit;
\r
1318 Player.ammo_detpack = Player.ammo_detpack - Goal.ammo_detpack;
\r
1319 Player.no_grenades_1 = Player.no_grenades_1 - Goal.no_grenades_1;
\r
1320 Player.no_grenades_2 = Player.no_grenades_2 - Goal.no_grenades_2;
\r
1325 te = find(world, classname, "item_tfgoal");
\r
1328 if (te.owner == Player && te != Goal)
\r
1330 if (te.invincible_finished > 0)
\r
1334 if (te.invisible_finished > 0)
\r
1338 if (te.super_damage_finished > 0)
\r
1342 if (te.radsuit_finished > 0)
\r
1347 te = find(te, classname, "item_tfgoal");
\r
1349 if (Goal.invincible_finished > 0 && !puinvin)
\r
1351 Player.tfstate = Player.tfstate - (Player.tfstate & 32);
\r
1352 Player.items = Player.items | 1048576;
\r
1353 Player.invincible_time = 1;
\r
1354 Player.invincible_finished = time + Goal.invincible_finished;
\r
1356 if (Goal.invisible_finished > 0 && !puinvis)
\r
1358 Player.tfstate = Player.tfstate - (Player.tfstate & 64);
\r
1359 Player.items = Player.items | 524288;
\r
1360 Player.invisible_time = 1;
\r
1361 Player.invisible_finished = time + Goal.invisible_finished;
\r
1363 if (Goal.super_damage_finished > 0 && !puquad)
\r
1365 Player.tfstate = Player.tfstate - (Player.tfstate & 128);
\r
1366 Player.items = Player.items | 4194304;
\r
1367 Player.super_time = 1;
\r
1368 Player.super_damage_finished = time + Goal.super_damage_finished;
\r
1370 if (Goal.radsuit_finished > 0 && !purad)
\r
1372 Player.tfstate = Player.tfstate - (Player.tfstate & 256);
\r
1373 Player.items = Player.items | 2097152;
\r
1374 Player.rad_time = 1;
\r
1375 Player.radsuit_finished = time + Goal.radsuit_finished;
\r
1379 TeamFortress_CheckClassStats();
\r
1380 //W_SetCurrentAmmo(); // automatic in nexuiz?
\r
1384 float(entity Goal, entity AP) APMeetsCriteria =
\r
1386 local float gotone;
\r
1392 if (Goal.team_no != AP.team_no)
\r
1397 if (Goal.playerclass)
\r
1399 if (Goal.playerclass != AP.playerclass)
\r
1406 if (Goal.class != AP.class)
\r
1411 if (Goal.items_allowed)
\r
1413 te = Finditem(Goal.items_allowed);
\r
1414 if (te.owner != AP)
\r
1420 if (Goal.if_goal_is_active)
\r
1422 te = Findgoal(Goal.if_goal_is_active);
\r
1423 if (te.goal_state != 1)
\r
1428 if (Goal.if_goal_is_inactive)
\r
1430 te = Findgoal(Goal.if_goal_is_inactive);
\r
1431 if (te.goal_state != 2)
\r
1436 if (Goal.if_goal_is_removed)
\r
1438 te = Findgoal(Goal.if_goal_is_removed);
\r
1439 if (te.goal_state != 3)
\r
1444 if (Goal.if_group_is_active)
\r
1446 te = find(world, classname, "info_tfgoal");
\r
1449 if (te.group_no == Goal.if_group_is_active)
\r
1451 if (te.goal_state != 1)
\r
1456 te = find(te, classname, "info_tfgoal");
\r
1459 if (Goal.if_group_is_inactive)
\r
1461 te = find(world, classname, "info_tfgoal");
\r
1464 if (te.group_no == Goal.if_group_is_inactive)
\r
1466 if (te.goal_state != 2)
\r
1471 te = find(te, classname, "info_tfgoal");
\r
1474 if (Goal.if_group_is_removed)
\r
1476 te = find(world, classname, "info_tfgoal");
\r
1479 if (te.group_no == Goal.if_group_is_removed)
\r
1481 if (te.goal_state != 3)
\r
1486 te = find(te, classname, "info_tfgoal");
\r
1489 if (Goal.if_item_has_moved)
\r
1491 te = Finditem(Goal.if_item_has_moved);
\r
1494 if (te.goal_state != 1 && te.origin == te.oldorigin)
\r
1500 if (Goal.if_item_hasnt_moved)
\r
1502 te = Finditem(Goal.if_item_hasnt_moved);
\r
1505 if (te.goal_state == 1 || te.origin != te.oldorigin)
\r
1514 if (Goal.has_item_from_group)
\r
1516 te = find(world, classname, "item_tfgoal");
\r
1517 while (te != world && !gotone)
\r
1519 if (te.group_no == Goal.has_item_from_group && te.owner == AP)
\r
1523 te = find(te, classname, "item_tfgoal");
\r
1534 void(entity Goal) SetupRespawn =
\r
1536 if (Goal.search_time != 0)
\r
1538 InactivateGoal(Goal);
\r
1539 Goal.think = tfgoal_timer_tick;
\r
1540 Goal.nextthink = time + Goal.search_time;
\r
1543 if (Goal.goal_result & 1)
\r
1548 if (Goal.wait > 0)
\r
1550 Goal.nextthink = time + Goal.wait;
\r
1551 Goal.think = DoRespawn;
\r
1556 if (Goal.wait == -1)
\r
1561 InactivateGoal(Goal);
\r
1564 void() DoRespawn =
\r
1566 RestoreGoal(self);
\r
1567 InactivateGoal(self);
\r
1570 float(entity Goal, entity AP) Activated =
\r
1572 local float APMet;
\r
1573 local float RevAct;
\r
1575 if (Goal.goal_state == 1)
\r
1579 if (Goal.goal_state == 3)
\r
1583 if (Goal.goal_state == 4)
\r
1587 APMet = APMeetsCriteria(Goal, AP);
\r
1588 if (Goal.classname == "item_tfgoal")
\r
1590 RevAct = Goal.goal_activation & 64;
\r
1594 RevAct = Goal.goal_activation & 4;
\r
1614 void(entity Goal, entity AP) DoGoalWork =
\r
1618 if (Goal.activate_goal_no != 0)
\r
1620 te = Findgoal(Goal.activate_goal_no);
\r
1623 AttemptToActivate(te, AP, Goal);
\r
1626 if (Goal.inactivate_goal_no != 0)
\r
1628 te = Findgoal(Goal.inactivate_goal_no);
\r
1631 InactivateGoal(te);
\r
1634 if (Goal.restore_goal_no != 0)
\r
1636 te = Findgoal(Goal.restore_goal_no);
\r
1642 if (Goal.remove_goal_no != 0)
\r
1644 te = Findgoal(Goal.remove_goal_no);
\r
1650 if (Goal.return_item_no != 0)
\r
1652 te = Finditem(Goal.return_item_no);
\r
1655 if (te.goal_state == 1)
\r
1657 tfgoalitem_RemoveFromPlayer(te, te.owner, 1);
\r
1661 RI.think = ReturnItem;
\r
1662 RI.nextthink = time + 0.1;
\r
1666 if (Goal.remove_spawnpoint != 0)
\r
1668 te = Findteamspawn(Goal.remove_spawnpoint);
\r
1671 te.goal_state = 3;
\r
1672 te.team_str_home = string_null;
\r
1675 if (Goal.restore_spawnpoint != 0)
\r
1677 te = Findteamspawn(Goal.restore_spawnpoint);
\r
1680 if (te.goal_state == 3)
\r
1682 te.goal_state = 2;
\r
1683 if (te.team_no == 1)
\r
1685 te.team_str_home = "ts1";
\r
1689 if (te.team_no == 2)
\r
1691 te.team_str_home = "ts2";
\r
1695 if (te.team_no == 3)
\r
1697 te.team_str_home = "ts3";
\r
1701 if (te.team_no == 4)
\r
1703 te.team_str_home = "ts4";
\r
1713 void(entity Goal, entity AP) DoGroupWork =
\r
1717 local float allset;
\r
1718 if (Goal.all_active != 0)
\r
1720 if (Goal.last_impulse == 0)
\r
1723 st = ftos(Goal.goal_no);
\r
1725 dprint(" has a .all_active specified, but no .last_impulse\n");
\r
1730 tg = find(world, classname, "info_tfgoal");
\r
1733 if (tg.group_no == Goal.all_active)
\r
1735 if (tg.goal_state != 1)
\r
1740 tg = find(tg, classname, "info_tfgoal");
\r
1744 tg = Findgoal(Goal.last_impulse);
\r
1747 DoResults(tg, AP, Goal.goal_result & 2);
\r
1752 if (Goal.activate_group_no != 0)
\r
1754 tg = find(world, classname, "info_tfgoal");
\r
1757 if (tg.group_no == Goal.activate_group_no)
\r
1759 DoResults(tg, AP, 0);
\r
1761 tg = find(tg, classname, "info_tfgoal");
\r
1764 if (Goal.inactivate_group_no != 0)
\r
1766 tg = find(world, classname, "info_tfgoal");
\r
1769 if (tg.group_no == Goal.inactivate_group_no)
\r
1771 InactivateGoal(tg);
\r
1773 tg = find(tg, classname, "info_tfgoal");
\r
1776 if (Goal.remove_group_no != 0)
\r
1778 tg = find(world, classname, "info_tfgoal");
\r
1781 if (tg.group_no == Goal.remove_group_no)
\r
1785 tg = find(tg, classname, "info_tfgoal");
\r
1788 if (Goal.restore_group_no != 0)
\r
1790 tg = find(world, classname, "info_tfgoal");
\r
1793 if (tg.group_no == Goal.restore_group_no)
\r
1797 tg = find(tg, classname, "info_tfgoal");
\r
1800 if (Goal.remove_spawngroup != 0)
\r
1802 tg = find(world, classname, "info_player_teamspawn");
\r
1805 if (tg.group_no == Goal.remove_spawngroup)
\r
1807 tg.goal_state = 3;
\r
1808 tg.team_str_home = string_null;
\r
1810 tg = find(tg, classname, "info_player_teamspawn");
\r
1813 if (Goal.restore_spawngroup != 0)
\r
1815 tg = find(world, classname, "info_player_teamspawn");
\r
1818 if (tg.group_no == Goal.restore_spawngroup)
\r
1820 tg.goal_state = 2;
\r
1821 if (tg.team_no == 1)
\r
1823 tg.team_str_home = "ts1";
\r
1827 if (tg.team_no == 2)
\r
1829 tg.team_str_home = "ts2";
\r
1833 if (tg.team_no == 3)
\r
1835 tg.team_str_home = "ts3";
\r
1839 if (tg.team_no == 4)
\r
1841 tg.team_str_home = "ts4";
\r
1847 tg = find(tg, classname, "info_player_teamspawn");
\r
1852 void(entity Item, entity AP) DoItemGroupWork =
\r
1855 local entity carrier;
\r
1856 local float allcarried;
\r
1859 if (Item.distance != 0)
\r
1861 if (Item.pain_finished == 0)
\r
1863 dprint("GoalItem ");
\r
1864 st = ftos(Item.goal_no);
\r
1866 dprint(" has a .distance specified, but no .pain_finished\n");
\r
1868 tg = find(world, classname, "item_tfgoal");
\r
1871 if (tg.group_no == Item.distance)
\r
1873 if (tg.goal_state != 1)
\r
1878 tg = find(tg, classname, "item_tfgoal");
\r
1880 if (allcarried == 1)
\r
1882 tg = Findgoal(Item.pain_finished);
\r
1885 DoResults(tg, AP, Item.goal_result & 2);
\r
1890 if (Item.speed != 0)
\r
1892 if (Item.attack_finished == 0)
\r
1894 dprint("GoalItem ");
\r
1895 st = ftos(Item.goal_no);
\r
1897 dprint(" has a .speed specified, but no .attack_finished\n");
\r
1900 tg = find(world, classname, "item_tfgoal");
\r
1903 if (tg.group_no == Item.speed)
\r
1905 if (tg.goal_state != 1)
\r
1911 if (carrier == world)
\r
1913 carrier = tg.owner;
\r
1917 if (carrier != tg.owner)
\r
1924 tg = find(tg, classname, "item_tfgoal");
\r
1926 if (allcarried == 1)
\r
1928 tg = Findgoal(Item.attack_finished);
\r
1931 DoResults(tg, AP, Item.goal_result & 2);
\r
1937 void(entity Goal, entity AP) DoTriggerWork =
\r
1940 if (Goal.killtarget)
\r
1945 t = find(t, targetname, Goal.killtarget);
\r
1950 } while (t != world);
\r
1958 t = find(t, targetname, Goal.target);
\r
1967 if (self.use != SUB_Null)
\r
1977 } while (t != world);
\r
1981 void() DelayedResult =
\r
1983 if (self.enemy.goal_state == 4)
\r
1985 DoResults(self.enemy, self.owner, self.weapon);
\r
1990 void(entity Goal, entity AP, float addb) DoResults =
\r
1994 local float winners;
\r
1996 if (Goal.goal_state == 1)
\r
2000 if (Goal.delay_time > 0 && Goal.goal_state != 4)
\r
2002 Goal.goal_state = 4;
\r
2004 te.think = DelayedResult;
\r
2005 te.nextthink = time + Goal.delay_time;
\r
2011 UpdateAbbreviations(Goal);
\r
2012 Goal.goal_state = 2;
\r
2015 if (Goal.volume == 1)
\r
2017 sound(other, 3, Goal.noise, 1, 0);
\r
2021 sound(other, 3, Goal.noise, 1, 1);
\r
2025 if (Goal.increase_team1 != 0)
\r
2027 TeamFortress_TeamIncreaseScore(1, Goal.increase_team1);
\r
2030 if (Goal.increase_team2 != 0)
\r
2032 TeamFortress_TeamIncreaseScore(2, Goal.increase_team2);
\r
2035 if (Goal.increase_team3 != 0)
\r
2037 TeamFortress_TeamIncreaseScore(3, Goal.increase_team3);
\r
2040 if (Goal.increase_team4 != 0)
\r
2042 TeamFortress_TeamIncreaseScore(4, Goal.increase_team4);
\r
2047 TeamFortress_TeamShowScores(2);
\r
2049 te = find(world, classname, "player");
\r
2050 while (te != world)
\r
2052 if (Goal.broadcast != string_null && CTF_Map == 0)
\r
2054 CenterPrint2(te, "\n\n\n", Goal.broadcast);
\r
2056 if (Goal.netname_broadcast != string_null && CTF_Map == 0)
\r
2058 sprint(te,AP.netname);
\r
2059 sprint(te,Goal.netname_broadcast);
\r
2063 if (Goal.message != string_null)
\r
2065 CenterPrint2(te, Goal.message, AP.netname);
\r
2070 if (AP.team_no == te.team_no)
\r
2072 if (Goal.owners_team_broadcast != string_null && te.team_no == Goal.owned_by)
\r
2074 CenterPrint2(te, Goal.owners_team_broadcast, AP.netname);
\r
2078 if (Goal.team_broadcast != string_null)
\r
2080 CenterPrint2(te, Goal.team_broadcast, AP.netname);
\r
2083 if (Goal.netname_owners_team_broadcast != string_null && te.team_no == Goal.owned_by)
\r
2085 sprint(te,AP.netname);
\r
2086 sprint(te,Goal.netname_owners_team_broadcast);
\r
2090 if (Goal.netname_team_broadcast != string_null)
\r
2092 sprint(te,AP.netname);
\r
2093 sprint(te,Goal.netname_team_broadcast);
\r
2099 if (Goal.owners_team_broadcast != string_null && te.team_no == Goal.owned_by)
\r
2101 CenterPrint2(te, Goal.owners_team_broadcast, AP.netname);
\r
2105 if (Goal.non_team_broadcast != string_null)
\r
2107 CenterPrint2(te, Goal.non_team_broadcast, AP.netname);
\r
2110 if (Goal.netname_owners_team_broadcast != string_null && te.team_no == Goal.owned_by)
\r
2112 sprint(te,AP.netname);
\r
2113 sprint(te,Goal.netname_owners_team_broadcast);
\r
2117 if (Goal.netname_non_team_broadcast != string_null)
\r
2119 sprint(te,AP.netname);
\r
2120 sprint(te,Goal.netname_non_team_broadcast);
\r
2125 if (IsAffectedBy(Goal, te, AP))
\r
2127 if (Goal.search_time != 0 && (Goal.goal_effects & 64))
\r
2129 if (APMeetsCriteria(Goal, te))
\r
2131 Apply_Results(Goal, te, AP, addb);
\r
2136 Apply_Results(Goal, te, AP, addb);
\r
2139 te = find(te, classname, "player");
\r
2141 if (Goal.classname != "item_tfgoal")
\r
2143 Goal.goal_state = 1;
\r
2145 if (Goal.goal_result & 4)
\r
2147 TeamFortress_TeamShowScores(1);
\r
2148 winners = TeamFortress_TeamGetWinner();
\r
2149 te = find(world, classname, "player");
\r
2152 te.takedamage = 0;
\r
2154 te.velocity = '0 0 0';
\r
2155 te.avelocity = '0 0 0';
\r
2156 te = find(te, classname, "player");
\r
2159 te.nextthink = time + 5;
\r
2160 te.think = execute_changelevel;
\r
2161 // te.think = changelevel; // Wazat -- may need fixing
\r
2166 DoGroupWork(Goal, AP);
\r
2167 DoGoalWork(Goal, AP);
\r
2168 DoTriggerWork(Goal, AP);
\r
2169 if (Goal.classname == "info_tfgoal")
\r
2171 SetupRespawn(Goal);
\r
2175 void() tfgoal_touch =
\r
2177 if (!(self.goal_activation & 1))
\r
2181 if (other.classname != "player")
\r
2185 if (other.is_dead == 1) // TEMP
\r
2189 if (self.goal_state == 1)
\r
2193 AttemptToActivate(self, other, self);
\r
2196 void() info_tfgoal_use =
\r
2198 AttemptToActivate(self, activator, self);
\r
2201 void() tfgoal_timer_tick =
\r
2203 if (self.goal_state != 3)
\r
2205 if (APMeetsCriteria(self, world))
\r
2207 DoResults(self, world, 1);
\r
2211 InactivateGoal(self);
\r
2212 self.think = tfgoal_timer_tick;
\r
2213 self.nextthink = time + self.search_time;
\r
2218 void() item_tfgoal_touch =
\r
2221 if (other.is_dead == 1) // TEMP
\r
2225 if (other.classname != "player")
\r
2229 if (other.health <= 0)
\r
2233 // for flag dropping
\r
2234 if ( (self.tent == other) && (time < self.option5) )
\r
2238 if (Activated(self, other))
\r
2240 tfgoalitem_GiveToPlayer(self, other, self);
\r
2241 self.goal_state = 1;
\r
2245 if (self.else_goal != 0)
\r
2247 te = Findgoal(self.else_goal);
\r
2250 AttemptToActivate(te, other, self);
\r
2256 void(entity Item, entity AP, entity Goal) tfgoalitem_GiveToPlayer =
\r
2259 if (Item.mdl != string_null)
\r
2261 setmodel(Item, string_null);
\r
2264 if (Item.goal_activation & 1)
\r
2266 AP.effects = AP.effects | 8;
\r
2268 if (Item.goal_activation & 2)
\r
2270 TeamFortress_SetSpeed(AP);
\r
2272 if (Item.goal_activation & 512)
\r
2274 Item.effects = Item.effects - (Item.effects | 8);
\r
2277 if (Item.items & 133701)
\r
2279 AP.items = AP.items | 262144;
\r
2280 if (Item.team_no == 1)
\r
2281 AP.effects = AP.effects | EF_BLUE;
\r
2282 else if (Item.team_no == 2)
\r
2283 AP.effects = AP.effects | EF_RED;
\r
2285 AP.effects = AP.effects | 128;
\r
2287 newmis.owner = AP;
\r
2288 newmis.movetype = 4;
\r
2290 setsize(newmis, '0 0 0', '0 0 0');
\r
2291 newmis.angles = AP.angles;
\r
2292 newmis.nextthink = time + 0.5;
\r
2293 newmis.think = MoveFlag;
\r
2295 setmodel(newmis, Item.mdl);
\r
2296 setorigin(newmis, AP.origin);
\r
2299 if (Item.items & 131072)
\r
2301 AP.items = AP.items | 131072;
\r
2302 AP.effects = AP.effects | 64;
\r
2304 newmis.owner = AP;
\r
2305 newmis.movetype = 4;
\r
2307 setsize(newmis, '0 0 0', '0 0 0');
\r
2308 newmis.angles = AP.angles;
\r
2309 newmis.nextthink = time + 0.5;
\r
2310 newmis.think = MoveFlag;
\r
2312 setmodel(newmis, "progs/tf_flag.mdl");
\r
2313 setorigin(newmis, AP.origin);
\r
2315 if (Item.items & 262144)
\r
2317 AP.items = AP.items | 262144;
\r
2318 AP.effects = AP.effects | 128;
\r
2320 newmis.owner = AP;
\r
2321 newmis.movetype = 4;
\r
2323 setsize(newmis, '0 0 0', '0 0 0');
\r
2324 newmis.angles = AP.angles;
\r
2325 newmis.nextthink = time + 0.5;
\r
2326 newmis.think = MoveFlag;
\r
2328 setmodel(newmis, "progs/tf_flag.mdl");
\r
2329 setorigin(newmis, AP.origin);
\r
2334 if (Goal.goal_result & 8)
\r
2336 Item.goal_state = 1;
\r
2340 /* if (AP.playerclass == 8 && (Item.goal_result & 16))
\r
2342 AP.is_unabletospy = 1;
\r
2344 if (AP.class == 2 && (Item.goal_result & 16))
\r
2346 AP.is_unabletospy = 1;
\r
2348 DoResults(Item, AP, 1);
\r
2349 DoItemGroupWork(Item, AP);
\r
2352 void() ReturnItem =
\r
2354 self.enemy.goal_state = 2;
\r
2355 self.enemy.solid = 1;
\r
2356 self.enemy.movetype = 0;
\r
2357 self.enemy.touch = item_tfgoal_touch;
\r
2358 self.enemy.origin = self.enemy.oldorigin;
\r
2359 if (self.enemy.mdl != string_null)
\r
2361 setmodel(self.enemy, self.enemy.mdl);
\r
2363 setorigin(self.enemy, self.enemy.origin);
\r
2364 //sound(self.enemy,"items/itembk2.wav", 1, 1);
\r
2365 sound (self.enemy, 2, "items/itembk2.wav", 1, 1);
\r
2366 tfgoalitem_checkgoalreturn(self.enemy);
\r
2370 void (entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer =
\r
2373 local float lighton;
\r
2374 local float slowon;
\r
2375 local float key1on;
\r
2376 local float key2on;
\r
2377 local float spyoff;
\r
2378 local entity DelayReturn;
\r
2380 if ((Item == world))
\r
2382 objerror ("error: tfgoalitem_RemoveFromPlayer(): Item == world");
\r
2390 te = find (world, classname, "item_tfgoal");
\r
2393 if (((te.owner == AP) && (te != Item)))
\r
2395 if ((te.goal_activation & 1))
\r
2399 if ((te.goal_activation & 2))
\r
2403 if ((te.items & 131072))
\r
2407 if ((te.items & 262144))
\r
2411 if ((te.goal_result & 16))
\r
2416 te = find (te, classname, "item_tfgoal");
\r
2420 if ((AP.invincible_finished > (time + 3)))
\r
2426 if ((AP.super_damage_finished > (time + 3)))
\r
2434 AP.effects = (AP.effects - (AP.effects & 8));
\r
2435 AP.effects = (AP.effects - (AP.effects & 64));
\r
2436 AP.effects = (AP.effects - (AP.effects & 128));
\r
2438 if ((Item.goal_activation & 512))
\r
2440 Item.effects = (Item.effects | 8);
\r
2444 AP.is_unabletospy = 0;
\r
2448 AP.items = (AP.items - (AP.items & 131072));
\r
2452 AP.items = (AP.items - (AP.items & 262144));
\r
2454 te = find (world, classname, "player");
\r
2455 while ((te != world))
\r
2457 if (IsAffectedBy (Item, te, AP))
\r
2459 RemoveResults (Item, te);
\r
2461 te = find (te, classname, "player");
\r
2463 if (((method == 0) || (method == 2)))
\r
2465 te = find (world, classname, "player");
\r
2466 while ((te != world))
\r
2468 if ((te.team_no == Item.owned_by))
\r
2470 if ((Item.team_drop != string_null))
\r
2472 CenterPrint2 (te, "\n\n\n", Item.team_drop);
\r
2474 if ((Item.netname_team_drop != string_null))
\r
2476 sprint (te, AP.netname);
\r
2477 sprint (te, Item.netname_team_drop);
\r
2482 if ((Item.non_team_drop != string_null))
\r
2484 CenterPrint2 (te, "\n\n\n", Item.non_team_drop);
\r
2486 if ((Item.netname_non_team_drop != string_null))
\r
2488 sprint (te, AP.netname);
\r
2489 sprint (te, Item.netname_non_team_drop);
\r
2492 te = find (te, classname, "player");
\r
2494 if ((Item.goal_activation & 8))
\r
2496 DelayReturn = spawn ();
\r
2497 DelayReturn.enemy = Item;
\r
2498 if ((method == 0))
\r
2500 DelayReturn.weapon = 0;
\r
2504 DelayReturn.weapon = 1;
\r
2506 DelayReturn.think = ReturnItem;
\r
2507 DelayReturn.nextthink = (time + 0.5);
\r
2511 if ((Item.goal_activation & 4))
\r
2513 if (((method == 2) && (Item.goal_activation & 4096)))
\r
2515 tfgoalitem_drop (Item, 1, AP);
\r
2519 tfgoalitem_drop (Item, 0, AP);
\r
2524 Item.owner = world;
\r
2526 TeamFortress_SetSpeed (AP);
\r
2530 Item.owner = world;
\r
2531 Item.flags = (Item.flags - (Item.flags & 512));
\r
2532 setsize (Item, Item.goal_min, Item.goal_max);
\r
2533 TeamFortress_SetSpeed (AP);
\r
2540 if (Item.goal_activation & 16)
\r
2542 DelayReturn = spawn();
\r
2543 DelayReturn.enemy = Item;
\r
2544 DelayReturn.think = ReturnItem;
\r
2545 DelayReturn.nextthink = time + 0.5;
\r
2546 Item.owner = world;
\r
2547 TeamFortress_SetSpeed(AP);
\r
2551 Item.owner = world;
\r
2552 TeamFortress_SetSpeed(AP);
\r
2556 objerror ("Invalid method passed into tfgoalitem_RemoveFromPlayer\n");
\r
2559 // MTF's remove from player function
\r
2560 /*void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer =
\r
2563 local float lighton;
\r
2564 local float slowon;
\r
2565 local float key1on;
\r
2566 local float key2on;
\r
2567 local float spyoff;
\r
2569 local entity DelayReturn;
\r
2570 if (Item == world)
\r
2572 dprint("error: tfgoalitem_RemoveFromPlayer(): Item == world");
\r
2580 te = find(world, classname, "item_tfgoal");
\r
2583 if (te.owner == AP && te != Item)
\r
2585 if (te.goal_activation & 1)
\r
2589 if (te.goal_activation & 2)
\r
2593 if (te.items & 131072)
\r
2597 if (te.items & 262144)
\r
2601 if (te.goal_result & 16)
\r
2606 te = find(te, classname, "item_tfgoal");
\r
2610 if (AP.invincible_finished > time + 3)
\r
2617 AP.effects = AP.effects - (AP.effects & 8);
\r
2619 if (Item.goal_activation & 512)
\r
2621 Item.effects = Item.effects | 8;
\r
2625 AP.is_unabletospy = 0;
\r
2629 AP.items = AP.items - (AP.items & 131072);
\r
2633 AP.items = AP.items - (AP.items & 262144);
\r
2635 te = find(world, classname, "player");
\r
2636 while (te != world)
\r
2638 if (IsAffectedBy(Item, te, AP))
\r
2640 RemoveResults(Item, te);
\r
2642 te = find(te, classname, "player");
\r
2644 if ((method == 0) || (method == 2))
\r
2646 te = find(world, classname, "player");
\r
2647 while (te != world)
\r
2649 if (te.team_no == Item.owned_by)
\r
2651 if (Item.team_drop != string_null)
\r
2653 CenterPrint2(te, "\n\n\n", Item.team_drop);
\r
2655 if (Item.netname_team_drop != string_null)
\r
2657 sprint(te,AP.netname);
\r
2658 sprint(te,Item.netname_team_drop);
\r
2663 if (Item.non_team_drop != string_null)
\r
2665 CenterPrint2(te, "\n\n\n", Item.non_team_drop);
\r
2667 if (Item.netname_non_team_drop != string_null)
\r
2669 sprint(te,AP.netname);
\r
2670 sprint(te,Item.netname_non_team_drop);
\r
2673 te = find(te, classname, "player");
\r
2675 if (Item.goal_activation & 8)
\r
2677 DelayReturn = spawn();
\r
2678 DelayReturn.enemy = Item;
\r
2679 DelayReturn.think = ReturnItem;
\r
2680 DelayReturn.nextthink = time + 0.5;
\r
2684 if (Item.goal_activation & 4)
\r
2687 tfgoalitem_drop(Item);
\r
2691 Item.owner = world;
\r
2693 TeamFortress_SetSpeed(AP);
\r
2697 Item.owner = world;
\r
2698 TeamFortress_SetSpeed(AP);
\r
2703 if (Item.goal_activation & 16)
\r
2705 DelayReturn = spawn();
\r
2706 DelayReturn.enemy = Item;
\r
2707 DelayReturn.think = ReturnItem;
\r
2708 DelayReturn.nextthink = time + 0.5;
\r
2709 Item.owner = world;
\r
2710 TeamFortress_SetSpeed(AP);
\r
2714 Item.owner = world;
\r
2715 TeamFortress_SetSpeed(AP);
\r
2719 dprint("Invalid method passed into tfgoalitem_RemoveFromPlayer\n");
\r
2722 void() tfgoalitem_dropthink =
\r
2725 self.movetype = 10; //6;
\r
2726 if (self.pausetime != 0)
\r
2728 pos = pointcontents(self.origin);
\r
2731 self.nextthink = time + self.pausetime / 4;
\r
2737 self.nextthink = time + 5;
\r
2741 if (pos == -2 || pos == -6)
\r
2743 self.nextthink = time + 2;
\r
2747 self.nextthink = time + self.pausetime;
\r
2751 self.think = tfgoalitem_remove;
\r
2755 void(entity Item) tfgoalitem_drop =
\r
2757 Item.origin = Item.owner.origin - '0 0 8';
\r
2758 //Item.velocity_z = 400;
\r
2759 //Item.velocity_x = -50 + random() * 100;
\r
2760 //Item.velocity_y = -50 + random() * 100;
\r
2761 Item.velocity_z = 1;
\r
2762 Item.velocity_x = 0;
\r
2763 Item.velocity_y = 0;
\r
2764 Item.goal_state = 2;
\r
2765 Item.movetype = 6;
\r
2767 Item.touch = item_tfgoal_touch;
\r
2768 setorigin(Item, Item.origin - '0 0 16');
\r
2769 setsize(Item, '-16 -16 0', '16 16 56');
\r
2770 if (Item.mdl != string_null)
\r
2772 setmodel(Item, Item.mdl);
\r
2774 Item.nextthink = time + 5;
\r
2775 Item.think = tfgoalitem_dropthink;
\r
2778 void() tfgoalitem_remove =
\r
2781 if (self.goal_state == 1)
\r
2785 if (self.goal_activation & 32)
\r
2788 self.touch = item_tfgoal_touch;
\r
2789 self.origin = self.oldorigin;
\r
2790 if (self.mdl != string_null)
\r
2792 setmodel(self, self.mdl);
\r
2794 setorigin(self, self.origin);
\r
2795 //sound(self,"items/itembk2.wav", 1, 1);
\r
2796 tfgoalitem_checkgoalreturn(self);
\r
2797 if (self.noise3 != string_null || self.noise4 != string_null)
\r
2799 te = find(world, classname, "player");
\r
2802 if (te.team_no == self.owned_by)
\r
2804 CenterPrint2(te, "\n\n\n", self.noise3);
\r
2808 CenterPrint2(te, "\n\n\n", self.noise4);
\r
2810 te = find(te, classname, "player");
\r
2818 void(entity Item) tfgoalitem_checkgoalreturn =
\r
2821 if (Item.impulse != 0)
\r
2823 te = Findgoal(Item.impulse);
\r
2826 te = Findgoal(Item.impulse);
\r
2829 AttemptToActivate(te, world, Item);
\r
2835 void(entity Goal, entity Player, entity Item) DisplayItemStatus =
\r
2837 if (Item.goal_state == 1)
\r
2839 if (Player.team_no == Item.owned_by)
\r
2841 sprint(Player,Goal.team_str_carried);
\r
2845 sprint(Player,Goal.non_team_str_carried);
\r
2847 sprint(Player," ");
\r
2848 if (Player == Item.owner)
\r
2850 sprint(Player," You");
\r
2854 sprint(Player,Item.owner.netname);
\r
2856 sprint(Player,".");
\r
2860 if (Item.origin != Item.oldorigin)
\r
2862 if (Player.team_no == Item.owned_by)
\r
2864 sprint(Player,Goal.team_str_moved);
\r
2868 sprint(Player,Goal.non_team_str_moved);
\r
2873 if (Player.team_no == Item.owned_by)
\r
2875 sprint(Player,Goal.team_str_home);
\r
2879 sprint(Player,Goal.non_team_str_home);
\r
2883 sprint(Player,"\n");
\r
2886 void() info_player_team1 =
\r
2889 self.classname = "info_player_teamspawn";
\r
2891 self.goal_effects = 1;
\r
2892 self.team_str_home = "ts2";
\r
2895 void() info_player_team2 =
\r
2898 self.classname = "info_player_teamspawn";
\r
2900 self.goal_effects = 1;
\r
2901 self.team_str_home = "ts1";
\r
2904 void() item_flag_team2 =
\r
2906 team2maxplayers = 4; //TEMP
\r
2909 precache_model("progs/w_s_key.mdl");
\r
2910 precache_sound("ogre/ogwake.wav");
\r
2911 precache_sound("boss2/pop2.wav");
\r
2912 self.classname = "item_tfgoal";
\r
2913 self.netname = "Team 1 Flag";
\r
2914 self.broadcast = " ÇÏÔ the enemy team's flag!\n";
\r
2915 self.deathtype = "You've got the enemy flag!\n";
\r
2916 self.noise = "ogre/ogwake.wav";
\r
2917 self.mdl = "progs/tf_flag.mdl";
\r
2919 setmodel(self, self.mdl);
\r
2921 self.goal_activation = 1 | 4 | 128 | 32 | 16 | 512;
\r
2922 self.goal_effects = 1;
\r
2923 self.pausetime = 128;
\r
2924 setsize(self, '-16 -16 -24', '16 16 32');
\r
2925 self.touch = item_tfgoal_touch;
\r
2926 self.goal_state = 2;
\r
2928 setorigin(self, self.origin);
\r
2929 self.nextthink = time + 0.2;
\r
2930 self.think = TF_PlaceItem;
\r
2932 dp.origin = self.origin;
\r
2933 dp.classname = "info_tfgoal";
\r
2934 dp.goal_activation = 1;
\r
2936 dp.items_allowed = 2;
\r
2938 dp.goal_effects = 3;
\r
2939 dp.broadcast = " ÃÁÐÔÕÒÅÄ the enemy flag!\n";
\r
2940 dp.message = "You ÃÁÐÔÕÒÅÄ the enemy flag!\n";
\r
2941 dp.noise = "boss2/pop2.wav";
\r
2942 dp.goal_result = 2;
\r
2943 dp.activate_goal_no = 5;
\r
2948 dp.goal_state = 2;
\r
2949 setsize(dp, '-16 -16 -24', '16 16 32');
\r
2950 dp.nextthink = time + 0.2;
\r
2951 dp.think = TF_PlaceGoal;
\r
2953 dp.origin = dp.origin;
\r
2954 dp.classname = "info_tfgoal";
\r
2955 dp.goal_effects = 1;
\r
2957 dp.goal_activation = 0;
\r
2960 dp.goal_state = 2;
\r
2961 setsize(dp, '-16 -16 -24', '16 16 32');
\r
2962 dp.nextthink = time + 0.2;
\r
2963 dp.think = TF_PlaceGoal;
\r
2966 void() item_flag_team1 =
\r
2968 team1maxplayers = 4; //TEMP
\r
2971 precache_model("progs/tf_flag.mdl");
\r
2972 precache_sound("ogre/ogwake.wav");
\r
2973 precache_sound("boss2/pop2.wav");
\r
2974 self.classname = "item_tfgoal";
\r
2975 self.netname = "Team 2 Flag";
\r
2976 self.broadcast = " ÇÏÔ the enemy team's flag!\n";
\r
2977 self.deathtype = "You've got the enemy flag!\n";
\r
2978 self.noise = "ogre/ogwake.wav";
\r
2979 self.mdl = "progs/tf_flag.mdl";
\r
2980 setmodel(self, self.mdl);
\r
2983 self.goal_activation = 1 | 4 | 128 | 32 | 16 | 512;
\r
2984 self.goal_effects = 1;
\r
2985 self.pausetime = 128;
\r
2986 setsize(self, '-16 -16 -24', '16 16 32');
\r
2987 self.touch = item_tfgoal_touch;
\r
2988 self.goal_state = 2;
\r
2990 setorigin(self, self.origin);
\r
2991 self.nextthink = time + 0.2;
\r
2992 self.think = TF_PlaceItem;
\r
2994 dp.origin = self.origin;
\r
2995 dp.classname = "info_tfgoal";
\r
2996 dp.goal_activation = 1;
\r
2998 dp.items_allowed = 1;
\r
3000 dp.goal_effects = 3;
\r
3001 dp.broadcast = " ÃÁÐÔÕÒÅÄ the enemy flag!\n";
\r
3002 dp.message = "You ÃÁÐÔÕÒÅÄ the enemy flag!\n";
\r
3003 dp.noise = "boss2/pop2.wav";
\r
3004 dp.goal_result = 2;
\r
3005 dp.activate_goal_no = 6;
\r
3010 dp.goal_state = 2;
\r
3011 setsize(dp, '-16 -16 -24', '16 16 32');
\r
3012 dp.nextthink = time + 0.2;
\r
3013 dp.think = TF_PlaceGoal;
\r
3015 dp.origin = dp.origin;
\r
3016 dp.classname = "info_tfgoal";
\r
3017 dp.goal_effects = 1;
\r
3019 dp.goal_activation = 0;
\r
3022 dp.goal_state = 2;
\r
3023 setsize(dp, '-16 -16 -24', '16 16 32');
\r
3024 dp.nextthink = time + 0.2;
\r
3025 dp.think = TF_PlaceGoal;
\r
3028 void() CTF_FlagCheck =
\r
3031 local float flagcount;
\r
3034 te = find(world, classname, "item_tfgoal");
\r
3035 while (te != world)
\r
3037 if (te.goal_no == 1)
\r
3039 pos = pointcontents(te.origin);
\r
3040 if (pos == -2 || pos == -6)
\r
3042 dprint("*****BUG*****\nFlag(s) outside world.\nPlease report this.\n");
\r
3043 te.nextthink = time + 0.2;
\r
3044 te.think = tfgoalitem_remove;
\r
3046 flagcount = flagcount + 1;
\r
3050 if (te.goal_no == 2)
\r
3052 pos = pointcontents(te.origin);
\r
3053 if (pos == -2 || pos == -6)
\r
3055 dprint("*****BUG*****\nFlag(s) outside world.\nPlease report this.\n");
\r
3056 te.nextthink = time + 0.2;
\r
3057 te.think = tfgoalitem_remove;
\r
3059 flagcount = flagcount + 1;
\r
3062 te = find(te, classname, "item_tfgoal");
\r
3064 if (flagcount != 2)
\r
3066 dprint("*****BUG*****\nFlag(s) missing.\nPlease report this.\n");
\r
3068 self.nextthink = time + 30;
\r