Materials exported funcs

develop
RusAnon 2010-05-03 18:21:55 +11:00
parent d507974e8e
commit 9f5220235a
1 changed files with 32 additions and 15 deletions

@ -3,23 +3,40 @@
Python class for DF_Hack::Materials
"""
from ._pydfhack import _MaterialsManager
class Materials(_MaterialsManager):
from .mixins import NoStart
from .decorators import suspend
class Materials(NoStart, _MaterialsManager):
api = None
started = False
cls = _MaterialsManager
def __init__(self, api, *args, **kwds):
_MaterialsManager.__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_Wood_Materials(self, *args, **kw):
return self.cls.Read_Wood_Materials(self, *args, **kw)
@suspend
def Read_Plant_Materials(self, *args, **kw):
return self.cls.Read_Plant_Materials(self, *args, **kw)
@suspend
def Read_Inorganic_Materials(self, *args, **kw):
return self.cls.Read_Inorganic_Materials(self, *args, **kw)
@suspend
def Read_Descriptor_Colors(self, *args, **kw):
return self.cls.Read_Descriptor_Colors(self, *args, **kw)
@suspend
def Read_Creature_Types(self, *args, **kw):
return self.cls.Read_Creature_Types(self, *args, **kw)
@suspend
def Read_Organic_Materials(self, *args, **kw):
return self.cls.Read_Organic_Materials(self, *args, **kw)
@suspend
def Read_Creature_Types_Ex(self, *args, **kw):
return self.cls.Read_Creature_Types_Ex(self, *args, **kw)