level.qc (1130B)
1 //handles mapchanges and other such things 2 3 void InitTrigger() 4 { 5 self.solid = SOLID_TRIGGER; 6 self.movetype = MOVETYPE_NONE; 7 8 //TODO: We really need to do this? 9 setmodel(self, self.model); 10 self.modelindex = 0; 11 self.model = ""; 12 } 13 14 void() trigger_changelevel = 15 { 16 //Quake map compatibility? 17 } 18 19 void() mapend_think = 20 { 21 local entity play; 22 23 self.nextthink = time + 5; 24 25 //check if all players are in 26 play = find(world, classname, "player"); 27 while (play != world) 28 { 29 //if any player is not touching the trigger_mapend 30 if (play.mapend != 1 ) 31 { 32 return; 33 } 34 play = find(play, classname, "player"); 35 } 36 37 //engine function 38 changelevel(self.map); 39 } 40 41 void() mapend_touch = 42 { 43 if (other.classname != "player") 44 return; 45 46 other.mapend = 1; 47 48 centerprint(other, self.message); 49 } 50 51 //Fangflecked level end trigger ent 52 //all players must be touching it for the map to change 53 void() trigger_mapend = 54 { 55 self.classname = "trigger_mapend"; 56 if (!self.map) 57 objerror("trigger_mapend must have a destination map specified!"); 58 59 InitTrigger(); 60 self.touch = mapend_touch; 61 self.think = mapend_think; 62 self.nextthink = time + 5; 63 } 64