ENTITY* tmp_opener;
var max_doors_z = 100;
action door()
{
my.skill99 = 100; /// its a door
}
action opener()
{
my.skill99 = 99; /// its an opener
}
function player_scan_openers()
{
if((key_enter)) // do the scan only when button enter pressed
{
c_scan(my.x, my.pan, vector(360, 0, 300), IGNORE_ME | SCAN_ENTS);
if(you)
{
if(you.skill99 == 99)
{
tmp_opener = you;
for(you = ent_next(NULL); you; you = ent_next(you))
{
if(you.skill99 == 100)
{
if(tmp_opener.skill1 == you.skill1)
{
if(you.skill2 == 0)
{
you.skill2 = 1;
var trig_percentage = 0;
while(trig_percentage < 100)
{
trig_percentage += 10 * time_step;
ent_animate(tmp_opener, "on", trig_percentage, ANM_CYCLE);
wait(1);
}
var tmp_z = you.z + 100;
while(you.z < tmp_z)
{
you.z += 5;
wait(1);
}
you.skill2 = 2;
}
else
{
if(you.skill2 == 2)
{
you.skill2 = 1;
var trig_percentage =0;
while(trig_percentage < 100)
{
trig_percentage += 10 * time_step;
ent_animate(tmp_opener, "off", trig_percentage, ANM_CYCLE);
wait(1);
}
var tmp_z = you.z - 100;
while(you.z > tmp_z)
{
you.z -= 5;
wait(1);
}
you.skill2 = 0;
}
}
}
}
}
}
}
}
}