mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Add physics overrides for walk speed and Fast Mode (#14475)
Co-authored-by: Wuzzy <Wuzzy@disroot.org>
This commit is contained in:
@@ -198,6 +198,15 @@ int LuaLocalPlayer::l_get_physics_override(lua_State *L)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user