Merge pull request #1672 from Areloch/ExpandedAssertContext
Some checks are pending
Linux Build / Ubuntu Latest GCC (push) Waiting to run
MacOSX Build / MacOSX Latest Clang (push) Waiting to run
Windows Build / Windows Latest MSVC (push) Waiting to run

Expanded Script Assert Context
This commit is contained in:
Brian Roberts 2026-02-23 22:47:16 -06:00 committed by GitHub
commit 5981154102
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 134 additions and 20 deletions

View file

@ -225,7 +225,16 @@ bool SubScene::evaluateCondition()
Con::setBoolVariable(resVar.c_str(), false);
String command = resVar + "=" + mLoadIf + ";";
Con::evaluatef(command.c_str());
StringTableEntry objectName = getName();
if (objectName != NULL)
objectName = getIdString();
StringTableEntry groupName = getGroup()->getName();
if (groupName != NULL)
groupName = getGroup()->getIdString();
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
Con::evaluate(command.c_str(), false, context);
return Con::getBoolVariable(resVar.c_str());
}
return true;

View file

@ -367,7 +367,17 @@ bool SpawnSphere::testCondition()
String resVar = getIdString() + String(".result");
Con::setBoolVariable(resVar.c_str(), false);
String command = resVar + "=" + mSpawnIf + ";";
Con::evaluatef(command.c_str());
StringTableEntry objectName = getName();
if (objectName != NULL)
objectName = getIdString();
StringTableEntry groupName = getGroup()->getName();
if (groupName != NULL)
groupName = getGroup()->getIdString();
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
Con::evaluate(command.c_str(), false, context);
if (Con::getBoolVariable(resVar.c_str()) == 1)
{
return true;

View file

@ -704,7 +704,17 @@ bool Trigger::testCondition()
String resVar = getIdString() + String(".result");
Con::setBoolVariable(resVar.c_str(), false);
String command = resVar + "=" + mTripIf + ";";
Con::evaluatef(command.c_str());
StringTableEntry objectName = getName();
if (objectName != NULL)
objectName = getIdString();
StringTableEntry groupName = getGroup()->getName();
if (groupName != NULL)
groupName = getGroup()->getIdString();
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
Con::evaluate(command.c_str(), false, context);
if (Con::getBoolVariable(resVar.c_str()) == 1)
{
return true;
@ -742,7 +752,17 @@ void Trigger::potentialEnterObject(GameBase* enter)
{
String command = String("%obj = ") + enter->getIdString() + ";";
command = command + String("%this = ") + getIdString() + ";" + mEnterCommand;
Con::evaluate(command.c_str());
StringTableEntry objectName = getName();
if (objectName != NULL)
objectName = getIdString();
StringTableEntry groupName = getGroup()->getName();
if (groupName != NULL)
groupName = getGroup()->getIdString();
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
Con::evaluate(command.c_str(), false, context);
}
if( mDataBlock && testTrippable() && testCondition())
@ -791,7 +811,17 @@ void Trigger::processTick(const Move* move)
{
String command = String("%obj = ") + remove->getIdString() + ";";
command = command + String("%this = ") + getIdString() + ";" + mLeaveCommand;
Con::evaluate(command.c_str());
StringTableEntry objectName = getName();
if (objectName != NULL)
objectName = getIdString();
StringTableEntry groupName = getGroup()->getName();
if (groupName != NULL)
groupName = getGroup()->getIdString();
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
Con::evaluate(command.c_str(), false, context);
}
if (testTrippable() && testCondition())
mDataBlock->onLeaveTrigger_callback( this, remove );
@ -800,7 +830,18 @@ void Trigger::processTick(const Move* move)
}
if (evalCmD(&mTickCommand))
Con::evaluate(mTickCommand.c_str());
{
StringTableEntry objectName = getName();
if (objectName != NULL)
objectName = getIdString();
StringTableEntry groupName = getGroup()->getName();
if (groupName != NULL)
groupName = getGroup()->getIdString();
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
Con::evaluate(mTickCommand.c_str(), false, context);
}
if (mObjects.size() != 0 && testTrippable() && testCondition())
mDataBlock->onTickTrigger_callback( this );