Jump pad fix

Post bugs you've found here. Please be descriptive. PLEASE DO NOT POST CHEATS HERE.

Moderator: Moderators

1 Wed Nov 12, 2014 2:47 pm

Ran into this yesterday. If the top of a jump pad is near the same level of a floor, the walk off code fails. Hilarity ensues.

I took a look, and the code hadn't been touched for a LONG time. Most was still from Scavengers time, and he borrowed it from Shifter. lol.

Cleaned it up and prettied up the bottom print.

Code: Select all
// cleaned up this mess 11/12/2014 12:34PM -Plasmatic
function JumpPad::onCollision(%this,%obj)
{   
   if($debug)
      event::collision(%this,%obj);
   if(%obj.testing)   //Plasmatic -Portal gun 11/20/2007 11:45PM
      return;
   if(getObjectType(%obj) != "Player")
      return;
   if(Player::isDead(%obj))
      return;
   if(%this.cloaked > 0 && getObjectType(%obj) == "Player")
   {
      //pop this visible for a second -plasmatic
      %this.cloaked = "";
      GameBase::startFadein(%this);
   }   
   %clientId = Player::getClient(%obj);
   
   %tpos=GameBase::getPosition(%this);
   %opos=GameBase::getPosition(%obj);

   %tstartZ=getWord(%tpos,2);
   %ostartZ=getWord(%opos,2);

   %diffZ=%ostartZ-%tstartZ-0.95;

   if(%obj.deployStandby!=1)
   {
      if(%diffZ > 0)
      {
         %obj.deployStandby = 1;

         bottomprint(%clientId, "<jc><f1>JumpPad : <f0>Aim the direction you want to go, then jump or use your jets.\nYou may walk off the platform to avoid being deployed.");
         JumpPadPack::CheckPlayer(%this,%obj);
      }
   }
   else if(%diffZ < 0)
   {
      bottomprint(%clientId, "",0);
      %obj.deployStandby = 0;
   }
   return;
}
//from shifter, modified by Plasmatic to use %trans
function JumpPadPack::CheckPlayer(%this,%obj)
{
   %tpos=GameBase::getPosition(%this);
   %opos=GameBase::getPosition(%obj);

   %tstartZ=getWord(%tpos,2);
   %ostartZ=getWord(%opos,2);

   %diffZ=%ostartZ-%tstartZ-0.92;
   %deploy=0;
   %recall=1;

   if((%diffZ>0.5) || Player::isJetting(%obj)) %deploy=1;
   if((%diffZ<0) || vector::getdistance(%tpos,%opos) > 3.75 ) %deploy=-1;
   // added distance and jet checks, cleaned up 11/12/2014 12:27PM -Plasmatic
   %client = Player::getClient(%obj);
   %armor = Player::getArmor(%client);
   
   if(%deploy>0)
   {
      //begin deploy
      %armor=GameBase::getDataName(%obj);
      %mass=%armor.mass;
      %rot=GameBase::getRotation(%obj);

      %rnd=floor(getrandom()*30);
      if(%rnd > 20)
      {
         GameBase::playSound(%this, debrisLargeExplosion, 0);
         Client::SendMessage(%client, 0, "K-E-R-S-P-R-O-I-N-G-g-g-g-!-!");
         %rnd = %rnd + 10;
      }
      else
      {
         GameBase::playSound(%this, SoundFireMortar, 0);
         Client::SendMessage(%client, 0, "SPROING!");
      }   
      %len = 40 + %rnd;
      %trans = GameBase::getMuzzleTransform(%obj);
      %tr= getWord(%trans,5);
      if(%tr < 0) %tr = -%tr;
      %tr = %tr+ 0.15;
      %up = %tr;
      %out = 1-%tr;
      %vec = Vector::getFromRot(%rot,%len*%mass*%out,%len*%mass*%up);
      Player::applyImpulse(%obj,%vec);
      schedule(%obj @ ".deployStandby=0;",0.1);
      %recall = 0;
      // end deploy
   }
   else if(%deploy < 0)
   {
      %recall = 0;
      %obj.deployStandby = 0;
   }
   if(%recall)
      schedule("JumpPadPack::CheckPlayer("@%this@","@%obj@");",0.05);
   else
      bottomprint(%client, "",0);//remoteEval(%client, "CP", "", 0);
}
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8374

2 Thu Nov 13, 2014 7:20 pm

Nice catch.
User avatar
virus
Ensign
Ensign
 
Posts: 64

3 Thu Nov 13, 2014 8:19 pm

Thanks. Added a jetting check along with a distance check.
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8374

4 Sat Nov 15, 2014 7:01 am

this is not a pm!!
DaJ4ck3L
Crow{OZ}
 
Posts: 118


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 2 guests

cron