1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Sukritact's Modular City Info Stack

Discussion in 'Civ5 - Mod Components' started by sukritact, Nov 20, 2014.

  1. sukritact

    sukritact Artist and Modder

    Joined:
    Sep 21, 2010
    Messages:
    2,826
    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

    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
     
  2. JFD

    JFD Kathigitarkh

    Joined:
    Oct 19, 2010
    Messages:
    9,107
    Location:
    The Kingdom of New Zealand
  3. Tomatekh

    Tomatekh Sahib-i-Qirani

    Joined:
    Aug 6, 2012
    Messages:
    1,369
    Honestly, this mod is a godsend. Fantastic work!
     
  4. Gyra Solune

    Gyra Solune King

    Joined:
    Jul 1, 2013
    Messages:
    942
    This looks super convenient! Thanks a bundle~
     
  5. Typhlomence

    Typhlomence Magical Tomomo

    Joined:
    Mar 19, 2014
    Messages:
    394
    Location:
    Brisbane, Australia
    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...
     
  6. Leugi

    Leugi Supreme Libertador

    Joined:
    Jan 25, 2013
    Messages:
    1,673
    Location:
    Bolivia
    Mwahahahahahaha. Excellent thing, must use it somewhere!
     
  7. turingmachine

    turingmachine Emperor

    Joined:
    May 4, 2008
    Messages:
    1,438
    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.
     
  8. sukritact

    sukritact Artist and Modder

    Joined:
    Sep 21, 2010
    Messages:
    2,826
    Location:
    Bangkok
    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.
     
  9. Mewr11

    Mewr11 Warlord

    Joined:
    Dec 13, 2014
    Messages:
    118
    Location:
    Within 5 parsecs of beta centauri
    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?
     
  10. Ondolindë

    Ondolindë Emperor

    Joined:
    Apr 30, 2016
    Messages:
    1,025
    Gender:
    Male
    Location:
    La Paz, Bolivia
    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.
     
  11. Klisz

    Klisz King

    Joined:
    Aug 18, 2014
    Messages:
    805
    The MCIS doesn't do anything by itself. It's simply a tool used by other mods.
     
  12. Ondolindë

    Ondolindë Emperor

    Joined:
    Apr 30, 2016
    Messages:
    1,025
    Gender:
    Male
    Location:
    La Paz, Bolivia
    Got it. Thanks for your answer.
     
  13. X_BriX

    X_BriX Chieftain

    Joined:
    Oct 7, 2016
    Messages:
    66
    Gender:
    Male
    Location:
    Poland
    Would it work with EUI?
     

Share This Page