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

#include <mapnode.h>

Public Member Functions

 MapNode ()=default
constexpr MapNode (content_t content, u8 a_param1=0, u8 a_param2=0) noexcept
bool operator== (const MapNode &other) const 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 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 (const 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, bool is_mono_block=false)
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

Referenced by deSerializeBulk(), operator!=(), operator==(), and serializeBulk().

Here is the caller graph for this function:

◆ MapNode() [2/2]

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

References param0, param1, and param2.

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 ( const u8 * source,
u8 version )

References deSerialize_pre22(), param0, param1, param2, readU16(), readU8(), and ser_ver_supported_read().

Referenced by 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 MapNode(), param0, param1, param2, readU16(), readU8(), and ser_ver_supported_read().

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:

◆ getContent()

content_t MapNode::getContent ( ) const
inlinenoexcept

References param0.

Referenced by MapBlock::actuallyUpdateIsAir(), add_area_node_boxes(), Map::addNodeAndUpdate(), ServerMap::addNodeAndUpdate(), analyze_block(), ABMHandler::apply(), LBMManager::applyLBMs(), Schematic::blitToVManip(), Decoration::canPlaceDecoration(), MapBlock::correctBlockNodeIds(), MapblockMeshGenerator::drawFirelikeNode(), MapblockMeshGenerator::drawGlasslikeFramedNode(), MapblockMeshGenerator::drawGlasslikeNode(), MapblockMeshGenerator::drawSolidNode(), voxalgo::fill_with_sunlight(), voxalgo::fill_with_sunlight(), ModApiEnvBase::findNodesInArea(), Server::findSpawnPos(), MapgenV6::flowMud(), DecoSimple::generate(), OreBlob::generate(), OrePuff::generate(), OreScatter::generate(), OreSheet::generate(), OreStratum::generate(), OreVein::generate(), CavernsNoise::generateCaverns(), CavesNoiseIntersection::generateCaves(), NodeDefManager::get(), MapBlock::getBlockNodeIdMapping(), NodeDefManager::getLightingFlags(), MapblockMeshGenerator::getLiquidNeighborhood(), getSmoothLightCombined(), getVisibleBrightness(), MapgenV6::growGrass(), LocalPlayer::handleAutojump(), Server::handleCommand_Interact(), voxalgo::is_sunlight_above(), ReflowScan::isLiquidFlowableTo(), MapblockMeshGenerator::isSameRail(), ModApiEnv::l_dig_node(), 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(), mapnode_translate_to_internal(), LocalPlayer::move(), 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(), MapblockMeshGenerator::prepareLiquidNodeDrawing(), VoxelManipulator::print(), pushnode(), readNodes(), ReflowScan::scanColumn(), set_node_in_block(), Mapgen::spreadLight(), PlayerSAO::step(), TestVoxelManipulator::testEmerge(), TestMap::testForEachNodeInArea(), TestMapNode::testNodeProperties(), ServerMap::transformLiquidsLocal(), treegen::tree_fruit_placement(), treegen::tree_leaves_placement(), treegen::tree_single_leaves_placement(), treegen::tree_trunk_placement(), MapBlock::tryShrinkNodes(), voxalgo::unspread_light(), GameUI::update(), ClientMap::updateDrawList(), 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()

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

References getLightRaw(), and MYMAX.

Referenced by voxalgo::blit_back_with_light(), voxalgo::finish_bulk_light_update(), getFaceLight(), getInteriorLight(), getLightBlend(), getSmoothLightCombined(), getVisibleBrightness(), voxalgo::is_light_locally_correct(), voxalgo::is_sunlight_above(), voxalgo::is_sunlight_above_block(), isLightDayNightEq(), VoxelManipulator::print(), voxalgo::repair_block_light(), TestVoxelAlgorithms::testLighting(), TestMapNode::testNodeProperties(), voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().

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

◆ getLightBlend()

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

References blend_light(), getLight(), 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, and param1.

Referenced by Map::addNodeAndUpdate(), getLight(), 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 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

References param1.

Referenced by ModApiEnv::l_get_node_raw(), pushnode(), and TestVoxelAlgorithms::testLighting().

Here is the caller graph for this function:

◆ getParam2()

u8 MapNode::getParam2 ( ) const
inlinenoexcept

References param2.

Referenced by createGenericNodeMesh(), getDegRotate(), getFaceDir(), getLevel(), getWallMounted(), ModApiEnv::l_get_node_raw(), 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 getLight(), LIGHTBANK_DAY, and LIGHTBANK_NIGHT.

Here is the call graph for this function:

◆ operator!=()

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

References MapNode().

Here is the call graph for this function:

◆ operator==()

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

References MapNode(), param0, param1, and param2.

Here is the call graph for this function:

◆ 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_write(), 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,
bool is_mono_block = false )
static

References MapNode(), p(), param0, param1, param2, sanity_check, ser_ver_supported_write(), 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_read().

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

void MapNode::setContent ( content_t c)
inlinenoexcept

References param0.

Referenced by MapBlock::correctBlockNodeIds(), MapgenV6::flowMud(), MapBlock::getBlockNodeIdMapping(), mapnode_translate_to_internal(), setLevel(), TestMapNode::testNodeProperties(), and ServerMap::transformLiquidsLocal().

Here is the caller graph for this function:

◆ 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(), and param1.

Referenced by createGenericNodeMesh(), and generateNodeMesh().

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(), and param2.

Referenced by createGenericNodeMesh(), createItemMesh(), 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: