From 303c78f3be406183e451ec1af3bd1660e44eb5d6 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Sun, 17 Aug 2025 13:09:59 -0700 Subject: [PATCH] Add images to the beginnning of rooms --- typeclasses/rooms.py | 7 +++++++ typeclasses/tutorial.py | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/typeclasses/rooms.py b/typeclasses/rooms.py index e00f325..249ddce 100644 --- a/typeclasses/rooms.py +++ b/typeclasses/rooms.py @@ -83,6 +83,13 @@ class Room(ObjectParent, ExtendedRoom, ContribRPRoom, Listener): self.get_time_of_day(), self.get_season()) def get_display_header(self, looker, **kwargs): + """ + Possibly send an image to webclients. + """ + image = self.db.title_image + if image: + looker.msg(image=(f"https://www.howardabrams.com/cozy-players-guide/{image}", + {"type": "background-pane"})) return "|n" def get_display_footer(self, looker, **kwargs): diff --git a/typeclasses/tutorial.py b/typeclasses/tutorial.py index f74c70f..f0f7a65 100755 --- a/typeclasses/tutorial.py +++ b/typeclasses/tutorial.py @@ -8,6 +8,7 @@ from evennia import ( CmdSet, TICKER_HANDLER, ) +from evennia.utils import delay from evennia.prototypes.spawner import spawn from typeclasses.npcs import CarriableNPC @@ -158,7 +159,6 @@ class TutorBird(CarriableNPC): """ Spawn the bird and attach it to character. """ - bird = spawn({ "typeclass": "typeclasses.tutorial.TutorBird", "key": "bird", @@ -166,6 +166,13 @@ class TutorBird(CarriableNPC): "desc": "Gray feathered bird perched on your shoulder. It's large black eyes looks at you quizically. Its yellow cheeks are adorable, making it seem overly helpful.", })[0] bird.location = character + delay(1, bird.display_image) + + def display_image(self): + """ + Displays an image for the tutorial for the webclient. + """ + self.location.msg(image=("https://www.howardabrams.com/cozy-players-guide/bubba.jpg")) def do_speak(self): """