mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-27 22:33:06 +00:00
petra: fix an index access + some cleanup
This was SVN commit r21324.
This commit is contained in:
@@ -753,7 +753,7 @@ m.HQ.prototype.bulkPickWorkers = function(gameState, baseRef, number)
|
||||
if (!accessIndex)
|
||||
return false;
|
||||
// sorting bases by whether they are on the same accessindex or not.
|
||||
let baseBest = this.baseManagers.slice().sort(function (a,b) {
|
||||
let baseBest = this.baseManagers.slice().sort((a,b) => {
|
||||
if (a.accessIndex == accessIndex && b.accessIndex != accessIndex)
|
||||
return -1;
|
||||
else if (b.accessIndex == accessIndex && a.accessIndex != accessIndex)
|
||||
@@ -765,7 +765,7 @@ m.HQ.prototype.bulkPickWorkers = function(gameState, baseRef, number)
|
||||
let workers = new API3.EntityCollection(gameState.sharedScript);
|
||||
for (let base of baseBest)
|
||||
{
|
||||
if (base.ID === baseRef.ID)
|
||||
if (base.ID == baseRef.ID)
|
||||
continue;
|
||||
base.pickBuilders(gameState, workers, needed);
|
||||
if (workers.length < number)
|
||||
|
||||
@@ -576,7 +576,7 @@ m.Worker.prototype.startGathering = function(gameState)
|
||||
// Try to help building one if any accessible foundation available
|
||||
let foundations = gameState.getOwnFoundations().toEntityArray();
|
||||
let shouldBuild = this.ent.isBuilder() && foundations.some(function(foundation) {
|
||||
if (!foundation || foundation.getMetadata(PlayerID, "access") !== access)
|
||||
if (!foundation || m.getLandAccess(gameState, foundation) != access)
|
||||
return false;
|
||||
let structure = gameState.getBuiltTemplate(foundation.templateName());
|
||||
if (structure.resourceDropsiteTypes() && structure.resourceDropsiteTypes().indexOf(resource) !== -1)
|
||||
|
||||
Reference in New Issue
Block a user