djcev.com

//

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

Last update to this file was on 2024-06-15 at 19:50.

Show hurt.qc

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

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

#ifdef SSQC
// 1998-07-03 hurt_touch fix by Robert Field start
.float hurt_together_time;
.float hurt_nextthink;
// 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;
};

//--------------------------------------------------------------
// 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

//--------------------------------------------------------------
void() trigger_hurt_touch =
{
if (self.estate != STATE_ACTIVE)
return;

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

if (other.takedamage && self.nextthink < time)
{
// 1998-07-03 trigger_hurt_touch fix by Robert Field
// self.solid = SOLID_NOT;
if (time != self.hurt_together_time)
if (time < self.hurt_nextthink)
return;
// 1998-07-03 hurt_touch fix by Robert Field end
t_damage2 (other, self, self, self.dmg);
// 1998-07-03 hurt_touch fix by Robert Field start
// self.think = hurt_on;
// self.nextthink = time + 1;
self.hurt_together_time = time;
self.hurt_nextthink = time + 1;
// 1998-07-03 trigger_hurt_touch fix by Robert Field end
}

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 =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;

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.