2016-02-11 05:09:46 +01:00
|
|
|
#The Armor Monoid
|
|
|
|
|
2016-08-05 22:45:03 +02:00
|
|
|
This mod provides a player_monoids monoid for handling armor groups. It
|
|
|
|
provides a monoid for damage resistance, and a way to register new damage types
|
2017-03-06 00:30:12 +01:00
|
|
|
for players.
|
2016-02-11 05:09:46 +01:00
|
|
|
|
|
|
|
Using the monoid
|
|
|
|
================
|
|
|
|
The values in the monoid are tables mapping armor group names to damage
|
2016-08-05 22:45:03 +02:00
|
|
|
multipliers. For example, if I wanted to apply an effect granting arcane
|
2016-02-11 05:09:46 +01:00
|
|
|
damage resistance but fleshy damage vulnerability, I could do <br/>
|
|
|
|
```
|
2016-08-05 22:45:03 +02:00
|
|
|
local tab = {
|
2016-08-05 22:53:33 +02:00
|
|
|
arcane = 0.5,
|
|
|
|
fleshy = 1.5,
|
2016-08-05 22:45:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
armor_monoid.monoid:add_change(player, tab, "mymod:arcane_boost")
|
2016-02-11 05:09:46 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Registering damage types
|
|
|
|
========================
|
|
|
|
To add a new damage type to players, use armor_monoid.register_armor_group. For
|
|
|
|
example: <br/>
|
|
|
|
```
|
|
|
|
armor_monoid.register_armor_group("arcane", 100)
|
|
|
|
```
|
|
|
|
<br/>
|
|
|
|
As you can see, the argument is not a multiplier, but the base armor group
|
|
|
|
rating. Calling this would mean players start off with an armor rating in
|
|
|
|
"arcane" of 100 (no protection).
|