djcev.com

//

Git Repos / fte_dogmode / qc / hazards / ltrail.qc

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

Show ltrail.qc

//==============================================================================
// ltrail -- Dissolution Of Eternity lighting trail
//==============================================================================

//======================================================================
// lightning trail
// pmack
// sept 96
//======================================================================

//======================================================================
// constants
//======================================================================

const float LTRAIL_TOGGLE = 1;
const float LTRAIL_ACTIVE = 2;

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

// base_hazard_ltrail
void() base_hazard_ltrail_chain;
void() base_hazard_ltrail_fire;
void() base_hazard_ltrail_use;
void(entity e) base_hazard_ltrail_init;
strip void() base_hazard_ltrail;

// ltrail_start
void(entity e) ltrail_start_init;
void() ltrail_start;

// ltrail_relay
void(entity e) ltrail_relay_init;
void() ltrail_relay;

// ltrail_end
void(entity e) ltrail_end_init;
void() ltrail_end;

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

//----------------------------------------------------------------------
// class base_hazard_ltrail: base_mapentity
// {
//--------------------------------------------------------------
void() base_hazard_ltrail_chain =
{
sub_usetargets ();
self.think = sub_null;
};

//--------------------------------------------------------------
void() base_hazard_ltrail_fire =
{
if (self.classtype != CT_HAZARD_LTRAIL_END)
{
local entity targent;

if (!self.sounds)
sound (self, CHAN_VOICE, "weapons/lhit.wav",
1, ATTN_NORM);

targent = find (world, targetname, self.target);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
WriteCoord (MSG_BROADCAST, targent.origin_x);
WriteCoord (MSG_BROADCAST, targent.origin_y);
WriteCoord (MSG_BROADCAST, targent.origin_z);
fire_lightning (self.origin, targent.origin,
self, self.currentammo);
}

if (self.items < time)
{
self.think = base_hazard_ltrail_chain;
self.nextthink = time + self.frags;
}
else
{
self.think = base_hazard_ltrail_fire;
self.nextthink = time + 0.05;
}
};

//--------------------------------------------------------------
// was ltrail_start_fire
//--------------------------------------------------------------
void() base_hazard_ltrail_use =
{
// if it's a toggle ltrail, we ignore triggers from
// ltrail_end's when toggled off.
if (self.spawnflags & LTRAIL_TOGGLE)
{
// user is not a lightning trail; change activity state.
if (other.classtype != CT_HAZARD_LTRAIL_END)
{
if (self.spawnflags & LTRAIL_ACTIVE)
{
// currently active
// self.spawnflags &= ~LTRAIL_ACTIVE;
self.spawnflags = self.spawnflags -
LTRAIL_ACTIVE;
return;
}
else
{
// not active
// self.spawnflags |= LTRAIL_ACTIVE;
self.spawnflags = self.spawnflags +
LTRAIL_ACTIVE;
}
}
else if (!(self.spawnflags & LTRAIL_ACTIVE))
{
// user is lightning trail, but trail has
// been turned off. ignore the message.
return;
}
}

if (self.classtype == CT_HAZARD_LTRAIL_START)
{
self.items = time + self.weapon;
base_hazard_ltrail_fire ();
// using rad_time instead of ltrailLastUsed -- CEV
self.rad_time = time;
}
else if (self.classtype == CT_HAZARD_LTRAIL_RELAY)
{
self.items = time + self.weapon;
base_hazard_ltrail_fire ();
}
else
{
self.think = base_hazard_ltrail_chain;
self.nextthink = time + self.frags;
}
};

//--------------------------------------------------------------
void(entity e) base_hazard_ltrail_init =
{
base_mapentity_init (e);

e.use = base_hazard_ltrail_use;

precache_sound ("weapons/lhit.wav");
e.movetype = MOVETYPE_NONE;
e.solid = SOLID_BBOX;

if (e.currentammo == 0)
e.currentammo = 25;

if (e.weapon == 0)
e.weapon = 0.3;

if (e.frags == 0)
e.frags = 0.3;
};

//--------------------------------------------------------------
strip void() base_hazard_ltrail =
{
base_hazard_ltrail_init (self);
};
// };

/*QUAKED ltrail_start (0 1 0) (-8 -8 -8) (8 8 8) LT_TOGGLE START_ON 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

Starting point of a lightning trail.
Set currentammo to amount of damage you want the lightning to do.
Default is 25.

Set frags to amount of time before next item is triggered.
Default is 0.3 seconds.

Set weapon to amount of time to be firing the lightning.
Default is 0.3 seconds.

Set the LT_TOGGLE checkbox if you want the lightning shooter to continuously fire until triggered again.
*/
//----------------------------------------------------------------------
// class ltrail_start: base_hazard_ltrail
// {
//--------------------------------------------------------------
void(entity e) ltrail_start_init =
{
e.classname = "ltrail_start";
e.classtype = CT_HAZARD_LTRAIL_START;

base_hazard_ltrail_init (e);

// using rad_time instead of ltrailLastUsed -- CEV
e.rad_time = time;

if (e.spawnflags & LTRAIL_ACTIVE)
{
e.items = time + 99999999;
e.think = base_hazard_ltrail_fire;
e.nextthink = time + 0.1;
}
};

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

ltrail_start_init (self);
};
// };

/*QUAKED ltrail_relay (0 1 0) (-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
Relay point of a lightning trail.
Set currentammo to amount of damage you want the lightning to do.
Default is 25.

Set frags to amount of time before next item is triggered.
Default is 0.3 seconds.

Set weapon to amount of time to be firing the lightning.
Default is 0.3 seconds.
*/
//----------------------------------------------------------------------
// class ltrail_relay: base_hazard_ltrail
// {
//--------------------------------------------------------------
void(entity e) ltrail_relay_init =
{
e.classname = "ltrail_relay";
e.classtype = CT_HAZARD_LTRAIL_RELAY;

base_hazard_ltrail_init (e);
};

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

ltrail_relay_init (self);
};
// };

/*QUAKED ltrail_end (0 1 0) (-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
Ending point of a lightning trail.
Does not fire any lightning.

Set frags to amount of time before next item is triggered.
Default is 0.3 seconds.
*/
//----------------------------------------------------------------------
// class ltrail_end: base_hazard_ltrail
// {
//--------------------------------------------------------------
void(entity e) ltrail_end_init =
{
e.classname = "ltrail_end";
e.classtype = CT_HAZARD_LTRAIL_END;

base_hazard_ltrail_init (e);
};

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

ltrail_end_init (self);
};
// };

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

Log ltrail.qc

Date Commit Message Author + -
2024-03-24 2nd pass refactor, rework QC class structure cev +137 -120
2024-02-18 Client/player, projectiles, entrypoints refactor cev +2 -2
2024-01-31 Class based monster refactor & start projectiles cev +1 -1
2024-01-09 Continue OO / Class-based refactor cev +181 -124
2023-12-02 More refactoring & moving, begin adding mdls & snd cev +208  

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