blob: 606f7694fa633e1dc474e8287cb97b3580b0abd9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// LuaChunkStay.cpp
// Implements the cLuaChunkStay class representing a cChunkStay binding for plugins
#include "Globals.h"
#include "LuaChunkStay.h"
#include "../World.h"
void cLuaChunkStay::Enable(
cWorld & a_World, cLuaState & a_LuaState,
const cLuaState::cRef & a_OnChunkAvailable, const cLuaState::cRef & a_OnAllChunksAvailable
)
{
if (m_LuaState != NULL)
{
LOGWARNING("LuaChunkStay: Already enabled. Ignoring this call.");
a_LuaState.LogStackTrace();
return;
}
m_LuaState = &a_LuaState;
m_OnChunkAvailable = a_OnAllChunksAvailable;
m_OnAllChunksAvailable = a_OnAllChunksAvailable;
super::Enable(*a_World.GetChunkMap());
}
void cLuaChunkStay::OnChunkAvailable(int a_ChunkX, int a_ChunkZ)
{
m_LuaState->Call(m_OnChunkAvailable, a_ChunkX, a_ChunkZ);
}
void cLuaChunkStay::OnAllChunksAvailable(void)
{
m_LuaState->Call(m_OnAllChunksAvailable);
}
|