Merge pull request #8776 from osjc/FixGetNode

Finish getNode cleanup
This commit is contained in:
Jozef Behran 2019-08-10 19:45:44 +02:00 committed by sfan5
parent 291e7730cf
commit 86d7f84b89
26 changed files with 120 additions and 139 deletions

@ -412,7 +412,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
// Prevent camera positioned inside nodes
const NodeDefManager *nodemgr = m_client->ndef();
MapNode n = m_client->getEnv().getClientMap()
.getNodeNoEx(floatToInt(my_cp, BS));
.getNode(floatToInt(my_cp, BS));
const ContentFeatures& features = nodemgr->get(n);
if (features.walkable) {

@ -1301,7 +1301,7 @@ MapNode Client::getNode(v3s16 p, bool *is_valid_position)
return {};
}
}
return m_env.getMap().getNodeNoEx(p, is_valid_position);
return m_env.getMap().getNode(p, is_valid_position);
}
void Client::addNode(v3s16 p, MapNode n, bool remove_metadata)

@ -218,7 +218,7 @@ void ClientEnvironment::step(float dtime)
f32 post_factor = 1; // 1 hp per node/s
if (info.type == COLLISION_NODE) {
const ContentFeatures &f = m_client->ndef()->
get(m_map->getNodeNoEx(info.node_p));
get(m_map->getNode(info.node_p));
// Determine fall damage multiplier
int addp = itemgroup_get(f.groups, "fall_damage_add_percent");
pre_factor = 1.0f + (float)addp / 100.0f;
@ -248,7 +248,7 @@ void ClientEnvironment::step(float dtime)
MapNode node_at_lplayer(CONTENT_AIR, 0x0f, 0);
v3s16 p = lplayer->getLightPosition();
node_at_lplayer = m_map->getNodeNoEx(p);
node_at_lplayer = m_map->getNode(p);
u16 light = getInteriorLight(node_at_lplayer, 0, m_client->ndef());
final_color_blend(&lplayer->light_color, light, day_night_ratio);
@ -270,7 +270,7 @@ void ClientEnvironment::step(float dtime)
// Get node at head
v3s16 p = cao->getLightPosition();
MapNode n = this->m_map->getNodeNoEx(p, &pos_ok);
MapNode n = this->m_map->getNode(p, &pos_ok);
if (pos_ok)
light = n.getLightBlend(day_night_ratio, m_client->ndef());
else
@ -351,7 +351,7 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
// Get node at head
v3s16 p = object->getLightPosition();
MapNode n = m_map->getNodeNoEx(p, &pos_ok);
MapNode n = m_map->getNode(p, &pos_ok);
if (pos_ok)
light = n.getLightBlend(getDayNightRatio(), m_client->ndef());
else

@ -160,7 +160,7 @@ void ClientMap::updateDrawList()
// inside ground
bool occlusion_culling_enabled = true;
if (g_settings->getBool("free_move")) {
MapNode n = getNodeNoEx(cam_pos_nodes);
MapNode n = getNode(cam_pos_nodes);
if (n.getContent() == CONTENT_IGNORE ||
m_nodedef->get(n).solidness == 2)
occlusion_culling_enabled = false;
@ -497,7 +497,7 @@ static bool getVisibleBrightness(Map *map, const v3f &p0, v3f dir, float step,
// Check content nearly at camera position
{
v3s16 p = floatToInt(p0 /*+ dir * 3*BS*/, BS);
MapNode n = map->getNodeNoEx(p);
MapNode n = map->getNode(p);
if(ndef->get(n).param_type == CPT_LIGHT &&
!ndef->get(n).sunlight_propagates)
allow_allowing_non_sunlight_propagates = true;
@ -505,7 +505,7 @@ static bool getVisibleBrightness(Map *map, const v3f &p0, v3f dir, float step,
// If would start at CONTENT_IGNORE, start closer
{
v3s16 p = floatToInt(pf, BS);
MapNode n = map->getNodeNoEx(p);
MapNode n = map->getNode(p);
if(n.getContent() == CONTENT_IGNORE){
float newd = 2*BS;
pf = p0 + dir * 2*newd;
@ -519,7 +519,7 @@ static bool getVisibleBrightness(Map *map, const v3f &p0, v3f dir, float step,
step *= step_multiplier;
v3s16 p = floatToInt(pf, BS);
MapNode n = map->getNodeNoEx(p);
MapNode n = map->getNode(p);
if (allow_allowing_non_sunlight_propagates && i == 0 &&
ndef->get(n).param_type == CPT_LIGHT &&
!ndef->get(n).sunlight_propagates) {
@ -621,7 +621,7 @@ int ClientMap::getBackgroundBrightness(float max_d, u32 daylight_factor,
int ret = 0;
if(brightness_count == 0){
MapNode n = getNodeNoEx(floatToInt(m_camera_position, BS));
MapNode n = getNode(floatToInt(m_camera_position, BS));
if(m_nodedef->get(n).param_type == CPT_LIGHT){
ret = decode_light(n.getLightBlend(daylight_factor, m_nodedef));
} else {
@ -640,7 +640,7 @@ void ClientMap::renderPostFx(CameraMode cam_mode)
// Sadly ISceneManager has no "post effects" render pass, in that case we
// could just register for that and handle it in renderMap().
MapNode n = getNodeNoEx(floatToInt(m_camera_position, BS));
MapNode n = getNode(floatToInt(m_camera_position, BS));
// - If the player is in a solid node, make everything black.
// - If the player is in liquid, draw a semi-transparent overlay.

@ -991,7 +991,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
const NodeDefManager *ndef = m_client->ndef();
v3s16 p = floatToInt(getPosition() +
v3f(0.0f, (m_prop.collisionbox.MinEdge.Y - 0.5f) * BS, 0.0f), BS);
MapNode n = m_env->getMap().getNodeNoEx(p);
MapNode n = m_env->getMap().getNode(p);
SimpleSoundSpec spec = ndef->get(n).sound_footstep;
// Reduce footstep gain, as non-local-player footsteps are
// somehow louder.

@ -48,7 +48,7 @@ public:
/* Update brightness */
u8 light;
bool pos_ok;
MapNode n = env->getMap().getNodeNoEx(floatToInt(pos, BS), &pos_ok);
MapNode n = env->getMap().getNode(floatToInt(pos, BS), &pos_ok);
light = pos_ok ? decode_light(n.getLightBlend(env->getDayNightRatio(),
env->getGameDef()->ndef()))
: 64;

@ -2926,7 +2926,7 @@ void Game::updateSound(f32 dtime)
soundmaker->step(dtime);
ClientMap &map = client->getEnv().getClientMap();
MapNode n = map.getNodeNoEx(player->getFootstepNodePos());
MapNode n = map.getNode(player->getFootstepNodePos());
soundmaker->m_player_step_sound = nodedef_manager->get(n).sound_footstep;
}
@ -3105,7 +3105,7 @@ PointedThing Game::updatePointedThing(
}
} else if (result.type == POINTEDTHING_NODE) {
// Update selection boxes
MapNode n = map.getNodeNoEx(result.node_undersurface);
MapNode n = map.getNode(result.node_undersurface);
std::vector<aabb3f> boxes;
n.getSelectionBoxes(nodedef, &boxes,
n.getNeighbors(result.node_undersurface, &map));
@ -3132,12 +3132,12 @@ PointedThing Game::updatePointedThing(
v3s16 p = floatToInt(pf, BS);
// Get selection mesh light level
MapNode n = map.getNodeNoEx(p);
MapNode n = map.getNode(p);
u16 node_light = getInteriorLight(n, -1, nodedef);
u16 light_level = node_light;
for (const v3s16 &dir : g_6dirs) {
n = map.getNodeNoEx(p + dir);
n = map.getNode(p + dir);
node_light = getInteriorLight(n, -1, nodedef);
if (node_light > light_level)
light_level = node_light;
@ -3198,7 +3198,7 @@ void Game::handlePointingAtNode(const PointedThing &pointed,
m_game_ui->setInfoText(unescape_translate(utf8_to_wide(
meta->getString("infotext"))));
} else {
MapNode n = map.getNodeNoEx(nodepos);
MapNode n = map.getNode(nodepos);
if (nodedef_manager->get(n).tiledef[0].name == "unknown_node.png") {
m_game_ui->setInfoText(L"Unknown node: " +
@ -3215,7 +3215,7 @@ void Game::handlePointingAtNode(const PointedThing &pointed,
if (meta && !meta->getString("formspec").empty() && !random_input
&& !isKeyDown(KeyType::SNEAK)) {
// Report right click to server
if (nodedef_manager->get(map.getNodeNoEx(nodepos)).rightclickable) {
if (nodedef_manager->get(map.getNode(nodepos)).rightclickable) {
client->interact(INTERACT_PLACE, pointed);
}
@ -3258,7 +3258,7 @@ void Game::handlePointingAtNode(const PointedThing &pointed,
SimpleSoundSpec();
if (def.node_placement_prediction.empty() ||
nodedef_manager->get(map.getNodeNoEx(nodepos)).rightclickable) {
nodedef_manager->get(map.getNode(nodepos)).rightclickable) {
client->interact(INTERACT_PLACE, pointed); // Report to server
} else {
soundmaker->m_player_rightpunch_sound =
@ -3278,7 +3278,7 @@ bool Game::nodePlacementPrediction(const ItemDefinition &selected_def,
MapNode node;
bool is_valid_position;
node = map.getNodeNoEx(nodepos, &is_valid_position);
node = map.getNode(nodepos, &is_valid_position);
if (!is_valid_position)
return false;
@ -3290,13 +3290,13 @@ bool Game::nodePlacementPrediction(const ItemDefinition &selected_def,
v3s16 p = neighbourpos;
// Place inside node itself if buildable_to
MapNode n_under = map.getNodeNoEx(nodepos, &is_valid_position);
MapNode n_under = map.getNode(nodepos, &is_valid_position);
if (is_valid_position)
{
if (nodedef->get(n_under).buildable_to)
p = nodepos;
else {
node = map.getNodeNoEx(p, &is_valid_position);
node = map.getNode(p, &is_valid_position);
if (is_valid_position &&!nodedef->get(node).buildable_to)
return false;
}
@ -3363,7 +3363,7 @@ bool Game::nodePlacementPrediction(const ItemDefinition &selected_def,
else
pp = p + v3s16(0, -1, 0);
if (!nodedef->get(map.getNodeNoEx(pp)).walkable)
if (!nodedef->get(map.getNode(pp)).walkable)
return false;
}
@ -3477,7 +3477,7 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos,
// See also: serverpackethandle.cpp, action == 2
LocalPlayer *player = client->getEnv().getLocalPlayer();
ClientMap &map = client->getEnv().getClientMap();
MapNode n = client->getEnv().getClientMap().getNodeNoEx(nodepos);
MapNode n = client->getEnv().getClientMap().getNode(nodepos);
// NOTE: Similar piece of code exists on the server side for
// cheat detection.
@ -3565,7 +3565,7 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos,
runData.nodig_delay_timer = 0.15;
bool is_valid_position;
MapNode wasnode = map.getNodeNoEx(nodepos, &is_valid_position);
MapNode wasnode = map.getNode(nodepos, &is_valid_position);
if (is_valid_position) {
if (client->moddingEnabled() &&
client->getScript()->on_dignode(nodepos, wasnode)) {

@ -136,7 +136,7 @@ void GameUI::update(const RunStats &stats, Client *client, MapDrawControl *draw_
if (pointed_old.type == POINTEDTHING_NODE) {
ClientMap &map = client->getEnv().getClientMap();
const NodeDefManager *nodedef = client->getNodeDefManager();
MapNode n = map.getNodeNoEx(pointed_old.node_undersurface);
MapNode n = map.getNode(pointed_old.node_undersurface);
if (n.getContent() != CONTENT_IGNORE && nodedef->get(n).name != "unknown") {
os << ", pointed: " << nodedef->get(n).name

@ -86,7 +86,7 @@ bool LocalPlayer::updateSneakNode(Map *map, const v3f &position,
if (current_node != m_sneak_node) {
new_sneak_node_exists = false;
} else {
node = map->getNodeNoEx(current_node, &is_valid_position);
node = map->getNode(current_node, &is_valid_position);
if (!is_valid_position || !nodemgr->get(node).walkable)
new_sneak_node_exists = false;
}
@ -112,7 +112,7 @@ bool LocalPlayer::updateSneakNode(Map *map, const v3f &position,
// The node to be sneaked on has to be walkable
node = map->getNodeNoEx(p, &is_valid_position);
node = map->getNode(p, &is_valid_position);
if (!is_valid_position || !nodemgr->get(node).walkable)
continue;
// And the node(s) above have to be nonwalkable
@ -122,7 +122,7 @@ bool LocalPlayer::updateSneakNode(Map *map, const v3f &position,
(m_collisionbox.MaxEdge.Y - m_collisionbox.MinEdge.Y) / BS
);
for (u16 y = 1; y <= height; y++) {
node = map->getNodeNoEx(p + v3s16(0, y, 0), &is_valid_position);
node = map->getNode(p + v3s16(0, y, 0), &is_valid_position);
if (!is_valid_position || nodemgr->get(node).walkable) {
ok = false;
break;
@ -130,7 +130,7 @@ bool LocalPlayer::updateSneakNode(Map *map, const v3f &position,
}
} else {
// legacy behaviour: check just one node
node = map->getNodeNoEx(p + v3s16(0, 1, 0), &is_valid_position);
node = map->getNode(p + v3s16(0, 1, 0), &is_valid_position);
ok = is_valid_position && !nodemgr->get(node).walkable;
}
if (!ok)
@ -145,7 +145,7 @@ bool LocalPlayer::updateSneakNode(Map *map, const v3f &position,
return false;
// Update saved top bounding box of sneak node
node = map->getNodeNoEx(m_sneak_node);
node = map->getNode(m_sneak_node);
std::vector<aabb3f> nodeboxes;
node.getCollisionBoxes(nodemgr, &nodeboxes);
m_sneak_node_bb_top = getNodeBoundingBox(nodeboxes);
@ -153,11 +153,11 @@ bool LocalPlayer::updateSneakNode(Map *map, const v3f &position,
if (physics_override_sneak_glitch) {
// Detect sneak ladder:
// Node two meters above sneak node must be solid
node = map->getNodeNoEx(m_sneak_node + v3s16(0, 2, 0),
node = map->getNode(m_sneak_node + v3s16(0, 2, 0),
&is_valid_position);
if (is_valid_position && nodemgr->get(node).walkable) {
// Node three meters above: must be non-solid
node = map->getNodeNoEx(m_sneak_node + v3s16(0, 3, 0),
node = map->getNode(m_sneak_node + v3s16(0, 3, 0),
&is_valid_position);
m_sneak_ladder_detected = is_valid_position &&
!nodemgr->get(node).walkable;
@ -225,7 +225,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
if (in_liquid)
{
pp = floatToInt(position + v3f(0,BS*0.1,0), BS);
node = map->getNodeNoEx(pp, &is_valid_position);
node = map->getNode(pp, &is_valid_position);
if (is_valid_position) {
in_liquid = nodemgr->get(node.getContent()).isLiquid();
liquid_viscosity = nodemgr->get(node.getContent()).liquid_viscosity;
@ -237,7 +237,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
else
{
pp = floatToInt(position + v3f(0,BS*0.5,0), BS);
node = map->getNodeNoEx(pp, &is_valid_position);
node = map->getNode(pp, &is_valid_position);
if (is_valid_position) {
in_liquid = nodemgr->get(node.getContent()).isLiquid();
liquid_viscosity = nodemgr->get(node.getContent()).liquid_viscosity;
@ -251,7 +251,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
Check if player is in liquid (the stable value)
*/
pp = floatToInt(position + v3f(0,0,0), BS);
node = map->getNodeNoEx(pp, &is_valid_position);
node = map->getNode(pp, &is_valid_position);
if (is_valid_position) {
in_liquid_stable = nodemgr->get(node.getContent()).isLiquid();
} else {
@ -265,9 +265,9 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
pp = floatToInt(position + v3f(0,0.5*BS,0), BS);
v3s16 pp2 = floatToInt(position + v3f(0,-0.2*BS,0), BS);
node = map->getNodeNoEx(pp, &is_valid_position);
node = map->getNode(pp, &is_valid_position);
bool is_valid_position2;
MapNode node2 = map->getNodeNoEx(pp2, &is_valid_position2);
MapNode node2 = map->getNode(pp2, &is_valid_position2);
if (!(is_valid_position && is_valid_position2)) {
is_climbing = false;
@ -429,7 +429,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
{
camera_barely_in_ceiling = false;
v3s16 camera_np = floatToInt(getEyePosition(), BS);
MapNode n = map->getNodeNoEx(camera_np);
MapNode n = map->getNode(camera_np);
if(n.getContent() != CONTENT_IGNORE){
if(nodemgr->get(n).walkable && nodemgr->get(n).solidness == 2){
camera_barely_in_ceiling = true;
@ -440,7 +440,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
/*
Check properties of the node on which the player is standing
*/
const ContentFeatures &f = nodemgr->get(map->getNodeNoEx(m_standing_node));
const ContentFeatures &f = nodemgr->get(map->getNode(m_standing_node));
// Determine if jumping is possible
m_disable_jump = itemgroup_get(f.groups, "disable_jump");
@ -821,7 +821,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
if (in_liquid) {
// If in liquid, the threshold of coming out is at higher y
pp = floatToInt(position + v3f(0, BS * 0.1, 0), BS);
node = map->getNodeNoEx(pp, &is_valid_position);
node = map->getNode(pp, &is_valid_position);
if (is_valid_position) {
in_liquid = nodemgr->get(node.getContent()).isLiquid();
liquid_viscosity = nodemgr->get(node.getContent()).liquid_viscosity;
@ -831,7 +831,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
} else {
// If not in liquid, the threshold of going in is at lower y
pp = floatToInt(position + v3f(0, BS * 0.5, 0), BS);
node = map->getNodeNoEx(pp, &is_valid_position);
node = map->getNode(pp, &is_valid_position);
if (is_valid_position) {
in_liquid = nodemgr->get(node.getContent()).isLiquid();
liquid_viscosity = nodemgr->get(node.getContent()).liquid_viscosity;
@ -844,7 +844,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
Check if player is in liquid (the stable value)
*/
pp = floatToInt(position + v3f(0, 0, 0), BS);
node = map->getNodeNoEx(pp, &is_valid_position);
node = map->getNode(pp, &is_valid_position);
if (is_valid_position)
in_liquid_stable = nodemgr->get(node.getContent()).isLiquid();
else
@ -855,9 +855,9 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
*/
pp = floatToInt(position + v3f(0, 0.5 * BS, 0), BS);
v3s16 pp2 = floatToInt(position + v3f(0, -0.2 * BS, 0), BS);
node = map->getNodeNoEx(pp, &is_valid_position);
node = map->getNode(pp, &is_valid_position);
bool is_valid_position2;
MapNode node2 = map->getNodeNoEx(pp2, &is_valid_position2);
MapNode node2 = map->getNode(pp2, &is_valid_position2);
if (!(is_valid_position && is_valid_position2))
is_climbing = false;
@ -942,13 +942,13 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
position_y_mod = m_sneak_node_bb_ymax - position_y_mod;
v3s16 current_node = floatToInt(position - v3f(0, position_y_mod, 0), BS);
if (m_sneak_node_exists &&
nodemgr->get(map->getNodeNoEx(m_old_node_below)).name == "air" &&
nodemgr->get(map->getNode(m_old_node_below)).name == "air" &&
m_old_node_below_type != "air") {
// Old node appears to have been removed; that is,
// it wasn't air before but now it is
m_need_to_get_new_sneak_node = false;
m_sneak_node_exists = false;
} else if (nodemgr->get(map->getNodeNoEx(current_node)).name != "air") {
} else if (nodemgr->get(map->getNode(current_node)).name != "air") {
// We are on something, so make sure to recalculate the sneak
// node.
m_need_to_get_new_sneak_node = true;
@ -976,16 +976,16 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
continue;
// The node to be sneaked on has to be walkable
node = map->getNodeNoEx(p, &is_valid_position);
node = map->getNode(p, &is_valid_position);
if (!is_valid_position || !nodemgr->get(node).walkable)
continue;
// And the node above it has to be nonwalkable
node = map->getNodeNoEx(p + v3s16(0, 1, 0), &is_valid_position);
node = map->getNode(p + v3s16(0, 1, 0), &is_valid_position);
if (!is_valid_position || nodemgr->get(node).walkable)
continue;
// If not 'sneak_glitch' the node 2 nodes above it has to be nonwalkable
if (!physics_override_sneak_glitch) {
node =map->getNodeNoEx(p + v3s16(0, 2, 0), &is_valid_position);
node =map->getNode(p + v3s16(0, 2, 0), &is_valid_position);
if (!is_valid_position || nodemgr->get(node).walkable)
continue;
}
@ -1001,7 +1001,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
if (sneak_node_found) {
f32 cb_max = 0;
MapNode n = map->getNodeNoEx(m_sneak_node);
MapNode n = map->getNode(m_sneak_node);
std::vector<aabb3f> nodeboxes;
n.getCollisionBoxes(nodemgr, &nodeboxes);
for (const auto &box : nodeboxes) {
@ -1045,7 +1045,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
{
camera_barely_in_ceiling = false;
v3s16 camera_np = floatToInt(getEyePosition(), BS);
MapNode n = map->getNodeNoEx(camera_np);
MapNode n = map->getNode(camera_np);
if (n.getContent() != CONTENT_IGNORE) {
if (nodemgr->get(n).walkable && nodemgr->get(n).solidness == 2)
camera_barely_in_ceiling = true;
@ -1056,12 +1056,12 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
Update the node last under the player
*/
m_old_node_below = floatToInt(position - v3f(0, BS / 2, 0), BS);
m_old_node_below_type = nodemgr->get(map->getNodeNoEx(m_old_node_below)).name;
m_old_node_below_type = nodemgr->get(map->getNode(m_old_node_below)).name;
/*
Check properties of the node on which the player is standing
*/
const ContentFeatures &f = nodemgr->get(map->getNodeNoEx(
const ContentFeatures &f = nodemgr->get(map->getNode(
getStandingNodePos()));
// Determine if jumping is possible
@ -1091,7 +1091,7 @@ float LocalPlayer::getSlipFactor(Environment *env, const v3f &speedH)
// Slip on slippery nodes
const NodeDefManager *nodemgr = env->getGameDef()->ndef();
Map *map = &env->getMap();
const ContentFeatures &f = nodemgr->get(map->getNodeNoEx(
const ContentFeatures &f = nodemgr->get(map->getNode(
getStandingNodePos()));
int slippery = 0;
if (f.walkable)
@ -1147,7 +1147,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
bool is_position_valid;
for (s16 z = ceilpos_min.Z; z <= ceilpos_max.Z; z++) {
for (s16 x = ceilpos_min.X; x <= ceilpos_max.X; x++) {
MapNode n = env->getMap().getNodeNoEx(v3s16(x, ceilpos_max.Y, z), &is_position_valid);
MapNode n = env->getMap().getNode(v3s16(x, ceilpos_max.Y, z), &is_position_valid);
if (!is_position_valid)
break; // won't collide with the void outside

@ -181,7 +181,7 @@ void Particle::updateLight()
floor(m_pos.Y+0.5),
floor(m_pos.Z+0.5)
);
MapNode n = m_env->getClientMap().getNodeNoEx(p, &pos_ok);
MapNode n = m_env->getClientMap().getNode(p, &pos_ok);
if (pos_ok)
light = n.getLightBlend(m_env->getDayNightRatio(), m_gamedef->ndef());
else

@ -206,7 +206,7 @@ bool wouldCollideWithCeiling(
static inline void getNeighborConnectingFace(const v3s16 &p,
const NodeDefManager *nodedef, Map *map, MapNode n, int v, int *neighbors)
{
MapNode n2 = map->getNodeNoEx(p);
MapNode n2 = map->getNode(p);
if (nodedef->nodeboxConnects(n, n2, v))
*neighbors |= v;
}
@ -278,7 +278,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
for (p.Y = min.Y; p.Y <= max.Y; p.Y++)
for (p.Z = min.Z; p.Z <= max.Z; p.Z++) {
bool is_position_valid;
MapNode n = map->getNodeNoEx(p, &is_position_valid);
MapNode n = map->getNode(p, &is_position_valid);
if (is_position_valid && n.getContent() != CONTENT_IGNORE) {
// Object collides into walkable nodes

@ -992,7 +992,7 @@ void PlayerSAO::step(float dtime, bool send_recommended)
if (!isImmortal() && m_drowning_interval.step(dtime, 2.0f)) {
// Get nose/mouth position, approximate with eye position
v3s16 p = floatToInt(getEyePosition(), BS);
MapNode n = m_env->getMap().getNodeNoEx(p);
MapNode n = m_env->getMap().getNode(p);
const ContentFeatures &c = m_env->getGameDef()->ndef()->get(n);
// If node generates drown
if (c.drowning > 0 && m_hp > 0) {
@ -1011,7 +1011,7 @@ void PlayerSAO::step(float dtime, bool send_recommended)
if (m_breathing_interval.step(dtime, 0.5f) && !isImmortal()) {
// Get nose/mouth position, approximate with eye position
v3s16 p = floatToInt(getEyePosition(), BS);
MapNode n = m_env->getMap().getNodeNoEx(p);
MapNode n = m_env->getMap().getNode(p);
const ContentFeatures &c = m_env->getGameDef()->ndef()->get(n);
// If player is alive & not drowning & not in ignore & not immortal, breathe
if (m_breath < m_prop.breath_max && c.drowning == 0 &&
@ -1030,7 +1030,7 @@ void PlayerSAO::step(float dtime, bool send_recommended)
for (float dam_height = 0.1f; dam_height < dam_top; dam_height++) {
v3s16 p = floatToInt(m_base_position +
v3f(0.0f, dam_height * BS, 0.0f), BS);
MapNode n = m_env->getMap().getNodeNoEx(p);
MapNode n = m_env->getMap().getNode(p);
const ContentFeatures &c = m_env->getGameDef()->ndef()->get(n);
if (c.damage_per_second > damage_per_second) {
damage_per_second = c.damage_per_second;
@ -1041,7 +1041,7 @@ void PlayerSAO::step(float dtime, bool send_recommended)
// Top damage point
v3s16 ptop = floatToInt(m_base_position +
v3f(0.0f, dam_top * BS, 0.0f), BS);
MapNode ntop = m_env->getMap().getNodeNoEx(ptop);
MapNode ntop = m_env->getMap().getNode(ptop);
const ContentFeatures &c = m_env->getGameDef()->ndef()->get(ntop);
if (c.damage_per_second > damage_per_second) {
damage_per_second = c.damage_per_second;

@ -159,7 +159,7 @@ void Environment::continueRaycast(RaycastState *state, PointedThing *result)
v3s16 np(x, y, z);
bool is_valid_position;
n = map.getNodeNoEx(np, &is_valid_position);
n = map.getNode(np, &is_valid_position);
if (!(is_valid_position && isPointableNode(n, nodedef,
state->m_liquids_pointable))) {
continue;

@ -170,7 +170,7 @@ bool Map::isValidPosition(v3s16 p)
}
// Returns a CONTENT_IGNORE node if not found
MapNode Map::getNodeNoEx(v3s16 p, bool *is_valid_position)
MapNode Map::getNode(v3s16 p, bool *is_valid_position)
{
v3s16 blockpos = getNodeBlockPos(p);
MapBlock *block = getBlockNoCreateNoEx(blockpos);
@ -188,25 +188,6 @@ MapNode Map::getNodeNoEx(v3s16 p, bool *is_valid_position)
return node;
}
#if 0
// Deprecated
// throws InvalidPositionException if not found
// TODO: Now this is deprecated, getNodeNoEx should be renamed
MapNode Map::getNode(v3s16 p)
{
v3s16 blockpos = getNodeBlockPos(p);
MapBlock *block = getBlockNoCreateNoEx(blockpos);
if (block == NULL)
throw InvalidPositionException();
v3s16 relpos = p - blockpos*MAP_BLOCKSIZE;
bool is_valid_position;
MapNode node = block->getNodeNoCheck(relpos, &is_valid_position);
if (!is_valid_position)
throw InvalidPositionException();
return node;
}
#endif
// throws InvalidPositionException if not found
void Map::setNode(v3s16 p, MapNode & n)
{
@ -233,7 +214,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
RollbackNode rollback_oldnode(this, p, m_gamedef);
// This is needed for updating the lighting
MapNode oldnode = getNodeNoEx(p);
MapNode oldnode = getNode(p);
// Remove node metadata
if (remove_metadata) {
@ -273,7 +254,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
v3s16 p2 = p + dir;
bool is_valid_position;
MapNode n2 = getNodeNoEx(p2, &is_valid_position);
MapNode n2 = getNode(p2, &is_valid_position);
if(is_valid_position &&
(m_nodedef->get(n2).isLiquid() ||
n2.getContent() == CONTENT_AIR))
@ -585,7 +566,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
v3s16 p0 = m_transforming_liquid.front();
m_transforming_liquid.pop_front();
MapNode n0 = getNodeNoEx(p0);
MapNode n0 = getNode(p0);
/*
Collect information about current node
@ -645,7 +626,7 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
break;
}
v3s16 npos = p0 + dirs[i];
NodeNeighbor nb(getNodeNoEx(npos), nt, npos);
NodeNeighbor nb(getNode(npos), nt, npos);
const ContentFeatures &cfnb = m_nodedef->get(nb.n);
switch (m_nodedef->get(nb.n.getContent()).liquid_type) {
case LIQUID_NONE:
@ -1078,7 +1059,7 @@ bool Map::isOccluded(v3s16 p0, v3s16 p1, float step, float stepfac,
for(float s=start_off; s<d0+end_off; s+=step){
v3f pf = p0f + uf * s;
v3s16 p = floatToInt(pf, BS);
MapNode n = getNodeNoEx(p);
MapNode n = getNode(p);
const ContentFeatures &f = m_nodedef->get(n);
if(f.drawtype == NDT_NORMAL){
// not transparent, see ContentFeature::updateTextures
@ -1660,7 +1641,7 @@ void ServerMap::updateVManip(v3s16 pos)
return;
s32 idx = vm->m_area.index(pos);
vm->m_data[idx] = getNodeNoEx(pos);
vm->m_data[idx] = getNode(pos);
vm->m_flags[idx] &= ~VOXELFLAG_NO_DATA;
vm->m_is_dirty = true;

@ -191,7 +191,7 @@ public:
// Returns a CONTENT_IGNORE node if not found
// If is_valid_position is not NULL then this will be set to true if the
// position is valid, otherwise false
MapNode getNodeNoEx(v3s16 p, bool *is_valid_position = NULL);
MapNode getNode(v3s16 p, bool *is_valid_position = NULL);
/*
These handle lighting but not faces.

@ -100,7 +100,7 @@ bool MapBlock::isValidPositionParent(v3s16 p)
MapNode MapBlock::getNodeParent(v3s16 p, bool *is_valid_position)
{
if (!isValidPosition(p))
return m_parent->getNodeNoEx(getPosRelative() + p, is_valid_position);
return m_parent->getNode(getPosRelative() + p, is_valid_position);
if (!data) {
if (is_valid_position)

@ -512,7 +512,7 @@ static inline void getNeighborConnectingFace(
const v3s16 &p, const NodeDefManager *nodedef,
Map *map, MapNode n, u8 bitmask, u8 *neighbors)
{
MapNode n2 = map->getNodeNoEx(p);
MapNode n2 = map->getNode(p);
if (nodedef->nodeboxConnects(n, n2, bitmask))
*neighbors |= bitmask;
}

@ -1122,7 +1122,7 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
MapNode n(CONTENT_IGNORE);
bool pos_ok;
n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
n = m_env->getMap().getNode(p_under, &pos_ok);
if (!pos_ok) {
infostream << "Server: Not punching: Node not found."
<< " Adding block to emerge queue."
@ -1185,7 +1185,7 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
// Only digging of nodes
if (pointed.type == POINTEDTHING_NODE) {
bool pos_ok;
MapNode n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
MapNode n = m_env->getMap().getNode(p_under, &pos_ok);
if (!pos_ok) {
infostream << "Server: Not finishing digging: Node not found."
<< " Adding block to emerge queue."
@ -1269,7 +1269,7 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
v3s16 blockpos = getNodeBlockPos(floatToInt(pointed_pos_under, BS));
RemoteClient *client = getClient(pkt->getPeerId());
// Send unusual result (that is, node not being removed)
if (m_env->getMap().getNodeNoEx(p_under).getContent() != CONTENT_AIR) {
if (m_env->getMap().getNode(p_under).getContent() != CONTENT_AIR) {
// Re-send block to revert change on client-side
client->SetBlockNotSent(blockpos);
}

@ -498,8 +498,8 @@ void GridNodeContainer::initNode(v3s16 ipos, PathGridnode *p_node)
v3s16 realpos = m_pathf->getRealPos(ipos);
MapNode current = m_pathf->m_env->getMap().getNodeNoEx(realpos);
MapNode below = m_pathf->m_env->getMap().getNodeNoEx(realpos + v3s16(0, -1, 0));
MapNode current = m_pathf->m_env->getMap().getNode(realpos);
MapNode below = m_pathf->m_env->getMap().getNode(realpos + v3s16(0, -1, 0));
if ((current.param0 == CONTENT_IGNORE) ||
@ -769,7 +769,7 @@ PathCost Pathfinder::calcCost(v3s16 pos, v3s16 dir)
return retval;
}
MapNode node_at_pos2 = m_env->getMap().getNodeNoEx(pos2);
MapNode node_at_pos2 = m_env->getMap().getNode(pos2);
//did we get information about node?
if (node_at_pos2.param0 == CONTENT_IGNORE ) {
@ -780,7 +780,7 @@ PathCost Pathfinder::calcCost(v3s16 pos, v3s16 dir)
if (!ndef->get(node_at_pos2).walkable) {
MapNode node_below_pos2 =
m_env->getMap().getNodeNoEx(pos2 + v3s16(0, -1, 0));
m_env->getMap().getNode(pos2 + v3s16(0, -1, 0));
//did we get information about node?
if (node_below_pos2.param0 == CONTENT_IGNORE ) {
@ -798,13 +798,13 @@ PathCost Pathfinder::calcCost(v3s16 pos, v3s16 dir)
}
else {
v3s16 testpos = pos2 - v3s16(0, -1, 0);
MapNode node_at_pos = m_env->getMap().getNodeNoEx(testpos);
MapNode node_at_pos = m_env->getMap().getNode(testpos);
while ((node_at_pos.param0 != CONTENT_IGNORE) &&
(!ndef->get(node_at_pos).walkable) &&
(testpos.Y > m_limits.MinEdge.Y)) {
testpos += v3s16(0, -1, 0);
node_at_pos = m_env->getMap().getNodeNoEx(testpos);
node_at_pos = m_env->getMap().getNode(testpos);
}
//did we find surface?
@ -832,13 +832,13 @@ PathCost Pathfinder::calcCost(v3s16 pos, v3s16 dir)
}
else {
v3s16 testpos = pos2;
MapNode node_at_pos = m_env->getMap().getNodeNoEx(testpos);
MapNode node_at_pos = m_env->getMap().getNode(testpos);
while ((node_at_pos.param0 != CONTENT_IGNORE) &&
(ndef->get(node_at_pos).walkable) &&
(testpos.Y < m_limits.MaxEdge.Y)) {
testpos += v3s16(0, 1, 0);
node_at_pos = m_env->getMap().getNodeNoEx(testpos);
node_at_pos = m_env->getMap().getNode(testpos);
}
//did we find surface?

@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
RollbackNode::RollbackNode(Map *map, v3s16 p, IGameDef *gamedef)
{
const NodeDefManager *ndef = gamedef->ndef();
MapNode n = map->getNodeNoEx(p);
MapNode n = map->getNode(p);
name = ndef->get(n).name;
param1 = n.param1;
param2 = n.param2;
@ -132,7 +132,7 @@ bool RollbackAction::applyRevert(Map *map, InventoryManager *imgr, IGameDef *gam
// Make sure position is loaded from disk
map->emergeBlock(getContainerPos(p, MAP_BLOCKSIZE), false);
// Check current node
MapNode current_node = map->getNodeNoEx(p);
MapNode current_node = map->getNode(p);
std::string current_name = ndef->get(current_node).name;
// If current node not the new node, it's bad
if (current_name != n_new.name) {

@ -246,7 +246,7 @@ void ScriptApiNode::node_on_receive_fields(v3s16 p,
const NodeDefManager *ndef = getServer()->ndef();
// If node doesn't exist, we don't know what callback to call
MapNode node = getEnv()->getMap().getNodeNoEx(p);
MapNode node = getEnv()->getMap().getNode(p);
if (node.getContent() == CONTENT_IGNORE)
return;

@ -38,7 +38,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowMove(
const NodeDefManager *ndef = getServer()->ndef();
// If node doesn't exist, we don't know what callback to call
MapNode node = getEnv()->getMap().getNodeNoEx(ma.to_inv.p);
MapNode node = getEnv()->getMap().getNode(ma.to_inv.p);
if (node.getContent() == CONTENT_IGNORE)
return 0;
@ -76,7 +76,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowPut(
const NodeDefManager *ndef = getServer()->ndef();
// If node doesn't exist, we don't know what callback to call
MapNode node = getEnv()->getMap().getNodeNoEx(ma.to_inv.p);
MapNode node = getEnv()->getMap().getNode(ma.to_inv.p);
if (node.getContent() == CONTENT_IGNORE)
return 0;
@ -112,7 +112,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowTake(
const NodeDefManager *ndef = getServer()->ndef();
// If node doesn't exist, we don't know what callback to call
MapNode node = getEnv()->getMap().getNodeNoEx(ma.from_inv.p);
MapNode node = getEnv()->getMap().getNode(ma.from_inv.p);
if (node.getContent() == CONTENT_IGNORE)
return 0;
@ -148,7 +148,7 @@ void ScriptApiNodemeta::nodemeta_inventory_OnMove(
const NodeDefManager *ndef = getServer()->ndef();
// If node doesn't exist, we don't know what callback to call
MapNode node = getEnv()->getMap().getNodeNoEx(ma.from_inv.p);
MapNode node = getEnv()->getMap().getNode(ma.from_inv.p);
if (node.getContent() == CONTENT_IGNORE)
return;
@ -181,7 +181,7 @@ void ScriptApiNodemeta::nodemeta_inventory_OnPut(
const NodeDefManager *ndef = getServer()->ndef();
// If node doesn't exist, we don't know what callback to call
MapNode node = getEnv()->getMap().getNodeNoEx(ma.to_inv.p);
MapNode node = getEnv()->getMap().getNode(ma.to_inv.p);
if (node.getContent() == CONTENT_IGNORE)
return;
@ -212,7 +212,7 @@ void ScriptApiNodemeta::nodemeta_inventory_OnTake(
const NodeDefManager *ndef = getServer()->ndef();
// If node doesn't exist, we don't know what callback to call
MapNode node = getEnv()->getMap().getNodeNoEx(ma.from_inv.p);
MapNode node = getEnv()->getMap().getNode(ma.from_inv.p);
if (node.getContent() == CONTENT_IGNORE)
return;

@ -350,7 +350,7 @@ int ModApiEnvMod::l_get_node(lua_State *L)
// pos
v3s16 pos = read_v3s16(L, 1);
// Do it
MapNode n = env->getMap().getNodeNoEx(pos);
MapNode n = env->getMap().getNode(pos);
// Return node
pushnode(L, n, env->getGameDef()->ndef());
return 1;
@ -366,7 +366,7 @@ int ModApiEnvMod::l_get_node_or_nil(lua_State *L)
v3s16 pos = read_v3s16(L, 1);
// Do it
bool pos_ok;
MapNode n = env->getMap().getNodeNoEx(pos, &pos_ok);
MapNode n = env->getMap().getNode(pos, &pos_ok);
if (pos_ok) {
// Return node
pushnode(L, n, env->getGameDef()->ndef());
@ -392,7 +392,7 @@ int ModApiEnvMod::l_get_node_light(lua_State *L)
u32 dnr = time_to_daynight_ratio(time_of_day, true);
bool is_position_ok;
MapNode n = env->getMap().getNodeNoEx(pos, &is_position_ok);
MapNode n = env->getMap().getNode(pos, &is_position_ok);
if (is_position_ok) {
const NodeDefManager *ndef = env->getGameDef()->ndef();
lua_pushinteger(L, n.getLightBlend(dnr, ndef));
@ -417,7 +417,7 @@ int ModApiEnvMod::l_place_node(lua_State *L)
MapNode n = readnode(L, 2, ndef);
// Don't attempt to load non-loaded area as of now
MapNode n_old = env->getMap().getNodeNoEx(pos);
MapNode n_old = env->getMap().getNode(pos);
if(n_old.getContent() == CONTENT_IGNORE){
lua_pushboolean(L, false);
return 1;
@ -446,7 +446,7 @@ int ModApiEnvMod::l_dig_node(lua_State *L)
v3s16 pos = read_v3s16(L, 1);
// Don't attempt to load non-loaded area as of now
MapNode n = env->getMap().getNodeNoEx(pos);
MapNode n = env->getMap().getNode(pos);
if(n.getContent() == CONTENT_IGNORE){
lua_pushboolean(L, false);
return 1;
@ -469,7 +469,7 @@ int ModApiEnvMod::l_punch_node(lua_State *L)
v3s16 pos = read_v3s16(L, 1);
// Don't attempt to load non-loaded area as of now
MapNode n = env->getMap().getNodeNoEx(pos);
MapNode n = env->getMap().getNode(pos);
if(n.getContent() == CONTENT_IGNORE){
lua_pushboolean(L, false);
return 1;
@ -491,7 +491,7 @@ int ModApiEnvMod::l_get_node_max_level(lua_State *L)
}
v3s16 pos = read_v3s16(L, 1);
MapNode n = env->getMap().getNodeNoEx(pos);
MapNode n = env->getMap().getNode(pos);
lua_pushnumber(L, n.getMaxLevel(env->getGameDef()->ndef()));
return 1;
}
@ -506,7 +506,7 @@ int ModApiEnvMod::l_get_node_level(lua_State *L)
}
v3s16 pos = read_v3s16(L, 1);
MapNode n = env->getMap().getNodeNoEx(pos);
MapNode n = env->getMap().getNode(pos);
lua_pushnumber(L, n.getLevel(env->getGameDef()->ndef()));
return 1;
}
@ -522,7 +522,7 @@ int ModApiEnvMod::l_set_node_level(lua_State *L)
u8 level = 1;
if(lua_isnumber(L, 2))
level = lua_tonumber(L, 2);
MapNode n = env->getMap().getNodeNoEx(pos);
MapNode n = env->getMap().getNode(pos);
lua_pushnumber(L, n.setLevel(env->getGameDef()->ndef(), level));
env->setNode(pos, n);
return 1;
@ -539,7 +539,7 @@ int ModApiEnvMod::l_add_node_level(lua_State *L)
u8 level = 1;
if(lua_isnumber(L, 2))
level = lua_tonumber(L, 2);
MapNode n = env->getMap().getNodeNoEx(pos);
MapNode n = env->getMap().getNode(pos);
lua_pushnumber(L, n.addLevel(env->getGameDef()->ndef(), level));
env->setNode(pos, n);
return 1;
@ -780,7 +780,7 @@ int ModApiEnvMod::l_find_node_near(lua_State *L)
std::vector<v3s16> list = FacePositionCache::getFacePositions(d);
for (const v3s16 &i : list) {
v3s16 p = pos + i;
content_t c = env->getMap().getNodeNoEx(p).getContent();
content_t c = env->getMap().getNode(p).getContent();
if (CONTAINS(filter, c)) {
push_v3s16(L, p);
return 1;
@ -832,7 +832,7 @@ int ModApiEnvMod::l_find_nodes_in_area(lua_State *L)
for (s16 y = minp.Y; y <= maxp.Y; y++)
for (s16 z = minp.Z; z <= maxp.Z; z++) {
v3s16 p(x, y, z);
content_t c = env->getMap().getNodeNoEx(p).getContent();
content_t c = env->getMap().getNode(p).getContent();
std::vector<content_t>::iterator it = std::find(filter.begin(), filter.end(), c);
if (it != filter.end()) {
@ -898,10 +898,10 @@ int ModApiEnvMod::l_find_nodes_in_area_under_air(lua_State *L)
for (s16 z = minp.Z; z <= maxp.Z; z++) {
s16 y = minp.Y;
v3s16 p(x, y, z);
content_t c = env->getMap().getNodeNoEx(p).getContent();
content_t c = env->getMap().getNode(p).getContent();
for (; y <= maxp.Y; y++) {
v3s16 psurf(x, y + 1, z);
content_t csurf = env->getMap().getNodeNoEx(psurf).getContent();
content_t csurf = env->getMap().getNode(psurf).getContent();
if (c != CONTENT_AIR && csurf == CONTENT_AIR &&
CONTAINS(filter, c)) {
push_v3s16(L, v3s16(x, y, z));

@ -3551,7 +3551,7 @@ v3f Server::findSpawnPos()
for (s32 i = 0; i < 8; i++) {
v3s16 blockpos = getNodeBlockPos(nodepos);
map.emergeBlock(blockpos, true);
content_t c = map.getNodeNoEx(nodepos).getContent();
content_t c = map.getNode(nodepos).getContent();
// In generated mapblocks allow spawn in all 'airlike' drawtype nodes.
// In ungenerated mapblocks allow spawn in 'ignore' nodes.

@ -550,7 +550,7 @@ bool ServerEnvironment::line_of_sight(v3f pos1, v3f pos2, v3s16 *p)
// Iterate trough nodes on the line
voxalgo::VoxelLineIterator iterator(pos1 / BS, (pos2 - pos1) / BS);
do {
MapNode n = getMap().getNodeNoEx(iterator.m_current_node_pos);
MapNode n = getMap().getNode(iterator.m_current_node_pos);
// Return non-air
if (n.param0 != CONTENT_AIR) {
@ -914,7 +914,7 @@ public:
c = n.getContent();
} else {
// otherwise consult the map
MapNode n = map->getNodeNoEx(p1 + block->getPosRelative());
MapNode n = map->getNode(p1 + block->getPosRelative());
c = n.getContent();
}
if (CONTAINS(aabm.required_neighbors, c))
@ -1008,7 +1008,7 @@ void ServerEnvironment::addLoadingBlockModifierDef(LoadingBlockModifierDef *lbm)
bool ServerEnvironment::setNode(v3s16 p, const MapNode &n)
{
const NodeDefManager *ndef = m_server->ndef();
MapNode n_old = m_map->getNodeNoEx(p);
MapNode n_old = m_map->getNode(p);
const ContentFeatures &cf_old = ndef->get(n_old);
@ -1041,7 +1041,7 @@ bool ServerEnvironment::setNode(v3s16 p, const MapNode &n)
bool ServerEnvironment::removeNode(v3s16 p)
{
const NodeDefManager *ndef = m_server->ndef();
MapNode n_old = m_map->getNodeNoEx(p);
MapNode n_old = m_map->getNode(p);
// Call destructor
if (ndef->get(n_old).has_on_destruct)

@ -529,7 +529,7 @@ void update_lighting_nodes(Map *map,
for (const v3s16 &neighbor_dir : neighbor_dirs) {
v3s16 p2 = p + neighbor_dir;
bool is_valid;
MapNode n2 = map->getNodeNoEx(p2, &is_valid);
MapNode n2 = map->getNode(p2, &is_valid);
if (is_valid) {
u8 spread = n2.getLight(bank, ndef);
// If it is sure that the neighbor won't be
@ -566,7 +566,7 @@ void update_lighting_nodes(Map *map,
MapNode n2;
n2 = map->getNodeNoEx(n2pos, &is_valid_position);
n2 = map->getNode(n2pos, &is_valid_position);
if (!is_valid_position)
break;
@ -598,7 +598,7 @@ void update_lighting_nodes(Map *map,
MapNode n2;
n2 = map->getNodeNoEx(n2pos, &is_valid_position);
n2 = map->getNode(n2pos, &is_valid_position);
if (!is_valid_position)
break;
@ -668,7 +668,7 @@ bool is_light_locally_correct(Map *map, const NodeDefManager *ndef,
LightBank bank, v3s16 pos)
{
bool is_valid_position;
MapNode n = map->getNodeNoEx(pos, &is_valid_position);
MapNode n = map->getNode(pos, &is_valid_position);
const ContentFeatures &f = ndef->get(n);
if (f.param_type != CPT_LIGHT) {
return true;
@ -677,7 +677,7 @@ bool is_light_locally_correct(Map *map, const NodeDefManager *ndef,
assert(f.light_source <= LIGHT_MAX);
u8 brightest_neighbor = f.light_source + 1;
for (const v3s16 &neighbor_dir : neighbor_dirs) {
MapNode n2 = map->getNodeNoEx(pos + neighbor_dir,
MapNode n2 = map->getNode(pos + neighbor_dir,
&is_valid_position);
u8 light2 = n2.getLight(bank, ndef);
if (brightest_neighbor < light2) {