From a2ae90d1ce04f605c2d0b0c125c4847653674da7 Mon Sep 17 00:00:00 2001 From: InspectorCaracal <51038201+InspectorCaracal@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:17:52 -0700 Subject: [PATCH] update traits contrib readme --- evennia/contrib/rpg/traits/README.md | 52 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/evennia/contrib/rpg/traits/README.md b/evennia/contrib/rpg/traits/README.md index 86254b350e..511233f15d 100644 --- a/evennia/contrib/rpg/traits/README.md +++ b/evennia/contrib/rpg/traits/README.md @@ -171,7 +171,32 @@ if trait1 > trait2: ``` -## Static trait +### Trait + +A single value of any type. + +This is the 'base' Trait, meant to inherit from if you want to invent +trait-types from scratch (most of the time you'll probably inherit from some of +the more advanced trait-type classes though). + +Unlike other Trait-types, the single `.value` property of the base `Trait` can +be editied. The value can hold any data that can be stored in an Attribute. If +it's an integer/float you can do arithmetic with it, but otherwise this acts just +like a glorified Attribute. + + +```python +> obj.traits.add("mytrait", "My Trait", trait_type="trait", value=30) +> obj.traits.mytrait.value +30 + +> obj.traits.mytrait.value = "stringvalue" +> obj.traits.mytrait.value +"stringvalue" + +``` + +### Static trait `value = base + mod` @@ -365,31 +390,6 @@ get how filled it is as a percentage etc. The `.rate` is particularly relevant for gauges - useful for everything from poison slowly draining your health, to resting gradually increasing it. -### Trait - -A single value of any type. - -This is the 'base' Trait, meant to inherit from if you want to invent -trait-types from scratch (most of the time you'll probably inherit from some of -the more advanced trait-type classes though). - -Unlike other Trait-types, the single `.value` property of the base `Trait` can -be editied. The value can hold any data that can be stored in an Attribute. If -it's an integer/float you can do arithmetic with it, but otherwise this acts just -like a glorified Attribute. - - -```python -> obj.traits.add("mytrait", "My Trait", trait_type="trait", value=30) -> obj.traits.mytrait.value -30 - -> obj.traits.mytrait.value = "stringvalue" -> obj.traits.mytrait.value -"stringvalue" - -``` - ## Expanding with your own Traits A Trait is a class inhering from `evennia.contrib.rpg.traits.Trait` (or from one of