Advertisement
Kovitikus

old prototypes.py?

Sep 6th, 2020
1,382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.47 KB | None | 0 0
  1. """
  2. Prototypes
  3.  
  4. A prototype is a simple way to create individualized instances of a
  5. given `Typeclass`. For example, you might have a Sword typeclass that
  6. implements everything a Sword would need to do. The only difference
  7. between different individual Swords would be their key, description
  8. and some Attributes. The Prototype system allows to create a range of
  9. such Swords with only minor variations. Prototypes can also inherit
  10. and combine together to form entire hierarchies (such as giving all
  11. Sabres and all Broadswords some common properties). Note that bigger
  12. variations, such as custom commands or functionality belong in a
  13. hierarchy of typeclasses instead.
  14.  
  15. Example prototypes are read by the `@spawn` command but is also easily
  16. available to use from code via `evennia.spawn` or `evennia.utils.spawner`.
  17. Each prototype should be a dictionary. Use the same name as the
  18. variable to refer to other prototypes.
  19.  
  20. Possible keywords are:
  21.    prototype - string pointing to parent prototype of this structure.
  22.    key - string, the main object identifier.
  23.    typeclass - string, if not set, will use `settings.BASE_OBJECT_TYPECLASS`.
  24.    location - this should be a valid object or #dbref.
  25.    home - valid object or #dbref.
  26.    destination - only valid for exits (object or dbref).
  27.  
  28.    permissions - string or list of permission strings.
  29.    locks - a lock-string.
  30.    aliases - string or list of strings.
  31.  
  32.    ndb_<name> - value of a nattribute (the "ndb_" part is ignored).
  33.    any other keywords are interpreted as Attributes and their values.
  34.  
  35. See the `@spawn` command and `evennia.utils.spawner` for more info.
  36.  
  37. """
  38.  
  39. #from random import randint
  40. #
  41. # GOBLIN = {
  42. # "key": "goblin grunt",
  43. # "health": lambda: randint(20,30),
  44. # "resists": ["cold", "poison"],
  45. # "attacks": ["fists"],
  46. # "weaknesses": ["fire", "light"]
  47. # }
  48. #
  49. # GOBLIN_WIZARD = {
  50. # "prototype": "GOBLIN",
  51. # "key": "goblin wizard",
  52. # "spells": ["fire ball", "lighting bolt"]
  53. # }
  54. #
  55. # GOBLIN_ARCHER = {
  56. # "prototype": "GOBLIN",
  57. # "key": "goblin archer",
  58. # "attacks": ["short bow"]
  59. #}
  60. #
  61. # This is an example of a prototype without a prototype
  62. # (nor key) of its own, so it should normally only be
  63. # used as a mix-in, as in the example of the goblin
  64. # archwizard below.
  65. # ARCHWIZARD_MIXIN = {
  66. # "attacks": ["archwizard staff"],
  67. # "spells": ["greater fire ball", "greater lighting"]
  68. #}
  69. #
  70. # GOBLIN_ARCHWIZARD = {
  71. # "key": "goblin archwizard",
  72. # "prototype" : ("GOBLIN_WIZARD", "ARCHWIZARD_MIXIN")
  73. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement