Sukritact's Modular City Info Stack
Download
Intro:
Spoiler :
Some of you guys may have seen the preview image I posted on the More Civs thread for Tibet:
An icon is used to add info into the City Screen without actually modifying the City Screen itself, thus allowing modders to supply players with extra info without sacrificing compatibility with mods that modify the City Screen.
The downside is only one mod of this type can be active at a time, else they overlap. The Modular City Info Stack fixes this, allowing modders to add as many icons as they'd like:
The icons are modular and flexible, modders can now provide much more info and interactivity on a city to city level without sacrificing compatibility. Icons can be used to provide info:
trigger popups
and other things.
An icon is used to add info into the City Screen without actually modifying the City Screen itself, thus allowing modders to supply players with extra info without sacrificing compatibility with mods that modify the City Screen.
The downside is only one mod of this type can be active at a time, else they overlap. The Modular City Info Stack fixes this, allowing modders to add as many icons as they'd like:
The icons are modular and flexible, modders can now provide much more info and interactivity on a city to city level without sacrificing compatibility. Icons can be used to provide info:
trigger popups
[/IMG]
and other things.
For Users
Download and install the mod as any other.
For Modders
Adding support for this mod is similar to adding an entry into the diplocorner dropdown. There is a LuaEvent that will allow you to do so. As an example:
Code:
function CityInfoStackDataRefresh(tCityInfoAddins, tEventsToHook)
table.insert(tCityInfoAddins, {["Key"] = "Tomatekh_Caral", ["SortOrder"] = 1})
table.insert(tEventsToHook, Events.SerialEventCityHexHighlightDirty)
end
LuaEvents.CityInfoStackDataRefresh.Add(CityInfoStackDataRefresh)
LuaEvents.RequestCityInfoStackDataRefresh()
tCityInfoAddins is a table of all the icons that will be generated by the mod, to add your own icon, you simple insert a table with the key (string) of the icon you wish to add, and the priority of the icon (as a reference, I currently have civ specific stuff at 1, Wonders at 2, and everything else at 3). Higher priorities appear higher on the stack.
tEventsToHook is a table of events at which the entire stack will refresh. By default the stack only refreshes on entering the City Screen, if you would like to have it refresh at other events, add them here.
To actually hook an icon, you do something like this:
Code:
function CityInfoStackDirty(sKey, pInstance)
if sKey ~= "Tomatekh_Caral" then return end
IconHookup(iFishingBoatAtlas, 64, sFishingBoatAtlas, pInstance.IconImage)
end
LuaEvents.CityInfoStackDirty.Add(CityInfoStackDirty)
sKey is the key you provided earlier, just check to make sure it's the one you want. You can do practically anything with the instance, add a tooltip, add a callback function etc, but as a reference, the instance has two parts, IconFrame, which is the metallic frame around the icon, and IconImage, which is the actual icon.
Icon size is at 64px
Download