djcev.com

//

Git Repos / fte_dogmode / qc / triggers / hurt.qc

Last update to this file was on 2025-08-13 at 05:20.

Show hurt.qc

//==============================================================================
// trigger_hurt -- from hip_rotate.qc by Jim Dose' 10/17/96
//==============================================================================

//======================================================================
// fields
//======================================================================

#if 0
// 1998-07-03 hurt_touch fix by Robert Field start
// .float hurt_together_time; // changed to .movetimer -- CEV
// .float hurt_nextthink; // changed to .delay -- CEV
// 1998-07-03 hurt_touch fix by Robert Field end
#endif

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

#ifdef SSQC
// trigger_hurt
void(entity e, float amount) trigger_hurt_setdamage;
// void() trigger_hurt_on;
void() trigger_hurt_touch;
void(entity e) trigger_hurt_init;
void() trigger_hurt;
#endif

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

#ifdef SSQC
/*QUAKED trigger_hurt (.5 .5 .5) ? 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
Any object touching this will be hurt
set dmg to damage amount
defalt dmg = 5
*/
//----------------------------------------------------------------------
// class trigger_hurt: base_trigger
// {
//--------------------------------------------------------------
void(entity e, float amount) trigger_hurt_setdamage =
{
e.dmg = amount;

if (!amount)
e.solid = SOLID_NOT;
else
e.solid = SOLID_TRIGGER;

e.nextthink = -1;
};

#if 0
//--------------------------------------------------------------
// 1998-07-03 hurt_touch fix by Robert Field start
void() trigger_hurt_on =
{
self.solid = SOLID_TRIGGER;
self.nextthink = -1;
};
// 1998-07-03 hurt_touch fix by Robert Field end
#endif

//--------------------------------------------------------------
void() trigger_hurt_touch =
{
if (self.stateflags & STATE_INACTIVE)
return;

// from Copper -- dumptruck_ds
if (other.movetype == MOVETYPE_NOCLIP)
return;

if (other.takedamage && self.nextthink < time)
{
#if 0
// 1998-07-03 trigger_hurt_touch fix by Robert Field
if (time != self.hurt_together_time)
if (time < self.hurt_nextthink)
return;
t_damage2 (other, self, self, self.dmg);
self.hurt_together_time = time;
self.hurt_nextthink = time + 1;
// 1998-07-03 trigger_hurt_touch fix by Robert Field end
#endif

if (time != self.movetimer)
if (time < self.delay)
return;
t_damage2 (other, self, self, self.dmg);
self.movetimer = time;
self.delay = time + 1;
}

return;
};

//--------------------------------------------------------------
void(entity e) trigger_hurt_init =
{
e.classname = "trigger_hurt";
e.classtype = CT_TRIGGER_HURT;

base_trigger_init (e);
e.touch = trigger_hurt_touch;

if (!e.dmg)
e.dmg = 5;

sub_checkwaiting (e);
};

//--------------------------------------------------------------
void() trigger_hurt =
{
BASE_TRIGGER_PREINIT (base_trigger_init_field)
trigger_hurt_init (self);
};
// };
#endif

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

Log hurt.qc

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