cleanup
This commit is contained in:
parent
792ee63f22
commit
b98954f95e
@ -488,7 +488,10 @@ void PlayerController::updateInteraction(const Input& inputEvents, float delta)
|
|||||||
}
|
}
|
||||||
const auto& bindings = inputEvents.getBindings();
|
const auto& bindings = inputEvents.getBindings();
|
||||||
bool xkey = bindings.active(BIND_PLAYER_FAST_INTERACTOIN);
|
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 longInteraction = interactionTimer <= 0 || xkey;
|
||||||
bool lclick = bindings.jactive(BIND_PLAYER_DESTROY) ||
|
bool lclick = bindings.jactive(BIND_PLAYER_DESTROY) ||
|
||||||
(longInteraction && bindings.active(BIND_PLAYER_DESTROY));
|
(longInteraction && bindings.active(BIND_PLAYER_DESTROY));
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include "items/Inventory.hpp"
|
#include "items/Inventory.hpp"
|
||||||
|
#include "libentity.hpp"
|
||||||
#include "objects/Entities.hpp"
|
#include "objects/Entities.hpp"
|
||||||
|
#include "objects/Entity.hpp"
|
||||||
#include "objects/Player.hpp"
|
#include "objects/Player.hpp"
|
||||||
#include "objects/Players.hpp"
|
#include "objects/Players.hpp"
|
||||||
#include "objects/Entity.hpp"
|
|
||||||
#include "physics/Hitbox.hpp"
|
#include "physics/Hitbox.hpp"
|
||||||
#include "window/Camera.hpp"
|
#include "window/Camera.hpp"
|
||||||
#include "world/Level.hpp"
|
#include "world/Level.hpp"
|
||||||
#include "libentity.hpp"
|
|
||||||
|
|
||||||
using namespace scripting;
|
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) {
|
static int l_set_interaction_distance(lua::State* L) {
|
||||||
if (auto player = get_player(L, 1)) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -293,7 +293,7 @@ void Player::deserialize(const dv::value& src) {
|
|||||||
setSpawnPoint(glm::vec3(
|
setSpawnPoint(glm::vec3(
|
||||||
sparr[0].asNumber(), sparr[1].asNumber(), sparr[2].asNumber()));
|
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();
|
flight = src["flight"].asBoolean();
|
||||||
noclip = src["noclip"].asBoolean();
|
noclip = src["noclip"].asBoolean();
|
||||||
|
|||||||
@ -57,8 +57,6 @@ class Player : public Serializable {
|
|||||||
bool infiniteItems = true;
|
bool infiniteItems = true;
|
||||||
bool instantDestruction = true;
|
bool instantDestruction = true;
|
||||||
bool loadingChunks = true;
|
bool loadingChunks = true;
|
||||||
|
|
||||||
// attributes
|
|
||||||
float maxInteractionDistance = 10.0f;
|
float maxInteractionDistance = 10.0f;
|
||||||
|
|
||||||
entityid_t eid = ENTITY_AUTO;
|
entityid_t eid = ENTITY_AUTO;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user