bug: knife damage on dead players


(SCDS_reyalP) #1

As reported by Hypnotoad here:
http://bani.anime.net/banimod/forums/viewtopic.php?t=3403

When knife damage is calculated, the backstab check doesn’t make sure that the player being backstabbed is alive. So knifing a corpse from some directions can give you near instant limbo.
src/game/g_weapon.c:Weapon_Knife


	if(traceEnt->client) 
	{
		AngleVectors (ent->client->ps.viewangles,		pforward, NULL, NULL);
		AngleVectors (traceEnt->client->ps.viewangles,	eforward, NULL, NULL);

		if( DotProduct( eforward, pforward ) > 0.6f )		// from behind(-ish)
		{
			damage = 100;	// enough to drop a 'normal' (100 health) human with one jab
			mod = MOD_KNIFE;

			if ( ent->client->sess.skill[SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS] >= 4 )
				damage = traceEnt->health;

		}
	}


Simple fix would be to check tracent.health in the if.

Also in the above code, it level 4 covert ‘carries over’ to every class.


(Domipheus) #2

surely that is intensional tho, if you stab a ‘revivable’ corpse then he should goto limbo.


(SCDS_reyalP) #3

That’s not what this is about. The question is, should you be able to do ‘backstab’ damage when knifing a body ? I would guess no, since:

  1. backstab icon is never drawn for bodies. AFAIK.
  2. backstab direction depends on view angles, which you have no way of knowing for a body.
  3. dead players lie on their backs, so how the f**k are you going to backstab them ?

edit: hmmm, not postive about #1 actually. I never noticed it…


(Domipheus) #4

ohh yeah, never mind me then :moo:


(Rain) #5

But I like that bug!

FWIW, the viewangles don’t change (I think) for dead players–you can almost always force someone into limbo by stabbing them if you face towards the top of their head. Think as though you’re slitting their throat. Or something.
:moo:


(fretn) #6

in rtcw it was something like this:

set your fov to 90
sit close to their head, make sure your compass pointing the player’s head
point to his left feet
and stab :slight_smile:

hm, I should make a screen


(Chruker) #7

If I enclose the content of the ‘if (traceEnt->client) {’ block with another if like this one:


if (traceEnt->health > 0) {

Would that be sufficient to fix this bug?

Is there a more correct way to check if a player is dead?


(SCDS_reyalP) #8
if(tracEnt->client && traceEnt->health > 0)