WackySlackyIV / Fodlan-CK3

1 stars 3 forks source link

[Future] Better Support for Fodlan Calendar System #5

Open xhh2a opened 2 years ago

xhh2a commented 2 years ago

Right now we are pretending dates are in the IY system which is offset from AD by 3 months. This means that the number of days/month is incorrect.

In addition we may want to support pre year 0 events in the future.

This issue tracks how we may implement this. https://fireemblem.fandom.com/wiki/F%C3%B3dlan_Calendar https://forum.paradoxplaza.com/forum/threads/mod-the-bronze-age-maryannu.1414700/page-3#post-26949113

  1. Shift all dates up by 1000 years, so year 1000 = year 0 IY
  2. Shift months by 3, so coding in history June (6) would show up as Month (3) in game. This will ensure the days/month match
  3. Write two localization strings for all existing usages of $YEAR$ with a conditional [Subtract_int32('(int32)$YEAR$', '(int32)1')], with the conditional check defined in gui/hud.gui

(need to check 0 bounds) localization.yml

CURRENT_DATE_IY_PREV_YEAR: "$DATE$ of $MONTH$, [Subtract_int32('(int32)$YEAR$', '(int32)1001')] IY"
CURRENT_DATE_IY_CUR_YEAR: "$DATE$ of $MONTH$, [Subtract_int32('(int32)$YEAR$', '(int32)1000')] IY"
CURRENT_DATE_BIY_CUR_YEAR: "$DATE$ of $MONTH$, [Subtract_int32('(int32)1000', '(int32)$YEAR$')] BIY"
CURRENT_DATE_BIY_PREV_YEAR: "$DATE$ of $MONTH$, [Subtract_int32('(int32)1001', '(int32)$YEAR$')] BIY"

gui/hud.gui

## Date
                button_standard_hover = {
                    layoutpolicy_horizontal = expanding
                    layoutpolicy_vertical = expanding

                    onclick = "[OnPause]"
                    datacontext = "[GetScriptedGui('fodlan_iy_previous_year')]"
                    visible = "[ScriptedGui.IsShown(GuiScope.SetRoot(Character.MakeScope).End)]"
                    tooltip = "CURRENT_DATE_IY_PREV_YEAR"
                    using = tooltip_nw
                    tooltip_offset = { 0 10 }
                                 ....
                                }
                button_standard_hover = {
                    layoutpolicy_horizontal = expanding
                    layoutpolicy_vertical = expanding

                    onclick = "[OnPause]"
                    datacontext = "[GetScriptedGui('fodlan_iy_current_year')]"
                    visible = "[ScriptedGui.IsShown(GuiScope.SetRoot(Character.MakeScope).End)]"
                    tooltip = "CURRENT_DATE_IY_CUR_YEAR"
                    using = tooltip_nw
                    tooltip_offset = { 0 10 }
                                 ....
                                }
                                button_standard_hover = {
                    layoutpolicy_horizontal = expanding
                    layoutpolicy_vertical = expanding

                    onclick = "[OnPause]"
                    datacontext = "[GetScriptedGui('fodlan_biy_previous_year')]"
                    visible = "[ScriptedGui.IsShown(GuiScope.SetRoot(Character.MakeScope).End)]"
                    tooltip = "CURRENT_DATE_BIY_PREV_YEAR"
                    using = tooltip_nw
                    tooltip_offset = { 0 10 }
                                 ....
                                }
                                button_standard_hover = {
                    layoutpolicy_horizontal = expanding
                    layoutpolicy_vertical = expanding

                    onclick = "[OnPause]"
                    datacontext = "[GetScriptedGui('fodlan_biy_current_year')]"
                    visible = "[ScriptedGui.IsShown(GuiScope.SetRoot(Character.MakeScope).End)]"
                    tooltip = "CURRENT_DATE_BIY_CUR_YEAR"
                    using = tooltip_nw
                    tooltip_offset = { 0 10 }
                                 ....
                                }

common/scripted_triggers/fodlan_calendar.txt

fodlan_previous_year = {
  get_month <= 3
}

fodlan_is_biy = {
  get_year < 1000
}

common/scripted_guis/fodlan_calendar.txt

fodlan_iy_previous_year = {
    AND = {
        fodlan_previous_year = yes
        fodlan_is_biy = no
     }
}

fodlan_iy_current_year = {
    AND = {
        fodlan_previous_year = no
        fodlan_is_biy = no
     }
}

fodlan_biy_previous_year = {
    AND = {
        fodlan_previous_year = yes
        fodlan_is_biy = yes
     }
}

fodlan_biy_current_year = {
    AND = {
        fodlan_previous_year = no
        fodlan_is_biy = yes
     }
}
xhh2a commented 2 years ago

https://ck3.paradoxwikis.com/Data_types Has a list of additional functions that can be used, we probably don't need to modify the gui at all since we can use AddTextIf and other comparator functions

xhh2a commented 2 years ago

Another thing we could potentially do since we have various additional localization functions is to make there be more than 1tick per day but that would require significant changes in the history DB as we will need to convert the dates to some other format.