EQMacEmu / Server

Other
28 stars 96 forks source link

IsMoving() now usable on clients #13

Closed Dwordis closed 1 year ago

Dwordis commented 1 year ago

Adds a SetMoving() line to ClientUpdate similar to PEQ. Allows the use of IsMoving() on Clients.

solar984 commented 1 year ago

This is checking the position, so it's not checking that the client is moving, it's checking that it changed position already. If you want to check if a client is moving, that it is expected to change position in the future, then you should check the delta values not the previous position. I suggest checking m_Delta or using ClientMoving(). You could also make IsMoving() virtual and have the client version call ClientMoving().

Dwordis commented 1 year ago

https://cdn.discordapp.com/attachments/648809136363929603/1144741313120583783/image.png

Hmmm, so what you're saying is, instead of using the old position and new position to determine whether the client moved, use the rate at which they're moving? Delta? Or am I misreading. For my own purposes, this method works perfectly, the player is determined to be moving when they are "moving", not when they have "moved", the screenshot above shows when the code executes during movement.

Am I wrong?

solar984 commented 1 year ago

The delta values are what gives it velocity and animates the model so it walks instead of stands. If you simply push forward after standing around, both the position and the delta will change from the resting state and you'll get the same result, but you're testing if the position changed, not whether they are moving, though the distinction might be subtle. I'm just saying this already exists and it's called ClientMoving(). It is possible to change position without having movement delta by gating or being summoned, for example, but this isn't the same as moving with the directional controls which set the delta. It is also possible to have delta without changing position, you can test this by walking against a wall/corner. This is important for how ClientMoving() is used when checking if a player is meditating. If they are walking against a wall, they are pushing up against it and not changing position, but they are moving and not meditating.

Dwordis commented 1 year ago

I see thank you for the knowledge