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 Python class for DF_Hack::Creature
""" """
from ._pydfhack import _CreatureManager from ._pydfhack import _CreatureManager
class Creature(_CreatureManager): from .mixins import NeedsStart
from .decorators import suspend
class Creature(NeedsStart, _CreatureManager):
api = None api = None
started = False cls = _CreatureManager
def __init__(self, api, *args, **kwds): def __init__(self, api, *args, **kwds):
_CreatureManager.__init__(self, args, kwds) cls.__init__(self, args, kwds)
self.api = api self.api = api
def prepare(self): @suspend
""" def Read_Creature(self, *args, **kw):
Enforce Suspend/Start return self.cls.Read_Creature(self, *args, **kw)
"""
if self.api.prepare(): @suspend
if not self.started: def Get_Dwarf_Race_Index(self, *args, **kw):
self.started = self.Start() return self.cls.Get_Dwarf_Race_Index(self, *args, **kw)
return self.started
else: @suspend
return False 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)