Add proper header to components contrib
This commit is contained in:
parent
2cbb0ae1fc
commit
bc92bad15a
1 changed files with 5 additions and 3 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
# Components
|
# Components
|
||||||
|
|
||||||
_Contrib by ChrisLR 2021_
|
Contrib by ChrisLR, 2021
|
||||||
|
|
||||||
|
Expand typeclasses using a components/composition approach.
|
||||||
|
|
||||||
## The Components Contrib
|
## The Components Contrib
|
||||||
|
|
||||||
|
|
@ -134,7 +136,7 @@ from evennia.contrib.base_systems import components
|
||||||
# This is the Component class
|
# This is the Component class
|
||||||
class Health(components.Component):
|
class Health(components.Component):
|
||||||
name = "health"
|
name = "health"
|
||||||
|
|
||||||
# Stores the current and max values as Attributes on the host, defaulting to 100
|
# Stores the current and max values as Attributes on the host, defaulting to 100
|
||||||
current = components.DBField(default=100)
|
current = components.DBField(default=100)
|
||||||
max = components.DBField(default=100)
|
max = components.DBField(default=100)
|
||||||
|
|
@ -185,7 +187,7 @@ class Attack(Command):
|
||||||
# Attempt to retrieve the component, None is obtained if it does not exist.
|
# Attempt to retrieve the component, None is obtained if it does not exist.
|
||||||
if target.components.health:
|
if target.components.health:
|
||||||
valid_target = target
|
valid_target = target
|
||||||
|
|
||||||
if not valid_target:
|
if not valid_target:
|
||||||
caller.msg("You can't attack that!")
|
caller.msg("You can't attack that!")
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue