Permalink
Browse files

Merge remote-tracking branch 'minetest/master'

  • Loading branch information...
proller committed Dec 27, 2016
2 parents fdb7682 + 084cdea commit 1efdd353aa971f813ca44b1bd15d2a74bb26a7fb
View
@@ -2036,9 +2036,10 @@ Call these functions only at load time!
* `minetest.register_on_cheat(func(ObjectRef, cheat))`
* Called when a player cheats
* `cheat`: `{type=<cheat_type>}`, where `<cheat_type>` is one of:
* `"moved_too_fast"`
* `"interacted_too_far"`
* `"finished_unknown_dig"`
* `moved_too_fast`
* `interacted_too_far`
* `interacted_while_dead`
* `finished_unknown_dig`
* `dug_unbreakable`
* `dug_too_fast`
* `minetest.register_on_chat_message(func(name, message))`
@@ -125,6 +125,10 @@ namespace gui
bool flgmip = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
bool flgcpy = driver->getTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY);
driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, true);
#endif
// Set the texture color format.
switch (pixel_mode)
@@ -140,6 +144,9 @@ namespace gui
// Restore our texture creation flags.
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, flgmip);
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, flgcpy);
#endif
return texture ? true : false;
}
View
@@ -27,8 +27,6 @@
#include <cassert>
#include <map>
#define PP(x) ((x).X)<<" "<<((x).Y)<<" "<<((x).Z)<<" "
u8 CircuitElement::face_to_shift[] = {
0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5
View
@@ -962,7 +962,7 @@ video::ITexture* TextureSource::generateTextureFromMesh(
smgr->drop();
// Unset render target
driver->setRenderTarget(0, false, true);
driver->setRenderTarget(0, false, true, video::SColor(0,0,0,0));
if (params.delete_texture_on_shutdown)
m_texture_trash.push_back(rtt);
View
@@ -387,6 +387,10 @@ void draw_pageflip_3d_mode(Camera& camera, bool show_hud,
bool draw_wield_tool, Client& client, gui::IGUIEnvironment* guienv,
video::SColor skycolor)
{
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
errorstream << "Pageflip 3D mode is not supported"
<< " with your Irrlicht version!" << std::endl;
#else
/* preserve old setup*/
irr::core::vector3df oldPosition = camera.getCameraNode()->getPosition();
irr::core::vector3df oldTarget = camera.getCameraNode()->getTarget();
@@ -461,6 +465,7 @@ void draw_pageflip_3d_mode(Camera& camera, bool show_hud,
camera.getCameraNode()->setPosition(oldPosition);
camera.getCameraNode()->setTarget(oldTarget);
#endif
}
void draw_plain(Camera &camera, bool show_hud, Hud &hud,
View
@@ -2194,12 +2194,11 @@ void Game::shutdown()
g_profiler->print(actionstream);
}
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8
if (g_settings->get("3d_mode") == "pageflip") {
// fmTODO: fixme:
#if IRRLICHT_VERSION_10000 < 10900
driver->setRenderTarget(irr::video::ERT_STEREO_BOTH_BUFFERS);
#endif
}
#endif
showOverlayMessage(wstrgettext("Shutting down..."), 0, 0, false);
@@ -20,6 +20,10 @@
#if USE_FREETYPE
#include "cguittfont/xCGUITTFont.h"
#endif
#ifndef _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
// newer Irrlicht versions no longer have this
#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
#endif
#include "util/string.h"
@@ -680,6 +680,16 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt) {
delete a;
return;
}
// Disallow dropping items if dead
if (playersao->isDead()) {
infostream << "Ignoring IDropAction from "
<< (da->from_inv.dump()) << ":" << da->from_list
<< " because player is dead." << std::endl;
delete a;
return;
}
stat.add("drop", player->getName());
}
/*
@@ -1059,7 +1059,18 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
delete a;
return;
}
// Disallow dropping items if dead
if (playersao->isDead()) {
infostream << "Ignoring IDropAction from "
<< (da->from_inv.dump()) << ":" << da->from_list
<< " because player is dead." << std::endl;
delete a;
return;
}
stat.add("drop", player->getName());
}
/*
Handle restrictions and special cases of the craft action
@@ -1355,6 +1366,7 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
2: digging completed
3: place block or item (to abovesurface)
4: use item
5: rightclick air ("activate")
*/
u8 action;
u16 item_i;
@@ -1392,8 +1404,16 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
}
if (playersao->isDead()) {
verbosestream << "TOSERVER_INTERACT: " << player->getName()
<< " is dead. Ignoring packet";
actionstream << "Server: NoCheat: " << player->getName()
<< " tried to interact while dead; ignoring." << std::endl;
if (pointed.type == POINTEDTHING_NODE) {
// Re-send block to revert change on client-side
RemoteClient *client = getClient(pkt->getPeerId());
v3s16 blockpos = getNodeBlockPos(pointed.node_undersurface);
client->SetBlockNotSent(blockpos);
}
// Call callbacks
m_script->on_cheat(playersao, "interacted_while_dead");
return;
}
@@ -1431,16 +1451,45 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
pointed_pos_above = pointed_pos_under;
}
/*
Make sure the player is allowed to do it
*/
if (!checkPriv(player->getName(), "interact")) {
actionstream<<player->getName()<<" attempted to interact with "
<<pointed.dump()<<" without 'interact' privilege"
<<std::endl;
// Re-send block to revert change on client-side
RemoteClient *client = getClient(pkt->getPeerId());
// Digging completed -> under
if (action == 2) {
v3s16 blockpos = getNodeBlockPos(floatToInt(pointed_pos_under, BS));
client->SetBlockNotSent(blockpos);
}
// Placement -> above
if (action == 3) {
v3s16 blockpos = getNodeBlockPos(floatToInt(pointed_pos_above, BS));
client->SetBlockNotSent(blockpos);
}
return;
}
/*
Check that target is reasonably close
(only when digging or placing things)
*/
static const bool enable_anticheat = !g_settings->getBool("disable_anticheat");
if ((action == 0 || action == 2 || action == 3) &&
if ((action == 0 || action == 2 || action == 3 || action == 4) &&
(enable_anticheat && !isSingleplayer())) {
float d = player_pos.getDistanceFrom(pointed_pos_under);
float max_d = BS * 14; // Just some large enough value
if (d > max_d) {
const ItemDefinition &playeritem_def =
playersao->getWieldedItem().getDefinition(m_itemdef);
float max_d = BS * playeritem_def.range;
float max_d_hand = BS * m_itemdef->get("").range;
if (max_d < 0 && max_d_hand >= 0)
max_d = max_d_hand;
else if (max_d < 0)
max_d = BS * 4.0;
if (d > max_d * 1.5) {
actionstream << "Player " << player->getName()
<< " tried to access " << pointed.dump()
<< " from too far: "
@@ -1458,28 +1507,6 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
}
}
/*
Make sure the player is allowed to do it
*/
if (!checkPriv(player->getName(), "interact")) {
actionstream<<player->getName()<<" attempted to interact with "
<<pointed.dump()<<" without 'interact' privilege"
<<std::endl;
// Re-send block to revert change on client-side
RemoteClient *client = getClient(pkt->getPeerId());
// Digging completed -> under
if (action == 2) {
v3s16 blockpos = getNodeBlockPos(floatToInt(pointed_pos_under, BS));
client->SetBlockNotSent(blockpos);
}
// Placement -> above
if (action == 3) {
v3s16 blockpos = getNodeBlockPos(floatToInt(pointed_pos_above, BS));
client->SetBlockNotSent(blockpos);
}
return;
}
/*
If something goes wrong, this player is to blame
*/
@@ -1491,11 +1518,6 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
*/
if (action == 0) {
if (pointed.type == POINTEDTHING_NODE) {
/*
NOTE: This can be used in the future to check if
somebody is cheating, by checking the timing.
*/
MapNode n(CONTENT_IGNORE);
bool pos_ok;
View
@@ -2914,11 +2914,8 @@ void Server::RespawnPlayer(u16 peer_id)
playersao->setHP(PLAYER_MAX_HP);
playersao->setBreath(PLAYER_MAX_BREATH);
SendPlayerHP(peer_id);
SendPlayerBreath(peer_id);
bool repositioned = m_script->on_respawnplayer(playersao);
if(!repositioned){
if (!repositioned) {
v3f pos = findSpawnPos();
// setPos will send the new position to client
playersao->getPlayer()->setSpeed(v3f(0,0,0));
@@ -2928,6 +2925,9 @@ void Server::RespawnPlayer(u16 peer_id)
playersao->m_ms_from_last_respawn = 0;
stat.add("respawn", playersao->getPlayer()->getName());
SendPlayerHP(peer_id);
SendPlayerBreath(peer_id);
}

0 comments on commit 1efdd35

Please sign in to comment.