home *** CD-ROM | disk | FTP | other *** search
- # DrowWorks Cog Script
- #
- # SY_MagTram A
- #
- # First attempt at MagTram cog
- #
- # Desc:
- #
- #
- #
- # [01/18/97] DGS Created From Matt's TreadRX script.
- # [03/03/98] DGS Modified to work with sector thrusts. It got totally re-written. (Del-Fi Lost Treasures)
- # [04/02/98] DGS Getting totally re-written again as so it's waiting for you at said "wait point". (Captiol Ultra-Lounge: Bachelor Pad Royale)
- # and it's a piece of junk that I just hate.
- # [04/09/98] DGS Created MagtramZ out of Magtram A to replace MagtramG. This just sucks. (Don Tiki).
-
- symbols
-
- ## ====================== Messages
- message startup
- message arrived
- message entered
- message exited
- message pulse
- message touched
- message timer
-
- ## ====================== Things
- thing tram
- thing door1_o
- thing door2_o
- thing door3_o
- thing door4_o
- thing door5_o
- thing door6_o
-
- ## ====================== Surfaces
- surface tram1block1 nolink
- surface tram1block2 nolink
- surface tram1block3 nolink
- surface tram1block4 nolink
-
- ## ---------------------- Door sectors
- int door1_s local
- int door2_s local
- int door3_s local
- int door4_s local
- int door5_s local
- int door6_s local
-
- ## ===================== Vectors
- vector up_v
-
- ## ====================== Sectors
- sector pickup1_s linkid=21
- sector pickup2_s linkid=22
- int tram_sect_i local
-
-
-
- ## ====================== Misc. Variables
-
- flex t_speed=15.0 local
- flex door_speed=12.0 local
- int cargo1_i=0 local
- int cargo2_i=0 local
- int cargot_i=0 local
- int pickups_i=0 local
- int moveframe=0 local
- int in_tram=0 local
- int touchy=0 local
-
-
- end
-
- # ========================================================================================
-
- code
-
- startup:
- //movetoframe(tram,1,t_speed);
- moveframe = 1;
- call open_adjoins;
-
- door1_s = GetThingSector(door1_o);
- SetSectorAdjoins(door1_s, 0);
- door2_s = GetThingSector(door2_o);
- SetSectorAdjoins(door2_s, 0);
- door3_s = GetThingSector(door3_o);
- SetSectorAdjoins(door3_s, 0);
- door4_s = GetThingSector(door4_o);
- SetSectorAdjoins(door4_s, 0);
- door5_s = GetThingSector(door5_o);
- SetSectorAdjoins(door5_s, 0);
- door6_s = GetThingSector(door6_o);
- SetSectorAdjoins(door6_s, 0);
-
-
- //call tramstop;
-
- return;
-
- tramstop:
- print("tramstop jerky");
- //This routine is in charge of checking a tram stop and dropping something off it it needs
- // to, or picking someone up if it needs to.
- if (cargot_i == 0) //if the tram is empty
- {
- if ((getthingsector(tram) == pickup1_s) && (cargo1_i !=0 )) //if the sector the tram is in is pickup 1 and there's cargo to pick up
- {
- achthing = cargo1_i; // Let the achthing (the thing it picks up) = whatever the cargo is.
- cargo1_i = 0; // Empty the cargostop variable
- pickups_i = pickup1_s; // tell the touched message what sectorthrust to stop.
- SectorThrust(pickup1_s, up_v, 5);
- //settimer(3);
- }
- }
- else // Else the cargo is holding something and it's way out wackity wacked
- {
- print("!");
- //call dropoff1;
- }
- return;
- touched:
- print("touched");
- //printint(tram_pickup);
- if (touchy == 0)
- {
- if (getsenderref() == tram)
- {
- call open_adjoins;
- print("touched32");
- touchy = 1;
- tram_pickup = 0;
- //print("touched");
- achthing = getlocalplayerthing();
- SectorThrust(pickups_i, up_v, 0);
- sleep(0.01);
- call pickup1;
- settimer(1);
- }
- }
- return;
-
- entered:
- // This routine handles setting up variables for when the player (or potentially something else)
- // enters a pickup zone.
- print("entered");
- if (dwCheckDroidCaps(16))
- {
- If (getsenderref()== pickup1_s) //if something entered pickup 1
- {
- call close_adjoins;
- SectorThrust(pickup1_s, up_v, 5);
- //print("Sector 1:");
- //printint(getsourceref());
- //cargo1_i = getsourceref();
- }
- }
- return;
-
- exited:
- //This routine handles clearing varibles that keep track of what's potential cargo.
- If (getsenderref()== pickup1_s)//if something exited pickup 1
- {
- if (cargo1_i == getsourceref())
- {
- cargo1_i = 0; //if it was potential cargo, then remove it
- SectorThrust(pickup1_s, up_v, 0);
- }
- }
- return;
-
- pickup1:
- // This routine picks up the player (well, in therory anything)
- // It was taken from Matt the Tat's tram cog. I modified it a little. -Doug
-
- if (dwCheckDroidCaps(16))
- {
- print("pick me up!");
- printint(achthing);
- t_speed = 7.5;
- hangoffset=('0,0,0');
- cargot_i = achthing;
- // setsectorthrust(thrustsector, thrustvector, 0);
- totalradius = GetThingRadius(achthing) + GetThingRadius(tram);
- VectorSet(hangoffset, 0, 0, (-totalradius)- 0.5);
- // hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
- hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
- //SetThingPos(achthing, VectorAdd(GetThingPos(tram), hangoffset));
- AttachThingToThingEx(achthing, tram, 8);
- dwdisablejump();
- }
- else
- {
- // Tell the player they're non-pharrous
- }
- return;
-
- dropoff1:
- print("dropOFF:");
- printint(cargot_i);
- cargot_i = 0; //empty out the cargo variable
- t_speed = 15;
- //Sleep(2);
- in_tram = 0;
- detachthing(achthing);
- setthingvel(achthing, '0,0,0.5');
- SectorThrust(pickup2_s, up_v, 3);
- setpulse(3);
- dwenablejump();
- return;
-
- arrived:
- if (getsenderref() == tram)
- {
- if ((getcurframe(tram))==1)
- {
- movetoframe(tram,6,t_speed);
- }
- else if ((getcurframe(tram))==6)
- {
- SetSectorAdjoins(door1_s, 1); //Turn on door adjoins
- movetoframe(door1_o,1,door_speed);
- movetoframe(tram,7,t_speed);
- }
- else if ((getcurframe(tram))==7)
- {
- movetoframe(door1_o,0,door_speed);
- movetoframe(tram,8,t_speed);
- }
- else if ((getcurframe(tram))==8)
- {
- SetSectorAdjoins(door2_s, 1); //Turn on door adjoins
- movetoframe(door2_o,1,door_speed);
- movetoframe(tram,9,t_speed);
- }
- else if ((getcurframe(tram))==9)
- {
- movetoframe(door2_o,0,door_speed); // Close door
- movetoframe(tram,11,t_speed);
- }
- else if ((getcurframe(tram))==11)
- {
- SetSectorAdjoins(door3_s, 1); //Turn on door adjoins
- movetoframe(door3_o,1,door_speed);
- movetoframe(tram,12,t_speed);
- }
- else if ((getcurframe(tram))==12)
- {
- movetoframe(door3_o,0,door_speed); // Close door
- movetoframe(tram,15,t_speed);
- }
- else if ((getcurframe(tram))==15)
- {
- call dropoff1;
- moveframe = 13;
- settimer(3);
- //SetSectorAdjoins(door4_s, 1); //Turn on door adjoins
- //movetoframe(door4_o,1,door_speed);
- //movetoframe(tram,10,t_speed);
- }
- else if ((getcurframe(tram))==3310)
- {
- movetoframe(door4_o,0,door_speed); // Close door
- movetoframe(tram,12,t_speed);
- }
- else if ((getcurframe(tram))==3312)
- {
- }
- else if ((getcurframe(tram))==3313)
- {
- SetSectorAdjoins(door5_s, 1); //Turn on door adjoins
- movetoframe(door5_o,1,door_speed);
- movetoframe(tram,15,t_speed);
- }
- else if ((getcurframe(tram))==3315)
- {
- movetoframe(door5_o,0,door_speed); // Close door
- movetoframe(tram,16,t_speed);
- }
- else if ((getcurframe(tram))==3316)
- {
- SetSectorAdjoins(door6_s, 1); //Turn on door adjoins
- movetoframe(door6_o,1,door_speed);
- movetoframe(tram,17,t_speed);
- }
-
- else if ((getcurframe(tram))==3317)
- {
- movetoframe(door6_o,0,door_speed); // Close door
- skiptoframe(tram,0,t_speed);
- }
-
-
-
- }
- else if (getsenderref() == door1_o) //if it's door 1
- {
- if (getcurframe(door1_o) == 0) SetSectorAdjoins(door1_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door2_o)
- {
- if (getcurframe(door2_o) == 0) SetSectorAdjoins(door2_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door3_o)
- {
- if (getcurframe(door3_o) == 0) SetSectorAdjoins(door3_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door4_o)
- {
- if (getcurframe(door4_o) == 0) SetSectorAdjoins(door4_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door5_o)
- {
- if (getcurframe(door5_o) == 0) SetSectorAdjoins(door5_s, 0); //Turn off door adjoins
- }
- else if (getsenderref() == door6_o)
- {
- if (getcurframe(door6_o) == 0) SetSectorAdjoins(door6_s, 0); //Turn off door adjoins
- }
-
- return;
- timer:
- // this routine is used to control the movement of the tram after it's waited at
- // the stop for a settimer() amount of ti
- print("I pity the fool");
- tram_pickup = 0;
- movetoframe(tram,moveframe,t_speed);
- return;
-
- pulse:
- SectorThrust(pickup2_s, up_v, 0);
- setpulse(0);
- return;
-
- open_adjoins:
- print("clearing flags");
- setadjoinflags(tram1block1, 2);
- setadjoinflags(tram1block2, 2);
- setadjoinflags(tram1block3, 2);
- setadjoinflags(tram1block4, 2);
- return;
-
- close_adjoins:
- print("setting flags");
- clearadjoinflags(tram1block1, 2);
- clearadjoinflags(tram1block2, 2);
- clearadjoinflags(tram1block3, 2);
- clearadjoinflags(tram1block4, 2);
- return;
-
-
- end
-