adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[adonthell-wastesedge-commits] Release_0-3-3 f4c7cbd 14/50: ADDED 'quit'


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-3 f4c7cbd 14/50: ADDED 'quit' command to console
Date: Mon, 25 Jul 2016 18:15:31 +0000 (UTC)

tag: Release_0-3-3
commit f4c7cbd144427ec3685b4c5a59a17cbf9bfe8988
Author: Kai Sterker <address@hidden>
Commit: Kai Sterker <address@hidden>

    ADDED 'quit' command to console
    CONVERTED intro schedule to be event-driven
    UPDATED talk.py for pausing/resuming events
---
 mapengine.data                           |  Bin 5809 -> 5729 bytes
 scripts/actions/talk.py                  |   10 +++--
 scripts/dialogues/demo_intro_1.py        |    6 +++
 scripts/modules/console.py               |    5 +++
 scripts/schedules/mapcharacters/intro.py |   60 ++++++++++++++----------------
 5 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/mapengine.data b/mapengine.data
index 8cad4fb..5374dad 100755
Binary files a/mapengine.data and b/mapengine.data differ
diff --git a/scripts/actions/talk.py b/scripts/actions/talk.py
index 08bca80..3a74a70 100755
--- a/scripts/actions/talk.py
+++ b/scripts/actions/talk.py
@@ -21,16 +21,20 @@ class talk:
         self.myself = mapcharacterinstance
 
     def restore_schedule (self, retval, args):
-        # -- activate the character's schedules
+        # -- activate the characters' schedules
+        # player isn't event-driven yet
         args[0].set_schedule_active (1)
-        args[1].set_schedule_active (1)
+        # args[0].resume ()
+        args[1].resume ()
 
         adonthell.gamedata_engine ().set_control_active (1)
 
     def run (self, requester):
         if requester.get_name() == adonthell.gamedata_player ().get_name():
             # -- deactivate the schedule of the characters involved
-            self.myself.set_schedule_active (0)
+            self.myself.pause ()
+            # player isn't event-driven yet
+            # requester.pause ()
             requester.set_schedule_active (0)
 
             # -- don't allow access to main menu and stuff
diff --git a/scripts/dialogues/demo_intro_1.py 
b/scripts/dialogues/demo_intro_1.py
index 84fc81e..e9cb9fd 100644
--- a/scripts/dialogues/demo_intro_1.py
+++ b/scripts/dialogues/demo_intro_1.py
@@ -1,4 +1,6 @@
 import dialogue
+import adonthell
+
 # -- pygettext support
 def _(message): return message
 
@@ -79,3 +81,7 @@ class demo_intro_1 (dialogue.base):
                self.namespace = globals ()
                self.the_player = p
                self.the_npc = n
+
+       def __del__(self):
+               self.the_player.do_stuff ("enter_inn")
+
diff --git a/scripts/modules/console.py b/scripts/modules/console.py
index 1e2517f..cf47515 100755
--- a/scripts/modules/console.py
+++ b/scripts/modules/console.py
@@ -78,6 +78,11 @@ class console (adonthell.win_container):
                 self.history.append (text + '\n')
                 self.hist_idx = len (self.history)
     
+            # -- quit?
+            if text == "quit":
+                self.write_history ()
+                adonthell.gamedata_engine ().main_quit ()
+            
             # -- ... and try to execute it
             try:
                 result = eval (text, self.namespace)
diff --git a/scripts/schedules/mapcharacters/intro.py 
b/scripts/schedules/mapcharacters/intro.py
index 6224c4a..da34c8c 100644
--- a/scripts/schedules/mapcharacters/intro.py
+++ b/scripts/schedules/mapcharacters/intro.py
@@ -1,7 +1,7 @@
 #
 #  $Id$
 #
-#  (C) Copyright 2001 Kai Sterker <address@hidden>
+#  (C) Copyright 2001/2002 Kai Sterker <address@hidden>
 #  Part of the Adonthell Project http://adonthell.linuxgames.com
 #
 #  This program is free software; you can redistribute it and/or modify
@@ -20,43 +20,37 @@ class intro:
 
     def __init__ (self, mapcharacterinstance):
         self.myself = mapcharacterinstance
-
+        self.myself.set_callback (self.goal_reached)
         adonthell.gamedata_get_quest ("demo").set_val ("intro_on", 1)
 
-
-    def run (self):
-        myself = self.myself
-        talk = adonthell.gamedata_get_quest ("demo").get_val ("intro_on")
-
-        # -- first talk to talan to get into the inn
-        if talk == 1:
-            talan = adonthell.gamedata_get_character ("Talan Wendth")
-            talan.launch_action (myself)
-
-            adonthell.gamedata_get_quest ("demo").set_val ("intro_on", 2)
-
-        # -- open the gate
-        elif talk == 2:
-        
-            # -- start music
-            adonthell.audio_load_background (0, "audio/at-demo-5.ogg")
-            adonthell.audio_play_background (0)
-            adonthell.audio_set_schedule ("in_game")
-            adonthell.audio_set_schedule_active (1)
+    # -- first talk to talan to get into the inn
+    def talk_to_talan (self):
+        talan = adonthell.gamedata_get_character ("Talan Wendth")
+        talan.launch_action (self.myself)
+
+    # -- finally enter the inn
+    def enter_inn (self):
+        # -- start music
+        adonthell.audio_load_background (0, "audio/at-demo-5.ogg")
+        adonthell.audio_play_background (0)
+        adonthell.audio_set_schedule ("in_game")
+        adonthell.audio_set_schedule_active (1)
                         
-            self.open_gate ()
+        self.open_gate ()
 
-            adonthell.gamedata_get_quest ("demo").set_val ("intro_on", 0)
-            myself.set_goal (10, 18, adonthell.STAND_EAST)
+        adonthell.gamedata_get_quest ("demo").set_val ("intro_on", 0)
+        self.myself.set_goal (10, 18, adonthell.STAND_EAST)
 
-        # -- move in and finally enable keyboard control
-        else:
-            if myself.follow_path () == 1:
-                myself.set_schedule ("keyboard_control")
-                self.close_gate ()
-                myself.go_east ()
-                talan = adonthell.gamedata_get_character ("Talan Wendth")
-                talan.time_callback_string ("3t", "walk")
+    # -- inside the inn
+    def goal_reached (self):
+        talan = adonthell.gamedata_get_character ("Talan Wendth")
+        talan.time_callback_string ("3t", "walk")
+        
+        self.myself.set_callback (None)
+        self.myself.set_schedule ("keyboard_control")
+        self.myself.set_schedule_active (1)
+        self.close_gate ()
+        self.myself.go_east ()
 
 
     # -- open the gate



reply via email to

[Prev in Thread] Current Thread [Next in Thread]