]> git.lizzy.rs Git - minetest.git/blobdiff - src/object_properties.cpp
VoxelArea: add_{x,y,z,p} must be static
[minetest.git] / src / object_properties.cpp
index cf23e34332cd337af9b9d733021fe7d499fc97f9..e330bc24a0dffb8ac75a7614a8c063aef2c8d32b 100644 (file)
@@ -33,42 +33,47 @@ ObjectProperties::ObjectProperties()
 std::string ObjectProperties::dump()
 {
        std::ostringstream os(std::ios::binary);
-       os<<"hp_max="<<hp_max;
-       os<<", physical="<<physical;
-       os<<", collideWithObjects="<<collideWithObjects;
-       os<<", weight="<<weight;
-       os<<", collisionbox="<<PP(collisionbox.MinEdge)<<","<<PP(collisionbox.MaxEdge);
-       os<<", visual="<<visual;
-       os<<", mesh="<<mesh;
-       os<<", visual_size="<<PP2(visual_size);
-       os<<", textures=[";
+       os << "hp_max=" << hp_max;
+       os << ", breath_max=" << breath_max;
+       os << ", physical=" << physical;
+       os << ", collideWithObjects=" << collideWithObjects;
+       os << ", weight=" << weight;
+       os << ", collisionbox=" << PP(collisionbox.MinEdge) << "," << PP(collisionbox.MaxEdge);
+       os << ", visual=" << visual;
+       os << ", mesh=" << mesh;
+       os << ", visual_size=" << PP2(visual_size);
+       os << ", textures=[";
        for (const std::string &texture : textures) {
-               os<<"\""<< texture <<"\" ";
+               os << "\"" << texture << "\" ";
        }
-       os<<"]";
-       os<<", colors=[";
+       os << "]";
+       os << ", colors=[";
        for (const video::SColor &color : colors) {
                os << "\"" << color.getAlpha() << "," << color.getRed() << ","
                        << color.getGreen() << "," << color.getBlue() << "\" ";
        }
-       os<<"]";
-       os<<", spritediv="<<PP2(spritediv);
-       os<<", initial_sprite_basepos="<<PP2(initial_sprite_basepos);
-       os<<", is_visible="<<is_visible;
-       os<<", makes_footstep_sound="<<makes_footstep_sound;
-       os<<", automatic_rotate="<<automatic_rotate;
-       os<<", backface_culling="<<backface_culling;
+       os << "]";
+       os << ", spritediv=" << PP2(spritediv);
+       os << ", initial_sprite_basepos=" << PP2(initial_sprite_basepos);
+       os << ", is_visible=" << is_visible;
+       os << ", makes_footstep_sound=" << makes_footstep_sound;
+       os << ", automatic_rotate="<< automatic_rotate;
+       os << ", backface_culling="<< backface_culling;
+       os << ", glow=" << glow;
        os << ", nametag=" << nametag;
        os << ", nametag_color=" << "\"" << nametag_color.getAlpha() << "," << nametag_color.getRed()
                        << "," << nametag_color.getGreen() << "," << nametag_color.getBlue() << "\" ";
        os << ", selectionbox=" << PP(selectionbox.MinEdge) << "," << PP(selectionbox.MaxEdge);
        os << ", pointable=" << pointable;
+       os << ", static_save=" << static_save;
+       os << ", eye_height=" << eye_height;
+       os << ", zoom_fov=" << zoom_fov;
        return os.str();
 }
 
 void ObjectProperties::serialize(std::ostream &os) const
 {
-       writeU8(os, 2); // version, protocol_version >= 36
+       writeU8(os, 3); // version, protocol_version >= 36
        writeS16(os, hp_max);
        writeU8(os, physical);
        writeF1000(os, weight);
@@ -95,7 +100,7 @@ void ObjectProperties::serialize(std::ostream &os) const
                writeARGB8(os, color);
        }
        writeU8(os, collideWithObjects);
-       writeF1000(os,stepheight);
+       writeF1000(os, stepheight);
        writeU8(os, automatic_face_movement_dir);
        writeF1000(os, automatic_face_movement_dir_offset);
        writeU8(os, backface_culling);
@@ -104,6 +109,10 @@ void ObjectProperties::serialize(std::ostream &os) const
        writeF1000(os, automatic_face_movement_max_rotation_per_sec);
        os << serializeString(infotext);
        os << serializeString(wield_item);
+       writeS8(os, glow);
+       writeU16(os, breath_max);
+       writeF1000(os, eye_height);
+       writeF1000(os, zoom_fov);
 
        // Add stuff only at the bottom.
        // Never remove anything, because we don't want new versions of this
@@ -112,7 +121,7 @@ void ObjectProperties::serialize(std::ostream &os) const
 void ObjectProperties::deSerialize(std::istream &is)
 {
        int version = readU8(is);
-       if (version != 2)
+       if (version != 3)
                throw SerializationError("unsupported ObjectProperties version");
 
        hp_max = readS16(is);
@@ -136,6 +145,7 @@ void ObjectProperties::deSerialize(std::istream &is)
        makes_footstep_sound = readU8(is);
        automatic_rotate = readF1000(is);
        mesh = deSerializeString(is);
+       colors.clear();
        u32 color_count = readU16(is);
        for (u32 i = 0; i < color_count; i++){
                colors.push_back(readARGB8(is));
@@ -150,4 +160,8 @@ void ObjectProperties::deSerialize(std::istream &is)
        automatic_face_movement_max_rotation_per_sec = readF1000(is);
        infotext = deSerializeString(is);
        wield_item = deSerializeString(is);
+       glow = readS8(is);
+       breath_max = readU16(is);
+       eye_height = readF1000(is);
+       zoom_fov = readF1000(is);
 }