diff --git a/source/Core.hpp b/source/Core.hpp index 9c9e675f..4e6fcb46 100644 --- a/source/Core.hpp +++ b/source/Core.hpp @@ -817,6 +817,30 @@ public: return m_CircularLocks; } + /* -------------------------------------------------------------------------------------------- + * Retrieve the preload signal if not complete. + */ + LightObj & GetPreLoadEvent() + { + return m_LockPreLoadSignal ? NullLightObj() : mOnPreLoad.second; + } + + /* -------------------------------------------------------------------------------------------- + * Retrieve the postload signal if not complete. + */ + LightObj & GetPostLoadEvent() + { + return m_LockPostLoadSignal ? NullLightObj() : mOnPostLoad.second; + } + + /* -------------------------------------------------------------------------------------------- + * Retrieve the unload signal if not complete. + */ + LightObj & GetUnloadEvent() + { + return m_LockUnloadSignal ? NullLightObj() : mOnUnload.second; + } + /* -------------------------------------------------------------------------------------------- * See if certain circular locks are enabled. */ diff --git a/source/CoreFuncs.cpp b/source/CoreFuncs.cpp index 0a7d1a94..6c786153 100644 --- a/source/CoreFuncs.cpp +++ b/source/CoreFuncs.cpp @@ -50,6 +50,24 @@ static SQInteger SqGetEvents(HSQUIRRELVM vm) return 1; } +// ------------------------------------------------------------------------------------------------ +static LightObj & SqGetPreLoadEvent() +{ + return Core::Get().GetPreLoadEvent(); +} + +// ------------------------------------------------------------------------------------------------ +static LightObj & SqGetPostLoadEvent() +{ + return Core::Get().GetPostLoadEvent(); +} + +// ------------------------------------------------------------------------------------------------ +static LightObj & SqGetUnloadEvent() +{ + return Core::Get().GetUnloadEvent(); +} + // ------------------------------------------------------------------------------------------------ static bool SqGetReloadStatus() { @@ -304,6 +322,9 @@ void Register_Core(HSQUIRRELVM vm) .Func(_SC("DestroyObject"), &DelObject) .Func(_SC("DestroyPickup"), &DelPickup) .Func(_SC("DestroyVehicle"), &DelVehicle) + .Func(_SC("OnPreLoad"), &SqGetPreLoadEvent) + .Func(_SC("OnPostLoad"), &SqGetPostLoadEvent) + .Func(_SC("OnUnload"), &SqGetUnloadEvent) .SquirrelFunc(_SC("LoadScript"), &SqLoadScript) .SquirrelFunc(_SC("On"), &SqGetEvents) );