Differential D2150 Diff 17818 ps/trunk/binaries/data/mods/public/simulation/ai/common-api/filters.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/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 140 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator