package GoKartPackage {
function VehicleData::onEnterLiquid(%data, %obj, %coverage, %type) {
Parent::onEnterLiquid(%data, %obj, %coverage, %type);
if(isObject(%obj.lastTouched)) {
%selection = %obj.lastTouched;
%x = getWord(%selection.getPosition(),0);
%y = getWord(%selection.getPosition(),1);
%z = getWord(%selection.getPosition(),2);
%z_add = %z + %selection.getDatablock().brickSizeZ/6;
%rot = getWord(%obj.lastTransform,6);
%obj.setVelocity("0 0 0");
%obj.setTransform(getWords(%obj.lastTransform,0,2) SPC "0 0 1" SPC %rot);
%obj.setVelocity("0 0 0");
} else {
// something has gone wrong, just explode them.
%obj.finalExplosion();
}
}
function GameConnection::spawnPlayer(%this) {
parent::spawnPlayer(%this);
for(%i=1;%i<=42;%i++) {
%brick = "_vehicle_spawn" @ %i;
if(!%brick.isUsed) {
%brick.isUsed = 1;
%brick.setVehicle(SpeedKartclassicgtVehicle.getID());
%this.player.delete();
%this.player = %brick.vehicle;
%this.setControlObject(%brick.vehicle);
return;
}
}
}
function Vehicle::onRemove(%this) {
%this.dump();
%this.spawnBrick.isUsed = 0;
%client = %this.getControllingClient();
%client.setControlObject(%client.Camera);
parent::onRemove(%this);
}
};
activatePackage(GoKartPackage);
Upon landing in water (should default to the else part), Blockland crashes.
If everything in onRemove is commented out, minus the parent, it's fine. What's going on?