Remove unused weight property from objects (#9320)

This commit is contained in:
Wuzzy 2020-01-22 09:19:27 +00:00 committed by Loïc Blot
parent 3dfb6ecbb2
commit e05b7dbb3c
5 changed files with 2 additions and 12 deletions

@ -6148,9 +6148,6 @@ Player properties need to be saved manually.
collide_with_objects = true, collide_with_objects = true,
-- Collide with other objects if physical = 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 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}, selectionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
-- Selection box uses collision box dimensions when not set. -- Selection box uses collision box dimensions when not set.

@ -869,7 +869,6 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t p
m_prop.hp_max = PLAYER_MAX_HP_DEFAULT; m_prop.hp_max = PLAYER_MAX_HP_DEFAULT;
m_prop.breath_max = PLAYER_MAX_BREATH_DEFAULT; m_prop.breath_max = PLAYER_MAX_BREATH_DEFAULT;
m_prop.physical = false; 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.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.selectionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f);
m_prop.pointable = true; m_prop.pointable = true;

@ -37,7 +37,6 @@ std::string ObjectProperties::dump()
os << ", breath_max=" << breath_max; os << ", breath_max=" << breath_max;
os << ", physical=" << physical; os << ", physical=" << physical;
os << ", collideWithObjects=" << collideWithObjects; os << ", collideWithObjects=" << collideWithObjects;
os << ", weight=" << weight;
os << ", collisionbox=" << PP(collisionbox.MinEdge) << "," << PP(collisionbox.MaxEdge); os << ", collisionbox=" << PP(collisionbox.MinEdge) << "," << PP(collisionbox.MaxEdge);
os << ", visual=" << visual; os << ", visual=" << visual;
os << ", mesh=" << mesh; os << ", mesh=" << mesh;
@ -77,7 +76,7 @@ void ObjectProperties::serialize(std::ostream &os) const
writeU8(os, 4); // PROTOCOL_VERSION >= 37 writeU8(os, 4); // PROTOCOL_VERSION >= 37
writeU16(os, hp_max); writeU16(os, hp_max);
writeU8(os, physical); writeU8(os, physical);
writeF32(os, weight); writeF32(os, 0.f); // Removed property (weight)
writeV3F32(os, collisionbox.MinEdge); writeV3F32(os, collisionbox.MinEdge);
writeV3F32(os, collisionbox.MaxEdge); writeV3F32(os, collisionbox.MaxEdge);
writeV3F32(os, selectionbox.MinEdge); writeV3F32(os, selectionbox.MinEdge);
@ -128,7 +127,7 @@ void ObjectProperties::deSerialize(std::istream &is)
hp_max = readU16(is); hp_max = readU16(is);
physical = readU8(is); physical = readU8(is);
weight = readF32(is); readU32(is); // removed property (weight)
collisionbox.MinEdge = readV3F32(is); collisionbox.MinEdge = readV3F32(is);
collisionbox.MaxEdge = readV3F32(is); collisionbox.MaxEdge = readV3F32(is);
selectionbox.MinEdge = readV3F32(is); selectionbox.MinEdge = readV3F32(is);

@ -31,7 +31,6 @@ struct ObjectProperties
u16 breath_max = 0; u16 breath_max = 0;
bool physical = false; bool physical = false;
bool collideWithObjects = true; bool collideWithObjects = true;
float weight = 5.0f;
// Values are BS=1 // Values are BS=1
aabb3f collisionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f); 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); aabb3f selectionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);

@ -208,8 +208,6 @@ void read_object_properties(lua_State *L, int index,
getboolfield(L, -1, "physical", prop->physical); getboolfield(L, -1, "physical", prop->physical);
getboolfield(L, -1, "collide_with_objects", prop->collideWithObjects); getboolfield(L, -1, "collide_with_objects", prop->collideWithObjects);
getfloatfield(L, -1, "weight", prop->weight);
lua_getfield(L, -1, "collisionbox"); lua_getfield(L, -1, "collisionbox");
bool collisionbox_defined = lua_istable(L, -1); bool collisionbox_defined = lua_istable(L, -1);
if (collisionbox_defined) if (collisionbox_defined)
@ -340,8 +338,6 @@ void push_object_properties(lua_State *L, ObjectProperties *prop)
lua_setfield(L, -2, "physical"); lua_setfield(L, -2, "physical");
lua_pushboolean(L, prop->collideWithObjects); lua_pushboolean(L, prop->collideWithObjects);
lua_setfield(L, -2, "collide_with_objects"); lua_setfield(L, -2, "collide_with_objects");
lua_pushnumber(L, prop->weight);
lua_setfield(L, -2, "weight");
push_aabb3f(L, prop->collisionbox); push_aabb3f(L, prop->collisionbox);
lua_setfield(L, -2, "collisionbox"); lua_setfield(L, -2, "collisionbox");
push_aabb3f(L, prop->selectionbox); push_aabb3f(L, prop->selectionbox);