From 09cc31dafcbd45be406e2ab1d126bf2e337ea88c Mon Sep 17 00:00:00 2001 From: Ari Mudev Date: Sat, 4 Sep 2010 15:35:38 +0000 Subject: [PATCH] Fix nudge lid randomness, fix order of emits. --- game/gamesrc/commands/examples/cmdset_red_button.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/game/gamesrc/commands/examples/cmdset_red_button.py b/game/gamesrc/commands/examples/cmdset_red_button.py index 165dae5978..79f48f249e 100644 --- a/game/gamesrc/commands/examples/cmdset_red_button.py +++ b/game/gamesrc/commands/examples/cmdset_red_button.py @@ -36,14 +36,20 @@ class CmdNudge(Command): nudge the lid. """ rand = random.random() + open_ok = False + if rand < 0.5: string = "You nudge at the lid. It seems stuck." - elif 0.5 <= 0.5 < 0.7: + elif 0.5 <= rand < 0.7: string = "You move the lid back and forth. It won't budge." else: string = "You manage to get a nail under the lid. It pops open." - self.obj.open_lid() + open_ok = True self.caller.msg(string) + + if open_ok: + """open_lid() does its own emits, so defer it until we speak""" + self.obj.open_lid() class CmdPush(Command): """