va

voxel-attr

Simple attribute (think DnD) module for voxel.js

Showing:

Popularity

Downloads/wk

1

GitHub Stars

5

Maintenance

Last Commit

7yrs ago

Contributors

0

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

voxel-attr

Simple attribute (think DnD) module for voxel.js

Build Status

How-to

  • Load with voxel-plugins

##Options

  • roll('attr') (sets to 1)
  • mod('attr') (sets to Math.max(1, current value/10))

##Usage

  • Attributes are stored as a list of ints in a dictionary
    * Default dictionary for exaple:
    ```javascript
        default_d={
            //[current, min, max, mod]
            "str":[1, 0, 99, 0],
            "dex":[1, 0, 99, 0],
            "con":[1, 0, 99, 0],
            "int":[1, 0, 99, 0],
            "wis":[1, 0, 99, 0],
            "cha":[1, 0, 99, 0]
        }
    ```
    
    ####Methods
  • get('attr') -- Returns list of values for given attribute from dictionart
    • You can also use getMin, getMax, etc. These return a int
  • set('attr', [current, min, max, mod]) -- Sets the values for given attribute to given list
    • You can also use setMin, setMax, etc. These take attribute name and single value
  • mod('attr') -- sets the mod value of given attr, you can change this by passing it into the options
  • inc('attr', value) -- Increases the current value of given attribute by value
  • dec('attr', value) -- Decreases the current value of given attribute by value ####Events
  • attrchange (attr, oldvalue, currentvalue, difference)
  • attrinc (attr, newvalue)
  • attrdec (attr, oldvalue)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial