Construction and Vegetation exports

develop
RusAnon 2010-05-03 18:31:20 +11:00
parent 9d9e7a4f24
commit f678b344d2
2 changed files with 18 additions and 32 deletions

@ -3,23 +3,16 @@
Python class for DF_Hack::Construction
"""
from ._pydfhack import _ConstructionManager
class Construction(_ConstructionManager):
from .mixins import NeedsStart
from .decorators import suspend
class Construction(NeedsStart, _ConstructionManager):
api = None
started = False
cls = _ConstructionManager
def __init__(self, api, *args, **kwds):
_ConstructionManager.__init__(self, args, kwds)
self.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(self, *args, **kw):
return self.cls.Read(self, *args, **kw)

@ -3,23 +3,16 @@
Python class for DF_Hack::Vegetation
"""
from ._pydfhack import _VegetationManager
class Vegetation(_VegetationManager):
from .mixins import NeedsStart
from .decorators import suspend
class Vegetation(NeedsStart, _VegetationManager):
api = None
started = False
cls = _VegetationManager
def __init__(self, api, *args, **kwds):
_VegetationManager.__init__(self, args, kwds)
self.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(self, *args, **kw):
return self.cls.Read(self, *args, **kw)