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")
15 other.velocity = self.movedir;
16 other.flags = other.flags - (other.flags & FL_ONGROUND);
22 if (other.classname == "player")
23 sound (other, CHAN_ITEM, "misc/jumppad.ogg", 1, ATTN_NORM);
25 // figure out how long it will take to hit the point considering gravity
26 grav = cvar("sv_gravity");
27 flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
31 // how far in X and Y to move
32 self.movedir = (self.enemy.origin - org);
34 dist = vlen(self.movedir);
36 // finally calculate the velocity
37 self.movedir = normalize(self.movedir) * (dist / flighttime);
38 self.movedir_z = flighttime * grav;
40 other.flags = other.flags - (other.flags & FL_ONGROUND);
41 // reset tracking of oldvelocity for impact damage (sudden velocity changes)
42 other.oldvelocity = other.velocity = self.movedir;
43 // reset tracking of who pushed you into a hazard (for kill credit)
46 if (other.classname == "missile")
47 other.angles = vectoangles (other.velocity);
49 if (self.spawnflags & PUSH_ONCE)
51 self.touch = SUB_Null;
52 self.think = SUB_Remove;
53 self.nextthink = time;
57 void() trigger_push_findtarget =
60 self.enemy = find(world, targetname, self.target);
63 objerror("trigger_push: target not found\n");
70 if (self.angles != '0 0 0')
73 self.solid = SOLID_TRIGGER;
74 setmodel (self, self.model);
75 self.movetype = MOVETYPE_NONE;
79 self.touch = trigger_push_touch;
81 // check if this is a jump pad
84 self.think = trigger_push_findtarget;
85 self.nextthink = time + 0.2;
92 self.movedir = self.movedir * self.speed * 10;
96 void() target_push = {};
97 void() info_notnull = {};
98 void() target_position = {};