home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Classic Fond 52
/
ClassicFond52.iso
/
GAMES
/
DROIDW.RAR
/
DWCD.GOB
/
mission_cog_d0_tread1rx.cog
< prev
next >
Wrap
Text File
|
1998-11-04
|
4KB
|
131 lines
#standard type magnetic tram cog.
#don't forget to set blocking walls to "no move"
symbols
message startup
message arrived
message crossed
message entered
thing magnettram
thing beammid
thing beamstart
thing beamend
sector thrustsector linkid=5
sector thrustonsector0 linkid=6
sector thrustonsector1 linkid=6
surface triggeradjoin mask=0x484
surface tram1block1 nolink
surface tram1block2 nolink
vector cratepos local
vector trampos local
vector thrustvector
sound playerattsound=nrg00mgntattch.wav
sound crateattsound=crat1drpcrt.wav
sound magnetstart=nrgt2magnet.wav
sound magnetloop=amb00mgntlp2.wav
end
## Code Section
code
startup:
addbeam(beamstart, beamend, 147, .02);
movetoframe(magnettram, 3, 25);
printflex(getadjoinflags(tram1block1));
setsectorthrust(thrustsector, thrustvector, 8);
player=getlocalplayerthing();
if (dwdCheckDroidCaps(16)!=0) print ("droid is magnetic");
return;
crossed:
hangoffset=('0,0,0');
achthing=getsourceref();
call movetram;
return;
entered:
//if magnetic check is true return
if (dwCheckDroidCaps(16)!=0) return;
if (getsenderid()==5) {
call clrajnflgs;
setsectorthrust(thrustsector, thrustvector, 0);
stopsound(magloop1);
}
else if (getsenderid()==6) {
call setajnflgs;
setsectorthrust(thrustsector, thrustvector, 8);
}
return;
movetram:
call clrajnflgs;
if (achthing==player) {
playsoundthing(playerattsound, achthing, 1.0, -1, -1, 0);
dwdisablejump();
}
else playsoundthing(crateattsound, achthing, 1.0, -1, -1, 0);
setsectorthrust(thrustsector, thrustvector, 0);
totalradius = GetThingRadius(achthing) + GetThingRadius(magnettram);
VectorSet(hangoffset, 0, 0, -totalradius);
// hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
SetThingPos(achthing, VectorAdd(GetThingPos(magnettram), hangoffset));
AttachThingToThingEx(achthing, magnettram, 8);
print("attaching to tram");
movetoframe(magnettram, 1, 15);
return;
arrived:
//when the tram has arrived, drop the achthing and reset to stop 0
if ((getcurframe(magnettram))==2) {
if (achthing==player) {
movetoframe(magnettram,3,15);
dwenablejump();
}
detachthing(achthing);
setthingvel(achthing, '0,0,0.5');
printflex(getadjoinflags(tram1block1));
}
else if ((getcurframe(magnettram))==1) {
removelaser(burning);
movetoframe(magnettram, 2, 15);
}
else if ((getcurframe(magnettram))==3) {
skiptoframe(magnettram, 0, 15);
burning=(addbeam(beammid, magnettram, 147, .02));
}
else if ((getcurframe(magnettram))==0) {
print("RX thrust on");
setsectorthrust(thrustsector, thrustvector, 8);
playsoundthing(magnetstart, magnettram, 1.0, 10, 20, 0);
magloop1=playsoundthing(magnetloop, magnettram, .45, 10, 20, 0x1);
//when the tram has reset, mark walls 'no move' again.
clearadjoinflags(tram1block1, 2);
clearadjoinflags(tram1block2, 2);
}
return;
clrajnflgs:
print("clearing flags");
setadjoinflags(tram1block1, 2);
setadjoinflags(tram1block2, 2);
return;
setajnflgs:
print("setting flags");
clearadjoinflags(tram1block1, 2);
clearadjoinflags(tram1block2, 2);
return;
end