Esempio n. 1
0
  public static void SP_trigger_key(Entity self) {
    if (GameBase.st.item == null) {
      ServerGame.PF_dprintf("no key item for trigger_key at " + Lib.vtos(self.s.origin) + "\n");
      return;
    }
    self.item = GameItems.FindItemByClassname(GameBase.st.item);

    if (null == self.item) {
      ServerGame.PF_dprintf(
          "item "
              + GameBase.st.item
              + " not found for trigger_key at "
              + Lib.vtos(self.s.origin)
              + "\n");
      return;
    }

    if (self.target == null) {
      ServerGame.PF_dprintf(self.classname + " at " + Lib.vtos(self.s.origin) + " has no target\n");
      return;
    }

    ServerInit.SV_SoundIndex("misc/keytry.wav");
    ServerInit.SV_SoundIndex("misc/keyuse.wav");

    self.use = trigger_key_use;
  }
Esempio n. 2
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;
  }
Esempio n. 3
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);
  }