<?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="Break and Enter" el:subtitle="" el:id="level5b"/>
      <el:version el:score="1" el:release="1" el:revision="1" el:status="released"/>
      <el:author  el:name="Siegfried Fennig" el:email="" el:homepage=""/>
      <el:copyright>Copyright © 2003 Siegfried Fennig</el:copyright>
      <el:license el:type="GPL version 2" 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 = 20
levelh = 13

create_world(levelw, levelh)
oxyd_default_flavor = "c"
draw_border("st-rock1")
fill_floor("fl-bluegreen")

oxyd( 5, 2)
oxyd( 9, 2)
oxyd( 10, 2)
oxyd( 14, 2)
oxyd( 5, 10)
oxyd( 9, 10)
oxyd( 10, 10)
oxyd( 14, 10)
oxyd_shuffle()

set_stone( "st-timer", 2, 2, {action="callback", target="t_h1"})
set_stone( "st-timer", 17, 2, {action="callback", target="t_h2"})
set_stone( "st-timer", 17, 10, {action="callback", target="t_h3"})

hammer(5,6)

draw_stones("st-thief", {2,5}, {1,0},16)
draw_stones("st-thief", {2,7}, {1,0},16)

draw_stones("st-stone_break", {4,1}, {1,0},12)
draw_stones("st-stone_break", {4,3}, {1,0},12)
draw_stones("st-stone_break", {4,9}, {1,0},12)
draw_stones("st-stone_break", {4,11}, {1,0},12)
draw_stones("st-stone_break", {6,2}, {1,0},3)
draw_stones("st-stone_break", {11,2}, {1,0},3)
draw_stones("st-stone_break", {4,2}, {1,0},1)
draw_stones("st-stone_break", {15,2}, {1,0},1)
draw_stones("st-stone_break", {6,10}, {1,0},3)
draw_stones("st-stone_break", {11,10}, {1,0},3)
draw_stones("st-stone_break", {4,10}, {1,0},1)
draw_stones("st-stone_break", {15,10}, {1,0},1)

draw_stones("st-grate2", {2,6},{1,0},2)
draw_stones("st-grate2", {16,6},{1,0},2)

oneway(1,5, enigma.SOUTH)
oneway(1,7, enigma.NORTH)
oneway(18,5, enigma.NORTH)
oneway(18,7, enigma.SOUTH)

fill_floor("fl-abyss", 1,1, 5,3)
fill_floor("fl-abyss", 14,1, 5,3)
fill_floor("fl-abyss", 14,9, 5,3)
fill_floor("fl-abyss", 3,9, 3,3)
fill_floor("fl-abyss", 7,2, 6,2)
fill_floor("fl-abyss", 7,9, 6,2)
fill_floor("fl-abyss", 1,11, 2,1)
fill_floor("fl-abyss", 2,9, 1,1)

timer = 0

function t_h1()
    doora=enigma.GetNamedObject("door1")
    doorb=enigma.GetNamedObject("door2")
    doorc=enigma.GetNamedObject("door3")
    doord=enigma.GetNamedObject("door4")

    if timer == 0 then
        SendMessage(doora, "open")
     end
    if timer == 1 then
        SendMessage(doorb, "open")
    end
    if timer == 2 then
        SendMessage(doorc, "open")
    end
    if timer == 3 then
        SendMessage(doord, "open")
        SendMessage(doora, "close")
    end
    if timer == 4 then
        SendMessage(doorb, "close")
    end
    if timer == 5 then
        SendMessage(doorc, "close")
    end
    if timer == 6 then
        SendMessage(doord, "close")
    end
end

function t_h2()
    doora=enigma.GetNamedObject("door5")
    doorb=enigma.GetNamedObject("door6")
    doorc=enigma.GetNamedObject("door7")
    doord=enigma.GetNamedObject("door8")

    if timer == 4 then
        SendMessage(doora, "open")
    end
    if timer == 5 then
        SendMessage(doorb, "open")
    end
    if timer == 6 then
        SendMessage(doorc, "open")
    end
    if timer == 7 then
        SendMessage(doord, "open")
        SendMessage(doora, "close")
    end
    if timer == 8 then
        SendMessage(doorb, "close")
    end
    if timer == 9 then
        SendMessage(doorc, "close")
    end
    if timer == 10 then
        SendMessage(doord, "close")
    end
end

function t_h3()
    doora=enigma.GetNamedObject("door9")
    doorb=enigma.GetNamedObject("door10")
    doorc=enigma.GetNamedObject("door11")
    doord=enigma.GetNamedObject("door12")

    if timer == 8 then
        SendMessage(doora, "open")
    end
    if timer == 9 then
        SendMessage(doorb, "open")
    end
    if timer == 10 then
        SendMessage(doorc, "open")
    end
    if timer == 11 then
        SendMessage(doord, "open")
        SendMessage(doora, "close")
    end
    if timer == 0 then
        SendMessage(doorb, "close")
    end
    if timer == 1 then
        SendMessage(doorc, "close")
    end
    if timer == 2 then
        SendMessage(doord, "close")
    end

    timer = timer + 1
    if timer == 12 then
        timer = 0
    end
end

set_stone("st-door_b", 4,6, {name="door1"})
set_stone("st-door_b", 5,6, {name="door2"})
set_stone("st-door_b", 6,6, {name="door3"})
set_stone("st-door_b", 7,6, {name="door4"})
set_stone("st-door_b", 8,6, {name="door5"})
set_stone("st-door_b", 9,6, {name="door6"})
set_stone("st-door_b", 10,6, {name="door7"})
set_stone("st-door_b", 11,6, {name="door8"})
set_stone("st-door_b", 12,6, {name="door9"})
set_stone("st-door_b", 13,6, {name="door10"})
set_stone("st-door_b", 14,6, {name="door11"})
set_stone("st-door_b", 15,6, {name="door12"})

set_actor("ac-blackball", 2.5, 10.5)
    ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
