Skip to content

Commit

Permalink
Remove unused weight property from objects (#9320)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuzzy2 authored and nerzhul committed Jan 22, 2020
1 parent 3dfb6ec commit e05b7db
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 12 deletions.
3 changes: 0 additions & 3 deletions doc/lua_api.txt
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion src/content_sao.cpp
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/object_properties.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/object_properties.h
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/script/common/c_content.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e05b7db

Please sign in to comment.