Ticket #1187: Ticket#1187_V6.2.patch

File Ticket#1187_V6.2.patch, 3.7 KB (added by James, 12 years ago)

or maybe this one...

  • data/config/default.cfg

     
    190190hotkey.timewarp.fastforward = Space         ; If timewarp mode enabled, speed up the game
    191191hotkey.timewarp.rewind = Backspace          ; If timewarp mode enabled, go back to earlier point in the game
    192192
     193
    193194; > OVERLAY KEYS
    194195hotkey.fps.toggle = "Alt+F"                  ; Toggle frame counter
    195196hotkey.session.devcommands.toggle = "Alt+D"  ; Toggle developer commands panel
    196197hotkey.session.gui.toggle = "Alt+G"          ; Toggle visibility of session GUI
    197198hotkey.menu.toggle = "F10"                   ; Toggle in-game menu
    198199hotkey.timeelapsedcounter.toggle = "F12"     ; Toggle time elapsed counter
     200hotkey.healthbars.toggle = Tab               ; Toggle display of health bars
    199201
     202
    200203; > HOTKEYS ONLY
    201204hotkey.chat = Return                        ; Toggle chat window
    202205
  • data/mods/public/gui/session/input.js

     
    5252var doublePressTimer = 0;
    5353var prevHotkey = 0;
    5454
     55// Some variables for status bar hotkey
     56var entsOnScreen = {};
     57var showStatusBars = false;
     58
    5559function updateCursorAndTooltip()
    5660{
    5761    var cursorSet = false;
     
    8387        Engine.SetCursor("arrow-default");
    8488    if (!tooltipSet)
    8589        informationTooltip.hidden = true;
     90    if(showStatusBars)
     91            allStatusBars(Engine.PickFriendlyEntitiesOnScreen(Engine.GetPlayerID()));
    8692}
    8793
    8894function updateBuildingPlacementPreview()
     
    760766            Engine.RewindTimeWarp();
    761767    }
    762768
     769
     770    if (ev.type == "hotkeydown" && ev.hotkey == "healthbars.toggle")
     771            showStatusBars = true;
     772    if (ev.type == "hotkeyup" && ev.hotkey == "healthbars.toggle")
     773    {
     774        showStatusBars = false;
     775        Engine.GuiInterfaceCall("SetStatusBars", { "entities":entsOnScreen, "enabled":false });
     776        Engine.GuiInterfaceCall("SetStatusBars", { "entities":Engine.PickEntitiesAtPoint(mouseX, mouseY), "enabled":true });
     777    }
     778   
    763779    // State-machine processing:
    764780
    765781    switch (inputState)
     
    14121428{
    14131429    Engine.PostNetworkCommand({"type": "unload-all", "garrisonHolder": garrisonHolder});
    14141430}
     1431
     1432
     1433// Set all inactive status bars on screen to active, removes those off screen
     1434function allStatusBars(ents)
     1435{
     1436    temp = entsOnScreen;
     1437    entsOnScreen = ents;
     1438    if(temp.length > 0)
     1439    {
     1440        for (var ent in entsOnScreen)
     1441        {   
     1442            if (temp.indexOf(entsOnScreen[ent]) >=0)
     1443            {
     1444                if(temp.length == 1 && temp[0] == entsOnScreen[ent])
     1445                    temp = [];
     1446                temp.splice(temp.indexOf(entsOnScreen[ent]), 1);
     1447            }
     1448        }
     1449    }
     1450    for (var ent in g_Selection.toList())
     1451    {   
     1452        if (entsOnScreen.indexOf(g_Selection.toList()[ent]) >=0)
     1453            entsOnScreen.splice(entsOnScreen.indexOf(g_Selection.toList()[ent]), 1);
     1454        if (entsOnScreen.indexOf(g_Selection.toList()[ent]) >=0)
     1455        {
     1456            if(temp.length == 1 && temp[i] == g_Selection.toList()[ent])
     1457                temp = {};
     1458            temp.splice(temp.indexOf(g_Selection.toList()[ent]), 1);
     1459        }
     1460    }
     1461    for (var ent in g_Selection.toList())
     1462    {   
     1463        if (entsOnScreen.indexOf(g_Selection.toList()[ent]) >=0)
     1464            entsOnScreen.splice(entsOnScreen.indexOf(g_Selection.toList()[ent]), 1);
     1465        if (entsOnScreen.indexOf(g_Selection.toList()[ent]) >=0)
     1466        {
     1467            if(temp.length == 1 && temp[i] == g_Selection.toList()[ent])
     1468                temp = {};
     1469            temp.splice(temp.indexOf(g_Selection.toList()[ent]), 1);
     1470        }
     1471    }
     1472    Engine.GuiInterfaceCall("SetStatusBars", { "entities":entsOnScreen, "enabled":true });
     1473    Engine.GuiInterfaceCall("SetStatusBars", { "entities":temp, "enabled":false });
     1474}
     1475 No newline at end of file