From fb46e828ac3240f5f0e6d770bde00862be1cc1e7 Mon Sep 17 00:00:00 2001 From: FynnTW Date: Mon, 23 Dec 2024 13:38:45 +0200 Subject: [PATCH] rename onReadGameDbsAtStart --- M2TWEOP Code/M2TWEOP library/luaPlugin.h | 1 + M2TWEOP Code/M2TWEOP library/types/events.cpp | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/M2TWEOP Code/M2TWEOP library/luaPlugin.h b/M2TWEOP Code/M2TWEOP library/luaPlugin.h index 72ed6b5c..e08cfa8b 100644 --- a/M2TWEOP Code/M2TWEOP library/luaPlugin.h +++ b/M2TWEOP Code/M2TWEOP library/luaPlugin.h @@ -116,6 +116,7 @@ class luaPlugin sol::function* onCampaignMapLoaded = nullptr; sol::function* onRemoveFromUnitQueue = nullptr; sol::function* onReadGameDbsAtStart = nullptr; + sol::function* onEduParsed = nullptr; sol::function* onGameInit = nullptr; sol::function* onUnloadCampaign = nullptr; sol::function* onAiTurn = nullptr; diff --git a/M2TWEOP Code/M2TWEOP library/types/events.cpp b/M2TWEOP Code/M2TWEOP library/types/events.cpp index 9edf319b..8c10e0e9 100644 --- a/M2TWEOP Code/M2TWEOP library/types/events.cpp +++ b/M2TWEOP Code/M2TWEOP library/types/events.cpp @@ -736,6 +736,10 @@ void onReadGameDbsAtStart() { tryLua((*plugData::data.luaAll.onReadGameDbsAtStart)()); } + if (plugData::data.luaAll.onEduParsed != nullptr) + { + tryLua((*plugData::data.luaAll.onEduParsed)()); + } } void onGameInit() @@ -1358,7 +1362,7 @@ void luaPlugin::onPluginLoadF() @tfield draw draw @tfield onLoadingFonts onLoadingFonts @tfield onNewGameStart onNewGameStart - @tfield onReadGameDbsAtStart onReadGameDbsAtStart + @tfield onEduParsed onEduParsed @tfield onGameInit onGameInit @tfield onUnloadCampaign onUnloadCampaign @tfield onAiTurn onAiTurn @@ -4125,19 +4129,22 @@ void luaPlugin::onPluginLoadF() */ onNewGameStart = new sol::function(luaState["onNewGameStart"]); checkLuaFunc(&onNewGameStart); + + onReadGameDbsAtStart = new sol::function(luaState["onReadGameDbsAtStart"]); + checkLuaFunc(&onReadGameDbsAtStart); /*** - Called after the game reads the EDU at startup (add units here). + Called after the game reads the EDU at startup (add units here). Previously called onReadGameDbsAtStart. - @function onReadGameDbsAtStart + @function onEduParsed @usage - function onReadGameDbsAtStart() + function onEduParsed() --something here end */ - onReadGameDbsAtStart = new sol::function(luaState["onReadGameDbsAtStart"]); - checkLuaFunc(&onReadGameDbsAtStart); + onEduParsed = new sol::function(luaState["onEduParsed"]); + checkLuaFunc(&onEduParsed); /*** Called after the game has loaded to the main menu.