2003-10-22 09:24:50 +00:00
|
|
|
#include "config.rh"
|
|
|
|
|
|
|
|
#include "paroxysm.rh"
|
|
|
|
|
|
|
|
/*
|
|
|
|
POX - Flashlight code from the Flashlight Tutorial at the Inside3D website <http://www.inside3d.com>
|
|
|
|
Created by ShockMan eMail: shockman@brutality.com
|
2003-10-22 21:54:29 +00:00
|
|
|
Added an entity attribute to the spawn function for bot support (since @self is only the bot at respwan)
|
2003-10-22 09:24:50 +00:00
|
|
|
*/
|
|
|
|
void() flash_update =
|
|
|
|
{
|
|
|
|
// The Player is dead so turn the Flashlight off
|
2003-10-22 21:54:29 +00:00
|
|
|
if (@self.owner.deadflag != DEAD_NO)
|
|
|
|
@self.effects = 0;
|
2003-10-22 09:24:50 +00:00
|
|
|
// The Player is alive so turn On the Flashlight
|
|
|
|
else
|
2003-10-22 21:54:29 +00:00
|
|
|
@self.effects = EF_DIMLIGHT;
|
2003-10-22 09:24:50 +00:00
|
|
|
// Find out which direction player facing
|
2003-10-22 21:54:29 +00:00
|
|
|
makevectors (@self.owner.v_angle);
|
2003-10-22 09:24:50 +00:00
|
|
|
// Check if there is any things infront of the flashlight
|
2003-10-22 21:54:29 +00:00
|
|
|
traceline (@self.owner.origin , (@self.owner.origin+(v_forward * 500)) , FALSE , @self);
|
2003-10-22 09:24:50 +00:00
|
|
|
// Set the Flashlight's position
|
2003-10-22 21:54:29 +00:00
|
|
|
setorigin (@self, trace_endpos+(v_forward * -5));
|
2003-10-22 09:24:50 +00:00
|
|
|
// Repeat it in 0.02 seconds...
|
2003-10-22 21:54:29 +00:00
|
|
|
@self.nextthink = time + 0.02;
|
2003-10-22 09:24:50 +00:00
|
|
|
};
|
|
|
|
void(entity me) flash_on =
|
|
|
|
{
|
|
|
|
// Make a new entity to hold the Flashlight
|
|
|
|
local entity myflash;
|
|
|
|
// spawn flash
|
|
|
|
myflash = spawn ();
|
|
|
|
myflash.movetype = MOVETYPE_NONE;
|
|
|
|
myflash.solid = SOLID_NOT;
|
|
|
|
// this uses the s_bubble.spr, if you want it to be completly
|
|
|
|
// invisible you need to create a one pixel trancparent spirit
|
|
|
|
// and use it here...
|
|
|
|
|
|
|
|
//POX - changed it to a null sprite
|
|
|
|
setmodel (myflash, "progs/null.spr");
|
|
|
|
setsize (myflash, '0 0 0', '0 0 0');
|
|
|
|
// Wire Player And Flashlight Together
|
|
|
|
myflash.owner = me;
|
|
|
|
me.flash = myflash;
|
|
|
|
|
|
|
|
// give the flash a Name And Make It Glow
|
|
|
|
myflash.classname = "flash";
|
|
|
|
myflash.effects = EF_DIMLIGHT;
|
|
|
|
|
|
|
|
// Set Start Position
|
2003-10-22 21:54:29 +00:00
|
|
|
makevectors (@self.v_angle);
|
|
|
|
traceline (@self.origin , (@self.origin+(v_forward * 500)) , FALSE , @self);
|
2003-10-22 09:24:50 +00:00
|
|
|
setorigin (myflash, trace_endpos);
|
|
|
|
// Start Flashlight Update
|
|
|
|
myflash.think = flash_update;
|
|
|
|
myflash.nextthink = time + 0.02;
|
|
|
|
};
|
|
|
|
//POX - the user toggle is not implemented (auto light for Darkmode only)
|
|
|
|
/*
|
|
|
|
|
|
|
|
void () flash_toggle =
|
|
|
|
{
|
|
|
|
// If Off, Turn On
|
2003-10-22 21:54:29 +00:00
|
|
|
if (@self.flash_flag == FALSE)
|
2003-10-22 09:24:50 +00:00
|
|
|
{
|
2003-10-22 21:54:29 +00:00
|
|
|
@self.flash_flag = TRUE;
|
2003-10-22 09:24:50 +00:00
|
|
|
flash_on();
|
|
|
|
}
|
|
|
|
// If On, Turn Off
|
|
|
|
else
|
|
|
|
{
|
2003-10-22 21:54:29 +00:00
|
|
|
@self.flash_flag = FALSE;
|
2003-10-22 09:24:50 +00:00
|
|
|
W_SetCurrentAmmo ();
|
2003-10-22 21:54:29 +00:00
|
|
|
@self.flash.think = SUB_Remove;
|
|
|
|
@self.flash.nextthink = time + 0.1;
|
2003-10-22 09:24:50 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
*/
|