5 void() trigger_push_touch =
7 local float flighttime, dist, grav;
10 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" && other.classname != "plasma_prim" && other.classname != "plasma_chain")
13 if (other.deadflag && other.classname == "player")
18 other.velocity = self.movedir;
19 other.flags = other.flags - (other.flags & FL_ONGROUND);
25 if (other.classname == "player")
26 sound (other, CHAN_ITEM, "misc/jumppad.ogg", 1, ATTN_NORM);
28 // figure out how long it will take to hit the point considering gravity
29 grav = cvar("sv_gravity");
30 flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
34 // how far in X and Y to move
35 self.movedir = (self.enemy.origin - org);
37 dist = vlen(self.movedir);
39 // finally calculate the velocity
40 self.movedir = normalize(self.movedir) * (dist / flighttime);
41 self.movedir_z = flighttime * grav;
43 other.flags = other.flags - (other.flags & FL_ONGROUND);
44 // reset tracking of oldvelocity for impact damage (sudden velocity changes)
45 other.oldvelocity = other.velocity = self.movedir;
46 // reset tracking of who pushed you into a hazard (for kill credit)
49 if (other.classname == "missile")
50 other.angles = vectoangles (other.velocity);
52 if (self.spawnflags & PUSH_ONCE)
54 self.touch = SUB_Null;
55 self.think = SUB_Remove;
56 self.nextthink = time;
60 void() trigger_push_findtarget =
63 self.enemy = find(world, targetname, self.target);
66 objerror("trigger_push: target not found\n");
73 if (self.angles != '0 0 0')
76 self.solid = SOLID_TRIGGER;
77 setmodel (self, self.model);
78 self.movetype = MOVETYPE_NONE;
82 self.touch = trigger_push_touch;
84 // check if this is a jump pad
87 self.think = trigger_push_findtarget;
88 self.nextthink = time + 0.2;
95 self.movedir = self.movedir * self.speed * 10;
99 void() target_push = {};
100 void() info_notnull = {};
101 void() target_position = {};