<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<el:level xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://enigma-game.org/schema/level/1 level.xsd" xmlns:el="http://enigma-game.org/schema/level/1">
  <el:protected>
    <el:info el:type="level">
      <el:identity el:title="Listen Carefully" el:subtitle="" el:id="duffy81"/>
      <el:version el:score="1" el:release="2" el:revision="2" el:status="released"/>
      <el:author el:name="Jacob Scott" el:email="" el:homepage=""/>
      <el:copyright>Copyright © 2004 Jacob Scott</el:copyright>
      <el:license el:type="GPL v2.0 or above" el:open="true"/>
      <el:compatibility el:enigma="1.10"/>
      <el:modes el:easy="false" el:single="true" el:network="false"/>
      <el:comments><el:code>new API converted by mecke</el:code></el:comments>
      <el:score el:easy="-" el:difficult="-"/>
    </el:info>
    <el:luamain><![CDATA[
wo["ConserveLevel"] = false

ti["  "] = {"fl_lawn"}
ti["- "] = {"fl_space"}
ti[". "] = {"fl_abyss"}
ti[" #"] = {"st_greenbrown"}
ti[" *"] = {"st_brownie"}
ti[" X"] = {"st_grate"}
ti[" G"] = {"st_rawglass"}
ti[" T"] = {"st_thief"}
ti[" >"] = {"st_oneway", orientation=EAST}
ti[" V"] = {"st_laser", state=ON, orientation=SOUTH}
ti[" M"] = {"st_mirror", orientation=SLASH}
ti[" N"] = {"st_mirror", orientation=BACKSLASH}
ti[" |"] = {"st_door", faces="ew", name="doormain"}
ti[" S"] = {"st_laserswitch", target="doormain"}
ti["doorh"] = {"st_door", faces="ns", name="door%%"}
ti["fourswitch"] = {"st_fourswitch", name="fs#", target="open_door", _door="door%%"}
ti["m "] = {"it_crack_m"}
ti["l "] = {"it_crack_l"}
ti[" O"] = {"st_oxyd"}
ti[" @"] = {"#ac_marble"}

wo(res.composer(res.autotile(ti, {"=", "doorh"}, {"F", "fourswitch"})), "  ", {
    " * * * * * * * * * * * * * * *-T-T-T-T * # # # # # # # # # # # # # # # # # # # #",
    " * O                       |  - - - -T * X X X X X X X X X X X X X X X X X X X #",
    " * O           # V # M G N #  -T-T- -T * X                                   X #",
    " * O           #=a #=h #=o #    -T- -T * X                                   X #",
    " * O           #=b #=i #=p #  -T-T- -T * X                                   X #",
    " * O           #=c #=j #=q #  -T- - -T * X                                   X #",
    " * O           #=d #=k #=r #   T @ T T * X                                   X #",
    " * O           #=e #=l #=s #   T T T X * X                                   X #",
    " * O           #=f #=m #=t #         X *.X. . . .                            X #",
    " * O           #=g #=n #=u #         X * X     >.                            X #",
    " * O           # N G M # G #         X *       >l                            X #",
    " * O X X X X X O X X X X X # X X X   X * X     >.                            X #",
    " * * * * * * * * * * * * G * * * * * * *.X. . . .                            X #",
    " # X X X X X X X X X X G N G N GmXmXmX X X                                   X #",
    " # X                   G G G G G                                             X #",
    " # X  Fa    Fh    Fo        .                                                X #",
    " # X  Fb    Fi    Fp    .   .                                                X #",
    " # X  Fc    Fj    Fq    .   .                                                X #",
    " # X  Fd    Fk    Fr    .   .                                                X #",
    " # X  Fe    Fl    Fs    .   .                                                X #",
    " # X  Ff    Fm    Ft    .   .                                                X #",
    " # X  Fg    Fn    Fu    .   .                                                X #",
    " # X                    .   .                                                X #",
    " # X X X X X X X X X X X.X X X X X X X X X X X X X X X X X X X X X X X X X X X #",
    " # # # # # # # # # # # # # # S # # # # # # # # # # # # # # # # # # # # # # # # #"})

wo:shuffleOxyd()

function open_door(value, sender)
    if sender["state"] == sender["_mustopen"] then
        no[sender["_door"]]:toggle()
    end
end

local orientations = {WEST, SOUTH, EAST, NORTH}
for obj in no["fs#*"] do
    obj["state"] = orientations[math.random(#orientations)]
    obj["_mustopen"] = orientations[math.random(#orientations)]
    open_door(true, obj)
end
 ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
