]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/nodedef.h
Only draw tracers to objects that are not attached (that fixes tracers to armor)
[dragonfireclient.git] / src / nodedef.h
index 60d91f8d99b689f921ae840f66b6cca66a8ae120..cf03abaae8b493b552d0875973f6de97888cb4f9 100644 (file)
@@ -33,6 +33,7 @@ class Client;
 #include "itemgroup.h"
 #include "sound.h" // SimpleSoundSpec
 #include "constants.h" // BS
+#include "texture_override.h" // TextureOverride
 #include "tileanimation.h"
 
 // PROTOCOL_VERSION >= 37
@@ -325,8 +326,10 @@ struct ContentFeatures
        std::vector<content_t> connects_to_ids;
        // Post effect color, drawn when the camera is inside the node.
        video::SColor post_effect_color;
-       // Flowing liquid or snow, value = default level
+       // Flowing liquid or leveled nodebox, value = default level
        u8 leveled;
+       // Maximum value for leveled nodes
+       u8 leveled_max;
 
        // --- LIGHTING-RELATED ---
 
@@ -365,8 +368,10 @@ struct ContentFeatures
        enum LiquidType liquid_type;
        // If the content is liquid, this is the flowing version of the liquid.
        std::string liquid_alternative_flowing;
+       content_t liquid_alternative_flowing_id;
        // If the content is liquid, this is the source version of the liquid.
        std::string liquid_alternative_source;
+       content_t liquid_alternative_source_id;
        // Viscosity for fluid flow, ranging from 1 to 7, with
        // 1 giving almost instantaneous propagation and 7 being
        // the slowest possible
@@ -404,7 +409,7 @@ struct ContentFeatures
        */
 
        ContentFeatures();
-       ~ContentFeatures() = default;
+       ~ContentFeatures();
        void reset();
        void serialize(std::ostream &os, u16 protocol_version) const;
        void deSerialize(std::istream &is);
@@ -425,7 +430,7 @@ struct ContentFeatures
        }
        bool sameLiquid(const ContentFeatures &f) const{
                if(!isLiquid() || !f.isLiquid()) return false;
-               return (liquid_alternative_flowing == f.liquid_alternative_flowing);
+               return (liquid_alternative_flowing_id == f.liquid_alternative_flowing_id);
        }
 
        int getGroup(const std::string &group) const
@@ -583,15 +588,12 @@ class NodeDefManager {
        void updateAliases(IItemDefManager *idef);
 
        /*!
-        * Reads the used texture pack's override.txt, and replaces the textures
-        * of registered nodes with the ones specified there.
+        * Replaces the textures of registered nodes with the ones specified in
+        * the texturepack's override.txt file
         *
-        * Format of the input file: in each line
-        * `node_name top|bottom|right|left|front|back|all|*|sides texture_name.png`
-        *
-        * @param override_filepath path to 'texturepack/override.txt'
+        * @param overrides the texture overrides
         */
-       void applyTextureOverrides(const std::string &override_filepath);
+       void applyTextureOverrides(const std::vector<TextureOverride> &overrides);
 
        /*!
         * Only the client uses this. Loads textures and shaders required for
@@ -641,10 +643,11 @@ class NodeDefManager {
        void resetNodeResolveState();
 
        /*!
-        * Resolves the IDs to which connecting nodes connect from names.
+        * Resolves (caches the IDs) cross-references between nodes,
+        * like liquid alternatives.
         * Must be called after node registration has finished!
         */
-       void mapNodeboxConnections();
+       void resolveCrossrefs();
 
 private:
        /*!
@@ -668,6 +671,14 @@ class NodeDefManager {
         */
        void addNameIdMapping(content_t i, std::string name);
 
+       /*!
+        * Removes a content ID from all groups.
+        * Erases content IDs from vectors in \ref m_group_to_items and
+        * removes empty vectors.
+        * @param id Content ID
+        */
+       void eraseIdFromGroups(content_t id);
+
        /*!
         * Recalculates m_selection_box_int_union based on
         * m_selection_box_union.
@@ -733,6 +744,9 @@ class NodeResolver {
        virtual ~NodeResolver();
        virtual void resolveNodeNames() = 0;
 
+       // required because this class is used as mixin for ObjDef
+       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);