Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/common-api/filters.js
var API3 = function(m) | var API3 = function(m) | ||||
{ | { | ||||
m.Filters = { | m.Filters = { | ||||
"byType": type => ({ | "byType": type => ({ | ||||
"func": ent => ent.templateName() == type, | "func": ent => ent.templateName() == type, | ||||
"dynamicProperties": [] | "dynamicProperties": [] | ||||
}), | }), | ||||
"byClass": cls => ({ | "byClass": cls => ({ | ||||
"func": ent => ent.hasClass(cls), | "func": ent => ent.hasClass(cls), | ||||
"dynamicProperties": [] | "dynamicProperties": [] | ||||
}), | }), | ||||
"byClassesAnd": clsList => ({ | "byClasses": clsList => ({ | ||||
"func": ent => clsList.every(cls => ent.hasClass(cls)), | "func": ent => ent.hasClasses(clsList), | ||||
"dynamicProperties": [] | |||||
}), | |||||
"byClassesOr": clsList => ({ | |||||
"func": ent => clsList.some(cls => ent.hasClass(cls)), | |||||
"dynamicProperties": [] | "dynamicProperties": [] | ||||
}), | }), | ||||
"byMetadata": (player, key, value) => ({ | "byMetadata": (player, key, value) => ({ | ||||
"func": ent => ent.getMetadata(player, key) == value, | "func": ent => ent.getMetadata(player, key) == value, | ||||
"dynamicProperties": ['metadata.' + key] | "dynamicProperties": ['metadata.' + key] | ||||
}), | }), | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | "isFishable": () => ({ | ||||
// temporarily do not fish moving fish (i.e. whales) | // temporarily do not fish moving fish (i.e. whales) | ||||
"func": ent => !ent.get("UnitMotion") && ent.hasClass("SeaCreature") && ent.resourceSupplyMax(), | "func": ent => !ent.get("UnitMotion") && ent.hasClass("SeaCreature") && ent.resourceSupplyMax(), | ||||
"dynamicProperties": [] | "dynamicProperties": [] | ||||
}) | }) | ||||
}; | }; | ||||
return m; | return m; | ||||
}(API3); | }(API3); | ||||
Lint: no-use-before-define: 'API3' was used before it was defined. | |||||
Wildfire Games · Phabricator
'API3' was used before it was defined.