[/code]
/////////////////////////////TASCHENLAMPE LITE C
function flashlight()
{
d3d_spotlightfalloff.x = 2.5;
d3d_spotlightfalloff.y = 0.1;
d3d_spotlightfalloff.z = 0.5;
d3d_spotlightcone.x = 60;
d3d_spotlightcone.y = 70;
d3d_spotlightcone.z = 2.5;
set(my,SPOTLIGHT);
while(me)
{
if(flashlight==1)
{
my.lightrange = 1000;
}
else
{
my.lightrange = 0;
}
wait(1);
}
}
action flashlight()
{
while (player == NULL) {wait (1);}
//my.passable = On;
while (vec_dist (player.x, my.x) > 100) {wait (1);}
set (my, INVISIBLE);
my.red = 200;
my.green = 200;
my.blue = 200;
//snd_play(grab_light, 70, 0);
while (1)
{
while (flash_enabled == 1)
{
my.lightrange = 200;
temp.x = max_dist * cos(player.pan) * cos(camera.tilt) + player.x+100;
temp.y = max_dist * sin(player.pan) * cos(camera.tilt) + player.y;
temp.z = max_dist * sin(camera.tilt) + player.z+20;
trace_mode = ignore_models + use_box;
my.skill1 = trace (player.x, temp);
if (my.skill1 != 0)
{
temp.x = (my.skill1 - 60) * cos(player.pan) * cos(camera.tilt) + player.x;
temp.y = (my.skill1 - 60) * sin(player.pan) * cos(camera.tilt) + player.y;
temp.z = (my.skill1 - 60) * sin(camera.tilt) + player.z;
vec_set (my.pos, temp);
}
energy -= 0.5 * time;
wait (1);
}
my.lightrange = 0;
wait (1);
}
}
function enable_flashlight()
{
//PLAY_SOUND flashlight,60;
flash_enabled += 1;
flash_enabled %= 2;
wait(1);
ent_create(cell,player.pos,battery_pickup);
}
on_f = enable_flashlight; // press the "F" key to use the flashlight
[code]