#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, ContentLightingFlags f) noexcept |
bool | isLightDayNightEq (ContentLightingFlags f) const noexcept |
Check if the light value for night differs from the light value for day. | |
u8 | getLight (LightBank bank, ContentLightingFlags f) const noexcept |
u8 | getLightRaw (LightBank bank, ContentLightingFlags f) const noexcept |
u8 | getLightBlend (u32 daylight_factor, ContentLightingFlags f) const |
u8 | getFaceDir (const NodeDefManager *nodemgr, bool allow_wallmounted=false) const |
u8 | getWallMounted (const NodeDefManager *nodemgr) const |
v3s16 | getWallMountedDir (const NodeDefManager *nodemgr) const |
u8 | getDegRotate (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 Buffer< u8 > | serializeBulk (int version, const MapNode *nodes, u32 nodecount, u8 content_width, u8 params_width) |
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 ModApiEnv::l_add_node_level(), and ModApiEnvVM::l_add_node_level().
void MapNode::deSerialize | ( | u8 * | source, |
u8 | version ) |
References deSerialize_pre22(), param0, param1, param2, readU16(), readU8(), and ser_ver_supported_read().
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 param0, param1, param2, readU16(), readU8(), and ser_ver_supported_read().
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 add_area_node_boxes(), ModApiEnv::l_get_node_boxes(), 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(), and getNodeTileN().
|
inlinenoexcept |
Referenced by MapBlockMesh::MapBlockMesh(), MapBlock::actuallyUpdateIsAir(), add_area_node_boxes(), Map::addNodeAndUpdate(), ServerMap::addNodeAndUpdate(), analyze_block(), ABMHandler::apply(), LBMManager::applyLBMs(), Schematic::blitToVManip(), Decoration::canPlaceDecoration(), CavesRandomWalk::carveRoute(), CavesV6::carveRoute(), Schematic::condenseContentIds(), correctBlockNodeIds(), createSpecialNodeMesh(), MapBlock::deSerialize_pre22(), MapblockMeshGenerator::drawFirelikeNode(), MapblockMeshGenerator::drawGlasslikeFramedNode(), MapblockMeshGenerator::drawGlasslikeNode(), MapblockMeshGenerator::drawSolidNode(), MapgenBasic::dustTopNodes(), voxalgo::fill_with_sunlight(), voxalgo::fill_with_sunlight(), MapgenV6::find_stone_level(), ModApiEnvBase::findNodesInArea(), DungeonGen::findPlaceForDoor(), Server::findSpawnPos(), MapgenV6::flowMud(), DecoSimple::generate(), DungeonGen::generate(), OreBlob::generate(), OrePuff::generate(), OreScatter::generate(), OreSheet::generate(), OreStratum::generate(), OreVein::generate(), MapgenV5::generateBaseTerrain(), MapgenBasic::generateBiomes(), CavernsNoise::generateCaverns(), CavesNoiseIntersection::generateCaves(), MapgenV6::generateGround(), MapgenCarpathian::generateTerrain(), MapgenFlat::generateTerrain(), MapgenFractal::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), NodeDefManager::get(), getBlockNodeIdMapping(), NodeDefManager::getLightingFlags(), MapblockMeshGenerator::getLiquidNeighborhood(), MinimapMapblock::getMinimapNodes(), getSmoothLightCombined(), getVisibleBrightness(), MapgenV6::growGrass(), LocalPlayer::handleAutojump(), Server::handleCommand_Interact(), voxalgo::is_sunlight_above(), ReflowScan::isLiquidFlowableTo(), Mapgen::isLiquidHorizontallyFlowable(), MapblockMeshGenerator::isSameRail(), ModApiEnv::l_dig_node(), LuaVoxelManip::l_get_data(), ModApiEnv::l_get_node_raw(), ModApiEnv::l_place_node(), ModApiEnv::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(), pushnode(), Schematic::resolveNodeNames(), ReflowScan::scanColumn(), Schematic::serializeToLua(), set_node_in_block(), ParticleSpawner::spawnParticle(), Mapgen::spreadLight(), PlayerSAO::step(), TestMap::testForEachNodeInArea(), TestMapNode::testNodeProperties(), ServerMap::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(), Mapgen::updateLiquid(), workOnBoth(), and workOnNodes().
u8 MapNode::getDegRotate | ( | const NodeDefManager * | nodemgr | ) | const |
References CPT2_COLORED_DEGROTATE, CPT2_DEGROTATE, NodeDefManager::get(), getParam2(), and ContentFeatures::param_type_2.
u8 MapNode::getFaceDir | ( | const NodeDefManager * | nodemgr, |
bool | allow_wallmounted = false ) const |
References CPT2_4DIR, CPT2_COLORED_4DIR, CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_FACEDIR, CPT2_WALLMOUNTED, DWM_COUNT, NodeDefManager::get(), getParam2(), MYMIN, ContentFeatures::param_type_2, and wallmounted_to_facedir.
Referenced by getNodeTile(), Game::nodePlacement(), 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(), ModApiEnv::l_get_node_level(), ModApiEnvVM::l_get_node_level(), and transformNodeBox().
|
inlinenoexcept |
References MYMAX.
Referenced by voxalgo::blit_back_with_light(), voxalgo::finish_bulk_light_update(), getFaceLight(), getInteriorLight(), getSmoothLightCombined(), getVisibleBrightness(), voxalgo::is_light_locally_correct(), voxalgo::is_sunlight_above(), voxalgo::is_sunlight_above_block(), VoxelManipulator::print(), voxalgo::repair_block_light(), TestVoxelAlgorithms::testLighting(), TestMapNode::testNodeProperties(), voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().
|
inline |
References blend_light(), LIGHTBANK_DAY, and LIGHTBANK_NIGHT.
Referenced by SmokePuffCSO::SmokePuffCSO(), ClientMap::getBackgroundBrightness(), getVisibleBrightness(), ModApiEnv::l_get_node_light(), and Particle::updateLight().
|
inlinenoexcept |
Returns the node's light level from param1. If the node emits light, it is ignored.
f | the ContentLightingFlags of this node. |
References LIGHTBANK_DAY.
Referenced by Map::addNodeAndUpdate(), 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 ModApiEnv::l_get_node_max_level(), and ModApiEnvVM::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 add_area_node_boxes(), Environment::continueRaycast(), ModApiEnv::l_get_node_boxes(), 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(), and ModApiEnv::l_get_node_boxes().
|
inlinenoexcept |
Referenced by MapBlock::deSerialize_pre22(), LuaVoxelManip::l_get_light_data(), ModApiEnv::l_get_node_raw(), pushnode(), and TestVoxelAlgorithms::testLighting().
|
inlinenoexcept |
Referenced by createSpecialNodeMesh(), MapBlock::deSerialize_pre22(), getDegRotate(), getFaceDir(), getLevel(), getWallMounted(), ModApiEnv::l_get_node_raw(), LuaVoxelManip::l_get_param2_data(), Game::nodePlacement(), 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(), ModApiEnv::l_get_node_boxes(), and Game::updatePointedThing().
u8 MapNode::getWallMounted | ( | const NodeDefManager * | nodemgr | ) | const |
References CPT2_COLORED_WALLMOUNTED, CPT2_WALLMOUNTED, ContentFeatures::drawtype, DWM_COUNT, NodeDefManager::get(), getParam2(), MYMIN, NDT_PLANTLIKE, NDT_PLANTLIKE_ROOTED, NDT_SIGNLIKE, NDT_TORCHLIKE, and ContentFeatures::param_type_2.
Referenced by getWallMountedDir(), and transformNodeBox().
v3s16 MapNode::getWallMountedDir | ( | const NodeDefManager * | nodemgr | ) | const |
References getWallMounted().
Referenced by Game::nodePlacement(), and transformNodeBox().
|
inlinenoexcept |
Check if the light value for night differs from the light value for day.
References LIGHTBANK_DAY, and LIGHTBANK_NIGHT.
|
inlinenoexcept |
void MapNode::rotateAlongYAxis | ( | const NodeDefManager * | nodemgr, |
Rotation | rot ) |
References CPT2_4DIR, CPT2_COLORED_4DIR, CPT2_COLORED_DEGROTATE, CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_DEGROTATE, CPT2_FACEDIR, CPT2_WALLMOUNTED, DWM_COUNT, NodeDefManager::get(), MYMIN, 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_write(), writeU16(), and writeU8().
|
static |
References p(), param0, param1, param2, sanity_check, ser_ver_supported_write(), writeU16(), and writeU8().
Referenced by MapBlock::serialize(), and Schematic::serializeToMts().
|
static |
References ser_ver_supported_read().
Referenced by MapBlock::deSerialize_pre22(), and Client::handleCommand_AddNode().
|
inlinenoexcept |
Referenced by CommonParticleParams::CommonParticleParams(), Schematic::applyProbabilities(), Schematic::condenseContentIds(), correctBlockNodeIds(), MapBlock::deSerialize_pre22(), MapgenV6::flowMud(), DungeonGen::generate(), getBlockNodeIdMapping(), LuaVoxelManip::l_set_data(), mapnode_translate_to_internal(), Schematic::resolveNodeNames(), setLevel(), TestMapNode::testNodeProperties(), and ServerMap::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(), ModApiEnv::l_set_node_level(), and ModApiEnvVM::l_set_node_level().
|
inlinenoexcept |
References LIGHTBANK_DAY, and LIGHTBANK_NIGHT.
Referenced by Map::addNodeAndUpdate(), voxalgo::fill_with_sunlight(), voxalgo::fill_with_sunlight(), voxalgo::finish_bulk_light_update(), voxalgo::propagate_block_sunlight(), voxalgo::spread_light(), ServerMap::transformLiquids(), voxalgo::unspread_light(), voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().
|
inlinenoexcept |
References p().
Referenced by MapBlock::deSerialize_pre22().
|
inlinenoexcept |
References p().
Referenced by createSpecialNodeMesh(), MapBlock::deSerialize_pre22(), getItemMesh(), Game::nodePlacement(), WieldMeshSceneNode::setItem(), and setLevel().
u16 MapNode::param0 |
Referenced by Pathfinder::calcCost(), deSerialize(), ParticleParameters::deSerialize(), deSerialize_pre22(), deSerializeBulk(), MapblockMeshGenerator::drawNodeboxNode(), MinimapUpdateThread::getMap(), GridNodeContainer::initNode(), Environment::line_of_sight(), NodeDefManager::nodeboxConnects(), treegen::TreeDef::resolveNodeNames(), Server::sendAddNode(), serialize(), ParticleParameters::serialize(), serializeBulk(), and Pathfinder::walkDownwards().
u8 MapNode::param1 |
Referenced by RollbackNode::RollbackNode(), Schematic::applyProbabilities(), Schematic::blitToVManip(), deSerialize(), deSerialize_pre22(), deSerializeBulk(), Schematic::deserializeFromMts(), ServerEnvironment::findSunlight(), Schematic::getSchematicFromMap(), ModApiEnv::l_get_natural_light(), ModApiMapgen::l_read_schematic(), LuaVoxelManip::l_set_light_data(), Mapgen::lightSpread(), Mapgen::propagateSunlight(), Server::sendAddNode(), serialize(), serializeBulk(), Schematic::serializeToLua(), Mapgen::setLighting(), and Mapgen::spreadLight().
u8 MapNode::param2 |
Referenced by RollbackNode::RollbackNode(), deSerialize(), ParticleParameters::deSerialize(), deSerialize_pre22(), deSerializeBulk(), MapblockMeshGenerator::drawNodeboxNode(), get_max_liquid_level(), getColor(), MapblockMeshGenerator::getLiquidNeighborhood(), ModApiMapgen::l_read_schematic(), LuaVoxelManip::l_set_param2_data(), NodeDefManager::nodeboxConnects(), VoxelManipulator::print(), rotateAlongYAxis(), Server::sendAddNode(), serialize(), ParticleParameters::serialize(), serializeBulk(), Schematic::serializeToLua(), and ServerMap::transformLiquids().