Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-player speed / jump / gravity overrides #598

Closed

Conversation

MirceaKitsune
Copy link
Contributor

Since I coded the new player physics, people frequently asked if something could be done to create low gravity areas and allow per-player weights. RealBadAngel also said he's like to do a jump boots powerup for one of his ideas, and I don't think running boots would be a bad idea either (or slow nodes like MineCraft's "soul sand").

So here's a patch which allows doing all that. It implements a new Lua function that can modify walking speed, jump height and gravity for individual players. To test it, use this function in a Lua script: player:set_physics_override(float_speed, float_jump, float_gravity). By default all values are 1... 0.5 means half of the normal amount while 2 means double the normal amount. They basically multiply the global physics settings in minetest.conf for individual players as optional overrides. I found this the cleanest and safest implementation so I hope no major changes are needed.

@ShadowNinja
Copy link
Member

I think you should be able to set the three overrides individually.
That way you would be able to, for example, use running boots and also have a jump boost.

@MirceaKitsune
Copy link
Contributor Author

ShadowNinja: I thought about that. But adding a function for each setting would make a mess in the code and add unnecessary complexity. Best to keep one function for the physics override as a whole. Especially since if I'm correct, you can modify individual values if you need to.

eg: Instead of using (1, 1, 0.5) to modify gravity (erasing speed and jump changes other mods could have made) you can use ( , , 0.5) which only modifies the third value. Hope I'm not wrong here, but pretty sure Lua works that way when the ~nil check is in place.

@ShadowNinja
Copy link
Member

Good, I thought then you had to set them all.

@Uberi
Copy link
Contributor

Uberi commented Apr 4, 2013

If you ask me, there should also be a function that gets the movement physics values, even if only for consistency.

@PilzAdam
Copy link
Contributor

PilzAdam commented Apr 5, 2013

c5a8448

@PilzAdam PilzAdam closed this Apr 5, 2013
@ghost
Copy link

ghost commented Apr 6, 2013

...maybe now someone can resurrect a new potion mod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants