// 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) {
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)
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;
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);
// 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
// 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
// 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;
// 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;
// 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;
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) {
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 {
// 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.
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.
/* 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;
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;
}
}
} 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));
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;
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: " +
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);
}
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 =
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;
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;
}
else
pp = p + v3s16(0, -1, 0);
- if (!nodedef->get(map.getNodeNoEx(pp)).walkable)
+ if (!nodedef->get(map.getNode(pp)).walkable)
return false;
}
// 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.
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)) {
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
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;
}
// 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
(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;
}
} 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)
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);
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;
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;
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;
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 {
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;
{
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;
/*
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");
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;
} 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;
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
*/
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;
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;
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;
}
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) {
{
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;
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
// 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)
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
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
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;
}
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
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) {
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 &&
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;
// 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;
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;
}
// 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);
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)
{
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) {
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))
v3s16 p0 = m_transforming_liquid.front();
m_transforming_liquid.pop_front();
- MapNode n0 = getNodeNoEx(p0);
+ MapNode n0 = getNode(p0);
/*
Collect information about current node
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:
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
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;
// 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.
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)
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;
}
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."
// 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."
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);
}
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) ||
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 ) {
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 ) {
}
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?
}
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?
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;
// 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) {
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;
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;
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;
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;
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;
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;
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;
// 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;
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());
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));
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;
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;
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;
}
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;
}
}
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;
}
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;
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;
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;
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()) {
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));
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.
// 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) {
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))
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);
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)
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
MapNode n2;
- n2 = map->getNodeNoEx(n2pos, &is_valid_position);
+ n2 = map->getNode(n2pos, &is_valid_position);
if (!is_valid_position)
break;
MapNode n2;
- n2 = map->getNodeNoEx(n2pos, &is_valid_position);
+ n2 = map->getNode(n2pos, &is_valid_position);
if (!is_valid_position)
break;
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;
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) {