-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMadPeaDoor.lsl
56 lines (47 loc) · 1.22 KB
/
MadPeaDoor.lsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// This script goes into the door
string sound = "Slide Door Sound";
integer listenHandler;
integer commandChannel = -150;
key keypadKey = "b57fe2eb-8474-acf1-8b3b-122ecd2d323c";
integer rangeMeters = 5;
float moveDistance = 3.08;
float moveTime = 5.0;
float waitTime = 6.0;
removeListen()
{
llListenRemove(listenHandler);
}
moveDoor()
{
llTriggerSound(sound, 0.3);
llSetKeyframedMotion(
[<(moveDistance * -1), 0.0, 0.0>, ZERO_ROTATION, moveTime,
<0.0, 0.0, 0.0>`, ZERO_ROTATION, waitTime,
<moveDistance, 0.0, 0.0>, ZERO_ROTATION, moveTime],
[KFM_MODE, KFM_FORWARD]);
}
default
{
state_entry()
{
llSetLinkPrimitiveParamsFast(LINK_THIS,
[PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
llSetKeyframedMotion([],[]);
llSensorRepeat("", "", AGENT, rangeMeters * PI, PI, 1);
}
listen(integer channel, string name, key id, string message)
{
if (message == "unlock")
{
moveDoor();
}
}
sensor(integer numberOfAgents) {
if (numberOfAgents > 0) {
listenHandler = llListen(commandChannel, "", keypadKey, "");
} else
{
removeListen();
}
}
}