aboutsummaryrefslogtreecommitdiff
path: root/src/nodedef.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nodedef.h')
-rw-r--r--src/nodedef.h74
1 files changed, 47 insertions, 27 deletions
diff --git a/src/nodedef.h b/src/nodedef.h
index a4a7b6e41..58d0faffa 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -63,6 +63,8 @@ enum ContentParamType2
CPT2_WALLMOUNTED,
// Block level like FLOWINGLIQUID
CPT2_LEVELED,
+ // 2D rotation for things like plants
+ CPT2_DEGROTATE,
};
enum LiquidType
@@ -78,6 +80,7 @@ enum NodeBoxType
NODEBOX_FIXED, // Static separately defined box(es)
NODEBOX_WALLMOUNTED, // Box for wall mounted nodes; (top, bottom, side)
NODEBOX_LEVELED, // Same as fixed, but with dynamic height from param2. for snow, ...
+ NODEBOX_CONNECTED, // optionally draws nodeboxes if a neighbor node attaches
};
struct NodeBox
@@ -90,6 +93,13 @@ struct NodeBox
aabb3f wall_top;
aabb3f wall_bottom;
aabb3f wall_side; // being at the -X side
+ // NODEBOX_CONNECTED
+ std::vector<aabb3f> connect_top;
+ std::vector<aabb3f> connect_bottom;
+ std::vector<aabb3f> connect_front;
+ std::vector<aabb3f> connect_left;
+ std::vector<aabb3f> connect_back;
+ std::vector<aabb3f> connect_right;
NodeBox()
{ reset(); }
@@ -102,6 +112,30 @@ struct NodeBox
struct MapNode;
class NodeMetadata;
+enum NodeDrawType
+{
+ NDT_NORMAL, // A basic solid block
+ NDT_AIRLIKE, // Nothing is drawn
+ NDT_LIQUID, // Do not draw face towards same kind of flowing/source liquid
+ NDT_FLOWINGLIQUID, // A very special kind of thing
+ NDT_GLASSLIKE, // Glass-like, don't draw faces towards other glass
+ NDT_ALLFACES, // Leaves-like, draw all faces no matter what
+ NDT_ALLFACES_OPTIONAL, // Fancy -> allfaces, fast -> normal
+ NDT_TORCHLIKE,
+ NDT_SIGNLIKE,
+ NDT_PLANTLIKE,
+ NDT_FENCELIKE,
+ NDT_RAILLIKE,
+ NDT_NODEBOX,
+ NDT_GLASSLIKE_FRAMED, // Glass-like, draw connected frames and all all
+ // visible faces
+ // uses 2 textures, one for frames, second for faces
+ NDT_FIRELIKE, // Draw faces slightly rotated and only on connecting nodes,
+ NDT_GLASSLIKE_FRAMED_OPTIONAL, // enabled -> connected, disabled -> Glass-like
+ // uses 2 textures, one for frames, second for faces
+ NDT_MESH, // Uses static meshes
+};
+
/*
Stand-alone definition of a TileSpec (basically a server-side TileSpec)
*/
@@ -135,31 +169,7 @@ struct TileDef
}
void serialize(std::ostream &os, u16 protocol_version) const;
- void deSerialize(std::istream &is);
-};
-
-enum NodeDrawType
-{
- NDT_NORMAL, // A basic solid block
- NDT_AIRLIKE, // Nothing is drawn
- NDT_LIQUID, // Do not draw face towards same kind of flowing/source liquid
- NDT_FLOWINGLIQUID, // A very special kind of thing
- NDT_GLASSLIKE, // Glass-like, don't draw faces towards other glass
- NDT_ALLFACES, // Leaves-like, draw all faces no matter what
- NDT_ALLFACES_OPTIONAL, // Fancy -> allfaces, fast -> normal
- NDT_TORCHLIKE,
- NDT_SIGNLIKE,
- NDT_PLANTLIKE,
- NDT_FENCELIKE,
- NDT_RAILLIKE,
- NDT_NODEBOX,
- NDT_GLASSLIKE_FRAMED, // Glass-like, draw connected frames and all all
- // visible faces
- // uses 2 textures, one for frames, second for faces
- NDT_FIRELIKE, // Draw faces slightly rotated and only on connecting nodes,
- NDT_GLASSLIKE_FRAMED_OPTIONAL, // enabled -> connected, disabled -> Glass-like
- // uses 2 textures, one for frames, second for faces
- NDT_MESH, // Uses static meshes
+ void deSerialize(std::istream &is, const u8 contentfeatures_version, const NodeDrawType drawtype);
};
#define CF_SPECIAL_COUNT 6
@@ -227,6 +237,8 @@ struct ContentFeatures
bool climbable;
// Player can build on these
bool buildable_to;
+ // Liquids flow into and replace node
+ bool floodable;
// Player cannot build to these (placement prediction disabled)
bool rightclickable;
// Flowing liquid or snow, value = default level
@@ -259,12 +271,17 @@ struct ContentFeatures
bool legacy_facedir_simple;
// Set to true if wall_mounted used to be set to true
bool legacy_wallmounted;
+ // for NDT_CONNECTED pairing
+ u8 connect_sides;
// Sound properties
SimpleSoundSpec sound_footstep;
SimpleSoundSpec sound_dig;
SimpleSoundSpec sound_dug;
+ std::vector<std::string> connects_to;
+ std::set<content_t> connects_to_ids;
+
/*
Methods
*/
@@ -299,7 +316,8 @@ public:
virtual bool getId(const std::string &name, content_t &result) const=0;
virtual content_t getId(const std::string &name) const=0;
// Allows "group:name" in addition to regular node names
- virtual void getIds(const std::string &name, std::set<content_t> &result)
+ // returns false if node name not found, true otherwise
+ virtual bool getIds(const std::string &name, std::set<content_t> &result)
const=0;
virtual const ContentFeatures &get(const std::string &name) const=0;
@@ -309,6 +327,7 @@ public:
virtual void pendNodeResolve(NodeResolver *nr)=0;
virtual bool cancelNodeResolveCallback(NodeResolver *nr)=0;
+ virtual bool nodeboxConnects(const MapNode from, const MapNode to, u8 connect_face)=0;
};
class IWritableNodeDefManager : public INodeDefManager {
@@ -323,7 +342,7 @@ public:
// If not found, returns CONTENT_IGNORE
virtual content_t getId(const std::string &name) const=0;
// Allows "group:name" in addition to regular node names
- virtual void getIds(const std::string &name, std::set<content_t> &result)
+ virtual bool getIds(const std::string &name, std::set<content_t> &result)
const=0;
// If not found, returns the features of CONTENT_UNKNOWN
virtual const ContentFeatures &get(const std::string &name) const=0;
@@ -363,6 +382,7 @@ public:
virtual bool cancelNodeResolveCallback(NodeResolver *nr)=0;
virtual void runNodeResolveCallbacks()=0;
virtual void resetNodeResolveState()=0;
+ virtual void mapNodeboxConnections()=0;
};
IWritableNodeDefManager *createNodeDefManager();