comparison demos/rpg/scripts/actors/baseactor.py @ 547:e59ece21ab3e

Item serialization will now assume some default values if they are not found in the save files. The 'spawn' console command can now spawn items with default values. Cleaned up some print statements.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 04 Jun 2010 21:01:34 +0000
parents 8fee2d2286e9
children 69d50e751c9a
comparison
equal deleted inserted replaced
546:8fee2d2286e9 547:e59ece21ab3e
150 if item.id == itemid: 150 if item.id == itemid:
151 itemtoremove = item 151 itemtoremove = item
152 152
153 if itemtoremove: 153 if itemtoremove:
154 self._inventory.remove(itemtoremove) 154 self._inventory.remove(itemtoremove)
155
156 def serialize(self):
157 lvars = super(Actor, self).serialize()
158
159 lvars['gold'] = self._gold
155 160
161 return lvars
162
163 def deserialize(self, valuedict):
164 super(Actor, self).deserialize(valuedict)
165
166 if valuedict.has_key("gold"):
167 self._gold = int(valuedict['gold'])
168 else:
169 self._gold = 0
156 170
157 def _getState(self): 171 def _getState(self):
158 return self._state 172 return self._state
159 173
160 def _setState(self, state): 174 def _setState(self, state):