1 void SUB_DontUseTargets() { }
7 activator = self.enemy;
12 void FixSize(entity e)
14 e.mins_x = rint(e.mins_x);
15 e.mins_y = rint(e.mins_y);
16 e.mins_z = rint(e.mins_z);
18 e.maxs_x = rint(e.maxs_x);
19 e.maxs_y = rint(e.maxs_y);
20 e.maxs_z = rint(e.maxs_z);
23 void trigger_setnextthink(entity e, float dtime)
26 e.nextthink = time + dtime;
33 ==============================
36 the global "activator" should be set to the entity that initiated the firing.
38 If self.delay is set, a DelayedUse entity will be created that will actually
39 do the SUB_UseTargets after that many seconds have passed.
41 Centerprints any self.message to the activator.
43 Removes all entities with a targetname that match self.killtarget,
44 and removes them, so some events can remove other triggers.
46 Search for (string)targetname in all entities that
47 match (string)self.target and call their .use function
49 ==============================
53 entity t, stemp, otemp, act;
62 // create a temp object to fire at a later time
64 t.classname = "DelayedUse";
65 t.nextthink = time + self.delay;
68 t.message = self.message;
69 t.killtarget = self.killtarget;
70 t.target = self.target;
71 t.target2 = self.target2;
72 t.target3 = self.target3;
73 t.target4 = self.target4;
83 if(IS_PLAYER(activator) && self.message != "")
84 if(IS_REAL_CLIENT(activator))
86 centerprint(activator, self.message);
88 play2(activator, "misc/talk.wav");
92 // kill the killtagets
97 for(t = world; (t = find(t, targetname, s)); )
109 if(stemp.target_random)
110 RandomSelection_Init();
112 for(i = 0; i < 4; ++i)
117 case 0: s = stemp.target; break;
118 case 1: s = stemp.target2; break;
119 case 2: s = stemp.target3; break;
120 case 3: s = stemp.target4; break;
124 for(t = world; (t = find(t, targetname, s)); )
127 if(stemp.target_random)
129 RandomSelection_Add(t, 0, string_null, 1, 0);
142 if(stemp.target_random && RandomSelection_chosen_ent)
144 self = RandomSelection_chosen_ent;
156 void trigger_touch_generic(void() touchfunc)
159 for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
162 vector emin = e.absmin, emax = e.absmax;
163 if(self.solid == SOLID_BSP)
168 if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
169 if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
176 void trigger_draw_generic()
178 float dt = time - self.move_time;
179 self.move_time = time;
180 if(dt <= 0) { return; }
182 setorigin(self, self.origin + self.velocity * frametime);
184 if(self.trigger_touch) { trigger_touch_generic(self.trigger_touch); }