djcev.com

//

Git Repos / fte_dogmode / qc / func / hurt.qc

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

Show hurt.qc

//==============================================================================
// func_hurt -- entity from MG1
//==============================================================================

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

#ifdef SSQC
//----------------------------------------------------------------------
// func_hurt spawnflags -- CEV
//----------------------------------------------------------------------
typedef enumflags
{
SPAWNFLAG_FUNC_HURT_START_ON = 1
// SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
// SPAWNFLAG_NOT_ON_NORMAL = 512,
// SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
// SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
// SPAWNFLAG_NOT_IN_COOP = 4096,
// SPAWNFLAG_NOT_IN_SP = 8192,
// SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
// SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
// SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
} func_hurt_spawnflags;
#endif

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

// func_hurt
#ifdef CSQC
void(float isnew) func_hurt_netreceive;
#endif
#ifdef SSQC
void() func_hurt_touch;
void() func_hurt_use;
#endif
#if defined(CSQC) || defined(SSQC)
void(entity e) func_hurt_init;
#endif
#ifdef SSQC
void() func_hurt;
#endif

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

//----------------------------------------------------------------------
// class func_hurt: base_func
// {
#ifdef CSQC
//--------------------------------------------------------------
void(float isnew) func_hurt_netreceive =
{
// creates the netflag variable -- CEV
BASE_FUNC_NETRECEIVE (func_hurt_init)
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() func_hurt_touch =
{
if (self.stateflags & STATE_INACTIVE)
return;

if (other.health <= 0)
return;

if (!other.takedamage)
return;

if (!(other.flags & (FL_CLIENT | FL_MONSTER)))
return;

if (self.attack_finished > time)
return;

t_damage2 (other, self, world, self.dmg);
self.attack_finished = time + self.wait;
};

//--------------------------------------------------------------
void() func_hurt_use =
{
if (self.stateflags & STATE_INACTIVE)
self.stateflags &= ~STATE_INACTIVE;
else
self.stateflags |= STATE_INACTIVE;

self.attack_finished = 0;
};
#endif

#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_hurt_init =
{
e.classname = "func_hurt";
e.classtype = CT_FUNC_HURT;
base_func_init (e);

#ifdef CSQC
setmodelindex (e, e.modelindex);
setsize (e, e.mins, e.maxs);
setorigin (e, e.origin);
e.drawmask = DRAWMASK_NORMAL;
e.predraw = base_func_predraw;
#endif

#ifdef SSQC
setmodel (e, e.model);
setorigin (e, e.origin);
e.solid = SOLID_BSP;
e.movetype = MOVETYPE_PUSH;
e.touch = func_hurt_touch;
e.use = func_hurt_use;

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

if (!e.wait)
e.wait = 0.2;

if (!(e.spawnflags & SPAWNFLAG_FUNC_HURT_START_ON))
e.stateflags |= STATE_INACTIVE;

// send it off to CSQC -- CEV
e.tick = base_func_neteval;
e.SendEntity = base_entity_netsend;
e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
#endif
};
#endif

#ifdef SSQC
//--------------------------------------------------------------
void() func_hurt =
{
BASE_FUNC_PREINIT (__NULL__)
func_hurt_init (self);
};
#endif
// }

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

Log hurt.qc

Date Commit Message Author + -
2025-08-13 Another big commit. Item changes, field rework, etc. cev +145  

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