djcev.com

//

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

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

Show hurt.qc

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

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

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

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

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;

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

/*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);
};
// };

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

Log hurt.qc

Date Commit Message Author + -
2024-03-24 2nd pass refactor, rework QC class structure cev +60 -35
2024-02-18 Client/player, projectiles, entrypoints refactor cev +1 -1
2024-01-09 Continue OO / Class-based refactor cev +13 -14
2023-12-09 Start OO / class-based refactor, work on items cev +75 -76
2023-11-20 changes to movement, build environment, file reorg cev +89  

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