1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Disallow placing entities outside safe boundaries

Entity positions are serialized as F1000. Disallow placing
entities outside safe borders with the minetest.add_entity
call.

Note that this patch only enforces those boundaries for
placing entities, moving entities that move outside boundaries
aren't affected.

Thanks to @nanepiwo for pointing this out.
This commit is contained in:
est31 2015-09-15 18:37:58 +02:00
parent 8e9c9e305a
commit f61f817b9c
2 changed files with 21 additions and 0 deletions

View file

@ -1493,6 +1493,15 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object,
delete object;
return 0;
}
if (objectpos_over_limit(object->getBasePosition())) {
errorstream << "ServerEnvironment::addActiveObjectRaw(): "
<< "object position outside maximum range" << std::endl;
if (object->environmentDeletes())
delete object;
return 0;
}
/*infostream<<"ServerEnvironment::addActiveObjectRaw(): "
<<"added (id="<<object->getId()<<")"<<std::endl;*/