Physics overrides: Move values to a common struct (#12591)

Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
SmallJoker
2022-08-12 11:17:02 +02:00
committed by GitHub
parent df1d215f48
commit c8ee755c05
11 changed files with 81 additions and 71 deletions

View File

@@ -157,23 +157,24 @@ int LuaLocalPlayer::l_get_physics_override(lua_State *L)
{
LocalPlayer *player = getobject(L, 1);
const auto &phys = player->physics_override;
lua_newtable(L);
lua_pushnumber(L, player->physics_override_speed);
lua_pushnumber(L, phys.speed);
lua_setfield(L, -2, "speed");
lua_pushnumber(L, player->physics_override_jump);
lua_pushnumber(L, phys.jump);
lua_setfield(L, -2, "jump");
lua_pushnumber(L, player->physics_override_gravity);
lua_pushnumber(L, phys.gravity);
lua_setfield(L, -2, "gravity");
lua_pushboolean(L, player->physics_override_sneak);
lua_pushboolean(L, phys.sneak);
lua_setfield(L, -2, "sneak");
lua_pushboolean(L, player->physics_override_sneak_glitch);
lua_pushboolean(L, phys.sneak_glitch);
lua_setfield(L, -2, "sneak_glitch");
lua_pushboolean(L, player->physics_override_new_move);
lua_pushboolean(L, phys.new_move);
lua_setfield(L, -2, "new_move");
return 1;