Vehicles don't trigger EntityTakeDamage?

I’m trying to make a simple script that will transfer a modified amount of damage to the driver of a seat when the seat takes damage. With Jeeps, it seems to do this by default if you hit the correct location, however a player sitting in a seat is, for all intents and purposes… invincible.

This would seem as easy as adding an EntityTakeDamage hook, but even when I make a debug function like this:

[lua]local function DebugDamage( target, inflictor, attacker, damage, info )
print( target:GetClass() )
hook.Add( “EntityTakeDamage”, “DamageTest”, DebugDamage )[/lua]

It does nothing when I shoot the seat. When I shoot a prop, it prints “prop_physics” to the console, as expected.

Is there any workaround for this?


It works fine with the actual “jeep”, printing “prop_vehicle_jeep” to the console. But individual seats and pods remain unaffected.

Sorry to bump this, but I stilll haven’t figured it out. :frowning:

Try to print damage values also

Seems like valve coded the prop_vehicle_prisoner_pod to (almost) never receive damage. It doesn’t even trace back to it’s baseclass. It will only cause damage to the player if the damage hitgroup is VEHICLE_HITBOX_DRIVER (Otherwise it’s ignoring all other damage). You’d probably have to ask garry to fix it so it behaves like other vehicles or possibly make a binary module, but I’m unsure if that’ll work.

:frowning: I thought this might be the case. Thanks for the information.

Bumping this, why it’s still an issue?

[editline]7th January 2014[/editline]

Right now, I have to use hacky workaround using entity with parented prisoner pod to it. It’s not really convenient.

[editline]7th January 2014[/editline]

Tried to see something in scripts/vehicles/ folder, found nothing, unfortunately.

good luck getting a word in over Rust.

The solution is to get the weapon metatable and detour the FireBullet function. For explosive damage, vehicle damage is supposedly called and works if you just write for the player to take damage, but it has never worked for me, so I just stick with my script that detours util.BlastDamage.

Not weapon metatable, but entity metatable.

weapons don’t fire bullets, players do.


Steam has nothing to do with this. Like at all. Entities fire bullets, not specifically weapons or players.

It was a joke…
(way to ruin it…)

I wasn’t specifying that only players call firebullets, as it is found in FindMetaTable(“Entity”). But also note that in most sweps the owner of the weapon calls FireBullets and not the weapon itself

It was a terrible joke.

Yeah whoops, I misspoke.

[editline]7th January 2014[/editline]

I don’t get it? Steamlogic?
And last I checked the weapon is usually the one to fire bullets? Having the player fire them would be rife with prediction issues.

SWEP:ShootBullet calls self.Owner:FireBullets

Need explosion damage for chairs :expressionless:

Hope this works

Looks like team garry did it. EntityTakeDamage works on chairs for explosions now. (That, or I somehow got it working)

If it wasn’t updated, I have SetCollisionGroup(COLLISION_GROUP_NONE) so people cant nocollide vehicles through stuff so maybe that’s it.