mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31:04 +00:00
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue