Advertisement
Guest User

Automatic exclusion marking

a guest
Jun 14th, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. {
  2. function c_answer_prompt(prompt)
  3. if prompt == "Really walk into a travel-excluded area?" then
  4. return true
  5. end
  6. end
  7. }
  8.  
  9. {
  10. function unmark_monsters()
  11. los = you.los()
  12. for i = -los,los do
  13. for j = -los,los do
  14. m = monster.get_monster_at(i,j)
  15. if m then
  16. local feat = view.feature_at(i,j)
  17. if not feat_is_stair(feat) then
  18. travel.del_exclude(i,j,0)
  19. end
  20. end
  21. end
  22. end
  23. end
  24. }
  25.  
  26.  
  27. {
  28. function unmark_feet()
  29. local feat = view.feature_at(0,0)
  30. los = you.los()
  31. if not feat_is_stair(feat) then
  32. travel.del_exclude(0,0,0)
  33. end
  34. end
  35. }
  36. {
  37. function mark_all()
  38. los = you.los()
  39. for i = -los-1,los+1 do
  40. for j = -los-1,los+1 do
  41. local feat = view.feature_at(i,j)
  42. if should_exclude(feat) then
  43. travel.set_exclude(i,j,0)
  44. end
  45. if should_unexclude(feat) then
  46. travel.del_exclude(i,j,0)
  47. end
  48. end
  49. end
  50. end
  51. }
  52.  
  53.  
  54. {
  55. function ready()
  56. mark_all()
  57. unmark_monsters()
  58. unmark_feet()
  59. end
  60. }
  61.  
  62. {
  63. function should_exclude(feat)
  64. return (not feat_is_floor(feat))
  65. end
  66. }
  67.  
  68. {
  69. function should_unexclude(feat)
  70. return feat_is_stair(feat) or feat_is_door(feat)
  71. end
  72. }
  73.  
  74. {
  75. function feat_is_floor(feat)
  76. return feat:find("floor")
  77. or feat:find("water")
  78. or feat:find("lava")
  79. or feat:find("altar")
  80. end
  81. }
  82.  
  83. {
  84. function feat_is_door(feat)
  85. return feat:find("door")
  86. end
  87. }
  88.  
  89. {
  90. function feat_is_stair(feat)
  91. return (feat:find("stone_stairs_up") or
  92. (feat:find("exit_") and (feat == "exit_hell" or feat == "exit_vaults"
  93. or feat == "exit_zot" or feat == "exit_slime_pits"
  94. or feat == "exit_orcish_mines" or feat == "exit_lair"
  95. or feat == "exit_crypt" or feat == "exit_snake_pit"
  96. or feat == "exit_elven_halls" or feat == "exit_tomb"
  97. or feat == "exit_swamp" or feat == "exit_shoals"
  98. or feat == "exit_spider_nest" or feat == "exit_depths"
  99. or feat == "exit_temple" or feat == "exit_dungeon"))
  100. or feat == "escape_hatch_up"
  101. or feat:find("stone_stairs_down")
  102. or feat:find("enter_")
  103. or feat == "escape_hatch_down")
  104. end
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement