Skip to content

Commit

Permalink
rename onReadGameDbsAtStart
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnTW committed Dec 23, 2024
1 parent 86dfc05 commit fb46e82
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions M2TWEOP Code/M2TWEOP library/luaPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 13 additions & 6 deletions M2TWEOP Code/M2TWEOP library/types/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,10 @@ void onReadGameDbsAtStart()
{
tryLua((*plugData::data.luaAll.onReadGameDbsAtStart)());
}
if (plugData::data.luaAll.onEduParsed != nullptr)
{
tryLua((*plugData::data.luaAll.onEduParsed)());
}
}

void onGameInit()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit fb46e82

Please sign in to comment.