Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <LuaChunkStay.h>
Public Member Functions | |
bool | AddChunks (const cLuaState::cStackTable &a_ChunkCoords) |
Adds chunks in the specified Lua table. More... | |
cLuaChunkStay () | |
void | Enable (cChunkMap &a_ChunkMap, cLuaState::cCallbackPtr a_OnChunkAvailable, cLuaState::cCallbackPtr a_OnAllChunksAvailable) |
Enables the ChunkStay for the specified chunkmap, with the specified Lua callbacks. More... | |
virtual | ~cLuaChunkStay () override |
Public Member Functions inherited from cChunkStay | |
void | Add (int a_ChunkX, int a_ChunkZ) |
Adds a chunk to be locked from unloading. More... | |
cChunkStay (void) | |
void | Clear (void) |
Clears all the chunks that have been added. More... | |
virtual void | Disable (void) |
Disables the ChunkStay, the chunks are released and the ChunkStay object can be edited with Add() and Remove() again. More... | |
void | Enable (cChunkMap &a_ChunkMap) |
Enables the ChunkStay on the specified chunkmap, causing it to load and generate chunks. More... | |
const cChunkCoordsVector & | GetChunks (void) const |
Returns all the chunks that should be kept. More... | |
void | Remove (int a_ChunkX, int a_ChunkZ) |
Releases the chunk so that it's no longer locked from unloading. More... | |
virtual | ~cChunkStay () |
Deletes the object. More... | |
Protected Member Functions | |
void | AddChunkCoord (cLuaState &a_LuaState, int a_Index) |
Adds a single chunk coord from the table at the top of the Lua stack. More... | |
virtual bool | OnAllChunksAvailable (void) override |
Called once all of the contained chunks are available. More... | |
virtual void | OnChunkAvailable (int a_ChunkX, int a_ChunkZ) override |
Called when a specific chunk become available. More... | |
virtual void | OnDisabled (void) override |
Called by the ChunkMap when the ChunkStay is disabled. More... | |
Protected Member Functions inherited from cChunkStay | |
bool | ChunkAvailable (int a_ChunkX, int a_ChunkZ) |
Called by cChunkMap when a chunk is available, checks m_NumLoaded and triggers the appropriate callbacks. More... | |
Protected Attributes | |
cLuaState::cCallbackPtr | m_OnAllChunksAvailable |
The Lua function to call in OnAllChunksAvailable. More... | |
cLuaState::cCallbackPtr | m_OnChunkAvailable |
The Lua function to call in OnChunkAvailable. More... | |
Protected Attributes inherited from cChunkStay | |
cChunkMap * | m_ChunkMap |
The chunkmap where the object is enabled. More... | |
cChunkCoordsVector | m_Chunks |
The list of chunks to lock from unloading. More... | |
cChunkCoordsVector | m_OutstandingChunks |
The chunks that still need loading. More... | |
Private Types | |
using | Super = cChunkStay |
Definition at line 26 of file LuaChunkStay.h.
|
private |
Definition at line 29 of file LuaChunkStay.h.
cLuaChunkStay::cLuaChunkStay | ( | ) |
Definition at line 14 of file LuaChunkStay.cpp.
|
inlineoverridevirtual |
Definition at line 34 of file LuaChunkStay.h.
|
protected |
Adds a single chunk coord from the table at the top of the Lua stack.
Expects the top element to be a table, checks that it contains two numbers. Uses those two numbers as chunk coords appended to m_Chunks. If the coords are already present, gives a warning and ignores the pair. The a_Index parameter is only for the error messages.
Definition at line 60 of file LuaChunkStay.cpp.
bool cLuaChunkStay::AddChunks | ( | const cLuaState::cStackTable & | a_ChunkCoords | ) |
Adds chunks in the specified Lua table.
Can be called only once. Returns true if any chunk added, false (plus log warning) if none.
Definition at line 22 of file LuaChunkStay.cpp.
void cLuaChunkStay::Enable | ( | cChunkMap & | a_ChunkMap, |
cLuaState::cCallbackPtr | a_OnChunkAvailable, | ||
cLuaState::cCallbackPtr | a_OnAllChunksAvailable | ||
) |
Enables the ChunkStay for the specified chunkmap, with the specified Lua callbacks.
Definition at line 98 of file LuaChunkStay.cpp.
|
overrideprotectedvirtual |
Called once all of the contained chunks are available.
If returns true, the ChunkStay is automatically disabled by the ChunkMap; if it returns false, the ChunkStay is kept.
Implements cChunkStay.
Definition at line 123 of file LuaChunkStay.cpp.
|
overrideprotectedvirtual |
Called when a specific chunk become available.
Implements cChunkStay.
Definition at line 111 of file LuaChunkStay.cpp.
|
overrideprotectedvirtual |
Called by the ChunkMap when the ChunkStay is disabled.
The object may choose to delete itself.
Implements cChunkStay.
Definition at line 143 of file LuaChunkStay.cpp.
|
protected |
The Lua function to call in OnAllChunksAvailable.
Only valid when enabled.
Definition at line 49 of file LuaChunkStay.h.
|
protected |
The Lua function to call in OnChunkAvailable.
Only valid when enabled.
Definition at line 46 of file LuaChunkStay.h.