lua:scripting:firetemple
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| lua:scripting:firetemple [2015/01/01 09:10] – vodur | lua:scripting:firetemple [2015/01/01 09:50] (current) – vodur | ||
|---|---|---|---|
| Line 91: | Line 91: | ||
| sendtochar(mob, | sendtochar(mob, | ||
| + | |||
| + | end | ||
| + | </ | ||
| + | |||
| + | Generate maze | ||
| + | <code lua> | ||
| + | do | ||
| + | |||
| + | local function revdir( dir ) | ||
| + | if dir == " | ||
| + | elseif dir == " | ||
| + | elseif dir == " | ||
| + | elseif dir == " | ||
| + | end | ||
| + | end | ||
| + | |||
| + | --Randomized Prim's algorithm http:// | ||
| + | local walls={} | ||
| + | local maze={} | ||
| + | |||
| + | for k,v in pairs(getroom(501).exits) do | ||
| + | table.insert(walls, | ||
| + | end | ||
| + | |||
| + | while #walls>0 do | ||
| + | local wallind=randnum(1,# | ||
| + | local wall=walls[wallind] | ||
| + | table.remove(walls, | ||
| + | | ||
| + | if not maze[wall.exit.toroom] then | ||
| + | wall.exit: | ||
| + | wall.exit: | ||
| + | wall.exit.toroom[revdir(wall.dir)]: | ||
| + | wall.exit.toroom[revdir(wall.dir)]: | ||
| + | maze[wall.exit.toroom]=true | ||
| + | for k,v in pairs(wall.exit.toroom.exits) do | ||
| + | table.insert(walls, | ||
| + | end | ||
| + | end | ||
| + | | ||
| + | | ||
| + | |||
| + | end | ||
| + | |||
| end | end | ||
| </ | </ | ||
lua/scripting/firetemple.1420103406.txt.gz · Last modified: 2015/01/01 09:10 by vodur