SHOW:
|
|
- or go back to the newest paste.
1 | void main(void) | |
2 | { | |
3 | var lights = GetByType("interior_light"); | |
4 | ||
5 | foreach (lights as light) | |
6 | { | |
7 | var enabled = false; | |
8 | ||
9 | // Save the original settings so we can reset to them later | |
10 | var color = light.getColor(); | |
11 | var radius = light.getRadius(); | |
12 | ||
13 | if (!enabled) // Starting from the Off state, we switch on Red Alert | |
14 | { | |
15 | // Set them all to red | |
16 | light.setColor(255, 0, 0); | |
17 | ||
18 | // Brighten and dim repeatedly | |
19 | while (true) | |
20 | { | |
21 | light.setRadius(4); | |
22 | sleep(1); | |
23 | light.setRadius(1); | |
24 | sleep(1); | |
25 | } | |
26 | ||
27 | // Save On state | |
28 | enabled = true; | |
29 | } | |
30 | else // If it was already on, set it back to defaults | |
31 | { | |
32 | light.setColor(color); | |
33 | light.setRadius(radius); | |
34 | enabled = false; | |
35 | } | |
36 | } | |
37 | } |