
modular.core
integer cmdchannel=2;
integer datachannel=-72492424;
list segmentlist;
rotation lastrot;
deployall(){
integer i;
for(i=0;i<llGetListLength(segmentlist);i++){
llRezObject(llList2String(segmentlist,i),llGetPos(),ZERO_VECTOR,ZERO_ROTATION,datachannel);
}
llSleep(0.5);
llShout(datachannel,"reorient");
}
default{
state_entry(){
llListen(cmdchannel,"",llGetOwner(),"");
llListen(datachannel,"","","");
lastrot=llGetRot();
llSetTimerEvent(1);
}
listen(integer chan,string who,key id,string msg){
if(chan==cmdchannel){
if(msg=="compile"){
if(llGetObjectName()=="Object")
llOwnerSay("It is advisable that you change this core object's name and compile again.");
else{
segmentlist=[];
llShout(datachannel,"compilelist");
}
}
else if(msg=="deploy"){
llShout(datachannel,"x");
deployall();
}
}
else if(chan==datachannel){
segmentlist+=msg;
}
}
timer(){
if(llGetRot()!=lastrot){
lastrot=llGetRot();
llShout(datachannel,"reorient");
}
}
moving_end(){
llShout(datachannel,"reorient");
}
}