From: BlockMen Date: Wed, 15 Jan 2014 20:26:54 +0000 (+0100) Subject: Prevent placing node when player would be inside new node X-Git-Tag: 0.4.10~311 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1b4908bf56552ca2e01b48591ade8d441d119625;p=oweals%2Fminetest.git Prevent placing node when player would be inside new node --- diff --git a/src/game.cpp b/src/game.cpp index 30f17be51..16fd42f16 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -905,9 +905,20 @@ bool nodePlacementPrediction(Client &client, // Add node to client map MapNode n(id, 0, param2); try{ - // This triggers the required mesh update too - client.addNode(p, n); - return true; + LocalPlayer* player = client.getEnv().getLocalPlayer(); + + // Dont place node when player would be inside new node + // NOTE: This is to be eventually implemented by a mod as client-side Lua + if (!nodedef->get(n).walkable || + (client.checkPrivilege("noclip") && g_settings->getBool("noclip")) || + (nodedef->get(n).walkable && + neighbourpos != player->getStandingNodePos() + v3s16(0,1,0) && + neighbourpos != player->getStandingNodePos() + v3s16(0,2,0))) { + + // This triggers the required mesh update too + client.addNode(p, n); + return true; + } }catch(InvalidPositionException &e){ errorstream<<"Node placement prediction failed for " <get(map.getNode(nodepos)).rightclickable) + client.interact(3, pointed); // Report to server } } }