Player Attributes (#578)

* feat: add max interaction distance functionality to Player class and Lua bindings

* feat: add getter and setter for max interaction distance in Player class documentation

* feat: add speed and gravity scale properties with corresponding getters and setters in Player class

* fix: replace deprecated __max and __min with std::max and std::min in setMaxInteractionDistance

* feat: add time scale functionality with getters and setters in World and Engine classes

* remove speed and gravity scale functions from player and world libraries

* remove time scale setting on world open and close

* rename interaction distance functions for consistency

* refactor: update interaction distance functions and remove time scale methods

* refactor: revert classes.lua to dev

* refactor: remove time scale functionality from Engine and World classes

* fix: Now I’ve definitely rolled back `classes.lua`.

* refactor: remove unused player attributes and clean up player class

* Update Player.hpp

removed unused methods from Player.cpp
This commit is contained in:
GHOST11111100
2025-09-26 21:59:15 +03:00
committed by GitHub
parent 4c815db222
commit 792ee63f22
8 changed files with 52 additions and 3 deletions
@@ -181,6 +181,20 @@ static int l_set_loading_chunks(lua::State* L) {
return 0;
}
static int l_get_interaction_distance(lua::State* L) {
if (auto player = get_player(L, 1)) {
return lua::pushnumber(L, player->getMaxInteractionDistance());
}
return 0;
}
static int l_set_interaction_distance(lua::State* L) {
if (auto player = get_player(L, 1)) {
player->setMaxInteractionDistance( static_cast<float>(lua::tonumber(L, 2)) );
}
return 0;
}
static int l_get_selected_block(lua::State* L) {
if (auto player = get_player(L, 1)) {
if (player->selection.vox.id == BLOCK_VOID) {
@@ -328,6 +342,8 @@ const luaL_Reg playerlib[] = {
{"set_instant_destruction", lua::wrap<l_set_instant_destruction>},
{"is_loading_chunks", lua::wrap<l_is_loading_chunks>},
{"set_loading_chunks", lua::wrap<l_set_loading_chunks>},
{"get_interaction_distance", lua::wrap<l_get_interaction_distance>},
{"set_interaction_distance", lua::wrap<l_set_interaction_distance>},
{"set_selected_slot", lua::wrap<l_set_selected_slot>},
{"get_selected_block", lua::wrap<l_get_selected_block>},
{"get_selected_entity", lua::wrap<l_get_selected_entity>},