aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/~ball.lsl
blob: 4d6bb2d707aae67bb36bd2d401a0cf9a05aa6a88 (plain)
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
57
58
59
60
61
62
63
//
// MLP lite v3.0 for OpenSim
// Based on the original MLP - MULTI-LOVE-POSE V1.2 - Copyright (c) 2006, by Miffy Fluffy (BSD License)
// This code has bounced around the Second Life and OpenSim for over a decade, with various people working on it.
// MLP lite for OpenSim is almost a complete rewrite by onefang rejected.

key      Boss;
integer  Number;
integer  isBall;


default
{
    state_entry()
    {
        integer perm = llGetObjectPermMask(MASK_OWNER);

        if (0 == (perm & (PERM_COPY | PERM_MOVE | PERM_MODIFY)))
        {
            llOwnerSay("DANGER, CAN'T COPY, MODIFY, OR MOVE THIS OBJECT!");
            llSay(DEBUG_CHANNEL, "DANGER, CAN'T COPY, MODIFY, OR MOVE THIS OBJECT!");
        }
    }

    on_rez(integer num)
    {
        string objectName = llGetObjectName();

        isBall = ("~ball" == objectName);
        if (isBall)     // This is only coz OpenSim 8.2 doesn't know PRIM_SIT_TARGET.
            llSitTarget(<0.0, 0.0, -0.1>, ZERO_ROTATION);
        Boss = osGetRezzingObject();
        if (NULL_KEY != Boss)
        {
            Number = num;
            osMessageObject(Boss, "ALIVE|" + num);
            llSetTimerEvent(600.0);
        }
    }

    changed(integer change)
    {
        if ((CHANGED_LINK == change) && isBall)
            osMessageObject(Boss, "AVATAR|" + Number + "|" + (string) llAvatarOnSitTarget());
    }

    dataserver(key query_id, string str)
    {
        if (query_id == Boss)
        {
            if ("LIVE" == str)
                llSetTimerEvent(600.0);
            else if ("DIE" == str)
                llDie();
        }
    }

    timer()
    {   // not heard "LIVE" from ~MLP for a while: suicide
        llDie();
    }
}