/*//-- dodecahedron rotations --//*/
list gLstDir = [
< 0.000000, 0.000000, 1.000000, 0.000000 >,
<-0.000000, 0.262846, 0.808951, 0.525842 >,
< 0.000000, 0.850583, 0.000000, 0.525841 >,
< 0.000000, 0.262846, -0.808951, 0.525842 >,
< 0.000000, -0.688110, -0.499994, 0.525843 >,
< 0.000000, -0.688135, 0.499960, 0.525842 >,
< 0.000000, -0.162495, 0.500105, 0.850582 >,
<-0.000000, 0.425401, 0.309104, 0.850581 >,
< 0.000000, 0.425415, -0.309083, 0.850582 >,
< 0.000000, -0.162495, -0.500105, 0.850582 >,
< 0.000000, -0.525841, 0.000000, 0.850583 >,
< 0.000000, 0.000000, 0.000000, 1.000000 >
];
integer gIdxCnt;
rotation gRotBas;
float gRadSns;
list gLstRpt;
uSensorExpansion()
{
if (gIdxCnt)
{
/*//-- Set rotation before we call the sensor --//*/
llSetLocalRot( llList2Rot( gLstDir, gIdxCnt++ ) );
llSensor( "", "", PASSIVE|ACTIVE, 95, gRadSns );
}
else
{
/*//-- we called all our Sensors, now report the findings --//*/
llOwnerSay( (string)((gLstRpt != []) / 2) + " Objects detected:\n" );
/*//-- (gLstRpt != []) == llGetListLength( gLstRpt ) --//*/
gIdxCnt = ([] != gLstRpt);
/*//-- ([] != gLstRpt) == -llGetListLength( gLstRpt ) --//*/
while (gIdxCnt)
{
llOwnerSay( "\nName: " + llList2String( gLstRpt, gIdxCnt++ ) + "\n @ " + llList2String( gLstRpt, gIdxCnt++ ) );
}
/*//-- we're done, clear our list --//*/
gLstRpt = [];
}
}
default
{
state_entry()
{
llOwnerSay( "Touch Me to Start" );
gRotBas = llGetLocalRot();
gRadSns = llAngleBetween( llList2Rot( gLstDir, 0 ), llList2Rot( gLstDir, 0 ) ) / 2.0;
}
touch_start( integer vInt )
{
gIdxCnt = ([] != gLstDir);
uSensorExpansion();
}
sensor( integer vIntTotal )
{
list vLstTmp;
/*//-- loop backwards to reduce variables --//*/
while (vIntTotal--)
{
/*//-- don't use (--vIntTotal), we want to subtract AFTER checking --//*/
vLstTmp = [llDetectedPos( vIntTotal ), llDetectedName( vIntTotal )];
/*//-- is it NOT in our list already --//*/
if (!~llListFindList( gLstRpt, vLstTmp ))
{
/*//-- (!~llListFindList()) == (llListFindList() = -1) --//*/
gLstRpt += vLstTmp;
}
}
uSensorExpansion();
}
no_sensor()
{
uSensorExpansion();
}
}