Some fixes and cleanups
This commit is contained in:
parent
7293af5d5a
commit
74dd57e85f
2 changed files with 54 additions and 15 deletions
|
|
@ -111,6 +111,15 @@
|
||||||
- `tb_items` - Extends `tb_equip` with item use with conditions/status effects.
|
- `tb_items` - Extends `tb_equip` with item use with conditions/status effects.
|
||||||
- `tb_magic` - Extends `tb_equip` with spellcasting.
|
- `tb_magic` - Extends `tb_equip` with spellcasting.
|
||||||
- `tb_range` - Adds system for abstract positioning and movement.
|
- `tb_range` - Adds system for abstract positioning and movement.
|
||||||
|
- The `extended_room` contrib saw some backwards-incompatible refactoring:
|
||||||
|
- All commands now begin with `CmdExtendedRoom`. So before it was `CmdExtendedLook`, now
|
||||||
|
it's `CmdExtendedRoomLook` etc.
|
||||||
|
- The `detail` command was broken out of the `desc` command and is now a new, stand-alone command
|
||||||
|
`CmdExtendedRoomDetail`. This was done to make things easier to extend and to mimic how the detail
|
||||||
|
command works in the tutorial-world.
|
||||||
|
- The `detail` command now also supports deleting details (like the tutorial-world version).
|
||||||
|
- The new `ExtendedRoomCmdSet` includes all the extended-room commands and is now the recommended way
|
||||||
|
to install the extended-room contrib.
|
||||||
- Updates and some cleanup of existing contribs.
|
- Updates and some cleanup of existing contribs.
|
||||||
|
|
||||||
# Overviews
|
# Overviews
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Extended Room
|
Extended Room
|
||||||
|
|
||||||
Evennia Contribution - Griatch 2012
|
Evennia Contribution - Griatch 2012, vincent-lg 2019
|
||||||
|
|
||||||
This is an extended Room typeclass for Evennia. It is supported
|
This is an extended Room typeclass for Evennia. It is supported
|
||||||
by an extended `Look` command and an extended `desc` command, also
|
by an extended `Look` command and an extended `desc` command, also
|
||||||
|
|
@ -50,21 +50,36 @@ if applicable. The `@detail` command is used to change details.
|
||||||
|
|
||||||
4) Extra commands
|
4) Extra commands
|
||||||
|
|
||||||
CmdExtendedLook - look command supporting room details
|
CmdExtendedRoomLook - look command supporting room details
|
||||||
CmdExtendedDesc - desc command allowing to add seasonal descs,
|
CmdExtendedRoomDesc - desc command allowing to add seasonal descs,
|
||||||
CmdSetDetail - command allowing to manipulate details in this room
|
CmdExtendedRoomDetail - command allowing to manipulate details in this room
|
||||||
as well as listing them
|
as well as listing them
|
||||||
CmdGameTime - A simple `time` command, displaying the current
|
CmdExtendedRoomGameTime - A simple `time` command, displaying the current
|
||||||
time and season.
|
time and season.
|
||||||
|
|
||||||
|
|
||||||
Installation/testing:
|
Installation/testing:
|
||||||
|
|
||||||
1) Add `CmdExtendedLook`, `CmdExtendedDesc`, `CmdDetail` and `CmdGameTime` to the default `cmdset`
|
Adding the `ExtendedRoomCmdset` to the default character cmdset will add all
|
||||||
(see Wiki for how to do this).
|
new commands for use.
|
||||||
2) `@dig` a room of type `contrib.extended_room.ExtendedRoom` (or make it the
|
|
||||||
default room type)
|
In more detail, in mygame/commands/default_cmdsets.py:
|
||||||
3) Use `desc` and `detail` to customize the room, then play around!
|
|
||||||
|
```
|
||||||
|
...
|
||||||
|
from evennia.contrib import extended_room # <-new
|
||||||
|
|
||||||
|
class CharacterCmdset(default_cmds.Character_CmdSet):
|
||||||
|
...
|
||||||
|
def at_cmdset_creation(self):
|
||||||
|
...
|
||||||
|
self.add(extended_room.ExtendedRoomCmdSet) # <-new
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Then reload to make the bew commands available. Note that they only work
|
||||||
|
on rooms with the typeclass `ExtendedRoom`. Create new rooms with the right
|
||||||
|
typeclass or use the `typeclass` command to swap existing rooms.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
@ -76,6 +91,7 @@ from evennia import DefaultRoom
|
||||||
from evennia import gametime
|
from evennia import gametime
|
||||||
from evennia import default_cmds
|
from evennia import default_cmds
|
||||||
from evennia import utils
|
from evennia import utils
|
||||||
|
from evennia import CmdSet
|
||||||
|
|
||||||
# error return function, needed by Extended Look command
|
# error return function, needed by Extended Look command
|
||||||
_AT_SEARCH_RESULT = utils.variable_from_module(*settings.SEARCH_AT_RESULT.rsplit('.', 1))
|
_AT_SEARCH_RESULT = utils.variable_from_module(*settings.SEARCH_AT_RESULT.rsplit('.', 1))
|
||||||
|
|
@ -305,7 +321,7 @@ class ExtendedRoom(DefaultRoom):
|
||||||
# Custom Look command supporting Room details. Add this to
|
# Custom Look command supporting Room details. Add this to
|
||||||
# the Default cmdset to use.
|
# the Default cmdset to use.
|
||||||
|
|
||||||
class CmdExtendedLook(default_cmds.CmdLook):
|
class CmdExtendedRoomLook(default_cmds.CmdLook):
|
||||||
"""
|
"""
|
||||||
look
|
look
|
||||||
|
|
||||||
|
|
@ -366,7 +382,7 @@ class CmdExtendedLook(default_cmds.CmdLook):
|
||||||
# Custom build commands for setting seasonal descriptions
|
# Custom build commands for setting seasonal descriptions
|
||||||
# and detailing extended rooms.
|
# and detailing extended rooms.
|
||||||
|
|
||||||
class CmdExtendedDesc(default_cmds.CmdDesc):
|
class CmdExtendedRoomDesc(default_cmds.CmdDesc):
|
||||||
"""
|
"""
|
||||||
`desc` - describe an object or room.
|
`desc` - describe an object or room.
|
||||||
|
|
||||||
|
|
@ -457,7 +473,7 @@ class CmdExtendedDesc(default_cmds.CmdDesc):
|
||||||
caller.msg("The description was set on %s." % obj.key)
|
caller.msg("The description was set on %s." % obj.key)
|
||||||
|
|
||||||
|
|
||||||
class CmdSetDetail(default_cmds.MuxCommand):
|
class CmdExtendedRoomDetail(default_cmds.MuxCommand):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sets a detail on a room
|
sets a detail on a room
|
||||||
|
|
@ -505,7 +521,7 @@ class CmdSetDetail(default_cmds.MuxCommand):
|
||||||
self.msg("Detail '{}' not found.".format(self.lhs))
|
self.msg("Detail '{}' not found.".format(self.lhs))
|
||||||
return
|
return
|
||||||
|
|
||||||
method = "set_detail" if "del" not in self.switches else "del_detail"
|
method = "set_detail" if "del" not in self.switches else "del_detail"
|
||||||
if not hasattr(location, method):
|
if not hasattr(location, method):
|
||||||
self.caller.msg("Details cannot be set on %s." % location)
|
self.caller.msg("Details cannot be set on %s." % location)
|
||||||
return
|
return
|
||||||
|
|
@ -521,7 +537,7 @@ class CmdSetDetail(default_cmds.MuxCommand):
|
||||||
|
|
||||||
# Simple command to view the current time and season
|
# Simple command to view the current time and season
|
||||||
|
|
||||||
class CmdGameTime(default_cmds.MuxCommand):
|
class CmdExtendedRoomGameTime(default_cmds.MuxCommand):
|
||||||
"""
|
"""
|
||||||
Check the game time
|
Check the game time
|
||||||
|
|
||||||
|
|
@ -545,3 +561,17 @@ class CmdGameTime(default_cmds.MuxCommand):
|
||||||
if season == "autumn":
|
if season == "autumn":
|
||||||
prep = "an"
|
prep = "an"
|
||||||
self.caller.msg("It's %s %s day, in the %s." % (prep, season, timeslot))
|
self.caller.msg("It's %s %s day, in the %s." % (prep, season, timeslot))
|
||||||
|
|
||||||
|
|
||||||
|
# CmdSet for easily install all commands
|
||||||
|
|
||||||
|
class ExtendedRoomCmdSet(CmdSet):
|
||||||
|
"""
|
||||||
|
Groups the extended-room commands.
|
||||||
|
|
||||||
|
"""
|
||||||
|
def at_cmdset_creation(self):
|
||||||
|
self.add(CmdExtendedRoomLook)
|
||||||
|
self.add(CmdExtendedRoomDesc)
|
||||||
|
self.add(CmdExtendedRoomDetail)
|
||||||
|
self.add(CmdExtendedRoomGameTime)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue