home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
71f102c
)
Keep checking tasks are possible during proceeding.
author
Christian Heller
<c.heller@plomlompom.de>
Sun, 6 Jan 2019 02:05:50 +0000
(
03:05
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Sun, 6 Jan 2019 02:05:50 +0000
(
03:05
+0100)
server_/game.py
patch
|
blob
|
history
diff --git
a/server_/game.py
b/server_/game.py
index 9c264ed019584fdc6fdb009ab5434623bd0cdbdd..974de92866979b25b0031a9c62969e6fdbc7ffa2 100644
(file)
--- a/
server_/game.py
+++ b/
server_/game.py
@@
-110,7
+110,17
@@
class Thing(game_common.Thing):
Decrements .task.todo; if it thus falls to <= 0, enacts method whose
name is 'task_' + self.task.name and sets .task = None. If is_AI, calls
.decide_task to decide a self.task.
Decrements .task.todo; if it thus falls to <= 0, enacts method whose
name is 'task_' + self.task.name and sets .task = None. If is_AI, calls
.decide_task to decide a self.task.
+
+ Before doing anything, checks that task is still possible, and aborts
+ it otherwise (for AI things, decides a new task).
"""
"""
+ try:
+ self.task.check()
+ except GameError:
+ self.task = None
+ if is_AI:
+ self.decide_task()
+ return
self.task.todo -= 1
if self.task.todo <= 0:
task = getattr(self, 'task_' + self.task.name)
self.task.todo -= 1
if self.task.todo <= 0:
task = getattr(self, 'task_' + self.task.name)