Sleepy bug fix

Don't error if someone tries to move after having gotten out of a
nightmare. Also use clear instead of del because I thought that it may
have been an issue but it turned out to have been fine but I'm too lazy
to revert it and it doesn't change anything.
This commit is contained in:
skizzerz 2018-06-26 11:09:05 -05:00
parent c79fbb03c1
commit 59ceb13329

View File

@ -976,7 +976,7 @@ class SleepyMode(GameMode):
elif self.step == 3:
if "correct" in self.on_path:
self.having_nightmare[0].send(messages["sleepy_nightmare_wake"])
del self.having_nightmare[0]
self.having_nightmare.clear()
elif "fake1" in self.on_path:
self.having_nightmare[0].send(messages["sleepy_nightmare_fake_1"])
self.step = 0
@ -991,7 +991,7 @@ class SleepyMode(GameMode):
self.nightmare_step()
def move(self, direction, var, wrapper, message):
if self.having_nightmare[0] is not wrapper.source:
if not self.having_nightmare or self.having_nightmare[0] is not wrapper.source:
return
opposite = {"n": "s", "e": "w", "s": "n", "w": "e"}
if self.prev_direction == opposite[direction]: