ai.txt 850 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. event.load("player_login");
  2. event.load("entity_join");
  3. ai_ignore = list.new();
  4. list.add(ai_ignore, "human");
  5. list.add(ai_ignore, "ender_dragon");
  6. list.add(ai_ignore, "villager");
  7. msg("dev", "§bAi §rloaded");
  8. @wait
  9. wait();
  10. ignoreGoto(event);
  11. goto("wait");
  12. @entity_join
  13. if(isLiving(entity)) {
  14. if(!isPlayer(entity)) {
  15. loc = entity.getLocation(entity);
  16. world = loc.getWorld(loc);
  17. world_name = world.getName(world);
  18. if(word.isSurvName(world_name)) {
  19. if(!living.getAi()) {
  20. entity_type = entity.getType(entity);
  21. if(!list.contains(ai_ignore, entity_type)) {
  22. living.removeAi(entity);
  23. }
  24. }
  25. }
  26. }
  27. }
  28. goto("wait");
  29. @player_login
  30. //Spawn mobs with ai
  31. online_list = players.toList();
  32. if(list.getSize(online_list) > 0) {
  33. living.setAi(false);
  34. } else {
  35. living.setAi(true);
  36. }
  37. goto("wait");