5 void() trigger_push_touch =
7 local float flighttime, dist, grav;
15 // figure out how long it will take to hit the point considering gravity
16 grav = cvar("sv_gravity");
17 flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav));
21 // how far in X and Y to move
22 self.movedir = (self.enemy.origin - org);
24 dist = vlen(self.movedir);
26 // finally calculate the velocity
27 self.movedir = normalize(self.movedir) * (dist / flighttime);
28 self.movedir_z = flighttime * grav;
30 other.velocity = self.movedir;
31 other.flags = other.flags - (other.flags & FL_ONGROUND);
33 if (self.spawnflags & PUSH_ONCE)
35 self.touch = SUB_Null;
36 self.think = SUB_Remove;
37 self.nextthink = time;
41 void() trigger_push_findtarget =
44 self.enemy = find(world, targetname, self.target);
46 objerror("trigger_push: target not found\n");
49 /*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE SILENT
50 Improved version of normal trigger_push.
52 Pushes anything that touches it,
53 or acts as a jump pad, hitting "target"
54 at the apogee (peak) of the jump.
56 Target should be an info_notnull.
59 "PUSH_ONCE" - removes itself after push
60 "SILENT" - no 'windtunnel' noise
62 "target" - acts as jump pad, hits this entity
67 if (self.angles == '0 -1 0')
68 self.movedir = '0 0 1';
69 else if (self.angles == '0 -2 0')
70 self.movedir = '0 0 -1';
73 makevectors (self.angles);
74 self.movedir = v_forward;
77 self.angles = '0 0 0';
82 if (self.angles != '0 0 0')
85 self.solid = SOLID_TRIGGER;
86 setmodel (self, self.model);
87 self.movetype = MOVETYPE_NONE;
91 self.touch = trigger_push_touch;
93 // check if this is a jump pad
96 self.think = trigger_push_findtarget;
97 self.nextthink = time + 0.2;
104 self.movedir = self.movedir * self.speed * 10;
108 void() target_push = { trigger_push(); };
109 void() info_notnull = {};
110 void() target_position = {};