Added some batch and prototype examples. Need to ponder how to handle migrations of proxies under evennia/.
This commit is contained in:
parent
515ce71d65
commit
5afb5c9638
2 changed files with 77 additions and 37 deletions
26
game_template/world/batch_cmds.ev
Normal file
26
game_template/world/batch_cmds.ev
Normal 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,7 +1,21 @@
|
||||||
"""
|
"""
|
||||||
Example prototypes read by the @spawn command but is also easily
|
Prototypes
|
||||||
available to use from code. Each prototype should be a dictionary. Use
|
|
||||||
the same name as the variable to refer to other 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:
|
Possible keywords are:
|
||||||
prototype - string pointing to parent prototype of this structure
|
prototype - string pointing to parent prototype of this structure
|
||||||
|
|
@ -15,42 +29,42 @@ Possible keywords are:
|
||||||
locks - a lock-string
|
locks - a lock-string
|
||||||
aliases - string or list of strings
|
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.
|
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
|
#from random import randint
|
||||||
|
#
|
||||||
NOBODY = {}
|
#NOBODY = {}
|
||||||
|
#
|
||||||
GOBLIN = {
|
#GOBLIN = {
|
||||||
"key": "goblin grunt",
|
# "key": "goblin grunt",
|
||||||
"health": lambda: randint(20,30),
|
# "health": lambda: randint(20,30),
|
||||||
"resists": ["cold", "poison"],
|
# "resists": ["cold", "poison"],
|
||||||
"attacks": ["fists"],
|
# "attacks": ["fists"],
|
||||||
"weaknesses": ["fire", "light"]
|
# "weaknesses": ["fire", "light"]
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
GOBLIN_WIZARD = {
|
#GOBLIN_WIZARD = {
|
||||||
"prototype": "GOBLIN",
|
# "prototype": "GOBLIN",
|
||||||
"key": "goblin wizard",
|
# "key": "goblin wizard",
|
||||||
"spells": ["fire ball", "lighting bolt"]
|
# "spells": ["fire ball", "lighting bolt"]
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
GOBLIN_ARCHER = {
|
#GOBLIN_ARCHER = {
|
||||||
"prototype": "GOBLIN",
|
# "prototype": "GOBLIN",
|
||||||
"key": "goblin archer",
|
# "key": "goblin archer",
|
||||||
"attacks": ["short bow"]
|
# "attacks": ["short bow"]
|
||||||
}
|
#}
|
||||||
|
#
|
||||||
ARCHWIZARD = {
|
#ARCHWIZARD = {
|
||||||
"attacks": ["archwizard staff"],
|
# "attacks": ["archwizard staff"],
|
||||||
}
|
#}
|
||||||
|
#
|
||||||
GOBLIN_ARCHWIZARD = {
|
#GOBLIN_ARCHWIZARD = {
|
||||||
"key": "goblin archwizard",
|
# "key": "goblin archwizard",
|
||||||
"prototype" : ("GOBLIN_WIZARD", "ARCHWIZARD")
|
# "prototype" : ("GOBLIN_WIZARD", "ARCHWIZARD")
|
||||||
}
|
#}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue