Blockland Forums > Suggestions & Requests
OnVehicleClicked
MARBLE MAN:
RegisterInputEvent(fxDtsBrick, "onVehicleClicked", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");
package clickVehicle
{
function Player::ActivateStuff(%obj)
{
Parent::ActivateStuff(%obj);
%ray = containerRaycast(%obj.getEyePoint(),vectorAdd(%obj.getEyePoint(),vectorScale(%obj.getEyeVector(),10)),%mask,%obj);
if(isObject(%col=firstWord(%ray))
if(%col.getClassName()$="Vehicle")
%col.onClick(%obj);
}
};
activatepackage(clickVehicle);
function Vehicle::onClick(%obj,%player)
{
if(!isObject(%obj.spawnBrick))
return;
$InputTarget_["Self"] = %obj.spawnBrick;
$InputTarget_["Player"] = %player;
$InputTarget_["Client"] = %player.client;
$InputTarget_["Minigame"] = %player.client.minigame;
%obj.spawnbrick.processInputEvent("onVehicleClicked", %player.client);
}
untested
TB2:
Oh, wow. Thanks!
(I will package it, but am leaving topic unlocked for further discussion.)
TB2:
I can just package that to an event?
MARBLE MAN:
--- Quote from: TB2 on October 26, 2013, 06:27:10 PM ---I can just package that to an event?
--- End quote ---
yes, put it in a server.cs
and add a description.txt
MARBLE MAN:
TIL i could have made this better:
Vehicle::OnActivate(%vehicle, %activatingObj, %activatingClient, %pos, %vec)