mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +00:00
Add persistent unique identifiers for objects (#14135)
This commit is contained in:
parent
e0f8243629
commit
4f42b4308c
20 changed files with 257 additions and 19 deletions
|
@ -2,16 +2,31 @@
|
|||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (C) 2022 Minetest core developers & community
|
||||
|
||||
#include "util/guid.h"
|
||||
#include "serverenvironment.h"
|
||||
#include <server/serveractiveobject.h>
|
||||
#include <string>
|
||||
|
||||
class MockServerActiveObject : public ServerActiveObject
|
||||
{
|
||||
public:
|
||||
MockServerActiveObject(ServerEnvironment *env = nullptr, v3f p = v3f()) :
|
||||
ServerActiveObject(env, p) {}
|
||||
ServerActiveObject(env, p)
|
||||
{
|
||||
if (env)
|
||||
m_guid = "mock:" + env->getGUIDGenerator().next().base64();
|
||||
}
|
||||
|
||||
virtual ActiveObjectType getType() const { return ACTIVEOBJECT_TYPE_TEST; }
|
||||
virtual bool getCollisionBox(aabb3f *toset) const { return false; }
|
||||
virtual bool getSelectionBox(aabb3f *toset) const { return false; }
|
||||
virtual bool collideWithObjects() const { return false; }
|
||||
virtual std::string getGUID() const
|
||||
{
|
||||
assert(!m_guid.empty());
|
||||
return m_guid;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_guid;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue