Fix wrong usage of set_physics_override, use playerphysics instead #7

Closed
cora wants to merge 1 commits from (deleted):fix_phys_override into master
First-time contributor

player:set_physics_override takes a table with physics overrides as an argument. According to my research this has been the case at least since minetest 5.0.0. This sets the physics override correctly and fixes warnings (and apparently a crash - see https://codeberg.org/mineclonia/mineclonia/pulls/1134#issuecomment-1567981 )

This also improves interaction with other mods by caching the previously set overrides and restoring them when the player leaves the lay/sit state.

Now I'm not sure what the 3rd argument was supposed to be – gravity? but setting that to 0 doesn't seem to make a lot of sense to me so I left it out. I think setting speed and jump to 0 will probably suffice.

Testing

  • Verify the /lay and /sit commands still work as expected,
  • Verify the player can get up from lying or sitting position and move as usually again
  • Bonus: write a mod modifying speed or jump using physics override and verify it works again after getting up from lying or sitting.
player:set_physics_override takes a table with physics overrides as an argument. According to my research this has been the case at least since minetest 5.0.0. This sets the physics override correctly and fixes warnings (and apparently a crash - see https://codeberg.org/mineclonia/mineclonia/pulls/1134#issuecomment-1567981 ) This also improves interaction with other mods by caching the previously set overrides and restoring them when the player leaves the lay/sit state. Now I'm not sure what the 3rd argument was supposed to be – gravity? but setting that to 0 doesn't seem to make a lot of sense to me so I left it out. I think setting speed and jump to 0 will probably suffice. ### Testing * Verify the /lay and /sit commands still work as expected, * Verify the player can get up from lying or sitting position and move as usually again * Bonus: write a mod modifying speed or jump using physics override and verify it works again after getting up from lying or sitting.
Author
First-time contributor

oh didn't notice #6 when doing this, however I think this variant may be better since it resets to the values set before and not to static 1

oh didn't notice #6 when doing this, however I think this variant may be better since it resets to the values set before and not to static 1

Looks good. But then it leaves me wondering how it works with the physics overrides in Mineclone itself... if this is supposed to be specifically for it, shouldn't it just use the playerphysics API?

Looks good. But then it leaves me wondering how it works with the physics overrides in Mineclone itself... if this is supposed to be specifically for it, shouldn't it just use the playerphysics API?
Author
First-time contributor

Pretty sure the goal here is to set it to 0 when the player is sitting or lying and not to a cumulative value like playerphysics would.

This neither changes the values stored in player meta by playerphysics nor set it to potentially something else after it's done (like the current version does).

Pretty sure the goal here is to set it to 0 when the player is sitting or lying and not to a cumulative value like playerphysics would. This neither changes the values stored in player meta by playerphysics nor set it to potentially something else after it's done (like the current version does).
Author
First-time contributor

then again looks like playerphysics multiplies it so could probably work if you put 0

then again looks like playerphysics multiplies it so could probably work if you put 0
cora force-pushed fix_phys_override from 6adbabeabe to 968650dd6b 2024-02-16 11:28:44 +01:00 Compare
cora force-pushed fix_phys_override from 968650dd6b to 97820be741 2024-02-16 11:29:36 +01:00 Compare
Author
First-time contributor

amended it

amended it
cora changed title from Fix wrong usage of set_physics_override to Fix wrong usage of set_physics_override, use playerphysics instead 2024-02-16 11:32:34 +01:00
Member

Merged: 25e3efc9ae

Merged: [`25e3efc9ae`](https://git.minetest.land/MineClone2/mcl_cozy/commit/25e3efc9aef064de97352e5b50203bd7ace2c702)
rudzik8 closed this pull request 2024-02-22 13:31:49 +01:00
This repo is archived. You cannot comment on pull requests.
No description provided.