From 8eff4e43c1886ddfc23d52afa60ab54416e086da Mon Sep 17 00:00:00 2001 From: Xinefus/Braska <64438452+Xinefus-Braska@users.noreply.github.com> Date: Wed, 4 Jan 2023 19:27:31 -0500 Subject: [PATCH] Update Beginner-Tutorial-Making-A-Sittable-Object.md Updates to Tutorial from 13.1 to 13.3.1. Some typos and a few func changes that ensure tutorial is actutally doing what it is supposed to. --- ...Beginner-Tutorial-Making-A-Sittable-Object.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/source/Howtos/Beginner-Tutorial/Part1/Beginner-Tutorial-Making-A-Sittable-Object.md b/docs/source/Howtos/Beginner-Tutorial/Part1/Beginner-Tutorial-Making-A-Sittable-Object.md index 8ad638fa77..9cacedc754 100644 --- a/docs/source/Howtos/Beginner-Tutorial/Part1/Beginner-Tutorial-Making-A-Sittable-Object.md +++ b/docs/source/Howtos/Beginner-Tutorial/Part1/Beginner-Tutorial-Making-A-Sittable-Object.md @@ -11,7 +11,7 @@ the current chair in an attribute `is_sitting`. Other systems could check this t - A character should be able to stand up and move away from the chair. - When you sit down you should not be able to walk to another room without first standing up. -## Make us not able to move while resting +## Make us not able to move while sitting When you are sitting in a chair you can't just walk off without first standing up. This requires a change to our Character typeclass. Open `mygame/typeclasses/characters.py`: @@ -24,12 +24,12 @@ This requires a change to our Character typeclass. Open `mygame/typeclasses/char class Character(DefaultCharacter): # ... - def at_pre_move(self, destination): + def at_pre_move(self, destination, **kwargs): """ Called by self.move_to when trying to move somewhere. If this returns False, the move is immediately cancelled. """ - if self.db.is_resting: + if self.db.is_sitting: self.msg("You need to stand up first.") return False return True @@ -71,7 +71,7 @@ class Sittable(Object): sitter.msg(f"You can't sit on {self.key} " f"- {current.key} is already sitting there!") return - self.db.sitting = sitter + self.db.sitter = sitter sitter.db.is_sitting = self.obj sitter.msg(f"You sit on {self.key}") ``` @@ -164,8 +164,8 @@ class Sittable(DefaultObject): f"You can't sit {adjective} {self.key} " f"- {current.key} is already sitting there!") return - self.db.sitting = sitter - sitter.db.is_sitting = self.obj + self.db.sitter = sitter + sitter.db.is_sitting = self sitter.msg(f"You sit {adjective} {self.key}") def do_stand(self, stander): @@ -313,7 +313,7 @@ class Sittable(DefaultObject): (docstring) """ def at_object_creation(self): - self.cmdset.add_default(CmdSetSit)A + self.cmdset.add_default(CmdSetSit) # ... ``` @@ -663,4 +663,4 @@ In this lesson we built ourselves a chair and even a sofa! Eagle-eyed readers will notice that the `stand` command sitting "on" the chair (variant 1) would work just fine together with the `sit` command sitting "on" the Character (variant 2). There is nothing stopping you from mixing them, or even try a third solution that better fits what you have in mind. -This concludes the first part of the Beginner tutorial! \ No newline at end of file +This concludes the first part of the Beginner tutorial!