-
Notifications
You must be signed in to change notification settings - Fork 4
/
text.py
43 lines (36 loc) · 1.05 KB
/
text.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from compositecore import Leaf
class Description(Leaf):
"""
Composites holding this has some describing text and a name.
"""
def __init__(self, name, description):
super(Description, self).__init__()
self.component_type = "description"
self._name = name
self.description = description
@property
def name(self):
return self._name
@property
def long_name(self):
if self.parent.has("is_named"):
return self._name
else:
return "the " + self._name
@name.setter
def name(self, value):
self._name = value
def copy(self):
"""
Makes a copy of this component.
"""
return Description(self.name, self.description)
class EntityMessages(Leaf):
"""
Holds the text messages that may be sent by the parent entity.
"""
def __init__(self, notice, death):
super(EntityMessages, self).__init__()
self.component_type = "entity_messages"
self.notice = notice
self.death = death