4 void() trigger_push_touch =
6 local float flighttime, dist, grav;
9 if (other.classname != "player")
14 other.velocity = self.movedir;
15 other.flags = other.flags - (other.flags & FL_ONGROUND);
21 sound (other, CHAN_ITEM, "misc/jumppad.wav", 1, ATTN_NORM);
23 // figure out how long it will take to hit the point considering gravity
24 grav = cvar("sv_gravity");
25 flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
29 // how far in X and Y to move
30 self.movedir = (self.enemy.origin - org);
32 dist = vlen(self.movedir);
34 // finally calculate the velocity
35 self.movedir = normalize(self.movedir) * (dist / flighttime);
36 self.movedir_z = flighttime * grav;
38 other.velocity = self.movedir;
39 other.flags = other.flags - (other.flags & FL_ONGROUND);
41 if (other.classname == "missile")
42 other.angles = vectoangles (other.velocity);
44 if (self.spawnflags & PUSH_ONCE)
46 self.touch = nullfunction;
47 self.think = SUB_Remove;
48 self.nextthink = time;
52 void() trigger_push_findtarget =
55 self.enemy = find(world, targetname, self.target);
58 objerror("trigger_push: target not found\n");
65 if (self.angles != '0 0 0')
68 self.solid = SOLID_TRIGGER;
69 setmodel (self, self.model);
70 self.movetype = MOVETYPE_NONE;
74 self.touch = trigger_push_touch;
76 // check if this is a jump pad
79 self.think = trigger_push_findtarget;
80 self.nextthink = time + 0.2;
87 self.movedir = self.movedir * self.speed * 10;
91 void() target_push = {};
92 void() info_notnull = {};
93 void() target_position = {};