trap switches
[dd2d.git] / data / scripts / item / stimpack.dacs
blob2d330d1ae0a02f482e8b1a17c4080d690f8e8b72
1 module itemStimpack is "item" "StimPack";
3 import apiActor;
4 import aiItem;
6 import stdlib;
9 // setup actor animations
10 public void initializeAnim () {
11   animClearFrames("item", "StimPack", "sleep");
12   animAddFrame("item", "StimPack", "sleep", ACTOR_DIR_LEFT, "sprites/items/stima0.vga");
16 // setup actor properties
17 public void initialize (Actor me) {
18   // `classname` and `classtype` will be set by the engine
19   //me.classname = "StimPack";
20   //me.classtype = "item";
21   me.radius = 10;
22   me.height = 8;
23   me.actorSetAnimation("sleep");
24   // add attached light
25   me.attLightXOfs = 0;
26   me.attLightYOfs = -5;
27   me.attachedLightRGBX(200, 200, 0, 32);
28   me.flags |= AF_NOGRAVITY;
32 // thinker
33 public void think (Actor me) {
34   /*
35   if (me.x < 32) {
36     writeln("STIMPACK THINK: ", me);
37     writeln("  light: xofs=", me.attLightXOfs, "; yofs=", me.attLightYOfs, "; rgbx=", me.attLightRGBX);
38     //me.attLightXOfs = 0;
39     //me.attLightYOfs = -5;
40     //me.attachedLightRGBX(200, 200, 0, 32);
41   }
42   */
43   // we can directly check for player overlap, but i want to test hitlists
44   //writeln("stimpack: think");
45   rewindTouchList();
46   for (Actor other = getNextTouchListItem; other; other = getNextTouchListItem) {
47     //if (me.x < 32) writeln("stimpack: other=", other.classname);
48     if (other.isPlayer) {
49       writeln("actor took medkit!");
50       addMessage("actor took medkit!");
51       me.actorMarkDead();
52       return;
53     }
54   }
55   itemThink(me);