Debian Codegraph @

scripts/game_events/cellar_to_bjarn.py

raw symbols SCIP
1 #
2 # (C) Copyright 2001 Kai Sterker <[email protected]>
3 # Part of the Adonthell Project http://adonthell.linuxgames.com
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License.
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY.
9 #
10 # See the COPYING file for more details
11 #
12
13 # -- Map Event to teleport a character into Bjarn's room, if allowed.
14 #
15 # Teleport the character that triggered this event to another position
16 # if bjarn's room door is open.
17
18 import adonthell
19 import events
20
21 class cellar_to_bjarn(object):
22
23 # Parameters:
24 # smdest: destination submap
25 # xdest: X position on smdest
26 # ydest: Y position on smdest
27 # destdir: direction where to look at after the teleport
28 def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
29 self.smdest = smdest
30 self.xdest = xdest
31 self.ydest = ydest
32 self.destdir = destdir
33
34 def run (self, submap, x, y, dir, name):
35 p = adonthell.gamedata_get_character (name)
36 # -- bjarn's door closed?
37 open = adonthell.gamedata_get_quest ("demo").get_val("bjarn_door_open")
38 if open == 0 or open == 1:
39 if p.get_name () == adonthell.gamedata_player ().get_name ():
40 adonthell.gamedata_get_character ("Bjarn Fingolson").launch_action (p)
41 p.stand ()
42 p.go_west ()
43 else:
44 events.switch_submap (p, self.smdest, self.xdest, self.ydest, self.destdir)