Update links/paths to new contrib locations
This commit is contained in:
parent
7f2b8c81d7
commit
8139fd79c7
61 changed files with 171 additions and 248 deletions
|
|
@ -2186,7 +2186,7 @@ class TestBatchProcess(CommandTest):
|
||||||
self.call(
|
self.call(
|
||||||
batchprocess.CmdBatchCommands(),
|
batchprocess.CmdBatchCommands(),
|
||||||
"batchprocessor.example_batch_cmds",
|
"batchprocessor.example_batch_cmds",
|
||||||
"Running Batch-command processor - Automatic mode for example_batch_cmds",
|
"Running Batch-command processor - Automatic mode for batchprocessor.example_batch_cmds",
|
||||||
)
|
)
|
||||||
# we make sure to delete the button again here to stop the running reactor
|
# we make sure to delete the button again here to stop the running reactor
|
||||||
confirm = building.CmdDestroy.confirm
|
confirm = building.CmdDestroy.confirm
|
||||||
|
|
|
||||||
0
evennia/contrib/base_systems/__init__.py
Normal file
0
evennia/contrib/base_systems/__init__.py
Normal file
|
|
@ -11,7 +11,7 @@ import datetime, gzip, pickle, threading
|
||||||
_SKIP = False
|
_SKIP = False
|
||||||
try:
|
try:
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
from evennia.contrib.awsstorage import aws_s3_cdn as s3boto3
|
from .awsstorage import aws_s3_cdn as s3boto3
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_SKIP = True
|
_SKIP = True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,11 @@ that will edit any default object offering to change its key and description.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
1. Import the `GenericBuildingCmd` class from this contrib in your `mygame/commands/default_cmdset.py` file:
|
1. Import the `GenericBuildingCmd` class from this contrib in your
|
||||||
|
`mygame/commands/default_cmdset.py` file:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from evennia.base_systems.contrib.building_menu import GenericBuildingCmd
|
from evennia.contrib.base_systems.building_menu import GenericBuildingCmd
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Below, add the command in the `CharacterCmdSet`:
|
2. Below, add the command in the `CharacterCmdSet`:
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ The first thing to do is to create a new module and place a class
|
||||||
inheriting from `BuildingMenu` in it.
|
inheriting from `BuildingMenu` in it.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from evennia.contrib.building_menu.building_menu import BuildingMenu
|
from evennia.contrib.base_systems.building_menu.building_menu import BuildingMenu
|
||||||
|
|
||||||
class RoomBuildingMenu(BuildingMenu):
|
class RoomBuildingMenu(BuildingMenu):
|
||||||
# ...
|
# ...
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ class TestBuildingMenu(CommandTest):
|
||||||
"""Test to add sub-menus."""
|
"""Test to add sub-menus."""
|
||||||
|
|
||||||
def open_exit(menu):
|
def open_exit(menu):
|
||||||
menu.open_submenu("evennia.contrib.tests.Submenu", self.exit)
|
menu.open_submenu("evennia.contrib.base_systems.building_menu.tests.Submenu", self.exit)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.menu.add_choice("exit", key="x", on_enter=open_exit)
|
self.menu.add_choice("exit", key="x", on_enter=open_exit)
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ To add the `%c-` "mux/mush" style, add the following to your settings file, then
|
||||||
reboot both Server and Portal:
|
reboot both Server and Portal:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from evennia.contrib import color_markups
|
from evennia.contrib.base_systems import color_markups
|
||||||
COLOR_ANSI_EXTRA_MAP = color_markups.MUX_COLOR_ANSI_EXTRA_MAP
|
COLOR_ANSI_EXTRA_MAP = color_markups.MUX_COLOR_ANSI_EXTRA_MAP
|
||||||
COLOR_XTERM256_EXTRA_FG = color_markups.MUX_COLOR_XTERM256_EXTRA_FG
|
COLOR_XTERM256_EXTRA_FG = color_markups.MUX_COLOR_XTERM256_EXTRA_FG
|
||||||
COLOR_XTERM256_EXTRA_BG = color_markups.MUX_COLOR_XTERM256_EXTRA_BG
|
COLOR_XTERM256_EXTRA_BG = color_markups.MUX_COLOR_XTERM256_EXTRA_BG
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,7 @@ def schedule(callback, repeat=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
seconds = real_seconds_until(**kwargs)
|
seconds = real_seconds_until(**kwargs)
|
||||||
script = create_script(
|
script = create_script(
|
||||||
"evennia.contrib.custom_gametime.GametimeScript",
|
"evennia.contrib.base_systems.custom_gametime.GametimeScript",
|
||||||
key="GametimeScript",
|
key="GametimeScript",
|
||||||
desc="A timegame-sensitive script",
|
desc="A timegame-sensitive script",
|
||||||
interval=seconds,
|
interval=seconds,
|
||||||
|
|
|
||||||
|
|
@ -84,10 +84,10 @@ This is the quick summary. Scroll down for more detailed help on each step.
|
||||||
default to `None`).
|
default to `None`).
|
||||||
3. Add the `call` command.
|
3. Add the `call` command.
|
||||||
4. Inherit from the custom typeclasses of the in-game Python system.
|
4. Inherit from the custom typeclasses of the in-game Python system.
|
||||||
- `evennia.contrib.ingame_python.typeclasses.EventCharacter`: to replace `DefaultCharacter`.
|
- `evennia.contrib.base_systems.ingame_python.typeclasses.EventCharacter`: to replace `DefaultCharacter`.
|
||||||
- `evennia.contrib.ingame_python.typeclasses.EventExit`: to replace `DefaultExit`.
|
- `evennia.contrib.base_systems.ingame_python.typeclasses.EventExit`: to replace `DefaultExit`.
|
||||||
- `evennia.contrib.ingame_python.typeclasses.EventObject`: to replace `DefaultObject`.
|
- `evennia.contrib.base_systems.ingame_python.typeclasses.EventObject`: to replace `DefaultObject`.
|
||||||
- `evennia.contrib.ingame_python.typeclasses.EventRoom`: to replace `DefaultRoom`.
|
- `evennia.contrib.base_systems.ingame_python.typeclasses.EventRoom`: to replace `DefaultRoom`.
|
||||||
|
|
||||||
The following sections describe in details each step of the installation.
|
The following sections describe in details each step of the installation.
|
||||||
|
|
||||||
|
|
@ -181,7 +181,7 @@ this:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from evennia import default_cmds
|
from evennia import default_cmds
|
||||||
from evennia.contrib.ingame_python.commands import CmdCallback
|
from evennia.contrib.base_systems.ingame_python.commands import CmdCallback
|
||||||
|
|
||||||
class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||||
"""
|
"""
|
||||||
|
|
@ -679,8 +679,8 @@ Here, we want to add a "push" event on objects. In your `typeclasses/objects.py
|
||||||
write something like:
|
write something like:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from evennia.contrib.ingame_python.utils import register_events
|
from evennia.contrib.base_systems.ingame_python.utils import register_events
|
||||||
from evennia.contrib.ingame_python.typeclasses import EventObject
|
from evennia.contrib.base_systems.ingame_python.typeclasses import EventObject
|
||||||
|
|
||||||
EVENT_PUSH = """
|
EVENT_PUSH = """
|
||||||
A character push the object.
|
A character push the object.
|
||||||
|
|
@ -806,14 +806,15 @@ see a message about a "beautiful ant-hill".
|
||||||
|
|
||||||
### Adding new eventfuncs
|
### Adding new eventfuncs
|
||||||
|
|
||||||
Eventfuncs, like `deny()`, are defined in `contrib/events/eventfuncs.py`. You can add your own
|
Eventfuncs, like `deny()`, are defined in
|
||||||
eventfuncs by creating a file named `eventfuncs.py` in your `world` directory. The functions
|
`contrib/base_systesm/ingame_python/eventfuncs.py`. You can add your own
|
||||||
defined in this file will be added as helpers.
|
eventfuncs by creating a file named `eventfuncs.py` in your `world` directory.
|
||||||
|
The functions defined in this file will be added as helpers.
|
||||||
|
|
||||||
You can also decide to create your eventfuncs in another location, or even in several locations. To
|
You can also decide to create your eventfuncs in another location, or even in
|
||||||
do so, edit the `EVENTFUNCS_LOCATION` setting in your `server/conf/settings.py` file, specifying
|
several locations. To do so, edit the `EVENTFUNCS_LOCATION` setting in your
|
||||||
either a python path or a list of Python paths in which your helper functions are defined. For
|
`server/conf/settings.py` file, specifying either a python path or a list of
|
||||||
instance:
|
Python paths in which your helper functions are defined. For instance:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
EVENTFUNCS_LOCATIONS = [
|
EVENTFUNCS_LOCATIONS = [
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class EventHandler(DefaultScript):
|
||||||
# Generate locals
|
# Generate locals
|
||||||
self.ndb.current_locals = {}
|
self.ndb.current_locals = {}
|
||||||
self.ndb.fresh_locals = {}
|
self.ndb.fresh_locals = {}
|
||||||
addresses = ["evennia.contrib.ingame_python.eventfuncs"]
|
addresses = ["evennia.contrib.base_systems.ingame_python.eventfuncs"]
|
||||||
addresses.extend(getattr(settings, "EVENTFUNCS_LOCATIONS", ["world.eventfuncs"]))
|
addresses.extend(getattr(settings, "EVENTFUNCS_LOCATIONS", ["world.eventfuncs"]))
|
||||||
for address in addresses:
|
for address in addresses:
|
||||||
if pypath_to_realpath(address):
|
if pypath_to_realpath(address):
|
||||||
|
|
@ -87,7 +87,7 @@ class EventHandler(DefaultScript):
|
||||||
delay(seconds, complete_task, task_id)
|
delay(seconds, complete_task, task_id)
|
||||||
|
|
||||||
# Place the script in the CallbackHandler
|
# Place the script in the CallbackHandler
|
||||||
from evennia.contrib.ingame_python import typeclasses
|
from evennia.contrib.base_systems.ingame_python import typeclasses
|
||||||
|
|
||||||
CallbackHandler.script = self
|
CallbackHandler.script = self
|
||||||
DefaultObject.callbacks = typeclasses.EventObject.callbacks
|
DefaultObject.callbacks = typeclasses.EventObject.callbacks
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,18 @@ class TestEventHandler(EvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Create the event handler."""
|
"""Create the event handler."""
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.handler = create_script("evennia.contrib.ingame_python.scripts.EventHandler")
|
self.handler = create_script("evennia.contrib.base_systems.ingame_python.scripts.EventHandler")
|
||||||
|
|
||||||
# Copy old events if necessary
|
# Copy old events if necessary
|
||||||
if OLD_EVENTS:
|
if OLD_EVENTS:
|
||||||
self.handler.ndb.events = dict(OLD_EVENTS)
|
self.handler.ndb.events = dict(OLD_EVENTS)
|
||||||
|
|
||||||
# Alter typeclasses
|
# Alter typeclasses
|
||||||
self.char1.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventCharacter")
|
self.char1.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventCharacter")
|
||||||
self.char2.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventCharacter")
|
self.char2.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventCharacter")
|
||||||
self.room1.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventRoom")
|
self.room1.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventRoom")
|
||||||
self.room2.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventRoom")
|
self.room2.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventRoom")
|
||||||
self.exit.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventExit")
|
self.exit.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventExit")
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Stop the event handler."""
|
"""Stop the event handler."""
|
||||||
|
|
@ -253,18 +253,18 @@ class TestCmdCallback(CommandTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Create the callback handler."""
|
"""Create the callback handler."""
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.handler = create_script("evennia.contrib.ingame_python.scripts.EventHandler")
|
self.handler = create_script("evennia.contrib.base_systems.ingame_python.scripts.EventHandler")
|
||||||
|
|
||||||
# Copy old events if necessary
|
# Copy old events if necessary
|
||||||
if OLD_EVENTS:
|
if OLD_EVENTS:
|
||||||
self.handler.ndb.events = dict(OLD_EVENTS)
|
self.handler.ndb.events = dict(OLD_EVENTS)
|
||||||
|
|
||||||
# Alter typeclasses
|
# Alter typeclasses
|
||||||
self.char1.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventCharacter")
|
self.char1.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventCharacter")
|
||||||
self.char2.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventCharacter")
|
self.char2.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventCharacter")
|
||||||
self.room1.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventRoom")
|
self.room1.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventRoom")
|
||||||
self.room2.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventRoom")
|
self.room2.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventRoom")
|
||||||
self.exit.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventExit")
|
self.exit.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventExit")
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Stop the callback handler."""
|
"""Stop the callback handler."""
|
||||||
|
|
@ -272,7 +272,7 @@ class TestCmdCallback(CommandTest):
|
||||||
OLD_EVENTS.update(self.handler.ndb.events)
|
OLD_EVENTS.update(self.handler.ndb.events)
|
||||||
self.handler.delete()
|
self.handler.delete()
|
||||||
for script in ScriptDB.objects.filter(
|
for script in ScriptDB.objects.filter(
|
||||||
db_typeclass_path="evennia.contrib.ingame_python.scripts.TimeEventScript"
|
db_typeclass_path="evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript"
|
||||||
):
|
):
|
||||||
script.delete()
|
script.delete()
|
||||||
|
|
||||||
|
|
@ -432,18 +432,18 @@ class TestDefaultCallbacks(CommandTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Create the callback handler."""
|
"""Create the callback handler."""
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.handler = create_script("evennia.contrib.ingame_python.scripts.EventHandler")
|
self.handler = create_script("evennia.contrib.base_systems.ingame_python.scripts.EventHandler")
|
||||||
|
|
||||||
# Copy old events if necessary
|
# Copy old events if necessary
|
||||||
if OLD_EVENTS:
|
if OLD_EVENTS:
|
||||||
self.handler.ndb.events = dict(OLD_EVENTS)
|
self.handler.ndb.events = dict(OLD_EVENTS)
|
||||||
|
|
||||||
# Alter typeclasses
|
# Alter typeclasses
|
||||||
self.char1.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventCharacter")
|
self.char1.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventCharacter")
|
||||||
self.char2.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventCharacter")
|
self.char2.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventCharacter")
|
||||||
self.room1.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventRoom")
|
self.room1.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventRoom")
|
||||||
self.room2.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventRoom")
|
self.room2.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventRoom")
|
||||||
self.exit.swap_typeclass("evennia.contrib.ingame_python.typeclasses.EventExit")
|
self.exit.swap_typeclass("evennia.contrib.base_systems.ingame_python.typeclasses.EventExit")
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Stop the callback handler."""
|
"""Stop the callback handler."""
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ def time_event(obj, event_name, number, parameters):
|
||||||
"""
|
"""
|
||||||
seconds, usual, key = get_next_wait(parameters)
|
seconds, usual, key = get_next_wait(parameters)
|
||||||
script = create_script(
|
script = create_script(
|
||||||
"evennia.contrib.ingame_python.scripts.TimeEventScript", interval=seconds, obj=obj
|
"evennia.contrib.base_systems.ingame_python.scripts.TimeEventScript", interval=seconds, obj=obj
|
||||||
)
|
)
|
||||||
script.key = key
|
script.key = key
|
||||||
script.desc = "event on {}".format(key)
|
script.desc = "event on {}".format(key)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ sequence instead of requiring you to enter both at once.
|
||||||
|
|
||||||
To install, add this line to the settings file (`mygame/server/conf/settings.py`):
|
To install, add this line to the settings file (`mygame/server/conf/settings.py`):
|
||||||
|
|
||||||
CMDSET_UNLOGGEDIN = "evennia.base_systems.contrib.menu_login.UnloggedinCmdSet"
|
CMDSET_UNLOGGEDIN = "evennia.contrib.base_systems.menu_login.UnloggedinCmdSet"
|
||||||
|
|
||||||
Reload the server and the new connection method will be active. Note that you must
|
Reload the server and the new connection method will be active. Note that you must
|
||||||
independently change the connection screen to match this login style, by editing
|
independently change the connection screen to match this login style, by editing
|
||||||
|
|
@ -244,7 +244,7 @@ class CmdUnloggedinLook(Command):
|
||||||
"""
|
"""
|
||||||
EvMenu(
|
EvMenu(
|
||||||
self.caller,
|
self.caller,
|
||||||
"evennia.contrib.menu_login",
|
"evennia.contrib.base_systems.menu_login",
|
||||||
startnode="node_enter_username",
|
startnode="node_enter_username",
|
||||||
auto_look=False,
|
auto_look=False,
|
||||||
auto_quit=False,
|
auto_quit=False,
|
||||||
|
|
|
||||||
0
evennia/contrib/full_systems/__init__.py
Normal file
0
evennia/contrib/full_systems/__init__.py
Normal file
|
|
@ -29,7 +29,7 @@ In `mygame/commands/default_cmdsets.py`:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
||||||
from evennia.contrib.evscaperoom.commands import CmdEvscapeRoomStart
|
from evennia.contrib.full_systems.evscaperoom.commands import CmdEvscapeRoomStart
|
||||||
|
|
||||||
class CharacterCmdSet(...):
|
class CharacterCmdSet(...):
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ comes with a small (very small) escape room as an example.
|
||||||
To do this, you need to make your own states. First make sure you can play the
|
To do this, you need to make your own states. First make sure you can play the
|
||||||
simple example room installed above.
|
simple example room installed above.
|
||||||
|
|
||||||
Copy `evennia/contrib/evscaperoom/states` to somewhere in your game folder (let's
|
Copy `evennia/contrib/full_systems/evscaperoom/states` to somewhere in your game folder (let's
|
||||||
assume you put it under `mygame/world/`).
|
assume you put it under `mygame/world/`).
|
||||||
|
|
||||||
Next you need to re-point Evennia to look for states in this new location. Add
|
Next you need to re-point Evennia to look for states in this new location. Add
|
||||||
|
|
@ -70,7 +70,7 @@ There are a few other settings that may be useful:
|
||||||
want some other naming scheme.
|
want some other naming scheme.
|
||||||
- `HELP_SUMMARY_TEXT` - this is the help blurb shown when entering `help` in
|
- `HELP_SUMMARY_TEXT` - this is the help blurb shown when entering `help` in
|
||||||
the room without an argument. The original is found at the top of
|
the room without an argument. The original is found at the top of
|
||||||
`evennia/contrib/evscaperoom/commands.py`.
|
`evennia/contrib/full_systems/evscaperoom/commands.py`.
|
||||||
|
|
||||||
# Playing the game
|
# Playing the game
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ from .utils import create_evscaperoom_object, msg_cinematic, parse_for_things
|
||||||
if hasattr(settings, "EVSCAPEROOM_STATE_PACKAGE"):
|
if hasattr(settings, "EVSCAPEROOM_STATE_PACKAGE"):
|
||||||
_ROOMSTATE_PACKAGE = settings.EVSCAPEROOM_STATE_PACKAGE
|
_ROOMSTATE_PACKAGE = settings.EVSCAPEROOM_STATE_PACKAGE
|
||||||
else:
|
else:
|
||||||
_ROOMSTATE_PACKAGE = "evennia.contrib.evscaperoom.states"
|
_ROOMSTATE_PACKAGE = "evennia.contrib.full_systems.evscaperoom.states"
|
||||||
if hasattr(settings, "EVSCAPEROOM_START_STATE"):
|
if hasattr(settings, "EVSCAPEROOM_START_STATE"):
|
||||||
_FIRST_STATE = settings.EVSCAPEROOM_START_STATE
|
_FIRST_STATE = settings.EVSCAPEROOM_START_STATE
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ system but they don't necessarily need to follow each other in the exact
|
||||||
sequence.
|
sequence.
|
||||||
|
|
||||||
Each state module must make a class `State` available in the global scope. This
|
Each state module must make a class `State` available in the global scope. This
|
||||||
should be a child of `evennia.contrib.evscaperoom.state.BaseState`. The
|
should be a child of `evennia.contrib.full_systems/evscaperoom.state.BaseState`. The
|
||||||
methods on this class will be called to initialize the state and clean up etc.
|
methods on this class will be called to initialize the state and clean up etc.
|
||||||
There are no other restrictions on the module.
|
There are no other restrictions on the module.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ teleported back to the evscaperoom menu.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from evennia.contrib.evscaperoom.state import BaseState
|
from evennia.contrib.full_systems.evscaperoom.state import BaseState
|
||||||
from evennia.contrib.evscaperoom import objects
|
from evennia.contrib.full_systems.evscaperoom import objects
|
||||||
|
|
||||||
GREETING = """
|
GREETING = """
|
||||||
This is the situation, {name}:
|
This is the situation, {name}:
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ class TestStates(EvenniaTest):
|
||||||
dirname = path.join(path.dirname(__file__), "states")
|
dirname = path.join(path.dirname(__file__), "states")
|
||||||
states = []
|
states = []
|
||||||
for imp, module, ispackage in pkgutil.walk_packages(
|
for imp, module, ispackage in pkgutil.walk_packages(
|
||||||
path=[dirname], prefix="evennia.contrib.evscaperoom.states."
|
path=[dirname], prefix="evennia.contrib.full_systems.evscaperoom.states."
|
||||||
):
|
):
|
||||||
mod = mod_import(module)
|
mod = mod_import(module)
|
||||||
states.append(mod)
|
states.append(mod)
|
||||||
|
|
|
||||||
0
evennia/contrib/game_systems/__init__.py
Normal file
0
evennia/contrib/game_systems/__init__.py
Normal file
|
|
@ -1,83 +0,0 @@
|
||||||
# Clothing
|
|
||||||
|
|
||||||
Evennia contribution - Tim Ashley Jenkins 2017
|
|
||||||
|
|
||||||
Provides a typeclass and commands for wearable clothing,
|
|
||||||
which is appended to a character's description when worn.
|
|
||||||
|
|
||||||
Clothing items, when worn, are added to the character's description
|
|
||||||
in a list. For example, if wearing the following clothing items:
|
|
||||||
|
|
||||||
a thin and delicate necklace
|
|
||||||
a pair of regular ol' shoes
|
|
||||||
one nice hat
|
|
||||||
a very pretty dress
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
To install, import this module and have your default character
|
|
||||||
inherit from ClothedCharacter in your game's characters.py file:
|
|
||||||
|
|
||||||
```python
|
|
||||||
|
|
||||||
from evennia.contrib.game_systems.clothing import ClothedCharacter
|
|
||||||
|
|
||||||
class Character(ClothedCharacter):
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
And then add `ClothedCharacterCmdSet` in your character set in
|
|
||||||
`mygame/commands/default_cmdsets.py`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
|
|
||||||
from evennia.contrib.game_systems.clothing import ClothedCharacterCmdSet <--
|
|
||||||
|
|
||||||
class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
|
||||||
...
|
|
||||||
at_cmdset_creation(self):
|
|
||||||
|
|
||||||
super().at_cmdset_creation()
|
|
||||||
...
|
|
||||||
self.add(ClothedCharacterCmdSet) # <--
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
From here, you can use the default builder commands to create clothes
|
|
||||||
with which to test the system:
|
|
||||||
|
|
||||||
create a pretty shirt : evennia.contrib.clothing.Clothing
|
|
||||||
set shirt/clothing_type = 'top'
|
|
||||||
wear shirt
|
|
||||||
|
|
||||||
A character's description may look like this:
|
|
||||||
|
|
||||||
Superuser(#1)
|
|
||||||
This is User #1.
|
|
||||||
|
|
||||||
Superuser is wearing one nice hat, a thin and delicate necklace,
|
|
||||||
a very pretty dress and a pair of regular ol' shoes.
|
|
||||||
|
|
||||||
Characters can also specify the style of wear for their clothing - I.E.
|
|
||||||
to wear a scarf 'tied into a tight knot around the neck' or 'draped
|
|
||||||
loosely across the shoulders' - to add an easy avenue of customization.
|
|
||||||
For example, after entering:
|
|
||||||
|
|
||||||
wear scarf draped loosely across the shoulders
|
|
||||||
|
|
||||||
The garment appears like so in the description:
|
|
||||||
|
|
||||||
Superuser(#1)
|
|
||||||
This is User #1.
|
|
||||||
|
|
||||||
Superuser is wearing a fanciful-looking scarf draped loosely
|
|
||||||
across the shoulders.
|
|
||||||
|
|
||||||
Items of clothing can be used to cover other items, and many options
|
|
||||||
are provided to define your own clothing types and their limits and
|
|
||||||
behaviors. For example, to have undergarments automatically covered
|
|
||||||
by outerwear, or to put a limit on the number of each type of item
|
|
||||||
that can be worn. The system as-is is fairly freeform - you
|
|
||||||
can cover any garment with almost any other, for example - but it
|
|
||||||
can easily be made more restrictive, and can even be tied into a
|
|
||||||
system for armor or other equipment.
|
|
||||||
|
|
@ -46,7 +46,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||||
From here, you can use the default builder commands to create clothes
|
From here, you can use the default builder commands to create clothes
|
||||||
with which to test the system:
|
with which to test the system:
|
||||||
|
|
||||||
create a pretty shirt : evennia.contrib.clothing.Clothing
|
create a pretty shirt : evennia.contrib.game_systems.clothing.Clothing
|
||||||
set shirt/clothing_type = 'top'
|
set shirt/clothing_type = 'top'
|
||||||
wear shirt
|
wear shirt
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,14 @@ system for armor or other equipment.
|
||||||
To install, import this module and have your default character
|
To install, import this module and have your default character
|
||||||
inherit from ClothedCharacter in your game's characters.py file:
|
inherit from ClothedCharacter in your game's characters.py file:
|
||||||
|
|
||||||
from evennia.contrib.clothing import ClothedCharacter
|
from evennia.contrib.game_systems.clothing import ClothedCharacter
|
||||||
|
|
||||||
class Character(ClothedCharacter):
|
class Character(ClothedCharacter):
|
||||||
|
|
||||||
And then add ClothedCharacterCmdSet in your character set in your
|
And then add ClothedCharacterCmdSet in your character set in your
|
||||||
game's commands/default_cmdsets.py:
|
game's commands/default_cmdsets.py:
|
||||||
|
|
||||||
from evennia.contrib.clothing import ClothedCharacterCmdSet
|
from evennia.contrib.game_systems.clothing import ClothedCharacterCmdSet
|
||||||
|
|
||||||
class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
||||||
...
|
...
|
||||||
|
|
@ -67,7 +67,7 @@ game's commands/default_cmdsets.py:
|
||||||
From here, you can use the default builder commands to create clothes
|
From here, you can use the default builder commands to create clothes
|
||||||
with which to test the system:
|
with which to test the system:
|
||||||
|
|
||||||
@create a pretty shirt : evennia.contrib.clothing.Clothing
|
@create a pretty shirt : evennia.contrib.game_systems.clothing.Clothing
|
||||||
@set shirt/clothing_type = 'top'
|
@set shirt/clothing_type = 'top'
|
||||||
wear shirt
|
wear shirt
|
||||||
|
|
||||||
|
|
@ -389,7 +389,7 @@ class CmdWear(MuxCommand):
|
||||||
if not clothing:
|
if not clothing:
|
||||||
self.caller.msg("Thing to wear must be in your inventory.")
|
self.caller.msg("Thing to wear must be in your inventory.")
|
||||||
return
|
return
|
||||||
if not clothing.is_typeclass("evennia.contrib.clothing.Clothing", exact=False):
|
if not clothing.is_typeclass("evennia.contrib.game_systems.clothing.Clothing", exact=False):
|
||||||
self.caller.msg("That's not clothes!")
|
self.caller.msg("That's not clothes!")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -492,10 +492,10 @@ class CmdCover(MuxCommand):
|
||||||
cover_with = self.caller.search(self.arglist[1], candidates=self.caller.contents)
|
cover_with = self.caller.search(self.arglist[1], candidates=self.caller.contents)
|
||||||
if not to_cover or not cover_with:
|
if not to_cover or not cover_with:
|
||||||
return
|
return
|
||||||
if not to_cover.is_typeclass("evennia.contrib.clothing.Clothing", exact=False):
|
if not to_cover.is_typeclass("evennia.contrib.game_systems.clothing.Clothing", exact=False):
|
||||||
self.caller.msg("%s isn't clothes!" % to_cover.name)
|
self.caller.msg("%s isn't clothes!" % to_cover.name)
|
||||||
return
|
return
|
||||||
if not cover_with.is_typeclass("evennia.contrib.clothing.Clothing", exact=False):
|
if not cover_with.is_typeclass("evennia.contrib.game_systems.clothing.Clothing", exact=False):
|
||||||
self.caller.msg("%s isn't clothes!" % cover_with.name)
|
self.caller.msg("%s isn't clothes!" % cover_with.name)
|
||||||
return
|
return
|
||||||
if cover_with.db.clothing_type:
|
if cover_with.db.clothing_type:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from evennia.utils.test_resources import EvenniaTest
|
||||||
from . import cooldowns
|
from . import cooldowns
|
||||||
|
|
||||||
|
|
||||||
@patch("evennia.contrib.cooldowns.time.time", return_value=0.0)
|
@patch("evennia.contrib.game_systems.cooldowns.time.time", return_value=0.0)
|
||||||
class TestCooldowns(EvenniaTest):
|
class TestCooldowns(EvenniaTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ tools will be identified before consumables).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
||||||
from evennia.contrib.crafting import crafting
|
from evennia.contrib.game_systems.crafting import crafting
|
||||||
|
|
||||||
spiked_club = crafting.craft(crafter, "spiked club", club, nails)
|
spiked_club = crafting.craft(crafter, "spiked club", club, nails)
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ substantially this way.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
||||||
from evennia.contrib.crafting.crafting import CraftingRecipe
|
from evennia.contrib.game_systems.crafting.crafting import CraftingRecipe
|
||||||
|
|
||||||
class PigIronRecipe(CraftingRecipe):
|
class PigIronRecipe(CraftingRecipe):
|
||||||
# Pig iron is a high-carbon result of melting iron in a blast furnace.
|
# Pig iron is a high-carbon result of melting iron in a blast furnace.
|
||||||
|
|
@ -112,7 +112,7 @@ substantially this way.
|
||||||
If the above class was added to a module in `CRAFT_RECIPE_MODULES`, it could be
|
If the above class was added to a module in `CRAFT_RECIPE_MODULES`, it could be
|
||||||
called using its `.name` property, as "pig iron".
|
called using its `.name` property, as "pig iron".
|
||||||
|
|
||||||
The [example_recipies](api:evennia.contrib.crafting.example_recipes) module has
|
The [example_recipies](api:evennia.contrib.game_systems.crafting.example_recipes) module has
|
||||||
a full example of the components for creating a sword from base components.
|
a full example of the components for creating a sword from base components.
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
@ -139,7 +139,7 @@ def _load_recipes():
|
||||||
|
|
||||||
global _RECIPE_CLASSES
|
global _RECIPE_CLASSES
|
||||||
if not _RECIPE_CLASSES:
|
if not _RECIPE_CLASSES:
|
||||||
paths = ["evennia.contrib.crafting.example_recipes"]
|
paths = ["evennia.contrib.game_systems.crafting.example_recipes"]
|
||||||
if hasattr(settings, "CRAFT_RECIPE_MODULES"):
|
if hasattr(settings, "CRAFT_RECIPE_MODULES"):
|
||||||
paths += make_iter(settings.CRAFT_RECIPE_MODULES)
|
paths += make_iter(settings.CRAFT_RECIPE_MODULES)
|
||||||
for path in paths:
|
for path in paths:
|
||||||
|
|
@ -462,7 +462,7 @@ class CraftingRecipe(CraftingRecipeBase):
|
||||||
this deletes consumables.
|
this deletes consumables.
|
||||||
|
|
||||||
Use `.msg` to conveniently send messages to the crafter. Raise
|
Use `.msg` to conveniently send messages to the crafter. Raise
|
||||||
`evennia.contrib.crafting.crafting.CraftingError` exception to abort
|
`evennia.contrib.game_systems.crafting.crafting.CraftingError` exception to abort
|
||||||
crafting at any time in the sequence. If raising with a text, this will be
|
crafting at any time in the sequence. If raising with a text, this will be
|
||||||
shown to the crafter automatically
|
shown to the crafter automatically
|
||||||
|
|
||||||
|
|
@ -909,7 +909,8 @@ def craft(crafter, recipe_name, *inputs, raise_exception=False, **kwargs):
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
If no recipe_module is given, will look for a list `settings.CRAFT_RECIPE_MODULES` and
|
If no recipe_module is given, will look for a list `settings.CRAFT_RECIPE_MODULES` and
|
||||||
lastly fall back to the example module `"evennia.contrib."`
|
lastly fall back to the example module
|
||||||
|
`"evennia.contrib.game_systems.crafting.example_recipes"`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# delayed loading/caching of recipes
|
# delayed loading/caching of recipes
|
||||||
|
|
|
||||||
|
|
@ -485,7 +485,7 @@ class TestCraftSword(TestCase):
|
||||||
self.crafter.msg = mock.MagicMock()
|
self.crafter.msg = mock.MagicMock()
|
||||||
|
|
||||||
@override_settings(CRAFT_RECIPE_MODULES=[], DEFAULT_HOME="#999999")
|
@override_settings(CRAFT_RECIPE_MODULES=[], DEFAULT_HOME="#999999")
|
||||||
@mock.patch("evennia.contrib.crafting.example_recipes.random")
|
@mock.patch("evennia.contrib.game_systems.crafting.example_recipes.random")
|
||||||
def test_craft_sword(self, mockrandom):
|
def test_craft_sword(self, mockrandom):
|
||||||
"""
|
"""
|
||||||
Craft example sword. For the test, every crafting works.
|
Craft example sword. For the test, every crafting works.
|
||||||
|
|
@ -652,8 +652,8 @@ class TestCraftSword(TestCase):
|
||||||
self.assertIsNotNone(cauldron)
|
self.assertIsNotNone(cauldron)
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("evennia.contrib.crafting.crafting._load_recipes", new=mock.MagicMock())
|
@mock.patch("evennia.contrib.game_systems.crafting.crafting._load_recipes", new=mock.MagicMock())
|
||||||
@mock.patch("evennia.contrib.crafting.crafting._RECIPE_CLASSES", new={"testrecipe": _MockRecipe})
|
@mock.patch("evennia.contrib.game_systems.crafting.crafting._RECIPE_CLASSES", new={"testrecipe": _MockRecipe})
|
||||||
@override_settings(CRAFT_RECIPE_MODULES=[], DEFAULT_HOME="#999999")
|
@override_settings(CRAFT_RECIPE_MODULES=[], DEFAULT_HOME="#999999")
|
||||||
class TestCraftCommand(CommandTest):
|
class TestCraftCommand(CommandTest):
|
||||||
"""Test the crafting command"""
|
"""Test the crafting command"""
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class TestGenderSub(CommandTest):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
gendersub._RE_GENDER_PRONOUN.sub(char._get_pronoun, txt), "Test their gender"
|
gendersub._RE_GENDER_PRONOUN.sub(char._get_pronoun, txt), "Test their gender"
|
||||||
)
|
)
|
||||||
with patch("evennia.contrib.gendersub.DefaultCharacter.msg") as mock_msg:
|
with patch("evennia.contrib.game_systems.gendersub.DefaultCharacter.msg") as mock_msg:
|
||||||
char.db.gender = "female"
|
char.db.gender = "female"
|
||||||
char.msg("Test |p gender")
|
char.msg("Test |p gender")
|
||||||
mock_msg.assert_called_with("Test her gender", from_obj=None, session=None)
|
mock_msg.assert_called_with("Test her gender", from_obj=None, session=None)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ also adds the short descriptions and the `sdesc` command).
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Edit `mygame/commands/default_cmdsets.py` and add
|
Edit `mygame/commands/default_cmdsets.py` and add
|
||||||
`from evennia.contrib.multidescer import CmdMultiDesc` to the top.
|
`from evennia.contrib.game_systems.multidescer import CmdMultiDesc` to the top.
|
||||||
|
|
||||||
Next, look up the `at_cmdset_create` method of the `CharacterCmdSet`
|
Next, look up the `at_cmdset_create` method of the `CharacterCmdSet`
|
||||||
class and add a line `self.add(CmdMultiDesc())` to the end
|
class and add a line `self.add(CmdMultiDesc())` to the end
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ also adds the short descriptions and the `sdesc` command).
|
||||||
Installation:
|
Installation:
|
||||||
|
|
||||||
Edit `mygame/commands/default_cmdsets.py` and add
|
Edit `mygame/commands/default_cmdsets.py` and add
|
||||||
`from evennia.contrib.game_system.multidescer import CmdMultiDesc` to the top.
|
`from evennia.contrib.game_systems.multidescer import CmdMultiDesc` to the top.
|
||||||
|
|
||||||
Next, look up the `at_cmdset_create` method of the `CharacterCmdSet`
|
Next, look up the `at_cmdset_create` method of the `CharacterCmdSet`
|
||||||
class and add a line `self.add(CmdMultiDesc())` to the end
|
class and add a line `self.add(CmdMultiDesc())` to the end
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ class TestPuzzles(CommandTest):
|
||||||
self._assert_msg_matched(msg, regexs, re_flags=re.MULTILINE | re.DOTALL)
|
self._assert_msg_matched(msg, regexs, re_flags=re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
def test_cmdset_puzzle(self):
|
def test_cmdset_puzzle(self):
|
||||||
self.char1.cmdset.add("evennia.contrib.puzzles.PuzzleSystemCmdSet")
|
self.char1.cmdset.add("evennia.contrib.game_systems.puzzles.PuzzleSystemCmdSet")
|
||||||
# FIXME: testing nothing, this is just to bump up coverage
|
# FIXME: testing nothing, this is just to bump up coverage
|
||||||
|
|
||||||
def test_cmd_puzzle(self):
|
def test_cmd_puzzle(self):
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ own battle system.
|
||||||
To install and test, import this module's TBBasicCharacter object into
|
To install and test, import this module's TBBasicCharacter object into
|
||||||
your game's character.py module:
|
your game's character.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle.tb_basic import TBBasicCharacter
|
from evennia.contrib.game_systems.turnbattle.tb_basic import TBBasicCharacter
|
||||||
|
|
||||||
And change your game's character typeclass to inherit from TBBasicCharacter
|
And change your game's character typeclass to inherit from TBBasicCharacter
|
||||||
instead of the default:
|
instead of the default:
|
||||||
|
|
@ -28,7 +28,7 @@ instead of the default:
|
||||||
|
|
||||||
Next, import this module into your default_cmdsets.py module:
|
Next, import this module into your default_cmdsets.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle import tb_basic
|
from evennia.contrib.game_systems.turnbattle import tb_basic
|
||||||
|
|
||||||
And add the battle command set to your default command set:
|
And add the battle command set to your default command set:
|
||||||
|
|
||||||
|
|
@ -585,7 +585,7 @@ class CmdFight(Command):
|
||||||
return
|
return
|
||||||
here.msg_contents("%s starts a fight!" % self.caller)
|
here.msg_contents("%s starts a fight!" % self.caller)
|
||||||
# Add a turn handler script to the room, which starts combat.
|
# Add a turn handler script to the room, which starts combat.
|
||||||
here.scripts.add("contrib.turnbattle.tb_basic.TBBasicTurnHandler")
|
here.scripts.add("contrib.game_systems.turnbattle.tb_basic.TBBasicTurnHandler")
|
||||||
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ the rules of your preferred system or the needs of your own game.
|
||||||
To install and test, import this module's TBEquipCharacter object into
|
To install and test, import this module's TBEquipCharacter object into
|
||||||
your game's character.py module:
|
your game's character.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle.tb_equip import TBEquipCharacter
|
from evennia.contrib.game_systems.turnbattle.tb_equip import TBEquipCharacter
|
||||||
|
|
||||||
And change your game's character typeclass to inherit from TBEquipCharacter
|
And change your game's character typeclass to inherit from TBEquipCharacter
|
||||||
instead of the default:
|
instead of the default:
|
||||||
|
|
@ -40,7 +40,7 @@ instead of the default:
|
||||||
|
|
||||||
Next, import this module into your default_cmdsets.py module:
|
Next, import this module into your default_cmdsets.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle import tb_equip
|
from evennia.contrib.game_systems.turnbattle import tb_equip
|
||||||
|
|
||||||
And add the battle command set to your default command set:
|
And add the battle command set to your default command set:
|
||||||
|
|
||||||
|
|
@ -722,7 +722,7 @@ class CmdFight(Command):
|
||||||
return
|
return
|
||||||
here.msg_contents("%s starts a fight!" % self.caller)
|
here.msg_contents("%s starts a fight!" % self.caller)
|
||||||
# Add a turn handler script to the room, which starts combat.
|
# Add a turn handler script to the room, which starts combat.
|
||||||
here.scripts.add("contrib.turnbattle.tb_equip.TBEquipTurnHandler")
|
here.scripts.add("contrib.game_systems.turnbattle.tb_equip.TBEquipTurnHandler")
|
||||||
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -933,7 +933,7 @@ class CmdWield(Command):
|
||||||
weapon = self.caller.search(self.args, candidates=self.caller.contents)
|
weapon = self.caller.search(self.args, candidates=self.caller.contents)
|
||||||
if not weapon:
|
if not weapon:
|
||||||
return
|
return
|
||||||
if not weapon.is_typeclass("evennia.contrib.turnbattle.tb_equip.TBEWeapon", exact=True):
|
if not weapon.is_typeclass("evennia.contrib.game_systems.turnbattle.tb_equip.TBEWeapon", exact=True):
|
||||||
self.caller.msg("That's not a weapon!")
|
self.caller.msg("That's not a weapon!")
|
||||||
# Remember to update the path to the weapon typeclass if you move this module!
|
# Remember to update the path to the weapon typeclass if you move this module!
|
||||||
return
|
return
|
||||||
|
|
@ -1012,7 +1012,7 @@ class CmdDon(Command):
|
||||||
armor = self.caller.search(self.args, candidates=self.caller.contents)
|
armor = self.caller.search(self.args, candidates=self.caller.contents)
|
||||||
if not armor:
|
if not armor:
|
||||||
return
|
return
|
||||||
if not armor.is_typeclass("evennia.contrib.turnbattle.tb_equip.TBEArmor", exact=True):
|
if not armor.is_typeclass("evennia.contrib.game_systems.turnbattle.tb_equip.TBEArmor", exact=True):
|
||||||
self.caller.msg("That's not armor!")
|
self.caller.msg("That's not armor!")
|
||||||
# Remember to update the path to the armor typeclass if you move this module!
|
# Remember to update the path to the armor typeclass if you move this module!
|
||||||
return
|
return
|
||||||
|
|
@ -1088,9 +1088,9 @@ PROTOTYPES START HERE
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BASEWEAPON = {"typeclass": "evennia.contrib.turnbattle.tb_equip.TBEWeapon"}
|
BASEWEAPON = {"typeclass": "evennia.contrib.game_systems.turnbattle.tb_equip.TBEWeapon"}
|
||||||
|
|
||||||
BASEARMOR = {"typeclass": "evennia.contrib.turnbattle.tb_equip.TBEArmor"}
|
BASEARMOR = {"typeclass": "evennia.contrib.game_systems.turnbattle.tb_equip.TBEArmor"}
|
||||||
|
|
||||||
DAGGER = {
|
DAGGER = {
|
||||||
"prototype": "BASEWEAPON",
|
"prototype": "BASEWEAPON",
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ can be specified on the item as well, but they are optional.
|
||||||
To install and test, import this module's TBItemsCharacter object into
|
To install and test, import this module's TBItemsCharacter object into
|
||||||
your game's character.py module:
|
your game's character.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle.tb_items import TBItemsCharacter
|
from evennia.contrib.game_systems.turnbattle.tb_items import TBItemsCharacter
|
||||||
|
|
||||||
And change your game's character typeclass to inherit from TBItemsCharacter
|
And change your game's character typeclass to inherit from TBItemsCharacter
|
||||||
instead of the default:
|
instead of the default:
|
||||||
|
|
@ -52,7 +52,7 @@ instead of the default:
|
||||||
|
|
||||||
Next, import this module into your default_cmdsets.py module:
|
Next, import this module into your default_cmdsets.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle import tb_items
|
from evennia.contrib.game_systems.turnbattle import tb_items
|
||||||
|
|
||||||
And add the battle command set to your default command set:
|
And add the battle command set to your default command set:
|
||||||
|
|
||||||
|
|
@ -866,7 +866,7 @@ class CmdFight(Command):
|
||||||
return
|
return
|
||||||
here.msg_contents("%s starts a fight!" % self.caller)
|
here.msg_contents("%s starts a fight!" % self.caller)
|
||||||
# Add a turn handler script to the room, which starts combat.
|
# Add a turn handler script to the room, which starts combat.
|
||||||
here.scripts.add("contrib.turnbattle.tb_items.TBItemsTurnHandler")
|
here.scripts.add("contrib.game_systems.turnbattle.tb_items.TBItemsTurnHandler")
|
||||||
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ or whatever else your game requires.
|
||||||
To install and test, import this module's TBMagicCharacter object into
|
To install and test, import this module's TBMagicCharacter object into
|
||||||
your game's character.py module:
|
your game's character.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle.tb_magic import TBMagicCharacter
|
from evennia.contrib.game_systems.turnbattle.tb_magic import TBMagicCharacter
|
||||||
|
|
||||||
And change your game's character typeclass to inherit from TBMagicCharacter
|
And change your game's character typeclass to inherit from TBMagicCharacter
|
||||||
instead of the default:
|
instead of the default:
|
||||||
|
|
@ -52,7 +52,7 @@ on all existing Characters.
|
||||||
|
|
||||||
Next, import this module into your default_cmdsets.py module:
|
Next, import this module into your default_cmdsets.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle import tb_magic
|
from evennia.contrib.game_systems.turnbattle import tb_magic
|
||||||
|
|
||||||
And add the battle command set to your default command set:
|
And add the battle command set to your default command set:
|
||||||
|
|
||||||
|
|
@ -612,7 +612,7 @@ class CmdFight(Command):
|
||||||
return
|
return
|
||||||
here.msg_contents("%s starts a fight!" % self.caller)
|
here.msg_contents("%s starts a fight!" % self.caller)
|
||||||
# Add a turn handler script to the room, which starts combat.
|
# Add a turn handler script to the room, which starts combat.
|
||||||
here.scripts.add("contrib.turnbattle.tb_magic.TBMagicTurnHandler")
|
here.scripts.add("contrib.game_systems.turnbattle.tb_magic.TBMagicTurnHandler")
|
||||||
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ are objects placed in the range field like any other.
|
||||||
To install and test, import this module's TBRangeCharacter object into
|
To install and test, import this module's TBRangeCharacter object into
|
||||||
your game's character.py module:
|
your game's character.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle.tb_range import TBRangeCharacter
|
from evennia.contrib.game_systems.turnbattle.tb_range import TBRangeCharacter
|
||||||
|
|
||||||
And change your game's character typeclass to inherit from TBRangeCharacter
|
And change your game's character typeclass to inherit from TBRangeCharacter
|
||||||
instead of the default:
|
instead of the default:
|
||||||
|
|
@ -81,12 +81,12 @@ instead of the default:
|
||||||
|
|
||||||
Do the same thing in your game's objects.py module for TBRangeObject:
|
Do the same thing in your game's objects.py module for TBRangeObject:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle.tb_range import TBRangeObject
|
from evennia.contrib.game_systems.turnbattle.tb_range import TBRangeObject
|
||||||
class Object(TBRangeObject):
|
class Object(TBRangeObject):
|
||||||
|
|
||||||
Next, import this module into your default_cmdsets.py module:
|
Next, import this module into your default_cmdsets.py module:
|
||||||
|
|
||||||
from evennia.contrib.turnbattle import tb_range
|
from evennia.contrib.game_systems.turnbattle import tb_range
|
||||||
|
|
||||||
And add the battle command set to your default command set:
|
And add the battle command set to your default command set:
|
||||||
|
|
||||||
|
|
@ -1031,7 +1031,7 @@ class CmdFight(Command):
|
||||||
return
|
return
|
||||||
here.msg_contents("%s starts a fight!" % self.caller)
|
here.msg_contents("%s starts a fight!" % self.caller)
|
||||||
# Add a turn handler script to the room, which starts combat.
|
# Add a turn handler script to the room, which starts combat.
|
||||||
here.scripts.add("contrib.turnbattle.tb_range.TBRangeTurnHandler")
|
here.scripts.add("contrib.game_systems.turnbattle.tb_range.TBRangeTurnHandler")
|
||||||
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
# Remember you'll have to change the path to the script if you copy this code to your own modules!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@ class TestTurnBattleRangeFunc(EvenniaTest):
|
||||||
|
|
||||||
|
|
||||||
class TestTurnBattleItemsFunc(EvenniaTest):
|
class TestTurnBattleItemsFunc(EvenniaTest):
|
||||||
@patch("evennia.contrib.turnbattle.tb_items.tickerhandler", new=MagicMock())
|
@patch("evennia.contrib.game_systems.turnbattle.tb_items.tickerhandler", new=MagicMock())
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTurnBattleItemsFunc, self).setUp()
|
super(TestTurnBattleItemsFunc, self).setUp()
|
||||||
self.testroom = create_object(DefaultRoom, key="Test Room")
|
self.testroom = create_object(DefaultRoom, key="Test Room")
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ For example:
|
||||||
|
|
||||||
mapbuilder world.gamemap.MAP world.maplegend.MAP_LEGEND
|
mapbuilder world.gamemap.MAP world.maplegend.MAP_LEGEND
|
||||||
mapbuilder evennia.contrib.grid.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
mapbuilder evennia.contrib.grid.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
||||||
mapbuilder/two evennia.contrib.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
mapbuilder/two evennia.contrib.grid.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
||||||
(Legend path defaults to map path)
|
(Legend path defaults to map path)
|
||||||
|
|
||||||
Below are two examples showcasing the use of automatic exit generation and
|
Below are two examples showcasing the use of automatic exit generation and
|
||||||
|
|
@ -93,7 +93,7 @@ convenience The below example code should be in mymap.py in mygame/world.
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.utils import utils
|
from evennia.utils import utils
|
||||||
|
|
||||||
# mapbuilder evennia.contrib.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
# mapbuilder evennia.contrib.grid.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
@ -193,7 +193,7 @@ EXAMPLE1_LEGEND = {
|
||||||
## Example Two
|
## Example Two
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# @mapbuilder/two evennia.contrib.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
# @mapbuilder/two evennia.contrib.grid.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ For example:
|
||||||
|
|
||||||
mapbuilder world.gamemap.MAP world.maplegend.MAP_LEGEND
|
mapbuilder world.gamemap.MAP world.maplegend.MAP_LEGEND
|
||||||
mapbuilder evennia.contrib.grid.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
mapbuilder evennia.contrib.grid.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
||||||
mapbuilder/two evennia.contrib.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
mapbuilder/two evennia.contrib.grid.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
||||||
(Legend path defaults to map path)
|
(Legend path defaults to map path)
|
||||||
|
|
||||||
Below are two examples showcasing the use of automatic exit generation and
|
Below are two examples showcasing the use of automatic exit generation and
|
||||||
|
|
@ -91,7 +91,7 @@ convenience The below example code should be in mymap.py in mygame/world.
|
||||||
# Example One:
|
# Example One:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# @mapbuilder evennia.contrib.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
# @mapbuilder evennia.contrib.grid.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
@ -191,7 +191,7 @@ EXAMPLE1_LEGEND = {
|
||||||
# Example two
|
# Example two
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# @mapbuilder/two evennia.contrib.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
# @mapbuilder/two evennia.contrib.grid.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
@ -414,8 +414,8 @@ class CmdMapBuilder(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@mapbuilder world.gamemap.MAP world.maplegend.MAP_LEGEND
|
@mapbuilder world.gamemap.MAP world.maplegend.MAP_LEGEND
|
||||||
@mapbuilder evennia.contrib.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
@mapbuilder evennia.contrib.grid.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND
|
||||||
@mapbuilder/two evennia.contrib.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
@mapbuilder/two evennia.contrib.grid.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
||||||
(Legend path defaults to map path)
|
(Legend path defaults to map path)
|
||||||
|
|
||||||
This is a command which takes two inputs:
|
This is a command which takes two inputs:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import random
|
||||||
# A map with a temple (▲) amongst mountains (n,∩) in a forest (♣,♠) on an
|
# A map with a temple (▲) amongst mountains (n,∩) in a forest (♣,♠) on an
|
||||||
# island surrounded by water (≈). By giving no instructions for the water
|
# island surrounded by water (≈). By giving no instructions for the water
|
||||||
# characters we effectively skip it and create no rooms for those squares.
|
# characters we effectively skip it and create no rooms for those squares.
|
||||||
EXAMPLE1_MAP = '''
|
EXAMPLE1_MAP = '''\
|
||||||
≈≈≈≈≈
|
≈≈≈≈≈
|
||||||
≈♣n♣≈
|
≈♣n♣≈
|
||||||
≈∩▲∩≈
|
≈∩▲∩≈
|
||||||
|
|
@ -102,7 +102,7 @@ EXAMPLE1_LEGEND = {
|
||||||
|
|
||||||
# Example two
|
# Example two
|
||||||
|
|
||||||
# @mapbuilder/two evennia.contrib.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
# @mapbuilder/two evennia.contrib.grid.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ EXAMPLE1_LEGEND = {
|
||||||
|
|
||||||
# This is the same layout as Example 1 but included are characters for exits.
|
# This is the same layout as Example 1 but included are characters for exits.
|
||||||
# We can use these characters to determine which rooms should be connected.
|
# We can use these characters to determine which rooms should be connected.
|
||||||
EXAMPLE2_MAP = '''
|
EXAMPLE2_MAP = '''\
|
||||||
≈ ≈ ≈ ≈ ≈
|
≈ ≈ ≈ ≈ ≈
|
||||||
|
|
||||||
≈ ♣-♣-♣ ≈
|
≈ ♣-♣-♣ ≈
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,3 @@ from .wilderness import WildernessScript # noqa
|
||||||
from .wilderness import WildernessExit # noqa
|
from .wilderness import WildernessExit # noqa
|
||||||
from .wilderness import WildernessRoom # noqa
|
from .wilderness import WildernessRoom # noqa
|
||||||
from .wilderness import WildernessMapProvider # noqa
|
from .wilderness import WildernessMapProvider # noqa
|
||||||
from .wilderness import Wilderness # noqa
|
|
||||||
from .wilderness import WildernessMap # noqa
|
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,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
|
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.
|
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:
|
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)`
|
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)`
|
tuples. x goes from left to right and y goes from bottom to top. So `(0, 0)`
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ in the docs.
|
||||||
1. If you haven't before, install the extra contrib requirements.
|
1. If you haven't before, install the extra contrib requirements.
|
||||||
You can do so by doing `pip install -r requirements_extra.txt` from the
|
You can do so by doing `pip install -r requirements_extra.txt` from the
|
||||||
`evennia/` folder.
|
`evennia/` folder.
|
||||||
2. Import and add the `evennia.contrib.xyzgrid.commands.XYZGridCmdSet` to the
|
2. Import and add the `evennia.contrib.grid.xyzgrid.commands.XYZGridCmdSet` to the
|
||||||
`CharacterCmdset` cmdset in `mygame/commands.default_cmds.py`. Reload
|
`CharacterCmdset` cmdset in `mygame/commands.default_cmds.py`. Reload
|
||||||
the server. This makes the `map`, `goto/path` and modified `teleport` and
|
the server. This makes the `map`, `goto/path` and modified `teleport` and
|
||||||
`open` commands available in-game.
|
`open` commands available in-game.
|
||||||
3. Edit `mygame/server/conf/settings.py` and set
|
3. Edit `mygame/server/conf/settings.py` and set
|
||||||
|
|
||||||
EXTRA_LAUNCHER_COMMANDS['xyzgrid'] = 'evennia.contrib.xyzgrid.launchcmd.xyzcommand'
|
EXTRA_LAUNCHER_COMMANDS['xyzgrid'] = 'evennia.contrib.grid.xyzgrid.launchcmd.xyzcommand'
|
||||||
|
|
||||||
4. Run the new `evennia xyzgrid help` for instructions on how to spawn the grid.
|
4. Run the new `evennia xyzgrid help` for instructions on how to spawn the grid.
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ After installation, do the following (from your command line, where the
|
||||||
`evennia` command is available) to install an example grid:
|
`evennia` command is available) to install an example grid:
|
||||||
|
|
||||||
evennia xyzgrid init
|
evennia xyzgrid init
|
||||||
evennia xyzgrid add evennia.contrib.xyzgrid.example
|
evennia xyzgrid add evennia.contrib.grid.xyzgrid.example
|
||||||
evennia xyzgrid list
|
evennia xyzgrid list
|
||||||
evennia xyzgrid show "the large tree"
|
evennia xyzgrid show "the large tree"
|
||||||
evennia xyzgrid show "the small cave"
|
evennia xyzgrid show "the small cave"
|
||||||
|
|
|
||||||
|
|
@ -851,9 +851,11 @@ class TestMap8(_MapTest):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
mapstr = self.map.get_visual_range(coord, dist=dist, mode='nodes',
|
mapstr = self.map.get_visual_range(coord, dist=dist, mode='nodes',
|
||||||
target=target, target_path_style="",
|
target=target, target_path_style=".",
|
||||||
character='@',
|
character='@',
|
||||||
max_size=max_size)
|
max_size=max_size)
|
||||||
|
self.assertEqual(expected, mapstr.replace("||", "|"))
|
||||||
|
|
||||||
def test_spawn(self):
|
def test_spawn(self):
|
||||||
"""
|
"""
|
||||||
Spawn the map into actual objects.
|
Spawn the map into actual objects.
|
||||||
|
|
@ -1013,10 +1015,9 @@ class TestMap11(_MapTest):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
mapstr = self.map.get_visual_range(coord, dist=dist, mode='nodes',
|
mapstr = self.map.get_visual_range(coord, dist=dist, mode='nodes',
|
||||||
target=target, target_path_style="",
|
target=target, target_path_style=".",
|
||||||
character='@',
|
character='@',
|
||||||
max_size=max_size)
|
max_size=max_size)
|
||||||
print(f"\n\n{coord}-{target}\n{expected}\n\n{mapstr}")
|
|
||||||
|
|
||||||
self.assertEqual(expected, mapstr)
|
self.assertEqual(expected, mapstr)
|
||||||
|
|
||||||
|
|
|
||||||
0
evennia/contrib/rpg/__init__.py
Normal file
0
evennia/contrib/rpg/__init__.py
Normal file
|
|
@ -42,7 +42,7 @@ to a game, common to many RP-centric games:
|
||||||
simple Attribute that modifies how the characters is viewed when
|
simple Attribute that modifies how the characters is viewed when
|
||||||
in a room as sdesc + pose.
|
in a room as sdesc + pose.
|
||||||
- in-emote says, including seamless integration with language
|
- in-emote says, including seamless integration with language
|
||||||
obscuration routine (such as contrib/rplanguage.py)
|
obscuration routine (such as contrib/rpg/rplanguage.py)
|
||||||
|
|
||||||
Installation:
|
Installation:
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ Extra Installation Instructions:
|
||||||
|
|
||||||
1. In typeclasses/character.py:
|
1. In typeclasses/character.py:
|
||||||
Import the `ContribRPCharacter` class:
|
Import the `ContribRPCharacter` class:
|
||||||
`from evennia.contrib.rpsystem import ContribRPCharacter`
|
`from evennia.contrib.rpg.rpsystem import ContribRPCharacter`
|
||||||
Inherit ContribRPCharacter:
|
Inherit ContribRPCharacter:
|
||||||
Change "class Character(DefaultCharacter):" to
|
Change "class Character(DefaultCharacter):" to
|
||||||
`class Character(ContribRPCharacter):`
|
`class Character(ContribRPCharacter):`
|
||||||
|
|
@ -133,13 +133,13 @@ Extra Installation Instructions:
|
||||||
Add `super().at_object_creation()` as the top line.
|
Add `super().at_object_creation()` as the top line.
|
||||||
2. In `typeclasses/rooms.py`:
|
2. In `typeclasses/rooms.py`:
|
||||||
Import the `ContribRPRoom` class:
|
Import the `ContribRPRoom` class:
|
||||||
`from evennia.contrib.rpsystem import ContribRPRoom`
|
`from evennia.contrib.rpg.rpsystem import ContribRPRoom`
|
||||||
Inherit `ContribRPRoom`:
|
Inherit `ContribRPRoom`:
|
||||||
Change `class Room(DefaultRoom):` to
|
Change `class Room(DefaultRoom):` to
|
||||||
`class Room(ContribRPRoom):`
|
`class Room(ContribRPRoom):`
|
||||||
3. In `typeclasses/objects.py`
|
3. In `typeclasses/objects.py`
|
||||||
Import the `ContribRPObject` class:
|
Import the `ContribRPObject` class:
|
||||||
`from evennia.contrib.rpsystem import ContribRPObject`
|
`from evennia.contrib.rpg.rpsystem import ContribRPObject`
|
||||||
Inherit `ContribRPObject`:
|
Inherit `ContribRPObject`:
|
||||||
Change `class Object(DefaultObject):` to
|
Change `class Object(DefaultObject):` to
|
||||||
`class Object(ContribRPObject):`
|
`class Object(ContribRPObject):`
|
||||||
|
|
@ -348,7 +348,7 @@ def parse_language(speaker, emote):
|
||||||
the markers and a tuple (langname, saytext), where
|
the markers and a tuple (langname, saytext), where
|
||||||
langname can be None.
|
langname can be None.
|
||||||
Raises:
|
Raises:
|
||||||
evennia.contrib.rpsystem.LanguageError: If an invalid language was
|
evennia.contrib.rpg.rpsystem.LanguageError: If an invalid language was
|
||||||
specified.
|
specified.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
@ -1756,7 +1756,7 @@ class ContribRPCharacter(DefaultCharacter, ContribRPObject):
|
||||||
Notes:
|
Notes:
|
||||||
This is designed to work together with a string obfuscator
|
This is designed to work together with a string obfuscator
|
||||||
such as the `obfuscate_language` or `obfuscate_whisper` in
|
such as the `obfuscate_language` or `obfuscate_whisper` in
|
||||||
the evennia.contrib.rplanguage module.
|
the evennia.contrib.rpg.rplanguage module.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return "%s|w%s|n" % ("|W(%s)" % language if language else "", text)
|
return "%s|w%s|n" % ("|W(%s)" % language if language else "", text)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Here's an example for adding the TraitHandler to the Character class:
|
||||||
|
|
||||||
from evennia import DefaultCharacter
|
from evennia import DefaultCharacter
|
||||||
from evennia.utils import lazy_property
|
from evennia.utils import lazy_property
|
||||||
from evennia.contrib.traits import TraitHandler
|
from evennia.contrib.rpg.traits import TraitHandler
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ other properties/methods on your class.
|
||||||
|
|
||||||
from evennia import DefaultObject
|
from evennia import DefaultObject
|
||||||
from evennia.utils import lazy_property
|
from evennia.utils import lazy_property
|
||||||
from evennia.contrib.traits import TraitProperty
|
from evennia.contrib.rpg.traits import TraitProperty
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
|
|
@ -394,13 +394,13 @@ like a glorified Attribute.
|
||||||
|
|
||||||
## Expanding with your own Traits
|
## Expanding with your own Traits
|
||||||
|
|
||||||
A Trait is a class inhering from `evennia.contrib.traits.Trait` (or from one of
|
A Trait is a class inhering from `evennia.contrib.rpg.traits.Trait` (or from one of
|
||||||
the existing Trait classes).
|
the existing Trait classes).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# in a file, say, 'mygame/world/traits.py'
|
# in a file, say, 'mygame/world/traits.py'
|
||||||
|
|
||||||
from evennia.contrib.traits import StaticTrait
|
from evennia.contrib.rpg.traits import StaticTrait
|
||||||
|
|
||||||
class RageTrait(StaticTrait):
|
class RageTrait(StaticTrait):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,17 +32,17 @@ class _MockObj:
|
||||||
|
|
||||||
# we want to test the base traits too
|
# we want to test the base traits too
|
||||||
_TEST_TRAIT_CLASS_PATHS = [
|
_TEST_TRAIT_CLASS_PATHS = [
|
||||||
"evennia.contrib.traits.Trait",
|
"evennia.contrib.rpg.traits.Trait",
|
||||||
"evennia.contrib.traits.StaticTrait",
|
"evennia.contrib.rpg.traits.StaticTrait",
|
||||||
"evennia.contrib.traits.CounterTrait",
|
"evennia.contrib.rpg.traits.CounterTrait",
|
||||||
"evennia.contrib.traits.GaugeTrait",
|
"evennia.contrib.rpg.traits.GaugeTrait",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class _TraitHandlerBase(TestCase):
|
class _TraitHandlerBase(TestCase):
|
||||||
"Base for trait tests"
|
"Base for trait tests"
|
||||||
|
|
||||||
@patch("evennia.contrib.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
@patch("evennia.contrib.rpg.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.obj = _MockObj()
|
self.obj = _MockObj()
|
||||||
self.traithandler = traits.TraitHandler(self.obj)
|
self.traithandler = traits.TraitHandler(self.obj)
|
||||||
|
|
@ -494,7 +494,7 @@ class TestTraitCounterTimed(_TraitHandlerBase):
|
||||||
Test for trait with timer component
|
Test for trait with timer component
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@patch("evennia.contrib.traits.time", new=MagicMock(return_value=1000))
|
@patch("evennia.contrib.rpg.traits.time", new=MagicMock(return_value=1000))
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.traithandler.add(
|
self.traithandler.add(
|
||||||
|
|
@ -522,7 +522,7 @@ class TestTraitCounterTimed(_TraitHandlerBase):
|
||||||
self.trait.ratetarget,
|
self.trait.ratetarget,
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch("evennia.contrib.traits.time")
|
@patch("evennia.contrib.rpg.traits.time")
|
||||||
def test_timer_rate(self, mock_time):
|
def test_timer_rate(self, mock_time):
|
||||||
"""Test time stepping"""
|
"""Test time stepping"""
|
||||||
mock_time.return_value = 1000
|
mock_time.return_value = 1000
|
||||||
|
|
@ -549,7 +549,7 @@ class TestTraitCounterTimed(_TraitHandlerBase):
|
||||||
mock_time.return_value = 1218
|
mock_time.return_value = 1218
|
||||||
self.assertEqual(self._get_timer_data(), (0, -2, -10, None, None))
|
self.assertEqual(self._get_timer_data(), (0, -2, -10, None, None))
|
||||||
|
|
||||||
@patch("evennia.contrib.traits.time")
|
@patch("evennia.contrib.rpg.traits.time")
|
||||||
def test_timer_ratetarget(self, mock_time):
|
def test_timer_ratetarget(self, mock_time):
|
||||||
"""test ratetarget"""
|
"""test ratetarget"""
|
||||||
mock_time.return_value = 1000
|
mock_time.return_value = 1000
|
||||||
|
|
@ -751,7 +751,7 @@ class TestTraitGaugeTimed(_TraitHandlerBase):
|
||||||
Test for trait with timer component
|
Test for trait with timer component
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@patch("evennia.contrib.traits.time", new=MagicMock(return_value=1000))
|
@patch("evennia.contrib.rpg.traits.time", new=MagicMock(return_value=1000))
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.traithandler.add(
|
self.traithandler.add(
|
||||||
|
|
@ -778,7 +778,7 @@ class TestTraitGaugeTimed(_TraitHandlerBase):
|
||||||
self.trait.ratetarget,
|
self.trait.ratetarget,
|
||||||
)
|
)
|
||||||
|
|
||||||
@patch("evennia.contrib.traits.time")
|
@patch("evennia.contrib.rpg.traits.time")
|
||||||
def test_timer_rate(self, mock_time):
|
def test_timer_rate(self, mock_time):
|
||||||
"""Test time stepping"""
|
"""Test time stepping"""
|
||||||
mock_time.return_value = 1000
|
mock_time.return_value = 1000
|
||||||
|
|
@ -806,7 +806,7 @@ class TestTraitGaugeTimed(_TraitHandlerBase):
|
||||||
mock_time.return_value = 1218
|
mock_time.return_value = 1218
|
||||||
self.assertEqual(self._get_timer_data(), (0, 0, -10, None, None))
|
self.assertEqual(self._get_timer_data(), (0, 0, -10, None, None))
|
||||||
|
|
||||||
@patch("evennia.contrib.traits.time")
|
@patch("evennia.contrib.rpg.traits.time")
|
||||||
def test_timer_ratetarget(self, mock_time):
|
def test_timer_ratetarget(self, mock_time):
|
||||||
"""test ratetarget"""
|
"""test ratetarget"""
|
||||||
mock_time.return_value = 1000
|
mock_time.return_value = 1000
|
||||||
|
|
@ -915,7 +915,7 @@ class TestTraitFields(TestCase):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@patch("evennia.contrib.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
@patch("evennia.contrib.rpg.traits._TRAIT_CLASS_PATHS", new=_TEST_TRAIT_CLASS_PATHS)
|
||||||
def test_traitfields(self):
|
def test_traitfields(self):
|
||||||
obj = DummyCharacter()
|
obj = DummyCharacter()
|
||||||
obj2 = DummyCharacter()
|
obj2 = DummyCharacter()
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ Here's an example for adding the TraitHandler to the Character class:
|
||||||
|
|
||||||
from evennia import DefaultCharacter
|
from evennia import DefaultCharacter
|
||||||
from evennia.utils import lazy_property
|
from evennia.utils import lazy_property
|
||||||
from evennia.contrib.traits import TraitHandler
|
from evennia.contrib.rpg.traits import TraitHandler
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ other properties/methods on your class.
|
||||||
|
|
||||||
from evennia import DefaultObject
|
from evennia import DefaultObject
|
||||||
from evennia.utils import lazy_property
|
from evennia.utils import lazy_property
|
||||||
from evennia.contrib.traits import TraitProperty
|
from evennia.contrib.rpg.traits import TraitProperty
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
|
|
@ -392,13 +392,13 @@ like a glorified Attribute.
|
||||||
|
|
||||||
## Expanding with your own Traits
|
## Expanding with your own Traits
|
||||||
|
|
||||||
A Trait is a class inhering from `evennia.contrib.traits.Trait` (or from one of
|
A Trait is a class inhering from `evennia.contrib.rpg.traits.Trait` (or from one of
|
||||||
the existing Trait classes).
|
the existing Trait classes).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# in a file, say, 'mygame/world/traits.py'
|
# in a file, say, 'mygame/world/traits.py'
|
||||||
|
|
||||||
from evennia.contrib.traits import StaticTrait
|
from evennia.contrib.rpg.traits import StaticTrait
|
||||||
|
|
||||||
class RageTrait(StaticTrait):
|
class RageTrait(StaticTrait):
|
||||||
|
|
||||||
|
|
@ -461,10 +461,10 @@ from evennia.utils.utils import inherits_from, class_from_module, list_to_string
|
||||||
# "counter" and "gauge".
|
# "counter" and "gauge".
|
||||||
|
|
||||||
_TRAIT_CLASS_PATHS = [
|
_TRAIT_CLASS_PATHS = [
|
||||||
"evennia.contrib.traits.Trait",
|
"evennia.contrib.rpg.traits.Trait",
|
||||||
"evennia.contrib.traits.StaticTrait",
|
"evennia.contrib.rpg.traits.StaticTrait",
|
||||||
"evennia.contrib.traits.CounterTrait",
|
"evennia.contrib.rpg.traits.CounterTrait",
|
||||||
"evennia.contrib.traits.GaugeTrait",
|
"evennia.contrib.rpg.traits.GaugeTrait",
|
||||||
]
|
]
|
||||||
|
|
||||||
if hasattr(settings, "TRAIT_CLASS_PATHS"):
|
if hasattr(settings, "TRAIT_CLASS_PATHS"):
|
||||||
|
|
@ -725,7 +725,7 @@ class TraitProperty:
|
||||||
Example:
|
Example:
|
||||||
::
|
::
|
||||||
from evennia.utils import lazy_property
|
from evennia.utils import lazy_property
|
||||||
from evennia.contrib.traits import TraitProperty
|
from evennia.contrib.rpg.traits import TraitProperty
|
||||||
|
|
||||||
class Character(DefaultCharacter):
|
class Character(DefaultCharacter):
|
||||||
|
|
||||||
|
|
|
||||||
4
evennia/contrib/tutorials/__init__.py
Normal file
4
evennia/contrib/tutorials/__init__.py
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
Contribs acting as tutorials, examples or supporting the documentation.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
@ -7,7 +7,7 @@ from evennia.utils.test_resources import EvenniaTest
|
||||||
from .bodyfunctions import BodyFunctions
|
from .bodyfunctions import BodyFunctions
|
||||||
|
|
||||||
|
|
||||||
@patch("evennia.contrib.tutorial_examples.bodyfunctions.random")
|
@patch("evennia.contrib.tutorials.bodyfunctions.random")
|
||||||
class TestBodyFunctions(EvenniaTest):
|
class TestBodyFunctions(EvenniaTest):
|
||||||
script_typeclass = BodyFunctions
|
script_typeclass = BodyFunctions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ class CmdTalk(default_cmds.MuxCommand):
|
||||||
|
|
||||||
# Initiate the menu. Change this if you are putting this on
|
# Initiate the menu. Change this if you are putting this on
|
||||||
# some other custom NPC class.
|
# some other custom NPC class.
|
||||||
EvMenu(self.caller, "evennia.contrib.talking_npc", startnode="menu_start_node")
|
EvMenu(self.caller, "evennia.contrib.tutorials.talking_npc", startnode="menu_start_node")
|
||||||
|
|
||||||
|
|
||||||
class TalkingCmdSet(CmdSet):
|
class TalkingCmdSet(CmdSet):
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ from evennia import TICKER_HANDLER
|
||||||
from evennia import search_object
|
from evennia import search_object
|
||||||
from evennia import Command, CmdSet
|
from evennia import Command, CmdSet
|
||||||
from evennia import logger
|
from evennia import logger
|
||||||
from evennia.contrib.tutorial_world import objects as tut_objects
|
from . import objects as tut_objects
|
||||||
|
|
||||||
|
|
||||||
class CmdMobOnOff(Command):
|
class CmdMobOnOff(Command):
|
||||||
|
|
|
||||||
|
|
@ -982,7 +982,7 @@ class TutorialWeapon(TutorialObject):
|
||||||
|
|
||||||
WEAPON_PROTOTYPES = {
|
WEAPON_PROTOTYPES = {
|
||||||
"weapon": {
|
"weapon": {
|
||||||
"typeclass": "evennia.contrib.tutorial_world.objects.TutorialWeapon",
|
"typeclass": "evennia.contrib.tutorials.tutorial_world.objects.TutorialWeapon",
|
||||||
"key": "Weapon",
|
"key": "Weapon",
|
||||||
"hit": 0.2,
|
"hit": 0.2,
|
||||||
"parry": 0.2,
|
"parry": 0.2,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from evennia import TICKER_HANDLER
|
||||||
from evennia import CmdSet, Command, DefaultRoom
|
from evennia import CmdSet, Command, DefaultRoom
|
||||||
from evennia import utils, create_object, search_object
|
from evennia import utils, create_object, search_object
|
||||||
from evennia import syscmdkeys, default_cmds
|
from evennia import syscmdkeys, default_cmds
|
||||||
from evennia.contrib.tutorial_world.objects import LightSource
|
from .objects import LightSource
|
||||||
|
|
||||||
# the system error-handling module is defined in the settings. We load the
|
# the system error-handling module is defined in the settings. We load the
|
||||||
# given setting here using utils.object_from_module. This way we can use
|
# given setting here using utils.object_from_module. This way we can use
|
||||||
|
|
@ -1158,7 +1158,7 @@ class OutroRoom(TutorialRoom):
|
||||||
del character.db.combat_parry_mode
|
del character.db.combat_parry_mode
|
||||||
del character.db.tutorial_bridge_position
|
del character.db.tutorial_bridge_position
|
||||||
for obj in character.contents:
|
for obj in character.contents:
|
||||||
if obj.typeclass_path.startswith("evennia.contrib.tutorial_world"):
|
if obj.typeclass_path.startswith("evennia.contrib.tutorials.tutorial_world"):
|
||||||
obj.delete()
|
obj.delete()
|
||||||
character.tags.clear(category="tutorial_world")
|
character.tags.clear(category="tutorial_world")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,8 @@ from twisted.trial.unittest import TestCase as TwistedTestCase
|
||||||
from twisted.internet.base import DelayedCall
|
from twisted.internet.base import DelayedCall
|
||||||
from evennia.commands.default.tests import CommandTest
|
from evennia.commands.default.tests import CommandTest
|
||||||
from evennia.utils.create import create_object
|
from evennia.utils.create import create_object
|
||||||
from evennia.contrib.tutorial_world import mob, objects as tutobjects
|
|
||||||
from evennia.utils.test_resources import EvenniaTest, mockdelay, mockdeferLater
|
from evennia.utils.test_resources import EvenniaTest, mockdelay, mockdeferLater
|
||||||
from evennia.contrib.tutorial_world import rooms as tutrooms
|
from . import mob, objects as tutobjects, rooms as tutrooms
|
||||||
|
|
||||||
|
|
||||||
class TestTutorialWorldMob(EvenniaTest):
|
class TestTutorialWorldMob(EvenniaTest):
|
||||||
|
|
@ -59,7 +58,7 @@ class TestTutorialWorldObjects(TwistedTestCase, CommandTest):
|
||||||
obelisk = create_object(tutobjects.Obelisk, key="obelisk", location=self.room1)
|
obelisk = create_object(tutobjects.Obelisk, key="obelisk", location=self.room1)
|
||||||
self.assertEqual(obelisk.return_appearance(self.char1).startswith("|cobelisk("), True)
|
self.assertEqual(obelisk.return_appearance(self.char1).startswith("|cobelisk("), True)
|
||||||
|
|
||||||
@patch("evennia.contrib.tutorial_world.objects.delay", mockdelay)
|
@patch("evennia.contrib.tutorials.tutorial_world.objects.delay", mockdelay)
|
||||||
@patch("evennia.scripts.taskhandler.deferLater", mockdeferLater)
|
@patch("evennia.scripts.taskhandler.deferLater", mockdeferLater)
|
||||||
def test_lightsource(self):
|
def test_lightsource(self):
|
||||||
light = create_object(tutobjects.LightSource, key="torch", location=self.room1)
|
light = create_object(tutobjects.LightSource, key="torch", location=self.room1)
|
||||||
|
|
@ -71,7 +70,7 @@ class TestTutorialWorldObjects(TwistedTestCase, CommandTest):
|
||||||
)
|
)
|
||||||
self.assertFalse(light.pk)
|
self.assertFalse(light.pk)
|
||||||
|
|
||||||
@patch("evennia.contrib.tutorial_world.objects.delay", mockdelay)
|
@patch("evennia.contrib.tutorials.tutorial_world.objects.delay", mockdelay)
|
||||||
@patch("evennia.scripts.taskhandler.deferLater", mockdeferLater)
|
@patch("evennia.scripts.taskhandler.deferLater", mockdeferLater)
|
||||||
def test_crumblingwall(self):
|
def test_crumblingwall(self):
|
||||||
wall = create_object(tutobjects.CrumblingWall, key="wall", location=self.room1)
|
wall = create_object(tutobjects.CrumblingWall, key="wall", location=self.room1)
|
||||||
|
|
|
||||||
0
evennia/contrib/utils/__init__.py
Normal file
0
evennia/contrib/utils/__init__.py
Normal file
|
|
@ -1,5 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Module containing the test cases for the Audit system.
|
Module containing the test cases for the Audit system.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from anything import Anything
|
from anything import Anything
|
||||||
|
|
@ -28,7 +29,7 @@ class AuditingTest(EvenniaTest):
|
||||||
"@ccreate channel = for channeling",
|
"@ccreate channel = for channeling",
|
||||||
"@create/drop some stuff",
|
"@create/drop some stuff",
|
||||||
"@create rock",
|
"@create rock",
|
||||||
"@create a pretty shirt : evennia.contrib.clothing.Clothing",
|
"@create a pretty shirt : evennia.contrib.game_systems.clothing.Clothing",
|
||||||
"@charcreate johnnyefhiwuhefwhef",
|
"@charcreate johnnyefhiwuhefwhef",
|
||||||
'Command "@logout" is not available. Maybe you meant "@color" or "@cboot"?',
|
'Command "@logout" is not available. Maybe you meant "@color" or "@cboot"?',
|
||||||
'/me says, "what is the password?"',
|
'/me says, "what is the password?"',
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ def init_fill_field(
|
||||||
# Initialize menu of selections
|
# Initialize menu of selections
|
||||||
FieldEvMenu(
|
FieldEvMenu(
|
||||||
caller,
|
caller,
|
||||||
"evennia.contrib.fieldfill",
|
"evennia.contrib.utils.fieldfill",
|
||||||
startnode="menunode_fieldfill",
|
startnode="menunode_fieldfill",
|
||||||
auto_look=False,
|
auto_look=False,
|
||||||
persistent=persistent,
|
persistent=persistent,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ Here's a very simple example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
||||||
from evennia.contrib.random_string_generator import RandomStringGenerator
|
from evennia.contrib.utils.random_string_generator import RandomStringGenerator
|
||||||
|
|
||||||
# Create a generator for phone numbers
|
# Create a generator for phone numbers
|
||||||
phone_generator = RandomStringGenerator("phone number", r"555-[0-9]{3}-[0-9]{4}")
|
phone_generator = RandomStringGenerator("phone number", r"555-[0-9]{3}-[0-9]{4}")
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ stored and won't be available again in order to avoid repetition.
|
||||||
Here's a very simple example:
|
Here's a very simple example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from evennia.contrib.random_string_generator import RandomStringGenerator
|
from evennia.contrib.utils.random_string_generator import RandomStringGenerator
|
||||||
# Create a generator for phone numbers
|
# Create a generator for phone numbers
|
||||||
phone_generator = RandomStringGenerator("phone number", r"555-[0-9]{3}-[0-9]{4}")
|
phone_generator = RandomStringGenerator("phone number", r"555-[0-9]{3}-[0-9]{4}")
|
||||||
# Generate a phone number (555-XXX-XXXX with X as numbers)
|
# Generate a phone number (555-XXX-XXXX with X as numbers)
|
||||||
|
|
@ -156,7 +156,7 @@ class RandomStringGenerator:
|
||||||
self._find_elements(regex)
|
self._find_elements(regex)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<evennia.contrib.tutorials.random_string_generator.RandomStringGenerator for {}>".format(
|
return "<evennia.contrib.utils.random_string_generator.RandomStringGenerator for {}>".format(
|
||||||
self.name
|
self.name
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -169,7 +169,7 @@ class RandomStringGenerator:
|
||||||
script = ScriptDB.objects.get(db_key="generator_script")
|
script = ScriptDB.objects.get(db_key="generator_script")
|
||||||
except ScriptDB.DoesNotExist:
|
except ScriptDB.DoesNotExist:
|
||||||
script = create_script(
|
script = create_script(
|
||||||
"contrib.tutorials.random_string_generator.RandomStringGeneratorScript")
|
"evennia.contrib.utils.random_string_generator.RandomStringGeneratorScript")
|
||||||
|
|
||||||
type(self).script = script
|
type(self).script = script
|
||||||
return script
|
return script
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ def init_tree_selection(
|
||||||
# Initialize menu of selections
|
# Initialize menu of selections
|
||||||
evmenu.EvMenu(
|
evmenu.EvMenu(
|
||||||
caller,
|
caller,
|
||||||
"evennia.contrib.tree_select",
|
"evennia.contrib.utils.tree_select",
|
||||||
startnode="menunode_treeselect",
|
startnode="menunode_treeselect",
|
||||||
startnode_input=None,
|
startnode_input=None,
|
||||||
cmd_on_exit=cmd_on_exit,
|
cmd_on_exit=cmd_on_exit,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue