# Jedi Knight Cog Script
#
# prl_adjoin_block.cog
# Sylvicolus [PRL] 17 April 2001
#
# Enemy AI, such as a turret gun, can not see player through the inside_adjoin.
# The inside_adjoin surface is the surface facing away from the hall sectors.
# As long as the player is in one of the two hall sectors the view is blocked.
# When blocked, the view through the adjoin is not rendered, this causes HOM.
# So that's why the adjoin is cleared when you leave the hall (to not see HOM).
# The hall2_sector is for a 2nd sector that could also be seen through the adjoin.
#
# The sleeptime is needed so that player won't see HOM while in 3rd person view,
# because the external camera will still be in the room behind the player
# a short while as he/she goes through the adjoin into the hall.
#
# This cog is not supported by LucasArts Entertainment Co.
symbols
message startup
message entered
message exited
surface inside_adjoin linkid=1
sector hall_sector linkid=2
sector hall2_sector linkid=2
int active=0 local
flex sleeptime=0.5 local
end
# ========================================================
code
startup:
player = GetLocalPlayerThing();
return;
entered:
if ((!active) && (GetSenderId() == 2))
{
Sleep(sleeptime);
ClearAdjoinFlags(inside_adjoin,0x1); // block view through adjoin
active=1;
return;
}
return;
exited:
Sleep(sleeptime);
if ((GetThingSector(player) == hall_sector) || (GetThingSector(player) == hall2_sector)) return;
if ((active) && (GetSenderId() == 2))
{
SetAdjoinFlags(inside_adjoin,0x1); // render through adjoin
active=0;
return;
}
return;
end
|