I'm trying to make a script that processes the input event onRelay on any bricks within a radius, I'm using a containerRadiusSearch to do this, and it doesn't seem to work. It only activates on the brick that the search is started at.
I tried processing a single brick in the console, and no matter what I did, it'd just process it on the brick that did the radius search, even when it wasn't included.
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("Max. Radius","radiusRelay","$Pref::RadiusRelay::MaxRadius","int 1 100","Event_RadiusRelay", 32, 1, 1);
RTB_registerPref("Admin Only","radiusRelay","$Pref::RadiusRelay::AdminOnly","bool","Event_RadiusRelay", 0, 0, 1);
}
registerOutputEvent("fxDTSBrick", "radiusRelay", "int 0 "@$Pref::RadiusRelay::MaxRadius@" 0", 1);
function fxDTSBrick::radiusRelay(%brick, %radius, %client)
{
if(%radius > $Pref::RadiusRelay::MaxRadius)
%radius = $Pref::RadiusRelay::MaxRadius;
if(%radius <= 0)
return;
if($Pref::RadiusRelay::AdminOnly && (!%client.isAdmin && !%client.isSuperAdmin))
return;
%pos = %brick.position;
initContainerRadiusSearch(%pos, %radius, $TypeMasks::FxBrickObjectType);
for(%i = containerSearchNext(); %i != 0; %i = containerSearchNext())
{
if(%i != %brick)
%i.processInputEvent("OnRelay", %i);
}
}