Advertisement
Guest User

Automatic Safe Tile Marking - Standard Version

a guest
Jun 22nd, 2018
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. # Automatic exclusion marking - Standard version by Ultraviolent4
  2.  
  3. {
  4. function c_answer_prompt(prompt)
  5. if prompt == "Really walk into a travel-excluded area?" then
  6. return true
  7. end
  8. if prompt == "Really fly into a travel-excluded area?" then
  9. return true
  10. end
  11. if prompt == "Really swim into a travel-excluded area?" then
  12. return true
  13. end
  14. end
  15. }
  16.  
  17. {
  18. function mark_monsters()
  19. los = you.los()
  20. for i = -los,los do
  21. for j = -los,los do
  22. m = monster.get_monster_at(i,j)
  23. if m and (not should_ignore_monster(m)) then
  24. local feat = view.feature_at(i,j)
  25. if not should_ignore_feature(feat) then
  26. travel.set_exclude(i,j,0)
  27. end
  28. end
  29. end
  30. end
  31. end
  32. }
  33.  
  34. {
  35. function mark_feet()
  36. local feat = view.feature_at(0,0)
  37. if not should_ignore_feature(feat) then
  38. travel.set_exclude(0,0,0)
  39. end
  40. end
  41. }
  42.  
  43. {
  44. function ready()
  45. mark_monsters()
  46. mark_feet()
  47. end
  48. }
  49.  
  50. {
  51. function should_ignore_monster(m)
  52. local name = m:name()
  53. return name:find("spire")
  54. or name:find("fulminant")
  55. or name:find("battlesphere")
  56. end
  57. }
  58.  
  59. {
  60. function should_ignore_feature(feat)
  61. return feat_is_stair(feat)
  62. or feat_is_door(feat)
  63. or feat:find("altar")
  64. or feat:find("shop")
  65. or feat:find("portal")
  66. or feat:find("arch")
  67. or feat:find("leading out of this place")
  68. or feat:find("gate")
  69. end
  70. }
  71.  
  72. {
  73. function feat_is_door(feat)
  74. return feat:find("door")
  75. end
  76. }
  77.  
  78. {
  79. function feat_is_stair(feat)
  80. return (feat:find("stone_stairs_up") or
  81. (feat:find("exit_") and (feat == "exit_hell" or feat == "exit_vaults"
  82. or feat == "exit_zot" or feat == "exit_slime_pits"
  83. or feat == "exit_orcish_mines" or feat == "exit_lair"
  84. or feat == "exit_crypt" or feat == "exit_snake_pit"
  85. or feat == "exit_elven_halls" or feat == "exit_tomb"
  86. or feat == "exit_swamp" or feat == "exit_shoals"
  87. or feat == "exit_spider_nest" or feat == "exit_depths"
  88. or feat == "exit_temple" or feat == "exit_dungeon"))
  89. or feat == "escape_hatch_up"
  90. or feat:find("stone_stairs_down")
  91. or feat:find("enter_")
  92. or feat == "escape_hatch_down")
  93. end
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement