<?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="Sacrifice" el:subtitle="" el:id="duffy49"/>
      <el:version el:score="1" el:release="1" el:revision="0" el:status="released"/>
      <el:author  el:name="Jacob Scott" el:email="" el:homepage=""/>
      <el:copyright>Copyright © 2003 Jacob Scott</el:copyright>
      <el:license el:type="GPL v2.0 or above" el:open="true"/>
      <el:compatibility el:enigma="0.92">
      </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[
levelw=80
levelh=20

create_world( levelw, levelh)

fill_floor("fl-leaves")

function renderLine( line, pattern)
    for i=1, strlen(pattern) do
        local c = strsub( pattern, i, i)
        if c =="#" then
            set_stone( "st-greenbrown", i-1, line)
        elseif c == "o" then
            oxyd( i-1, line)
        elseif c == "w" then
            set_stone( "st-glass", i-1, line)
        elseif c == "!" then
            abyss(i-1,line)
            fill_floor("fl-water", i-1,line, 1,1)
        elseif c=="z" then
            set_actor("ac-blackball", i-.5,line+.5)
        elseif c=="+" then
            set_stone( "st-wood",i-1,line)
        elseif c=="=" then
            fill_floor("fl-space", i-1,line, 1,1)
        elseif c=="B" then
            set_stone("st-bombs", i-1,line)
        elseif c=="d" then
            set_stone("st-oneway-s", i-1,line)    
        elseif c=="l" then
            set_stone("st-oneway-w", i-1,line)
        elseif c=="s" then
            set_stone("st-stoneimpulse",i-1,line)
        elseif c=="S" then
            set_stone( "st-stoneimpulse-hollow", i-1,line)
        elseif c=="M" then
            mirrorp(i-1,line,FALSE,TRUE, 4)
        elseif c=="N" then
            mirrorp(i-1,line,TRUE,FALSE, 3)
        elseif c=="L" then
            set_attrib(laser(i-1,line, TRUE, EAST), "name", "laser")
        elseif c == "R" then
            set_stone("st-bolder-e", i-1,line)
        elseif c == "a" then
            set_stone( "st-switch", i-1, line, 
                      {target="start_ferry", action="callback"})
        end
    end    
end
-- Floor:  " "
-- Border: "#"
-- Oxyd:   "o"

renderLine(00,"####################################################ooo###")
renderLine(01,"#a         w  w        ====== = = =   w   w  w   w w   wo#")
renderLine(02,"#      w   w   ww ww   ======= = = =  w w  w   w w w   ww#")
renderLine(03,"#      ww ww w     w   ====== = = =      w   w w   w     o")
renderLine(04,"#z           ww  w     ======= = = =  w    w   w w w     o")
renderLine(05,"#     w   w      w w   ====== = = =   w w w  w   w N     o")
renderLine(06,"#         w  ww  w     ======= = = =  w    w   w w w     o")
renderLine(07,"#               w  w   ====== = = =      w   w w   w     o")
renderLine(08,"#      ww    w    ww   ======= = = =  w w  w   w w w     o")
renderLine(09,"#       w    w     w   ====== = = =   w   w  w   w w     o")
renderLine(10,"#wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww###o #")
renderLine(11,"#L  MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMw #")
renderLine(12,"##########################################################")

oxyd_shuffle()

ferry_started = nil
ferry_x = 2
ferry_y = 10
ferry_width = 1
ferry_end = 54

function move_ferry()
set_stone("st-greenbrown",ferry_x+ferry_width-2,ferry_y)
set_stone("st-greenbrown",ferry_x+ferry_width-1,ferry_y)
set_stone("st-greenbrown",ferry_x+ferry_width,ferry_y)
if ferry_x>2 then
set_stone("st-glass",ferry_x+ferry_width-3, ferry_y)
end
    ferry_x = ferry_x + 1
end

function timer_callback()
   if ferry_x==ferry_end then
ferry_x=2
end
    if ferry_started and ferry_x < ferry_end then
        move_ferry()
    end
end

function start_ferry()
    if not ferry_started then
        move_ferry()
        ferry_started = 1
    end
 end

set_stone( "st-timer", 58,0 ,{target="timer_callback", action="callback",name="timer", interval=.6})

enigma.ConserveLevel=FALSE
    ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
