garrysmod-issues
garrysmod-issues copied to clipboard
Broken server-side functions in movement hooks
Details
CMoveData:SetButtons and CMoveData:SetImpulseCommand as well as CUserCmd:ClearButtons and CUserCmd:ClearMovement methods in now literally do nothing in GM:SetupMove, GM:Move and GM:FinishMove on the server.
Only GM:CreateMove on the client-side is able to stop the player.
Steps to reproduce
hook.Add( "SetupMove", "magical nothing", function( ply, mv, cmd )
---@cast ply Player
---@cast mv CMoveData
---@cast cmd CUserCmd
mv:SetImpulseCommand( 0 )
mv:SetButtons( 0 )
cmd:ClearButtons()
cmd:ClearMovement()
-- for some reason only IN_JUMP stops here, but the player can still run and shoot...
end )
I experienced this around 2-3 months ago, when some of my scripts got broken. Forgot to write about this, but maybe the time interval would be helpful.
I just loaded up a version from 12 months ago (on x86-64) and the code you provided behaves exactly the same there, so something doesn't add up here.
I haven't used it in a long time so I can't say how long ago, probably over a year ago, anyway this is extremely strange behavior, why only IN_JUMP stops there? It's like "ok it doesn't remove buttons at all and everything refers to GM:StartCommand", but no, the wiki says we can create magical CMoveData:RemoveKeys which is very different from the actual behavior of the hook.
I have just tried a build from July 2021 (on dev beta this time) and it still behaves consistently to latest version. So unless you waited over 4 years to report this bug, your code does not show what was supposedly broken.