<?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="Im-pull-se" el:subtitle="" el:id="ralf07"/>
      <el:version el:score="1" el:release="1" el:revision="0" el:status="released"/>
      <el:author  el:name="Ralf Westram" el:email="amgine@reallysoft.de" el:homepage=""/>
      <el:copyright>Copyright © 2003 Ralf Westram</el:copyright>
      <el:license el:type="GPL v2.0 or above" el:open="true"/>
      <el:compatibility el:enigma="0.92">
       <el:dependency el:path="lib/ralf" el:id="lib/ralf" el:release="1" el:preload="true"/>
      </el:compatibility>
      <el:modes el:easy="false" el:single="true" el:network="false"/>
      <el:comments>
        <el:code>Lua 5.1 and XML converted by Leveladministrators</el:code>
      </el:comments>
      <el:score el:easy="-" el:difficult="-"/>
    </el:info>
    <el:luamain><![CDATA[
--debug_mode()

level={
   "!!!!!!!!!o!!!!!!!!!!",
   "!!!!!!!!   !!!!!!!!!",
   "!!!!!!xxxXxxx!!!!!!!",
   "!!!!!xX     Xx!!!!!!",
   "!!!!!x R_I_R x!!!!!!",
   "!!!! x _#i#_ x !!!!!",
   "!!!o X Ii iI X o!!!!",
   "!!!! x _#i#_ x !!!!!",
   "!!!!!x R_I_R x!!!!!!",
   "!!!!!xX  a  Xx!!!!!!",
   "!!!!!!xxxXxxx!!!!!!!",
   "!!!!!!!!   !!!!!!!!!",
   "!!!!!!!!!o!!!!!!!!!!",
}

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

triggerstate="000000000000"
triggers=0

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

function open(x,y)
   x,y = x+xlo,y+ylo
   enigma.KillStone(x,y)
   set_stone("st-pull",x,y)
end

function check(which)
   local state = strsub(triggerstate,which,which)
   state = 1-state
   triggerstate = strsub(triggerstate,1,which-1)..state..strsub(triggerstate,which+1)

   if (triggerstate=="111111111111") then
      open(9,2)
      open(9,10)
      open(5,6)
      open(13,6)
   end
end

function set_trigger(x,y)
   triggers=triggers+1
   local funcn = "trig_"..triggers
   dostring(funcn.." = function() check("..triggers..") end")
   set_item("it-trigger",x,y,{action="callback",target=funcn})
end

function my_floor(x,y)
   if mod(x+y,2)==1 then
      set_floor("fl-bluegray",x,y)
   else
      set_floor("fl-bluegreen",x,y)
   end
end

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

cells={}

cells["!"] = cell{floor="fl-abyss"}
cells["."] = cell{floor="fl-sahara"}
cells[" "] = cell{parent=my_floor}

cells["#"] = cell{parent=cells["."],stone="st-glass"}
cells["x"] = cell{parent=cells[" "],stone="st-glass1"}
cells["X"] = cell{parent=cells["."],stone="st-glass1"}

cells["a"] = cell{parent=cells[" "],actor={"ac-blackball", {player=0}}}
cells["o"] = cell{oxyd}

cells["_"] = cell{parent={cells[" "],set_trigger}}
cells["R"] = cell{parent=cells["_"],stone="st-pull"}

cells["i"] = cell{parent=cells[" "],stone="st-stoneimpulse"}
cells["I"] = cell{parent=cells["."],stone="st-stoneimpulse"}

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

rs_create_world(level,cells)
oxyd_shuffle()
    ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
