1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add physics overrides for walk speed and Fast Mode (#14475)

Co-authored-by: Wuzzy <Wuzzy@disroot.org>
This commit is contained in:
grorp 2024-04-30 13:50:01 +02:00 committed by GitHub
parent c044a3c1ca
commit 2bdd0a6bdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 94 additions and 33 deletions

View file

@ -1610,6 +1610,9 @@ int ObjectRef::l_set_physics_override(lua_State *L)
getfloatfield(L, 2, "liquid_sink", phys.liquid_sink);
getfloatfield(L, 2, "acceleration_default", phys.acceleration_default);
getfloatfield(L, 2, "acceleration_air", phys.acceleration_air);
getfloatfield(L, 2, "speed_fast", phys.speed_fast);
getfloatfield(L, 2, "acceleration_fast", phys.acceleration_fast);
getfloatfield(L, 2, "speed_walk", phys.speed_walk);
if (phys != old)
playersao->m_physics_override_sent = false;
@ -1653,6 +1656,12 @@ int ObjectRef::l_get_physics_override(lua_State *L)
lua_setfield(L, -2, "acceleration_default");
lua_pushnumber(L, phys.acceleration_air);
lua_setfield(L, -2, "acceleration_air");
lua_pushnumber(L, phys.speed_fast);
lua_setfield(L, -2, "speed_fast");
lua_pushnumber(L, phys.acceleration_fast);
lua_setfield(L, -2, "acceleration_fast");
lua_pushnumber(L, phys.speed_walk);
lua_setfield(L, -2, "speed_walk");
return 1;
}