- Timestamp:
- 07/10/11 04:11:51 (14 years ago)
- Location:
- ps/trunk/binaries/data
- Files:
-
- 8 edited
-
config/default.cfg (modified) (1 diff)
-
mods/public/gui/session/input.js (modified) (4 diffs)
-
mods/public/gui/session/session.xml (modified) (2 diffs)
-
mods/public/simulation/components/GuiInterface.js (modified) (4 diffs)
-
mods/public/simulation/components/Identity.js (modified) (1 diff)
-
mods/public/simulation/templates/template_unit_mechanical_ship_bireme.xml (modified) (1 diff)
-
mods/public/simulation/templates/template_unit_mechanical_ship_quinquereme.xml (modified) (1 diff)
-
mods/public/simulation/templates/template_unit_mechanical_ship_trireme.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/config/default.cfg
r9658 r9791 137 137 hotkey.selection.add = Shift ; Add units to selection 138 138 hotkey.selection.remove = Ctrl ; Remove units from selection 139 hotkey.selection.idle = Period ; Select next idle unit 139 hotkey.selection.idleworker = Period ; Select next idle worker 140 hotkey.selection.idlewarrior = Comma ; Select next idle warrior 140 141 hotkey.selection.offscreen = Alt ; Include offscreen units in selection 141 142 hotkey.selection.group.select.0 = 0 -
ps/trunk/binaries/data/mods/public/gui/session/input.js
r9764 r9791 338 338 { 339 339 // invalid location - don't build it 340 // TODO: play a sound? 340 341 return false; 341 342 } … … 734 735 { 735 736 g_Selection.reset(); 737 resetIdleUnit(); 736 738 inputState = INPUT_NORMAL; 737 739 return true; … … 919 921 case "garrison": 920 922 Engine.PostNetworkCommand({"type": "garrison", "entities": selection, "target": action.target, "queued": queued}); 921 // Need to play some sound here??923 // TODO: Play a sound? 922 924 return true; 923 925 … … 1196 1198 } 1197 1199 1198 var lastIdle Worker= 0;1200 var lastIdleUnit = 0; 1199 1201 var currIdleClass = 0; 1200 function findIdleWorker() 1202 1203 function resetIdleUnit() 1204 { 1205 lastIdleUnit = 0; 1206 currIdleClass = 0; 1207 } 1208 1209 function findIdleUnit(classes) 1201 1210 { 1202 1211 // Cycle through idling classes before giving up 1203 var idleClasses = ["Worker", "Trade", "CitizenSoldier"]; 1204 for (var i = 0; i <= idleClasses.length; ++i) 1205 { 1206 var data = { prevWorker: lastIdleWorker, idleClass: idleClasses[currIdleClass] }; 1207 lastIdleWorker = Engine.GuiInterfaceCall("FindIdleWorker", data); 1212 for (var i = 0; i <= classes.length; ++i) 1213 { 1214 var data = { prevUnit: lastIdleUnit, idleClass: classes[currIdleClass] }; 1215 var newIdleUnit = Engine.GuiInterfaceCall("FindIdleUnit", data); 1208 1216 1209 // Check if we have valid entity 1210 if (lastIdleWorker) 1211 { 1217 // Check if we have new valid entity 1218 if (newIdleUnit && newIdleUnit != lastIdleUnit) 1219 { 1220 lastIdleUnit = newIdleUnit; 1212 1221 g_Selection.reset() 1213 g_Selection.addList([lastIdle Worker]);1214 Engine.CameraFollow(lastIdle Worker);1222 g_Selection.addList([lastIdleUnit]); 1223 Engine.CameraFollow(lastIdleUnit); 1215 1224 1216 1225 return; 1217 1226 } 1218 1227 1219 lastIdle Worker= 0;1220 currIdleClass = (currIdleClass + 1) % idleClasses.length;1228 lastIdleUnit = 0; 1229 currIdleClass = (currIdleClass + 1) % classes.length; 1221 1230 } 1222 1231 1223 1232 // TODO: display a message or play a sound to indicate no more idle units, or something 1224 1233 // Reset for next cycle 1225 currIdleClass = 0;1234 resetIdleUnit(); 1226 1235 } 1227 1236 -
ps/trunk/binaries/data/mods/public/gui/session/session.xml
r9780 r9791 83 83 <object hotkey="camera.follow"> 84 84 <action on="Press">setCameraFollow(g_Selection.toList()[0]);</action> 85 </object> 86 87 <!-- Find idle warrior - TODO: Potentially move this to own UI button? --> 88 <object hotkey="selection.idlewarrior"> 89 <action on="Press">findIdleUnit(["Hero", "Super", "CitizenSoldier", "Siege", "Warship"]);</action> 85 90 </object> 86 91 … … 446 451 tooltip_style="sessionToolTip" 447 452 tooltip="Find idle worker" 448 hotkey="selection.idle "453 hotkey="selection.idleworker" 449 454 > 450 455 <!-- TODO: should highlight the button if there's non-zero idle workers --> 451 456 <object size="0 0 100% 100%" type="image" sprite="idleWorker" ghost="true" /> 452 <action on="Press">findIdle Worker();</action>457 <action on="Press">findIdleUnit(["Worker", "Trade", "CitizenSoldier"]);</action> 453 458 </object> 454 459 </object> -
ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
r9726 r9791 504 504 }; 505 505 506 function isIdle Worker(ent, idleClass)506 function isIdleUnit(ent, idleClass) 507 507 { 508 508 var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); … … 513 513 } 514 514 515 GuiInterface.prototype.FindIdle Worker= function(player, data)515 GuiInterface.prototype.FindIdleUnit = function(player, data) 516 516 { 517 517 var rangeMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); … … 522 522 for each (var ent in playerEntities) 523 523 { 524 if (ent > data.prev Worker && isIdleWorker(ent, data.idleClass))524 if (ent > data.prevUnit && isIdleUnit(ent, data.idleClass)) 525 525 return ent; 526 526 } … … 585 585 "SetBuildingPlacementPreview": 1, 586 586 "PlaySound": 1, 587 "FindIdle Worker": 1,587 "FindIdleUnit": 1, 588 588 589 589 "SetPathfinderDebugOverlay": 1, -
ps/trunk/binaries/data/mods/public/simulation/components/Identity.js
r9776 r9791 90 90 "<value>CitizenSoldier</value>" + 91 91 "<value>Trade</value>" + 92 "<value>Warship</value>" + 92 93 "<value a:help='Primary weapon type'>Bow</value>" + // TODO: what are these used for? 93 94 "<value a:help='Primary weapon type'>Javelin</value>" + -
ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_bireme.xml
r9598 r9791 4 4 <GenericName>Light Warship</GenericName> 5 5 <Tooltip>Light Warship.</Tooltip> 6 <Classes datatype="tokens">Warship</Classes> 6 7 </Identity> 7 8 <Cost> -
ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_quinquereme.xml
r9762 r9791 4 4 <GenericName>Heavy Warship</GenericName> 5 5 <Tooltip>Heavy Warship.</Tooltip> 6 <Classes datatype="tokens">Warship</Classes> 6 7 </Identity> 7 8 <Cost> -
ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_mechanical_ship_trireme.xml
r9762 r9791 4 4 <GenericName>Medium Warship</GenericName> 5 5 <Tooltip>Medium Warship.</Tooltip> 6 <Classes datatype="tokens">Warship</Classes> 6 7 </Identity> 7 8 <Cost>
Note:
See TracChangeset
for help on using the changeset viewer.
