4 void() trigger_push_touch =
6 local float flighttime, dist, grav;
14 sound (other, CHAN_ITEM, "misc/jumppad.wav", 1, ATTN_NORM);
16 // figure out how long it will take to hit the point considering gravity
17 grav = cvar("sv_gravity");
18 flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
22 // how far in X and Y to move
23 self.movedir = (self.enemy.origin - org);
25 dist = vlen(self.movedir);
27 // finally calculate the velocity
28 self.movedir = normalize(self.movedir) * (dist / flighttime);
29 self.movedir_z = flighttime * grav;
31 other.velocity = self.movedir;
32 other.flags = other.flags - (other.flags & FL_ONGROUND);
34 if (other.classname == "missile")
35 other.angles = vectoangles (other.velocity);
37 if (self.spawnflags & PUSH_ONCE)
39 self.touch = SUB_Null;
40 self.think = SUB_Remove;
41 self.nextthink = time;
45 void() trigger_push_findtarget =
48 self.enemy = find(world, targetname, self.target);
50 objerror("trigger_push: target not found\n");
55 if (self.angles != '0 0 0')
58 self.solid = SOLID_TRIGGER;
59 setmodel (self, self.model);
60 self.movetype = MOVETYPE_NONE;
64 self.touch = trigger_push_touch;
66 // check if this is a jump pad
69 self.think = trigger_push_findtarget;
70 self.nextthink = time + 0.2;
77 self.movedir = self.movedir * self.speed * 10;
81 void() target_push = { trigger_push(); };
82 void() info_notnull = {};
83 void() target_position = {};