Luanti 5.19.0-dev
Loading...
Searching...
No Matches
test_sao.cpp File Reference
#include "test.h"
#include "mock_server.h"
#include "server/luaentity_sao.h"
#include "serverenvironment.h"
#include "servermap.h"
#include "emerge.h"
Include dependency graph for test_sao.cpp:

Classes

class  TestSAO

Functions

static LuaEntitySAO * add_entity (ServerEnvironment *env, v3f pos, const char *name)
static u16 assert_active_in_block (MapBlock *block, u16 obj_id=0)

Variables

static TestSAO g_test_instance
static const char * helper_lua_src

Function Documentation

◆ add_entity()

LuaEntitySAO * add_entity ( ServerEnvironment * env,
v3f pos,
const char * name )
static

References add_entity(), and ServerEnvironment::addActiveObject().

Referenced by add_entity(), TestSAO::testNotSaved(), TestSAO::testShutdown(), TestSAO::testStaticSave(), and TestSAO::testStaticToTrue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assert_active_in_block()

u16 assert_active_in_block ( MapBlock * block,
u16 obj_id = 0 )
static

References assert_active_in_block(), MapBlock::m_static_objects, UASSERT, and UASSERTEQ.

Referenced by assert_active_in_block(), TestSAO::testActivate(), TestSAO::testShutdown(), TestSAO::testStaticSave(), and TestSAO::testStaticToFalse().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_test_instance

TestSAO g_test_instance
static

◆ helper_lua_src

const char* helper_lua_src
static
Initial value:
= R"(
local function assert_objectref(self)
assert(self.object:is_valid(), "ObjectRef is not valid in callback")
end
local def = {
on_activate = assert_objectref,
on_deactivate = assert_objectref,
on_step = assert_objectref,
get_staticdata = assert_objectref,
}
core.register_entity(":test:static", table.copy(def))
def.initial_properties = { static_save = false }
core.register_entity(":test:non_static", table.copy(def))
)"

Referenced by TestSAO::runTests().