mirror of
https://github.com/evennia/evennia.git
synced 2026-03-20 06:46:31 +01:00
Add an example to documentation.
This commit is contained in:
parent
29896a82e8
commit
5ce63ae52b
1 changed files with 13 additions and 0 deletions
|
|
@ -34,6 +34,19 @@ db_attribute parameter.
|
|||
@lazy_property
|
||||
def cooldowns(self):
|
||||
return CooldownHandler(self, db_attribute="cooldowns")
|
||||
|
||||
Example:
|
||||
|
||||
Assuming you've installed cooldowns on your Character typeclasses, you can
|
||||
use a cooldown to limit how often you can perform a command:
|
||||
|
||||
class PowerAttack(Command):
|
||||
def func(self):
|
||||
if self.caller.cooldowns.ready("power attack"):
|
||||
self.do_power_attack()
|
||||
self.caller.cooldowns.set("power attack", 10)
|
||||
else:
|
||||
self.caller.msg("That's not ready yet!")
|
||||
"""
|
||||
|
||||
import math
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue