//*************************************************************** // 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 talkToBuilder = -9292921; integer talkToBuildingComponents = -8927211; integer controllerReceiveChannel = -293321; vector startPos; //central position above the building - *this must be set manually* //all below set relative to startPos vector firstFloorCentre; vector groundFloorCentre; vector firstFloorCornerA; vector firstFloorCornerB; vector firstFloorCornerC; vector firstFloorCornerD; vector groundFloorCornerA; vector groundFloorCornerB; vector groundFloorCornerC; vector groundFloorCornerD; vector groundFloorCornerADMidpoint; float verticalFloorSeparation = 12.0; //metres float halfFloorLength = 10.0; //metres float wallHeight = 1.5; //metres moveToPos(vector pos) { //gets over 10m limit of movement while(llGetPos() != pos) { llSetPos(pos); } } place_ground_floor_pedestrians() { moveToPos(groundFloorCentre); integer x; integer y; //25 for(x = -6; x < -1; x++) { for(y = -6; y < -1; y++) { llRezObject("pedestrian", llGetPos() + , <0,0,0>, llEuler2Rot(<0,0,0>), 0); } } //15 for(x = 2; x < 5; x++) { for(y = -6; y < -1; y++) { llRezObject("pedestrian", llGetPos() + , <0,0,0>, llEuler2Rot(<0,0,0>), 0); } } //10 for(x = 2; x < 7; x++) { for(y = 2; y < 4; y++) { llRezObject("pedestrian", llGetPos() + , <0,0,0>, llEuler2Rot(<0,0,0>), 0); } } } place_first_floor_pedestrians() { moveToPos(firstFloorCentre); integer x; integer y; //25 for(x = -4; x < 1; x++) { for(y = -6; y < -1; y++) { llRezObject("pedestrian", llGetPos() + , <0,0,0>, llEuler2Rot(<0,0,0>), 0); } } //20 for(x = -5; x < 5; x++) { for(y = 6; y < 8; y++) { llRezObject("pedestrian", llGetPos() + , <0,0,0>, llEuler2Rot(<0,0,0>), 0); } } //5 for(x = 6; x < 7; x++) { for(y = -5; y < 0; y++) { llRezObject("pedestrian", llGetPos() + , <0,0,0>, llEuler2Rot(<0,0,0>), 0); } } } build_ground_floor_detail() { moveToPos(groundFloorCentre); llRezObject("furniture_table", llGetPos() + <-5,4,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <-2,1,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <5,-5,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <2,-7,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <7,-7,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); } build_first_floor_detail() { moveToPos(firstFloorCentre); llRezObject("furniture_table", llGetPos() + <-5,3,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <-7,0,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <-5,-3,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <3,3,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <6,0,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("furniture_table", llGetPos() + <4,-3,0.5>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); } build_ground_floor_internal_walls_for_single_storey() { //move to corner 1 and rez components moveToPos(groundFloorCentre); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <3.5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 7); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <3.5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 7); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez exit route signs llRezObject("exitSign", llGetPos() + <-2,7,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,(6*PI)/4>), 0); llRezObject("exitSign", llGetPos() + <-2,-7,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("exitSign", llGetPos() + <2,-7,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("exitSign", llGetPos() + <8.5,2,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,(6*PI)/4>), 0); llRezObject("exitSign", llGetPos() + <8.5,-2,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,(6*PI)/4>), 0); } build_ground_floor_internal_walls_for_multi_storey() { //move to corner 1 and rez components moveToPos(groundFloorCentre); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <3.5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 7); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <3.5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 7); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez exit route signs llRezObject("exitSign", llGetPos() + <-2,7,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,(6*PI)/4>), 0); llRezObject("exitSign", llGetPos() + <-2,-7,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); llRezObject("exitSign", llGetPos() + <2,-7,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); moveToPos(groundFloorCornerD); llRezObject("exitSign", llGetPos() + <-2,2,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,PI/4>), 0); } build_ground_floor() { //move to corner 1 and rez components moveToPos(groundFloorCornerA); //rez one floor llRezObject("floor", llGetPos() + <-5,-5,-1>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <-5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <-5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,-5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,-5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez exit llRezObject("exit", llGetPos() + <-7,-1,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,-PI/2>), 0); //move to corner 2 and rez components moveToPos(groundFloorCornerB); //rez one floor llRezObject("floor", llGetPos() + <5,-5,-1>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,-5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,-5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //move to corner 3 and rez components moveToPos(groundFloorCornerC); //rez one floor llRezObject("floor", llGetPos() + <5,5,-1>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //move to corner 4 and rez components moveToPos(groundFloorCornerD); //rez one floor llRezObject("floor", llGetPos() + <-5,5,-1>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <-5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <-5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); } build_staircase() { moveToPos(firstFloorCornerA); //rez staircase entry llRezObject("staircaseEntry", llGetPos() + <-1,-1,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez route signs llRezObject("exitSign", llGetPos() + <-5,-1,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,(6*PI)/4>), 0); llRezObject("exitSign", llGetPos() + <-5,-8,2*wallHeight>, <0,0,0>, llEuler2Rot(<0,0,(6*PI)/4>), 0); //rez dummy staircase entance llRezObject("staircase dummy", llGetPos() + <-2,-5,wallHeight>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <-2,-7,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 5); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <-2,-7,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 5); //rez wall 2 layer 1 llRezObject("wall", llGetPos() + <-4,-5.5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 4); //rez wall 2 layer 2 llRezObject("wall", llGetPos() + <-4,-5.5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 4); //move to corner 1 and rez components moveToPos(groundFloorCornerA); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <-3,-5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <-3,-5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 3 llRezObject("wall", llGetPos() + <-3,-5,(5*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 4 llRezObject("wall", llGetPos() + <-3,-5,(7*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //move to corner 4 and rez components moveToPos(groundFloorCornerD); //rez wall 2 layer 1 llRezObject("wall", llGetPos() + <-3,7.5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 5); //rez wall 2 layer 2 llRezObject("wall", llGetPos() + <-3,7.5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 5); //rez wall 2 layer 3 llRezObject("wall", llGetPos() + <-3,7.5,(5*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 5); //rez wall 2 layer 4 llRezObject("wall", llGetPos() + <-3,7.5,(7*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 5); //rez high outside walls moveToPos(groundFloorCornerA); //rez wall 1 layer 3 llRezObject("wall", llGetPos() + <0,-5,(5*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 4 llRezObject("wall", llGetPos() + <0,-5,(7*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); moveToPos(groundFloorCornerD); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,5,(5*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,5,(7*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez start, steps and end moveToPos(groundFloorCornerADMidpoint); llRezObject("staircaseStart", llGetPos() + <-1.5,4.2,5.8>, <0,0,0>, llEuler2Rot(<0,0,PI>), 0); llRezObject("staircase steps", llGetPos() + <-1.5,3.2,4>, <0,0,0>, llEuler2Rot(<0,0,PI>), 0); llRezObject("staircase steps", llGetPos() + <-1.5,1.6,3>, <0,0,0>, llEuler2Rot(<0,0,PI>), 0); llRezObject("staircase steps", llGetPos() + <-1.5,0,2>, <0,0,0>, llEuler2Rot(<0,0,PI>), 0); llRezObject("staircase steps", llGetPos() + <-1.5,-1.6,1>, <0,0,0>, llEuler2Rot(<0,0,PI>), 0); llRezObject("staircase steps", llGetPos() + <-1.5,-3.2,0>, <0,0,0>, llEuler2Rot(<0,0,PI>), 0); llRezObject("staircaseEnd", llGetPos() + <-1.5,-4.2,1>, <0,0,0>, llEuler2Rot(<0,0,PI>), 0); } build_first_floor() { //move to corner 1 and rez components moveToPos(firstFloorCornerA); //rez one floor llRezObject("floor", llGetPos() + <-5,-5,-1>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <-5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <-5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,-5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,-5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //move to corner 2 and rez components moveToPos(firstFloorCornerB); //rez one floor llRezObject("floor", llGetPos() + <5,-5,-1>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,-5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,-5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //move to corner 3 and rez components moveToPos(firstFloorCornerC); //rez one floor llRezObject("floor", llGetPos() + <5,5,-1>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //move to corner 4 and rez components moveToPos(firstFloorCornerD); //rez one floor llRezObject("floor", llGetPos() + <-5,5,-1>, <0,0,0>, llEuler2Rot(<0,0,0>), 0); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <-5,0,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <-5,0,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,PI/2>), 10); //rez wall 1 layer 1 llRezObject("wall", llGetPos() + <0,5,wallHeight/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); //rez wall 1 layer 2 llRezObject("wall", llGetPos() + <0,5,(3*wallHeight)/2>, <0,0,0>, llEuler2Rot(<0,0,0>), 10); } build_simple() { //single floor bare room build_ground_floor(); place_ground_floor_pedestrians(); moveToPos(startPos); } build_complicated() { build_ground_floor(); build_ground_floor_internal_walls_for_single_storey(); build_ground_floor_detail(); place_ground_floor_pedestrians(); moveToPos(startPos); } build_multifloor() { build_ground_floor(); build_ground_floor_internal_walls_for_multi_storey(); build_first_floor(); build_staircase(); build_ground_floor_detail(); build_first_floor_detail(); place_ground_floor_pedestrians(); place_first_floor_pedestrians(); moveToPos(startPos); } clear_site() { //send msg twice to make sure everyone hears it llOwnerSay("clearing site"); llShout(talkToBuildingComponents, "demolish"); llSleep(1.0); llShout(talkToBuildingComponents, "demolish"); } default { state_entry() { llOwnerSay("builder online"); //set important positions startPos = llGetPos(); firstFloorCentre = startPos - <0,0,verticalFloorSeparation>; groundFloorCentre = firstFloorCentre - <0,0,verticalFloorSeparation>; firstFloorCornerA = firstFloorCentre + ; firstFloorCornerB = firstFloorCentre + <-halfFloorLength, halfFloorLength, 0>; firstFloorCornerC = firstFloorCentre + <-halfFloorLength, -halfFloorLength, 0>; firstFloorCornerD = firstFloorCentre + ; groundFloorCornerA = groundFloorCentre + ; groundFloorCornerB = groundFloorCentre + <-halfFloorLength, halfFloorLength, 0>; groundFloorCornerC = groundFloorCentre + <-halfFloorLength, -halfFloorLength, 0>; groundFloorCornerD = groundFloorCentre + ; groundFloorCornerADMidpoint = groundFloorCornerA + <0,-10,0>; state site_empty; } } state site_empty { state_entry() { llListen(talkToBuilder, "", NULL_KEY, ""); } listen(integer channel, string name, key id, string message) { if(channel == talkToBuilder) { if(message == "build_simple") { build_simple(); llSay(controllerReceiveChannel, "builder_finished"); state site_occupied; } if(message == "build_complicated") { build_complicated(); llSay(controllerReceiveChannel, "builder_finished"); state site_occupied; } if(message == "build_multifloor") { build_multifloor(); llSay(controllerReceiveChannel, "builder_finished"); state site_occupied; } } } } state site_occupied { state_entry() { llListen(talkToBuilder, "", NULL_KEY, ""); } listen(integer channel, string name, key id, string message) { if(channel == talkToBuilder) { if(message == "clear_site") { clear_site(); state site_empty; } else { llOwnerSay("site occupied, I can't build anything new"); } } } }