I need some help understanding how to make UI mods compatible. I use @sukritact 's Simple UI Adjustments and would like to make my mod compatible with it if possible. Simple UI makes some changes to specific functions in CityBannerManager.lua through the use of ReplaceUIScript. I am changing a different function in the same file that Sukritact did not touch and also using ReplaceUIScript. Seems like there should be a way to make things compatible since there is no overlap in the functions we are modifying.
Currently my mod is loading after Sukritact's mod and it appears my changes to CityBannerManager are working, but Sukritact's do not when my mod is active. For example, when hovering over the city banner it does not show me what tiles the citizens are working like it normally does when Simple UI is working.
One question I had - is there a difference between "include("CityBannerManager.lua");" and "include("CityBannerManager");" ?
Here is a condensed version of Simple UI's modinfo and LUA. I think the details of the functions are probably not important to the discussion, but I could include more code if needed.
CityBannerManager_Suk_UI.lua:
Here is the related portion of my modinfo and LUA. I think I do not need to create BASE_* function pointers and call them like Sukritact did for some functions because I copied the entire contents of the original function and then changed a few lines. Correct me if I am wrong about that.
CityBannerManager_KeyLoyalty.lua:
P.S. I see no errors in the log files.
Currently my mod is loading after Sukritact's mod and it appears my changes to CityBannerManager are working, but Sukritact's do not when my mod is active. For example, when hovering over the city banner it does not show me what tiles the citizens are working like it normally does when Simple UI is working.
One question I had - is there a difference between "include("CityBannerManager.lua");" and "include("CityBannerManager");" ?
Here is a condensed version of Simple UI's modinfo and LUA. I think the details of the functions are probably not important to the discussion, but I could include more code if needed.
Spoiler Simple UI Adjustment Code :
Code:
<ReplaceUIScript id="Replace_CityBannerManager">
<Properties>
<LuaContext>CityBannerManager</LuaContext>
<LuaReplace>UI/Common/CityBannerManager_Suk_UI.lua</LuaReplace>
</Properties>
</ReplaceUIScript>
Code:
include("CityBannerManager.lua");
BASE_CityBanner_Initialize = CityBanner.Initialize
function CityBanner:Initialize( playerID: number, cityID : number, districtID : number, bannerType : number, bannerStyle : number)
BASE_CityBanner_Initialize(self, playerID, cityID, districtID, bannerType, bannerStyle)
...
end
if not OnPopulationIconClicked then
function OnPopulationIconClicked(playerID: number, cityID: number)
...
end
end
function SetReligionTooltip(tControl, pCity)
...
end
BASE_CityBanner_UpdateReligion = CityBanner.UpdateReligion
function CityBanner.UpdateReligion(self)
BASE_CityBanner_UpdateReligion(self)
...
end
Here is the related portion of my modinfo and LUA. I think I do not need to create BASE_* function pointers and call them like Sukritact did for some functions because I copied the entire contents of the original function and then changed a few lines. Correct me if I am wrong about that.
Spoiler Key Loyalties Code :
Code:
<ReplaceUIScript id="ReplaceCityBannerLoyalty">
<Properties>
<LuaContext>CityBannerManager</LuaContext>
<LuaReplace>CityBannerManager_KeyLoyalty.lua</LuaReplace>
<LoadOrder>333</LoadOrder>
</Properties>
</ReplaceUIScript>
Code:
include("CityBannerManager");
function CityBanner:UpdateLoyalty()
...
end
P.S. I see no errors in the log files.
Last edited: