<?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="Check the light" el:subtitle="how to play chess with lasers" el:id="just10"/>
      <el:version el:score="3" el:release="4" el:revision="9" el:status="released"/>
      <el:author  el:name="JuSt" el:email="" el:homepage=""/>
      <el:copyright>Copyright © 2007 JuSt</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 R. Bourquin</el:code></el:comments>
      <el:score el:easy="-" el:difficult="1:17"/>
    </el:info>
    <el:luamain><![CDATA[
wo["ConserveLevel"] = false

ti[" "] = {"fl_concrete"}
ti["~"] = {"fl_water"}
ti["-"] = {"fl_wood"}
ti["#"] = {"st_redmarble"}
ti["R"] = {"st_rawglass"}
ti["+"] = {"st_box"}
ti["*"] = ti["-"] .. ti["+"]
ti["C"] = {"st_chess"}
ti["B"] = {"st_break_oxydc"}
ti["I"] = {"st_stoneimpulse"}
ti["X"] = {"st_grate", flavor="cross"}
ti["G"] = {"st_grate", flavor="framed"}
ti["M"] = {"st_mirror", orientation=VERTICAL, movable=true}
ti["P"] = ti["~"] .. {"st_lightpassenger"}
ti["L"] = {"st_laserswitch", target="check_first_chess"}
ti["J"] = {"st_laserswitch", target="check_second_chess"}
ti["K"] = {"st_laserswitch", target="check_mirror"}
ti["="] = {"st_door", flavor="d", faces="ns", name="door1"}
ti["D"] = {"st_door", flavor="a", name="door2#"}
ti["Y"] = ti["~"] .. {"st_door", flavor="a", name="door3", state=CLOSED}
ti["Z"] = {"st_door", flavor="a", name="door4", state=OPEN}
ti["^"] = {"st_laser", orientation=NORTH, state=ON}
ti[">"] = {"st_laser", orientation=EAST, state=ON}
ti["V"] = {"st_laser", orientation=SOUTH, state=ON}
ti["<"] = {"st_laser", orientation=WEST, state=ON}
ti["1"] = {"st_laser", orientation=WEST, name="laser1", state=ON}
ti["2"] = {"st_laser", orientation=EAST, name="laser2", state=ON}
ti["3"] = {"st_laser", orientation=NORTH, name="laser3"}
ti["4"] = {"st_laser", orientation=WEST, name="laser4", state=ON}
ti["S"] = {"st_switch", target="dry"}
ti["x"] = {"fl_bridge", name="bridge"} .. ti["X"]
ti["a"] = {"it_trigger", target="door1", action="open"}
ti["b"] = {"it_trigger", target="door1", action="close"}
ti["c"] = {"it_trigger", action={"open", "open", "on"}, target={"door2#*", "door4", "laser3"}}
ti["t"] = {"it_document", text="text1"}
ti["s"] = ti["~"] .. ti["G"] .. {"it_seed"}
ti["O"] = {"st_oxyd"}
ti["@"] = {"#ac_marble_black"}

wo(ti, " ", {
    "###Va+IIII########O#",
    "#V#R##V##I#@#    B O",
    "#~~~~~~<#I#      # O",
    "#P#=#~ X#I2 # t  # O",
    "#~#I#~ X#I# #    #D#",
    "#~#IL~ Z1I# #  C  s#",
    "#~#II~ XYIBM#     G#",
    "#~#+J~ x4B#  C    G#",
    "#~#b#~           G #",
    "#~# #~ X      #D##G#",
    "#~###~ ######BS ##3#",
    ">~~~~~~*~*~*~*~~~~c#",
    "#####^K#############"})

wo:shuffleOxyd()

function check_first_chess(value, sender)
    if st(sender+E):is("st_chess") then
        no["bridge"]:close()
        grp(no["laser1"], no["laser2"]):off()
    end
end

function check_second_chess(value, sender)
    if st(sender+E):is("st_chess") then
        no["laser4"]:off()
    end
end

function check_mirror(value, sender)
    if st(sender+4*N):is("st_mirror") then
        no["door4"]:close()
        no["door3"]:open()
    end
end

function dry(value, sender)
    sender["target"] = DEFAULT
    wo:drawMap(ti, po(5, 3), " ", {"-","-","-","-","-","-","-","-"})
end
 ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
      <el:string el:key="text1">
        <el:english el:translate="true">Are chess knights resistent to laser beams?</el:english>
        <el:translation el:lang="de">Ob Schachfiguren laserresistent sind?</el:translation>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
