MCPcopy Create free account
hub / github.com/JACoders/OpenJK / hurt_touch

Function hurt_touch

code/game/g_trigger.cpp:1126–1274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1124}
1125extern void JET_FlyStart(gentity_t* actor);
1126void hurt_touch( gentity_t *self, gentity_t *other, trace_t *trace )
1127{
1128 int dflags;
1129 int actualDmg = self->damage;
1130
1131 if ( self->svFlags & SVF_INACTIVE )
1132 {//set by target_deactivate
1133 return;
1134 }
1135
1136 if ( !other->takedamage )
1137 {
1138 return;
1139 }
1140
1141 if( level.time < self->painDebounceTime + self->wait ) // normal 'wait' check
1142 {
1143 if( self->spawnflags & 2048 ) // MULTIPLE - allow multiple entities to touch this trigger in one frame
1144 {
1145 if ( self->painDebounceTime && level.time > self->painDebounceTime ) // if we haven't reached the next frame continue to let ents touch the trigger
1146 {
1147 return;
1148 }
1149 }
1150 else // only allowing one ent per frame to touch trigger
1151 {
1152 return;
1153 }
1154 }
1155
1156 // if the player has already activated this trigger this frame
1157 if( other && !other->s.number && self->aimDebounceTime == level.time )
1158 {
1159 return;
1160 }
1161
1162
1163 if ( self->spawnflags & 2 )
1164 {//player only
1165 if ( other->s.number )
1166 {
1167 return;
1168 }
1169 }
1170
1171 if ( self->NPC_targetname && self->NPC_targetname[0] )
1172 {//I am for you, Kirk
1173 if ( other->script_targetname && other->script_targetname[0] )
1174 {//must have a name
1175 if ( Q_stricmp( self->NPC_targetname, other->script_targetname ) != 0 )
1176 {//not the right guy to fire me off
1177 return;
1178 }
1179 }
1180 else
1181 {//no name? No trigger.
1182 return;
1183 }

Callers

nothing calls this directly

Calls 5

Q_stricmpFunction · 0.85
JET_FlyStartFunction · 0.85
G_SoundFunction · 0.70
G_DamageFunction · 0.70
CGCam_FadeFunction · 0.50

Tested by

no test coverage detected