mirror of
https://github.com/evennia/evennia.git
synced 2026-03-17 21:36:30 +01:00
Rename all at_before/after hooks to at_pre/post. Old names still work but are deprecated. Resolves #1454.
This commit is contained in:
parent
81cacc5ba0
commit
b1ebbbecd3
21 changed files with 106 additions and 102 deletions
|
|
@ -35,12 +35,12 @@ for more info.
|
|||
**Q:** How does one keep a character from using any exit, if they meet a certain condition? (I.E. in
|
||||
combat, immobilized, etc.)
|
||||
|
||||
**A:** The `at_before_move` hook is called by Evennia just before performing any move. If it returns
|
||||
**A:** The `at_pre_move` hook is called by Evennia just before performing any move. If it returns
|
||||
`False`, the move is aborted. Let's say we want to check for an [Attribute](../Components/Attributes.md) `cantmove`.
|
||||
Add the following code to the `Character` class:
|
||||
|
||||
```python
|
||||
def at_before_move(self, destination):
|
||||
def at_pre_move(self, destination):
|
||||
"Called just before trying to move"
|
||||
if self.db.cantmove: # replace with condition you want to test
|
||||
self.msg("Something is preventing you from moving!")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue