summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/ManualBindings.cpp6
-rw-r--r--source/cClientHandle.h1
-rw-r--r--source/cEntity.h6
-rw-r--r--source/cServer.cpp60
-rw-r--r--source/cWorld.h2
5 files changed, 11 insertions, 64 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp
index 34934eebd..ba3b99e14 100644
--- a/source/ManualBindings.cpp
+++ b/source/ManualBindings.cpp
@@ -13,6 +13,7 @@
#include "cPlayer.h"
#include "cWebAdmin.h"
#include "cStringMap.h"
+#include "cClientHandle.h"
#include "md5/md5.h"
@@ -507,6 +508,11 @@ void ManualBindings::Bind( lua_State* tolua_S )
tolua_variable(tolua_S,"FormData",tolua_get_HTTPRequest_FormData,0);
tolua_endmodule(tolua_S);
+ tolua_beginmodule(tolua_S,"cClientHandle");
+ tolua_constant(tolua_S,"MIN_VIEW_DISTANCE",cClientHandle::MIN_VIEW_DISTANCE);
+ tolua_constant(tolua_S,"MAX_VIEW_DISTANCE",cClientHandle::MAX_VIEW_DISTANCE);
+ tolua_endmodule(tolua_S);
+
tolua_function(tolua_S,"md5",tolua_md5);
tolua_endmodule(tolua_S);
diff --git a/source/cClientHandle.h b/source/cClientHandle.h
index 05ec39f07..dd5094222 100644
--- a/source/cClientHandle.h
+++ b/source/cClientHandle.h
@@ -106,6 +106,7 @@ public:
inline short GetPing() const { return m_Ping; } //tolua_export
void SetViewDistance(int a_ViewDistance); //tolua_export
+ int GetViewDistance() { return m_ViewDistance; }//tolua_export
int GetUniqueID() const { return m_UniqueID; } //tolua_export
diff --git a/source/cEntity.h b/source/cEntity.h
index 1b26f46be..34c878abd 100644
--- a/source/cEntity.h
+++ b/source/cEntity.h
@@ -80,9 +80,9 @@ public: //tolua_export
float GetRoll (void) const {return m_Rot.z; } //tolua_export
Vector3f GetLookVector(); //tolua_export
- int GetChunkX(void) const {return m_ChunkX; }
- int GetChunkY(void) const {return m_ChunkY; }
- int GetChunkZ(void) const {return m_ChunkZ; }
+ int GetChunkX(void) const {return m_ChunkX; } //tolua_export
+ int GetChunkY(void) const {return m_ChunkY; } //tolua_export
+ int GetChunkZ(void) const {return m_ChunkZ; } //tolua_export
void SetPosX( const double & a_PosX ); //tolua_export
void SetPosY( const double & a_PosY ); //tolua_export
diff --git a/source/cServer.cpp b/source/cServer.cpp
index d8e3506dc..332631b47 100644
--- a/source/cServer.cpp
+++ b/source/cServer.cpp
@@ -464,66 +464,6 @@ bool cServer::Command( cClientHandle & a_Client, const char* a_Cmd )
{
return true;
}
-
- std::string Command( a_Cmd );
- if( Command.length() <= 0 ) return false;
- if( Command[0] != '/' ) return false;
-
- AStringVector split = StringSplit( Command, " " );
- if( split.size() == 0 )
- return false;
-
- if (split[0].compare("/coords") == 0)
- {
- AString Pos;
- Printf(Pos, "[X:%0.2f] [Y:%0.2f] [Z:%0.2f]", a_Client.GetPlayer()->GetPosX(), a_Client.GetPlayer()->GetPosY(), a_Client.GetPlayer()->GetPosZ() );
- a_Client.Send( cPacket_Chat(cChatColor::Green + Pos));
- return true;
- }
-
- if (split[0].compare("/viewdistance") == 0)
- {
- if (split.size() != 2)
- {
- a_Client.Send(cPacket_Chat(cChatColor::Green + "Invalid syntax, expected 1 parameter, the number of chunks to stream"));
- return false;
- }
- int dist = atol(split[1].c_str());
- a_Client.SetViewDistance(dist);
- return true;
- }
-
- if (split[0].compare("/regeneratechunk") == 0)
- {
- if (!a_Client.GetPlayer()->HasPermission("builtin.regeneratechunk"))
- {
- a_Client.Send(cPacket_Chat(cChatColor::Green + "You don't have permissions to regenerate chunks"));
- return true;
- }
- int ChunkX, ChunkZ;
- if (split.size() == 1)
- {
- // Regenerate current chunk
- ChunkX = a_Client.GetPlayer()->GetChunkX();
- ChunkZ = a_Client.GetPlayer()->GetChunkZ();
- }
- else if (split.size() == 3)
- {
- // Regenerate chunk in params
- ChunkX = atoi(split[1].c_str());
- ChunkZ = atoi(split[2].c_str());
- }
- else
- {
- a_Client.Send(cPacket_Chat(cChatColor::Green + "Invalid syntax, expected either 0 (current chunk) or 2 (x, z) parameters"));
- return false;
- }
- AString Msg;
- Printf(Msg, "Regenerating chunk [%d, %d]", ChunkX, ChunkZ);
- a_Client.Send(cPacket_Chat(cChatColor::Green + Msg));
- a_Client.GetPlayer()->GetWorld()->RegenerateChunk(ChunkX, ChunkZ);
- return true;
- }
return false;
}
diff --git a/source/cWorld.h b/source/cWorld.h
index 29b7fce72..d5916807a 100644
--- a/source/cWorld.h
+++ b/source/cWorld.h
@@ -177,7 +177,7 @@ public:
void ChunksStay(const cChunkCoordsList & a_Chunks, bool a_Stay = true);
/// Regenerate the given chunk:
- void RegenerateChunk(int a_ChunkX, int a_ChunkZ);
+ void RegenerateChunk(int a_ChunkX, int a_ChunkZ); //tolua_export
// TODO: Export to Lua
bool DoWithEntity( int a_UniqueID, cEntityCallback & a_Callback );