home *** CD-ROM | disk | FTP | other *** search
/ Classic Fond 52 / ClassicFond52.iso / GAMES / DROIDW.RAR / DWCD.GOB / mission_cog_05_finaltram.cog < prev    next >
Encoding:
Text File  |  1998-11-04  |  2.0 KB  |  75 lines

  1. #standard type magnetic tram cog.
  2. #don't forget to set blocking walls to "no move"
  3. symbols
  4. message             startup
  5. message             arrived
  6. message             crossed
  7. message             entered
  8. message             user1
  9.  
  10. thing               newtram 
  11.  
  12. sector              thrustsector        linkid=5   
  13.  
  14. surface             triggeradjoin       mask=0xfff    
  15. surface             tram1block1         nolink
  16. surface             tram1block2         nolink
  17. surface             tram1block3         nolink
  18. surface             tram1block4         nolink
  19.  
  20. vector              cratepos            local
  21. vector              trampos             local
  22. vector              thrustvector
  23.  
  24. cog                 gmoCOG
  25. end
  26.  
  27. ## Code Section
  28. code                  
  29. startup:
  30.      tramlegal=1;
  31.      ItIsAttached=0;
  32.      player=getlocalplayerthing();
  33.      setsectorthrust(thrustsector, thrustvector, 8);
  34.      return;
  35.      
  36. crossed:
  37.      hangoffset=('0,0,0');
  38.      achthing=getsourceref();
  39.      call movetram;
  40.      return;
  41.    
  42. movetram:
  43.      itisattached=1;
  44. //     call clrajnflgs;
  45.      totalradius = GetThingRadius(achthing) + GetThingRadius(magnettram);
  46.     VectorSet(hangoffset, 0, 0, -totalradius);
  47.  //    hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
  48.     hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
  49.     SetThingPos(achthing, VectorAdd(GetThingPos(newtram), hangoffset));
  50.     AttachThingToThingEx(achthing, newtram, 8);
  51.      movetoframe(newtram, 1, 4);
  52.      setsectorthrust(thrustsector, thrustvector, 0);
  53.      return;
  54.      
  55. arrived:
  56.      //when the tram has arrived, drop the achthing and reset to stop 0
  57.      if (getcurframe(newtram)==1) {
  58.           movetoframe(newtram, 2, 5);
  59.      }
  60.      else if (getcurframe(newtram)==2) {
  61.           destroything(achthing);
  62.           sendmessage(gmoCog, user0);
  63.           movetoframe(newtram, 0, 5);  
  64.      }
  65.      else if (getcurframe(newtram)==0) {
  66.           setsectorthrust(thrustsector, thrustvector, 8);
  67.      }
  68.      return;
  69.           
  70.  
  71.  
  72. end
  73.  
  74.  
  75.