home *** CD-ROM | disk | FTP | other *** search
- # DroidWorks
- # 03_ctrl_activate.cog
- #
- # This cog sends a message to 03_tanks.cog when the motor's been activated.
- #
- #
- # [01/20/98] DGS Created
- # {01/29/98] JP Modified to be used in the Moisture Farm Level.
- #
- symbols
-
- message user3
- message activate
- message startup
- message timer
- message pulse
-
- cog ctrl_cog
- cog endfarmer
- surface button
-
- thing light0
- sector sector1
- sector sector2
- sector sector3
- sector sector4
-
- sound accomplish=00tAccomplish.wav local
- sound power=NRG02PowerOn.wav local
- sound broke=swt00twghtmax.wav local
-
- end
-
- # ========================================================================================
-
- code
-
- startup:
- player=getlocalplayerthing();
- print("ctrlactivate");
- underwater=0;
- //global0=0;
- //AttachThingToThing(wrench_long, gear);
- setwallcel(button, 2);
- setpulse(0.7);
- return;
-
- # =========================================================
- user3:
- //user3 gets called when player hits reset switch, see ctrlswitch co
- //sendmesasge
- print("user3");
- underwater=1;
- return;
-
- activate:
- print("ctrl activate");
- //if (GetSenderId() == 7) // pressing reset button underwater
- //{
- if (underwater == 0) // water is not drained yet
- {
- print ("resetswitchbroke");
- //PlaySoundLocal(reset_switch_broke, 1, 0, 0);
- dwplaycammyspeech(16031, "M3CA027.wav", 5, 2); //reset don't work under h20
- playsoundlocal(broke, 1, 0, 0);
- }
-
- if (underwater == 1) // power comes on
- {
- print("powers on");
- //PlaySoundLocal(power_on, 1, 0, 0);
- setpulse(0);
- SetWallCel(button, 1); // reset button changes color
- setthinglight(light0, brightness, 1.5); // turns these lights on
- //setthinglight(light1, brightness, 2.0);
- //setthinglight(light2, brightness, 1.0);
- //setthinglight(light3, brightness, 3.0);
- dwplaycammyspeech(16036, "M3CA032.wav", 5, 2); //you did it!
- dwfreezeplayer();
- playsoundlocal(power, 1, 0, 0);
- settimer(8);
- sendmessage(endfarmer, user1);
- print("user1 sent");
- SetSectorLight(sector1, 0.9, 1);
- SetSectorLight(sector2, 0.9, 1.5);
- SetSectorLight(sector3, 0.9, 0.7);
- SetSectorLight(sector4, 0.9, 1.2);
- }
-
-
- //}
- return;
-
- //timer:
- //setInv(player, 4, 1);
- //playsoundthing(accomplish, player, 1.0, -1, -1, 0);
- pulse:
- curcel=getwallcel(button);
- setwallcel(button, 2-curcel);
-
- return;
-
- end
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- startup:
- setwallcel(button, 0);
- return;
-
- activate:
- // send message to 03_Tanks_cog telling it the switch has been hit.
- sendmessage(tanks2_cog, user0);
- setwallcel(button, 1);
- print("foo2");
- settimer(1);
- return;
-
- timer:
- setwallcel(button, 0);
- return;
- end
-