def login(actor): '''Perform some initialisation for the Player being logged in.''' actor.connstate = 'online' actor.chunked_event = None actor.chunks = iter([]) actor.receiveEvent(LoginFirstEvent()) distributeEvent(actor.room, [actor], LoginThirdEvent(actor))
def login(actor): '''Perform some initialisation for the Player being logged in.''' actor.connstate = 'online' actor.chunked_event = None actor.chunks = iter([]) actor.receiveEvent(LoginFirstEvent()) distributeEvent(actor.room, [actor], LoginThirdEvent(actor))
def speakTo(actor, target, text): if target not in actor.room and target not in actor.inventory: unfoundObject(actor) else: actor.receiveEvent(SpeakToFirstEvent(target, text)) target.receiveEvent(SpeakToSecondEvent(actor, text)) distributeEvent(actor.room, [actor, target], SpeakToThirdEvent(actor, target, text))
def speakTo(actor, target, text): if target not in actor.room and target not in actor.inventory: unfoundObject(actor) else: actor.receiveEvent(SpeakToFirstEvent(target, text)) target.receiveEvent(SpeakToSecondEvent(actor, text)) distributeEvent(actor.room, [actor, target], SpeakToThirdEvent(actor, target, text))
def logoffFinal(actor): #XXX: is this doing stuff in the correct order? if actor.connstate != 'online': logging.info("Foiled a double logoff attempt with %r." % actor) return actor.connstate = 'offline' actor.receiveEvent(LogoffFirstEvent()) distributeEvent(actor.room, [actor], LogoffThirdEvent(actor)) actor.disconnect() actor.room.remove(actor)
def emoteTo(actor, target, first, second, third): if target.room not in [actor.room, actor.inventory]: unfoundObject() return first = process(first) second = process(second) third = process(third) actor.receiveEvent(EmoteTargettedFirst(target, first)) target.receiveEvent(EmoteTargettedSecond(actor, second)) distributeEvent(actor.room, [actor, target], EmoteTargettedThird(actor, target, third))
def speak(actor, text): actor.receiveEvent(SpeakNormalFirstEvent(text)) distributeEvent(actor.room, [actor], SpeakNormalThirdEvent(actor, text))
def emote(actor, first, third): first = process(first) third = process(third) actor.receiveEvent(EmoteUntargettedFirst(actor, first)) distributeEvent(actor.room, [actor], EmoteUntargettedThird(actor, third))
def speak(actor, text): actor.receiveEvent(SpeakNormalFirstEvent(text)) distributeEvent(actor.room, [actor], SpeakNormalThirdEvent(actor, text))