Minetest 5.10.0-dev
 
Loading...
Searching...
No Matches
Schematic Class Reference

#include <mg_schematic.h>

+ Inheritance diagram for Schematic:
+ Collaboration diagram for Schematic:

Public Member Functions

 Schematic ()=default
 
virtual ~Schematic ()
 
ObjDefclone () const
 
virtual void resolveNodeNames ()
 
bool loadSchematicFromFile (const std::string &filename, const NodeDefManager *ndef, StringMap *replace_names=NULL)
 
bool saveSchematicToFile (const std::string &filename, const NodeDefManager *ndef)
 
bool getSchematicFromMap (Map *map, v3s16 p1, v3s16 p2)
 
bool deserializeFromMts (std::istream *is)
 
bool serializeToMts (std::ostream *os) const
 
bool serializeToLua (std::ostream *os, bool use_comments, u32 indent_spaces) const
 
void blitToVManip (MMVManip *vm, v3s16 p, Rotation rot, bool force_place)
 
bool placeOnVManip (MMVManip *vm, v3s16 p, u32 flags, Rotation rot, bool force_place)
 
void placeOnMap (ServerMap *map, v3s16 p, u32 flags, Rotation rot, bool force_place)
 
void applyProbabilities (v3s16 p0, std::vector< std::pair< v3s16, u8 > > *plist, std::vector< std::pair< s16, u8 > > *splist)
 
- Public Member Functions inherited from ObjDef
virtual ~ObjDef ()=default
 
- Public Member Functions inherited from NodeResolver
 NodeResolver ()
 
virtual ~NodeResolver ()
 
void cloneTo (NodeResolver *res) const
 
bool getIdFromNrBacklog (content_t *result_out, const std::string &node_alt, content_t c_fallback, bool error_on_fallback=true)
 
bool getIdsFromNrBacklog (std::vector< content_t > *result_out, bool all_required=false, content_t c_fallback=CONTENT_IGNORE)
 
bool isResolveDone () const
 
void reset (bool resolve_done=false)
 

Public Attributes

std::vector< content_tc_nodes
 
u32 flags = 0
 
v3s16 size
 
MapNodeschemdata = nullptr
 
u8 * slice_probs = nullptr
 
- Public Attributes inherited from ObjDef
u32 index
 
u32 uid
 
ObjDefHandle handle
 
std::string name
 
- Public Attributes inherited from NodeResolver
std::vector< std::string > m_nodenames
 
std::vector< size_t > m_nnlistsizes
 

Private Member Functions

void condenseContentIds ()
 

Additional Inherited Members

- Protected Member Functions inherited from ObjDef
void cloneTo (ObjDef *def) const
 
- Protected Attributes inherited from NodeResolver
const NodeDefManagerm_ndef = nullptr
 
u32 m_nodenames_idx = 0
 

Constructor & Destructor Documentation

◆ Schematic()

Schematic::Schematic ( )
default

Referenced by clone().

+ Here is the caller graph for this function:

◆ ~Schematic()

Schematic::~Schematic ( )
virtual

References schemdata, size, slice_probs, and porting::TrackFreedMemory().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyProbabilities()

void Schematic::applyProbabilities ( v3s16 p0,
std::vector< std::pair< v3s16, u8 > > * plist,
std::vector< std::pair< s16, u8 > > * splist )

References CONTENT_AIR, ObjDef::index, MTSCHEM_PROB_NEVER, p(), MapNode::param1, schemdata, MapNode::setContent(), size, and slice_probs.

Referenced by ModApiMapgen::l_create_schematic().

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

◆ blitToVManip()

void Schematic::blitToVManip ( MMVManip * vm,
v3s16 p,
Rotation rot,
bool force_place )

References VoxelArea::contains(), CONTENT_AIR, CONTENT_IGNORE, MapNode::getContent(), VoxelArea::index(), VoxelManipulator::m_area, VoxelManipulator::m_data, NodeResolver::m_ndef, MTSCHEM_FORCE_PLACE, MTSCHEM_PROB_ALWAYS, MTSCHEM_PROB_MASK, MTSCHEM_PROB_NEVER, myrand_range(), p(), MapNode::param1, ROTATE_180, ROTATE_270, ROTATE_90, MapNode::rotateAlongYAxis(), sanity_check, schemdata, size, slice_probs, and SWAP.

Referenced by DecoSchematic::generate(), placeOnMap(), and placeOnVManip().

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

◆ clone()

ObjDef * Schematic::clone ( ) const
virtual

Implements ObjDef.

References Schematic(), c_nodes, NodeResolver::cloneTo(), ObjDef::cloneTo(), FATAL_ERROR_IF, flags, schemdata, size, and slice_probs.

Referenced by DecoSchematic::clone(), and saveSchematicToFile().

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

◆ condenseContentIds()

void Schematic::condenseContentIds ( )
private

References NodeDefManager::get(), MapNode::getContent(), NodeResolver::m_ndef, NodeResolver::m_nodenames, ContentFeatures::name, NodeResolver::reset(), schemdata, MapNode::setContent(), and size.

Referenced by saveSchematicToFile().

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

◆ deserializeFromMts()

bool Schematic::deserializeFromMts ( std::istream * is)

References CONTENT_IGNORE, decompress(), MapNode::deSerializeBulk(), deSerializeString16(), errorstream, NodeResolver::m_nnlistsizes, NodeResolver::m_nodenames, MTSCHEM_FILE_SIGNATURE, MTSCHEM_FILE_VER_HIGHEST_READ, MTSCHEM_MAPNODE_SER_FMT_VER, MTSCHEM_PROB_ALWAYS_OLD, MTSCHEM_PROB_NEVER, ObjDef::name, MapNode::param1, readU16(), readU32(), readU8(), readV3S16(), NodeResolver::reset(), schemdata, size, and slice_probs.

Referenced by loadSchematicFromFile(), and TestSchematic::testMtsSerializeDeserialize().

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

◆ getSchematicFromMap()

bool Schematic::getSchematicFromMap ( Map * map,
v3s16 p1,
v3s16 p2 )

References getNodeBlockPos(), VoxelArea::index(), MMVManip::initialEmerge(), VoxelManipulator::m_area, VoxelManipulator::m_data, MTSCHEM_PROB_ALWAYS, MapNode::param1, NodeResolver::reset(), schemdata, size, and slice_probs.

Referenced by ModApiMapgen::l_create_schematic().

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

◆ loadSchematicFromFile()

bool Schematic::loadSchematicFromFile ( const std::string & filename,
const NodeDefManager * ndef,
StringMap * replace_names = NULL )

References deserializeFromMts(), NodeResolver::m_ndef, NodeResolver::m_nodenames, ObjDef::name, open_ifstream(), and NodeDefManager::pendNodeResolve().

Referenced by load_schematic(), and TestSchematic::testFileSerializeDeserialize().

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

◆ placeOnMap()

void Schematic::placeOnMap ( ServerMap * map,
v3s16 p,
u32 flags,
Rotation rot,
bool force_place )

References voxalgo::blit_back_with_light(), blitToVManip(), DECO_PLACE_CENTER_X, DECO_PLACE_CENTER_Y, DECO_PLACE_CENTER_Z, Map::dispatchEvent(), flags, getNodeBlockPos(), MMVManip::initialEmerge(), NodeResolver::m_ndef, MEET_OTHER, myrand_range(), p(), ROTATE_0, ROTATE_270, ROTATE_90, ROTATE_RAND, sanity_check, schemdata, size, and MapEditEvent::type.

Referenced by ModApiMapgen::l_place_schematic().

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

◆ placeOnVManip()

bool Schematic::placeOnVManip ( MMVManip * vm,
v3s16 p,
u32 flags,
Rotation rot,
bool force_place )

References blitToVManip(), VoxelArea::contains(), DECO_PLACE_CENTER_X, DECO_PLACE_CENTER_Y, DECO_PLACE_CENTER_Z, flags, VoxelManipulator::m_area, NodeResolver::m_ndef, myrand_range(), p(), ROTATE_0, ROTATE_270, ROTATE_90, ROTATE_RAND, sanity_check, schemdata, size, and slice_probs.

Referenced by ModApiMapgen::l_place_schematic_on_vmanip().

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

◆ resolveNodeNames()

void Schematic::resolveNodeNames ( )
virtual

Implements NodeResolver.

References c_nodes, CONTENT_AIR, errorstream, MapNode::getContent(), NodeResolver::getIdsFromNrBacklog(), ObjDef::name, schemdata, MapNode::setContent(), and size.

+ Here is the call graph for this function:

◆ saveSchematicToFile()

bool Schematic::saveSchematicToFile ( const std::string & filename,
const NodeDefManager * ndef )

References clone(), condenseContentIds(), NodeResolver::isResolveDone(), NodeResolver::m_ndef, fs::safeWriteToFile(), and serializeToMts().

Referenced by ModApiMapgen::l_create_schematic(), and TestSchematic::testFileSerializeDeserialize().

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

◆ serializeToLua()

bool Schematic::serializeToLua ( std::ostream * os,
bool use_comments,
u32 indent_spaces ) const

References FATAL_ERROR_IF, NodeDefManager::get(), MapNode::getContent(), NodeResolver::isResolveDone(), NodeResolver::m_ndef, NodeResolver::m_nodenames, MTSCHEM_FORCE_PLACE, MTSCHEM_PROB_MASK, ContentFeatures::name, MapNode::param1, MapNode::param2, schemdata, size, and slice_probs.

Referenced by ModApiMapgen::l_serialize_schematic(), and TestSchematic::testLuaTableSerialize().

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

◆ serializeToMts()

bool Schematic::serializeToMts ( std::ostream * os) const

References compress(), NodeResolver::m_nodenames, MTSCHEM_FILE_SIGNATURE, MTSCHEM_FILE_VER_HIGHEST_WRITE, MTSCHEM_MAPNODE_SER_FMT_VER, schemdata, MapNode::serializeBulk(), serializeString16(), size, slice_probs, writeU16(), writeU32(), writeU8(), and writeV3S16().

Referenced by ModApiMapgen::l_serialize_schematic(), saveSchematicToFile(), and TestSchematic::testMtsSerializeDeserialize().

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

Member Data Documentation

◆ c_nodes

std::vector<content_t> Schematic::c_nodes

Referenced by clone(), and resolveNodeNames().

◆ flags

◆ schemdata

◆ size

◆ slice_probs


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