Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_traintrack_moving_parent_Step_1

(view raw script w/o annotations or w/e)
1
if (trigger == -4)
2
{
3
    with (obj_traintrack_switch)
4
    {
5
        if (extflag == other.extflag)
6
            other.trigger = id;
7
    }
8
    with (obj_train_station)
9
    {
10
        if (extflag == other.extflag)
11
            other.trigger = id;
12
    }
13
}
14
do_switch = false;
15
with (trigger)
16
{
17
    if (abs(pressed) == 1)
18
        other.do_switch = true;
19
}
20
if (do_switch)
21
{
22
    for (var i = 0; i < array_length(track); i++)
23
    {
24
        if (i_ex(track[i]) && track[i].train_occupied)
25
        {
26
            do_switch = false;
27
            break;
28
        }
29
    }
30
    if (!do_switch)
31
    {
32
        if (trigger.pressed == 1)
33
            trigger.pressed = 0;
34
        if (trigger.pressed == -1)
35
            trigger.pressed = 2;
36
        if (canflasherror)
37
            snd_play(snd_error);
38
        with (obj_traintrack_moving_parent)
39
        {
40
            if (extflag == other.extflag)
41
            {
42
                do_switch = false;
43
                if (other.canflasherror)
44
                {
45
                    with (instance_create(center_x, center_y, obj_oflash))
46
                    {
47
                        depth = other.depth - 1;
48
                        sprite_index = other.track_sprite;
49
                        angle = other.track_angle;
50
                    }
51
                }
52
            }
53
        }
54
        if (canflasherror)
55
        {
56
            canflasherror = false;
57
            alarm[0]
 = 30;
gml_Object_obj_traintrack_moving_parent_Alarm_0.gml

canflasherror = true;
58
        }
59
    }
60
}