Added some batch and prototype examples. Need to ponder how to handle migrations of proxies under evennia/.

This commit is contained in:
Griatch 2015-01-09 01:03:04 +01:00
parent 515ce71d65
commit 5afb5c9638
2 changed files with 77 additions and 37 deletions

View file

@ -0,0 +1,26 @@
#
# A batch-command file is a way to build a game world
# in a programmatic way, by placing a sequence of
# build commands after one another. This allows for
# using a real text editor to edit e.g. descriptions
# rather than entering text on the command line.
#
# A batch-command file is loaded with @batchprocess in-game:
#
# @batchprocess[/interactive] tutorial_examples.batch_cmds
#
# A # as the first symbol on a line begins a comment and
# marks the end of a previous command definition. This is important,
# - every command must be separated by at least one line of comment.
#
# All supplied commands are given as normal, on their own line
# and accepts arguments in any format up until the first next
# comment line begins. Extra whitespace is removed; an empty
# line in a command definition translates into a newline.
#
# See <evennia-root>/contrib/tutorial_examples/batch_cmds.ev for
# an example of a batch-command code. See also the batch-code
# system for loading python-code in this way.
#

View file

@ -1,7 +1,21 @@
"""
Example prototypes read by the @spawn command but is also easily
available to use from code. Each prototype should be a dictionary. Use
the same name as the variable to refer to other prototypes.
Prototypes
A prototype is a simple way to create individualized instances of a
given Typeclass. For example, you might have a Sword typeclass that
implements everything a Sword would need to do. The only difference
between different individual Swords would be their key, description
and some Attributes. The Prototype system allows to create a range of
such Swords with only minor variations. Prototypes can also inherit
and combine together to form entire hierarchies (such as giving all
Sabres and all Broadswords some common properties). Note that bigger
variations, such as custom commands or functionality belong in a
hierarchy of typeclasses instead.
Example prototypes are read by the @spawn command but is also easily
available to use from code via evennia.spawn or evennia.utils.spawner.
Each prototype should be a dictionary. Use the same name as the
variable to refer to other prototypes.
Possible keywords are:
prototype - string pointing to parent prototype of this structure
@ -15,42 +29,42 @@ Possible keywords are:
locks - a lock-string
aliases - string or list of strings
ndb_<name> - value of a nattribute (ndb_ is stripped)
ndb_<name> - value of a nattribute (the "ndb_" part is ignored)
any other keywords are interpreted as Attributes and their values.
See the @spawn command and src.utils.spawner for more info.
See the @spawn command and evennia.utils.spawner for more info.
"""
from random import randint
NOBODY = {}
GOBLIN = {
"key": "goblin grunt",
"health": lambda: randint(20,30),
"resists": ["cold", "poison"],
"attacks": ["fists"],
"weaknesses": ["fire", "light"]
}
GOBLIN_WIZARD = {
"prototype": "GOBLIN",
"key": "goblin wizard",
"spells": ["fire ball", "lighting bolt"]
}
GOBLIN_ARCHER = {
"prototype": "GOBLIN",
"key": "goblin archer",
"attacks": ["short bow"]
}
ARCHWIZARD = {
"attacks": ["archwizard staff"],
}
GOBLIN_ARCHWIZARD = {
"key": "goblin archwizard",
"prototype" : ("GOBLIN_WIZARD", "ARCHWIZARD")
}
#from random import randint
#
#NOBODY = {}
#
#GOBLIN = {
# "key": "goblin grunt",
# "health": lambda: randint(20,30),
# "resists": ["cold", "poison"],
# "attacks": ["fists"],
# "weaknesses": ["fire", "light"]
# }
#
#GOBLIN_WIZARD = {
# "prototype": "GOBLIN",
# "key": "goblin wizard",
# "spells": ["fire ball", "lighting bolt"]
# }
#
#GOBLIN_ARCHER = {
# "prototype": "GOBLIN",
# "key": "goblin archer",
# "attacks": ["short bow"]
#}
#
#ARCHWIZARD = {
# "attacks": ["archwizard staff"],
#}
#
#GOBLIN_ARCHWIZARD = {
# "key": "goblin archwizard",
# "prototype" : ("GOBLIN_WIZARD", "ARCHWIZARD")
#}