Remove unused weight property from objects (#9320)
authorWuzzy <wuzzy2@mail.ru>
Wed, 22 Jan 2020 09:19:27 +0000 (09:19 +0000)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Wed, 22 Jan 2020 09:19:27 +0000 (10:19 +0100)
doc/lua_api.txt
src/content_sao.cpp
src/object_properties.cpp
src/object_properties.h
src/script/common/c_content.cpp

index b06e08548a8e7cbff7664db32682b327e9498206..551aa50b5b72043b580b04c47738699f28591441 100644 (file)
@@ -6148,9 +6148,6 @@ Player properties need to be saved manually.
         collide_with_objects = true,
         -- Collide with other objects if physical = true
 
-        weight = 5,
-        -- Unused.
-
         collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},  -- Default
         selectionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
         -- Selection box uses collision box dimensions when not set.
index ebda0efc94de0ae802a8923cbb5efcdc95300bec..43c784b426fe475d267b8e5703c13e78702ba4db 100644 (file)
@@ -869,7 +869,6 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t p
        m_prop.hp_max = PLAYER_MAX_HP_DEFAULT;
        m_prop.breath_max = PLAYER_MAX_BREATH_DEFAULT;
        m_prop.physical = false;
-       m_prop.weight = 75;
        m_prop.collisionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f);
        m_prop.selectionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f);
        m_prop.pointable = true;
index a037c5f65c62ac11494cc96b93d0b19312f0c86f..4cf180b18eb4ccb8bf9a4a27b73032d90f82aca4 100644 (file)
@@ -37,7 +37,6 @@ std::string ObjectProperties::dump()
        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;
@@ -77,7 +76,7 @@ void ObjectProperties::serialize(std::ostream &os) const
        writeU8(os, 4); // PROTOCOL_VERSION >= 37
        writeU16(os, hp_max);
        writeU8(os, physical);
-       writeF32(os, weight);
+       writeF32(os, 0.f); // Removed property (weight)
        writeV3F32(os, collisionbox.MinEdge);
        writeV3F32(os, collisionbox.MaxEdge);
        writeV3F32(os, selectionbox.MinEdge);
@@ -128,7 +127,7 @@ void ObjectProperties::deSerialize(std::istream &is)
 
        hp_max = readU16(is);
        physical = readU8(is);
-       weight = readF32(is);
+       readU32(is); // removed property (weight)
        collisionbox.MinEdge = readV3F32(is);
        collisionbox.MaxEdge = readV3F32(is);
        selectionbox.MinEdge = readV3F32(is);
index 199182d70839ced53c4a803e8acc7579f87788f1..3895f337990c5818a04272cd5f4912f026fe5ec3 100644 (file)
@@ -31,7 +31,6 @@ struct ObjectProperties
        u16 breath_max = 0;
        bool physical = false;
        bool collideWithObjects = true;
-       float weight = 5.0f;
        // Values are BS=1
        aabb3f collisionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
        aabb3f selectionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
index fc1d82bcc1368d4b9b20c30c7f7abcbe9f05fb3a..ca061c45466f1384a1dabc69363d4fad5b4b2ab6 100644 (file)
@@ -208,8 +208,6 @@ void read_object_properties(lua_State *L, int index,
        getboolfield(L, -1, "physical", prop->physical);
        getboolfield(L, -1, "collide_with_objects", prop->collideWithObjects);
 
-       getfloatfield(L, -1, "weight", prop->weight);
-
        lua_getfield(L, -1, "collisionbox");
        bool collisionbox_defined = lua_istable(L, -1);
        if (collisionbox_defined)
@@ -340,8 +338,6 @@ void push_object_properties(lua_State *L, ObjectProperties *prop)
        lua_setfield(L, -2, "physical");
        lua_pushboolean(L, prop->collideWithObjects);
        lua_setfield(L, -2, "collide_with_objects");
-       lua_pushnumber(L, prop->weight);
-       lua_setfield(L, -2, "weight");
        push_aabb3f(L, prop->collisionbox);
        lua_setfield(L, -2, "collisionbox");
        push_aabb3f(L, prop->selectionbox);