// Check for out-of-range interaction
if (remote->type == InventoryLocation::NODEMETA) {
v3f node_pos = intToFloat(remote->p, BS);
- v3f player_pos = player->getPlayerSAO()->getBasePosition();
+ v3f player_pos = player->getPlayerSAO()->getEyePosition();
f32 d = player_pos.getDistanceFrom(node_pos);
if (!checkInteractDistance(player, d, "inventory"))
return;
else if (max_d < 0)
max_d = BS * 4.0f;
- // cube diagonal: sqrt(3) = 1.732
- if (d > max_d * 1.732) {
+ // Cube diagonal * 1.5 for maximal supported node extents:
+ // sqrt(3) * 1.5 ≅ 2.6
+ if (d > max_d + 2.6f * BS) {
actionstream << "Player " << player->getName()
<< " tried to access " << what
<< " from too far: "
if ((action == 0 || action == 2 || action == 3 || action == 4) &&
enable_anticheat && !isSingleplayer()) {
- float d = player_pos.getDistanceFrom(pointed_pos_under);
+ float d = playersao->getEyePosition()
+ .getDistanceFrom(pointed_pos_under);
+
if (!checkInteractDistance(player, d, pointed.dump())) {
// Re-send block to revert change on client-side
RemoteClient *client = getClient(pkt->getPeerId());
u16 i = 1;
for (const std::string &texture : prop->textures) {
lua_pushlstring(L, texture.c_str(), texture.size());
- lua_rawseti(L, -2, i);
+ lua_rawseti(L, -2, i++);
}
lua_setfield(L, -2, "textures");
i = 1;
for (const video::SColor &color : prop->colors) {
push_ARGB8(L, color);
- lua_rawseti(L, -2, i);
+ lua_rawseti(L, -2, i++);
}
lua_setfield(L, -2, "colors");
u16 i = 1;
for (const std::string &it : c.connects_to) {
lua_pushlstring(L, it.c_str(), it.size());
- lua_rawseti(L, -2, i);
+ lua_rawseti(L, -2, i++);
}
lua_setfield(L, -2, "connects_to");
u8 i = 1;
for (const aabb3f &it : box) {
push_aabb3f(L, it);
- lua_rawseti(L, -2, i);
+ lua_rawseti(L, -2, i++);
}
}
int i = 1;
for (const auto &dep : spec.depends) {
lua_pushstring(L, dep.c_str());
- lua_rawseti(L, -2, i);
- i++;
+ lua_rawseti(L, -2, i++);
}
lua_setfield(L, -2, "depends");
i = 1;
for (const auto &dep : spec.optdepends) {
lua_pushstring(L, dep.c_str());
- lua_rawseti(L, -2, i);
- i++;
+ lua_rawseti(L, -2, i++);
}
lua_setfield(L, -2, "optional_depends");
}
int i = 1;
for (u32 gen_notify_on_deco_id : emerge->gen_notify_on_deco_ids) {
lua_pushnumber(L, gen_notify_on_deco_id);
- lua_rawseti(L, -2, i);
- i++;
+ lua_rawseti(L, -2, i++);
}
return 2;
}
s16 i = 1;
for (const std::string ¶m : params) {
lua_pushlstring(L, param.c_str(), param.size());
- lua_rawseti(L, -2, i);
- i++;
+ lua_rawseti(L, -2, i++);
}
lua_pushboolean(L, clouds);
return 4;