26 self->solid = SOLID_TRIGGER;
28 gi.setmodel(
self, self->model);
29 self->svflags = SVF_NOCLIENT;
64 ent->activator = activator;
71 if (self->spawnflags & 2)
73 }
else if (
other->svflags & SVF_MONSTER) {
74 if (!(self->spawnflags & 1))
83 if (DotProduct(
forward, self->movedir) < 0)
87 self->activator =
other;
104 self->solid = SOLID_TRIGGER;
111 if (ent->sounds == 1)
112 ent->noise_index =
gi.soundindex(
"misc/secret.wav");
113 else if (ent->sounds == 2)
114 ent->noise_index =
gi.soundindex(
"misc/talk.wav");
115 else if (ent->sounds == 3)
116 ent->noise_index =
gi.soundindex(
"misc/trigger1.wav");
122 ent->svflags |= SVF_NOCLIENT;
125 if (ent->spawnflags & 4) {
126 ent->solid = SOLID_NOT;
129 ent->solid = SOLID_TRIGGER;
136 gi.setmodel(ent, ent->model);
160 if (ent->spawnflags & 1) {
163 VectorMA(ent->mins, 0.5, ent->size, v);
164 ent->spawnflags &= ~1;
165 ent->spawnflags |= 4;
166 gi.dprintf(
"fixed TRIGGERED flag on %s at %s\n", ent->classname,
vtos(v));
205 if (!activator->client)
209 if (!activator->client->pers.inventory[index]) {
210 if (
level.
time < self->touch_debounce_time)
212 self->touch_debounce_time =
level.
time + 5.0;
213 gi.centerprintf(activator,
"You need the %s", self->item->pickup_name);
214 gi.sound(activator, CHAN_AUTO,
gi.soundindex(
"misc/keytry.wav"), 1, ATTN_NORM, 0);
218 gi.sound(activator, CHAN_AUTO,
gi.soundindex(
"misc/keyuse.wav"), 1, ATTN_NORM, 0);
223 if (strcmp(self->item->classname,
"key_power_cube") == 0) {
226 for (cube = 0; cube < 8; cube++)
227 if (activator->client->pers.power_cubes & (1 << cube))
235 if (ent->client->pers.power_cubes & (1 << cube)) {
236 ent->client->pers.inventory[index]--;
237 ent->client->pers.power_cubes &= ~(1 << cube);
247 ent->client->pers.inventory[index] = 0;
251 activator->client->pers.inventory[index]--;
262 gi.dprintf(
"no key item for trigger_key at %s\n",
vtos(self->s.origin));
268 gi.dprintf(
"item %s not found for trigger_key at %s\n",
st.
item,
vtos(self->s.origin));
273 gi.dprintf(
"%s at %s has no target\n", self->classname,
vtos(self->s.origin));
277 gi.soundindex(
"misc/keytry.wav");
278 gi.soundindex(
"misc/keyuse.wav");
302 if (self->count == 0)
308 if (!(self->spawnflags & 1)) {
309 gi.centerprintf(activator,
"%i more to go...", self->count);
310 gi.sound(activator, CHAN_AUTO,
gi.soundindex(
"misc/talk1.wav"), 1, ATTN_NORM, 0);
315 if (!(self->spawnflags & 1)) {
316 gi.centerprintf(activator,
"Sequence completed!");
317 gi.sound(activator, CHAN_AUTO,
gi.soundindex(
"misc/talk1.wav"), 1, ATTN_NORM, 0);
319 self->activator = activator;
347 if (ent->delay < 0.2)
367 if (strcmp(
other->classname,
"grenade") == 0) {
368 VectorScale(self->movedir, self->speed * 10,
other->velocity);
369 }
else if (
other->health > 0) {
370 VectorScale(self->movedir, self->speed * 10,
other->velocity);
374 VectorCopy(
other->velocity,
other->client->oldvelocity);
423 if (self->solid == SOLID_NOT)
424 self->solid = SOLID_TRIGGER;
426 self->solid = SOLID_NOT;
429 if (!(self->spawnflags & 2))
438 if (!
other->takedamage)
444 if (self->spawnflags & 16)
449 if (!(self->spawnflags & 4)) {
451 gi.sound(
other, CHAN_AUTO, self->noise_index, 1, ATTN_NORM, 0);
454 if (self->spawnflags & 8)
465 self->noise_index =
gi.soundindex(
"world/electro.wav");
471 if (self->spawnflags & 1)
472 self->solid = SOLID_NOT;
474 self->solid = SOLID_TRIGGER;
476 if (self->spawnflags & 2)
499 other->gravity =
self->gravity;
505 gi.dprintf(
"trigger_gravity without gravity set at %s\n",
vtos(self->s.origin));
534 if (
other->svflags & SVF_DEADMONSTER)
536 if (!(
other->svflags & SVF_MONSTER))
540 other->velocity[0] =
self->movedir[0] *
self->speed;
541 other->velocity[1] =
self->movedir[1] *
self->speed;
543 if (!
other->groundentity)
546 other->groundentity = NULL;
547 other->velocity[2] =
self->movedir[2];
556 if (self->s.angles[YAW] == 0)
557 self->s.angles[YAW] = 360;