home *** CD-ROM | disk | FTP | other *** search
- #standard type magnetic tram cog.
- #don't forget to set blocking walls to "no move"
- symbols
- message startup
- message arrived
- message crossed
- message entered
- message user1
-
- thing newtram
-
- sector thrustsector linkid=5
-
- surface triggeradjoin mask=0xfff
- surface tram1block1 nolink
- surface tram1block2 nolink
- surface tram1block3 nolink
- surface tram1block4 nolink
-
- vector cratepos local
- vector trampos local
- vector thrustvector
-
- cog gmoCOG
- end
-
- ## Code Section
- code
- startup:
- tramlegal=1;
- ItIsAttached=0;
- player=getlocalplayerthing();
- setsectorthrust(thrustsector, thrustvector, 8);
- return;
-
- crossed:
- hangoffset=('0,0,0');
- achthing=getsourceref();
- call movetram;
- return;
-
- movetram:
- itisattached=1;
- // call clrajnflgs;
- totalradius = GetThingRadius(achthing) + GetThingRadius(magnettram);
- VectorSet(hangoffset, 0, 0, -totalradius);
- // hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
- hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
- SetThingPos(achthing, VectorAdd(GetThingPos(newtram), hangoffset));
- AttachThingToThingEx(achthing, newtram, 8);
- movetoframe(newtram, 1, 4);
- setsectorthrust(thrustsector, thrustvector, 0);
- return;
-
- arrived:
- //when the tram has arrived, drop the achthing and reset to stop 0
- if (getcurframe(newtram)==1) {
- movetoframe(newtram, 2, 5);
- }
- else if (getcurframe(newtram)==2) {
- destroything(achthing);
- sendmessage(gmoCog, user0);
- movetoframe(newtram, 0, 5);
- }
- else if (getcurframe(newtram)==0) {
- setsectorthrust(thrustsector, thrustvector, 8);
- }
- return;
-
-
-
- end
-
-
-