From 0fe07a513f83138bd9d85423ba67f4a29a8d14b3 Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 23 Mar 2023 23:31:29 +0100 Subject: [PATCH] Fix errors in wilderness contrib docs. Resolve #3144 --- docs/source/Contribs/Contrib-Wilderness.md | 17 ++++++++++++----- docs/source/Contribs/Contribs-Overview.md | 2 +- evennia/contrib/grid/wilderness/README.md | 17 ++++++++++++----- evennia/contrib/grid/wilderness/wilderness.py | 17 +++++++++-------- 4 files changed, 34 insertions(+), 19 deletions(-) diff --git a/docs/source/Contribs/Contrib-Wilderness.md b/docs/source/Contribs/Contrib-Wilderness.md index 8a53fd7bcc..57d0ae161e 100644 --- a/docs/source/Contribs/Contrib-Wilderness.md +++ b/docs/source/Contribs/Contrib-Wilderness.md @@ -3,7 +3,7 @@ Contribution by titeuf87, 2017 This contrib provides a wilderness map without actually creating a large number -of rooms - as you move, you instead end up back in the same room but its description +of rooms - as you move, you instead end up back in the same room but its description changes. This means you can make huge areas with little database use as long as the rooms are relatively similar (e.g. only the names/descs changing). @@ -19,11 +19,11 @@ with their own name. If no name is provided, then a default one is used. Interna the wilderness is stored as a Script with the name you specify. If you don't specify the name, a script named "default" will be created and used. - @py from evennia.contrib.grid import wilderness; wilderness.create_wilderness() + py from evennia.contrib.grid import wilderness; wilderness.create_wilderness() Once created, it is possible to move into that wilderness map: - @py from evennia.contrib.grid import wilderness; wilderness.enter_wilderness(me) + py from evennia.contrib.grid import wilderness; wilderness.enter_wilderness(me) All coordinates used by the wilderness map are in the format of `(x, y)` tuples. x goes from left to right and y goes from bottom to top. So `(0, 0)` @@ -102,14 +102,21 @@ class PyramidMapProvider(wilderness.WildernessMapProvider): desc = "This is a room in the pyramid." if y == 3 : desc = "You can see far and wide from the top of the pyramid." - room.ndb.desc = desc + room.ndb.active_desc = desc ``` +Note that the currently active description is stored as `.ndb.active_desc`. When +looking at the room, this is what will be pulled and shown. + +> Exits on a room are always present, but locks hide those not used for a +> location. So make sure to `quell` if you are a superuser (since the superuser ignores +> locks, those exits will otherwise not be hidden) + Now we can use our new pyramid-shaped wilderness map. From inside Evennia we create a new wilderness (with the name "default") but using our new map provider: py from world import pyramid as p; p.wilderness.create_wilderness(mapprovider=p.PyramidMapProvider()) - py from evennia.contrib import wilderness; wilderness.enter_wilderness(me, coordinates=(4, 1)) + py from evennia.contrib.grid import wilderness; wilderness.enter_wilderness(me, coordinates=(4, 1)) ## Implementation details diff --git a/docs/source/Contribs/Contribs-Overview.md b/docs/source/Contribs/Contribs-Overview.md index f7d1442406..3a5d025929 100644 --- a/docs/source/Contribs/Contribs-Overview.md +++ b/docs/source/Contribs/Contribs-Overview.md @@ -494,7 +494,7 @@ and abort an ongoing traversal, respectively. _Contribution by titeuf87, 2017_ This contrib provides a wilderness map without actually creating a large number -of rooms - as you move, you instead end up back in the same room but its description +of rooms - as you move, you instead end up back in the same room but its description changes. This means you can make huge areas with little database use as long as the rooms are relatively similar (e.g. only the names/descs changing). diff --git a/evennia/contrib/grid/wilderness/README.md b/evennia/contrib/grid/wilderness/README.md index 261060eceb..ed4c194a80 100644 --- a/evennia/contrib/grid/wilderness/README.md +++ b/evennia/contrib/grid/wilderness/README.md @@ -3,7 +3,7 @@ Contribution by titeuf87, 2017 This contrib provides a wilderness map without actually creating a large number -of rooms - as you move, you instead end up back in the same room but its description +of rooms - as you move, you instead end up back in the same room but its description changes. This means you can make huge areas with little database use as long as the rooms are relatively similar (e.g. only the names/descs changing). @@ -19,11 +19,11 @@ with their own name. If no name is provided, then a default one is used. Interna the wilderness is stored as a Script with the name you specify. If you don't specify the name, a script named "default" will be created and used. - @py from evennia.contrib.grid import wilderness; wilderness.create_wilderness() + py from evennia.contrib.grid import wilderness; wilderness.create_wilderness() Once created, it is possible to move into that wilderness map: - @py from evennia.contrib.grid import wilderness; wilderness.enter_wilderness(me) + py from evennia.contrib.grid import wilderness; wilderness.enter_wilderness(me) All coordinates used by the wilderness map are in the format of `(x, y)` tuples. x goes from left to right and y goes from bottom to top. So `(0, 0)` @@ -102,14 +102,21 @@ class PyramidMapProvider(wilderness.WildernessMapProvider): desc = "This is a room in the pyramid." if y == 3 : desc = "You can see far and wide from the top of the pyramid." - room.ndb.desc = desc + room.ndb.active_desc = desc ``` +Note that the currently active description is stored as `.ndb.active_desc`. When +looking at the room, this is what will be pulled and shown. + +> Exits on a room are always present, but locks hide those not used for a +> location. So make sure to `quell` if you are a superuser (since the superuser ignores +> locks, those exits will otherwise not be hidden) + Now we can use our new pyramid-shaped wilderness map. From inside Evennia we create a new wilderness (with the name "default") but using our new map provider: py from world import pyramid as p; p.wilderness.create_wilderness(mapprovider=p.PyramidMapProvider()) - py from evennia.contrib import wilderness; wilderness.enter_wilderness(me, coordinates=(4, 1)) + py from evennia.contrib.grid import wilderness; wilderness.enter_wilderness(me, coordinates=(4, 1)) ## Implementation details diff --git a/evennia/contrib/grid/wilderness/wilderness.py b/evennia/contrib/grid/wilderness/wilderness.py index 5607f3f4c3..78e0d6d5cd 100644 --- a/evennia/contrib/grid/wilderness/wilderness.py +++ b/evennia/contrib/grid/wilderness/wilderness.py @@ -92,9 +92,16 @@ class PyramidMapProvider(wilderness.WildernessMapProvider): desc = "This is a room in the pyramid." if y == 3 : desc = "You can see far and wide from the top of the pyramid." - room.ndb.desc = desc + room.ndb.active_desc = desc ``` +Note that the currently active description is stored as `.ndb.active_desc`. When +looking at the room, this is what will be pulled and shown. + +> Exits on a room are always present, but locks hide those not used for a +> location. So make sure to `quell` if you are a superuser (since the superuser ignores +> locks, those exits will otherwise not be hidden) + Now we can use our new pyramid-shaped wilderness map. From inside Evennia we create a new wilderness (with the name "default") but using our new map provider: @@ -116,13 +123,7 @@ create a new wilderness (with the name "default") but using our new map provider """ -from evennia import ( - DefaultExit, - DefaultRoom, - DefaultScript, - create_object, - create_script, -) +from evennia import DefaultExit, DefaultRoom, DefaultScript, create_object, create_script from evennia.typeclasses.attributes import AttributeProperty from evennia.utils import inherits_from