Solid Map Boundaries?

Hey everyone, KoRo here,
Back a few years ago when I was testing out server hosting capabilities (anyone remember KoRo's Konstruction? lol), I was trying to figure out a way to make the map boundaries solid so that instead of flying out of bounds, you would bounce back in...

I know the devs for Team Rabbit 2 were able to do this, but I have no idea how. Does anyone here know if that's possible to do?

Thanks
Koro

Comments

  • I had a look in lakrabbit, as it has it too.
    // borlak -- TAKEN FROM TR2 -- thanks! :D
    function bounceOffGrid(%obj, %bounceForce)
    {
    	if (%bounceForce $= "")
    		%bounceForce = 65;
          
    	%oldVel = %obj.getVelocity();
    	%obj.setVelocity("0 0 0");
    
    	%vecx = firstWord(%oldVel);
    	%vecy = getWord(%oldVel, 1);
    	%vecz = getWord(%oldVel, 2);
    
    	%shapePos = %obj.getPosition();
    	%shapex = firstWord(%shapePos);
    	%shapey = getWord(%shapePos, 1);
    	%bounds = MissionArea.area;
    	%boundsWest = firstWord(%bounds);
    	%boundsNorth = getWord(%bounds, 1);
    	%boundsEast = %boundsWest + getWord(%bounds, 2);
    	%boundsSouth = %boundsNorth + getWord(%bounds, 3);
    
    	// Two cases:  1) object is at E or W side; 2) object is at N or S side
    	if((%shapex <= %boundsWest) || (%shapex >= %boundsEast))
    		%vecx = -%vecx;
    	else
    		%vecy = -%vecy;
    
    	%vec = %vecx SPC %vecy SPC %vecz;
    
    	// If the object's speed was pretty slow, give it a boost
    	%oldSpeed = VectorLen(%oldVel);
    	if (%oldSpeed < 25)
    	{
    		%vec = VectorNormalize(%vec);
    		%vec = VectorScale(%vec, 25);
    	}
    	else
    		%vec = VectorScale(%vec, 1.15);
    
    	// apply the impulse to the object
    	//%obj.applyImpulse(%obj.getWorldBoxCenter(), %vec);
    	%obj.setVelocity(%vec);
    }
    function isOutOfBounds(%position)
    {
    	%shapePos = %position;
    	%shapex = firstWord(%shapePos);
    	%shapey = getWord(%shapePos, 1);
    	%bounds = MissionArea.area;
    	%boundsWest = firstWord(%bounds);
    	%boundsNorth = getWord(%bounds, 1);
    	%boundsEast = %boundsWest + getWord(%bounds, 2);
    	%boundsSouth = %boundsNorth + getWord(%bounds, 3);
       
    	return (%shapex < %boundsWest  || %shapex > %boundsEast ||
    		%shapey < %boundsNorth || %shapey > %boundsSouth);
    }
    function getHeight(%this)
    {
    	%z = getWord(%this.getPosition(), 2);
    	return mFloor((%z - getTerrainHeight(%this.getPosition())));
    }
    
    function LakRabbitGame::leaveMissionArea(%game, %playerData, %player)
    {
    	bounceOffGrid(%player, 65);
    	return;
    	
       if(%player.getState() $= "Dead")
          return;
       
       %player.client.outOfBounds = true;
       if (%player.client.team == $RabbitTeam)
          messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area. Return or take damage.~wfx/misc/warning_beep.wav');
       else
          messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area.~wfx/misc/warning_beep.wav');
       logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
       %player.alertThread = %game.schedule(1000, "AlertPlayer", 3, %player);
    }
    
    function LakRabbitGame::AlertPlayer(%game, %count, %player)
    {
       if (%player.client.team == $RabbitTeam)
       {
          if(%count > 1)
             %player.alertThread = %game.schedule(1000, "AlertPlayer", %count - 1, %player);
          else 
             %player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
       }
    
       //keep the thread going for non rabbits, but give the new rabbit time to return to the mission area...
       else
          %player.alertThread = %game.schedule(1000, "AlertPlayer", 3, %player);
    }
    
    function LakRabbitGame::MissionAreaDamage(%game, %player)
    {
       if(%player.getState() !$= "Dead") {                                   
          %player.setDamageFlash(0.1);
    		%damageRate = 0.10;
    		%pack = %player.getMountedImage($BackpackSlot);
    		if(%pack.getName() $= "RepairPackImage")
    			if(%player.getMountedImage($WeaponSlot).getName() $= "RepairGunImage")
    				%damageRate = 0.20;
          %prevHurt = %player.getDamageLevel();
          %player.setDamageLevel(%prevHurt + %damageRate);
          // a little redundancy to see if the lastest damage killed the player
          if(%player.getState() $= "Dead")
             %game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
          else
             %player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
       }
       else  
       {
          %game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
       }
    
    I think all you need is that.
  • Yah except it has references to the lakrabbit gametype, so he'll have to modify it.
  • Lawlz, got an image of Eolk implimenting that, and nukey not knowing, and him running into the boundary in an Airwing and bouncing back. "WTF!? O.o" lol
  • (laughing too hard to type properly)
  • Lawlz, got an image of Eolk implimenting that, and nukey not knowing, and him running into the boundary in an Airwing and bouncing back. "WTF!? O.o" lol

    I wouldn't be surprised if Eolk did that...
  • I always cheated on lakrabbit servers with that option by taking the flag, then, using an exploit with bouncy grids to land myself out of bounds and win.
  • .

    ..
    .

    ..
    .
    .
    .
    • post.jpg
  • Nice. Thanks a lot, everyone. The Construction community has always been full of winners......

    /me remembers Fujisawa, Eek'n'Ike, Antman, Kibiloski, Zonkman, Foocumber, and of course....(TPC)Shoot-Me, hosting the most popular server from waaaaaay back when (5+ years I think now?)
Sign In or Register to comment.