Please help with Hotkeys!

ozolos

Chieftain
Joined
Sep 26, 2016
Messages
4
So eventually I believe every button in the interface should be able to have a user defined hotkey (even though most be will empty by default.)

But to start, I am missing the "Fortify until Healed" hotkey like crazy and want to figure out how to add it.

I've scoured the Assets folder and this is what I've found so far:

In Assets/Gameplay/Data/UnitOperations.xml I added:
Code:
<Row
  OperationType="UNITOPERATION_HEAL"
  Sound="UNIT_FORTIFY"
  VisibleInUI="true"
  HoldCycling="false"
  CategoryInUI="INPLACE"
  Icon="ICON_UNITOPERATION_HEAL"
  Description="LOC_UNITOPERATION_HEAL_DESCRIPTION"
  HotkeyId="Heal"
/>

And in Assets/Text/en_US/UI_Options_Text.xml:

Code:
<Row Tag="LOC_OPTIONS_HOTKEY_UNIT_HEAL">
    <Text>Heal</Text>
</Row>
...
<Row Tag="LOC_OPTIONS_HOTKEY_UNIT_HEAL_HELP">
    <Text>Fortifies the selected unit until it is healed.</Text>
</Row>

But nothing is showing up in my Options Keybindings...

I checked out the Assets/UI/Options.lua and it has this for keybindings:

Code:
-- Key binding infrastructure.
function RefreshKeyBinding()
  local ActionIdIndex = 1;
  local ActionNameIndex = 2;
  local ActionCategoryIndex = 3;
  local Gesture1Index = 4;
  local Gesture2Index = 5;

  local actions = {};
  local count = Input.GetActionCount();
  for i = 0, count - 1, 1 do
    local action = Input.GetActionId(i);
    local info = {
      action,
      Locale.Lookup(Input.GetActionName(action)),
      Locale.Lookup(Input.GetActionCategory(action)),
      Input.GetGestureDisplayString(action, 0) or false,
      Input.GetGestureDisplayString(action, 1) or false
    };
    table.insert(actions, info);
  end

  table.sort(actions, function(a, b)
    local result = Locale.Compare(a[ActionCategoryIndex], b[ActionCategoryIndex]);
    if(result == 0) then
      return Locale.Compare(a[ActionNameIndex], b[ActionNameIndex]) == -1;
    else
      return result == -1;
    end
  end);


It looks likes it's getting them from Locale and Input - but I'm not very familiar with Lua or Civ modding, so I'm not sure how to continue. Any ideas or suggestions?
 
Last edited:
Top Bottom