MCPcopy Create free account
hub / github.com/crawl/crawl / LUAFN

Function LUAFN

crawl-ref/source/l-debug.cc:46–74  ·  view source on GitHub ↗

WARNING: This is a very low-level call. Usage: goto_place("placename", ) "placename" is the name of the place as used in maps, such as "Lair:2", "Vaults:$", etc. If is specified, the entrance point of the branch specified in place_name is bound to the given level in the parent branch (the entrance level should be 1-based). This can be helpful when testing scenarios

Source from the content-addressed store, hash-verified

44// when testing scenarios that depend on the absolute depth of the current
45// place.
46LUAFN(debug_goto_place)
47{
48 try
49 {
50 const level_id id = level_id::parse_level_id(luaL_checkstring(ls, 1));
51 const int bind_entrance =
52 lua_isnumber(ls, 2)? luaL_safe_checkint(ls, 2) : -1;
53
54 if (is_connected_branch(id.branch))
55 you.level_stack.clear();
56 else
57 {
58 for (int i = you.level_stack.size() - 1; i >= 0; i--)
59 if (you.level_stack[i].id == id)
60 you.level_stack.resize(i);
61 if (!player_in_branch(id.branch))
62 you.level_stack.push_back(level_pos::current());
63 }
64
65 you.goto_place(id);
66 if (bind_entrance != -1)
67 brentry[you.where_are_you].depth = bind_entrance;
68 }
69 catch (const bad_level_id &err)
70 {
71 luaL_error(ls, err.what());
72 }
73 return 0;
74}
75
76LUAWRAP(debug_dungeon_setup, initial_dungeon_setup())
77

Callers

nothing calls this directly

Calls 15

is_connected_branchFunction · 0.85
player_in_branchFunction · 0.85
UNUSEDFunction · 0.85
init_level_connectivityFunction · 0.85
load_levelFunction · 0.85
dgn_reset_player_dataFunction · 0.85
los_changedFunction · 0.85
tile_clear_flavourFunction · 0.85
builderFunction · 0.85
update_portal_entrancesFunction · 0.85
mimic_atFunction · 0.85

Tested by

no test coverage detected