Make players be again visible from a long distance
parent
08a10b8a6a
commit
e4daa4c065
|
@ -1217,10 +1217,12 @@ void ServerEnvironment::getAddedActiveObjects(v3s16 pos, s16 radius,
|
||||||
// Discard if removed
|
// Discard if removed
|
||||||
if(object->m_removed)
|
if(object->m_removed)
|
||||||
continue;
|
continue;
|
||||||
|
if(object->unlimitedTransferDistance() == false){
|
||||||
// Discard if too far
|
// Discard if too far
|
||||||
f32 distance_f = object->getBasePosition().getDistanceFrom(pos_f);
|
f32 distance_f = object->getBasePosition().getDistanceFrom(pos_f);
|
||||||
if(distance_f > radius_f)
|
if(distance_f > radius_f)
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
// Discard if already on current_objects
|
// Discard if already on current_objects
|
||||||
core::map<u16, bool>::Node *n;
|
core::map<u16, bool>::Node *n;
|
||||||
n = current_objects.find(id);
|
n = current_objects.find(id);
|
||||||
|
@ -1255,24 +1257,33 @@ void ServerEnvironment::getRemovedActiveObjects(v3s16 pos, s16 radius,
|
||||||
{
|
{
|
||||||
u16 id = i.getNode()->getKey();
|
u16 id = i.getNode()->getKey();
|
||||||
ServerActiveObject *object = getActiveObject(id);
|
ServerActiveObject *object = getActiveObject(id);
|
||||||
if(object == NULL)
|
|
||||||
{
|
if(object == NULL){
|
||||||
infostream<<"ServerEnvironment::getRemovedActiveObjects():"
|
infostream<<"ServerEnvironment::getRemovedActiveObjects():"
|
||||||
<<" object in current_objects is NULL"<<std::endl;
|
<<" object in current_objects is NULL"<<std::endl;
|
||||||
}
|
removed_objects.insert(id, false);
|
||||||
else if(object->m_removed == false)
|
|
||||||
{
|
|
||||||
f32 distance_f = object->getBasePosition().getDistanceFrom(pos_f);
|
|
||||||
/*infostream<<"removed == false"
|
|
||||||
<<"distance_f = "<<distance_f
|
|
||||||
<<", radius_f = "<<radius_f<<std::endl;*/
|
|
||||||
if(distance_f < radius_f)
|
|
||||||
{
|
|
||||||
// Not removed
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if(object->m_removed)
|
||||||
|
{
|
||||||
removed_objects.insert(id, false);
|
removed_objects.insert(id, false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If transfer distance is unlimited, don't remove
|
||||||
|
if(object->unlimitedTransferDistance())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
f32 distance_f = object->getBasePosition().getDistanceFrom(pos_f);
|
||||||
|
|
||||||
|
if(distance_f >= radius_f)
|
||||||
|
{
|
||||||
|
removed_objects.insert(id, false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not removed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,6 +242,11 @@ void ServerRemotePlayer::removingFromEnvironment()
|
||||||
m_is_in_environment = false;
|
m_is_in_environment = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ServerRemotePlayer::unlimitedTransferDistance() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ServerRemotePlayer::step(float dtime, bool send_recommended)
|
void ServerRemotePlayer::step(float dtime, bool send_recommended)
|
||||||
{
|
{
|
||||||
if(send_recommended == false)
|
if(send_recommended == false)
|
||||||
|
|
|
@ -216,6 +216,9 @@ public:
|
||||||
|
|
||||||
bool environmentDeletes() const
|
bool environmentDeletes() const
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
|
virtual bool unlimitedTransferDistance() const;
|
||||||
|
|
||||||
bool isStaticAllowed() const
|
bool isStaticAllowed() const
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,9 @@ public:
|
||||||
virtual bool environmentDeletes() const
|
virtual bool environmentDeletes() const
|
||||||
{ return true; }
|
{ return true; }
|
||||||
|
|
||||||
|
virtual bool unlimitedTransferDistance() const
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
// Create a certain type of ServerActiveObject
|
// Create a certain type of ServerActiveObject
|
||||||
static ServerActiveObject* create(u8 type,
|
static ServerActiveObject* create(u8 type,
|
||||||
ServerEnvironment *env, u16 id, v3f pos,
|
ServerEnvironment *env, u16 id, v3f pos,
|
||||||
|
|
Loading…
Reference in New Issue