Sukritact's Modular City Info Stack

sukritact

Artist and Modder
Joined
Sep 21, 2010
Messages
2,931
Location
Bangkok
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



[/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
 
Definitely a great idea! While it might be a bit tricky for me, I might add some support for this in my mods since I feel they could make use of it...
 
Mwahahahahahaha. Excellent thing, must use it somewhere!
 
This looks really neat, and I hope more modders will start using it. There are a ton of mods with extra abilities but that don't really give you all the information needed when using it. I assumed it was difficulty modding the interface, so this should help immensely.
 
MCIS has been updated, the latest version should be able to be included/integrated directly into other mods. Just hook it into your mod like you would any UI component. The means of providing actual support remains the same, so this update won't break any mods currently providing support.
 
I'm getting pretty sever lag in cities with an info stack, but none in cities without them. Any ideas on what might be causing this?
 
I was wondering if any one can help me. I did as it says in the instructions:Download and install the mod as any other. I did, meaning placing it in the MODS folder and then activating it in the MODS Menu, but it doesn`t work. Any help would be much appreciated.
 
I was wondering if any one can help me. I did as it says in the instructions:Download and install the mod as any other. I did, meaning placing it in the MODS folder and then activating it in the MODS Menu, but it doesn`t work. Any help would be much appreciated.

The MCIS doesn't do anything by itself. It's simply a tool used by other mods.
 
Top Bottom