Merge branch 'master' of git://cams.pavlovian.net/questhelper
[QuestHelper.git] / routing_loc.lua
blob34cd57bdb1e87b8aa50b587f80dca600b89ae9c8
1 QuestHelper_File["routing_loc.lua"] = "Development Version"
2 QuestHelper_Loadtime["routing_loc.lua"] = GetTime()
4 -- Okay, this is going to be revamped seriously later, but for now:
5 -- .c is continent, either 0, 3, or -77
6 -- .x is x-coordinate
7 -- .y is y-coordinate
8 -- .p is original-questhelper plane
9 -- that's it.
11 -- Also, we're gonna pull something similar as with Collect to wrap everything up and not pollute the global space. But for now we don't.
13 -- LOCATIONS ARE IMMUTABLE, THEY NEVER CHANGE, THIS IS INCREDIBLY IMPORTANT
15 function NewLoc(c, x, y, rc, rz)
16 QuestHelper: Assert(c)
17 QuestHelper: Assert(x)
18 QuestHelper: Assert(y)
19 local tab = QuestHelper:CreateTable("location")
20 tab.c = c
21 tab.x = x
22 tab.y = y
23 if not QuestHelper_IndexLookup[rc] or not QuestHelper_IndexLookup[rc][rz] then
24 QuestHelper:TextOut(string.format("lolwut %s %s", tostring(rc), tostring(rz)))
25 end
26 QuestHelper: Assert(QuestHelper_IndexLookup[rc])
27 QuestHelper: Assert(QuestHelper_IndexLookup[rc][rz])
28 tab.p = QuestHelper_IndexLookup[rc][rz]
29 return tab
30 end
32 function IsLoc(c)
33 return c and c.c and c.x and c.y and c.p
34 end