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_once (.5 .5 .5) ? x x TRIGGERED Triggers once, then removes itself. You must set
   * the key "target" to the name of another object in the level that has a matching "targetname".
   *
   * <p>If TRIGGERED, this trigger must be triggered before it is live.
   *
   * <p>sounds 1) secret 2) beep beep 3) large switch 4)
   *
   * <p>"message" string to be displayed when triggered
   */
  public static void SP_trigger_once(Entity ent) {
    // make old maps work because I messed up on flag assignments here
    // triggered was on bit 1 when it should have been on bit 4
    if ((ent.spawnflags & 1) != 0) {
      float[] v = {0, 0, 0};

      Math3D.VectorMA(ent.mins, 0.5f, ent.size, v);
      ent.spawnflags &= ~1;
      ent.spawnflags |= 4;
      ServerGame.PF_dprintf(
          "fixed TRIGGERED flag on " + ent.classname + " at " + Lib.vtos(v) + "\n");
    }

    ent.wait = -1;
    SP_trigger_multiple(ent);
  }
Example #3
0
  public static void SP_trigger_counter(Entity self) {
    self.wait = -1;
    if (0 == self.count) self.count = 2;

    self.use = trigger_counter_use;
  }