djcev.com

//

Git Repos / fte_dogmode / qc / misc / particle_stream.qc

Last update to this file was on 2024-03-24 at 02:40.

Show particle_stream.qc

//==============================================================================
// misc_particle_stream -- from Zerstrorer mod -- dumptruck_ds
//==============================================================================

//======================================================================
// forward declarations
//======================================================================

// misc_particle_stream
void(vector start, vector end, float color1, float color2, float pdensity)
misc_particle_stream_beam;
void() misc_particle_stream_think;
void() misc_particle_stream_use;
void(entity e) misc_particle_stream_init;
void() misc_particle_stream;

//------------------------------------------------------------------------------

//=START PARTICLE-STREAM================================================

/*QUAKED misc_particle_stream (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
A particle stream! It appears when triggered. This entity is
one end of the stream, target another entity as the other end-point.
I used the info_notnull, but you should be able to target anything
(like monsters).

"target" This entities origin is the end-point of the stream
"dmg" 1st Color - Use if you want a single color stream
"cnt" 2nd Color - Mixes particles of both colors
"noise" Sound to play when triggered
*/
//----------------------------------------------------------------------
// class misc_particle_stream: base_mapentity
// {
//--------------------------------------------------------------
void(vector start, vector end, float color1, float color2,
float pdensity) misc_particle_stream_beam =
{
local vector spray, next;
local float dist, loop, clr;

clr = color1;
spray = start - end;
dist = vlen (spray);
loop = dist / 24;
spray = normalize (spray);
next = spray * 24;

while (loop > 0)
{
particle (end, spray, clr, pdensity);
end = end + next;
loop = loop - 1;
if (clr == color1)
clr = color2;
else
clr = color1;
}
};

//--------------------------------------------------------------
// was particle_stream_start -- CEV
//--------------------------------------------------------------
void() misc_particle_stream_think =
{
local entity pspot;

pspot = find (world, targetname, self.target);

if (!pspot)
{
dprint ("misc_particle_stream::do_think: "
"Particle stream can't find target!\n");
return;
}

self.enemy = pspot;
};

//--------------------------------------------------------------
void() misc_particle_stream_use =
{
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
// was 40 - too many particles for my taste -- dumptruck_ds
misc_particle_stream_beam (self.origin, self.enemy.origin,
self.dmg, self.cnt, 15);
};

//--------------------------------------------------------------
void(entity e) misc_particle_stream_init =
{
e.classname = "misc_particle_stream";
e.classtype = CT_MISC_PARTICLE_STREAM;
base_mapentity_init (e);

if (!e.target)
objerror ("misc_particle_stream_init: no target!");

if (!e.dmg)
e.dmg = 73;
if (!e.cnt)
e.cnt = e.dmg;
if (!e.noise)
e.noise = "misc/null.wav";

precache_sound (e.noise);

e.use = misc_particle_stream_use;
e.think = misc_particle_stream_think;
e.nextthink = time + 0.2;
};

//--------------------------------------------------------------
void() misc_particle_stream =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

misc_particle_stream_init (self);
};
// };

Return to the top of this page or return to the overview of this repo.

Log particle_stream.qc

Date Commit Message Author + -
2024-03-24 2nd pass refactor, rework QC class structure cev +49 -24
2024-01-31 Class based monster refactor & start projectiles cev +1 -1
2024-01-09 Continue OO / Class-based refactor cev +21 -21
2023-12-09 Start OO / class-based refactor, work on items cev +74 -66
2023-11-27 Code reorg, minor movement changes, misc cev +89  

Return to the top of this page or return to the overview of this repo.