Ticket #1491: civc_hotkey.patch
File civc_hotkey.patch, 3.4 KB (added by , 12 years ago) |
---|
-
binaries/data/mods/public/gui/session/input.js
1648 1648 currIdleClass = 0; 1649 1649 } 1650 1650 1651 var lastBuilding = 0; 1652 function selectBuilding(entity) 1653 { 1654 if (entity) 1655 { 1656 var data = { prevBuilding: lastBuilding, buildingClass: entity }; 1657 var newBuilding = Engine.GuiInterfaceCall("FindBuilding", data); 1658 if (newBuilding && newBuilding != lastBuilding) 1659 { 1660 lastBuilding = newBuilding; 1661 g_Selection.reset() 1662 g_Selection.addList([lastBuilding]); 1663 Engine.CameraFollow(lastBuilding); 1664 } 1665 } 1666 lastBuilding = 0; 1667 } 1668 1651 1669 function findIdleUnit(classes) 1652 1670 { 1653 1671 // Cycle through idling classes before giving up -
binaries/data/mods/public/gui/session/session.xml
89 89 <action on="Press">findIdleUnit(["Hero", "Champion", "CitizenSoldier", "Siege", "Warship"]);</action> 90 90 </object> 91 91 92 <!-- Select towncenter--> 93 <object hotkey="selection.civilcenter"> 94 <action on="Press">selectBuilding("CivCentre");</action> 95 </object> 96 92 97 <!-- ================================ ================================ --> 93 98 <!-- Developer / Debug items --> 94 99 <!-- ================================ ================================ --> -
binaries/data/mods/public/simulation/components/GuiInterface.js
1452 1452 return 0; 1453 1453 }; 1454 1454 1455 GuiInterface.prototype.FindBuilding = function(player, data) 1456 { 1457 var rangeMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 1458 var playerEntities = rangeMan.GetEntitiesByPlayer(player); 1459 1460 // Find the first matching entity that is after the previous selection, 1461 // so that we cycle around in a predictable order 1462 for each (var ent in playerEntities) 1463 { 1464 var cmpIdentity = Engine.QueryInterface(ent, IID_Identity); 1465 if (ent > data.prevBuilding && cmpIdentity && cmpIdentity.HasClass(data.buildingClass)) 1466 return ent; 1467 } 1468 1469 // No idle entities left in the class 1470 return 0; 1471 }; 1472 1473 1474 1455 1475 GuiInterface.prototype.GetTradingDetails = function(player, data) 1456 1476 { 1457 1477 var cmpEntityTrader = Engine.QueryInterface(data.trader, IID_Trader); … … 1572 1592 "GetFoundationSnapData": 1, 1573 1593 "PlaySound": 1, 1574 1594 "FindIdleUnit": 1, 1595 "FindBuilding": 1, 1575 1596 "GetTradingDetails": 1, 1576 1597 "CanAttack": 1, 1577 1598 -
binaries/data/config/default.cfg
152 152 hotkey.selection.remove = Ctrl ; Remove units from selection 153 153 hotkey.selection.idleworker = Period ; Select next idle worker 154 154 hotkey.selection.idlewarrior = Comma ; Select next idle warrior 155 hotkey.selection.civilcenter = H ; Select towncenter 155 156 hotkey.selection.offscreen = Alt ; Include offscreen units in selection 156 157 hotkey.selection.group.select.0 = 0 157 158 hotkey.selection.group.save.0 = "Ctrl+0"