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
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
// 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.I wouldn't be surprised if Eolk did that...
..
.
..
.
.
.
/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?)