Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Automatic exclusion marking - Inverse version by PantsMacKenzie and Ultraviolent4
- {
- function c_answer_prompt(prompt)
- if prompt == "Really walk into a travel-excluded area?" then
- return true
- end
- if prompt == "Really fly into a travel-excluded area?" then
- return true
- end
- if prompt == "Really swim into a travel-excluded area?" then
- return true
- end
- end
- }
- # the macro to exclude tiles in LoS is set to "-" (the minus key) by default
- macros += M - ===mark_los
- # if you play trunk on cbro or cpo you can use this to load an additional macro file (this won't override your regular macros)
- # additional_macro_file = marklos.macro
- {
- function mark_los()
- los = you.los()
- for i = -los,los do
- for j = -los,los do
- if you.see_cell(i,j) then
- local feat = view.feature_at(i,j)
- if not should_unexclude(feat) then
- travel.set_exclude(i,j,0)
- end
- end
- end
- end
- end
- }
- {
- function unmark_monsters()
- los = you.los()
- for i = -los,los do
- for j = -los,los do
- m = monster.get_monster_at(i,j)
- if m and (not should_ignore_monster(m)) then
- local feat = view.feature_at(i,j)
- if not feat_is_stair(feat) then
- travel.del_exclude(i,j,0)
- end
- end
- end
- end
- end
- }
- {
- function unmark_feet()
- local feat = view.feature_at(0,0)
- los = you.los()
- if not feat_is_stair(feat) then
- travel.del_exclude(0,0,0)
- end
- end
- }
- {
- function mark_all()
- los = you.los()
- for i = -los-1,los+1 do
- for j = -los-1,los+1 do
- local feat = view.feature_at(i,j)
- if should_exclude(feat) then
- travel.set_exclude(i,j,0)
- end
- if should_unexclude(feat) then
- travel.del_exclude(i,j,0)
- end
- end
- end
- end
- }
- {
- function ready()
- mark_all()
- unmark_monsters()
- unmark_feet()
- end
- }
- {
- function should_exclude(feat)
- return (not feat_is_floor(feat))
- end
- }
- {
- function should_unexclude(feat)
- return feat_is_stair(feat)
- or feat_is_door(feat)
- or feat:find("water")
- or feat:find("lava")
- or feat:find("altar")
- or feat:find("shop")
- or feat:find("portal")
- or feat:find("arch")
- or feat:find("leading out of this place")
- or feat:find("gate")
- or feat:find("web")
- end
- }
- {
- function should_ignore_monster(m)
- local name = m:name()
- return name:find("spire")
- or name:find("fulminant")
- or name:find("battlesphere")
- end
- }
- {
- function feat_is_floor(feat)
- return feat:find("floor")
- end
- }
- {
- function feat_is_door(feat)
- return feat:find("door")
- end
- }
- {
- function feat_is_stair(feat)
- return (feat:find("stone_stairs_up") or
- (feat:find("exit_") and (feat == "exit_hell" or feat == "exit_vaults"
- or feat == "exit_zot" or feat == "exit_slime_pits"
- or feat == "exit_orcish_mines" or feat == "exit_lair"
- or feat == "exit_crypt" or feat == "exit_snake_pit"
- or feat == "exit_elven_halls" or feat == "exit_tomb"
- or feat == "exit_swamp" or feat == "exit_shoals"
- or feat == "exit_spider_nest" or feat == "exit_depths"
- or feat == "exit_temple" or feat == "exit_dungeon"))
- or feat == "escape_hatch_up"
- or feat:find("stone_stairs_down")
- or feat:find("enter_")
- or feat == "escape_hatch_down")
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement