summaryrefslogtreecommitdiffstats
path: root/src/World.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/World.h')
-rw-r--r--src/World.h40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/World.h b/src/World.h
index cbaf9cb95..22847b975 100644
--- a/src/World.h
+++ b/src/World.h
@@ -12,6 +12,7 @@
#include "ChunkSender.h"
#include "Defines.h"
#include "LightingThread.h"
+#include "IniFile.h"
#include "Item.h"
#include "Mobs/Monster.h"
#include "Entities/ProjectileEntity.h"
@@ -103,6 +104,12 @@ public:
// tolua_begin
+ /** Get whether saving chunks is enabled */
+ bool IsSavingEnabled(void) const { return m_IsSavingEnabled; }
+
+ /** Set whether saving chunks is enabled */
+ void SetSavingEnabled(bool a_IsSavingEnabled) { m_IsSavingEnabled = a_IsSavingEnabled; }
+
int GetTicksUntilWeatherChange(void) const { return m_WeatherInterval; }
/** Is the daylight cycle enabled? */
@@ -301,6 +308,10 @@ public:
Note: Only loaded chunks are considered. */
bool HasEntity(UInt32 a_UniqueID);
+ /** Removes the entity from the world.
+ Returns an owning reference to the found entity. */
+ OwnedEntity RemoveEntity(cEntity & a_Entity);
+
/** Calls the callback for each entity in the entire world; returns true if all entities processed, false if the callback aborted by returning true */
bool ForEachEntity(cEntityCallback & a_Callback); // Exported in ManualBindings.cpp
@@ -453,18 +464,32 @@ public:
Returns the UniqueID of the spawned minecart, or cEntity::INVALID_ID on failure. */
UInt32 SpawnMinecart(double a_X, double a_Y, double a_Z, int a_MinecartType, const cItem & a_Content = cItem(), int a_BlockHeight = 1);
+ // DEPRECATED, use the vector-parametered version instead.
+ UInt32 SpawnBoat(double a_X, double a_Y, double a_Z, cBoat::eMaterial a_Material)
+ {
+ LOGWARNING("cWorld::SpawnBoat(double, double, double) is deprecated, use cWorld::SpawnBoat(Vector3d) instead.");
+ return SpawnBoat({a_X, a_Y, a_Z}, a_Material);
+ }
+
/** Spawns a boat at the given coordinates.
Returns the UniqueID of the spawned boat, or cEntity::INVALID_ID on failure. */
- UInt32 SpawnBoat(double a_X, double a_Y, double a_Z, cBoat::eMaterial a_Material);
+ UInt32 SpawnBoat(Vector3d a_Pos, cBoat::eMaterial a_Material);
/** Spawns an experience orb at the given location with the given reward.
Returns the UniqueID of the spawned experience orb, or cEntity::INVALID_ID on failure. */
virtual UInt32 SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) override;
+ // DEPRECATED, use the vector-parametered version instead.
+ UInt32 SpawnPrimedTNT(double a_X, double a_Y, double a_Z, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1)
+ {
+ LOGWARNING("cWorld::SpawnPrimedTNT(double, double, double) is deprecated, use cWorld::SpawnPrimedTNT(Vector3d) instead.");
+ return SpawnPrimedTNT({a_X, a_Y, a_Z}, a_FuseTimeInSec, a_InitialVelocityCoeff);
+ }
+
/** Spawns a new primed TNT entity at the specified block coords and specified fuse duration.
Initial velocity is given based on the relative coefficient provided.
Returns the UniqueID of the created entity, or cEntity::INVALID_ID on failure. */
- UInt32 SpawnPrimedTNT(double a_X, double a_Y, double a_Z, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1);
+ UInt32 SpawnPrimedTNT(Vector3d a_Pos, int a_FuseTimeInSec = 80, double a_InitialVelocityCoeff = 1);
// tolua_end
@@ -639,6 +664,9 @@ public:
/** Returns the name of the world */
const AString & GetName(void) const { return m_WorldName; }
+ /** Returns the data path to the world data */
+ const AString & GetDataPath(void) const { return m_DataPath; }
+
/** Returns the name of the world.ini file used by this world */
const AString & GetIniFileName(void) const {return m_IniFileName; }
@@ -882,6 +910,9 @@ private:
AString m_WorldName;
+ /** The path to the root directory for the world files. Does not including trailing path specifier. */
+ AString m_DataPath;
+
/** The name of the overworld that portals in this world should link to.
Only has effect if this world is a Nether or End world. */
AString m_LinkedOverworldName;
@@ -893,6 +924,9 @@ private:
int m_StorageCompressionFactor;
+ /** Whether or not writing chunks to disk is currently enabled */
+ std::atomic<bool> m_IsSavingEnabled;
+
/** The dimension of the world, used by the client to provide correct lighting scheme */
eDimension m_Dimension;
@@ -1047,7 +1081,7 @@ private:
cSetChunkDataPtrs m_SetChunkDataQueue;
- cWorld(const AString & a_WorldName, eDimension a_Dimension = dimOverworld, const AString & a_LinkedOverworldName = "");
+ cWorld(const AString & a_WorldName, const AString & a_DataPath, eDimension a_Dimension = dimOverworld, const AString & a_LinkedOverworldName = "");
virtual ~cWorld() override;
void Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_LastTickDurationMSec);