# Jedi Knight Cog Script # # prl_00_door_adjoinless.cog # This is 00_door.cog with sector adjoin references removed # Sylvicolus [PRL] 28 May 2001 # http://www.lactarius.com/sylvicolus/jk/ # # Basic door cog to use with see-through doors. # # # This cog is not supported by LucasArts Entertainment Co. symbols message startup message activate message arrived message timer message blocked thing door0 linkid=0 mask=0x405 thing door1 linkid=1 mask=0x405 thing door2 linkid=2 mask=0x405 thing door3 linkid=3 mask=0x405 float moveSpeed=8.0 float sleepTime=2.0 int numDoors=0 local int doorStatus local int moveStatus local int i local end # ======================================================== code startup: for (i=0; i<=3; i=i+1) if (door0[i] >= 0) numDoors = numDoors + 1; return; activate: call CheckStatus; if (moveStatus) return; if (doorStatus == 0) { sleep(0.1); call OpenDoors; } return; arrived: call CheckStatus; if (moveStatus) return; if (doorStatus == numDoors) { SetTimer(sleepTime); } return; blocked: call OpenDoors; return; timer: call CloseDoors; return; OpenDoors: for (i=0; i<=3; i=i+1) if (door0[i] >= 0) MoveToFrame(door0[i], 1, moveSpeed); return; CloseDoors: for (i=0; i<=3; i=i+1) if (door0[i] >= 0) MoveToFrame(door0[i], 0, moveSpeed); return; CheckStatus: moveStatus = 0; doorStatus = 0; for (i=0; i<=3; i=i+1) { if (door0[i] >= 0) { moveStatus = moveStatus + IsThingMoving(door0[i]); doorStatus = doorStatus + GetCurFrame(door0[i]); } } return; end