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 b2d3419 21/50: FIXED proble


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-3 b2d3419 21/50: FIXED problem of NPCs not reaching cellar due to temporarily blocked path
Date: Mon, 25 Jul 2016 18:15:31 +0000 (UTC)

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

    FIXED problem of NPCs not reaching cellar due to temporarily blocked path
---
 scripts/schedules/mapcharacters/to_cellar.py |   61 +-------------------------
 1 file changed, 2 insertions(+), 59 deletions(-)

diff --git a/scripts/schedules/mapcharacters/to_cellar.py 
b/scripts/schedules/mapcharacters/to_cellar.py
index 9ef8788..fff4fbf 100644
--- a/scripts/schedules/mapcharacters/to_cellar.py
+++ b/scripts/schedules/mapcharacters/to_cellar.py
@@ -68,7 +68,8 @@ class to_cellar:
                 if y - (x + 3) > 0: dir = adonthell.STAND_NORTH
                 else: dir = adonthell.STAND_WEST
 
-        self.myself.set_goal (x, y, dir)
+        if not self.myself.set_goal (x, y, dir):
+            self.myself.time_callback ("1t", self.walk)
 
     # -- reached Bjarn's room
     def goal_reached (self):
@@ -80,61 +81,3 @@ class to_cellar:
                         
         else:
             self.myself.pause ()
-
-
-    def run_old (self):
-        myself = self.myself
-        todo = myself.get_val ("todo")
-
-        # -- waiting
-        if todo == 0:
-            delay = myself.get_val ("delay")
-
-            # If standing delay expired, move around next time
-            if delay == 0:
-                myself.set_val ("todo", 1)
-            else:
-                myself.set_val ("delay", delay - 1)
-
-        # -- get movement target
-        elif todo == 1:
-            x, y, dir = self.exits[myself.submap ()]
-
-            # -- in Bjarn's room
-            if x == -1:
-                submap = myself.mymap ().get_submap (myself.submap ())
-                x = random.randint (1, 4)
-                y = random.randint (5, 9)
-
-                while not submap.get_square (x, y).is_free () or (y == 5 and x 
> 2):
-                    x = random.randint (1, 4)
-                    y = random.randint (5, 9)
-
-                # -- calculate direction
-                # -- north-western area
-                if x + y < 10:
-                    if x + 3 > y: dir = adonthell.STAND_SOUTH
-                    else: dir = adonthell.STAND_EAST
-                # -- south-east corner
-                else:
-                    if y - (x + 3) > 0: dir = adonthell.STAND_NORTH
-                    else: dir = adonthell.STAND_WEST
-
-            myself.set_goal (x, y, dir)
-            myself.set_val ("todo", 2)
-
-        # -- move
-        elif todo == 2:
-            if myself.follow_path () == 1:
-                # -- reached our final destination
-                myself.set_val ("todo", 0)
-
-                if myself.submap () == 7 and myself.posx () != 1:
-                    if myself.get_name () == adonthell.gamedata_player 
().get_name ():
-                        myself.set_schedule ("keyboard_control")
-                        bjarn = adonthell.gamedata_get_character ("Bjarn 
Fingolson")
-                        bjarn.set_dialogue ("dialogues.extro")
-                        bjarn.launch_action (myself)
-                        
-                    else:
-                        myself.set_schedule_active (0)



reply via email to

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