This commit is contained in:
MihailRis 2025-09-26 22:03:08 +03:00
parent 792ee63f22
commit b98954f95e
5 changed files with 11 additions and 9 deletions

View File

@ -488,7 +488,10 @@ void PlayerController::updateInteraction(const Input& inputEvents, float delta)
}
const auto& bindings = inputEvents.getBindings();
bool xkey = bindings.active(BIND_PLAYER_FAST_INTERACTOIN);
float maxDistance = xkey ? 200.0f : player.getMaxInteractionDistance();
float maxDistance = player.getMaxInteractionDistance();
if (xkey) {
maxDistance *= 100.0;
}
bool longInteraction = interactionTimer <= 0 || xkey;
bool lclick = bindings.jactive(BIND_PLAYER_DESTROY) ||
(longInteraction && bindings.active(BIND_PLAYER_DESTROY));

View File

@ -2,14 +2,14 @@
#include <glm/glm.hpp>
#include "items/Inventory.hpp"
#include "libentity.hpp"
#include "objects/Entities.hpp"
#include "objects/Entity.hpp"
#include "objects/Player.hpp"
#include "objects/Players.hpp"
#include "objects/Entity.hpp"
#include "physics/Hitbox.hpp"
#include "window/Camera.hpp"
#include "world/Level.hpp"
#include "libentity.hpp"
using namespace scripting;
@ -190,7 +190,8 @@ static int l_get_interaction_distance(lua::State* L) {
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)) );
player->setMaxInteractionDistance(
static_cast<float>(lua::tonumber(L, 2)));
}
return 0;
}

View File

@ -293,7 +293,7 @@ void Player::deserialize(const dv::value& src) {
setSpawnPoint(glm::vec3(
sparr[0].asNumber(), sparr[1].asNumber(), sparr[2].asNumber()));
if (src.has("max-interaction-distance")) maxInteractionDistance = src["max-interaction-distance"].asNumber();
src.at("max-interaction-distance").get(maxInteractionDistance);
flight = src["flight"].asBoolean();
noclip = src["noclip"].asBoolean();

View File

@ -57,8 +57,6 @@ class Player : public Serializable {
bool infiniteItems = true;
bool instantDestruction = true;
bool loadingChunks = true;
// attributes
float maxInteractionDistance = 10.0f;
entityid_t eid = ENTITY_AUTO;