[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[adonthell-wastesedge-commits] Release_0-3-3 6eee5ec 11/50: UPDATED mape
From: |
Kai Sterker |
Subject: |
[adonthell-wastesedge-commits] Release_0-3-3 6eee5ec 11/50: UPDATED mapengine.data to latest version |
Date: |
Mon, 25 Jul 2016 18:15:30 +0000 (UTC) |
tag: Release_0-3-3
commit 6eee5ec3008f919e7e1a49c3db5414f61138d824
Author: Kai Sterker <address@hidden>
Commit: Kai Sterker <address@hidden>
UPDATED mapengine.data to latest version
---
mapengine.data | Bin 5503 -> 5557 bytes
scripts/schedules/mapcharacters/sarin.py | 117 ++++++++++++------------------
2 files changed, 46 insertions(+), 71 deletions(-)
diff --git a/mapengine.data b/mapengine.data
index 0b69a0a..ac53708 100755
Binary files a/mapengine.data and b/mapengine.data differ
diff --git a/scripts/schedules/mapcharacters/sarin.py
b/scripts/schedules/mapcharacters/sarin.py
index 41a2218..43e6d27 100755
--- a/scripts/schedules/mapcharacters/sarin.py
+++ b/scripts/schedules/mapcharacters/sarin.py
@@ -15,8 +15,7 @@
# He walks from one end of the room to the other. From time to
# to time he'll stop and chose another direction
-from adonthell import WALK_NORTH, WALK_SOUTH, WALK_EAST, WALK_WEST, \
- STAND_NORTH, STAND_SOUTH, STAND_WEST, STAND_EAST
+import adonthell
import schedule
import random
@@ -33,6 +32,8 @@ class sarin (schedule.speak):
self.min_y = 2
self.max_y = 6
+ self.direction = self.myself.get_val ("direction")
+
# -- make random remarks
self.speech = [_("Ruffinans, the lot of them!"), \
_("How dare they imprison one better than they?"), \
@@ -40,80 +41,54 @@ class sarin (schedule.speak):
_("I cannot believe such disrespect. Barbarians!")]
self.speech_delay = (20, 40)
schedule.speak.__init__(self)
-
- def walk (self):
- pass
- def goal_reached (self):
- pass
- def run_old (self):
- myself = self.myself
-
- # -- delay for orientation change
- delay = myself.get_val ("delay")
- # -- switch orientation
- if delay == 0:
- # -- get the current direction ...
- dir = myself.get_val ("direction")
-
- # -- ... and set the new one accordingly
- if dir == WALK_EAST or dir == WALK_WEST:
- dir = random.randrange (WALK_NORTH, WALK_SOUTH + 1)
- else:
- dir = random.randrange (WALK_WEST, WALK_EAST + 1)
+ delay = "%it" % random.randrange (3, 6)
+ self.walk_event = adonthell.time_event (delay)
+ self.walk_event.set_callback (self.walk)
+ adonthell.event_handler_register_event (self.walk_event)
+
+ self.myself.set_callback (self.goal_reached)
- # -- time until the next orientation change
- delay = random.randrange (100, 200) * 15
- myself.set_val ("direction", dir)
- myself.set_val ("delay", delay)
- myself.set_val ("todo", 1)
+ #delay = "%it" % random.randrange (13, 16)
+ #self.switch_event = adonthell.time_event (delay)
+ #self.switch_event.set_callback (self.switch_direction)
+ #adonthell.event_handler_register_event (self.switch_event)
+ def switch_direction (self):
+ # -- ... and set the new one accordingly
+ if self.direction == adonthell.WALK_EAST or self.direction ==
adonthell.WALK_WEST:
+ self.direction = random.randrange (adonthell.WALK_NORTH,
adonthell.WALK_SOUTH + 1)
else:
- myself.set_val ("delay", delay - 1)
-
-
- todo = myself.get_val ("todo")
-
- # -- waiting
- if todo == 0:
- # -- delay for direction change
- delay = myself.get_val ("switch_direction")
-
- if delay == 0:
- myself.set_val ("todo", 1)
- else:
- myself.set_val ("switch_direction", delay - 1)
-
- # -- get movement target
- elif todo == 1:
- # -- get the current direction ...
- dir = myself.get_val ("direction")
-
- # -- switch direction
- if dir == WALK_NORTH:
- goal = (myself.posx (), self.min_y, STAND_SOUTH, 0, 1)
- elif dir == WALK_SOUTH:
- goal = (myself.posx (), self.max_y, STAND_NORTH, 0, -1)
- elif dir == WALK_EAST:
- goal = (self.max_x, myself.posy(), STAND_WEST, -1, 0)
- else:
- goal = (self.min_x, myself.posy (), STAND_EAST, 1, 0)
-
- x, y, d = goal[:3]
- myself.set_val ("direction", d + 4)
+ self.direction = random.randrange (adonthell.WALK_WEST,
adonthell.WALK_EAST + 1)
+
+ delay = "%it" % random.randrange (13, 16)
+ self.switch_event = adonthell.time_event (delay)
+ self.switch_event.set_callback (self.switch_direction)
+ adonthell.event_handler_register_event (self.switch_event)
- while not myself.set_goal (x, y, d):
- offx, offy = goal [-2:]
- x = x + offx
- y = y + offy
+ self.walk ()
+
+ def walk (self):
+ # -- switch direction
+ if self.direction == adonthell.WALK_NORTH:
+ goal = (self.myself.posx (), self.min_y, adonthell.STAND_SOUTH, 0,
1)
+ elif self.direction == adonthell.WALK_SOUTH:
+ goal = (self.myself.posx (), self.max_y, adonthell.STAND_NORTH, 0,
-1)
+ elif self.direction == adonthell.WALK_EAST:
+ goal = (self.max_x, self.myself.posy (), adonthell.STAND_WEST, -1,
0)
+ else:
+ goal = (self.min_x, self.myself.posy (), adonthell.STAND_EAST, 1,
0)
- myself.set_val ("todo", 2)
+ x, y, d = goal[:3]
+ self.direction = d + 4
- # -- move
- elif todo == 2:
- if myself.follow_path () == 1:
- # -- wait a little on the current tile
- delay = random.randrange (15, 30) * 10
- myself.set_val ("switch_direction", delay)
+ while not self.myself.set_goal (x, y, d):
+ offx, offy = goal [-2:]
+ x = x + offx
+ y = y + offy
- myself.set_val ("todo", 0)
+ def goal_reached (self):
+ delay = "%it" % random.randrange (3, 6)
+ self.walk_event = adonthell.time_event (delay)
+ self.walk_event.set_callback (self.walk)
+ adonthell.event_handler_register_event (self.walk_event)
- [adonthell-wastesedge-commits] Release_0-3-3 0c77716 29/50: UPDATED docs for wastesedge 0.3.3, (continued)
- [adonthell-wastesedge-commits] Release_0-3-3 0c77716 29/50: UPDATED docs for wastesedge 0.3.3, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 b2d3419 21/50: FIXED problem of NPCs not reaching cellar due to temporarily blocked path, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 5a5fe13 45/50: FIXED speech of Janesta, which was accidently marked as player text, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 5ab2c22 25/50: FIXED installation of .mo files., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 a229355 10/50: CHANGED most schedules to use event-based walking; disabled the rest for now, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 02aec5d 08/50: UPDATED to work with new event system, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 a9e2395 23/50: FIXED Bjarn walking around after he starts crying, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 1d9d842 47/50: FIXED memleak (main_munu wasn't deleted at exit), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 04514cb 30/50: New Debian packaging files, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 9705cbd 02/50: ADDED quick-load feature, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 6eee5ec 11/50: UPDATED mapengine.data to latest version,
Kai Sterker <=
- [adonthell-wastesedge-commits] Release_0-3-3 3d365be 41/50: ADDED icons for use under Linux, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 fdf6820 27/50: ADDED win32 installer stuff, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 2d519ba 42/50: ADDED icons to RPM build script, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 4a8b5d1 24/50: Fixed version number for Debian packages, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 1fa6179 16/50: REPLACED 'devel'-init.py with 'release'-init.py, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 d521f72 22/50: CHANGED code so that only player is on hold when opening a window, not the whole map, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 218bbe0 43/50: REMOVED beginning of french translation, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 15b1616 40/50: ADDED much better icons by Ben, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 4180e0f 50/50: ADDED pixmaps directory to the distribution, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-3 f4c7cbd 14/50: ADDED 'quit' command to console, Kai Sterker, 2016/07/25