commit
9bb48a8fa4
@ -2117,6 +2117,7 @@ end
|
|||||||
QueueSaveAllChunks = { Params = "", Return = "", Notes = "Queues all chunks to be saved in the world storage thread" },
|
QueueSaveAllChunks = { Params = "", Return = "", Notes = "Queues all chunks to be saved in the world storage thread" },
|
||||||
QueueSetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta, TickDelay", Return = "", Notes = "Queues the block to be set to the specified blocktype and meta after the specified amount of game ticks. Uses SetBlock() for the actual setting, so simulators are woken up and block entities are handled correctly." },
|
QueueSetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta, TickDelay", Return = "", Notes = "Queues the block to be set to the specified blocktype and meta after the specified amount of game ticks. Uses SetBlock() for the actual setting, so simulators are woken up and block entities are handled correctly." },
|
||||||
QueueTask = { Params = "TaskFunction", Return = "", Notes = "Queues the specified function to be executed in the tick thread. This is the primary means of interaction with a cWorld from the WebAdmin page handlers (see {{WebWorldThreads}}). The function signature is <pre class=\"pretty-print lang-lua\">function()</pre>All return values from the function are ignored. Note that this function is actually called *after* the QueueTask() function returns. Note that it is unsafe to store references to MCServer objects, such as entities, across from the caller to the task handler function; store the EntityID instead." },
|
QueueTask = { Params = "TaskFunction", Return = "", Notes = "Queues the specified function to be executed in the tick thread. This is the primary means of interaction with a cWorld from the WebAdmin page handlers (see {{WebWorldThreads}}). The function signature is <pre class=\"pretty-print lang-lua\">function()</pre>All return values from the function are ignored. Note that this function is actually called *after* the QueueTask() function returns. Note that it is unsafe to store references to MCServer objects, such as entities, across from the caller to the task handler function; store the EntityID instead." },
|
||||||
|
QueueUnloadUnusedChunks = { Params = "", Return = "", Notes = "Queues a cTask that unloads chunks that are no longer needed and are saved." },
|
||||||
RegenerateChunk = { Params = "ChunkX, ChunkZ", Return = "", Notes = "Queues the specified chunk to be re-generated, overwriting the current data. To queue a chunk for generating only if it doesn't exist, use the GenerateChunk() instead." },
|
RegenerateChunk = { Params = "ChunkX, ChunkZ", Return = "", Notes = "Queues the specified chunk to be re-generated, overwriting the current data. To queue a chunk for generating only if it doesn't exist, use the GenerateChunk() instead." },
|
||||||
ScheduleTask = { Params = "DelayTicks, TaskFunction", Return = "", Notes = "Queues the specified function to be executed in the world's tick thread after a the specified number of ticks. This enables operations to be queued for execution in the future. The function signature is <pre class=\"pretty-print lang-lua\">function({{cWorld|World}})</pre>All return values from the function are ignored. Note that it is unsafe to store references to MCServer objects, such as entities, across from the caller to the task handler function; store the EntityID instead." },
|
ScheduleTask = { Params = "DelayTicks, TaskFunction", Return = "", Notes = "Queues the specified function to be executed in the world's tick thread after a the specified number of ticks. This enables operations to be queued for execution in the future. The function signature is <pre class=\"pretty-print lang-lua\">function({{cWorld|World}})</pre>All return values from the function are ignored. Note that it is unsafe to store references to MCServer objects, such as entities, across from the caller to the task handler function; store the EntityID instead." },
|
||||||
SendBlockTo = { Params = "BlockX, BlockY, BlockZ, {{cPlayer|Player}}", Return = "", Notes = "Sends the block at the specified coords to the specified player's client, as an UpdateBlock packet." },
|
SendBlockTo = { Params = "BlockX, BlockY, BlockZ, {{cPlayer|Player}}", Return = "", Notes = "Sends the block at the specified coords to the specified player's client, as an UpdateBlock packet." },
|
||||||
@ -2146,7 +2147,6 @@ end
|
|||||||
SpawnExperienceOrb = { Params = "X, Y, Z, Reward", Return = "EntityID", Notes = "Spawns an {{cExpOrb|experience orb}} at the specified coords, with the given reward" },
|
SpawnExperienceOrb = { Params = "X, Y, Z, Reward", Return = "EntityID", Notes = "Spawns an {{cExpOrb|experience orb}} at the specified coords, with the given reward" },
|
||||||
SpawnPrimedTNT = { Params = "X, Y, Z, FuseTimeSecs, InitialVelocityCoeff", Return = "", Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse time. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value." },
|
SpawnPrimedTNT = { Params = "X, Y, Z, FuseTimeSecs, InitialVelocityCoeff", Return = "", Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse time. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value." },
|
||||||
TryGetHeight = { Params = "BlockX, BlockZ", Return = "IsValid, Height", Notes = "Returns true and height of the highest non-air block if the chunk is loaded, or false otherwise." },
|
TryGetHeight = { Params = "BlockX, BlockZ", Return = "IsValid, Height", Notes = "Returns true and height of the highest non-air block if the chunk is loaded, or false otherwise." },
|
||||||
UnloadUnusedChunks = { Params = "", Return = "", Notes = "Unloads chunks that are no longer needed, and are saved. NOTE: This API is deprecated and will be removed soon." },
|
|
||||||
UpdateSign = { Params = "X, Y, Z, Line1, Line2, Line3, Line4, [{{cPlayer|Player}}]", Return = "", Notes = "Sets the sign text at the specified coords. The sign-updating hooks are called for the change. The Player parameter is used to indicate the player from whom the change has come, it may be nil. Same as SetSignLiens()" },
|
UpdateSign = { Params = "X, Y, Z, Line1, Line2, Line3, Line4, [{{cPlayer|Player}}]", Return = "", Notes = "Sets the sign text at the specified coords. The sign-updating hooks are called for the change. The Player parameter is used to indicate the player from whom the change has come, it may be nil. Same as SetSignLiens()" },
|
||||||
UseBlockEntity = { Params = "{{cPlayer|Player}}, BlockX, BlockY, BlockZ", Return = "", Notes = "Makes the specified Player use the block entity at the specified coords (open chest UI, etc.) If the cords are in an unloaded chunk or there's no block entity, ignores the call." },
|
UseBlockEntity = { Params = "{{cPlayer|Player}}, BlockX, BlockY, BlockZ", Return = "", Notes = "Makes the specified Player use the block entity at the specified coords (open chest UI, etc.) If the cords are in an unloaded chunk or there's no block entity, ignores the call." },
|
||||||
WakeUpSimulators = { Params = "BlockX, BlockY, BlockZ", Return = "", Notes = "Wakes up the simulators for the specified block." },
|
WakeUpSimulators = { Params = "BlockX, BlockY, BlockZ", Return = "", Notes = "Wakes up the simulators for the specified block." },
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit d6ed2041469ab959bbf3842db41c0e25fd249dc1
|
Subproject commit 0e53588713215f0a9557ef55295e8aa22f265cba
|
@ -1 +1 @@
|
|||||||
Subproject commit 2cb1a0c4009ecf368ecc74eb428394e10f9e6d00
|
Subproject commit 2ceda579893ceb23c5eb0d56df47dc235644e0f4
|
@ -2213,6 +2213,15 @@ void cWorld::UnloadUnusedChunks(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cWorld::QueueUnloadUnusedChunks(void)
|
||||||
|
{
|
||||||
|
QueueTask(new cWorld::cTaskUnloadUnusedChunks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cWorld::CollectPickupsByPlayer(cPlayer * a_Player)
|
void cWorld::CollectPickupsByPlayer(cPlayer * a_Player)
|
||||||
{
|
{
|
||||||
m_ChunkMap->CollectPickupsByPlayer(a_Player);
|
m_ChunkMap->CollectPickupsByPlayer(a_Player);
|
||||||
@ -2945,6 +2954,7 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cWorld::cTaskSaveAllChunks:
|
// cWorld::cTaskSaveAllChunks:
|
||||||
|
|
||||||
@ -2957,6 +2967,18 @@ void cWorld::cTaskSaveAllChunks::Run(cWorld & a_World)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// cWorld::cTaskUnloadUnusedChunks
|
||||||
|
|
||||||
|
void cWorld::cTaskUnloadUnusedChunks::Run(cWorld & a_World)
|
||||||
|
{
|
||||||
|
a_World.UnloadUnusedChunks();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cWorld::cChunkGeneratorCallbacks:
|
// cWorld::cChunkGeneratorCallbacks:
|
||||||
|
|
||||||
|
15
src/World.h
15
src/World.h
@ -99,6 +99,15 @@ public:
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
class cTaskUnloadUnusedChunks :
|
||||||
|
public cTask
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// cTask overrides:
|
||||||
|
virtual void Run(cWorld & a_World) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
|
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
|
||||||
{
|
{
|
||||||
return "cWorld";
|
return "cWorld";
|
||||||
@ -243,7 +252,8 @@ public:
|
|||||||
bool IsChunkValid (int a_ChunkX, int a_ChunkZ) const;
|
bool IsChunkValid (int a_ChunkX, int a_ChunkZ) const;
|
||||||
bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const;
|
bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const;
|
||||||
|
|
||||||
void UnloadUnusedChunks(void); // tolua_export
|
/** Queues a task to unload unused chunks onto the tick thread. The prefferred way of unloading*/
|
||||||
|
void QueueUnloadUnusedChunks(void); // tolua_export
|
||||||
|
|
||||||
void CollectPickupsByPlayer(cPlayer * a_Player);
|
void CollectPickupsByPlayer(cPlayer * a_Player);
|
||||||
|
|
||||||
@ -866,6 +876,9 @@ private:
|
|||||||
/** Ticks all clients that are in this world */
|
/** Ticks all clients that are in this world */
|
||||||
void TickClients(float a_Dt);
|
void TickClients(float a_Dt);
|
||||||
|
|
||||||
|
/** Unloads all chunks immediately.*/
|
||||||
|
void UnloadUnusedChunks(void);
|
||||||
|
|
||||||
void UpdateSkyDarkness(void);
|
void UpdateSkyDarkness(void);
|
||||||
|
|
||||||
/** <summary>Generates a random spawnpoint on solid land by walking chunks and finding their biomes</summary> */
|
/** <summary>Generates a random spawnpoint on solid land by walking chunks and finding their biomes</summary> */
|
||||||
|
Loading…
Reference in New Issue
Block a user