Changeset View
Changeset View
Standalone View
Standalone View
source/ps/scripting/JSInterface_Mod.cpp
Show All 23 Lines | |||||
extern void RestartEngine(); | extern void RestartEngine(); | ||||
JS::Value JSI_Mod::GetEngineInfo(ScriptInterface::CxPrivate* pCxPrivate) | JS::Value JSI_Mod::GetEngineInfo(ScriptInterface::CxPrivate* pCxPrivate) | ||||
{ | { | ||||
return Mod::GetEngineInfo(*(pCxPrivate->pScriptInterface)); | return Mod::GetEngineInfo(*(pCxPrivate->pScriptInterface)); | ||||
} | } | ||||
/** | |||||
* Returns a JS object containing a listing of available mods that | |||||
* have a modname.json file in their modname folder. The returned | |||||
* object looks like { modname1: json1, modname2: json2, ... } where | |||||
* jsonN is the content of the modnameN/modnameN.json file as a JS | |||||
* object. | |||||
* | |||||
* @return JS object with available mods as the keys of the modname.json | |||||
* properties. | |||||
*/ | |||||
JS::Value JSI_Mod::GetAvailableMods(ScriptInterface::CxPrivate* pCxPrivate) | |||||
{ | |||||
return Mod::GetAvailableMods(*(pCxPrivate->pScriptInterface)); | |||||
} | |||||
void JSI_Mod::RestartEngine(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) | void JSI_Mod::RestartEngine(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) | ||||
{ | { | ||||
::RestartEngine(); | ::RestartEngine(); | ||||
} | } | ||||
void JSI_Mod::SetMods(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::vector<CStr>& mods) | void JSI_Mod::SetMods(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::vector<CStr>& mods) | ||||
{ | { | ||||
g_modsLoaded = mods; | g_modsToLoad = mods; | ||||
} | } | ||||
void JSI_Mod::RegisterScriptFunctions(const ScriptInterface& scriptInterface) | void JSI_Mod::RegisterScriptFunctions(const ScriptInterface& scriptInterface) | ||||
{ | { | ||||
scriptInterface.RegisterFunction<JS::Value, &GetEngineInfo>("GetEngineInfo"); | scriptInterface.RegisterFunction<JS::Value, &GetEngineInfo>("GetEngineInfo"); | ||||
scriptInterface.RegisterFunction<JS::Value, &JSI_Mod::GetAvailableMods>("GetAvailableMods"); | |||||
Imarok: modmod is crying.
(You should test the mod selector when changing things with mod loading) | |||||
wraitiiUnsubmitted Not Done Inline ActionsAck, I did forget that. The existence of this function now makes sense, but it really shouldn't be used in GetEngineInfo. wraitii: Ack, I did forget that. The existence of this function now makes sense, but it really shouldn't… | |||||
scriptInterface.RegisterFunction<void, &JSI_Mod::RestartEngine>("RestartEngine"); | scriptInterface.RegisterFunction<void, &JSI_Mod::RestartEngine>("RestartEngine"); | ||||
scriptInterface.RegisterFunction<void, std::vector<CStr>, &JSI_Mod::SetMods>("SetMods"); | scriptInterface.RegisterFunction<void, std::vector<CStr>, &JSI_Mod::SetMods>("SetMods"); | ||||
} | } |
Wildfire Games · Phabricator
modmod is crying.
(You should test the mod selector when changing things with mod loading)