5 void() trigger_push_touch =
7 local float flighttime, dist, grav;
13 // where the center is
14 //org = (self.absmin + self.absmax) * 0.5;
17 // figure out how long it will take to hit the point considering gravity
18 grav = cvar("sv_gravity");
19 flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
26 // how far in X and Y to move
27 self.movedir = (self.enemy.origin - org);
29 dist = vlen(self.movedir);
31 // finally calculate the velocity
32 self.movedir = normalize(self.movedir) * (dist / flighttime);
33 self.movedir_z = flighttime * grav;
35 other.velocity = self.movedir;
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");
53 /*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE SILENT
54 Improved version of normal trigger_push.
56 Pushes anything that touches it,
57 or acts as a jump pad, hitting "target"
58 at the apogee (peak) of the jump.
60 Target should be an info_notnull.
63 "PUSH_ONCE" - removes itself after push
64 "SILENT" - no 'windtunnel' noise
66 "target" - acts as jump pad, hits this entity
71 if (self.angles == '0 -1 0')
72 self.movedir = '0 0 1';
73 else if (self.angles == '0 -2 0')
74 self.movedir = '0 0 -1';
77 makevectors (self.angles);
78 self.movedir = v_forward;
81 self.angles = '0 0 0';
86 if (self.angles != '0 0 0')
89 self.solid = SOLID_TRIGGER;
90 setmodel (self, self.model);
91 self.movetype = MOVETYPE_NONE;
98 self.movedir = self.movedir * self.speed * 10;
100 self.touch = trigger_push_touch;
102 // check if this is a jump pad
105 self.think = trigger_push_findtarget;
106 self.nextthink = time + 0.2;
116 void() info_notnull = {};
117 void() info_targetposition = {};