Creature exported funcs

develop
RusAnon 2010-05-03 18:25:23 +11:00
parent 9f5220235a
commit 9d770b9b76
1 changed files with 25 additions and 16 deletions

@ -3,23 +3,32 @@
Python class for DF_Hack::Creature
"""
from ._pydfhack import _CreatureManager
class Creature(_CreatureManager):
from .mixins import NeedsStart
from .decorators import suspend
class Creature(NeedsStart, _CreatureManager):
api = None
started = False
cls = _CreatureManager
def __init__(self, api, *args, **kwds):
_CreatureManager.__init__(self, args, kwds)
cls.__init__(self, args, kwds)
self.api = api
def prepare(self):
"""
Enforce Suspend/Start
"""
if self.api.prepare():
if not self.started:
self.started = self.Start()
return self.started
else:
return False
@suspend
def Read_Creature(self, *args, **kw):
return self.cls.Read_Creature(self, *args, **kw)
@suspend
def Get_Dwarf_Race_Index(self, *args, **kw):
return self.cls.Get_Dwarf_Race_Index(self, *args, **kw)
@suspend
def Write_Labors(self, *args, **kw):
return self.cls.Write_Labors(self, *args, **kw)
@suspend
def Read_Creature_In_Box(self, *args, **kw):
return self.cls.Read_Creature_In_Box(self, *args, **kw)
@suspend
def Get_Dwarf_Civ_id(self, *args, **kw):
return self.cls.Get_Dwarf_Civ_id(self, *args, **kw)