we can go to level 2 now!
[dd2d.git] / data / scripts / switch / teleport.dacs
blobb9bd052ffae99d6c3e88fc62b642b62d63c59513
1 module switchTeleport is "switch" "Teleport";
3 import apiActor;
4 import apiMap;
5 import apiMove;
6 import apiSwitch;
7 import stdlib;
10 // setup actor properties
11 public void initialize (Actor me) {
12   // should be enough
13   //me.radius = 16;
14   //me.height = 16;
15   //me.flags &= ~(AF_NOCOLLISION|AF_NOONTOUCH/*|AF_NOLIGHT*/);
16   // add attached light
17   /*
18   me.attLightXOfs = 0;
19   me.attLightYOfs = -6;
20   me.attachedLightRGBX(255, 127, 0, 24);
21   */
25 // thinker
26 public void think (Actor me) {
27   if (me.atm > 0) {
28     --me.atm;
29     return;
30   }
32   me.atm = 0; // just in case
34   auto toucher = me.switchWhoTouched();
35   if (toucher) {
36     int x = me.switchGetA*8+4;
37     int y = me.switchGetB*8+7;
38     me.atm = 1; // cooldown time
39     if (!Z_canfit(x, y, toucher.radius, toucher.height)) {
40       //if (!swsnd) swsnd = Z_sound(sndnotele, 128);
41     } else {
42       toucher.Z_teleobj(x, y);
43     }
44   }