//***************************************************************
// Copyright 2008 Centre For Advanced Spatial Analysis, UCL
//
// Author: Joel Dearden, University College London
//
// Contact: j.dearden@ucl.ac.uk
//
// Joel Dearden,
// Centre for Advanced Spatial Analysis,
// University College London,
// 1-19 Torrington Place,
// London,
// WC1E 7HB
//
//
// This file is part of SLPedEvac.
//
// SLPedEvac is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// SLPedEvac is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SLPedEvac. If not, see .
//
//***************************************************************
integer talk_channel = -1;
//integer maxMoveDist = 5;
//float timeToTarget = 20;
float lifetime = 40.0; //seconds
list interestingObjects = ["exit", "staircaseEntry", "exitSign", "wall", "floor"];
//vector startPos; //set on rez
default
{
state_entry()
{
//set physical and phantom
llSetStatus( STATUS_PHANTOM | STATUS_PHYSICS, TRUE);
//set buoyant
llSetBuoyancy(1.0);
llVolumeDetect(TRUE);
}
collision_start( integer num_detected )
{
//found something
string name = llDetectedName(0);
//is it interesting?
if(llListFindList(interestingObjects, (list)name) != -1)
{
//collision info: :
llRegionSay(talk_channel, name + ":" + (string)llDetectedPos(0));
llDie();
}
}
collision_end( integer num_detected )
{
//found something
string name = llDetectedName(0);
//is it interesting?
if(llListFindList(interestingObjects, (list)name) != -1)
{
//collision info: :
llRegionSay(talk_channel, name + ":" + (string)llDetectedPos(0));
llDie();
}
}
//at_target( integer tnum, vector targetpos, vector ourpos )
//{
//nothing detected
// llRegionSay(talk_channel, "X");
// llDie();
//}
on_rez(integer start_param)
{
talk_channel = start_param;
llSetTimerEvent(lifetime);
//save start position
//startPos = llGetPos();
//calculate target position
//ray caster should have rezzed this ray with correct
//rotation so that +ve Y-axis is facing in direction of travel
//vector distanceVector = <0, maxMoveDist, 0>;
//llOwnerSay("dv:" + (string)distanceVector);
//vector rotatedDistanceVector = distanceVector * llGetRot();
//llOwnerSay("rdv:" + (string)rotatedDistanceVector);
//save target position
//vector targetPos = startPos + rotatedDistanceVector;
//llOwnerSay("tp:" + (string)targetPos);
//calculate target
//llMoveToTarget(targetPos, timeToTarget);
//llTarget(targetPos, 1);
}
timer()
{
llRegionSay(talk_channel, "X");
llDie();
}
}