Because a ping doesn't give any indication of what sort of building it is, I don't think radar pings should be enumerable or based on "base object".
Instead, would it be worth having an event that triggers when a new ping is detected?
Code: Select all
var pings = [];
eventRadarPing(nX,nY,bBig,nPlayer) {
// nX = x coord (number)
// nY = y coord (number)
// bBig = is it a BIG ping, eg. satellite uplink? (boolean)
// nPlayer = id of player who built the structure (number)
pings.push({x:nX,y:nY,big:bBig,player:nPlayer}); // add to my list of pings
}
Removing pings from the AI's internal list is also quite easy:
Code: Select all
eventSeen(viewer,seen) {
var i = pings.length;
while (-1<--i) {
if (pings[i].x==seen.x && pings[i].y==seen.y) pings.splice(i,1); // remove ping
}
}
Suggestions on a postcard to the usual address please...