8. Final Project¶
Build an area that uses everything from this unit:
- At least one room, built however you like —
@digfrom the Builder's Guide, orcreate_objectfrom Lesson 5. - At least one custom command, added in
commands/command.pyand registered indefault_cmdsets.py(Lesson 4). - At least one custom object, with its own typeclass in
typeclasses/objects.pyinstead of the plain default (Lesson 3), and at least one attribute that changes (Lesson 6). - Optional, for extra challenge: a script (Lesson 7) that makes something in your area happen on its own.
A starting point for a custom object with its own behavior:
# typeclasses/objects.py
from evennia.objects.objects import DefaultObject
class ObjectParent:
pass
class LockedChest(DefaultObject):
def at_object_creation(self):
self.db.is_locked = True
def at_pre_get(self, getter):
if self.db.is_locked:
getter.msg("The chest is locked.")
return False
return True
Build it, connect it to your custom command, @reload, and test it the way you've tested everything else this unit — one small change at a time.
Try it
Finish your area and walk a classmate through it: show them the room, the object, and the command, and explain what each piece of code does.
Tip
If something doesn't work, re-read the traceback from the bottom up (Unit 3, Lesson 7) before asking for help — most of the time it already tells you exactly what's wrong.