Example #1
0
  public static void SP_trigger_multiple(Entity ent) {
    if (ent.sounds == 1) ent.noise_index = ServerInit.SV_SoundIndex("misc/secret.wav");
    else if (ent.sounds == 2) ent.noise_index = ServerInit.SV_SoundIndex("misc/talk.wav");
    else if (ent.sounds == 3) ent.noise_index = ServerInit.SV_SoundIndex("misc/trigger1.wav");

    if (ent.wait == 0) ent.wait = 0.2f;

    ent.touch = Touch_Multi;
    ent.movetype = Constants.MOVETYPE_NONE;
    ent.svflags |= Constants.SVF_NOCLIENT;

    if ((ent.spawnflags & 4) != 0) {
      ent.solid = Constants.SOLID_NOT;
      ent.use = trigger_enable;
    } else {
      ent.solid = Constants.SOLID_TRIGGER;
      ent.use = Use_Multi;
    }

    if (!Math3D.VectorEquals(ent.s.angles, Globals.vec3_origin))
      GameBase.G_SetMovedir(ent.s.angles, ent.movedir);

    ServerGame.PF_setmodel(ent, ent.model);
    World.SV_LinkEdict(ent);
  }
Example #2
0
 /*
  * QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE Pushes the player "speed"
  * defaults to 1000
  */
 public static void SP_trigger_push(Entity self) {
   InitTrigger(self);
   windsound = ServerInit.SV_SoundIndex("misc/windfly.wav");
   self.touch = trigger_push_touch;
   if (0 == self.speed) self.speed = 1000;
   World.SV_LinkEdict(self);
 }
Example #3
0
 public static void SP_trigger_monsterjump(Entity self) {
   if (0 == self.speed) self.speed = 200;
   if (0 == GameBase.st.height) GameBase.st.height = 200;
   if (self.s.angles[Constants.YAW] == 0) self.s.angles[Constants.YAW] = 360;
   InitTrigger(self);
   self.touch = trigger_monsterjump_touch;
   self.movedir[2] = GameBase.st.height;
 }
Example #4
0
  public static void SP_trigger_gravity(Entity self) {
    if (GameBase.st.gravity == null) {
      ServerGame.PF_dprintf(
          "trigger_gravity without gravity set at " + Lib.vtos(self.s.origin) + "\n");
      GameUtil.G_FreeEdict(self);
      return;
    }

    InitTrigger(self);
    self.gravity = Lib.atoi(GameBase.st.gravity);
    self.touch = trigger_gravity_touch;
  }
Example #5
0
  public static void SP_trigger_hurt(Entity self) {
    InitTrigger(self);

    self.noise_index = ServerInit.SV_SoundIndex("world/electro.wav");
    self.touch = hurt_touch;

    if (0 == self.dmg) self.dmg = 5;

    if ((self.spawnflags & 1) != 0) self.solid = Constants.SOLID_NOT;
    else self.solid = Constants.SOLID_TRIGGER;

    if ((self.spawnflags & 2) != 0) self.use = hurt_use;

    World.SV_LinkEdict(self);
  }
Example #6
0
  // the trigger was just activated
  // ent.activator should be set to the activator so it can be held through a
  // delay so wait for the delay time before firing
  public static void multi_trigger(Entity ent) {
    if (ent.nextthink != 0) return; // already been triggered

    GameUtil.G_UseTargets(ent, ent.activator);

    if (ent.wait > 0) {
      ent.think = multi_wait;
      ent.nextthink = GameBase.level.time + ent.wait;
    } else { // we can't just remove (self) here, because this is a touch
      // function
      // called while looping through area links...
      ent.touch = null;
      ent.nextthink = GameBase.level.time + Constants.FRAMETIME;
      ent.think = GameUtil.G_FreeEdictA;
    }
  }