mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge branch 'main' into evadventure_work
This commit is contained in:
commit
1f3d4ed840
23 changed files with 112 additions and 93 deletions
|
|
@ -58,10 +58,10 @@ _multiversion-check-env:
|
|||
@EVDIR=$(EVDIR) EVGAMEDIR=$(EVGAMEDIR) bash -e checkenv.sh multiversion
|
||||
|
||||
_clean_api_index:
|
||||
rm source/api/*
|
||||
rm -f source/api/*
|
||||
|
||||
_clean_api_rsts:
|
||||
rm source/api/*.rst
|
||||
rm -f source/api/*.rst
|
||||
|
||||
# remove superfluos 'module' and 'package' text from api headers
|
||||
_reformat_apidoc_headers:
|
||||
|
|
|
|||
|
|
@ -1,13 +1,21 @@
|
|||
# Changelog
|
||||
|
||||
## Main branch
|
||||
## Evennia 1.3.0
|
||||
|
||||
Apr 29, 2023
|
||||
|
||||
- Feature: Better ANSI color fallbacks (InspectorCaracal).
|
||||
- Feature: Add support for saving `deque` with `maxlen` to Attributes (before
|
||||
`maxlen` was ignored).
|
||||
- Fix: More unit tests for scripts (Storsorken)
|
||||
- Fix: The username validator did not display errors correctly in web
|
||||
registration form.
|
||||
- Fix: Components contrib had issues with inherited typeclasses (ChrisLR)
|
||||
- Fix: f-string fix in clothing contrib (aMiss-aWry)
|
||||
- Fix: Have `EvenniaTestCase` properly flush idmapper cache (bradleymarques)
|
||||
- Tools: More unit tests for scripts (Storsorken)
|
||||
- Docs: Made separate doc pages for Exits, Characters and Rooms. Expanded on how
|
||||
to change the description of an in-game object with templating.
|
||||
- Docs: Fixed a multitude of doc issues.
|
||||
- Docs: A multitude of doc issues and typos fixed.
|
||||
|
||||
## Evennia 1.2.1
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ To test this, run
|
|||
|
||||
to run the entire test module
|
||||
|
||||
evennia test --settings setings.py world.tests
|
||||
evennia test --settings settings.py world.tests
|
||||
|
||||
or a specific class:
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ Channels can be used both for chats between [Accounts](./Accounts.md) and betwee
|
|||
- Private guild channels for planning and organization (IC/OOC depending on game)
|
||||
- Cyberpunk-style retro chat rooms (IC)
|
||||
- In-game radio channels (IC)
|
||||
- Group telephathy (IC)
|
||||
- Walkie talkies (IC)
|
||||
- Group telepathy (IC)
|
||||
- Walkie-talkies (IC)
|
||||
|
||||
```{versionchanged} 1.0
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ To create/destroy a new channel on the fly you can do
|
|||
Aliases are optional but can be good for obvious shortcuts everyone may want to
|
||||
use. The description is used in channel-listings. You will automatically join a
|
||||
channel you created and will be controlling it. You can also use `channel/desc` to
|
||||
change the description on a channel you wnn later.
|
||||
change the description on a channel you own later.
|
||||
|
||||
If you control a channel you can also kick people off it:
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ channels you could override the `help` command and change the lockstring to:
|
|||
|
||||
```
|
||||
|
||||
Add this custom command to your default cmdset and regular users wil now get an
|
||||
Add this custom command to your default cmdset and regular users will now get an
|
||||
access-denied error when trying to use use these switches.
|
||||
|
||||
## Using channels in code
|
||||
|
|
@ -263,7 +263,7 @@ below:
|
|||
3. `channel.at_post_channel_msg(message, **kwargs)`
|
||||
|
||||
Note that `Accounts` and `Objects` both have their have separate sets of hooks.
|
||||
So make sure you modify the set actually used by your subcribers (or both).
|
||||
So make sure you modify the set actually used by your subscribers (or both).
|
||||
Default channels all use `Account` subscribers.
|
||||
|
||||
### Channel class
|
||||
|
|
@ -379,7 +379,7 @@ Notable `Channel` hooks:
|
|||
a class-method that will happily remove found channel-aliases from the user linked to _any_
|
||||
channel, not only from the channel the method is called on.
|
||||
- `pre_join_channel(subscriber)` - if this returns `False`, connection will be refused.
|
||||
- `post_join_channel(subscriber)` - by default this sets up a users's channel-nicks/aliases.
|
||||
- `post_join_channel(subscriber)` - by default this sets up a users' channel-nicks/aliases.
|
||||
- `pre_leave_channel(subscriber)` - if this returns `False`, the user is not allowed to leave.
|
||||
- `post_leave_channel(subscriber)` - this will clean up any channel aliases/nicks of the user.
|
||||
- `delete` the standard typeclass-delete mechanism will also automatically un-subscribe all
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
*Exits* are in-game [Objects](./Objects.md) connecting other objects (usually [Rooms](./Rooms.md)) together.
|
||||
|
||||
> Note that Exits are one-way objects, so in order for two Rooms to be linked bi-directionally, there will need to be two exits.
|
||||
|
||||
An object named `north` or `in` might be exits, as well as `door`, `portal` or `jump out the window`.
|
||||
|
||||
An exit has two things that separate them from other objects.
|
||||
|
|
@ -29,7 +31,7 @@ The default exit functionality is all defined on the [DefaultExit](DefaultExit)
|
|||
|
||||
Exits are [locked](./Locks.md) using an `access_type` called *traverse* and also make use of a few hook methods for giving feedback if the traversal fails. See `evennia.DefaultExit` for more info.
|
||||
|
||||
Exits are normally overridden on a case-by-case basis, but if you want to change the default exit createad by rooms like `dig` , `tunnel` or `open` you can change it in settings:
|
||||
Exits are normally overridden on a case-by-case basis, but if you want to change the default exit created by rooms like `dig`, `tunnel` or `open` you can change it in settings:
|
||||
|
||||
BASE_EXIT_TYPECLASS = "typeclasses.exits.Exit"
|
||||
|
||||
|
|
@ -52,4 +54,8 @@ The process of traversing an exit is as follows:
|
|||
1. `obj.at_post_move(source)`
|
||||
1. On the Exit object, `at_post_traverse(obj, source)` is triggered.
|
||||
|
||||
If the move fails for whatever reason, the Exit will look for an Attribute `err_traverse` on itself and display this as an error message. If this is not found, the Exit will instead call `at_failed_traverse(obj)` on itself.
|
||||
If the move fails for whatever reason, the Exit will look for an Attribute `err_traverse` on itself and display this as an error message. If this is not found, the Exit will instead call `at_failed_traverse(obj)` on itself.
|
||||
|
||||
### Creating Exits in code
|
||||
|
||||
For an example of how to create Exits programatically please see [this guide](../Howtos/Beginner-Tutorial/Part1/Beginner-Tutorial-Creating-Things.md#linking-exits-and-rooms-in-code).
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ Below are the access_types checked by the default commandset.
|
|||
- `search` - this controls if the object can be found with the
|
||||
`DefaultObject.search` method (usually referred to with `caller.search`
|
||||
in Commands). This is how to create entirely 'undetectable' in-game objects.
|
||||
If not setting this lock excplicitly, all objects are assumed searchable.
|
||||
If not setting this lock explicitly, all objects are assumed searchable.
|
||||
Note that if you are aiming to make some _permanently invisible game system,
|
||||
using a [Script](./Scripts.md) is a better bet.
|
||||
- `get`- who may pick up the object and carry it around.
|
||||
|
|
@ -330,7 +330,7 @@ error message. Sounds good! Let's start by setting that on the box:
|
|||
Next we need to craft a Lock of type *get* on our box. We want it to only be passed if the accessing
|
||||
object has the attribute *strength* of the right value. For this we would need to create a lock
|
||||
function that checks if attributes have a value greater than a given value. Luckily there is already
|
||||
such a one included in evennia (see `evennia/locks/lockfuncs.py`), called `attr_gt`.
|
||||
such a one included in Evennia (see `evennia/locks/lockfuncs.py`), called `attr_gt`.
|
||||
|
||||
So the lock string will look like this: `get:attr_gt(strength, 50)`. We put this on the box now:
|
||||
|
||||
|
|
|
|||
|
|
@ -84,11 +84,11 @@ Translations are found in the core `evennia/` library, under
|
|||
`evennia/evennia/locale/`. You must make sure to have cloned this repository
|
||||
from [Evennia's github](github:evennia) before you can proceed.
|
||||
|
||||
If you cannot find your language in `evennia/evennia/locale/` it's because noone
|
||||
If you cannot find your language in `evennia/evennia/locale/` it's because no one
|
||||
has translated it yet. Alternatively you might have the language but find the
|
||||
translation bad ... You are welcome to help improve the situation!
|
||||
|
||||
To start a new translation you need to first have cloned the Evennia repositry
|
||||
To start a new translation you need to first have cloned the Evennia repository
|
||||
with GIT and activated a python virtualenv as described on the
|
||||
[Setup Quickstart](../Setup/Installation.md) page.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,26 @@
|
|||
# Components
|
||||
|
||||
_Contrib by ChrisLR 2021_
|
||||
Contrib by ChrisLR, 2021
|
||||
|
||||
# The Components Contrib
|
||||
Expand typeclasses using a components/composition approach.
|
||||
|
||||
## The Components Contrib
|
||||
|
||||
This contrib introduces Components and Composition to Evennia.
|
||||
Each 'Component' class represents a feature that will be 'enabled' on a typeclass instance.
|
||||
You can register these components on an entire typeclass or a single object at runtime.
|
||||
It supports both persisted attributes and in-memory attributes by using Evennia's AttributeHandler.
|
||||
|
||||
# Pros
|
||||
## Pros
|
||||
- You can reuse a feature across multiple typeclasses without inheritance
|
||||
- You can cleanly organize each feature into a self-contained class.
|
||||
- You can check if your object supports a feature without checking its instance.
|
||||
|
||||
# Cons
|
||||
## Cons
|
||||
- It introduces additional complexity.
|
||||
- A host typeclass instance is required.
|
||||
|
||||
# How to install
|
||||
## How to install
|
||||
|
||||
To enable component support for a typeclass,
|
||||
import and inherit the ComponentHolderMixin, similar to this
|
||||
|
|
@ -126,7 +128,7 @@ from typeclasses.components import health
|
|||
```
|
||||
Both of the above examples will work.
|
||||
|
||||
# Full Example
|
||||
## Full Example
|
||||
```python
|
||||
from evennia.contrib.base_systems import components
|
||||
|
||||
|
|
@ -134,7 +136,7 @@ from evennia.contrib.base_systems import components
|
|||
# This is the Component class
|
||||
class Health(components.Component):
|
||||
name = "health"
|
||||
|
||||
|
||||
# Stores the current and max values as Attributes on the host, defaulting to 100
|
||||
current = components.DBField(default=100)
|
||||
max = components.DBField(default=100)
|
||||
|
|
@ -185,7 +187,7 @@ class Attack(Command):
|
|||
# Attempt to retrieve the component, None is obtained if it does not exist.
|
||||
if target.components.health:
|
||||
valid_target = target
|
||||
|
||||
|
||||
if not valid_target:
|
||||
caller.msg("You can't attack that!")
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -111,9 +111,9 @@ Additional color markup styles for Evennia (extending or replacing the default
|
|||
|
||||
### `components`
|
||||
|
||||
__Contrib by ChrisLR 2021__
|
||||
_Contrib by ChrisLR, 2021_
|
||||
|
||||
# The Components Contrib
|
||||
Expand typeclasses using a components/composition approach.
|
||||
|
||||
[Read the documentation](./Contrib-Components.md) - [Browse the Code](evennia.contrib.base_systems.components)
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ If you try the `get` command, we will pick up the box. So far so good, but if we
|
|||
|
||||
lock box = get:false()
|
||||
|
||||
Locks represent a rather [big topic](../../../Components/Locks.md), but for now that will do what we want. This will lock the box so noone can lift it. The exception is superusers, they override all locks and will pick it
|
||||
Locks represent a rather [big topic](../../../Components/Locks.md), but for now that will do what we want. This will lock the box so no one can lift it. The exception is superusers, they override all locks and will pick it
|
||||
up anyway. Make sure you are quelling your superuser powers and try to get the box now:
|
||||
|
||||
> get box
|
||||
|
|
@ -142,7 +142,7 @@ You create your own scripts in Python, outside the game; the path you give to `s
|
|||
|
||||
## Pushing Your Buttons
|
||||
|
||||
If we get back to the box we made, there is only so much fun you can have with it at this point. It's just a dumb generic object. If you renamed it to `stone` and changed its description, noone would be the wiser. However, with the combined use of custom [Typeclasses](../../../Components/Typeclasses.md), [Scripts](../../../Components/Scripts.md)
|
||||
If we get back to the box we made, there is only so much fun you can have with it at this point. It's just a dumb generic object. If you renamed it to `stone` and changed its description, no one would be the wiser. However, with the combined use of custom [Typeclasses](../../../Components/Typeclasses.md), [Scripts](../../../Components/Scripts.md)
|
||||
and object-based [Commands](../../../Components/Commands.md), you could expand it and other items to be as unique, complex
|
||||
and interactive as you want.
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ Let's make us one of _those_!
|
|||
|
||||
create/drop button:tutorials.red_button.RedButton
|
||||
|
||||
The same way we did with the Script Earler, we specify a "Python-path" to the Python code we want Evennia to use for creating the object. There you go - one red button.
|
||||
The same way we did with the Script earlier, we specify a "Python-path" to the Python code we want Evennia to use for creating the object. There you go - one red button.
|
||||
|
||||
The RedButton is an example object intended to show off a few of Evennia's features. You will find that the [Typeclass](../../../Components/Typeclasses.md) and [Commands](../../../Components/Commands.md) controlling it are inside [evennia/contrib/tutorials/red_button](../../../api/evennia.contrib.tutorials.red_button.md)
|
||||
|
||||
|
|
@ -240,4 +240,4 @@ You will now find your new `History` entry in the `help` list and read your help
|
|||
|
||||
## Adding a World
|
||||
|
||||
After this brief introduction to building and using in-game commands you may be ready to see a more fleshed-out example. Evennia comes with a tutorial world for you to explore. We will try that out in the next lesson.
|
||||
After this brief introduction to building and using in-game commands you may be ready to see a more fleshed-out example. Evennia comes with a tutorial world for you to explore. We will try that out in the next lesson.
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ class EvAdventureRollEngine:
|
|||
defender_defense = getattr(defender, defense_type.value, 1) + 10
|
||||
result, quality = self.saving_throw(attacker, bonus_type=attack_type,
|
||||
target=defender_defense,
|
||||
advantage=advantave, disadvantage=disadvantage)
|
||||
advantage=advantage, disadvantage=disadvantage)
|
||||
|
||||
return result, quality
|
||||
```
|
||||
|
|
@ -584,8 +584,8 @@ class TestEvAdventureRuleEngine(BaseEvenniaTest):
|
|||
@patch("evadventure.rules.randint")
|
||||
def test_roll(self, mock_randint):
|
||||
mock_randint.return_value = 4
|
||||
self.assertEqual(self.roll_engine.roll("1d6", 4)
|
||||
self.assertEqual(self.roll_engine.roll("2d6", 2 * 4)
|
||||
self.assertEqual(self.roll_engine.roll("1d6", 4))
|
||||
self.assertEqual(self.roll_engine.roll("2d6"), 2 * 4)
|
||||
|
||||
# test of the other rule methods below ...
|
||||
```
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ are very dedicated.
|
|||
Many games, even the most roleplay-dedicated, thus tend to allow for players to mediate themselves
|
||||
to some extent. A common way to do this is to introduce *coded systems* - that is, to let the
|
||||
computer do some of the heavy lifting. A basic thing is to add an online dice-roller so everyone can
|
||||
make rolls and make sure noone is cheating. Somewhere at this level you find the most bare-bones
|
||||
make rolls and make sure no one is cheating. Somewhere at this level you find the most bare-bones
|
||||
roleplaying MUSHes.
|
||||
|
||||
The advantage of a coded system is that as long as the rules are fair the computer is too - it makes
|
||||
|
|
@ -236,4 +236,4 @@ Note how simple the command becomes and how generic you can make it. It becomes
|
|||
number of Combat commands by just extending this functionality - you can easily roll challenges and
|
||||
pick different skills to check. And if you ever decided to, say, change how to determine hit chance,
|
||||
you don't have to change every command, but need only change the single `roll_hit` function inside
|
||||
your `rules` module.
|
||||
your `rules` module.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class NPCMerchant(Object):
|
|||
def open_shop(self, shopper):
|
||||
menunodes = {} # TODO!
|
||||
shopname = self.db.shopname or "The shop"
|
||||
EvMenu(shopper, menunodes, startnode="shop_start",
|
||||
EvMenu(shopper, menunodes, startnode="shopfront",
|
||||
shopname=shopname, shopkeeper=self, wares=self.contents)
|
||||
|
||||
```
|
||||
|
|
@ -215,7 +215,7 @@ class NPCMerchant(Object):
|
|||
"inspect_and_buy": node_inspect_and_buy
|
||||
}
|
||||
shopname = self.db.shopname or "The shop"
|
||||
EvMenu(shopper, menunodes, startnode="shop_start",
|
||||
EvMenu(shopper, menunodes, startnode="shopfront",
|
||||
shopname=shopname, shopkeeper=self, wares=self.contents)
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ If `localhost` doesn't work when trying to connect to your local game, try `127.
|
|||
## Mac Troubleshooting
|
||||
|
||||
- Some Mac users have reported not being able to connect to `localhost` (i.e. your own computer). If so, try to connect to `127.0.0.1` instead, which is the same thing. Use port 4000 from mud clients and port 4001 from the web browser as usual.
|
||||
- If you get a `MemoryError` when starting Evennia, or when looking at the log, this may be due to an sqlite versioning issue. [A user in our forums](https://github.com/evennia/evennia/discussions/2638#discussioncomment-3630761) found a working solution for this. [Here](https://github.com/evennia/evennia/issues/3120#issuecomment-1442540538) is another variation to solve it.
|
||||
|
||||
## Windows Troubleshooting
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue