Zombacode

By [Q1] eh#2907

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/426924/933864/Zombacode.js

  1. window.sortEntities = (...options) => {
  2. var optionMatchMap = {};
  3. for(let i in game.world.entities) {
  4. let match = [];
  5. let ei = game.world.entities[i].targetTick;
  6. let opCount = 0;
  7.  
  8. options.forEach((option => {
  9. option.attrs.forEach((attr => {
  10. try {
  11. match.push(ei[attr.name] === attr.eq);
  12. } catch {
  13. match.push(false);
  14. };
  15. }));
  16. if(match.includes(true)) {
  17. optionMatchMap[opCount] = {
  18. eq: match,
  19. uid: i
  20. };
  21. };
  22. opCount++;
  23. }));
  24. };
  25. return optionMatchMap;
  26. };