Skip to content

Commit e05b7db

Browse files
Wuzzy2nerzhul
authored andcommittedJan 22, 2020
Remove unused weight property from objects (#9320)
1 parent 3dfb6ec commit e05b7db

File tree

5 files changed

+2
-12
lines changed

5 files changed

+2
-12
lines changed
 

Diff for: ‎doc/lua_api.txt

-3
Original file line numberDiff line numberDiff line change
@@ -6148,9 +6148,6 @@ Player properties need to be saved manually.
61486148
collide_with_objects = true,
61496149
-- Collide with other objects if physical = true
61506150

6151-
weight = 5,
6152-
-- Unused.
6153-
61546151
collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5}, -- Default
61556152
selectionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5},
61566153
-- Selection box uses collision box dimensions when not set.

Diff for: ‎src/content_sao.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,6 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t p
869869
m_prop.hp_max = PLAYER_MAX_HP_DEFAULT;
870870
m_prop.breath_max = PLAYER_MAX_BREATH_DEFAULT;
871871
m_prop.physical = false;
872-
m_prop.weight = 75;
873872
m_prop.collisionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f);
874873
m_prop.selectionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f);
875874
m_prop.pointable = true;

Diff for: ‎src/object_properties.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ std::string ObjectProperties::dump()
3737
os << ", breath_max=" << breath_max;
3838
os << ", physical=" << physical;
3939
os << ", collideWithObjects=" << collideWithObjects;
40-
os << ", weight=" << weight;
4140
os << ", collisionbox=" << PP(collisionbox.MinEdge) << "," << PP(collisionbox.MaxEdge);
4241
os << ", visual=" << visual;
4342
os << ", mesh=" << mesh;
@@ -77,7 +76,7 @@ void ObjectProperties::serialize(std::ostream &os) const
7776
writeU8(os, 4); // PROTOCOL_VERSION >= 37
7877
writeU16(os, hp_max);
7978
writeU8(os, physical);
80-
writeF32(os, weight);
79+
writeF32(os, 0.f); // Removed property (weight)
8180
writeV3F32(os, collisionbox.MinEdge);
8281
writeV3F32(os, collisionbox.MaxEdge);
8382
writeV3F32(os, selectionbox.MinEdge);
@@ -128,7 +127,7 @@ void ObjectProperties::deSerialize(std::istream &is)
128127

129128
hp_max = readU16(is);
130129
physical = readU8(is);
131-
weight = readF32(is);
130+
readU32(is); // removed property (weight)
132131
collisionbox.MinEdge = readV3F32(is);
133132
collisionbox.MaxEdge = readV3F32(is);
134133
selectionbox.MinEdge = readV3F32(is);

Diff for: ‎src/object_properties.h

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ struct ObjectProperties
3131
u16 breath_max = 0;
3232
bool physical = false;
3333
bool collideWithObjects = true;
34-
float weight = 5.0f;
3534
// Values are BS=1
3635
aabb3f collisionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
3736
aabb3f selectionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);

Diff for: ‎src/script/common/c_content.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ void read_object_properties(lua_State *L, int index,
208208
getboolfield(L, -1, "physical", prop->physical);
209209
getboolfield(L, -1, "collide_with_objects", prop->collideWithObjects);
210210

211-
getfloatfield(L, -1, "weight", prop->weight);
212-
213211
lua_getfield(L, -1, "collisionbox");
214212
bool collisionbox_defined = lua_istable(L, -1);
215213
if (collisionbox_defined)
@@ -340,8 +338,6 @@ void push_object_properties(lua_State *L, ObjectProperties *prop)
340338
lua_setfield(L, -2, "physical");
341339
lua_pushboolean(L, prop->collideWithObjects);
342340
lua_setfield(L, -2, "collide_with_objects");
343-
lua_pushnumber(L, prop->weight);
344-
lua_setfield(L, -2, "weight");
345341
push_aabb3f(L, prop->collisionbox);
346342
lua_setfield(L, -2, "collisionbox");
347343
push_aabb3f(L, prop->selectionbox);

0 commit comments

Comments
 (0)