/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 143)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(local
beamDisarmed
dyingScript
doorOpened2
)
/******************************************************************************/
(instance public rm143 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))

  (send gEgo: put(INV_KNIFE))
(send gEgo: put(INV_MONEY))
(send gEgo: put(INV_TOOLS))
(send gEgo: put(INV_HOTELKEY))
(send gEgo: put(INV_SNIPER))
		(switch(gPreviousRoomNumber)
			(case 74
				(send gEgo:
					posn(181 91)
					loop(2)
				)
    ))

         (tile: init())
         (lasers: init())
		SetUpEgo()
  (aLight: init())
		(send gEgo:init())
  (aGuard: init())
 /* (send gTheMusic:
			prevSignal(0)
			stop()
			number(401)
			loop(-1)
			play()
		)*/
(if(== enemyLives 0)
= gEgoView 0
(send gEgo:posn(152 120) view(0) loop(0))
         (tile: hide())
         (lasers: hide())
         (aGuard: view(165) loop(3) posn(123 122))
        = beamDisarmed TRUE
)
(if(== gPreviousRoomNumber 74)
  Print("The guard seems to be sleeping. Maybe you can get past him without waking him. But first you got to get out from your cell.")
   (send gEgo: put(INV_SPACESUIT))
    )
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)
 (method(doit)
(if(==(send gEgo: onControl()) ctlCYAN)
(if(> enemyLives 0)
Print("Where do you think your going? Trying to escape?" #title "Guard:")
Print("Yes? Then I have to teach you a lesson!" #title "Guard:")
Print("Fists up!" #title "Guard:")
(send gRoom: newRoom(133))
)
)

(if(==(send gEgo: onControl()) ctlYELLOW)
(if(not(beamDisarmed))
= beamDisarmed TRUE
(send gEgo: view(600))
ProgramControl()
(send gEgo: setCycle(Fwd))
 = dyingScript ScriptID(DYING_SCRIPT)
  (send dyingScript:
    caller(3)
    register("The laser beams killed you. You died in pain and suffery. Muhaa!")
  )
  (send gGame:setScript(dyingScript))
)
)
 )
  (method (handleEvent pEvent)
(super:handleEvent(pEvent))
(if(Said('escape'))
(if(not(beamDisarmed))
Print("First, try to get out of the prison.")
return
)
Print("Use the escape-door for that.")
)
(if(Said('look>'))
(if(Said('/prison,cell'))
Print("This cell is small. And not very nicely furnished.")
)
(if(Said('/floor,ceiling'))
Print("It's not that important nor interesting.")
)
(if(Said('/beams'))
(if(not(beamDisarmed))
Print("They look razor-like beams. Better don't get too close.")
Print("All those lasers start from a laser-source. Maybe if you could reflect those beams, to destroy the source.")
return
)
Print("You destroyed those.")
)
(if(Said('/button'))
Print("You can see many buttons here. One is placed next to the escape-door. Another is on the computer panel.")
)
(if(Said('/door,(escape<door)'))
Print("You should be able to get out of the ship, using this door.")
)
(if(Said('/tile,wall'))
(if(==(send gEgo: onControl()) ctlNAVY)
Print("These tiles on the wall looks shiny, just as mirror.")
return
)
Print("You see metal walls all around you.")
)
(if(Said('/'))
Print("According to the noise, you are in the back of the ship, near the engine area.")
(if(not(beamDisarmed))
Print("You are locked up in a prison-cell. It's a very small room. Laser beams are blocking your way out.")
Print("Some shiny tiles are on the bottom of the wall.")
)
(if(> enemyLives 0)
Print("A guard is sleeping on a chair.")
return
   )
Print("The guard is lying on the floor.")
        )
        )

(if(Said('open/door'))
Print("The door is opened and closed with the button next to the door.")
)
(if(Said('press/button'))
(if(==(send gEgo: onControl()) ctlRED)
(if(doorOpened2)
Print("The escape-pod is now locked.")
(aLight: cel(0))
= doorOpened2 FALSE
return
)
Print("The escape-pod is now unlocked.")
(aLight: cel(1))
= doorOpened2 TRUE
return
)
(if(==(send gEgo: onControl()) ctlBLUE)
(if(doorOpened2)
    DrawPic(8)
    (send gEgo: hide())
    (aLight: hide()) (aGuard: hide())
Print("You press the button and the door to the escape pod opens. You step in ...")
+= gScore 1
(send gRoom: newRoom(135))
return
)
Print("A small light shows that the escape-pod has to be unlocked before you enter.")
return
)
Print("You're not close to any button.")
)
(if(Said('mirror,use,place/beam,(laser<beam),(wall<tile,plate,board),tile,plate,board/(laser<beam),beam,source') or
(if(Said('mirror,use,place/beam,(laser<beam),(wall<tile,plate,board),tile,plate,board/(laser<beam),beam') or
(if(Said('mirror,use,place/beam,(laser<beam),(wall<tile,plate,board),tile,plate,board'))))))
(if(beamDisarmed)
Print("Why do it again when you've done it already?")
return
)
(if(not(send gEgo: has(INV_TILE)))
Print("You don't have anyting to reflect with.")
return
)
Print("A very good idea! Reflecting the beam back into the source maybe will destroy it and you can escape. Wee!")
Print("At least it's worth trying.")
Print("You take the tile and put it in one of the beams. Just as you thought - the beam reflected back into the source, destroying it and causing and chain-reaction which damaged all of the lasers.")
Print("QUIET KABOOM!!" #font 7)
(lasers: hide())
(send gEgo: put(INV_TILE))
= beamDisarmed TRUE
+= gScore 3
)
(if(Said('remove,take/(wall<tile,plate,board),tile,plate,board'))
(if(send gEgo: has(INV_TILE))
Print("You don't want to remove another tile from the wall.")
return
)
Print("You remove one of the tiles form the wall.")
(send gEgo: get(INV_TILE))
+= gScore 3
 (tile: dispose())
return
)
)
)
(instance tile of Prop
(properties
view 199
x 180
y 78
))
(instance lasers of Prop
(properties
view 202
x 190
y 101
))
(instance aLight of Prop
(properties
view 205
x 84
y 34
cel 0
))
(instance aGuard of Act
(properties
view 206
x 14
y 103
))

/******************************************************************************/
