- added two new lua functions:

networkSetCameraPositionForFaction(int factionIndex,Vec2i pos)
networkSetCameraPositionForTeam(int teamIndex, Vec2i pos)
This commit is contained in:
Mark Vejvoda 2012-10-10 18:28:55 +00:00
parent 84452f8633
commit 4a63060b71
2 changed files with 42 additions and 0 deletions

View File

@ -243,6 +243,9 @@ void ScriptManager::init(World* world, GameCamera *gameCamera, const XmlNode *ro
luaScript.registerFunction(networkShowMessageForFaction, "networkShowMessageForFaction");
luaScript.registerFunction(networkShowMessageForTeam, "networkShowMessageForTeam");
luaScript.registerFunction(networkSetCameraPositionForFaction, "networkSetCameraPositionForFaction");
luaScript.registerFunction(networkSetCameraPositionForTeam, "networkSetCameraPositionForTeam");
luaScript.registerFunction(showMessage, "showMessage");
luaScript.registerFunction(setDisplayText, "setDisplayText");
luaScript.registerFunction(addConsoleText, "addConsoleText");
@ -827,6 +830,26 @@ void ScriptManager::networkShowMessageForTeam(const string &text, const string &
onMessageBoxOk(false);
}
void ScriptManager::networkSetCameraPositionForFaction(int factionIndex, const Vec2i &pos) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(factionIndex == this->world->getThisFactionIndex()) {
gameCamera->centerXZ(pos.x, pos.y);
}
}
void ScriptManager::networkSetCameraPositionForTeam(int teamIndex, const Vec2i &pos) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ScriptManager_STREFLOP_Wrapper streflopWrapper;
if(teamIndex == this->world->getThisTeamIndex()) {
gameCamera->centerXZ(pos.x, pos.y);
}
}
void ScriptManager::showMessage(const string &text, const string &header){
ScriptManager_STREFLOP_Wrapper streflopWrapper;
@ -1600,6 +1623,19 @@ int ScriptManager::networkShowMessageForTeam(LuaHandle* luaHandle){
return luaArguments.getReturnCount();
}
int ScriptManager::networkSetCameraPositionForFaction(LuaHandle* luaHandle){
LuaArguments luaArguments(luaHandle);
thisScriptManager->networkSetCameraPositionForFaction(luaArguments.getInt(-2), luaArguments.getVec2i(-1));
return luaArguments.getReturnCount();
}
int ScriptManager::networkSetCameraPositionForTeam(LuaHandle* luaHandle){
LuaArguments luaArguments(luaHandle);
thisScriptManager->networkSetCameraPositionForTeam(luaArguments.getInt(-2), luaArguments.getVec2i(-1));
return luaArguments.getReturnCount();
}
int ScriptManager::setDisplayText(LuaHandle* luaHandle){
LuaArguments luaArguments(luaHandle);
thisScriptManager->setDisplayText(luaArguments.getString(-1));

View File

@ -241,6 +241,9 @@ private:
void networkShowMessageForFaction(const string &text, const string &header,int factionIndex);
void networkShowMessageForTeam(const string &text, const string &header,int teamIndex);
void networkSetCameraPositionForFaction(int factionIndex, const Vec2i &pos);
void networkSetCameraPositionForTeam(int teamIndex, const Vec2i &pos);
void showMessage(const string &text, const string &header);
void clearDisplayText();
void setDisplayText(const string &text);
@ -363,6 +366,9 @@ private:
static int networkShowMessageForFaction(LuaHandle* luaHandle);
static int networkShowMessageForTeam(LuaHandle* luaHandle);
static int networkSetCameraPositionForFaction(LuaHandle* luaHandle);
static int networkSetCameraPositionForTeam(LuaHandle* luaHandle);
static int showMessage(LuaHandle* luaHandle);
static int setDisplayText(LuaHandle* luaHandle);
static int addConsoleText(LuaHandle* luaHandle);