Facepunch / garrysmod-issues

Garry's Mod issue tracker
141 stars 56 forks source link

PlayerShouldTakeDamage not called clientside #3020

Open markusmarkusz opened 7 years ago

markusmarkusz commented 7 years ago

Details

GM:PlayerShouldTakeDamage() isn't called shared.

Steps to reproduce

Add a hook to test it.

As far as I know, it was a shared hook. (Somewhere I read it was a predicted hook.)

ghost commented 7 years ago

http://wiki.garrysmod.com/page/GM/PlayerShouldTakeDamage It's called server-side only.

Kefta commented 7 years ago

http://wiki.garrysmod.com/index.php?title=GM/PlayerShouldTakeDamage&diff=16933&oldid=12999 It's still in shared.lua of the base gamemode.

markusmarkusz commented 7 years ago

Somewhere (I think in the Sandbox gamemode.) there is a comment that says PlayerShouldTakeDamage is shared.

Kefta commented 7 years ago

Yup https://github.com/garrynewman/garrysmod/blob/784cd57576d85712fa13a7cea3a9523b4df966b0/garrysmod/gamemodes/sandbox/gamemode/init.lua#L80-L86

robotboy655 commented 7 years ago

It technically is a shared hook as it can be called from the engine to Lua on client, but there's nothing in the engine that triggers the conditions on the client which is why it is never called on client in Lua.

markusmarkusz commented 7 years ago

The comment in Sandbox says:

This is a shared function - the client will think they can 
     damage the players even though they can't. This just means the 
     prediction will show blood.

If I understood correctly, this hook was responsible for seeing blood if you shoot at someone, right? Which hook does this now? Is there any reason left to have this hook shared?

Bo98 commented 7 years ago

ScalePlayerDamage should work for stopping blood particle effects.