Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
MapNode Struct Reference

#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)
 

Constructor & Destructor Documentation

◆ MapNode() [1/2]

MapNode::MapNode ( )
default

◆ MapNode() [2/2]

MapNode::MapNode ( content_t content,
u8 a_param1 = 0,
u8 a_param2 = 0 )
inlinenoexcept

Member Function Documentation

◆ addLevel()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deSerialize()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deSerialize_pre22()

void MapNode::deSerialize_pre22 ( const u8 * source,
u8 version )
private

References CONTENT_AIR, CONTENT_IGNORE, mapnode_translate_to_internal(), param0, param1, and param2.

Referenced by deSerialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deSerializeBulk()

void MapNode::deSerializeBulk ( std::istream & is,
int version,
MapNode * nodes,
u32 nodecount,
u8 content_width,
u8 params_width )
static

References FATAL_ERROR, param0, param1, param2, readU16(), readU8(), and ser_ver_supported().

Referenced by MapBlock::deSerialize(), and Schematic::deserializeFromMts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCollisionBoxes()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColor()

void MapNode::getColor ( const ContentFeatures & f,
video::SColor * color ) const

Returns the color of the node.

Parameters
fcontent features of this node
coloroutput, contains the node's color.

References ContentFeatures::color, ContentFeatures::palette, and param2.

Referenced by Minimap::blitMinimapPixelsToImageSurface(), ParticleManager::getNodeParticleParams(), and getNodeTileN().

+ Here is the caller graph for this function:

◆ getContent()

content_t MapNode::getContent ( ) const
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().

◆ getDegRotate()

u8 MapNode::getDegRotate ( const NodeDefManager * nodemgr) const
Returns
Rotation in range 0–239 (in 1.5° steps)

References CPT2_COLORED_DEGROTATE, CPT2_DEGROTATE, NodeDefManager::get(), getParam2(), and ContentFeatures::param_type_2.

+ Here is the call graph for this function:

◆ getFaceDir()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLevel()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLight()

◆ getLightBlend()

u8 MapNode::getLightBlend ( u32 daylight_factor,
ContentLightingFlags f ) const
inline

References blend_light(), LIGHTBANK_DAY, and LIGHTBANK_NIGHT.

Referenced by SmokePuffCSO::SmokePuffCSO(), ClientMap::getBackgroundBrightness(), getVisibleBrightness(), ModApiEnv::l_get_node_light(), and Particle::updateLight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLightRaw()

u8 MapNode::getLightRaw ( LightBank bank,
ContentLightingFlags f ) const
inlinenoexcept

Returns the node's light level from param1. If the node emits light, it is ignored.

Parameters
fthe ContentLightingFlags of this node.

References LIGHTBANK_DAY.

Referenced by Map::addNodeAndUpdate(), voxalgo::propagate_block_sunlight(), voxalgo::spread_light(), and voxalgo::unspread_light().

+ Here is the caller graph for this function:

◆ getMaxLevel()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNeighbors()

u8 MapNode::getNeighbors ( v3s16 p,
Map * map ) const

Checks which neighbors does this node connect to.

Parameters
pcoordinates 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeBoxes()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParam1()

u8 MapNode::getParam1 ( ) const
inlinenoexcept

Referenced by MapBlock::deSerialize_pre22(), LuaVoxelManip::l_get_light_data(), ModApiEnv::l_get_node_raw(), pushnode(), and TestVoxelAlgorithms::testLighting().

+ Here is the caller graph for this function:

◆ getParam2()

u8 MapNode::getParam2 ( ) const
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().

+ Here is the caller graph for this function:

◆ getSelectionBoxes()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWallMounted()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWallMountedDir()

v3s16 MapNode::getWallMountedDir ( const NodeDefManager * nodemgr) const

References getWallMounted().

Referenced by Game::nodePlacement(), and transformNodeBox().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLightDayNightEq()

bool MapNode::isLightDayNightEq ( ContentLightingFlags f) const
inlinenoexcept

Check if the light value for night differs from the light value for day.

Returns
If the light values are equal, returns true; otherwise false

References LIGHTBANK_DAY, and LIGHTBANK_NIGHT.

◆ operator==()

bool MapNode::operator== ( const MapNode & other) const
inlinenoexcept

◆ rotateAlongYAxis()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

void MapNode::serialize ( u8 * dest,
u8 version ) const

References param0, param1, param2, ser_ver_supported(), writeU16(), and writeU8().

+ Here is the call graph for this function:

◆ serializeBulk()

Buffer< u8 > MapNode::serializeBulk ( int version,
const MapNode * nodes,
u32 nodecount,
u8 content_width,
u8 params_width )
static

References p(), param0, param1, param2, sanity_check, ser_ver_supported(), writeU16(), and writeU8().

Referenced by MapBlock::serialize(), and Schematic::serializeToMts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializedLength()

u32 MapNode::serializedLength ( u8 version)
static

References ser_ver_supported().

Referenced by MapBlock::deSerialize_pre22(), and Client::handleCommand_AddNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContent()

◆ setLevel()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLight()

void MapNode::setLight ( LightBank bank,
u8 a_light,
ContentLightingFlags f )
inlinenoexcept

◆ setParam1()

void MapNode::setParam1 ( u8 p)
inlinenoexcept

References p().

Referenced by MapBlock::deSerialize_pre22().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParam2()

void MapNode::setParam2 ( u8 p)
inlinenoexcept

References p().

Referenced by createSpecialNodeMesh(), MapBlock::deSerialize_pre22(), getItemMesh(), Game::nodePlacement(), WieldMeshSceneNode::setItem(), and setLevel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ param0

◆ param1

◆ param2


The documentation for this struct was generated from the following files: