mirror of
https://github.com/glest/glest-source.git
synced 2025-08-27 01:44:23 +02:00
- added new lua method lastDeadUnitCauseOfDeath, possible int values are:
None = 0 Attacked = 1 AttackBoost = 2 StarvedResource = 3 StarvedRegeneration = 4
This commit is contained in:
@@ -147,6 +147,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera){
|
|||||||
|
|
||||||
luaScript.registerFunction(getLastDeadUnitName, "lastDeadUnitName");
|
luaScript.registerFunction(getLastDeadUnitName, "lastDeadUnitName");
|
||||||
luaScript.registerFunction(getLastDeadUnitId, "lastDeadUnit");
|
luaScript.registerFunction(getLastDeadUnitId, "lastDeadUnit");
|
||||||
|
luaScript.registerFunction(getLastDeadUnitCauseOfDeath, "lastDeadUnitCauseOfDeath");
|
||||||
|
|
||||||
luaScript.registerFunction(getLastAttackedUnitName, "lastAttackedUnitName");
|
luaScript.registerFunction(getLastAttackedUnitName, "lastAttackedUnitName");
|
||||||
luaScript.registerFunction(getLastAttackedUnitId, "lastAttackedUnit");
|
luaScript.registerFunction(getLastAttackedUnitId, "lastAttackedUnit");
|
||||||
@@ -174,6 +175,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera){
|
|||||||
//last created unit
|
//last created unit
|
||||||
lastCreatedUnitId= -1;
|
lastCreatedUnitId= -1;
|
||||||
lastDeadUnitId= -1;
|
lastDeadUnitId= -1;
|
||||||
|
lastDeadUnitCauseOfDeath = ucodNone;
|
||||||
|
|
||||||
lastAttackedUnitName = "";
|
lastAttackedUnitName = "";
|
||||||
lastAttackedUnitId = -1;
|
lastAttackedUnitId = -1;
|
||||||
@@ -231,6 +233,8 @@ void ScriptManager::onUnitDied(const Unit* unit){
|
|||||||
|
|
||||||
lastDeadUnitName= unit->getType()->getName();
|
lastDeadUnitName= unit->getType()->getName();
|
||||||
lastDeadUnitId= unit->getId();
|
lastDeadUnitId= unit->getId();
|
||||||
|
lastDeadUnitCauseOfDeath = unit->getCauseOfDeath();
|
||||||
|
|
||||||
luaScript.beginCall("unitDied");
|
luaScript.beginCall("unitDied");
|
||||||
luaScript.endCall();
|
luaScript.endCall();
|
||||||
}
|
}
|
||||||
@@ -929,6 +933,12 @@ int ScriptManager::getLastDeadUnitId() {
|
|||||||
return lastDeadUnitId;
|
return lastDeadUnitId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ScriptManager::getLastDeadUnitCauseOfDeath() {
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||||
|
return lastDeadUnitCauseOfDeath;
|
||||||
|
}
|
||||||
|
|
||||||
const string &ScriptManager::getLastAttackedUnitName() {
|
const string &ScriptManager::getLastAttackedUnitName() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||||
@@ -1369,6 +1379,12 @@ int ScriptManager::getLastDeadUnitId(LuaHandle* luaHandle){
|
|||||||
return luaArguments.getReturnCount();
|
return luaArguments.getReturnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ScriptManager::getLastDeadUnitCauseOfDeath(LuaHandle* luaHandle){
|
||||||
|
LuaArguments luaArguments(luaHandle);
|
||||||
|
luaArguments.returnInt(thisScriptManager->getLastDeadUnitCauseOfDeath());
|
||||||
|
return luaArguments.getReturnCount();
|
||||||
|
}
|
||||||
|
|
||||||
int ScriptManager::getLastAttackedUnitName(LuaHandle* luaHandle) {
|
int ScriptManager::getLastAttackedUnitName(LuaHandle* luaHandle) {
|
||||||
LuaArguments luaArguments(luaHandle);
|
LuaArguments luaArguments(luaHandle);
|
||||||
luaArguments.returnString(thisScriptManager->getLastAttackedUnitName());
|
luaArguments.returnString(thisScriptManager->getLastAttackedUnitName());
|
||||||
|
@@ -128,6 +128,7 @@ private:
|
|||||||
//last dead unit
|
//last dead unit
|
||||||
string lastDeadUnitName;
|
string lastDeadUnitName;
|
||||||
int lastDeadUnitId;
|
int lastDeadUnitId;
|
||||||
|
int lastDeadUnitCauseOfDeath;
|
||||||
|
|
||||||
//last attacked unit
|
//last attacked unit
|
||||||
string lastAttackedUnitName;
|
string lastAttackedUnitName;
|
||||||
@@ -251,6 +252,8 @@ private:
|
|||||||
|
|
||||||
const string &getLastDeadUnitName();
|
const string &getLastDeadUnitName();
|
||||||
int getLastDeadUnitId();
|
int getLastDeadUnitId();
|
||||||
|
int getLastDeadUnitCauseOfDeath();
|
||||||
|
|
||||||
|
|
||||||
const string &getLastAttackedUnitName();
|
const string &getLastAttackedUnitName();
|
||||||
int getLastAttackedUnitId();
|
int getLastAttackedUnitId();
|
||||||
@@ -333,6 +336,7 @@ private:
|
|||||||
|
|
||||||
static int getLastDeadUnitName(LuaHandle* luaHandle);
|
static int getLastDeadUnitName(LuaHandle* luaHandle);
|
||||||
static int getLastDeadUnitId(LuaHandle* luaHandle);
|
static int getLastDeadUnitId(LuaHandle* luaHandle);
|
||||||
|
static int getLastDeadUnitCauseOfDeath(LuaHandle* luaHandle);
|
||||||
|
|
||||||
static int getLastAttackedUnitName(LuaHandle* luaHandle);
|
static int getLastAttackedUnitName(LuaHandle* luaHandle);
|
||||||
static int getLastAttackedUnitId(LuaHandle* luaHandle);
|
static int getLastAttackedUnitId(LuaHandle* luaHandle);
|
||||||
|
Reference in New Issue
Block a user