#include <mapnode.h>
Public Member Functions | |
MapNode ()=default | |
MapNode (content_t content, u8 a_param1=0, u8 a_param2=0) noexcept | |
bool | operator== (const MapNode &other) const noexcept |
content_t | getContent () const noexcept |
void | setContent (content_t c) noexcept |
u8 | getParam1 () const noexcept |
void | setParam1 (u8 p) noexcept |
u8 | getParam2 () const noexcept |
void | setParam2 (u8 p) noexcept |
void | getColor (const ContentFeatures &f, video::SColor *color) const |
void | setLight (LightBank bank, u8 a_light, const ContentFeatures &f) noexcept |
void | setLight (LightBank bank, u8 a_light, const NodeDefManager *nodemgr) |
bool | isLightDayNightEq (const NodeDefManager *nodemgr) const |
Check if the light value for night differs from the light value for day. More... | |
u8 | getLight (LightBank bank, const NodeDefManager *nodemgr) const |
u8 | getLightRaw (LightBank bank, const ContentFeatures &f) const noexcept |
u8 | getLightNoChecks (LightBank bank, const ContentFeatures *f) const noexcept |
This function differs from getLight(LightBank bank, NodeDefManager *nodemgr) in that the ContentFeatures of the node in question are not retrieved by the function itself. More... | |
bool | getLightBanks (u8 &lightday, u8 &lightnight, const NodeDefManager *nodemgr) const |
u8 | getLightBlend (u32 daylight_factor, const NodeDefManager *nodemgr) const |
u8 | getFaceDir (const NodeDefManager *nodemgr, bool allow_wallmounted=false) const |
u8 | getWallMounted (const NodeDefManager *nodemgr) const |
v3s16 | getWallMountedDir (const NodeDefManager *nodemgr) const |
void | rotateAlongYAxis (const NodeDefManager *nodemgr, Rotation rot) |
u8 | getNeighbors (v3s16 p, Map *map) const |
void | getNodeBoxes (const NodeDefManager *nodemgr, std::vector< aabb3f > *boxes, u8 neighbors=0) const |
void | getSelectionBoxes (const NodeDefManager *nodemg, std::vector< aabb3f > *boxes, u8 neighbors=0) const |
void | getCollisionBoxes (const NodeDefManager *nodemgr, std::vector< aabb3f > *boxes, u8 neighbors=0) const |
u8 | getMaxLevel (const NodeDefManager *nodemgr) const |
u8 | getLevel (const NodeDefManager *nodemgr) const |
s8 | setLevel (const NodeDefManager *nodemgr, s16 level=1) |
s8 | addLevel (const NodeDefManager *nodemgr, s16 add=1) |
void | serialize (u8 *dest, u8 version) const |
void | deSerialize (u8 *source, u8 version) |
Static Public Member Functions | |
static u32 | serializedLength (u8 version) |
static void | serializeBulk (std::ostream &os, int version, const MapNode *nodes, u32 nodecount, u8 content_width, u8 params_width, int compression_level) |
static void | deSerializeBulk (std::istream &is, int version, MapNode *nodes, u32 nodecount, u8 content_width, u8 params_width) |
Public Attributes | |
u16 | param0 |
u8 | param1 |
u8 | param2 |
Private Member Functions | |
void | deSerialize_pre22 (const u8 *source, u8 version) |
|
default |
|
inlinenoexcept |
s8 MapNode::addLevel | ( | const NodeDefManager * | nodemgr, |
s16 | add = 1 |
||
) |
References getLevel(), and setLevel().
Referenced by ModApiEnvMod::l_add_node_level().
void MapNode::deSerialize | ( | u8 * | source, |
u8 | version | ||
) |
References deSerialize_pre22(), param0, param1, param2, readU16(), readU8(), and ser_ver_supported().
Referenced by MapBlock::deSerialize_pre22(), and Client::handleCommand_AddNode().
|
private |
References CONTENT_AIR, CONTENT_IGNORE, mapnode_translate_to_internal(), param0, param1, and param2.
Referenced by deSerialize().
|
static |
References decompressZlib(), FATAL_ERROR, param0, param1, param2, readU16(), readU8(), and ser_ver_supported().
Referenced by MapBlock::deSerialize(), and Schematic::deserializeFromMts().
void MapNode::getCollisionBoxes | ( | const NodeDefManager * | nodemgr, |
std::vector< aabb3f > * | boxes, | ||
u8 | neighbors = 0 |
||
) | const |
References ContentFeatures::collision_box, NodeBox::fixed, NodeDefManager::get(), ContentFeatures::node_box, and transformNodeBox().
Referenced by collisionMoveSimple(), LocalPlayer::old_move(), and LocalPlayer::updateSneakNode().
void MapNode::getColor | ( | const ContentFeatures & | f, |
video::SColor * | color | ||
) | const |
Returns the color of the node.
f | content features of this node |
color | output, contains the node's color. |
References ContentFeatures::color, ContentFeatures::palette, and param2.
Referenced by Minimap::blitMinimapPixelsToImageSurface(), ParticleManager::getNodeParticleParams(), getNodeTileN(), and MapblockMeshGenerator::getSpecialTile().
|
inlinenoexcept |
References param0.
Referenced by MapBlock::actuallyUpdateDayNightDiff(), Map::addNodeAndUpdate(), analyze_block(), ABMHandler::apply(), LBMManager::applyLBMs(), Schematic::blitToVManip(), Decoration::canPlaceDecoration(), CavesRandomWalk::carveRoute(), CavesV6::carveRoute(), collisionMoveSimple(), correctBlockNodeIds(), MapBlock::deSerialize_pre22(), MapblockMeshGenerator::drawFirelikeNode(), MapblockMeshGenerator::drawGlasslikeFramedNode(), MapblockMeshGenerator::drawGlasslikeNode(), MapgenBasic::dustTopNodes(), voxalgo::fill_with_sunlight(), MapgenV6::find_stone_level(), DungeonGen::findPlaceForDoor(), Server::findSpawnPos(), MapgenV6::flowMud(), OreScatter::generate(), OreSheet::generate(), OrePuff::generate(), OreBlob::generate(), OreVein::generate(), OreStratum::generate(), DecoSimple::generate(), DungeonGen::generate(), generate_nodelist_and_update_ids(), MapgenV5::generateBaseTerrain(), MapgenBasic::generateBiomes(), CavernsNoise::generateCaverns(), CavesNoiseIntersection::generateCaves(), MapgenV6::generateGround(), MapgenCarpathian::generateTerrain(), MapgenFlat::generateTerrain(), MapgenFractal::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), NodeDefManager::get(), getBlockNodeIdMapping(), MapblockMeshGenerator::getLiquidNeighborhood(), MinimapMapblock::getMinimapNodes(), getSmoothLightCombined(), getTileInfo(), getVisibleBrightness(), MapgenV6::growGrass(), LocalPlayer::handleAutojump(), Server::handleCommand_Interact(), voxalgo::is_sunlight_above(), ReflowScan::isLiquidFlowableTo(), Mapgen::isLiquidHorizontallyFlowable(), MapblockMeshGenerator::isSameRail(), ModApiEnvMod::l_dig_node(), ModApiEnvMod::l_find_node_near(), ModApiEnvMod::l_find_nodes_in_area(), ModApiEnvMod::l_find_nodes_in_area_under_air(), LuaVoxelManip::l_get_data(), ModApiEnvMod::l_place_node(), ModApiEnvMod::l_punch_node(), ModApiMapgen::l_read_schematic(), treegen::make_jungletree(), treegen::make_pine_tree(), treegen::make_tree(), MapgenSinglenode::makeChunk(), DungeonGen::makeCorridor(), DungeonGen::makeDungeon(), mapnode_translate_to_internal(), LocalPlayer::move(), MapgenV6::moveMud(), ScriptApiNode::node_on_receive_fields(), ScriptApiNodemeta::nodemeta_inventory_AllowMove(), ScriptApiNodemeta::nodemeta_inventory_AllowPut(), ScriptApiNodemeta::nodemeta_inventory_AllowTake(), ScriptApiNodemeta::nodemeta_inventory_OnMove(), ScriptApiNodemeta::nodemeta_inventory_OnPut(), ScriptApiNodemeta::nodemeta_inventory_OnTake(), LocalPlayer::old_move(), MapgenV6::placeTreesAndJungleGrass(), MapblockMeshGenerator::prepareLiquidNodeDrawing(), VoxelManipulator::print(), Mapgen::propagateSunlight(), Schematic::resolveNodeNames(), ReflowScan::scanColumn(), Schematic::serializeToLua(), Map::setNode(), ParticleSpawner::spawnParticle(), voxalgo::spread_light(), Mapgen::spreadLight(), PlayerSAO::step(), TestMapNode::testNodeProperties(), Map::transformLiquids(), treegen::tree_fruit_placement(), treegen::tree_leaves_placement(), treegen::tree_single_leaves_placement(), treegen::tree_trunk_placement(), voxalgo::unspread_light(), GameUI::update(), ClientMap::updateDrawList(), and Mapgen::updateLiquid().
u8 MapNode::getFaceDir | ( | const NodeDefManager * | nodemgr, |
bool | allow_wallmounted = false |
||
) | const |
References CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_FACEDIR, CPT2_WALLMOUNTED, NodeDefManager::get(), getParam2(), ContentFeatures::param_type_2, and wallmounted_to_facedir.
Referenced by MapblockMeshGenerator::drawMeshNode(), getNodeTile(), and transformNodeBox().
u8 MapNode::getLevel | ( | const NodeDefManager * | nodemgr | ) | const |
References CPT2_FLOWINGLIQUID, CPT2_LEVELED, NodeDefManager::get(), getParam2(), ContentFeatures::leveled, LEVELED_MASK, ContentFeatures::leveled_max, LIQUID_FLOWING, LIQUID_LEVEL_MASK, LIQUID_LEVEL_SOURCE, LIQUID_SOURCE, ContentFeatures::liquid_type, and ContentFeatures::param_type_2.
Referenced by addLevel(), ModApiEnvMod::l_get_node_level(), and transformNodeBox().
u8 MapNode::getLight | ( | LightBank | bank, |
const NodeDefManager * | nodemgr | ||
) | const |
References CPT_LIGHT, NodeDefManager::get(), ContentFeatures::light_source, LIGHTBANK_DAY, MYMAX, param1, and ContentFeatures::param_type.
Referenced by getFaceLight(), getInteriorLight(), getVisibleBrightness(), voxalgo::is_light_locally_correct(), voxalgo::is_sunlight_above(), voxalgo::is_sunlight_above_block(), VoxelManipulator::print(), TestMapNode::testNodeProperties(), voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().
bool MapNode::getLightBanks | ( | u8 & | lightday, |
u8 & | lightnight, | ||
const NodeDefManager * | nodemgr | ||
) | const |
References CPT_LIGHT, NodeDefManager::get(), ContentFeatures::light_source, param1, and ContentFeatures::param_type.
Referenced by getLightBlend().
|
inline |
References blend_light(), and getLightBanks().
Referenced by SmokePuffCSO::SmokePuffCSO(), ClientMap::getBackgroundBrightness(), getVisibleBrightness(), ModApiEnvMod::l_get_node_light(), Particle::updateLight(), and GenericCAO::updateLight().
|
noexcept |
This function differs from getLight(LightBank bank, NodeDefManager *nodemgr) in that the ContentFeatures of the node in question are not retrieved by the function itself.
Thus, if you have already called nodemgr->get() to get the ContentFeatures you pass it to this function instead of the function getting ContentFeatures itself. Since NodeDefManager::get() is relatively expensive this can lead to significant performance improvements in some situations. Call this function if (and only if) you have already retrieved the ContentFeatures by calling NodeDefManager::get() for the node you're working with and the pre-conditions listed are true.
References LIGHTBANK_DAY, and MYMAX.
Referenced by voxalgo::blit_back_with_light(), voxalgo::finish_bulk_light_update(), getSmoothLightCombined(), voxalgo::is_light_locally_correct(), and voxalgo::repair_block_light().
|
noexcept |
Returns the node's light level from param1. If the node emits light, it is ignored.
f | the ContentFeatures of this node. |
References CPT_LIGHT, and LIGHTBANK_DAY.
Referenced by voxalgo::propagate_block_sunlight(), voxalgo::spread_light(), and voxalgo::unspread_light().
u8 MapNode::getMaxLevel | ( | const NodeDefManager * | nodemgr | ) | const |
References CPT2_FLOWINGLIQUID, CPT2_LEVELED, NodeDefManager::get(), ContentFeatures::leveled, ContentFeatures::leveled_max, LIQUID_FLOWING, LIQUID_LEVEL_MAX, ContentFeatures::liquid_type, and ContentFeatures::param_type_2.
Referenced by ModApiEnvMod::l_get_node_max_level().
Checks which neighbors does this node connect to.
p | coordinates of the node |
References ContentFeatures::drawtype, NodeDefManager::get(), getNeighborConnectingFace(), Map::getNodeDefManager(), NDT_NODEBOX, ContentFeatures::node_box, NODEBOX_CONNECTED, p(), and NodeBox::type.
Referenced by Environment::continueRaycast(), and Game::updatePointedThing().
void MapNode::getNodeBoxes | ( | const NodeDefManager * | nodemgr, |
std::vector< aabb3f > * | boxes, | ||
u8 | neighbors = 0 |
||
) | const |
References NodeDefManager::get(), ContentFeatures::node_box, and transformNodeBox().
Referenced by MapblockMeshGenerator::drawNodeboxNode().
|
inlinenoexcept |
References param1.
Referenced by MapBlock::deSerialize_pre22(), and pushnode().
|
inlinenoexcept |
References param2.
Referenced by MapBlock::deSerialize_pre22(), MapblockMeshGenerator::drawGlasslikeFramedNode(), getFaceDir(), getLevel(), getWallMounted(), pushnode(), setLevel(), and GameUI::update().
void MapNode::getSelectionBoxes | ( | const NodeDefManager * | nodemg, |
std::vector< aabb3f > * | boxes, | ||
u8 | neighbors = 0 |
||
) | const |
References NodeDefManager::get(), ContentFeatures::selection_box, and transformNodeBox().
Referenced by Environment::continueRaycast(), and Game::updatePointedThing().
u8 MapNode::getWallMounted | ( | const NodeDefManager * | nodemgr | ) | const |
References CPT2_COLORED_WALLMOUNTED, CPT2_WALLMOUNTED, NodeDefManager::get(), getParam2(), and ContentFeatures::param_type_2.
Referenced by MapblockMeshGenerator::drawMeshNode(), MapblockMeshGenerator::drawSignlikeNode(), MapblockMeshGenerator::drawTorchlikeNode(), and getWallMountedDir().
v3s16 MapNode::getWallMountedDir | ( | const NodeDefManager * | nodemgr | ) | const |
References getWallMounted().
Referenced by transformNodeBox().
bool MapNode::isLightDayNightEq | ( | const NodeDefManager * | nodemgr | ) | const |
Check if the light value for night differs from the light value for day.
References CPT_LIGHT, NodeDefManager::get(), ContentFeatures::light_source, MYMAX, param1, and ContentFeatures::param_type.
Referenced by MapBlock::actuallyUpdateDayNightDiff().
|
inlinenoexcept |
void MapNode::rotateAlongYAxis | ( | const NodeDefManager * | nodemgr, |
Rotation | rot | ||
) |
References CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_FACEDIR, CPT2_WALLMOUNTED, NodeDefManager::get(), param2, ContentFeatures::param_type_2, rot_to_wallmounted, and wallmounted_to_rot.
Referenced by Schematic::blitToVManip().
void MapNode::serialize | ( | u8 * | dest, |
u8 | version | ||
) | const |
References param0, param1, param2, ser_ver_supported(), writeU16(), and writeU8().
|
static |
References compressZlib(), param0, param1, param2, sanity_check, ser_ver_supported(), writeU16(), and writeU8().
Referenced by MapBlock::serialize(), and Schematic::serializeToMts().
|
static |
References ser_ver_supported().
Referenced by MapBlock::deSerialize_pre22(), and Client::handleCommand_AddNode().
|
inlinenoexcept |
References param0.
Referenced by CommonParticleParams::CommonParticleParams(), Schematic::applyProbabilities(), correctBlockNodeIds(), MapBlock::deSerialize_pre22(), MapgenV6::flowMud(), DungeonGen::generate(), generate_nodelist_and_update_ids(), getBlockNodeIdMapping(), LuaVoxelManip::l_set_data(), mapnode_translate_to_internal(), Schematic::resolveNodeNames(), setLevel(), TestMapNode::testNodeProperties(), and Map::transformLiquids().
s8 MapNode::setLevel | ( | const NodeDefManager * | nodemgr, |
s16 | level = 1 |
||
) |
References CONTENT_AIR, CPT2_FLOWINGLIQUID, CPT2_LEVELED, NodeDefManager::get(), getParam2(), LEVELED_MASK, ContentFeatures::leveled_max, ContentFeatures::liquid_alternative_flowing_id, ContentFeatures::liquid_alternative_source_id, LIQUID_FLOWING, LIQUID_LEVEL_MASK, LIQUID_LEVEL_SOURCE, LIQUID_SOURCE, ContentFeatures::liquid_type, ContentFeatures::param_type_2, setContent(), and setParam2().
Referenced by addLevel(), and ModApiEnvMod::l_set_node_level().
|
noexcept |
References CPT_LIGHT, LIGHTBANK_DAY, and LIGHTBANK_NIGHT.
Referenced by Map::addNodeAndUpdate(), voxalgo::fill_with_sunlight(), voxalgo::finish_bulk_light_update(), voxalgo::propagate_block_sunlight(), setLight(), voxalgo::spread_light(), Map::transformLiquids(), voxalgo::unspread_light(), voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().
void MapNode::setLight | ( | LightBank | bank, |
u8 | a_light, | ||
const NodeDefManager * | nodemgr | ||
) |
|
inlinenoexcept |
Referenced by MapBlock::deSerialize_pre22().
|
inlinenoexcept |
Referenced by MapBlock::deSerialize_pre22(), and setLevel().
u16 MapNode::param0 |
Referenced by Pathfinder::calcCost(), ParticleParameters::deSerialize(), deSerialize(), deSerialize_pre22(), deSerializeBulk(), getContent(), MinimapUpdateThread::getMap(), GridNodeContainer::initNode(), Environment::line_of_sight(), NodeDefManager::nodeboxConnects(), operator==(), Server::sendAddNode(), ParticleParameters::serialize(), serialize(), serializeBulk(), setContent(), and Pathfinder::walkDownwards().
u8 MapNode::param1 |
Referenced by RollbackNode::RollbackNode(), Schematic::applyProbabilities(), Schematic::blitToVManip(), deSerialize(), deSerialize_pre22(), deSerializeBulk(), Schematic::deserializeFromMts(), ServerEnvironment::findSunlight(), getLight(), getLightBanks(), getParam1(), Schematic::getSchematicFromMap(), isLightDayNightEq(), LuaVoxelManip::l_get_light_data(), ModApiEnvMod::l_get_natural_light(), ModApiMapgen::l_read_schematic(), LuaVoxelManip::l_set_light_data(), Mapgen::lightSpread(), operator==(), Mapgen::propagateSunlight(), Server::sendAddNode(), serialize(), serializeBulk(), Schematic::serializeToLua(), Mapgen::setLighting(), setParam1(), and Mapgen::spreadLight().
u8 MapNode::param2 |
Referenced by RollbackNode::RollbackNode(), ParticleParameters::deSerialize(), deSerialize(), deSerialize_pre22(), deSerializeBulk(), MapblockMeshGenerator::drawPlantlike(), getColor(), MapblockMeshGenerator::getLiquidNeighborhood(), getParam2(), LuaVoxelManip::l_get_param2_data(), ModApiMapgen::l_read_schematic(), LuaVoxelManip::l_set_param2_data(), NodeDefManager::nodeboxConnects(), operator==(), VoxelManipulator::print(), rotateAlongYAxis(), Server::sendAddNode(), ParticleParameters::serialize(), serialize(), serializeBulk(), Schematic::serializeToLua(), setParam2(), and Map::transformLiquids().