Example #1
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 #2
0
        public void touch(Entity self, Entity other, Plane plane, Surface surf) {
          if (Lib.strcmp(other.classname, "grenade") == 0) {
            Math3D.VectorScale(self.movedir, self.speed * 10, other.velocity);
          } else if (other.health > 0) {
            Math3D.VectorScale(self.movedir, self.speed * 10, other.velocity);

            if (other.client != null) {
              // don't take falling damage immediately from this
              Math3D.VectorCopy(other.velocity, other.client.oldvelocity);
              if (other.fly_sound_debounce_time < GameBase.level.time) {
                other.fly_sound_debounce_time = GameBase.level.time + 1.5f;
                ServerGame.PF_StartSound(
                    other,
                    Constants.CHAN_AUTO,
                    windsound,
                    (float) 1,
                    (float) Constants.ATTN_NORM,
                    (float) 0);
              }
            }
          }
          if ((self.spawnflags & PUSH_ONCE) != 0) GameUtil.G_FreeEdict(self);
        }