Scripting work : the tutorial is now completely scripting-powered, nothing hardcoded anymore

This commit is contained in:
Marianne Gagnon 2015-05-21 20:26:28 -04:00
parent 17cfc130d0
commit 0a3daf9484
2 changed files with 8 additions and 7 deletions

View File

@ -101,6 +101,12 @@ namespace Scripting
tobj->setID(*triggerID);
World::getWorld()->getTrack()->getTrackObjectManager()->insertObject(tobj);
}
/** Exits the race to the main menu */
void exitRace()
{
World::getWorld()->scheduleExitRace();
}
}
/** \cond DOXYGEN_IGNORE */
@ -245,7 +251,8 @@ namespace Scripting
r = engine->RegisterGlobalFunction("void createTrigger(const string &in, const Vec3 &in, float distance)",
asFUNCTION(createTrigger), asCALL_CDECL); assert(r >= 0);
r = engine->RegisterGlobalFunction("TrackObject@ getTrackObject(const string &in)", asFUNCTION(getTrackObject), asCALL_CDECL); assert(r >= 0);
r = engine->RegisterGlobalFunction("void exitRace()", asFUNCTION(exitRace), asCALL_CDECL); assert(r >= 0);
// TrackObject
r = engine->RegisterObjectMethod("TrackObject", "void setEnable(bool status)", asMETHOD(TrackObject, setEnable), asCALL_THISCALL); assert(r >= 0);
r = engine->RegisterObjectMethod("TrackObject", "SoundEmitter@ getSoundEmitter()", asMETHOD(TrackObject, getSoundEmitter), asCALL_THISCALL); assert(r >= 0);

View File

@ -940,12 +940,6 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
_("Complete all challenges to unlock the big door!"), true);
}
}
else if (m_action == "tutorial_exit")
{
// TODO: move to scripting
World::getWorld()->scheduleExitRace();
return;
}
else
{
Scripting::ScriptEngine* script_engine =