Minetest  5.4.0
Schematic Class Reference

#include <mg_schematic.h>

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

Public Member Functions

 Schematic ()
 
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, std::vector< std::string > *names)
 
bool serializeToMts (std::ostream *os, const std::vector< std::string > &names) const
 
bool serializeToLua (std::ostream *os, const std::vector< std::string > &names, 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)
 
void nodeResolveInternal ()
 

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
u32 m_nodenames_idx = 0
 
u32 m_nnlistsizes_idx = 0
 
std::vector< std::string > m_nodenames
 
std::vector< size_t > m_nnlistsizes
 
const NodeDefManagerm_ndef = nullptr
 
bool m_resolve_done = false
 

Additional Inherited Members

- Protected Member Functions inherited from ObjDef
void cloneTo (ObjDef *def) const
 

Constructor & Destructor Documentation

◆ Schematic()

Schematic::Schematic ( )
default

Referenced by clone().

+ Here is the caller graph for this function:

◆ ~Schematic()

Schematic::~Schematic ( )
virtual

References schemdata, and slice_probs.

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

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

◆ deserializeFromMts()

bool Schematic::deserializeFromMts ( std::istream *  is,
std::vector< std::string > *  names 
)

References CONTENT_IGNORE, MapNode::deSerializeBulk(), deSerializeString16(), errorstream, MTSCHEM_FILE_SIGNATURE, MTSCHEM_FILE_VER_HIGHEST_READ, MTSCHEM_PROB_ALWAYS_OLD, MTSCHEM_PROB_NEVER, ObjDef::name, MapNode::param1, readU16(), readU32(), readU8(), readV3S16(), schemdata, SER_FMT_VER_HIGHEST_READ, 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, 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(), errorstream, NodeResolver::m_nnlistsizes, NodeResolver::m_nodenames, ObjDef::name, 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, MapNode::getContent(), NodeResolver::getIdsFromNrBacklog(), 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 generate_nodelist_and_update_ids(), NodeResolver::m_ndef, NodeResolver::m_nodenames, NodeResolver::m_resolve_done, fs::safeWriteToFile(), schemdata, serializeToMts(), and size.

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,
const std::vector< std::string > &  names,
bool  use_comments,
u32  indent_spaces 
) const

References MapNode::getContent(), MTSCHEM_FORCE_PLACE, MTSCHEM_PROB_MASK, 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 std::vector< std::string > &  names 
) const

References MTSCHEM_FILE_SIGNATURE, MTSCHEM_FILE_VER_HIGHEST_WRITE, schemdata, SER_FMT_VER_HIGHEST_WRITE, 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: