mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-21 18:11:11 +00:00
Add spatial index for objects (#14631)
This commit is contained in:
parent
bed36139db
commit
a3648b0b16
17 changed files with 982 additions and 116 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "inventory.h"
|
||||
#include "inventorymanager.h"
|
||||
#include "constants.h" // BS
|
||||
#include "serverenvironment.h"
|
||||
|
||||
ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
|
||||
ActiveObject(0),
|
||||
|
@ -14,6 +15,17 @@ ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
|
|||
{
|
||||
}
|
||||
|
||||
void ServerActiveObject::setBasePosition(v3f pos)
|
||||
{
|
||||
bool changed = m_base_position != pos;
|
||||
m_base_position = pos;
|
||||
if (changed && getEnv()) {
|
||||
// getEnv() should never be null if the object is in an environment.
|
||||
// It may however be null e.g. in tests or database migrations.
|
||||
getEnv()->updateObjectPos(getId(), pos);
|
||||
}
|
||||
}
|
||||
|
||||
float ServerActiveObject::getMinimumSavedMovement()
|
||||
{
|
||||
return 2.0*BS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue