garrysmod-issues icon indicating copy to clipboard operation
garrysmod-issues copied to clipboard

Broken server-side functions in movement hooks

Open unknown-gd opened this issue 6 months ago • 4 comments

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 )

unknown-gd avatar May 20 '25 22:05 unknown-gd

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.

Zvbhrf avatar May 21 '25 06:05 Zvbhrf

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.

robotboy655 avatar May 21 '25 14:05 robotboy655

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.

unknown-gd avatar May 21 '25 15:05 unknown-gd

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.

robotboy655 avatar May 21 '25 16:05 robotboy655