...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
function iHave(structure) { var list = enumStruct(me,structure); return (list.length && list[0].status = BUILT); // true = structure is built, false = no structure or not ready.some(function(building) { return building.status == BUILT; }); } |
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// You need a HQ before you can design units or build defence towers if (iHave(HQ)) { // build defence towers } else { // instruct a truck to build a HQ! } |
...