2 float PUSH_SILENT = 2;
\r
4 void() trigger_push_touch =
\r
6 local float flighttime, dist, grav;
\r
9 if (other.classname != "player" && other.classname != "corpse" && other.classname != "body" && other.classname != "gib" && other.classname != "missile" && other.classname != "casing" && other.classname != "grenade" && other.classname != "plasma")
\r
16 other.velocity = self.movedir;
\r
17 other.flags = other.flags - (other.flags & FL_ONGROUND);
\r
23 if (other.classname == "player")
\r
24 sound (other, CHAN_ITEM, "misc/jumppad.wav", 1, ATTN_NORM);
\r
26 // figure out how long it will take to hit the point considering gravity
\r
27 grav = cvar("sv_gravity");
\r
28 flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
\r
32 // how far in X and Y to move
\r
33 self.movedir = (self.enemy.origin - org);
\r
35 dist = vlen(self.movedir);
\r
37 // finally calculate the velocity
\r
38 self.movedir = normalize(self.movedir) * (dist / flighttime);
\r
39 self.movedir_z = flighttime * grav;
\r
41 other.velocity = self.movedir;
\r
42 other.flags = other.flags - (other.flags & FL_ONGROUND);
\r
44 if (other.classname == "missile")
\r
45 other.angles = vectoangles (other.velocity);
\r
47 if (self.spawnflags & PUSH_ONCE)
\r
49 self.touch = SUB_Null;
\r
50 self.think = SUB_Remove;
\r
51 self.nextthink = time;
\r
55 void() trigger_push_findtarget =
\r
58 self.enemy = find(world, targetname, self.target);
\r
61 objerror("trigger_push: target not found\n");
\r
66 void() trigger_push =
\r
68 if (self.angles != '0 0 0')
\r
71 self.solid = SOLID_TRIGGER;
\r
72 setmodel (self, self.model);
\r
73 self.movetype = MOVETYPE_NONE;
\r
74 self.modelindex = 0;
\r
77 self.touch = trigger_push_touch;
\r
79 // check if this is a jump pad
\r
82 self.think = trigger_push_findtarget;
\r
83 self.nextthink = time + 0.2;
\r
87 // normal push setup
\r
90 self.movedir = self.movedir * self.speed * 10;
\r
94 void() target_push = {};
\r
95 //void() info_notnull = {}; // Moved to tfq3fitems.c!
\r
96 void() target_position = {};
\r