summaryrefslogtreecommitdiff
path: root/npc/functions/doors.txt
blob: d15969ad18d28a6eec094f21b247c25bb1c8f4c7 (plain) (blame)
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
64
65
66
// Evol functions.
// Author:
//    4144
// Description:
//    Doors utility functions
// Variables:
//    none

function	script	doorTouch	{
    getmapxy(.@pc_map$, .@pc_x, .@pc_y, UNITTYPE_PC); // get char location
    if (.@pc_y < .y)
        end;

    if (getareausers() <= 1)
    {
        .dir = 2;
        stopnpctimer;
        initnpctimer;
    }
    close;
}

function	script	doorUnTouch	{
    if (.dir != 2 && .dir != 6)
        end;

    if (getareausers(.map$) == 0)
    {
        .dir = 4;
        initnpctimer;
        startnpctimer;
    }
    close;
}

function	script	doorTimer	{
    stopnpctimer;
    if (.dir == 2) .dir = 6;
    if (.dir == 4) .dir = 8;
    end;
}

function	script	doorInit	{
    .distance = 5;
    .alwaysVisible = true;
    .bodytype = BODYTYPE_1;
    end;
}

function	script	open_door	{
    .@door$ = getarg(0);
    setnpcdir.@door$, 2;
    sleep 300;
    setnpcdir .@door$, 6;
    sleep 300;
    return 0;
}

function	script	close_door	{
    .@door$ = getarg(0);
    setnpcdir .@door$, 4;
    sleep 300;
    setnpcdir .@door$, 8;
    sleep 300;
    return 0;
}