Leeloo Dallas multipass fix.

Announcements, Important Things and other Cool Stuff

Moderator: Moderators

1 Fri Aug 28, 2009 12:12 pm

A patch for the Zappy Inventories that will eliminate a few exploits and issues.

Slap Mr Green for the fix. Image
Or click this for more information.

-Plasmatic
Image
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

2 Fri Aug 28, 2009 12:18 pm

For server operators, unzip the fix into the config or Annihilation directories, then add
Code: Select all
exec(ZappyfixAug2009);
to the end of the Annihilation.cs file in the config directory. Restart the server.

This will eliminate more than a few cheat holes and issues.

The code contained in the fix:
Code: Select all
// August 2009 Zappy inventory patch aka Leeloo Dallas multipass fix.
// www.annihilation.info
// Plasmatic
//
// Unzip to the Annihilation directory
// add the line
// exec(ZappyfixAug2009);
// to the end of annihilation.cs in config directory.
//


//Infinite Zappy fix 3/17/2007 6:36AM Plasmatic
function InvTrigger::onEnter(%this,%object)
{
   %type = getObjectType(%object);
   if(%type == "Player")
   {
      if(Player::isAIControlled(%object))
         return;
      %group = getGroup(%this);
      %obj = %this.Owner;
      %client = GameBase::getOwnerClient(%object);
      
      //Ok, this is a strange bug. We're only going to track last trigger we enter with this..
      %object.InvObject = %obj;   //Infinite Zappy fix 3/17/2007 6:36AM Plasmatic
      //Lightning projectiles are not deleted when firing object is destroyed. Yay.
      
      %object.invtrigger++;   // Leeloo Dallas multipass fix. 8/28/2009 9:37AM
      if($debuginv)
         messageall(1,"Trigger(s) ="@%object.invtrigger);
      
      if($debug || $debuginv || $debugt)
      {
         echo("InvTrigger::onEnter "@%obj@" Damage state,"@GameBase::getDamageState(%obj)@", Powered,"@GameBase::isPowered(%obj)@" client,"@%client);
         echo("Left turret active"@%obj.lTurret@", "@GameBase::isActive(%obj.lTurret)@ " energy="@GameBase::getEnergy(%obj.lTurret)@ " right turret active"@%obj.rTurret@", "@GameBase::isActive(%obj.rTurret)@ " energy="@GameBase::getEnergy(%obj.rTurret));
      }
      if((GameBase::getTeam(%object) == GameBase::getTeam(%obj) || GameBase::getTeam(%obj) == -1) && %client.isSpy != true)
      {
         %client.InvTargetable = true;   //moved here in 3.0, station won't fire if unpowered.. -Plas 3.0
         if(GameBase::getDamageState(%obj) == "Enabled")
         {
            if(GameBase::isPowered(%obj))
            {
               
               gamebase::setactive(%obj.lTurret,true);   //just to make certain.. gets changed on drop ship destroy.. for some damn reason..
               gamebase::setactive(%obj.rTurret,true);
               GameBase::setRechargeRate(%obj.lTurret,100);
               GameBase::setRechargeRate(%obj.rTurret,100);                  
                           
               //plas 3.0
               if(!$Annihilation::Zappy)
               {
                  %Client.InvConnect = true;
                  %client.ListType = "InvList";
                  GameBase::playSound(%object, SoundActivatePDA,0);
                  Client::sendMessage(%client,3,"..Inventory Uplink established..");
                  QuickInv(%client);
                  schedule("ZappyResupply(" @ %client @ ");",0.25);   
               }
            }
         }         
         else
         {
            gamebase::setactive(%obj.lTurret,false);   //just to make certain.. gets changed on drop ship destroy.. for some damn reason..
            gamebase::setactive(%obj.rTurret,false);
            GameBase::setRechargeRate(%obj.lTurret,100);
            GameBase::setRechargeRate(%obj.rTurret,100);   
         }         
      }      
   }
}


// Fix for overlaping Zappy Inv triggers 3/23/2007 4:21AM Plasamtic
// made easier by the.. Infinite Zappy fix 3/17/2007 6:46AM
function InvTrigger::onLeave(%this,%object)
{
   %type = getObjectType(%object);
   if(%type == "Player")
   {
      if(Player::isAIControlled(%object))
         return;
      
      %client = GameBase::getOwnerClient(%object);
            
      %TrigPos = Gamebase::getPosition(%this);
      %PlPos = getBoxCenter(%object);   
      %dist = vector::getdistance(%PlPos,%TrigPos);      
      if(%dist > 3)
      {
         %object.invtrigger--;   // Leeloo Dallas multipass fix. 8/28/2009 9:37AM
         if($debuginv)
            messageall(1,"Trigger(s) ="@%object.invtrigger);
         %client.ConnectBeam = "";
         
         %PlayerStation = %object.InvObject;
         %TriggerStation = %this.owner;
         if(%PlayerStation == %TriggerStation || %object.invtrigger < 1)
         {
            if($debug || $debuginv || $debugt)
            {
               echo("InvTrigger::onLeave, client= "@%client@" Dist= "@%dist);
            }
            
            
            
            %client.ConnectBeam = "";   //internal
            %client.InvTargetable = "";   //internal
            %Client.InvConnect = "";   //external   
            QuickInvOff(%client);   
            %object.ZappyResupply = "";
            %client.ListType = "";
         }
         else
         {
            //For the odd time 2 triggers overlap.. 3/23/2007 4:21AM Plasamtic
            // fire up the new triggers inventory station.
      
            %client.ConnectBeam = "";   //internal
            if((GameBase::getTeam(%object) == GameBase::getTeam(%PlayerStation) || GameBase::getTeam(%PlayerStation) == -1) && %client.isSpy != true)
            {
               %client.InvTargetable = true;   //moved here in 3.0, station won't fire if unpowered.. -Plas 3.0
               if(GameBase::getDamageState(%PlayerStation) == "Enabled")
               {
                  if(GameBase::isPowered(%PlayerStation))
                  {
                     gamebase::setactive(%PlayerStation.lTurret,true);   //just to make certain.. gets changed on drop ship destroy.. for some damn reason..
                     gamebase::setactive(%PlayerStation.rTurret,true);
                     GameBase::setRechargeRate(%PlayerStation.lTurret,100);
                     GameBase::setRechargeRate(%PlayerStation.rTurret,100);                  
                     Client::sendMessage(%client,3,"..Attempting Uplink transfer..");   //3/23/2007 4:41AM For overlaping triggers. -Plasmatic   
               
                     //   //plas 3.0
                     if(!$Annihilation::Zappy)
                     {
                        %Client.InvConnect = true;
                        %client.ListType = "InvList";
                        GameBase::playSound(%object, SoundActivatePDA,0);
                        Client::sendMessage(%client,3,"..Inventory Uplink established..");
                        QuickInv(%client);
                        schedule("ZappyResupply(" @ %client @ ");",0.25);   
                     }
                  }
               }         
               else
               {
                  gamebase::setactive(%PlayerStation.lTurret,false);   //just to make certain.. gets changed on drop ship destroy.. for some damn reason..
                  gamebase::setactive(%PlayerStation.rTurret,false);
                  GameBase::setRechargeRate(%PlayerStation.lTurret,100);
                  GameBase::setRechargeRate(%PlayerStation.rTurret,100);   
               }         
            }
         }   
      }
   }
}


function MobileInventory::onCollision(%this, %object)    // Was MobileStation   8/28/2009 10:33AM Plasmatic
{   
   if($trace)
      echo($ver,"| MobileStation::onCollision ",%this);
   if($debug)
      event::collision(%this,%object);
   if(%object.testing)   //Plasmatic -Portal gun 11/20/2007 11:45PM
      return;
   if(%this.cloaked > 0 && getObjectType(%object) == "Player"){
      GameBase::startFadein(%this);   
      %this.cloaked = "";
      }//pop this visible for a second -plasmatic
   if(%this.target == ""){
      dbecho(3, "STATION: Collision (" @ %this @ "," @ %object @ ")");
      %obj = getObjectType(%object);

      if(%obj == "Player" && isPlayerBusy(%object) == 0)
      {
         %client = Player::getClient(%object);
         if((GameBase::getTeam(%object) == GameBase::getTeam(%this) || GameBase::getTeam(%this) == -1) && %client.isSpy != true)
         {
            if(GameBase::getDamageState(%this) == "Enabled")
            {
               if(GameBase::isPowered(%this))
               {
                  
                  
                  if(%this.enterTime == "")
                     %this.enterTime = getSimTime();
                  GameBase::setActive(%this,true);
               }
               else
                  Client::sendMessage(%client,0,"Unit is not powered");
            }
            else
               Client::sendMessage(%client,0,"Unit is disabled");
         }
         else if(Station::getTarget(%this) == %object)
         {
            %curTime = getSimTime();
            if(%curTime - %object.stationDeniedStamp > 3.5 && GameBase::getDamageState(%this) == "Enabled")
            {
               Client::clearItemShopping(%client);
               Station::onDeactivate(%this);
               Station::onEndSequence(%this,1);
               if(Client::getGuiMode(%client) != 1)
                  Client::setGuiMode(%client,1);
               %object.stationDeniedStamp = %curTime;
               Client::sendMessage(%client,0,"--ACCESS DENIED-- Wrong Team ~waccess_denied.wav");
            }
         }
      }
   }
}



function MobileInventory::onDestroyed(%this)
{
   if($trace)
      echo($ver,"| MobileInventory::onDestroyed");
   MobileInventory::onDisabled(%this);
   
   GameBase::setEnergy(%this.lTurret,0);   //Infinite Zappy fix Plasmatic 3/17/2007 6:49AM
   GameBase::setDamageLevel(%this.lTurret,1100);   //plasm 3.0
   GameBase::setEnergy(%this.rTurret,0);   //Infinite Zappy fix Plasmatic 3/17/2007 6:49AM
   GameBase::setDamageLevel(%this.rTurret,1100);   
   
   //Infinite Zappy fix Plasmatic 3/17/2007 7:03AM
   for(%cl = Client::getFirst(); %cl != -1; %cl = Client::getNext(%cl))
   {
      %player = Client::getOwnedObject(%cl);
      if(%player.InvObject == %this)
      {
         %cl.ConnectBeam = "";   //internal
         %cl.InvTargetable = "";   //internal
         %Cl.InvConnect = "";   //external   
         QuickInvOff(%cl);   
         %player.ZappyResupply = "";
         %cl.ListType = "";
      }
   }
         
   %this.cloakable = "";
   %this.nuetron = "";
   StaticShape::objectiveDestroyed(%this);
   if(!$NoCalcDamage)
      calcRadiusDamage(%this, $DebrisDamageType, 2.5, 0.05, 25, 13, 3, 0.55, 0.30, 250, 170);
   $TeamItemCount[GameBase::getTeam(%this) @ "MobileInventoryPack"]--;
   
   %trigger = %this.trigger;   

   // Leeloo Dallas multipass fix. 8/28/2009 11:36AM
   %set = newObject("set",SimSet);
   %pos = GameBase::getPosition(%trigger);
   %num = containerBoxFillSet(%set,$SimPlayerObjectType,%pos,4,4,4,0);
   %totalnum = Group::objectCount(%set);
   
   for(%i = 0; %i < %totalnum; %i++)
   {
      %obj = Group::getObject(%set, %i);
      %p = GameBase::getPosition(%obj);
      %dist = Vector::getDistance(%pos, %p);
      if(%dist < 3)
         %obj.invtrigger--;

   }
   deleteObject(%set);

   Schedule("deleteobject("@%trigger@");",0.1);
}

//Updated 3/17/2007 6:56AM
function InventoryCharge::damageTarget(%target, %timeSlice, %damPerSec, %enDrainPerSec, %pos, %vec, %mom, %shooterId)
{
   // verify player is within sight of coresponding inventory -invs not covered with blast walls..   
   // could do this with a diffrent damage type, but this would have to be in player::ondamage

   %client = GameBase::getOwnerClient(%target);
   %client.ConnectBeam ++;   // Leeloo Dallas multipass fix. 8/28/2009 11:36AM
   
   //Lightning projectiles are not deleted when firing object is destroyed. Yay.
   //Infinite Zappy fix 3/17/2007 6:46AM
   //Scratch that. Setting turret energy to 0 just before destroy deletes it. -Plasmatic
   //love it, Leaving fix in for redundancy.
   //Scratch that.. In some cases you can get around the check. Redundancy is good.
   %InvObject = %target.InvObject;
   %InvPos = gamebase::getposition(%InvObject);
   //client::sendmessage(%client,0,"Inv zappy "@%client.InvTargetable@", InvStation ="@%InvPos);
   if(%client.InvTargetable && %InvPos != "0 0 0")
   {
      if(!%Client.InvConnect)
      {   
         Client::sendMessage(%client,3,"..Inventory Uplink established..");
         
         QuickInv(%client);
         schedule("ZappyResupply(" @ %client @ ");",0.25);
         GameBase::playSound(%target, SoundActivatePDA,0);
               
      }
            
      %client.InvConnect = true;
      %client.ListType = "InvList";
   
   }
   else
   {
//      %client.ConnectBeam = "";   //internal
      %client.InvTargetable = "";   //internal
      %Client.InvConnect = "";   //external   
      QuickInvOff(%client);   
      %object.ZappyResupply = "";
      %client.ListType = "";      
   }
}

function InvTurret::verifyTarget(%this,%target)
{
   if(!$Annihilation::ExtendedInvs || !$Annihilation::Zappy)
      return false;
   
   %client = GameBase::getOwnerClient(%target);
   %control = GameBase::getControlClient(%target);
   // was a little funkyness (cheat hole) with turrets damaging vehicles and giving inv to owner.
   // owner would not lose inv when leaving trigger -the vehicle would.. added the '%control' check for 2.2 -plasmatic
   if(!%client.InvTargetable || %client.ConnectBeam > 60 || %control == -1)
      return "False";
      
   //meh, lets do a double power check here.. plasm 3.0
   %owner = %this.Owner;
   if(!GameBase::isPowered(%Owner) || GameBase::getDamageState(%Owner) != "Enabled") // notice the big O... heh heh eeeheh heh.. -Plasmatic 3.0
      return false;
   
   else return true;
}
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

3 Sat Aug 29, 2009 9:28 am

Blakhart
The ultimate Iowigger!
 
Posts: 1615

4 Mon Aug 31, 2009 8:53 am

does this fix the gobal inv 100%?? you covered it all??
bawb
Commander
Commander
 
Posts: 1203

5 Mon Aug 31, 2009 11:55 am

I was able to break it in a patched Annihilation server yesterday, but he had other modified code... Try it out in Blue Sex.
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

6 Mon Aug 31, 2009 7:33 pm

Plasmatic wrote:I was able to break it in a patched Annihilation server yesterday, but he had other modified code... Try it out in Blue Sex.


if you can't fix it just make it a "feature"
of course you'd have to re-break what you've fixed up to now

:browsmile:
Quimica
Call me Mr. Picky.
 
Posts: 1333

7 Mon Aug 31, 2009 10:39 pm

It's fixed, but I'm not 100% sure the patch works in all the busted up code out there. :evil:
User avatar
Plasmatic
Lead Developer
Lead Developer
 
Posts: 8375

8 Tue Sep 01, 2009 6:02 pm

Plasmatic wrote:It's fixed, but I'm not 100% sure the patch works in all the busted up code out there. :evil:

Luckily most people break a mod completely when they start screwing around with it. Some people though, are able to muddle through and really screw things up.
Quimica
Call me Mr. Picky.
 
Posts: 1333

9 Wed Dec 23, 2009 2:22 pm

<--
S_hift
Lt Commander
Lt Commander
 
Posts: 497


Return to News

Who is online

Users browsing this forum: No registered users and 1 guest

cron