Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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.
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1493,6 +1493,15 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object, | |
delete object; | ||
return 0; | ||
} | ||
|
||
if (objectpos_over_limit(object->getBasePosition())) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
est31
Author
Contributor
|
||
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;*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warning: getBasePosition is equivalent to v3s16 * BS. Here you will remove all objets far from limits.
Divide getBasePosition / BS to have the correct limits for map nodes.