Use classic Markdown code blocks
This commit is contained in:
parent
cf7a0b71aa
commit
82b3e0eefc
13
API.md
13
API.md
@ -66,19 +66,16 @@ Potions, Exhaustion and Electrocution.
|
||||
Here's what it could look like:
|
||||
|
||||
Potions mod:
|
||||
```
|
||||
|
||||
playerphysics.add_physics_factor(player, "speed", "run_potion", 2)
|
||||
```
|
||||
|
||||
Exhaustion mod:
|
||||
```
|
||||
|
||||
playerphysics.add_physics_factor(player, "jump", "exhausted", 0.75)
|
||||
```
|
||||
|
||||
Electrocution mod:
|
||||
```
|
||||
|
||||
playerphysics.add_physics_factor(player, "jump", "shocked", 0.9)
|
||||
```
|
||||
|
||||
When the 3 mods have done their change, the real player speed is simply the product of all factors, that is:
|
||||
|
||||
@ -91,9 +88,7 @@ The final player speed is thus 135%.
|
||||
Let's take the example above.
|
||||
Now if the Electrocution mod is done with shocking the player, it just needs to call:
|
||||
|
||||
```
|
||||
playerphysics.remove_physics_factor(player, "jump", "shocked")
|
||||
```
|
||||
|
||||
The effect is now gone, so the new player speed will be:
|
||||
|
||||
@ -102,9 +97,7 @@ The effect is now gone, so the new player speed will be:
|
||||
### Sleeping
|
||||
To simulate sleeping by preventing all player movement, this can be done with this easy trick:
|
||||
|
||||
```
|
||||
playerphysics.add_physics_factor(player, "speed", "sleeping", 0)
|
||||
playerphysics.add_physics_factor(player, "jump", "sleeping", 0)
|
||||
```
|
||||
|
||||
This works regardless of the other factors because 0 times anything equals 0.
|
||||
|
Loading…
x
Reference in New Issue
Block a user